| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 std::string encryption_key_id_; | 157 std::string encryption_key_id_; |
| 158 bool fixup_negative_ogg_timestamps_; | 158 bool fixup_negative_ogg_timestamps_; |
| 159 | 159 |
| 160 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxerStream); | 160 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxerStream); |
| 161 }; | 161 }; |
| 162 | 162 |
| 163 class MEDIA_EXPORT FFmpegDemuxer : public Demuxer { | 163 class MEDIA_EXPORT FFmpegDemuxer : public Demuxer { |
| 164 public: | 164 public: |
| 165 FFmpegDemuxer(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 165 FFmpegDemuxer(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 166 DataSource* data_source, | 166 DataSource* data_source, |
| 167 const NeedKeyCB& need_key_cb, | 167 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb, |
| 168 const scoped_refptr<MediaLog>& media_log); | 168 const scoped_refptr<MediaLog>& media_log); |
| 169 ~FFmpegDemuxer() override; | 169 ~FFmpegDemuxer() override; |
| 170 | 170 |
| 171 // Demuxer implementation. | 171 // Demuxer implementation. |
| 172 void Initialize(DemuxerHost* host, | 172 void Initialize(DemuxerHost* host, |
| 173 const PipelineStatusCB& status_cb, | 173 const PipelineStatusCB& status_cb, |
| 174 bool enable_text_tracks) override; | 174 bool enable_text_tracks) override; |
| 175 void Stop() override; | 175 void Stop() override; |
| 176 void Seek(base::TimeDelta time, const PipelineStatusCB& cb) override; | 176 void Seek(base::TimeDelta time, const PipelineStatusCB& cb) override; |
| 177 base::Time GetTimelineOffset() const override; | 177 base::Time GetTimelineOffset() const override; |
| 178 DemuxerStream* GetStream(DemuxerStream::Type type) override; | 178 DemuxerStream* GetStream(DemuxerStream::Type type) override; |
| 179 base::TimeDelta GetStartTime() const override; | 179 base::TimeDelta GetStartTime() const override; |
| 180 | 180 |
| 181 // Calls |need_key_cb_| with the initialization data encountered in the file. | 181 // Calls |encrypted_media_init_data_cb_| with the initialization data |
| 182 void FireNeedKey(const std::string& init_data_type, | 182 // encountered in the file. |
| 183 const std::string& encryption_key_id); | 183 void OnEncryptedMediaInitData(const std::string& init_data_type, |
| 184 const std::string& encryption_key_id); |
| 184 | 185 |
| 185 // Allow FFmpegDemuxerStream to notify us when there is updated information | 186 // Allow FFmpegDemuxerStream to notify us when there is updated information |
| 186 // about capacity and what buffered data is available. | 187 // about capacity and what buffered data is available. |
| 187 void NotifyCapacityAvailable(); | 188 void NotifyCapacityAvailable(); |
| 188 void NotifyBufferingChanged(); | 189 void NotifyBufferingChanged(); |
| 189 | 190 |
| 190 // The lowest demuxed timestamp. If negative, DemuxerStreams must use this to | 191 // The lowest demuxed timestamp. If negative, DemuxerStreams must use this to |
| 191 // adjust packet timestamps such that external clients see a zero-based | 192 // adjust packet timestamps such that external clients see a zero-based |
| 192 // timeline. | 193 // timeline. |
| 193 base::TimeDelta start_time() const { return start_time_; } | 194 base::TimeDelta start_time() const { return start_time_; } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 bool text_enabled_; | 293 bool text_enabled_; |
| 293 | 294 |
| 294 // Set if we know duration of the audio stream. Used when processing end of | 295 // Set if we know duration of the audio stream. Used when processing end of |
| 295 // stream -- at this moment we definitely know duration. | 296 // stream -- at this moment we definitely know duration. |
| 296 bool duration_known_; | 297 bool duration_known_; |
| 297 | 298 |
| 298 // FFmpegURLProtocol implementation and corresponding glue bits. | 299 // FFmpegURLProtocol implementation and corresponding glue bits. |
| 299 scoped_ptr<BlockingUrlProtocol> url_protocol_; | 300 scoped_ptr<BlockingUrlProtocol> url_protocol_; |
| 300 scoped_ptr<FFmpegGlue> glue_; | 301 scoped_ptr<FFmpegGlue> glue_; |
| 301 | 302 |
| 302 const NeedKeyCB need_key_cb_; | 303 const EncryptedMediaInitDataCB encrypted_media_init_data_cb_; |
| 303 | 304 |
| 304 // NOTE: Weak pointers must be invalidated before all other member variables. | 305 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 305 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_; | 306 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_; |
| 306 | 307 |
| 307 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); | 308 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); |
| 308 }; | 309 }; |
| 309 | 310 |
| 310 } // namespace media | 311 } // namespace media |
| 311 | 312 |
| 312 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ | 313 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ |
| OLD | NEW |