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 // Implements the Demuxer interface using FFmpeg's libavformat. At this time | 5 // Implements the Demuxer interface using FFmpeg's libavformat. At this time |
6 // will support demuxing any audio/video format thrown at it. The streams | 6 // will support demuxing any audio/video format thrown at it. The streams |
7 // output mime types audio/x-ffmpeg and video/x-ffmpeg and include an integer | 7 // output mime types audio/x-ffmpeg and video/x-ffmpeg and include an integer |
8 // key FFmpegCodecID which contains the CodecID enumeration value. The CodecIDs | 8 // key FFmpegCodecID which contains the CodecID enumeration value. The CodecIDs |
9 // can be used to create and initialize the corresponding FFmpeg decoder. | 9 // can be used to create and initialize the corresponding FFmpeg decoder. |
10 // | 10 // |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 // about capacity and what buffered data is available. | 147 // about capacity and what buffered data is available. |
148 void NotifyCapacityAvailable(); | 148 void NotifyCapacityAvailable(); |
149 void NotifyBufferingChanged(); | 149 void NotifyBufferingChanged(); |
150 | 150 |
151 private: | 151 private: |
152 // To allow tests access to privates. | 152 // To allow tests access to privates. |
153 friend class FFmpegDemuxerTest; | 153 friend class FFmpegDemuxerTest; |
154 | 154 |
155 virtual ~FFmpegDemuxer(); | 155 virtual ~FFmpegDemuxer(); |
156 | 156 |
157 // Carries out initialization on the demuxer thread. | 157 // FFmpeg callbacks during initialization. |
158 void InitializeTask(DemuxerHost* host, const PipelineStatusCB& status_cb); | |
159 void OnOpenContextDone(const PipelineStatusCB& status_cb, bool result); | 158 void OnOpenContextDone(const PipelineStatusCB& status_cb, bool result); |
160 void OnFindStreamInfoDone(const PipelineStatusCB& status_cb, int result); | 159 void OnFindStreamInfoDone(const PipelineStatusCB& status_cb, int result); |
161 | 160 |
162 // Carries out a seek on the demuxer thread. | 161 // FFmpeg callbacks during seeking. |
163 void SeekTask(base::TimeDelta time, const PipelineStatusCB& cb); | |
164 void OnSeekFrameDone(const PipelineStatusCB& cb, int result); | 162 void OnSeekFrameDone(const PipelineStatusCB& cb, int result); |
165 | 163 |
166 // Carries out demuxing and satisfying stream reads on the demuxer thread. | 164 // FFmpeg callbacks during reading + helper method to initiate reads. |
167 void DemuxTask(); | 165 void ReadFrameIfNeeded(); |
168 void OnReadFrameDone(ScopedAVPacket packet, int result); | 166 void OnReadFrameDone(ScopedAVPacket packet, int result); |
169 | 167 |
170 // Carries out stopping the demuxer streams on the demuxer thread. | 168 // DataSource callbacks during stopping. |
171 void StopTask(const base::Closure& callback); | |
172 void OnDataSourceStopped(const base::Closure& callback); | 169 void OnDataSourceStopped(const base::Closure& callback); |
173 | 170 |
174 // Carries out disabling the audio stream on the demuxer thread. | |
175 void DisableAudioStreamTask(); | |
176 | |
177 // Returns true iff any stream has additional capacity. Note that streams can | 171 // Returns true iff any stream has additional capacity. Note that streams can |
178 // go over capacity depending on how the file is muxed. | 172 // go over capacity depending on how the file is muxed. |
179 bool StreamsHaveAvailableCapacity(); | 173 bool StreamsHaveAvailableCapacity(); |
180 | 174 |
181 // Signal all FFmpegDemuxerStreams that the stream has ended. | 175 // Signal all FFmpegDemuxerStreams that the stream has ended. |
182 void StreamHasEnded(); | 176 void StreamHasEnded(); |
183 | 177 |
184 // Called by |url_protocol_| whenever |data_source_| returns a read error. | 178 // Called by |url_protocol_| whenever |data_source_| returns a read error. |
185 void OnDataSourceError(); | 179 void OnDataSourceError(); |
186 | 180 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 // FFmpegURLProtocol implementation and corresponding glue bits. | 235 // FFmpegURLProtocol implementation and corresponding glue bits. |
242 BlockingUrlProtocol url_protocol_; | 236 BlockingUrlProtocol url_protocol_; |
243 scoped_ptr<FFmpegGlue> glue_; | 237 scoped_ptr<FFmpegGlue> glue_; |
244 | 238 |
245 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); | 239 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); |
246 }; | 240 }; |
247 | 241 |
248 } // namespace media | 242 } // namespace media |
249 | 243 |
250 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ | 244 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ |
OLD | NEW |