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

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

Issue 7796033: Replace AudioDecoderConfig with simple accessors on AudioDecoder. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: rebase Created 9 years, 3 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/audio_decoder_config.h ('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) 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 // 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 13 matching lines...) Expand all
24 #define MEDIA_BASE_FILTERS_H_ 24 #define MEDIA_BASE_FILTERS_H_
25 25
26 #include <limits> 26 #include <limits>
27 #include <string> 27 #include <string>
28 28
29 #include "base/callback.h" 29 #include "base/callback.h"
30 #include "base/callback_old.h" 30 #include "base/callback_old.h"
31 #include "base/memory/ref_counted.h" 31 #include "base/memory/ref_counted.h"
32 #include "base/memory/scoped_ptr.h" 32 #include "base/memory/scoped_ptr.h"
33 #include "base/time.h" 33 #include "base/time.h"
34 #include "media/base/audio_decoder_config.h" 34 #include "media/base/channel_layout.h"
35 #include "media/base/media_export.h" 35 #include "media/base/media_export.h"
36 #include "media/base/pipeline_status.h" 36 #include "media/base/pipeline_status.h"
37 #include "media/base/video_frame.h" 37 #include "media/base/video_frame.h"
38 38
39 namespace media { 39 namespace media {
40 40
41 class Buffer; 41 class Buffer;
42 class Decoder; 42 class Decoder;
43 class DemuxerStream; 43 class DemuxerStream;
44 class Filter; 44 class Filter;
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 208
209 209
210 class MEDIA_EXPORT AudioDecoder : public Filter { 210 class MEDIA_EXPORT AudioDecoder : public Filter {
211 public: 211 public:
212 // Initialize a AudioDecoder with the given DemuxerStream, executing the 212 // Initialize a AudioDecoder with the given DemuxerStream, executing the
213 // callback upon completion. 213 // callback upon completion.
214 // stats_callback is used to update global pipeline statistics. 214 // stats_callback is used to update global pipeline statistics.
215 virtual void Initialize(DemuxerStream* stream, FilterCallback* callback, 215 virtual void Initialize(DemuxerStream* stream, FilterCallback* callback,
216 StatisticsCallback* stats_callback) = 0; 216 StatisticsCallback* stats_callback) = 0;
217 217
218 virtual AudioDecoderConfig config() = 0;
219
220 // Renderer provides an output buffer for Decoder to write to. These buffers 218 // Renderer provides an output buffer for Decoder to write to. These buffers
221 // will be recycled to renderer via the permanent callback. 219 // will be recycled to renderer via the permanent callback.
222 // 220 //
223 // We could also pass empty pointer here to let decoder provide buffers pool. 221 // We could also pass empty pointer here to let decoder provide buffers pool.
224 virtual void ProduceAudioSamples(scoped_refptr<Buffer> buffer) = 0; 222 virtual void ProduceAudioSamples(scoped_refptr<Buffer> buffer) = 0;
225 223
226 // Installs a permanent callback for passing decoded audio output. 224 // Installs a permanent callback for passing decoded audio output.
227 typedef base::Callback<void(scoped_refptr<Buffer>)> ConsumeAudioSamplesCB; 225 typedef base::Callback<void(scoped_refptr<Buffer>)> ConsumeAudioSamplesCB;
228 void set_consume_audio_samples_callback( 226 void set_consume_audio_samples_callback(
229 const ConsumeAudioSamplesCB& callback) { 227 const ConsumeAudioSamplesCB& callback) {
230 consume_audio_samples_callback_ = callback; 228 consume_audio_samples_callback_ = callback;
231 } 229 }
232 230
231 // Returns various information about the decoded audio format.
232 virtual int bits_per_channel() = 0;
233 virtual ChannelLayout channel_layout() = 0;
234 virtual int sample_rate() = 0;
235
233 protected: 236 protected:
234 AudioDecoder(); 237 AudioDecoder();
235 virtual ~AudioDecoder(); 238 virtual ~AudioDecoder();
236 239
237 // Executes the permanent callback to pass off decoded audio. 240 // Executes the permanent callback to pass off decoded audio.
238 void ConsumeAudioSamples(scoped_refptr<Buffer> buffer); 241 void ConsumeAudioSamples(scoped_refptr<Buffer> buffer);
239 242
240 private: 243 private:
241 ConsumeAudioSamplesCB consume_audio_samples_callback_; 244 ConsumeAudioSamplesCB consume_audio_samples_callback_;
242 }; 245 };
(...skipping 22 matching lines...) Expand all
265 // buffer. 268 // buffer.
266 virtual bool HasEnded() = 0; 269 virtual bool HasEnded() = 0;
267 270
268 // Sets the output volume. 271 // Sets the output volume.
269 virtual void SetVolume(float volume) = 0; 272 virtual void SetVolume(float volume) = 0;
270 }; 273 };
271 274
272 } // namespace media 275 } // namespace media
273 276
274 #endif // MEDIA_BASE_FILTERS_H_ 277 #endif // MEDIA_BASE_FILTERS_H_
OLDNEW
« no previous file with comments | « media/base/audio_decoder_config.h ('k') | media/base/mock_filters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698