OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 // If |buffer_queue_| is not empty will execute on caller's thread, otherwise | 76 // If |buffer_queue_| is not empty will execute on caller's thread, otherwise |
77 // will post ReadTask to execute on demuxer's thread. Read will acquire | 77 // will post ReadTask to execute on demuxer's thread. Read will acquire |
78 // |lock_| for the life of the function so that means |read_callback| must | 78 // |lock_| for the life of the function so that means |read_callback| must |
79 // not make calls into FFmpegDemuxerStream directly or that may cause a | 79 // not make calls into FFmpegDemuxerStream directly or that may cause a |
80 // deadlock. |read_callback| should execute as quickly as possible because | 80 // deadlock. |read_callback| should execute as quickly as possible because |
81 // |lock_| is held throughout the life of the callback. | 81 // |lock_| is held throughout the life of the callback. |
82 virtual void Read(const ReadCallback& read_callback); | 82 virtual void Read(const ReadCallback& read_callback); |
83 // Bitstream converter to convert input packet. | 83 // Bitstream converter to convert input packet. |
84 virtual void EnableBitstreamConverter(); | 84 virtual void EnableBitstreamConverter(); |
85 virtual AVStream* GetAVStream(); | 85 virtual AVStream* GetAVStream(); |
86 virtual AudioDecoderConfig* audio_decoder_config(); | |
Ami GONE FROM CHROMIUM
2011/09/12 20:54:21
OVERRIDE everywhere?
scherkus (not reviewing)
2011/09/19 21:19:45
Done.
| |
86 | 87 |
87 private: | 88 private: |
88 virtual ~FFmpegDemuxerStream(); | 89 virtual ~FFmpegDemuxerStream(); |
89 | 90 |
90 // Carries out enqueuing a pending read on the demuxer thread. | 91 // Carries out enqueuing a pending read on the demuxer thread. |
91 void ReadTask(const ReadCallback& read_callback); | 92 void ReadTask(const ReadCallback& read_callback); |
92 | 93 |
93 // Attempts to fulfill a single pending read by dequeueing a buffer and read | 94 // Attempts to fulfill a single pending read by dequeueing a buffer and read |
94 // callback pair and executing the callback. The calling function must | 95 // callback pair and executing the callback. The calling function must |
95 // acquire |lock_| before calling this function. | 96 // acquire |lock_| before calling this function. |
96 void FulfillPendingRead(); | 97 void FulfillPendingRead(); |
97 | 98 |
98 // Converts an FFmpeg stream timestamp into a base::TimeDelta. | 99 // Converts an FFmpeg stream timestamp into a base::TimeDelta. |
99 static base::TimeDelta ConvertStreamTimestamp(const AVRational& time_base, | 100 static base::TimeDelta ConvertStreamTimestamp(const AVRational& time_base, |
100 int64 timestamp); | 101 int64 timestamp); |
101 | 102 |
102 FFmpegDemuxer* demuxer_; | 103 FFmpegDemuxer* demuxer_; |
103 AVStream* stream_; | 104 AVStream* stream_; |
105 scoped_ptr<AudioDecoderConfig> audio_config_; | |
104 Type type_; | 106 Type type_; |
105 base::TimeDelta duration_; | 107 base::TimeDelta duration_; |
106 bool discontinuous_; | 108 bool discontinuous_; |
107 bool stopped_; | 109 bool stopped_; |
108 | 110 |
109 typedef std::deque<scoped_refptr<Buffer> > BufferQueue; | 111 typedef std::deque<scoped_refptr<Buffer> > BufferQueue; |
110 BufferQueue buffer_queue_; | 112 BufferQueue buffer_queue_; |
111 | 113 |
112 typedef std::deque<ReadCallback> ReadQueue; | 114 typedef std::deque<ReadCallback> ReadQueue; |
113 ReadQueue read_queue_; | 115 ReadQueue read_queue_; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
258 // starting clock value to match the timestamps in the media file. Default | 260 // starting clock value to match the timestamps in the media file. Default |
259 // is 0. | 261 // is 0. |
260 base::TimeDelta start_time_; | 262 base::TimeDelta start_time_; |
261 | 263 |
262 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); | 264 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); |
263 }; | 265 }; |
264 | 266 |
265 } // namespace media | 267 } // namespace media |
266 | 268 |
267 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ | 269 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ |
OLD | NEW |