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