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