OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "media/base/decryptor.h" | 10 #include "media/base/decryptor.h" |
11 #include "media/base/demuxer_stream.h" | 11 #include "media/base/demuxer_stream.h" |
12 #include "media/base/video_decoder.h" | 12 #include "media/base/video_decoder.h" |
13 | 13 |
14 class MessageLoop; | |
15 | |
16 struct AVCodecContext; | 14 struct AVCodecContext; |
17 struct AVFrame; | 15 struct AVFrame; |
18 | 16 |
| 17 namespace base { |
| 18 class MessageLoopProxy; |
| 19 } |
| 20 |
19 namespace media { | 21 namespace media { |
20 | 22 |
21 class DecoderBuffer; | 23 class DecoderBuffer; |
22 | 24 |
23 class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder { | 25 class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder { |
24 public: | 26 public: |
25 FFmpegVideoDecoder(const base::Callback<MessageLoop*()>& message_loop_cb, | 27 typedef base::Callback< |
| 28 scoped_refptr<base::MessageLoopProxy>()> MessageLoopFactoryCB; |
| 29 FFmpegVideoDecoder(const MessageLoopFactoryCB& message_loop_factory_cb, |
26 Decryptor* decryptor); | 30 Decryptor* decryptor); |
27 | 31 |
28 // VideoDecoder implementation. | 32 // VideoDecoder implementation. |
29 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream, | 33 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream, |
30 const PipelineStatusCB& status_cb, | 34 const PipelineStatusCB& status_cb, |
31 const StatisticsCB& statistics_cb) OVERRIDE; | 35 const StatisticsCB& statistics_cb) OVERRIDE; |
32 virtual void Read(const ReadCB& read_cb) OVERRIDE; | 36 virtual void Read(const ReadCB& read_cb) OVERRIDE; |
33 virtual void Reset(const base::Closure& closure) OVERRIDE; | 37 virtual void Reset(const base::Closure& closure) OVERRIDE; |
34 virtual void Stop(const base::Closure& closure) OVERRIDE; | 38 virtual void Stop(const base::Closure& closure) OVERRIDE; |
35 | 39 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // and resets them to NULL. | 84 // and resets them to NULL. |
81 void ReleaseFFmpegResources(); | 85 void ReleaseFFmpegResources(); |
82 | 86 |
83 // Reset decoder and call |reset_cb_|. | 87 // Reset decoder and call |reset_cb_|. |
84 void DoReset(); | 88 void DoReset(); |
85 | 89 |
86 // Free decoder resources and call |stop_cb_|. | 90 // Free decoder resources and call |stop_cb_|. |
87 void DoStop(); | 91 void DoStop(); |
88 | 92 |
89 // This is !is_null() iff Initialize() hasn't been called. | 93 // This is !is_null() iff Initialize() hasn't been called. |
90 base::Callback<MessageLoop*()> message_loop_factory_cb_; | 94 MessageLoopFactoryCB message_loop_factory_cb_; |
91 | 95 |
92 MessageLoop* message_loop_; | 96 scoped_refptr<base::MessageLoopProxy> message_loop_; |
93 | 97 |
94 DecoderState state_; | 98 DecoderState state_; |
95 | 99 |
96 StatisticsCB statistics_cb_; | 100 StatisticsCB statistics_cb_; |
97 | 101 |
98 ReadCB read_cb_; | 102 ReadCB read_cb_; |
99 base::Closure reset_cb_; | 103 base::Closure reset_cb_; |
100 base::Closure stop_cb_; | 104 base::Closure stop_cb_; |
101 | 105 |
102 // FFmpeg structures owned by this object. | 106 // FFmpeg structures owned by this object. |
103 AVCodecContext* codec_context_; | 107 AVCodecContext* codec_context_; |
104 AVFrame* av_frame_; | 108 AVFrame* av_frame_; |
105 | 109 |
106 // Pointer to the demuxer stream that will feed us compressed buffers. | 110 // Pointer to the demuxer stream that will feed us compressed buffers. |
107 scoped_refptr<DemuxerStream> demuxer_stream_; | 111 scoped_refptr<DemuxerStream> demuxer_stream_; |
108 | 112 |
109 Decryptor* decryptor_; | 113 Decryptor* decryptor_; |
110 | 114 |
111 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); | 115 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); |
112 }; | 116 }; |
113 | 117 |
114 } // namespace media | 118 } // namespace media |
115 | 119 |
116 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ | 120 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ |
OLD | NEW |