Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: media/base/filters.h

Issue 9310028: Update AudioRenderer, VideoRenderer, and AudioDecoder Initialize() methods to use PipelineStatusCB. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix AudioRendererImplTest Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/base/composite_filter_unittest.cc ('k') | media/base/mock_filters.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 VideoDecoder(); 167 VideoDecoder();
168 virtual ~VideoDecoder(); 168 virtual ~VideoDecoder();
169 }; 169 };
170 170
171 171
172 class MEDIA_EXPORT AudioDecoder : public Filter { 172 class MEDIA_EXPORT AudioDecoder : public Filter {
173 public: 173 public:
174 // Initialize a AudioDecoder with the given DemuxerStream, executing the 174 // Initialize a AudioDecoder with the given DemuxerStream, executing the
175 // callback upon completion. 175 // callback upon completion.
176 // stats_callback is used to update global pipeline statistics. 176 // stats_callback is used to update global pipeline statistics.
177 // 177 virtual void Initialize(DemuxerStream* stream,
178 // TODO(scherkus): switch to PipelineStatus callback. 178 const PipelineStatusCB& callback,
179 virtual void Initialize(DemuxerStream* stream, const base::Closure& callback,
180 const StatisticsCallback& stats_callback) = 0; 179 const StatisticsCallback& stats_callback) = 0;
181 180
182 // Request samples to be decoded and returned via the provided callback. 181 // Request samples to be decoded and returned via the provided callback.
183 // Only one read may be in flight at any given time. 182 // Only one read may be in flight at any given time.
184 // 183 //
185 // Implementations guarantee that the callback will not be called from within 184 // Implementations guarantee that the callback will not be called from within
186 // this method. 185 // this method.
187 // 186 //
188 // Non-NULL sample buffer pointers will contain decoded audio data or may 187 // 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 188 // indicate the end of the stream. A NULL buffer pointer indicates an aborted
(...skipping 10 matching lines...) Expand all
200 protected: 199 protected:
201 AudioDecoder(); 200 AudioDecoder();
202 virtual ~AudioDecoder(); 201 virtual ~AudioDecoder();
203 }; 202 };
204 203
205 204
206 class MEDIA_EXPORT VideoRenderer : public Filter { 205 class MEDIA_EXPORT VideoRenderer : public Filter {
207 public: 206 public:
208 // Initialize a VideoRenderer with the given VideoDecoder, executing the 207 // Initialize a VideoRenderer with the given VideoDecoder, executing the
209 // callback upon completion. 208 // callback upon completion.
210 virtual void Initialize(VideoDecoder* decoder, const base::Closure& callback, 209 virtual void Initialize(VideoDecoder* decoder,
210 const PipelineStatusCB& callback,
211 const StatisticsCallback& stats_callback) = 0; 211 const StatisticsCallback& stats_callback) = 0;
212 212
213 // Returns true if this filter has received and processed an end-of-stream 213 // Returns true if this filter has received and processed an end-of-stream
214 // buffer. 214 // buffer.
215 virtual bool HasEnded() = 0; 215 virtual bool HasEnded() = 0;
216 }; 216 };
217 217
218 218
219 class MEDIA_EXPORT AudioRenderer : public Filter { 219 class MEDIA_EXPORT AudioRenderer : public Filter {
220 public: 220 public:
221 // Initialize a AudioRenderer with the given AudioDecoder, executing the 221 // Initialize a AudioRenderer with the given AudioDecoder, executing the
222 // |init_callback| upon completion. |underflow_callback| is called when the 222 // |init_callback| upon completion. |underflow_callback| is called when the
223 // renderer runs out of data to pass to the audio card during playback. 223 // renderer runs out of data to pass to the audio card during playback.
224 // If the |underflow_callback| is called ResumeAfterUnderflow() must be called 224 // If the |underflow_callback| is called ResumeAfterUnderflow() must be called
225 // to resume playback. Pause(), Seek(), or Stop() cancels the underflow 225 // to resume playback. Pause(), Seek(), or Stop() cancels the underflow
226 // condition. 226 // condition.
227 virtual void Initialize(AudioDecoder* decoder, 227 virtual void Initialize(AudioDecoder* decoder,
228 const base::Closure& init_callback, 228 const PipelineStatusCB& init_callback,
229 const base::Closure& underflow_callback) = 0; 229 const base::Closure& underflow_callback) = 0;
230 230
231 // Returns true if this filter has received and processed an end-of-stream 231 // Returns true if this filter has received and processed an end-of-stream
232 // buffer. 232 // buffer.
233 virtual bool HasEnded() = 0; 233 virtual bool HasEnded() = 0;
234 234
235 // Sets the output volume. 235 // Sets the output volume.
236 virtual void SetVolume(float volume) = 0; 236 virtual void SetVolume(float volume) = 0;
237 237
238 // Resumes playback after underflow occurs. 238 // Resumes playback after underflow occurs.
239 // |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
240 // decoded audio buffer. 240 // decoded audio buffer.
241 virtual void ResumeAfterUnderflow(bool buffer_more_audio) = 0; 241 virtual void ResumeAfterUnderflow(bool buffer_more_audio) = 0;
242 }; 242 };
243 243
244 } // namespace media 244 } // namespace media
245 245
246 #endif // MEDIA_BASE_FILTERS_H_ 246 #endif // MEDIA_BASE_FILTERS_H_
OLDNEW
« no previous file with comments | « media/base/composite_filter_unittest.cc ('k') | media/base/mock_filters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698