| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 namespace media { | 53 namespace media { |
| 54 | 54 |
| 55 class MediaLog; | 55 class MediaLog; |
| 56 class FFmpegBitstreamConverter; | 56 class FFmpegBitstreamConverter; |
| 57 class FFmpegDemuxer; | 57 class FFmpegDemuxer; |
| 58 class FFmpegGlue; | 58 class FFmpegGlue; |
| 59 | 59 |
| 60 typedef std::unique_ptr<AVPacket, ScopedPtrAVFreePacket> ScopedAVPacket; | 60 typedef std::unique_ptr<AVPacket, ScopedPtrAVFreePacket> ScopedAVPacket; |
| 61 | 61 |
| 62 class FFmpegDemuxerStream : public DemuxerStream { | 62 class MEDIA_EXPORT FFmpegDemuxerStream : public DemuxerStream { |
| 63 public: | 63 public: |
| 64 // Attempts to create FFmpegDemuxerStream form the given AVStream. Will return | 64 // Attempts to create FFmpegDemuxerStream form the given AVStream. Will return |
| 65 // null if the AVStream cannot be translated into a valid decoder config. | 65 // null if the AVStream cannot be translated into a valid decoder config. |
| 66 // | 66 // |
| 67 // FFmpegDemuxerStream keeps a copy of |demuxer| and initializes itself using | 67 // FFmpegDemuxerStream keeps a copy of |demuxer| and initializes itself using |
| 68 // information inside |stream|. Both parameters must outlive |this|. | 68 // information inside |stream|. Both parameters must outlive |this|. |
| 69 static std::unique_ptr<FFmpegDemuxerStream> Create( | 69 static std::unique_ptr<FFmpegDemuxerStream> Create( |
| 70 FFmpegDemuxer* demuxer, | 70 FFmpegDemuxer* demuxer, |
| 71 AVStream* stream, | 71 AVStream* stream, |
| 72 const scoped_refptr<MediaLog>& media_log); | 72 const scoped_refptr<MediaLog>& media_log); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 // DemuxerStream implementation. | 108 // DemuxerStream implementation. |
| 109 Type type() const override; | 109 Type type() const override; |
| 110 Liveness liveness() const override; | 110 Liveness liveness() const override; |
| 111 void Read(const ReadCB& read_cb) override; | 111 void Read(const ReadCB& read_cb) override; |
| 112 void EnableBitstreamConverter() override; | 112 void EnableBitstreamConverter() override; |
| 113 bool SupportsConfigChanges() override; | 113 bool SupportsConfigChanges() override; |
| 114 AudioDecoderConfig audio_decoder_config() override; | 114 AudioDecoderConfig audio_decoder_config() override; |
| 115 VideoDecoderConfig video_decoder_config() override; | 115 VideoDecoderConfig video_decoder_config() override; |
| 116 VideoRotation video_rotation() override; | 116 VideoRotation video_rotation() override; |
| 117 bool enabled() const override; | 117 |
| 118 void set_enabled(bool enabled, base::TimeDelta timestamp) override; | 118 bool enabled() const; |
| 119 void set_enabled(bool enabled, base::TimeDelta timestamp); |
| 119 | 120 |
| 120 void SetStreamStatusChangeCB(const StreamStatusChangeCB& cb); | 121 void SetStreamStatusChangeCB(const StreamStatusChangeCB& cb); |
| 121 | 122 |
| 122 void SetLiveness(Liveness liveness); | 123 void SetLiveness(Liveness liveness); |
| 123 | 124 |
| 124 // Returns the range of buffered data in this stream. | 125 // Returns the range of buffered data in this stream. |
| 125 Ranges<base::TimeDelta> GetBufferedRanges() const; | 126 Ranges<base::TimeDelta> GetBufferedRanges() const; |
| 126 | 127 |
| 127 // Returns true if this stream has capacity for additional data. | 128 // Returns true if this stream has capacity for additional data. |
| 128 bool HasAvailableCapacity(); | 129 bool HasAvailableCapacity(); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 base::TimeDelta duration_; | 357 base::TimeDelta duration_; |
| 357 | 358 |
| 358 // FFmpegURLProtocol implementation and corresponding glue bits. | 359 // FFmpegURLProtocol implementation and corresponding glue bits. |
| 359 std::unique_ptr<BlockingUrlProtocol> url_protocol_; | 360 std::unique_ptr<BlockingUrlProtocol> url_protocol_; |
| 360 std::unique_ptr<FFmpegGlue> glue_; | 361 std::unique_ptr<FFmpegGlue> glue_; |
| 361 | 362 |
| 362 const EncryptedMediaInitDataCB encrypted_media_init_data_cb_; | 363 const EncryptedMediaInitDataCB encrypted_media_init_data_cb_; |
| 363 | 364 |
| 364 const MediaTracksUpdatedCB media_tracks_updated_cb_; | 365 const MediaTracksUpdatedCB media_tracks_updated_cb_; |
| 365 | 366 |
| 366 std::map<MediaTrack::Id, DemuxerStream*> track_id_to_demux_stream_map_; | 367 std::map<MediaTrack::Id, FFmpegDemuxerStream*> track_id_to_demux_stream_map_; |
| 367 | 368 |
| 368 // NOTE: Weak pointers must be invalidated before all other member variables. | 369 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 369 base::WeakPtr<FFmpegDemuxer> weak_this_; | 370 base::WeakPtr<FFmpegDemuxer> weak_this_; |
| 370 base::WeakPtrFactory<FFmpegDemuxer> cancel_pending_seek_factory_; | 371 base::WeakPtrFactory<FFmpegDemuxer> cancel_pending_seek_factory_; |
| 371 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_; | 372 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_; |
| 372 | 373 |
| 373 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); | 374 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); |
| 374 }; | 375 }; |
| 375 | 376 |
| 376 } // namespace media | 377 } // namespace media |
| 377 | 378 |
| 378 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ | 379 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ |
| OLD | NEW |