chromeos: dbus: add Bluetooth properties support
[chromium-blink-merge.git] / content / renderer / pepper_platform_video_capture_impl.h
blob4330226c07f157073ad6ab1f1c924e588d59a2fa
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_PEPPER_PLATFORM_VIDEO_CAPTURE_IMPL_H_
6 #define CONTENT_RENDERER_PEPPER_PLATFORM_VIDEO_CAPTURE_IMPL_H_
7 #pragma once
9 #include <string>
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h"
15 #include "media/video/capture/video_capture.h"
16 #include "webkit/plugins/ppapi/plugin_delegate.h"
18 class PepperPluginDelegateImpl;
20 namespace media {
21 class VideoCaptureHandlerProxy;
24 class PepperPlatformVideoCaptureImpl
25 : public webkit::ppapi::PluginDelegate::PlatformVideoCapture,
26 public media::VideoCapture::EventHandler {
27 public:
28 PepperPlatformVideoCaptureImpl(
29 const base::WeakPtr<PepperPluginDelegateImpl>& plugin_delegate,
30 const std::string& device_id,
31 webkit::ppapi::PluginDelegate::PlatformVideoCaptureEventHandler* handler);
32 virtual ~PepperPlatformVideoCaptureImpl();
34 // webkit::ppapi::PluginDelegate::PlatformVideoCapture implementation.
35 virtual void StartCapture(media::VideoCapture::EventHandler* handler,
36 const VideoCaptureCapability& capability) OVERRIDE;
37 virtual void StopCapture(media::VideoCapture::EventHandler* handler) OVERRIDE;
38 virtual void FeedBuffer(scoped_refptr<VideoFrameBuffer> buffer) OVERRIDE;
39 virtual bool CaptureStarted() OVERRIDE;
40 virtual int CaptureWidth() OVERRIDE;
41 virtual int CaptureHeight() OVERRIDE;
42 virtual int CaptureFrameRate() OVERRIDE;
43 virtual void DetachEventHandler() OVERRIDE;
45 // media::VideoCapture::EventHandler implementation
46 virtual void OnStarted(VideoCapture* capture) OVERRIDE;
47 virtual void OnStopped(VideoCapture* capture) OVERRIDE;
48 virtual void OnPaused(VideoCapture* capture) OVERRIDE;
49 virtual void OnError(VideoCapture* capture, int error_code) OVERRIDE;
50 virtual void OnRemoved(VideoCapture* capture) OVERRIDE;
51 virtual void OnBufferReady(VideoCapture* capture,
52 scoped_refptr<VideoFrameBuffer> buffer) OVERRIDE;
53 virtual void OnDeviceInfoReceived(
54 VideoCapture* capture,
55 const media::VideoCaptureParams& device_info) OVERRIDE;
57 private:
58 void Initialize();
60 void OnDeviceOpened(int request_id,
61 bool succeeded,
62 const std::string& label);
64 base::WeakPtr<PepperPluginDelegateImpl> plugin_delegate_;
66 std::string device_id_;
67 std::string label_;
68 int session_id_;
70 scoped_ptr<media::VideoCaptureHandlerProxy> handler_proxy_;
72 webkit::ppapi::PluginDelegate::PlatformVideoCaptureEventHandler* handler_;
74 media::VideoCapture* video_capture_;
76 // StartCapture() must be balanced by StopCapture(), otherwise this object
77 // will leak.
78 bool unbalanced_start_;
80 DISALLOW_COPY_AND_ASSIGN(PepperPlatformVideoCaptureImpl);
83 #endif // CONTENT_RENDERER_PEPPER_PLATFORM_VIDEO_CAPTURE_IMPL_H_