OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_CAPTURE_IMPL_H_ |
| 6 #define WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_CAPTURE_IMPL_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/scoped_callback_factory.h" |
| 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "media/video/capture/video_capture.h" |
| 15 #include "ppapi/c/dev/ppp_video_capture_dev.h" |
| 16 #include "ppapi/thunk/ppb_video_capture_api.h" |
| 17 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 18 #include "webkit/plugins/ppapi/ppb_buffer_impl.h" |
| 19 #include "webkit/plugins/ppapi/resource.h" |
| 20 |
| 21 struct PP_VideoCaptureDeviceInfo_Dev; |
| 22 struct PPB_VideoCapture_Dev; |
| 23 |
| 24 namespace webkit { |
| 25 namespace ppapi { |
| 26 |
| 27 class PluginInstance; |
| 28 |
| 29 class PPB_VideoCapture_Impl : public Resource, |
| 30 public ::ppapi::thunk::PPB_VideoCapture_API, |
| 31 public media::VideoCapture::EventHandler { |
| 32 public: |
| 33 explicit PPB_VideoCapture_Impl(PluginInstance* instance); |
| 34 virtual ~PPB_VideoCapture_Impl(); |
| 35 |
| 36 bool Init(); |
| 37 |
| 38 // ResourceObjectBase overrides. |
| 39 virtual PPB_VideoCapture_API* AsPPB_VideoCapture_API() OVERRIDE; |
| 40 |
| 41 // PPB_VideoCapture implementation. |
| 42 virtual int32_t StartCapture( |
| 43 const PP_VideoCaptureDeviceInfo_Dev& requested_info, |
| 44 uint32_t buffer_count) OVERRIDE; |
| 45 virtual int32_t ReuseBuffer(uint32_t buffer) OVERRIDE; |
| 46 virtual int32_t StopCapture() OVERRIDE; |
| 47 |
| 48 // media::VideoCapture::EventHandler implementation. |
| 49 virtual void OnStarted(media::VideoCapture* capture) OVERRIDE; |
| 50 virtual void OnStopped(media::VideoCapture* capture) OVERRIDE; |
| 51 virtual void OnPaused(media::VideoCapture* capture) OVERRIDE; |
| 52 virtual void OnError(media::VideoCapture* capture, int error_code) OVERRIDE; |
| 53 virtual void OnBufferReady( |
| 54 media::VideoCapture* capture, |
| 55 scoped_refptr<media::VideoCapture::VideoFrameBuffer> buffer) OVERRIDE; |
| 56 virtual void OnDeviceInfoReceived( |
| 57 media::VideoCapture* capture, |
| 58 const media::VideoCaptureParams& device_info) OVERRIDE; |
| 59 |
| 60 private: |
| 61 void ReleaseBuffers(); |
| 62 void SendStatus(); |
| 63 |
| 64 scoped_ptr<PluginDelegate::PlatformVideoCapture> platform_video_capture_; |
| 65 |
| 66 size_t buffer_count_hint_; |
| 67 struct BufferInfo { |
| 68 BufferInfo(); |
| 69 ~BufferInfo(); |
| 70 |
| 71 bool in_use; |
| 72 void* data; |
| 73 scoped_refptr<PPB_Buffer_Impl> buffer; |
| 74 }; |
| 75 std::vector<BufferInfo> buffers_; |
| 76 |
| 77 const PPP_VideoCapture_Dev* ppp_videocapture_; |
| 78 PP_VideoCaptureStatus_Dev status_; |
| 79 |
| 80 DISALLOW_COPY_AND_ASSIGN(PPB_VideoCapture_Impl); |
| 81 }; |
| 82 |
| 83 } // namespace ppapi |
| 84 } // namespace webkit |
| 85 |
| 86 #endif // WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_DECODER_IMPL_H_ |
OLD | NEW |