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 // Filters are connected in a strongly typed manner, with downstream filters | 5 // Filters are connected in a strongly typed manner, with downstream filters |
6 // always reading data from upstream filters. Upstream filters have no clue | 6 // always reading data from upstream filters. Upstream filters have no clue |
7 // who is actually reading from them, and return the results via callbacks. | 7 // who is actually reading from them, and return the results via callbacks. |
8 // | 8 // |
9 // DemuxerStream(Video) <- VideoDecoder <- VideoRenderer | 9 // DemuxerStream(Video) <- VideoDecoder <- VideoRenderer |
10 // DataSource <- Demuxer < | 10 // DataSource <- Demuxer < |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 virtual void Initialize(DemuxerStream* stream, | 128 virtual void Initialize(DemuxerStream* stream, |
129 const PipelineStatusCB& callback, | 129 const PipelineStatusCB& callback, |
130 const StatisticsCallback& stats_callback) = 0; | 130 const StatisticsCallback& stats_callback) = 0; |
131 | 131 |
132 // Request a frame to be decoded and returned via the provided callback. | 132 // Request a frame to be decoded and returned via the provided callback. |
133 // Only one read may be in flight at any given time. | 133 // Only one read may be in flight at any given time. |
134 // | 134 // |
135 // Implementations guarantee that the callback will not be called from within | 135 // Implementations guarantee that the callback will not be called from within |
136 // this method. | 136 // this method. |
137 // | 137 // |
138 // Frames will be non-NULL yet may be end of stream frames. | 138 // Non-NULL frames contain decoded video data or may indicate the end of |
| 139 // the stream. NULL video frames indicate an aborted read. This can happen if |
| 140 // the DemuxerStream gets flushed and doesn't have any more data to return. |
139 typedef base::Callback<void(scoped_refptr<VideoFrame>)> ReadCB; | 141 typedef base::Callback<void(scoped_refptr<VideoFrame>)> ReadCB; |
140 virtual void Read(const ReadCB& callback) = 0; | 142 virtual void Read(const ReadCB& callback) = 0; |
141 | 143 |
142 // Returns the natural width and height of decoded video in pixels. | 144 // Returns the natural width and height of decoded video in pixels. |
143 // | 145 // |
144 // Clients should NOT rely on these values to remain constant. Instead, use | 146 // Clients should NOT rely on these values to remain constant. Instead, use |
145 // the width/height from decoded video frames themselves. | 147 // the width/height from decoded video frames themselves. |
146 // | 148 // |
147 // TODO(scherkus): why not rely on prerolling and decoding a single frame to | 149 // TODO(scherkus): why not rely on prerolling and decoding a single frame to |
148 // get dimensions? | 150 // get dimensions? |
(...skipping 27 matching lines...) Expand all Loading... |
176 // TODO(scherkus): switch to PipelineStatus callback. | 178 // TODO(scherkus): switch to PipelineStatus callback. |
177 virtual void Initialize(DemuxerStream* stream, const base::Closure& callback, | 179 virtual void Initialize(DemuxerStream* stream, const base::Closure& callback, |
178 const StatisticsCallback& stats_callback) = 0; | 180 const StatisticsCallback& stats_callback) = 0; |
179 | 181 |
180 // Request samples to be decoded and returned via the provided callback. | 182 // Request samples to be decoded and returned via the provided callback. |
181 // Only one read may be in flight at any given time. | 183 // Only one read may be in flight at any given time. |
182 // | 184 // |
183 // Implementations guarantee that the callback will not be called from within | 185 // Implementations guarantee that the callback will not be called from within |
184 // this method. | 186 // this method. |
185 // | 187 // |
186 // Sample buffers will be non-NULL yet may be end of stream buffers. | 188 // Non-NULL sample buffer pointers will contain decoded audio data or may |
| 189 // indicate the end of the stream. A NULL buffer pointer indicates an aborted |
| 190 // Read(). This can happen if the DemuxerStream gets flushed and doesn't have |
| 191 // any more data to return. |
187 typedef base::Callback<void(scoped_refptr<Buffer>)> ReadCB; | 192 typedef base::Callback<void(scoped_refptr<Buffer>)> ReadCB; |
188 virtual void Read(const ReadCB& callback) = 0; | 193 virtual void Read(const ReadCB& callback) = 0; |
189 | 194 |
190 // Returns various information about the decoded audio format. | 195 // Returns various information about the decoded audio format. |
191 virtual int bits_per_channel() = 0; | 196 virtual int bits_per_channel() = 0; |
192 virtual ChannelLayout channel_layout() = 0; | 197 virtual ChannelLayout channel_layout() = 0; |
193 virtual int samples_per_second() = 0; | 198 virtual int samples_per_second() = 0; |
194 | 199 |
195 protected: | 200 protected: |
196 AudioDecoder(); | 201 AudioDecoder(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 237 |
233 // Resumes playback after underflow occurs. | 238 // Resumes playback after underflow occurs. |
234 // |buffer_more_audio| is set to true if you want to increase the size of the | 239 // |buffer_more_audio| is set to true if you want to increase the size of the |
235 // decoded audio buffer. | 240 // decoded audio buffer. |
236 virtual void ResumeAfterUnderflow(bool buffer_more_audio) = 0; | 241 virtual void ResumeAfterUnderflow(bool buffer_more_audio) = 0; |
237 }; | 242 }; |
238 | 243 |
239 } // namespace media | 244 } // namespace media |
240 | 245 |
241 #endif // MEDIA_BASE_FILTERS_H_ | 246 #endif // MEDIA_BASE_FILTERS_H_ |
OLD | NEW |