| 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 26 matching lines...) Expand all Loading... |
| 37 #include "media/base/video_decoder_config.h" | 37 #include "media/base/video_decoder_config.h" |
| 38 #include "media/filters/blocking_url_protocol.h" | 38 #include "media/filters/blocking_url_protocol.h" |
| 39 | 39 |
| 40 // FFmpeg forward declarations. | 40 // FFmpeg forward declarations. |
| 41 struct AVPacket; | 41 struct AVPacket; |
| 42 struct AVRational; | 42 struct AVRational; |
| 43 struct AVStream; | 43 struct AVStream; |
| 44 | 44 |
| 45 namespace media { | 45 namespace media { |
| 46 | 46 |
| 47 // A new potentially encrypted stream has been parsed. | |
| 48 // First parameter - The type of initialization data. | |
| 49 // Second parameter - The initialization data associated with the stream. | |
| 50 // Third parameter - Number of bytes of the initialization data. | |
| 51 typedef base::Callback<void(const std::string& type, | |
| 52 scoped_ptr<uint8[]> init_data, | |
| 53 int init_data_size)> FFmpegNeedKeyCB; | |
| 54 | |
| 55 class MediaLog; | 47 class MediaLog; |
| 56 class FFmpegDemuxer; | 48 class FFmpegDemuxer; |
| 57 class FFmpegGlue; | 49 class FFmpegGlue; |
| 58 class FFmpegH264ToAnnexBBitstreamConverter; | 50 class FFmpegH264ToAnnexBBitstreamConverter; |
| 59 class ScopedPtrAVFreePacket; | 51 class ScopedPtrAVFreePacket; |
| 60 | 52 |
| 61 typedef scoped_ptr_malloc<AVPacket, ScopedPtrAVFreePacket> ScopedAVPacket; | 53 typedef scoped_ptr_malloc<AVPacket, ScopedPtrAVFreePacket> ScopedAVPacket; |
| 62 | 54 |
| 63 class FFmpegDemuxerStream : public DemuxerStream { | 55 class FFmpegDemuxerStream : public DemuxerStream { |
| 64 public: | 56 public: |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 123 |
| 132 std::string encryption_key_id_; | 124 std::string encryption_key_id_; |
| 133 | 125 |
| 134 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxerStream); | 126 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxerStream); |
| 135 }; | 127 }; |
| 136 | 128 |
| 137 class MEDIA_EXPORT FFmpegDemuxer : public Demuxer { | 129 class MEDIA_EXPORT FFmpegDemuxer : public Demuxer { |
| 138 public: | 130 public: |
| 139 FFmpegDemuxer(const scoped_refptr<base::MessageLoopProxy>& message_loop, | 131 FFmpegDemuxer(const scoped_refptr<base::MessageLoopProxy>& message_loop, |
| 140 DataSource* data_source, | 132 DataSource* data_source, |
| 141 const FFmpegNeedKeyCB& need_key_cb, | 133 const NeedKeyCB& need_key_cb, |
| 142 const scoped_refptr<MediaLog>& media_log); | 134 const scoped_refptr<MediaLog>& media_log); |
| 143 virtual ~FFmpegDemuxer(); | 135 virtual ~FFmpegDemuxer(); |
| 144 | 136 |
| 145 // Demuxer implementation. | 137 // Demuxer implementation. |
| 146 virtual void Initialize(DemuxerHost* host, | 138 virtual void Initialize(DemuxerHost* host, |
| 147 const PipelineStatusCB& status_cb) OVERRIDE; | 139 const PipelineStatusCB& status_cb) OVERRIDE; |
| 148 virtual void Stop(const base::Closure& callback) OVERRIDE; | 140 virtual void Stop(const base::Closure& callback) OVERRIDE; |
| 149 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE; | 141 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE; |
| 150 virtual void OnAudioRendererDisabled() OVERRIDE; | 142 virtual void OnAudioRendererDisabled() OVERRIDE; |
| 151 virtual void SetPlaybackRate(float playback_rate) OVERRIDE; | 143 virtual void SetPlaybackRate(float playback_rate) OVERRIDE; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 bool audio_disabled_; | 235 bool audio_disabled_; |
| 244 | 236 |
| 245 // Set if we know duration of the audio stream. Used when processing end of | 237 // Set if we know duration of the audio stream. Used when processing end of |
| 246 // stream -- at this moment we definitely know duration. | 238 // stream -- at this moment we definitely know duration. |
| 247 bool duration_known_; | 239 bool duration_known_; |
| 248 | 240 |
| 249 // FFmpegURLProtocol implementation and corresponding glue bits. | 241 // FFmpegURLProtocol implementation and corresponding glue bits. |
| 250 BlockingUrlProtocol url_protocol_; | 242 BlockingUrlProtocol url_protocol_; |
| 251 scoped_ptr<FFmpegGlue> glue_; | 243 scoped_ptr<FFmpegGlue> glue_; |
| 252 | 244 |
| 253 const FFmpegNeedKeyCB need_key_cb_; | 245 const NeedKeyCB need_key_cb_; |
| 254 | 246 |
| 255 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); | 247 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); |
| 256 }; | 248 }; |
| 257 | 249 |
| 258 } // namespace media | 250 } // namespace media |
| 259 | 251 |
| 260 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ | 252 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ |
| OLD | NEW |