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

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

Issue 11148011: Move audio decoder initialization to AudioRendererImpl. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: nits Created 8 years, 2 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
« no previous file with comments | « no previous file | media/base/filter_collection.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 #ifndef MEDIA_BASE_AUDIO_RENDERER_H_ 5 #ifndef MEDIA_BASE_AUDIO_RENDERER_H_
6 #define MEDIA_BASE_AUDIO_RENDERER_H_ 6 #define MEDIA_BASE_AUDIO_RENDERER_H_
7 7
8 #include <list>
9
8 #include "base/callback.h" 10 #include "base/callback.h"
9 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
10 #include "base/time.h" 12 #include "base/time.h"
11 #include "media/base/media_export.h" 13 #include "media/base/media_export.h"
12 #include "media/base/pipeline_status.h" 14 #include "media/base/pipeline_status.h"
13 15
14 namespace media { 16 namespace media {
15 17
16 class AudioDecoder; 18 class AudioDecoder;
19 class DemuxerStream;
17 20
18 class MEDIA_EXPORT AudioRenderer 21 class MEDIA_EXPORT AudioRenderer
19 : public base::RefCountedThreadSafe<AudioRenderer> { 22 : public base::RefCountedThreadSafe<AudioRenderer> {
20 public: 23 public:
24 typedef std::list<scoped_refptr<AudioDecoder> > AudioDecoderList;
25
21 // First parameter is the current time that has been rendered. 26 // First parameter is the current time that has been rendered.
22 // Second parameter is the maximum time value that the clock cannot exceed. 27 // Second parameter is the maximum time value that the clock cannot exceed.
23 typedef base::Callback<void(base::TimeDelta, base::TimeDelta)> TimeCB; 28 typedef base::Callback<void(base::TimeDelta, base::TimeDelta)> TimeCB;
24 29
25 // Initialize a AudioRenderer with the given AudioDecoder, executing the 30 // Initialize a AudioRenderer with the given AudioDecoder, executing the
26 // |init_cb| upon completion. 31 // |init_cb| upon completion.
27 // 32 //
33 // |statistics_cb| is executed periodically with audio rendering stats.
34 //
28 // |underflow_cb| is executed when the renderer runs out of data to pass to 35 // |underflow_cb| is executed when the renderer runs out of data to pass to
29 // the audio card during playback. ResumeAfterUnderflow() must be called 36 // the audio card during playback. ResumeAfterUnderflow() must be called
30 // to resume playback. Pause(), Preroll(), or Stop() cancels the underflow 37 // to resume playback. Pause(), Preroll(), or Stop() cancels the underflow
31 // condition. 38 // condition.
32 // 39 //
33 // |time_cb| is executed whenever time has advanced by way of audio rendering. 40 // |time_cb| is executed whenever time has advanced by way of audio rendering.
34 // 41 //
35 // |ended_cb| is executed when audio rendering has reached the end of stream. 42 // |ended_cb| is executed when audio rendering has reached the end of stream.
36 // 43 //
37 // |disabled_cb| is executed when audio rendering has been disabled due to 44 // |disabled_cb| is executed when audio rendering has been disabled due to
38 // external factors (i.e., device was removed). |time_cb| will no longer be 45 // external factors (i.e., device was removed). |time_cb| will no longer be
39 // executed. 46 // executed.
40 // 47 //
41 // |error_cb| is executed if an error was encountered. 48 // |error_cb| is executed if an error was encountered.
42 virtual void Initialize(const scoped_refptr<AudioDecoder>& decoder, 49 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream,
50 const AudioDecoderList& decoders,
43 const PipelineStatusCB& init_cb, 51 const PipelineStatusCB& init_cb,
52 const StatisticsCB& statistics_cb,
44 const base::Closure& underflow_cb, 53 const base::Closure& underflow_cb,
45 const TimeCB& time_cb, 54 const TimeCB& time_cb,
46 const base::Closure& ended_cb, 55 const base::Closure& ended_cb,
47 const base::Closure& disabled_cb, 56 const base::Closure& disabled_cb,
48 const PipelineStatusCB& error_cb) = 0; 57 const PipelineStatusCB& error_cb) = 0;
49 58
50 // Start audio decoding and rendering at the current playback rate, executing 59 // Start audio decoding and rendering at the current playback rate, executing
51 // |callback| when playback is underway. 60 // |callback| when playback is underway.
52 virtual void Play(const base::Closure& callback) = 0; 61 virtual void Play(const base::Closure& callback) = 0;
53 62
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 AudioRenderer(); 96 AudioRenderer();
88 virtual ~AudioRenderer(); 97 virtual ~AudioRenderer();
89 98
90 private: 99 private:
91 DISALLOW_COPY_AND_ASSIGN(AudioRenderer); 100 DISALLOW_COPY_AND_ASSIGN(AudioRenderer);
92 }; 101 };
93 102
94 } // namespace media 103 } // namespace media
95 104
96 #endif // MEDIA_BASE_AUDIO_RENDERER_H_ 105 #endif // MEDIA_BASE_AUDIO_RENDERER_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/filter_collection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698