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 | 147 |
148 // Demuxer implementation. | 148 // Demuxer implementation. |
149 virtual void Initialize(DemuxerHost* host, | 149 virtual void Initialize(DemuxerHost* host, |
150 const PipelineStatusCB& status_cb, | 150 const PipelineStatusCB& status_cb, |
151 bool enable_text_tracks) OVERRIDE; | 151 bool enable_text_tracks) OVERRIDE; |
152 virtual void Stop(const base::Closure& callback) OVERRIDE; | 152 virtual void Stop(const base::Closure& callback) OVERRIDE; |
153 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE; | 153 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE; |
154 virtual void OnAudioRendererDisabled() OVERRIDE; | 154 virtual void OnAudioRendererDisabled() OVERRIDE; |
155 virtual DemuxerStream* GetStream(DemuxerStream::Type type) OVERRIDE; | 155 virtual DemuxerStream* GetStream(DemuxerStream::Type type) OVERRIDE; |
156 virtual base::TimeDelta GetStartTime() const OVERRIDE; | 156 virtual base::TimeDelta GetStartTime() const OVERRIDE; |
| 157 virtual base::Time GetTimelineOffset() const OVERRIDE; |
157 | 158 |
158 // Calls |need_key_cb_| with the initialization data encountered in the file. | 159 // Calls |need_key_cb_| with the initialization data encountered in the file. |
159 void FireNeedKey(const std::string& init_data_type, | 160 void FireNeedKey(const std::string& init_data_type, |
160 const std::string& encryption_key_id); | 161 const std::string& encryption_key_id); |
161 | 162 |
162 // Allow FFmpegDemuxerStream to notify us when there is updated information | 163 // Allow FFmpegDemuxerStream to notify us when there is updated information |
163 // about capacity and what buffered data is available. | 164 // about capacity and what buffered data is available. |
164 void NotifyCapacityAvailable(); | 165 void NotifyCapacityAvailable(); |
165 void NotifyBufferingChanged(); | 166 void NotifyBufferingChanged(); |
166 | 167 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 scoped_refptr<MediaLog> media_log_; | 240 scoped_refptr<MediaLog> media_log_; |
240 | 241 |
241 // Derived bitrate after initialization has completed. | 242 // Derived bitrate after initialization has completed. |
242 int bitrate_; | 243 int bitrate_; |
243 | 244 |
244 // The first timestamp of the opened media file. This is used to set the | 245 // The first timestamp of the opened media file. This is used to set the |
245 // starting clock value to match the timestamps in the media file. Default | 246 // starting clock value to match the timestamps in the media file. Default |
246 // is 0. | 247 // is 0. |
247 base::TimeDelta start_time_; | 248 base::TimeDelta start_time_; |
248 | 249 |
| 250 // The Time associated with timestamp 0. Set to a null |
| 251 // time if the file doesn't have an association to Time. |
| 252 base::Time timeline_offset_; |
| 253 |
249 // Whether audio has been disabled for this demuxer (in which case this class | 254 // Whether audio has been disabled for this demuxer (in which case this class |
250 // drops packets destined for AUDIO demuxer streams on the floor). | 255 // drops packets destined for AUDIO demuxer streams on the floor). |
251 bool audio_disabled_; | 256 bool audio_disabled_; |
252 | 257 |
253 // Whether text streams have been enabled for this demuxer. | 258 // Whether text streams have been enabled for this demuxer. |
254 bool text_enabled_; | 259 bool text_enabled_; |
255 | 260 |
256 // Set if we know duration of the audio stream. Used when processing end of | 261 // Set if we know duration of the audio stream. Used when processing end of |
257 // stream -- at this moment we definitely know duration. | 262 // stream -- at this moment we definitely know duration. |
258 bool duration_known_; | 263 bool duration_known_; |
259 | 264 |
260 // FFmpegURLProtocol implementation and corresponding glue bits. | 265 // FFmpegURLProtocol implementation and corresponding glue bits. |
261 scoped_ptr<BlockingUrlProtocol> url_protocol_; | 266 scoped_ptr<BlockingUrlProtocol> url_protocol_; |
262 scoped_ptr<FFmpegGlue> glue_; | 267 scoped_ptr<FFmpegGlue> glue_; |
263 | 268 |
264 const NeedKeyCB need_key_cb_; | 269 const NeedKeyCB need_key_cb_; |
265 | 270 |
266 // NOTE: Weak pointers must be invalidated before all other member variables. | 271 // NOTE: Weak pointers must be invalidated before all other member variables. |
267 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_; | 272 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_; |
268 | 273 |
269 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); | 274 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); |
270 }; | 275 }; |
271 | 276 |
272 } // namespace media | 277 } // namespace media |
273 | 278 |
274 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ | 279 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ |
OLD | NEW |