| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_MEDIA_CAPTURE_VIDEO_DECODER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_CAPTURE_VIDEO_DECODER_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_CAPTURE_VIDEO_DECODER_H_ | 6 #define CONTENT_RENDERER_MEDIA_CAPTURE_VIDEO_DECODER_H_ |
| 7 | 7 |
| 8 #include "base/time.h" | 8 #include "base/time.h" |
| 9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
| 10 #include "media/base/demuxer_stream.h" | 10 #include "media/base/demuxer_stream.h" |
| 11 #include "media/base/filters.h" | 11 #include "media/base/filters.h" |
| 12 #include "media/base/pipeline_status.h" | 12 #include "media/base/pipeline_status.h" |
| 13 #include "media/base/video_frame.h" | 13 #include "media/base/video_frame.h" |
| 14 #include "media/video/capture/video_capture.h" | 14 #include "media/video/capture/video_capture.h" |
| 15 #include "media/video/capture/video_capture_types.h" |
| 15 | 16 |
| 16 namespace base { | 17 namespace base { |
| 17 class MessageLoopProxy; | 18 class MessageLoopProxy; |
| 18 } | 19 } |
| 19 class VideoCaptureImplManager; | 20 class VideoCaptureImplManager; |
| 20 | 21 |
| 21 // A filter takes raw frames from video capture engine and passes them to media | 22 // A filter takes raw frames from video capture engine and passes them to media |
| 22 // engine as a video decoder filter. | 23 // engine as a video decoder filter. |
| 23 class CONTENT_EXPORT CaptureVideoDecoder | 24 class CONTENT_EXPORT CaptureVideoDecoder |
| 24 : public media::VideoDecoder, | 25 : public media::VideoDecoder, |
| 25 public media::VideoCapture::EventHandler { | 26 public media::VideoCapture::EventHandler { |
| 26 public: | 27 public: |
| 27 CaptureVideoDecoder( | 28 CaptureVideoDecoder( |
| 28 base::MessageLoopProxy* message_loop_proxy, | 29 base::MessageLoopProxy* message_loop_proxy, |
| 29 media::VideoCaptureSessionId video_stream_id, | 30 media::VideoCaptureSessionId video_stream_id, |
| 30 VideoCaptureImplManager* vc_manager, | 31 VideoCaptureImplManager* vc_manager, |
| 31 const media::VideoCapture::VideoCaptureCapability& capability); | 32 const media::VideoCaptureCapability& capability); |
| 32 virtual ~CaptureVideoDecoder(); | 33 virtual ~CaptureVideoDecoder(); |
| 33 | 34 |
| 34 // Filter implementation. | 35 // Filter implementation. |
| 35 virtual void Play(const base::Closure& callback) OVERRIDE; | 36 virtual void Play(const base::Closure& callback) OVERRIDE; |
| 36 virtual void Seek(base::TimeDelta time, | 37 virtual void Seek(base::TimeDelta time, |
| 37 const media::PipelineStatusCB& cb) OVERRIDE; | 38 const media::PipelineStatusCB& cb) OVERRIDE; |
| 38 virtual void Pause(const base::Closure& callback) OVERRIDE; | 39 virtual void Pause(const base::Closure& callback) OVERRIDE; |
| 39 virtual void Flush(const base::Closure& callback) OVERRIDE; | 40 virtual void Flush(const base::Closure& callback) OVERRIDE; |
| 40 virtual void Stop(const base::Closure& callback) OVERRIDE; | 41 virtual void Stop(const base::Closure& callback) OVERRIDE; |
| 41 | 42 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 scoped_refptr<media::VideoCapture::VideoFrameBuffer> buf); | 90 scoped_refptr<media::VideoCapture::VideoFrameBuffer> buf); |
| 90 void OnDeviceInfoReceivedOnDecoderThread( | 91 void OnDeviceInfoReceivedOnDecoderThread( |
| 91 media::VideoCapture* capture, | 92 media::VideoCapture* capture, |
| 92 const media::VideoCaptureParams& device_info); | 93 const media::VideoCaptureParams& device_info); |
| 93 | 94 |
| 94 // Delivers the frame to |read_cb_| and resets the callback. | 95 // Delivers the frame to |read_cb_| and resets the callback. |
| 95 void DeliverFrame(const scoped_refptr<media::VideoFrame>& video_frame); | 96 void DeliverFrame(const scoped_refptr<media::VideoFrame>& video_frame); |
| 96 | 97 |
| 97 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | 98 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; |
| 98 scoped_refptr<VideoCaptureImplManager> vc_manager_; | 99 scoped_refptr<VideoCaptureImplManager> vc_manager_; |
| 99 media::VideoCapture::VideoCaptureCapability capability_; | 100 media::VideoCaptureCapability capability_; |
| 100 gfx::Size natural_size_; | 101 gfx::Size natural_size_; |
| 101 DecoderState state_; | 102 DecoderState state_; |
| 102 bool got_first_frame_; | 103 bool got_first_frame_; |
| 103 ReadCB read_cb_; | 104 ReadCB read_cb_; |
| 104 base::Closure pending_stop_cb_; | 105 base::Closure pending_stop_cb_; |
| 105 media::StatisticsCB statistics_cb_; | 106 media::StatisticsCB statistics_cb_; |
| 106 | 107 |
| 107 media::VideoCaptureSessionId video_stream_id_; | 108 media::VideoCaptureSessionId video_stream_id_; |
| 108 media::VideoCapture* capture_engine_; | 109 media::VideoCapture* capture_engine_; |
| 109 base::Time last_frame_timestamp_; | 110 base::Time last_frame_timestamp_; |
| 110 base::Time start_time_; | 111 base::Time start_time_; |
| 111 | 112 |
| 112 DISALLOW_COPY_AND_ASSIGN(CaptureVideoDecoder); | 113 DISALLOW_COPY_AND_ASSIGN(CaptureVideoDecoder); |
| 113 }; | 114 }; |
| 114 | 115 |
| 115 #endif // CONTENT_RENDERER_MEDIA_CAPTURE_VIDEO_DECODER_H_ | 116 #endif // CONTENT_RENDERER_MEDIA_CAPTURE_VIDEO_DECODER_H_ |
| OLD | NEW |