OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef CONTENT_RENDERER_MEDIA_LOCAL_VIDEO_CAPTURE_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_LOCAL_VIDEO_CAPTURE_H_ |
| 7 |
| 8 #include "content/common/content_export.h" |
| 9 #include "content/common/media/video_capture.h" |
| 10 #include "media/video/capture/video_capture.h" |
| 11 #include "webkit/media/video_frame_provider.h" |
| 12 |
| 13 namespace base { |
| 14 class MessageLoopProxy; |
| 15 } |
| 16 |
| 17 namespace media { |
| 18 class VideoCaptureHandlerProxy; |
| 19 } |
| 20 |
| 21 class VideoCaptureImplManager; |
| 22 |
| 23 // This class takes raw frames from video capture engine via VideoCaptureProxy |
| 24 // and passes them to media player as a video frame provider. |
| 25 // This class lives on main thread. |
| 26 class CONTENT_EXPORT LocalVideoCapture |
| 27 : NON_EXPORTED_BASE(public webkit_media::VideoFrameProvider), |
| 28 public media::VideoCapture::EventHandler { |
| 29 public: |
| 30 LocalVideoCapture( |
| 31 media::VideoCaptureSessionId video_stream_id, |
| 32 VideoCaptureImplManager* vc_manager, |
| 33 const media::VideoCaptureCapability& capability, |
| 34 const base::Closure& error_cb, |
| 35 const webkit_media::RepaintCB& repaint_cb); |
| 36 |
| 37 // webkit_media::VideoFrameProvider implementation. |
| 38 virtual void Start() OVERRIDE; |
| 39 virtual void Stop() OVERRIDE; |
| 40 virtual void Play() OVERRIDE; |
| 41 virtual void Pause() OVERRIDE; |
| 42 |
| 43 // VideoCapture::EventHandler implementation. |
| 44 virtual void OnStarted(media::VideoCapture* capture) OVERRIDE; |
| 45 virtual void OnStopped(media::VideoCapture* capture) OVERRIDE; |
| 46 virtual void OnPaused(media::VideoCapture* capture) OVERRIDE; |
| 47 virtual void OnError(media::VideoCapture* capture, int error_code) OVERRIDE; |
| 48 virtual void OnRemoved(media::VideoCapture* capture) OVERRIDE; |
| 49 virtual void OnBufferReady( |
| 50 media::VideoCapture* capture, |
| 51 scoped_refptr<media::VideoCapture::VideoFrameBuffer> buf) OVERRIDE; |
| 52 virtual void OnDeviceInfoReceived( |
| 53 media::VideoCapture* capture, |
| 54 const media::VideoCaptureParams& device_info) OVERRIDE; |
| 55 |
| 56 protected: |
| 57 virtual ~LocalVideoCapture(); |
| 58 |
| 59 private: |
| 60 friend class LocalVideoCaptureTest; |
| 61 |
| 62 media::VideoCaptureSessionId video_stream_id_; |
| 63 scoped_refptr<VideoCaptureImplManager> vc_manager_; |
| 64 media::VideoCaptureCapability capability_; |
| 65 base::Closure error_cb_; |
| 66 webkit_media::RepaintCB repaint_cb_; |
| 67 media::VideoCapture* capture_engine_; |
| 68 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; |
| 69 scoped_ptr<media::VideoCaptureHandlerProxy> handler_proxy_; |
| 70 video_capture::State state_; |
| 71 |
| 72 DISALLOW_COPY_AND_ASSIGN(LocalVideoCapture); |
| 73 }; |
| 74 |
| 75 #endif // CONTENT_RENDERER_MEDIA_LOCAL_VIDEO_CAPTURE_H_ |
OLD | NEW |