| 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 | 17 |
| 18 // FFmpeg types. | 18 // FFmpeg types. |
| 19 struct AVRational; | 19 struct AVRational; |
| 20 | 20 |
| 21 namespace media { | 21 namespace media { |
| 22 | 22 |
| 23 class VideoDecodeEngine; | 23 class VideoDecodeEngine; |
| 24 | 24 |
| 25 class FFmpegVideoDecoder : public VideoDecoder, | 25 class FFmpegVideoDecoder : public VideoDecoder, |
| 26 public VideoDecodeEngine::EventHandler { | 26 public VideoDecodeEngine::EventHandler { |
| 27 public: | 27 public: |
| 28 explicit FFmpegVideoDecoder(VideoDecodeContext* decode_context); | 28 FFmpegVideoDecoder(MessageLoop* message_loop, |
| 29 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, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // reserved as a last-ditch effort. | 103 // reserved as a last-ditch effort. |
| 103 virtual TimeTuple FindPtsAndDuration(const AVRational& time_base, | 104 virtual TimeTuple FindPtsAndDuration(const AVRational& time_base, |
| 104 PtsHeap* pts_heap, | 105 PtsHeap* pts_heap, |
| 105 const TimeTuple& last_pts, | 106 const TimeTuple& last_pts, |
| 106 const VideoFrame* frame); | 107 const VideoFrame* frame); |
| 107 | 108 |
| 108 // Injection point for unittest to provide a mock engine. Takes ownership of | 109 // Injection point for unittest to provide a mock engine. Takes ownership of |
| 109 // the provided engine. | 110 // the provided engine. |
| 110 virtual void SetVideoDecodeEngineForTest(VideoDecodeEngine* engine); | 111 virtual void SetVideoDecodeEngineForTest(VideoDecodeEngine* engine); |
| 111 | 112 |
| 113 MessageLoop* message_loop_; |
| 112 size_t width_; | 114 size_t width_; |
| 113 size_t height_; | 115 size_t height_; |
| 114 MediaFormat media_format_; | 116 MediaFormat media_format_; |
| 115 | 117 |
| 116 PtsHeap pts_heap_; // Heap of presentation timestamps. | 118 PtsHeap pts_heap_; // Heap of presentation timestamps. |
| 117 TimeTuple last_pts_; | 119 TimeTuple last_pts_; |
| 118 scoped_ptr<AVRational> time_base_; // Pointer to avoid needing full type. | 120 scoped_ptr<AVRational> time_base_; // Pointer to avoid needing full type. |
| 119 DecoderState state_; | 121 DecoderState state_; |
| 120 scoped_ptr<VideoDecodeEngine> decode_engine_; | 122 scoped_ptr<VideoDecodeEngine> decode_engine_; |
| 121 scoped_ptr<VideoDecodeContext> decode_context_; | 123 scoped_ptr<VideoDecodeContext> decode_context_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 132 | 134 |
| 133 // Pointer to the demuxer stream that will feed us compressed buffers. | 135 // Pointer to the demuxer stream that will feed us compressed buffers. |
| 134 scoped_refptr<DemuxerStream> demuxer_stream_; | 136 scoped_refptr<DemuxerStream> demuxer_stream_; |
| 135 | 137 |
| 136 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); | 138 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); |
| 137 }; | 139 }; |
| 138 | 140 |
| 139 } // namespace media | 141 } // namespace media |
| 140 | 142 |
| 141 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ | 143 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ |
| OLD | NEW |