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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 // FFmpegDemuxerStream. | 198 // FFmpegDemuxerStream. |
199 FFmpegDemuxerStream* GetFFmpegStream(DemuxerStream::Type type) const; | 199 FFmpegDemuxerStream* GetFFmpegStream(DemuxerStream::Type type) const; |
200 | 200 |
201 // Called after the streams have been collected from the media, to allow | 201 // Called after the streams have been collected from the media, to allow |
202 // the text renderer to bind each text stream to the cue rendering engine. | 202 // the text renderer to bind each text stream to the cue rendering engine. |
203 void AddTextStreams(); | 203 void AddTextStreams(); |
204 | 204 |
205 DemuxerHost* host_; | 205 DemuxerHost* host_; |
206 | 206 |
207 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 207 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
208 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_; | |
209 base::WeakPtr<FFmpegDemuxer> weak_this_; | |
210 | 208 |
211 // Thread on which all blocking FFmpeg operations are executed. | 209 // Thread on which all blocking FFmpeg operations are executed. |
212 base::Thread blocking_thread_; | 210 base::Thread blocking_thread_; |
213 | 211 |
214 // Tracks if there's an outstanding av_read_frame() operation. | 212 // Tracks if there's an outstanding av_read_frame() operation. |
215 // | 213 // |
216 // TODO(scherkus): Allow more than one read in flight for higher read | 214 // TODO(scherkus): Allow more than one read in flight for higher read |
217 // throughput using demuxer_bench to verify improvements. | 215 // throughput using demuxer_bench to verify improvements. |
218 bool pending_read_; | 216 bool pending_read_; |
219 | 217 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 // Set if we know duration of the audio stream. Used when processing end of | 255 // Set if we know duration of the audio stream. Used when processing end of |
258 // stream -- at this moment we definitely know duration. | 256 // stream -- at this moment we definitely know duration. |
259 bool duration_known_; | 257 bool duration_known_; |
260 | 258 |
261 // FFmpegURLProtocol implementation and corresponding glue bits. | 259 // FFmpegURLProtocol implementation and corresponding glue bits. |
262 scoped_ptr<BlockingUrlProtocol> url_protocol_; | 260 scoped_ptr<BlockingUrlProtocol> url_protocol_; |
263 scoped_ptr<FFmpegGlue> glue_; | 261 scoped_ptr<FFmpegGlue> glue_; |
264 | 262 |
265 const NeedKeyCB need_key_cb_; | 263 const NeedKeyCB need_key_cb_; |
266 | 264 |
| 265 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 266 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_; |
| 267 |
267 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); | 268 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); |
268 }; | 269 }; |
269 | 270 |
270 } // namespace media | 271 } // namespace media |
271 | 272 |
272 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ | 273 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ |
OLD | NEW |