OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 // | 154 // |
155 // Must be called on the demuxer thread. | 155 // Must be called on the demuxer thread. |
156 bool StreamsHavePendingReads(); | 156 bool StreamsHavePendingReads(); |
157 | 157 |
158 // Signal all FFmpegDemuxerStream that the stream has ended. | 158 // Signal all FFmpegDemuxerStream that the stream has ended. |
159 // | 159 // |
160 // Must be called on the demuxer thread. | 160 // Must be called on the demuxer thread. |
161 void StreamHasEnded(); | 161 void StreamHasEnded(); |
162 | 162 |
163 // FFmpeg context handle. | 163 // FFmpeg context handle. |
164 scoped_ptr_malloc<AVFormatContext, ScopedPtrAVFree> format_context_; | 164 AVFormatContext* format_context_; |
165 | 165 |
166 // Latest timestamp read on the demuxer thread. | 166 // Latest timestamp read on the demuxer thread. |
167 base::TimeDelta current_timestamp_; | 167 base::TimeDelta current_timestamp_; |
168 | 168 |
169 // Two vector of streams: | 169 // Two vector of streams: |
170 // - |streams_| is indexed for the Demuxer interface GetStream(), which only | 170 // - |streams_| is indexed for the Demuxer interface GetStream(), which only |
171 // contains supported streams and no NULL entries. | 171 // contains supported streams and no NULL entries. |
172 // - |packet_streams_| is indexed to mirror AVFormatContext when dealing | 172 // - |packet_streams_| is indexed to mirror AVFormatContext when dealing |
173 // with AVPackets returned from av_read_frame() and contain NULL entries | 173 // with AVPackets returned from av_read_frame() and contain NULL entries |
174 // representing unsupported streams where we throw away the data. | 174 // representing unsupported streams where we throw away the data. |
175 // | 175 // |
176 // Ownership is handled via reference counting. | 176 // Ownership is handled via reference counting. |
177 // | 177 // |
178 // Once initialized, operations on FFmpegDemuxerStreams should be carried out | 178 // Once initialized, operations on FFmpegDemuxerStreams should be carried out |
179 // on the demuxer thread. | 179 // on the demuxer thread. |
180 typedef std::vector< scoped_refptr<FFmpegDemuxerStream> > StreamVector; | 180 typedef std::vector< scoped_refptr<FFmpegDemuxerStream> > StreamVector; |
181 StreamVector streams_; | 181 StreamVector streams_; |
182 StreamVector packet_streams_; | 182 StreamVector packet_streams_; |
183 | 183 |
184 // Used for debugging. | 184 // Used for debugging. |
185 PlatformThreadId thread_id_; | 185 PlatformThreadId thread_id_; |
186 | 186 |
187 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); | 187 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); |
188 }; | 188 }; |
189 | 189 |
190 } // namespace media | 190 } // namespace media |
191 | 191 |
192 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ | 192 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ |
OLD | NEW |