| 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 private: | 147 private: |
| 148 friend class FFmpegDemuxerTest; | 148 friend class FFmpegDemuxerTest; |
| 149 | 149 |
| 150 // Use FFmpegDemuxerStream::Create to construct. | 150 // Use FFmpegDemuxerStream::Create to construct. |
| 151 // Audio/Video streams must include their respective DecoderConfig. At most | 151 // Audio/Video streams must include their respective DecoderConfig. At most |
| 152 // one DecoderConfig should be provided (leaving the other nullptr). Both | 152 // one DecoderConfig should be provided (leaving the other nullptr). Both |
| 153 // configs should be null for text streams. | 153 // configs should be null for text streams. |
| 154 FFmpegDemuxerStream(FFmpegDemuxer* demuxer, | 154 FFmpegDemuxerStream(FFmpegDemuxer* demuxer, |
| 155 AVStream* stream, | 155 AVStream* stream, |
| 156 std::unique_ptr<AudioDecoderConfig> audio_config, | 156 std::unique_ptr<AudioDecoderConfig> audio_config, |
| 157 std::unique_ptr<VideoDecoderConfig> video_config); | 157 std::unique_ptr<VideoDecoderConfig> video_config, |
| 158 scoped_refptr<MediaLog> media_log); |
| 158 | 159 |
| 159 // Runs |read_cb_| if present with the front of |buffer_queue_|, calling | 160 // Runs |read_cb_| if present with the front of |buffer_queue_|, calling |
| 160 // NotifyCapacityAvailable() if capacity is still available. | 161 // NotifyCapacityAvailable() if capacity is still available. |
| 161 void SatisfyPendingRead(); | 162 void SatisfyPendingRead(); |
| 162 | 163 |
| 163 // Converts an FFmpeg stream timestamp into a base::TimeDelta. | 164 // Converts an FFmpeg stream timestamp into a base::TimeDelta. |
| 164 static base::TimeDelta ConvertStreamTimestamp(const AVRational& time_base, | 165 static base::TimeDelta ConvertStreamTimestamp(const AVRational& time_base, |
| 165 int64_t timestamp); | 166 int64_t timestamp); |
| 166 | 167 |
| 167 // Resets any currently active bitstream converter. | 168 // Resets any currently active bitstream converter. |
| 168 void ResetBitstreamConverter(); | 169 void ResetBitstreamConverter(); |
| 169 | 170 |
| 170 // Create new bitstream converter, destroying active converter if present. | 171 // Create new bitstream converter, destroying active converter if present. |
| 171 void InitBitstreamConverter(); | 172 void InitBitstreamConverter(); |
| 172 | 173 |
| 173 FFmpegDemuxer* demuxer_; | 174 FFmpegDemuxer* demuxer_; |
| 174 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 175 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 175 AVStream* stream_; | 176 AVStream* stream_; |
| 176 base::TimeDelta start_time_; | 177 base::TimeDelta start_time_; |
| 177 std::unique_ptr<AudioDecoderConfig> audio_config_; | 178 std::unique_ptr<AudioDecoderConfig> audio_config_; |
| 178 std::unique_ptr<VideoDecoderConfig> video_config_; | 179 std::unique_ptr<VideoDecoderConfig> video_config_; |
| 180 scoped_refptr<MediaLog> media_log_; |
| 179 Type type_; | 181 Type type_; |
| 180 Liveness liveness_; | 182 Liveness liveness_; |
| 181 base::TimeDelta duration_; | 183 base::TimeDelta duration_; |
| 182 bool end_of_stream_; | 184 bool end_of_stream_; |
| 183 base::TimeDelta last_packet_timestamp_; | 185 base::TimeDelta last_packet_timestamp_; |
| 184 base::TimeDelta last_packet_duration_; | 186 base::TimeDelta last_packet_duration_; |
| 185 Ranges<base::TimeDelta> buffered_ranges_; | 187 Ranges<base::TimeDelta> buffered_ranges_; |
| 186 VideoRotation video_rotation_; | 188 VideoRotation video_rotation_; |
| 187 bool is_enabled_; | 189 bool is_enabled_; |
| 188 bool waiting_for_keyframe_; | 190 bool waiting_for_keyframe_; |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 base::WeakPtr<FFmpegDemuxer> weak_this_; | 379 base::WeakPtr<FFmpegDemuxer> weak_this_; |
| 378 base::WeakPtrFactory<FFmpegDemuxer> cancel_pending_seek_factory_; | 380 base::WeakPtrFactory<FFmpegDemuxer> cancel_pending_seek_factory_; |
| 379 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_; | 381 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_; |
| 380 | 382 |
| 381 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); | 383 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); |
| 382 }; | 384 }; |
| 383 | 385 |
| 384 } // namespace media | 386 } // namespace media |
| 385 | 387 |
| 386 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ | 388 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ |
| OLD | NEW |