| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // Signals to empty queue and mark next packet as discontinuous. | 63 // Signals to empty queue and mark next packet as discontinuous. |
| 64 void FlushBuffers(); | 64 void FlushBuffers(); |
| 65 | 65 |
| 66 // Returns the duration of this stream. | 66 // Returns the duration of this stream. |
| 67 base::TimeDelta duration() { return duration_; } | 67 base::TimeDelta duration() { return duration_; } |
| 68 | 68 |
| 69 // DemuxerStream implementation. | 69 // DemuxerStream implementation. |
| 70 virtual const MediaFormat& media_format(); | 70 virtual const MediaFormat& media_format(); |
| 71 virtual void Read(Callback1<Buffer*>::Type* read_callback); | 71 virtual void Read(Callback1<Buffer*>::Type* read_callback); |
| 72 | 72 |
| 73 AVStream* av_stream() { | 73 AVStream* av_stream() const { return stream_; } |
| 74 return av_stream_; | |
| 75 } | |
| 76 | 74 |
| 77 static const char* interface_id(); | 75 static const char* interface_id(); |
| 78 | 76 |
| 79 protected: | 77 protected: |
| 80 virtual void* QueryInterface(const char* interface_id); | 78 virtual void* QueryInterface(const char* interface_id); |
| 81 | 79 |
| 82 private: | 80 private: |
| 83 // Returns true if there are still pending reads. | 81 // Returns true if there are still pending reads. |
| 84 bool FulfillPendingReads(); | 82 bool FulfillPendingReads(); |
| 85 | 83 |
| 84 // Converts an FFmpeg stream timestamp into a base::TimeDelta. |
| 85 base::TimeDelta ConvertTimestamp(int64 timestamp); |
| 86 |
| 86 FFmpegDemuxer* demuxer_; | 87 FFmpegDemuxer* demuxer_; |
| 87 AVStream* av_stream_; | 88 AVStream* stream_; |
| 88 MediaFormat media_format_; | 89 MediaFormat media_format_; |
| 89 base::TimeDelta time_base_; | |
| 90 base::TimeDelta duration_; | 90 base::TimeDelta duration_; |
| 91 bool discontinuous_; | 91 bool discontinuous_; |
| 92 | 92 |
| 93 Lock lock_; | 93 Lock lock_; |
| 94 | 94 |
| 95 typedef std::deque< scoped_refptr<Buffer> > BufferQueue; | 95 typedef std::deque< scoped_refptr<Buffer> > BufferQueue; |
| 96 BufferQueue buffer_queue_; | 96 BufferQueue buffer_queue_; |
| 97 | 97 |
| 98 typedef std::deque<Callback1<Buffer*>::Type*> ReadQueue; | 98 typedef std::deque<Callback1<Buffer*>::Type*> ReadQueue; |
| 99 ReadQueue read_queue_; | 99 ReadQueue read_queue_; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 // Thread handle. | 163 // Thread handle. |
| 164 base::Thread thread_; | 164 base::Thread thread_; |
| 165 | 165 |
| 166 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); | 166 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); |
| 167 }; | 167 }; |
| 168 | 168 |
| 169 } // namespace media | 169 } // namespace media |
| 170 | 170 |
| 171 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ | 171 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ |
| OLD | NEW |