Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Unified Diff: content/renderer/pepper_platform_video_capture_impl.h

Issue 9234064: Implement device enumeration for PPB_VideoCapture_Dev. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/content_renderer.gypi ('k') | content/renderer/pepper_platform_video_capture_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/pepper_platform_video_capture_impl.h
diff --git a/content/renderer/pepper_platform_video_capture_impl.h b/content/renderer/pepper_platform_video_capture_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..4330226c07f157073ad6ab1f1c924e588d59a2fa
--- /dev/null
+++ b/content/renderer/pepper_platform_video_capture_impl.h
@@ -0,0 +1,83 @@
+// Copyright (c) 2012 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 CONTENT_RENDERER_PEPPER_PLATFORM_VIDEO_CAPTURE_IMPL_H_
+#define CONTENT_RENDERER_PEPPER_PLATFORM_VIDEO_CAPTURE_IMPL_H_
+#pragma once
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "media/video/capture/video_capture.h"
+#include "webkit/plugins/ppapi/plugin_delegate.h"
+
+class PepperPluginDelegateImpl;
+
+namespace media {
+class VideoCaptureHandlerProxy;
+}
+
+class PepperPlatformVideoCaptureImpl
+ : public webkit::ppapi::PluginDelegate::PlatformVideoCapture,
+ public media::VideoCapture::EventHandler {
+ public:
+ PepperPlatformVideoCaptureImpl(
+ const base::WeakPtr<PepperPluginDelegateImpl>& plugin_delegate,
+ const std::string& device_id,
+ webkit::ppapi::PluginDelegate::PlatformVideoCaptureEventHandler* handler);
+ virtual ~PepperPlatformVideoCaptureImpl();
+
+ // webkit::ppapi::PluginDelegate::PlatformVideoCapture implementation.
+ virtual void StartCapture(media::VideoCapture::EventHandler* handler,
+ const VideoCaptureCapability& capability) OVERRIDE;
+ virtual void StopCapture(media::VideoCapture::EventHandler* handler) OVERRIDE;
+ virtual void FeedBuffer(scoped_refptr<VideoFrameBuffer> buffer) OVERRIDE;
+ virtual bool CaptureStarted() OVERRIDE;
+ virtual int CaptureWidth() OVERRIDE;
+ virtual int CaptureHeight() OVERRIDE;
+ virtual int CaptureFrameRate() OVERRIDE;
+ virtual void DetachEventHandler() OVERRIDE;
+
+ // media::VideoCapture::EventHandler implementation
+ virtual void OnStarted(VideoCapture* capture) OVERRIDE;
+ virtual void OnStopped(VideoCapture* capture) OVERRIDE;
+ virtual void OnPaused(VideoCapture* capture) OVERRIDE;
+ virtual void OnError(VideoCapture* capture, int error_code) OVERRIDE;
+ virtual void OnRemoved(VideoCapture* capture) OVERRIDE;
+ virtual void OnBufferReady(VideoCapture* capture,
+ scoped_refptr<VideoFrameBuffer> buffer) OVERRIDE;
+ virtual void OnDeviceInfoReceived(
+ VideoCapture* capture,
+ const media::VideoCaptureParams& device_info) OVERRIDE;
+
+ private:
+ void Initialize();
+
+ void OnDeviceOpened(int request_id,
+ bool succeeded,
+ const std::string& label);
+
+ base::WeakPtr<PepperPluginDelegateImpl> plugin_delegate_;
+
+ std::string device_id_;
+ std::string label_;
+ int session_id_;
+
+ scoped_ptr<media::VideoCaptureHandlerProxy> handler_proxy_;
+
+ webkit::ppapi::PluginDelegate::PlatformVideoCaptureEventHandler* handler_;
+
+ media::VideoCapture* video_capture_;
+
+ // StartCapture() must be balanced by StopCapture(), otherwise this object
+ // will leak.
+ bool unbalanced_start_;
+
+ DISALLOW_COPY_AND_ASSIGN(PepperPlatformVideoCaptureImpl);
+};
+
+#endif // CONTENT_RENDERER_PEPPER_PLATFORM_VIDEO_CAPTURE_IMPL_H_
« no previous file with comments | « content/content_renderer.gypi ('k') | content/renderer/pepper_platform_video_capture_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698