| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 fixup_negative_ogg_timestamps_ = true; | 85 fixup_negative_ogg_timestamps_ = true; |
| 86 } | 86 } |
| 87 | 87 |
| 88 // DemuxerStream implementation. | 88 // DemuxerStream implementation. |
| 89 virtual Type type() OVERRIDE; | 89 virtual Type type() OVERRIDE; |
| 90 virtual void Read(const ReadCB& read_cb) OVERRIDE; | 90 virtual void Read(const ReadCB& read_cb) OVERRIDE; |
| 91 virtual void EnableBitstreamConverter() OVERRIDE; | 91 virtual void EnableBitstreamConverter() OVERRIDE; |
| 92 virtual bool SupportsConfigChanges() OVERRIDE; | 92 virtual bool SupportsConfigChanges() OVERRIDE; |
| 93 virtual AudioDecoderConfig audio_decoder_config() OVERRIDE; | 93 virtual AudioDecoderConfig audio_decoder_config() OVERRIDE; |
| 94 virtual VideoDecoderConfig video_decoder_config() OVERRIDE; | 94 virtual VideoDecoderConfig video_decoder_config() OVERRIDE; |
| 95 virtual VideoRotation video_rotation() OVERRIDE; |
| 96 virtual void set_video_rotation(VideoRotation) OVERRIDE; |
| 95 | 97 |
| 96 // Returns the range of buffered data in this stream. | 98 // Returns the range of buffered data in this stream. |
| 97 Ranges<base::TimeDelta> GetBufferedRanges() const; | 99 Ranges<base::TimeDelta> GetBufferedRanges() const; |
| 98 | 100 |
| 99 // Returns elapsed time based on the already queued packets. | 101 // Returns elapsed time based on the already queued packets. |
| 100 // Used to determine stream duration when it's not known ahead of time. | 102 // Used to determine stream duration when it's not known ahead of time. |
| 101 base::TimeDelta GetElapsedTime() const; | 103 base::TimeDelta GetElapsedTime() const; |
| 102 | 104 |
| 103 // Returns true if this stream has capacity for additional data. | 105 // Returns true if this stream has capacity for additional data. |
| 104 bool HasAvailableCapacity(); | 106 bool HasAvailableCapacity(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 126 FFmpegDemuxer* demuxer_; | 128 FFmpegDemuxer* demuxer_; |
| 127 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 129 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 128 AVStream* stream_; | 130 AVStream* stream_; |
| 129 AudioDecoderConfig audio_config_; | 131 AudioDecoderConfig audio_config_; |
| 130 VideoDecoderConfig video_config_; | 132 VideoDecoderConfig video_config_; |
| 131 Type type_; | 133 Type type_; |
| 132 base::TimeDelta duration_; | 134 base::TimeDelta duration_; |
| 133 bool end_of_stream_; | 135 bool end_of_stream_; |
| 134 base::TimeDelta last_packet_timestamp_; | 136 base::TimeDelta last_packet_timestamp_; |
| 135 Ranges<base::TimeDelta> buffered_ranges_; | 137 Ranges<base::TimeDelta> buffered_ranges_; |
| 138 VideoRotation video_rotation_; |
| 136 | 139 |
| 137 DecoderBufferQueue buffer_queue_; | 140 DecoderBufferQueue buffer_queue_; |
| 138 ReadCB read_cb_; | 141 ReadCB read_cb_; |
| 139 | 142 |
| 140 #if defined(USE_PROPRIETARY_CODECS) | 143 #if defined(USE_PROPRIETARY_CODECS) |
| 141 scoped_ptr<FFmpegH264ToAnnexBBitstreamConverter> bitstream_converter_; | 144 scoped_ptr<FFmpegH264ToAnnexBBitstreamConverter> bitstream_converter_; |
| 142 #endif | 145 #endif |
| 143 | 146 |
| 144 bool bitstream_converter_enabled_; | 147 bool bitstream_converter_enabled_; |
| 145 | 148 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 // point occurs after its associated start time. Otherwise it will use | 273 // point occurs after its associated start time. Otherwise it will use |
| 271 // |fallback_stream_for_seeking_|. | 274 // |fallback_stream_for_seeking_|. |
| 272 typedef std::pair<int, base::TimeDelta> StreamSeekInfo; | 275 typedef std::pair<int, base::TimeDelta> StreamSeekInfo; |
| 273 StreamSeekInfo preferred_stream_for_seeking_; | 276 StreamSeekInfo preferred_stream_for_seeking_; |
| 274 StreamSeekInfo fallback_stream_for_seeking_; | 277 StreamSeekInfo fallback_stream_for_seeking_; |
| 275 | 278 |
| 276 // The Time associated with timestamp 0. Set to a null | 279 // The Time associated with timestamp 0. Set to a null |
| 277 // time if the file doesn't have an association to Time. | 280 // time if the file doesn't have an association to Time. |
| 278 base::Time timeline_offset_; | 281 base::Time timeline_offset_; |
| 279 | 282 |
| 283 VideoRotation video_rotation_; |
| 284 |
| 280 // Liveness of the stream. | 285 // Liveness of the stream. |
| 281 Liveness liveness_; | 286 Liveness liveness_; |
| 282 | 287 |
| 283 // Whether text streams have been enabled for this demuxer. | 288 // Whether text streams have been enabled for this demuxer. |
| 284 bool text_enabled_; | 289 bool text_enabled_; |
| 285 | 290 |
| 286 // Set if we know duration of the audio stream. Used when processing end of | 291 // Set if we know duration of the audio stream. Used when processing end of |
| 287 // stream -- at this moment we definitely know duration. | 292 // stream -- at this moment we definitely know duration. |
| 288 bool duration_known_; | 293 bool duration_known_; |
| 289 | 294 |
| 290 // FFmpegURLProtocol implementation and corresponding glue bits. | 295 // FFmpegURLProtocol implementation and corresponding glue bits. |
| 291 scoped_ptr<BlockingUrlProtocol> url_protocol_; | 296 scoped_ptr<BlockingUrlProtocol> url_protocol_; |
| 292 scoped_ptr<FFmpegGlue> glue_; | 297 scoped_ptr<FFmpegGlue> glue_; |
| 293 | 298 |
| 294 const NeedKeyCB need_key_cb_; | 299 const NeedKeyCB need_key_cb_; |
| 295 | 300 |
| 296 // NOTE: Weak pointers must be invalidated before all other member variables. | 301 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 297 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_; | 302 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_; |
| 298 | 303 |
| 299 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); | 304 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); |
| 300 }; | 305 }; |
| 301 | 306 |
| 302 } // namespace media | 307 } // namespace media |
| 303 | 308 |
| 304 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ | 309 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ |
| OLD | NEW |