| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 void SetEndOfStream(); | 70 void SetEndOfStream(); |
| 71 | 71 |
| 72 // Drops queued buffers and clears end of stream state. | 72 // Drops queued buffers and clears end of stream state. |
| 73 void FlushBuffers(); | 73 void FlushBuffers(); |
| 74 | 74 |
| 75 // Empties the queues and ignores any additional calls to Read(). | 75 // Empties the queues and ignores any additional calls to Read(). |
| 76 void Stop(); | 76 void Stop(); |
| 77 | 77 |
| 78 base::TimeDelta duration() const { return duration_; } | 78 base::TimeDelta duration() const { return duration_; } |
| 79 | 79 |
| 80 // Enables fixes for ogg files with negative timestamps. For AUDIO streams, | 80 // Enables fixes for files with negative timestamps. Normally all timestamps |
| 81 // all packets with negative timestamps will be marked for post-decode | 81 // are rebased against FFmpegDemuxer::start_time() whenever that value is |
| 82 // discard. For all other stream types, if FFmpegDemuxer::start_time() is | 82 // negative. When this fix is enabled, only AUDIO stream packets will be |
| 83 // negative, it will not be used to shift timestamps during EnqueuePacket(). | 83 // rebased to time zero, all other stream types will use the muxed timestamp. |
| 84 void enable_negative_timestamp_fixups_for_ogg() { | 84 // |
| 85 fixup_negative_ogg_timestamps_ = true; | 85 // Further, when no codec delay is present, all AUDIO packets which originally |
| 86 // had negative timestamps will be marked for post-decode discard. When codec |
| 87 // delay is present, it is assumed the decoder will handle discard and does |
| 88 // not need the AUDIO packets to be marked for discard; just rebased to zero. |
| 89 void enable_negative_timestamp_fixups() { |
| 90 fixup_negative_timestamps_ = true; |
| 86 } | 91 } |
| 87 | 92 |
| 88 // DemuxerStream implementation. | 93 // DemuxerStream implementation. |
| 89 Type type() const override; | 94 Type type() const override; |
| 90 Liveness liveness() const override; | 95 Liveness liveness() const override; |
| 91 void Read(const ReadCB& read_cb) override; | 96 void Read(const ReadCB& read_cb) override; |
| 92 void EnableBitstreamConverter() override; | 97 void EnableBitstreamConverter() override; |
| 93 bool SupportsConfigChanges() override; | 98 bool SupportsConfigChanges() override; |
| 94 AudioDecoderConfig audio_decoder_config() override; | 99 AudioDecoderConfig audio_decoder_config() override; |
| 95 VideoDecoderConfig video_decoder_config() override; | 100 VideoDecoderConfig video_decoder_config() override; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 VideoRotation video_rotation_; | 153 VideoRotation video_rotation_; |
| 149 | 154 |
| 150 DecoderBufferQueue buffer_queue_; | 155 DecoderBufferQueue buffer_queue_; |
| 151 ReadCB read_cb_; | 156 ReadCB read_cb_; |
| 152 | 157 |
| 153 #if defined(USE_PROPRIETARY_CODECS) | 158 #if defined(USE_PROPRIETARY_CODECS) |
| 154 scoped_ptr<FFmpegBitstreamConverter> bitstream_converter_; | 159 scoped_ptr<FFmpegBitstreamConverter> bitstream_converter_; |
| 155 #endif | 160 #endif |
| 156 | 161 |
| 157 std::string encryption_key_id_; | 162 std::string encryption_key_id_; |
| 158 bool fixup_negative_ogg_timestamps_; | 163 bool fixup_negative_timestamps_; |
| 159 | 164 |
| 160 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxerStream); | 165 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxerStream); |
| 161 }; | 166 }; |
| 162 | 167 |
| 163 class MEDIA_EXPORT FFmpegDemuxer : public Demuxer { | 168 class MEDIA_EXPORT FFmpegDemuxer : public Demuxer { |
| 164 public: | 169 public: |
| 165 FFmpegDemuxer(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 170 FFmpegDemuxer(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 166 DataSource* data_source, | 171 DataSource* data_source, |
| 167 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb, | 172 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb, |
| 168 const scoped_refptr<MediaLog>& media_log); | 173 const scoped_refptr<MediaLog>& media_log); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 310 |
| 306 // NOTE: Weak pointers must be invalidated before all other member variables. | 311 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 307 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_; | 312 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_; |
| 308 | 313 |
| 309 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); | 314 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); |
| 310 }; | 315 }; |
| 311 | 316 |
| 312 } // namespace media | 317 } // namespace media |
| 313 | 318 |
| 314 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ | 319 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ |
| OLD | NEW |