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 25 matching lines...) Expand all Loading... |
36 #include "media/filters/ffmpeg_glue.h" | 36 #include "media/filters/ffmpeg_glue.h" |
37 | 37 |
38 // FFmpeg forward declarations. | 38 // FFmpeg forward declarations. |
39 struct AVFormatContext; | 39 struct AVFormatContext; |
40 struct AVPacket; | 40 struct AVPacket; |
41 struct AVRational; | 41 struct AVRational; |
42 struct AVStream; | 42 struct AVStream; |
43 | 43 |
44 namespace media { | 44 namespace media { |
45 | 45 |
46 class BitstreamConverter; | |
47 class FFmpegDemuxer; | 46 class FFmpegDemuxer; |
| 47 class FFmpegH264ToAnnexBBitstreamConverter; |
48 class ScopedPtrAVFreePacket; | 48 class ScopedPtrAVFreePacket; |
49 | 49 |
50 class FFmpegDemuxerStream : public DemuxerStream { | 50 class FFmpegDemuxerStream : public DemuxerStream { |
51 public: | 51 public: |
52 // Keeps a copy of |demuxer| and initializes itself using information | 52 // Keeps a copy of |demuxer| and initializes itself using information |
53 // inside |stream|. Both parameters must outlive |this|. | 53 // inside |stream|. Both parameters must outlive |this|. |
54 FFmpegDemuxerStream(FFmpegDemuxer* demuxer, AVStream* stream); | 54 FFmpegDemuxerStream(FFmpegDemuxer* demuxer, AVStream* stream); |
55 | 55 |
56 // Returns true is this stream has pending reads, false otherwise. | 56 // Returns true is this stream has pending reads, false otherwise. |
57 // | 57 // |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 bool stopped_; | 118 bool stopped_; |
119 base::TimeDelta last_packet_timestamp_; | 119 base::TimeDelta last_packet_timestamp_; |
120 Ranges<base::TimeDelta> buffered_ranges_; | 120 Ranges<base::TimeDelta> buffered_ranges_; |
121 | 121 |
122 typedef std::deque<scoped_refptr<DecoderBuffer> > BufferQueue; | 122 typedef std::deque<scoped_refptr<DecoderBuffer> > BufferQueue; |
123 BufferQueue buffer_queue_; | 123 BufferQueue buffer_queue_; |
124 | 124 |
125 typedef std::deque<ReadCB> ReadQueue; | 125 typedef std::deque<ReadCB> ReadQueue; |
126 ReadQueue read_queue_; | 126 ReadQueue read_queue_; |
127 | 127 |
128 // Used to translate bitstream formats. | 128 scoped_ptr<FFmpegH264ToAnnexBBitstreamConverter> bitstream_converter_; |
129 scoped_ptr<BitstreamConverter> bitstream_converter_; | |
130 | 129 |
131 // Used to synchronize access to |buffer_queue_|, |read_queue_|, and | 130 // Used to synchronize access to |buffer_queue_|, |read_queue_|, and |
132 // |stopped_|. This is so other threads can get access to buffers that have | 131 // |stopped_|. This is so other threads can get access to buffers that have |
133 // already been demuxed without having the demuxer thread sending the | 132 // already been demuxed without having the demuxer thread sending the |
134 // buffers. |lock_| must be acquired before any access to |buffer_queue_|, | 133 // buffers. |lock_| must be acquired before any access to |buffer_queue_|, |
135 // |read_queue_|, or |stopped_|. | 134 // |read_queue_|, or |stopped_|. |
136 mutable base::Lock lock_; | 135 mutable base::Lock lock_; |
137 | 136 |
138 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxerStream); | 137 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxerStream); |
139 }; | 138 }; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 // Set if we know duration of the audio stream. Used when processing end of | 261 // Set if we know duration of the audio stream. Used when processing end of |
263 // stream -- at this moment we definitely know duration. | 262 // stream -- at this moment we definitely know duration. |
264 bool duration_known_; | 263 bool duration_known_; |
265 | 264 |
266 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); | 265 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); |
267 }; | 266 }; |
268 | 267 |
269 } // namespace media | 268 } // namespace media |
270 | 269 |
271 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ | 270 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ |
OLD | NEW |