OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_VIDEO_CAPTURE_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_VIDEO_CAPTURE_H_ |
6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_VIDEO_CAPTURE_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_VIDEO_CAPTURE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 class PepperMediaDeviceManager; | 24 class PepperMediaDeviceManager; |
25 class PepperVideoCaptureHost; | 25 class PepperVideoCaptureHost; |
26 class RenderViewImpl; | 26 class RenderViewImpl; |
27 class VideoCaptureHandle; | 27 class VideoCaptureHandle; |
28 | 28 |
29 class PepperPlatformVideoCapture | 29 class PepperPlatformVideoCapture |
30 : public media::VideoCapture, | 30 : public media::VideoCapture, |
31 public base::RefCounted<PepperPlatformVideoCapture>, | 31 public base::RefCounted<PepperPlatformVideoCapture>, |
32 public media::VideoCapture::EventHandler { | 32 public media::VideoCapture::EventHandler { |
33 public: | 33 public: |
34 PepperPlatformVideoCapture( | 34 PepperPlatformVideoCapture(const base::WeakPtr<RenderViewImpl>& render_view, |
35 const base::WeakPtr<RenderViewImpl>& render_view, | 35 const std::string& device_id, |
36 const std::string& device_id, | 36 const GURL& document_url, |
37 const GURL& document_url, | 37 PepperVideoCaptureHost* handler); |
38 PepperVideoCaptureHost* handler); | |
39 | 38 |
40 // Detaches the event handler and stops sending notifications to it. | 39 // Detaches the event handler and stops sending notifications to it. |
41 void DetachEventHandler(); | 40 void DetachEventHandler(); |
42 | 41 |
43 // media::VideoCapture implementation. | 42 // media::VideoCapture implementation. |
44 virtual void StartCapture( | 43 virtual void StartCapture(media::VideoCapture::EventHandler* handler, |
45 media::VideoCapture::EventHandler* handler, | 44 const media::VideoCaptureParams& params) OVERRIDE; |
46 const media::VideoCaptureParams& params) OVERRIDE; | |
47 virtual void StopCapture(media::VideoCapture::EventHandler* handler) OVERRIDE; | 45 virtual void StopCapture(media::VideoCapture::EventHandler* handler) OVERRIDE; |
48 virtual bool CaptureStarted() OVERRIDE; | 46 virtual bool CaptureStarted() OVERRIDE; |
49 virtual int CaptureFrameRate() OVERRIDE; | 47 virtual int CaptureFrameRate() OVERRIDE; |
50 virtual void GetDeviceSupportedFormats( | 48 virtual void GetDeviceSupportedFormats(const DeviceFormatsCallback& callback) |
51 const DeviceFormatsCallback& callback) OVERRIDE; | 49 OVERRIDE; |
52 virtual void GetDeviceFormatsInUse( | 50 virtual void GetDeviceFormatsInUse(const DeviceFormatsInUseCallback& callback) |
53 const DeviceFormatsInUseCallback& callback) OVERRIDE; | 51 OVERRIDE; |
54 | 52 |
55 // media::VideoCapture::EventHandler implementation | 53 // media::VideoCapture::EventHandler implementation |
56 virtual void OnStarted(VideoCapture* capture) OVERRIDE; | 54 virtual void OnStarted(VideoCapture* capture) OVERRIDE; |
57 virtual void OnStopped(VideoCapture* capture) OVERRIDE; | 55 virtual void OnStopped(VideoCapture* capture) OVERRIDE; |
58 virtual void OnPaused(VideoCapture* capture) OVERRIDE; | 56 virtual void OnPaused(VideoCapture* capture) OVERRIDE; |
59 virtual void OnError(VideoCapture* capture, int error_code) OVERRIDE; | 57 virtual void OnError(VideoCapture* capture, int error_code) OVERRIDE; |
60 virtual void OnRemoved(VideoCapture* capture) OVERRIDE; | 58 virtual void OnRemoved(VideoCapture* capture) OVERRIDE; |
61 virtual void OnFrameReady( | 59 virtual void OnFrameReady(VideoCapture* capture, |
62 VideoCapture* capture, | 60 const scoped_refptr<media::VideoFrame>& frame) |
63 const scoped_refptr<media::VideoFrame>& frame) OVERRIDE; | 61 OVERRIDE; |
64 | 62 |
65 protected: | 63 protected: |
66 friend class base::RefCounted<PepperPlatformVideoCapture>; | 64 friend class base::RefCounted<PepperPlatformVideoCapture>; |
67 virtual ~PepperPlatformVideoCapture(); | 65 virtual ~PepperPlatformVideoCapture(); |
68 | 66 |
69 private: | 67 private: |
70 void Initialize(); | 68 void Initialize(); |
71 | 69 |
72 void OnDeviceOpened(int request_id, | 70 void OnDeviceOpened(int request_id, bool succeeded, const std::string& label); |
73 bool succeeded, | |
74 const std::string& label); | |
75 | 71 |
76 PepperMediaDeviceManager* GetMediaDeviceManager(); | 72 PepperMediaDeviceManager* GetMediaDeviceManager(); |
77 | 73 |
78 base::WeakPtr<RenderViewImpl> render_view_; | 74 base::WeakPtr<RenderViewImpl> render_view_; |
79 | 75 |
80 std::string device_id_; | 76 std::string device_id_; |
81 std::string label_; | 77 std::string label_; |
82 int session_id_; | 78 int session_id_; |
83 | 79 |
84 scoped_ptr<media::VideoCaptureHandlerProxy> handler_proxy_; | 80 scoped_ptr<media::VideoCaptureHandlerProxy> handler_proxy_; |
(...skipping 10 matching lines...) Expand all Loading... |
95 // there isn't any pending request before this object goes away. | 91 // there isn't any pending request before this object goes away. |
96 bool pending_open_device_; | 92 bool pending_open_device_; |
97 int pending_open_device_id_; | 93 int pending_open_device_id_; |
98 | 94 |
99 DISALLOW_COPY_AND_ASSIGN(PepperPlatformVideoCapture); | 95 DISALLOW_COPY_AND_ASSIGN(PepperPlatformVideoCapture); |
100 }; | 96 }; |
101 | 97 |
102 } // namespace content | 98 } // namespace content |
103 | 99 |
104 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_VIDEO_CAPTURE_H_ | 100 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_VIDEO_CAPTURE_H_ |
OLD | NEW |