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_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_VIDEO_CAPTURE_IMPL_H_ |
6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_VIDEO_CAPTURE_IMPL_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_VIDEO_CAPTURE_IMPL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 class PepperPluginDelegateImpl; | 24 class PepperPluginDelegateImpl; |
25 | 25 |
26 class PepperPlatformVideoCaptureImpl | 26 class PepperPlatformVideoCaptureImpl |
27 : public webkit::ppapi::PluginDelegate::PlatformVideoCapture, | 27 : public webkit::ppapi::PluginDelegate::PlatformVideoCapture, |
28 public media::VideoCapture::EventHandler { | 28 public media::VideoCapture::EventHandler { |
29 public: | 29 public: |
30 PepperPlatformVideoCaptureImpl( | 30 PepperPlatformVideoCaptureImpl( |
31 const base::WeakPtr<PepperPluginDelegateImpl>& plugin_delegate, | 31 const base::WeakPtr<PepperPluginDelegateImpl>& plugin_delegate, |
32 const std::string& device_id, | 32 const std::string& device_id, |
33 webkit::ppapi::PluginDelegate::PlatformVideoCaptureEventHandler* handler); | 33 webkit::ppapi::PluginDelegate::PlatformVideoCaptureEventHandler* handler); |
34 virtual ~PepperPlatformVideoCaptureImpl(); | |
35 | 34 |
36 // webkit::ppapi::PluginDelegate::PlatformVideoCapture implementation. | 35 // webkit::ppapi::PluginDelegate::PlatformVideoCapture implementation. |
37 virtual void StartCapture(media::VideoCapture::EventHandler* handler, | 36 virtual void StartCapture(media::VideoCapture::EventHandler* handler, |
38 const VideoCaptureCapability& capability) OVERRIDE; | 37 const VideoCaptureCapability& capability) OVERRIDE; |
39 virtual void StopCapture(media::VideoCapture::EventHandler* handler) OVERRIDE; | 38 virtual void StopCapture(media::VideoCapture::EventHandler* handler) OVERRIDE; |
40 virtual void FeedBuffer(scoped_refptr<VideoFrameBuffer> buffer) OVERRIDE; | 39 virtual void FeedBuffer(scoped_refptr<VideoFrameBuffer> buffer) OVERRIDE; |
41 virtual bool CaptureStarted() OVERRIDE; | 40 virtual bool CaptureStarted() OVERRIDE; |
42 virtual int CaptureWidth() OVERRIDE; | 41 virtual int CaptureWidth() OVERRIDE; |
43 virtual int CaptureHeight() OVERRIDE; | 42 virtual int CaptureHeight() OVERRIDE; |
44 virtual int CaptureFrameRate() OVERRIDE; | 43 virtual int CaptureFrameRate() OVERRIDE; |
45 virtual void DetachEventHandler() OVERRIDE; | 44 virtual void DetachEventHandler() OVERRIDE; |
46 | 45 |
47 // media::VideoCapture::EventHandler implementation | 46 // media::VideoCapture::EventHandler implementation |
48 virtual void OnStarted(VideoCapture* capture) OVERRIDE; | 47 virtual void OnStarted(VideoCapture* capture) OVERRIDE; |
49 virtual void OnStopped(VideoCapture* capture) OVERRIDE; | 48 virtual void OnStopped(VideoCapture* capture) OVERRIDE; |
50 virtual void OnPaused(VideoCapture* capture) OVERRIDE; | 49 virtual void OnPaused(VideoCapture* capture) OVERRIDE; |
51 virtual void OnError(VideoCapture* capture, int error_code) OVERRIDE; | 50 virtual void OnError(VideoCapture* capture, int error_code) OVERRIDE; |
52 virtual void OnRemoved(VideoCapture* capture) OVERRIDE; | 51 virtual void OnRemoved(VideoCapture* capture) OVERRIDE; |
53 virtual void OnBufferReady(VideoCapture* capture, | 52 virtual void OnBufferReady(VideoCapture* capture, |
54 scoped_refptr<VideoFrameBuffer> buffer) OVERRIDE; | 53 scoped_refptr<VideoFrameBuffer> buffer) OVERRIDE; |
55 virtual void OnDeviceInfoReceived( | 54 virtual void OnDeviceInfoReceived( |
56 VideoCapture* capture, | 55 VideoCapture* capture, |
57 const media::VideoCaptureParams& device_info) OVERRIDE; | 56 const media::VideoCaptureParams& device_info) OVERRIDE; |
58 | 57 |
59 private: | 58 private: |
| 59 virtual ~PepperPlatformVideoCaptureImpl(); |
| 60 |
60 void Initialize(); | 61 void Initialize(); |
61 | 62 |
62 void OnDeviceOpened(int request_id, | 63 void OnDeviceOpened(int request_id, |
63 bool succeeded, | 64 bool succeeded, |
64 const std::string& label); | 65 const std::string& label); |
65 | 66 |
66 base::WeakPtr<PepperPluginDelegateImpl> plugin_delegate_; | 67 base::WeakPtr<PepperPluginDelegateImpl> plugin_delegate_; |
67 | 68 |
68 std::string device_id_; | 69 std::string device_id_; |
69 std::string label_; | 70 std::string label_; |
70 int session_id_; | 71 int session_id_; |
71 | 72 |
72 scoped_ptr<media::VideoCaptureHandlerProxy> handler_proxy_; | 73 scoped_ptr<media::VideoCaptureHandlerProxy> handler_proxy_; |
73 | 74 |
74 webkit::ppapi::PluginDelegate::PlatformVideoCaptureEventHandler* handler_; | 75 webkit::ppapi::PluginDelegate::PlatformVideoCaptureEventHandler* handler_; |
75 | 76 |
76 media::VideoCapture* video_capture_; | 77 media::VideoCapture* video_capture_; |
77 | 78 |
78 // StartCapture() must be balanced by StopCapture(), otherwise this object | 79 // StartCapture() must be balanced by StopCapture(), otherwise this object |
79 // will leak. | 80 // will leak. |
80 bool unbalanced_start_; | 81 bool unbalanced_start_; |
81 | 82 |
82 DISALLOW_COPY_AND_ASSIGN(PepperPlatformVideoCaptureImpl); | 83 DISALLOW_COPY_AND_ASSIGN(PepperPlatformVideoCaptureImpl); |
83 }; | 84 }; |
84 | 85 |
85 } // namespace content | 86 } // namespace content |
86 | 87 |
87 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_VIDEO_CAPTURE_IMPL_H_ | 88 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_VIDEO_CAPTURE_IMPL_H_ |
OLD | NEW |