diff options
author | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-06 03:15:48 +0000 |
---|---|---|
committer | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-06 03:15:48 +0000 |
commit | 97dd433374f7a5e5195fb6c65bdab33740b98e86 (patch) | |
tree | 9d75e9732ff0a56929c24fd5ffd82d5865382e3e /webkit/plugins/ppapi/ppb_video_capture_impl.h | |
parent | a82aa8513ec8f638ab2d68fca5e6a1a1d5fd1e67 (diff) | |
download | chromium_src-97dd433374f7a5e5195fb6c65bdab33740b98e86.zip chromium_src-97dd433374f7a5e5195fb6c65bdab33740b98e86.tar.gz chromium_src-97dd433374f7a5e5195fb6c65bdab33740b98e86.tar.bz2 |
Video Capture Pepper API
The API is very simple at this point but works end-to-end.
BUG=None
TEST=VideoCapture sample (in a later CL)
Review URL: http://codereview.chromium.org/7553003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95719 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins/ppapi/ppb_video_capture_impl.h')
-rw-r--r-- | webkit/plugins/ppapi/ppb_video_capture_impl.h | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/webkit/plugins/ppapi/ppb_video_capture_impl.h b/webkit/plugins/ppapi/ppb_video_capture_impl.h new file mode 100644 index 0000000..be24f23 --- /dev/null +++ b/webkit/plugins/ppapi/ppb_video_capture_impl.h @@ -0,0 +1,86 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_CAPTURE_IMPL_H_ +#define WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_CAPTURE_IMPL_H_ + +#include <vector> + +#include "base/basictypes.h" +#include "base/compiler_specific.h" +#include "base/memory/scoped_callback_factory.h" +#include "base/memory/scoped_ptr.h" +#include "media/video/capture/video_capture.h" +#include "ppapi/c/dev/ppp_video_capture_dev.h" +#include "ppapi/thunk/ppb_video_capture_api.h" +#include "webkit/plugins/ppapi/plugin_delegate.h" +#include "webkit/plugins/ppapi/ppb_buffer_impl.h" +#include "webkit/plugins/ppapi/resource.h" + +struct PP_VideoCaptureDeviceInfo_Dev; +struct PPB_VideoCapture_Dev; + +namespace webkit { +namespace ppapi { + +class PluginInstance; + +class PPB_VideoCapture_Impl : public Resource, + public ::ppapi::thunk::PPB_VideoCapture_API, + public media::VideoCapture::EventHandler { + public: + explicit PPB_VideoCapture_Impl(PluginInstance* instance); + virtual ~PPB_VideoCapture_Impl(); + + bool Init(); + + // ResourceObjectBase overrides. + virtual PPB_VideoCapture_API* AsPPB_VideoCapture_API() OVERRIDE; + + // PPB_VideoCapture implementation. + virtual int32_t StartCapture( + const PP_VideoCaptureDeviceInfo_Dev& requested_info, + uint32_t buffer_count) OVERRIDE; + virtual int32_t ReuseBuffer(uint32_t buffer) OVERRIDE; + virtual int32_t StopCapture() OVERRIDE; + + // media::VideoCapture::EventHandler implementation. + virtual void OnStarted(media::VideoCapture* capture) OVERRIDE; + virtual void OnStopped(media::VideoCapture* capture) OVERRIDE; + virtual void OnPaused(media::VideoCapture* capture) OVERRIDE; + virtual void OnError(media::VideoCapture* capture, int error_code) OVERRIDE; + virtual void OnBufferReady( + media::VideoCapture* capture, + scoped_refptr<media::VideoCapture::VideoFrameBuffer> buffer) OVERRIDE; + virtual void OnDeviceInfoReceived( + media::VideoCapture* capture, + const media::VideoCaptureParams& device_info) OVERRIDE; + + private: + void ReleaseBuffers(); + void SendStatus(); + + scoped_ptr<PluginDelegate::PlatformVideoCapture> platform_video_capture_; + + size_t buffer_count_hint_; + struct BufferInfo { + BufferInfo(); + ~BufferInfo(); + + bool in_use; + void* data; + scoped_refptr<PPB_Buffer_Impl> buffer; + }; + std::vector<BufferInfo> buffers_; + + const PPP_VideoCapture_Dev* ppp_videocapture_; + PP_VideoCaptureStatus_Dev status_; + + DISALLOW_COPY_AND_ASSIGN(PPB_VideoCapture_Impl); +}; + +} // namespace ppapi +} // namespace webkit + +#endif // WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_DECODER_IMPL_H_ |