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

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

Issue 9826023: Merge AudioRendererImpl and AudioRendererBase; add NullAudioSink (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 9 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
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_SINK_H_ 5 #ifndef MEDIA_BASE_AUDIO_RENDERER_SINK_H_
6 #define MEDIA_BASE_AUDIO_RENDERER_SINK_H_ 6 #define MEDIA_BASE_AUDIO_RENDERER_SINK_H_
7 7
8 #include <vector> 8 #include <vector>
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 10 matching lines...) Expand all
21 class AudioRendererSink 21 class AudioRendererSink
22 : public base::RefCountedThreadSafe<media::AudioRendererSink> { 22 : public base::RefCountedThreadSafe<media::AudioRendererSink> {
23 public: 23 public:
24 class RenderCallback { 24 class RenderCallback {
25 public: 25 public:
26 // Fills entire buffer of length |number_of_frames| but returns actual 26 // Fills entire buffer of length |number_of_frames| but returns actual
27 // number of frames it got from its source (|number_of_frames| in case of 27 // number of frames it got from its source (|number_of_frames| in case of
28 // continuous stream). That actual number of frames is passed to host 28 // continuous stream). That actual number of frames is passed to host
29 // together with PCM audio data and host is free to use or ignore it. 29 // together with PCM audio data and host is free to use or ignore it.
30 // TODO(crogers): use base:Callback instead. 30 // TODO(crogers): use base:Callback instead.
31 virtual size_t Render(const std::vector<float*>& audio_data, 31 virtual int Render(const std::vector<float*>& audio_data,
32 size_t number_of_frames, 32 int number_of_frames,
33 size_t audio_delay_milliseconds) = 0; 33 int audio_delay_milliseconds) = 0;
34 34
35 // Signals an error has occurred. 35 // Signals an error has occurred.
36 virtual void OnRenderError() = 0; 36 virtual void OnRenderError() = 0;
37 37
38 protected: 38 protected:
39 virtual ~RenderCallback() {} 39 virtual ~RenderCallback() {}
40 }; 40 };
41 41
42 virtual ~AudioRendererSink() {} 42 virtual ~AudioRendererSink() {}
43 43
44 // Sets important information about the audio stream format. 44 // Sets important information about the audio stream format.
45 // It must be called before any of the other methods. 45 // It must be called before any of the other methods.
46 virtual void Initialize(const AudioParameters& params, 46 virtual void Initialize(const AudioParameters& params,
47 RenderCallback* callback) = 0; 47 RenderCallback* callback) = 0;
48 48
49 // Starts audio playback. 49 // Starts audio playback.
50 virtual void Start() = 0; 50 virtual void Start() = 0;
51 51
52 // Stops audio playback. 52 // Stops audio playback.
53 virtual void Stop() = 0; 53 virtual void Stop() = 0;
54 54
55 // Pauses playback. 55 // Pauses playback.
56 virtual void Pause(bool flush) = 0; 56 virtual void Pause(bool flush) = 0;
57 57
58 // Resumes playback after calling Pause(). 58 // Resumes playback after calling Pause().
59 virtual void Play() = 0; 59 virtual void Play() = 0;
60 60
61 // Called to inform the sink of a change in playback rate. Override if
62 // subclass needs the playback rate.
63 virtual void SetPlaybackRate(float rate) { };
scherkus (not reviewing) 2012/03/23 15:24:52 nit: collapse to {}
vrk (LEFT CHROMIUM) 2012/04/02 21:17:54 Done.
64
61 // Sets the playback volume, with range [0.0, 1.0] inclusive. 65 // Sets the playback volume, with range [0.0, 1.0] inclusive.
62 // Returns |true| on success. 66 // Returns |true| on success.
63 virtual bool SetVolume(double volume) = 0; 67 virtual bool SetVolume(double volume) = 0;
64 68
65 // Gets the playback volume, with range [0.0, 1.0] inclusive. 69 // Gets the playback volume, with range [0.0, 1.0] inclusive.
66 virtual void GetVolume(double* volume) = 0; 70 virtual void GetVolume(double* volume) = 0;
67 }; 71 };
68 72
69 } // namespace media 73 } // namespace media
70 74
71 #endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_ 75 #endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698