OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_heap.h" | 13 #include "media/base/pts_heap.h" |
14 #include "media/base/video_frame.h" | 14 #include "media/base/video_frame.h" |
15 #include "media/filters/decoder_base.h" | 15 #include "media/filters/decoder_base.h" |
16 #include "media/video/video_decode_engine.h" | 16 #include "media/video/video_decode_engine.h" |
| 17 #include "media/ffmpeg/ffmpeg_common.h" |
17 | 18 |
18 // FFmpeg types. | 19 // FFmpeg types. |
19 struct AVRational; | 20 struct AVRational; |
20 | 21 |
21 namespace media { | 22 namespace media { |
22 | 23 |
23 class VideoDecodeEngine; | 24 class VideoDecodeEngine; |
24 | 25 |
25 class FFmpegVideoDecoder : public VideoDecoder, | 26 class FFmpegVideoDecoder : public VideoDecoder, |
26 public VideoDecodeEngine::EventHandler { | 27 public VideoDecodeEngine::EventHandler { |
27 public: | 28 public: |
28 explicit FFmpegVideoDecoder(VideoDecodeContext* decode_context); | 29 explicit FFmpegVideoDecoder(VideoDecodeContext* decode_context); |
29 virtual ~FFmpegVideoDecoder(); | 30 virtual ~FFmpegVideoDecoder(); |
30 | 31 |
31 // Filter implementation. | 32 // Filter implementation. |
32 virtual void Stop(FilterCallback* callback); | 33 virtual void Stop(FilterCallback* callback); |
33 virtual void Seek(base::TimeDelta time, FilterCallback* callback); | 34 virtual void Seek(base::TimeDelta time, FilterCallback* callback); |
34 virtual void Pause(FilterCallback* callback); | 35 virtual void Pause(FilterCallback* callback); |
35 virtual void Flush(FilterCallback* callback); | 36 virtual void Flush(FilterCallback* callback); |
36 | 37 |
37 // Decoder implementation. | 38 // Decoder implementation. |
38 virtual void Initialize(DemuxerStream* demuxer_stream, | 39 virtual void Initialize(DemuxerStream* demuxer_stream, |
39 FilterCallback* callback); | 40 FilterCallback* callback); |
40 virtual const MediaFormat& media_format() { return media_format_; } | 41 virtual const MediaFormat& media_format() { return media_format_; } |
41 virtual void ProduceVideoFrame(scoped_refptr<VideoFrame> video_frame); | 42 virtual void ProduceVideoFrame(scoped_refptr<VideoFrame> video_frame); |
42 virtual bool ProvidesBuffer(); | 43 virtual bool ProvidesBuffer(); |
43 | 44 |
| 45 virtual const char* filter_name() { return "FFmpegVideoDecoder"; } |
| 46 virtual bool supports_codec_id(int codec_id) { |
| 47 // Tell that we support all possible video formats |
| 48 return true; |
| 49 } |
| 50 |
44 private: | 51 private: |
45 // VideoDecodeEngine::EventHandler interface. | 52 // VideoDecodeEngine::EventHandler interface. |
46 virtual void OnInitializeComplete(const VideoCodecInfo& info); | 53 virtual void OnInitializeComplete(const VideoCodecInfo& info); |
47 virtual void OnUninitializeComplete(); | 54 virtual void OnUninitializeComplete(); |
48 virtual void OnFlushComplete(); | 55 virtual void OnFlushComplete(); |
49 virtual void OnSeekComplete(); | 56 virtual void OnSeekComplete(); |
50 virtual void OnError(); | 57 virtual void OnError(); |
51 virtual void OnFormatChange(VideoStreamInfo stream_info); | 58 virtual void OnFormatChange(VideoStreamInfo stream_info); |
52 virtual void ProduceVideoSample(scoped_refptr<Buffer> buffer); | 59 virtual void ProduceVideoSample(scoped_refptr<Buffer> buffer); |
53 virtual void ConsumeVideoFrame(scoped_refptr<VideoFrame> frame); | 60 virtual void ConsumeVideoFrame(scoped_refptr<VideoFrame> frame); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 138 |
132 // Pointer to the demuxer stream that will feed us compressed buffers. | 139 // Pointer to the demuxer stream that will feed us compressed buffers. |
133 scoped_refptr<DemuxerStream> demuxer_stream_; | 140 scoped_refptr<DemuxerStream> demuxer_stream_; |
134 | 141 |
135 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); | 142 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); |
136 }; | 143 }; |
137 | 144 |
138 } // namespace media | 145 } // namespace media |
139 | 146 |
140 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ | 147 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ |
OLD | NEW |