| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ | 5 #ifndef MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ |
| 6 #define MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ | 6 #define MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| 11 #include "base/time.h" | 11 #include "base/time.h" |
| 12 #include "media/base/filters.h" | 12 #include "media/base/filters.h" |
| 13 #include "media/base/pts_stream.h" | 13 #include "media/base/pts_stream.h" |
| 14 #include "media/base/video_frame.h" | 14 #include "media/base/video_frame.h" |
| 15 #include "media/video/video_decode_engine.h" | 15 #include "media/video/video_decode_engine.h" |
| 16 | 16 |
| 17 class MessageLoop; |
| 18 |
| 17 namespace media { | 19 namespace media { |
| 18 | 20 |
| 19 class VideoDecodeEngine; | 21 class VideoDecodeEngine; |
| 20 | 22 |
| 21 class MEDIA_EXPORT FFmpegVideoDecoder | 23 class MEDIA_EXPORT FFmpegVideoDecoder |
| 22 : public VideoDecoder, | 24 : public VideoDecoder, |
| 23 public VideoDecodeEngine::EventHandler { | 25 public VideoDecodeEngine::EventHandler { |
| 24 public: | 26 public: |
| 25 FFmpegVideoDecoder(MessageLoop* message_loop, | 27 explicit FFmpegVideoDecoder(MessageLoop* message_loop); |
| 26 VideoDecodeContext* decode_context); | |
| 27 virtual ~FFmpegVideoDecoder(); | 28 virtual ~FFmpegVideoDecoder(); |
| 28 | 29 |
| 29 // Filter implementation. | 30 // Filter implementation. |
| 30 virtual void Stop(const base::Closure& callback) OVERRIDE; | 31 virtual void Stop(const base::Closure& callback) OVERRIDE; |
| 31 virtual void Seek(base::TimeDelta time, const FilterStatusCB& cb) OVERRIDE; | 32 virtual void Seek(base::TimeDelta time, const FilterStatusCB& cb) OVERRIDE; |
| 32 virtual void Pause(const base::Closure& callback) OVERRIDE; | 33 virtual void Pause(const base::Closure& callback) OVERRIDE; |
| 33 virtual void Flush(const base::Closure& callback) OVERRIDE; | 34 virtual void Flush(const base::Closure& callback) OVERRIDE; |
| 34 | 35 |
| 35 // Decoder implementation. | 36 // VideoDecoder implementation. |
| 36 virtual void Initialize(DemuxerStream* demuxer_stream, | 37 virtual void Initialize(DemuxerStream* demuxer_stream, |
| 37 const base::Closure& callback, | 38 const base::Closure& callback, |
| 38 const StatisticsCallback& stats_callback) OVERRIDE; | 39 const StatisticsCallback& stats_callback) OVERRIDE; |
| 39 virtual void ProduceVideoFrame( | 40 virtual void ProduceVideoFrame( |
| 40 scoped_refptr<VideoFrame> video_frame) OVERRIDE; | 41 scoped_refptr<VideoFrame> video_frame) OVERRIDE; |
| 41 virtual gfx::Size natural_size() OVERRIDE; | 42 virtual gfx::Size natural_size() OVERRIDE; |
| 42 | 43 |
| 43 private: | 44 private: |
| 44 // VideoDecodeEngine::EventHandler interface. | 45 // VideoDecodeEngine::EventHandler interface. |
| 45 virtual void OnInitializeComplete(bool success) OVERRIDE; | 46 virtual void OnInitializeComplete(bool success) OVERRIDE; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 88 |
| 88 // Injection point for unittest to provide a mock engine. Takes ownership of | 89 // Injection point for unittest to provide a mock engine. Takes ownership of |
| 89 // the provided engine. | 90 // the provided engine. |
| 90 virtual void SetVideoDecodeEngineForTest(VideoDecodeEngine* engine); | 91 virtual void SetVideoDecodeEngineForTest(VideoDecodeEngine* engine); |
| 91 | 92 |
| 92 MessageLoop* message_loop_; | 93 MessageLoop* message_loop_; |
| 93 | 94 |
| 94 PtsStream pts_stream_; // Stream of presentation timestamps. | 95 PtsStream pts_stream_; // Stream of presentation timestamps. |
| 95 DecoderState state_; | 96 DecoderState state_; |
| 96 scoped_ptr<VideoDecodeEngine> decode_engine_; | 97 scoped_ptr<VideoDecodeEngine> decode_engine_; |
| 97 scoped_ptr<VideoDecodeContext> decode_context_; | |
| 98 | 98 |
| 99 base::Closure initialize_callback_; | 99 base::Closure initialize_callback_; |
| 100 base::Closure uninitialize_callback_; | 100 base::Closure uninitialize_callback_; |
| 101 base::Closure flush_callback_; | 101 base::Closure flush_callback_; |
| 102 FilterStatusCB seek_cb_; | 102 FilterStatusCB seek_cb_; |
| 103 StatisticsCallback statistics_callback_; | 103 StatisticsCallback statistics_callback_; |
| 104 | 104 |
| 105 // Hold video frames when flush happens. | 105 // Hold video frames when flush happens. |
| 106 std::deque<scoped_refptr<VideoFrame> > frame_queue_flushed_; | 106 std::deque<scoped_refptr<VideoFrame> > frame_queue_flushed_; |
| 107 | 107 |
| 108 // TODO(scherkus): I think this should be calculated by VideoRenderers based | 108 // TODO(scherkus): I think this should be calculated by VideoRenderers based |
| 109 // on information provided by VideoDecoders (i.e., aspect ratio). | 109 // on information provided by VideoDecoders (i.e., aspect ratio). |
| 110 gfx::Size natural_size_; | 110 gfx::Size natural_size_; |
| 111 | 111 |
| 112 // Pointer to the demuxer stream that will feed us compressed buffers. | 112 // Pointer to the demuxer stream that will feed us compressed buffers. |
| 113 scoped_refptr<DemuxerStream> demuxer_stream_; | 113 scoped_refptr<DemuxerStream> demuxer_stream_; |
| 114 | 114 |
| 115 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); | 115 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 } // namespace media | 118 } // namespace media |
| 119 | 119 |
| 120 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ | 120 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ |
| OLD | NEW |