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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 // | 142 // |
143 // Safe to call on any thread. | 143 // Safe to call on any thread. |
144 bool StreamsHavePendingReads(); | 144 bool StreamsHavePendingReads(); |
145 | 145 |
146 // FFmpeg context handle. | 146 // FFmpeg context handle. |
147 scoped_ptr_malloc<AVFormatContext, ScopedPtrAVFree> format_context_; | 147 scoped_ptr_malloc<AVFormatContext, ScopedPtrAVFree> format_context_; |
148 | 148 |
149 // Latest timestamp read on the demuxer thread. | 149 // Latest timestamp read on the demuxer thread. |
150 base::TimeDelta current_timestamp_; | 150 base::TimeDelta current_timestamp_; |
151 | 151 |
152 // Vector of streams. | 152 // Two vector of streams: |
| 153 // - |streams_| is indexed for the Demuxer interface GetStream(), which only |
| 154 // contains supported streams and no NULL entries. |
| 155 // - |packet_streams_| is indexed to mirror AVFormatContext when dealing |
| 156 // with AVPackets returned from av_read_frame() and contain NULL entries |
| 157 // representing unsupported streams where we throw away the data. |
| 158 // |
| 159 // Ownership is handled via reference counting. |
153 typedef std::vector< scoped_refptr<FFmpegDemuxerStream> > StreamVector; | 160 typedef std::vector< scoped_refptr<FFmpegDemuxerStream> > StreamVector; |
154 StreamVector streams_; | 161 StreamVector streams_; |
| 162 StreamVector packet_streams_; |
155 | 163 |
156 // Thread handle. | 164 // Thread handle. |
157 base::Thread thread_; | 165 base::Thread thread_; |
158 | 166 |
159 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); | 167 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); |
160 }; | 168 }; |
161 | 169 |
162 } // namespace media | 170 } // namespace media |
163 | 171 |
164 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ | 172 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ |
OLD | NEW |