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