Index: content/renderer/media/video_capture_relay.h |
=================================================================== |
--- content/renderer/media/video_capture_relay.h (revision 0) |
+++ content/renderer/media/video_capture_relay.h (revision 0) |
@@ -0,0 +1,84 @@ |
+// 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_MEDIA_VIDEO_CAPTURE_RELAY_H_ |
+#define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_RELAY_H_ |
+ |
+#include "base/threading/thread.h" |
+#include "base/time.h" |
+#include "content/common/content_export.h" |
+#include "media/base/video_frame.h" |
+#include "media/video/capture/video_capture.h" |
+#include "webkit/media/video_frame_provider.h" |
+ |
+namespace base { |
+class MessageLoopProxy; |
+} |
+class VideoCaptureImplManager; |
+ |
+// Takes raw frames from video capture engine and passes them to media |
+// player as a video frame provider. |
+class CONTENT_EXPORT VideoCaptureRelay |
+ : public webkit_media::VideoFrameProvider, |
+ public media::VideoCapture::EventHandler { |
+ public: |
+ VideoCaptureRelay( |
+ media::VideoCaptureSessionId video_stream_id, |
+ VideoCaptureImplManager* vc_manager, |
+ const media::VideoCaptureCapability& capability, |
+ const base::Closure& paint_cb); |
+ virtual ~VideoCaptureRelay(); |
+ |
+ // webkit_media::VideoFrameProvider implementation. |
+ virtual void Start() OVERRIDE; |
+ virtual void Stop(const base::Closure& callback) OVERRIDE; |
+ virtual void GetCurrentFrame( |
+ scoped_refptr<media::VideoFrame>* frame_out) OVERRIDE; |
+ virtual void PutCurrentFrame(scoped_refptr<media::VideoFrame> frame) OVERRIDE; |
+ |
+ // 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 OnRemoved(media::VideoCapture* capture) OVERRIDE; |
+ virtual void OnBufferReady( |
+ media::VideoCapture* capture, |
+ scoped_refptr<media::VideoCapture::VideoFrameBuffer> buf) OVERRIDE; |
+ virtual void OnDeviceInfoReceived( |
+ media::VideoCapture* capture, |
+ const media::VideoCaptureParams& device_info) OVERRIDE; |
+ |
+ private: |
+ friend class VideoCaptureRelayTest; |
+ |
+ void StartOnRelayThread(); |
+ void StopOnRelayThread(const base::Closure& callback); |
+ |
+ void OnStoppedOnRelayThread(media::VideoCapture* capture); |
+ void OnBufferReadyOnRelayThread( |
+ media::VideoCapture* capture, |
+ scoped_refptr<media::VideoCapture::VideoFrameBuffer> buf); |
+ void OnDeviceInfoReceivedOnRelayThread( |
+ media::VideoCapture* capture, |
+ const media::VideoCaptureParams& device_info); |
+ |
+ base::Thread thread_; |
+ scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; |
+ base::Lock lock_; |
+ scoped_refptr<VideoCaptureImplManager> vc_manager_; |
+ media::VideoCaptureCapability capability_; |
+ bool is_active_; |
+ base::Closure pending_stop_cb_; |
+ bool pending_paint_; |
+ base::Closure paint_cb_; |
+ scoped_refptr<media::VideoFrame> current_frame_; |
+ |
+ media::VideoCaptureSessionId video_stream_id_; |
+ media::VideoCapture* capture_engine_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(VideoCaptureRelay); |
+}; |
+ |
+#endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_RELAY_H_ |
Property changes on: content/renderer/media/video_capture_relay.h |
___________________________________________________________________ |
Added: svn:eol-style |
+ LF |