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