OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 // Demuxer implementation. | 140 // Demuxer implementation. |
141 virtual void Stop(const base::Closure& callback) OVERRIDE; | 141 virtual void Stop(const base::Closure& callback) OVERRIDE; |
142 virtual void Seek(base::TimeDelta time, const FilterStatusCB& cb) OVERRIDE; | 142 virtual void Seek(base::TimeDelta time, const FilterStatusCB& cb) OVERRIDE; |
143 virtual void OnAudioRendererDisabled() OVERRIDE; | 143 virtual void OnAudioRendererDisabled() OVERRIDE; |
144 virtual void set_host(FilterHost* filter_host) OVERRIDE; | 144 virtual void set_host(FilterHost* filter_host) OVERRIDE; |
145 virtual void SetPlaybackRate(float playback_rate) OVERRIDE; | 145 virtual void SetPlaybackRate(float playback_rate) OVERRIDE; |
146 virtual scoped_refptr<DemuxerStream> GetStream( | 146 virtual scoped_refptr<DemuxerStream> GetStream( |
147 DemuxerStream::Type type) OVERRIDE; | 147 DemuxerStream::Type type) OVERRIDE; |
148 virtual void SetPreload(Preload preload) OVERRIDE; | 148 virtual void SetPreload(Preload preload) OVERRIDE; |
149 virtual base::TimeDelta GetStartTime() const OVERRIDE; | 149 virtual base::TimeDelta GetStartTime() const OVERRIDE; |
| 150 virtual int GetBitrate() OVERRIDE; |
150 | 151 |
151 // FFmpegURLProtocol implementation. | 152 // FFmpegURLProtocol implementation. |
152 virtual size_t Read(size_t size, uint8* data) OVERRIDE; | 153 virtual size_t Read(size_t size, uint8* data) OVERRIDE; |
153 virtual bool GetPosition(int64* position_out) OVERRIDE; | 154 virtual bool GetPosition(int64* position_out) OVERRIDE; |
154 virtual bool SetPosition(int64 position) OVERRIDE; | 155 virtual bool SetPosition(int64 position) OVERRIDE; |
155 virtual bool GetSize(int64* size_out) OVERRIDE; | 156 virtual bool GetSize(int64* size_out) OVERRIDE; |
156 virtual bool IsStreaming() OVERRIDE; | 157 virtual bool IsStreaming() OVERRIDE; |
157 | 158 |
158 // Provide access to FFmpegDemuxerStream. | 159 // Provide access to FFmpegDemuxerStream. |
159 MessageLoop* message_loop(); | 160 MessageLoop* message_loop(); |
160 | 161 |
161 // For testing purposes. | 162 // For testing purposes. |
162 void disable_first_seek_hack_for_testing() { first_seek_hack_ = false; } | 163 void disable_first_seek_hack_for_testing() { first_seek_hack_ = false; } |
163 | 164 |
164 // Returns the bitrate of media file. May be obtained from container or | |
165 // approximated. Returns 0 if it is unknown. | |
166 int GetBitrate(); | |
167 | |
168 private: | 165 private: |
169 // Only allow a factory to create this class. | 166 // Only allow a factory to create this class. |
170 friend class MockFFmpegDemuxer; | 167 friend class MockFFmpegDemuxer; |
171 FRIEND_TEST_ALL_PREFIXES(FFmpegDemuxerTest, ProtocolRead); | 168 FRIEND_TEST_ALL_PREFIXES(FFmpegDemuxerTest, ProtocolRead); |
172 | 169 |
173 // Carries out initialization on the demuxer thread. | 170 // Carries out initialization on the demuxer thread. |
174 void InitializeTask( | 171 void InitializeTask( |
175 DataSource* data_source, const PipelineStatusCB& callback); | 172 DataSource* data_source, const PipelineStatusCB& callback); |
176 | 173 |
177 // Carries out a seek on the demuxer thread. | 174 // Carries out a seek on the demuxer thread. |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 // starting clock value to match the timestamps in the media file. Default | 255 // starting clock value to match the timestamps in the media file. Default |
259 // is 0. | 256 // is 0. |
260 base::TimeDelta start_time_; | 257 base::TimeDelta start_time_; |
261 | 258 |
262 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); | 259 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); |
263 }; | 260 }; |
264 | 261 |
265 } // namespace media | 262 } // namespace media |
266 | 263 |
267 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ | 264 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ |
OLD | NEW |