OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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 MEDIA_VIDEO_CAPTURE_FAKE_CAPTURE_VIDEO_DECODER_H_ |
| 6 #define MEDIA_VIDEO_CAPTURE_FAKE_CAPTURE_VIDEO_DECODER_H_ |
| 7 |
| 8 #include "media/base/filters.h" |
| 9 #include "media/base/pipeline_status.h" |
| 10 #include "media/video/capture/video_capture.h" |
| 11 |
| 12 namespace base { |
| 13 class MessageLoopProxy; |
| 14 } |
| 15 |
| 16 namespace media { |
| 17 |
| 18 class DemuxerStream; |
| 19 class VideoFrame; |
| 20 |
| 21 // A filter generates raw frames and passes them to media engine as a video |
| 22 // decoder filter. |
| 23 class MEDIA_EXPORT FakeCaptureVideoDecoder |
| 24 : public VideoDecoder { |
| 25 public: |
| 26 FakeCaptureVideoDecoder( |
| 27 base::MessageLoopProxy* message_loop_proxy, |
| 28 const VideoCapture::VideoCaptureCapability& capability); |
| 29 virtual ~FakeCaptureVideoDecoder(); |
| 30 |
| 31 // Filter implementation. |
| 32 virtual void Seek(base::TimeDelta time, |
| 33 const FilterStatusCB& cb) OVERRIDE; |
| 34 virtual void Pause(const base::Closure& callback) OVERRIDE; |
| 35 virtual void Flush(const base::Closure& callback) OVERRIDE; |
| 36 virtual void Stop(const base::Closure& callback) OVERRIDE; |
| 37 |
| 38 // Decoder implementation. |
| 39 virtual void Initialize( |
| 40 DemuxerStream* demuxer_stream, |
| 41 const PipelineStatusCB& filter_callback, |
| 42 const StatisticsCallback& stat_callback) OVERRIDE; |
| 43 virtual void Read(const ReadCB& callback) OVERRIDE; |
| 44 virtual const gfx::Size& natural_size() OVERRIDE; |
| 45 |
| 46 private: |
| 47 enum DecoderState { |
| 48 kUnInitialized, |
| 49 kNormal, |
| 50 kStopped, |
| 51 kPaused |
| 52 }; |
| 53 |
| 54 void SeekOnDecoderThread(base::TimeDelta time, |
| 55 const FilterStatusCB& cb); |
| 56 void PauseOnDecoderThread(const base::Closure& callback); |
| 57 void FlushOnDecoderThread(const base::Closure& callback); |
| 58 void StopOnDecoderThread(const base::Closure& callback); |
| 59 |
| 60 void InitializeOnDecoderThread( |
| 61 DemuxerStream* demuxer_stream, |
| 62 const PipelineStatusCB& filter_callback, |
| 63 const StatisticsCallback& stat_callback); |
| 64 void ReadOnDecoderThread(const ReadCB& callback); |
| 65 |
| 66 void GenerateFrameOnDecoderThread(); |
| 67 |
| 68 // Delivers the frame to |read_cb_| and resets the callback. |
| 69 void DeliverFrame(const scoped_refptr<VideoFrame>& video_frame); |
| 70 |
| 71 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; |
| 72 VideoCapture::VideoCaptureCapability capability_; |
| 73 gfx::Size natural_size_; |
| 74 DecoderState state_; |
| 75 ReadCB read_cb_; |
| 76 StatisticsCallback statistics_callback_; |
| 77 |
| 78 base::TimeDelta frame_interval_ms_; |
| 79 |
| 80 DISALLOW_COPY_AND_ASSIGN(FakeCaptureVideoDecoder); |
| 81 }; |
| 82 |
| 83 } // namespace media |
| 84 |
| 85 #endif // MEDIA_VIDEO_CAPTURE_FAKE_CAPTURE_VIDEO_DECODER_H_ |
OLD | NEW |