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 #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" |
11 #include "media/audio/audio_parameters.h" | 11 #include "media/audio/audio_parameters.h" |
12 #include "media/base/audio_bus.h" | |
12 #include "media/base/media_export.h" | 13 #include "media/base/media_export.h" |
13 | 14 |
14 namespace media { | 15 namespace media { |
15 | 16 |
16 // AudioRendererSink is an interface representing the end-point for | 17 // AudioRendererSink is an interface representing the end-point for |
17 // rendered audio. An implementation is expected to | 18 // rendered audio. An implementation is expected to |
18 // periodically call Render() on a callback object. | 19 // periodically call Render() on a callback object. |
19 | 20 |
20 class AudioRendererSink | 21 class AudioRendererSink |
21 : public base::RefCountedThreadSafe<media::AudioRendererSink> { | 22 : public base::RefCountedThreadSafe<media::AudioRendererSink> { |
22 public: | 23 public: |
23 class RenderCallback { | 24 class RenderCallback { |
24 public: | 25 public: |
25 // Fills entire buffer of length |number_of_frames| but returns actual | 26 // Fills entire buffer of length |number_of_frames| but returns actual |
26 // 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 |
27 // continuous stream). That actual number of frames is passed to host | 28 // continuous stream). That actual number of frames is passed to host |
28 // 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. |
29 // TODO(crogers): use base:Callback instead. | 30 // TODO(crogers): use base:Callback instead. |
30 virtual int Render(const std::vector<float*>& audio_data, | 31 virtual int Render(AudioBus* audio_bus, |
31 int number_of_frames, | 32 int number_of_frames, |
DaleCurtis
2012/08/07 23:12:19
Do we need/want number_of_frames still? Or should
scherkus (not reviewing)
2012/08/07 23:23:41
Doesn't seem too crazy -- what would the fix to Si
DaleCurtis
2012/08/07 23:49:24
There are few ways I can think of:
- Creating/wrap
scherkus (not reviewing)
2012/08/08 00:49:01
The first option sounds OK -- but we can tackle th
DaleCurtis
2012/08/08 01:26:07
Actually it was pretty easy to do, so the next pat
| |
32 int audio_delay_milliseconds) = 0; | 33 int audio_delay_milliseconds) = 0; |
33 | 34 |
34 // Signals an error has occurred. | 35 // Signals an error has occurred. |
35 virtual void OnRenderError() = 0; | 36 virtual void OnRenderError() = 0; |
36 | 37 |
37 protected: | 38 protected: |
38 virtual ~RenderCallback() {} | 39 virtual ~RenderCallback() {} |
39 }; | 40 }; |
40 | 41 |
41 // Sets important information about the audio stream format. | 42 // Sets important information about the audio stream format. |
(...skipping 18 matching lines...) Expand all Loading... | |
60 virtual bool SetVolume(double volume) = 0; | 61 virtual bool SetVolume(double volume) = 0; |
61 | 62 |
62 protected: | 63 protected: |
63 friend class base::RefCountedThreadSafe<AudioRendererSink>; | 64 friend class base::RefCountedThreadSafe<AudioRendererSink>; |
64 virtual ~AudioRendererSink() {} | 65 virtual ~AudioRendererSink() {} |
65 }; | 66 }; |
66 | 67 |
67 } // namespace media | 68 } // namespace media |
68 | 69 |
69 #endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_ | 70 #endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_ |
OLD | NEW |