| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 base::Lock lock_; | 126 base::Lock lock_; |
| 127 | 127 |
| 128 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxerStream); | 128 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxerStream); |
| 129 }; | 129 }; |
| 130 | 130 |
| 131 class MEDIA_EXPORT FFmpegDemuxer : public Demuxer, public FFmpegURLProtocol { | 131 class MEDIA_EXPORT FFmpegDemuxer : public Demuxer, public FFmpegURLProtocol { |
| 132 public: | 132 public: |
| 133 FFmpegDemuxer(MessageLoop* message_loop, | 133 FFmpegDemuxer(MessageLoop* message_loop, |
| 134 const scoped_refptr<DataSource>& data_source, | 134 const scoped_refptr<DataSource>& data_source, |
| 135 bool local_source); | 135 bool local_source); |
| 136 virtual ~FFmpegDemuxer(); | |
| 137 | 136 |
| 138 // Posts a task to perform additional demuxing. | 137 // Posts a task to perform additional demuxing. |
| 139 virtual void PostDemuxTask(); | 138 virtual void PostDemuxTask(); |
| 140 | 139 |
| 141 // Demuxer implementation. | 140 // Demuxer implementation. |
| 142 virtual void Initialize(DemuxerHost* host, | 141 virtual void Initialize(DemuxerHost* host, |
| 143 const PipelineStatusCB& status_cb) OVERRIDE; | 142 const PipelineStatusCB& status_cb) OVERRIDE; |
| 144 virtual void Stop(const base::Closure& callback) OVERRIDE; | 143 virtual void Stop(const base::Closure& callback) OVERRIDE; |
| 145 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE; | 144 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE; |
| 146 virtual void OnAudioRendererDisabled() OVERRIDE; | 145 virtual void OnAudioRendererDisabled() OVERRIDE; |
| 147 virtual void SetPlaybackRate(float playback_rate) OVERRIDE; | 146 virtual void SetPlaybackRate(float playback_rate) OVERRIDE; |
| 148 virtual scoped_refptr<DemuxerStream> GetStream( | 147 virtual scoped_refptr<DemuxerStream> GetStream( |
| 149 DemuxerStream::Type type) OVERRIDE; | 148 DemuxerStream::Type type) OVERRIDE; |
| 150 virtual base::TimeDelta GetStartTime() const OVERRIDE; | 149 virtual base::TimeDelta GetStartTime() const OVERRIDE; |
| 151 virtual int GetBitrate() OVERRIDE; | 150 virtual int GetBitrate() OVERRIDE; |
| 152 virtual bool IsLocalSource() OVERRIDE; | 151 virtual bool IsLocalSource() OVERRIDE; |
| 153 virtual bool IsSeekable() OVERRIDE; | 152 virtual bool IsSeekable() OVERRIDE; |
| 154 | 153 |
| 155 // FFmpegURLProtocol implementation. | 154 // FFmpegURLProtocol implementation. |
| 156 virtual size_t Read(size_t size, uint8* data) OVERRIDE; | 155 virtual size_t Read(size_t size, uint8* data) OVERRIDE; |
| 157 virtual bool GetPosition(int64* position_out) OVERRIDE; | 156 virtual bool GetPosition(int64* position_out) OVERRIDE; |
| 158 virtual bool SetPosition(int64 position) OVERRIDE; | 157 virtual bool SetPosition(int64 position) OVERRIDE; |
| 159 virtual bool GetSize(int64* size_out) OVERRIDE; | 158 virtual bool GetSize(int64* size_out) OVERRIDE; |
| 160 virtual bool IsStreaming() OVERRIDE; | 159 virtual bool IsStreaming() OVERRIDE; |
| 161 | 160 |
| 162 // Provide access to FFmpegDemuxerStream. | 161 // Provide access to FFmpegDemuxerStream. |
| 163 MessageLoop* message_loop(); | 162 MessageLoop* message_loop(); |
| 164 | 163 |
| 165 private: | 164 private: |
| 165 virtual ~FFmpegDemuxer(); |
| 166 |
| 166 // Carries out initialization on the demuxer thread. | 167 // Carries out initialization on the demuxer thread. |
| 167 void InitializeTask(DemuxerHost* host, const PipelineStatusCB& status_cb); | 168 void InitializeTask(DemuxerHost* host, const PipelineStatusCB& status_cb); |
| 168 | 169 |
| 169 // Carries out a seek on the demuxer thread. | 170 // Carries out a seek on the demuxer thread. |
| 170 void SeekTask(base::TimeDelta time, const PipelineStatusCB& cb); | 171 void SeekTask(base::TimeDelta time, const PipelineStatusCB& cb); |
| 171 | 172 |
| 172 // Carries out demuxing and satisfying stream reads on the demuxer thread. | 173 // Carries out demuxing and satisfying stream reads on the demuxer thread. |
| 173 void DemuxTask(); | 174 void DemuxTask(); |
| 174 | 175 |
| 175 // Carries out stopping the demuxer streams on the demuxer thread. | 176 // Carries out stopping the demuxer streams on the demuxer thread. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 // Whether audio has been disabled for this demuxer (in which case this class | 248 // Whether audio has been disabled for this demuxer (in which case this class |
| 248 // drops packets destined for AUDIO demuxer streams on the floor). | 249 // drops packets destined for AUDIO demuxer streams on the floor). |
| 249 bool audio_disabled_; | 250 bool audio_disabled_; |
| 250 | 251 |
| 251 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); | 252 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); |
| 252 }; | 253 }; |
| 253 | 254 |
| 254 } // namespace media | 255 } // namespace media |
| 255 | 256 |
| 256 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ | 257 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ |
| OLD | NEW |