OLD | NEW |
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 #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 14 matching lines...) Expand all Loading... |
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 size_t Render(const std::vector<float*>& audio_data, |
32 size_t number_of_frames, | 32 size_t number_of_frames, |
33 size_t audio_delay_milliseconds) = 0; | 33 size_t audio_delay_milliseconds) = 0; |
34 | 34 |
| 35 // Signals an error has occurred. |
| 36 virtual void OnError() = 0; |
| 37 |
35 protected: | 38 protected: |
36 virtual ~RenderCallback() {} | 39 virtual ~RenderCallback() {} |
37 }; | 40 }; |
38 | 41 |
39 virtual ~AudioRendererSink() {} | 42 virtual ~AudioRendererSink() {} |
40 | 43 |
41 // Sets important information about the audio stream format. | 44 // Sets important information about the audio stream format. |
42 // It must be called before any of the other methods. | 45 // It must be called before any of the other methods. |
43 virtual void Initialize(size_t buffer_size, | 46 virtual void Initialize(size_t buffer_size, |
44 int channels, | 47 int channels, |
(...skipping 17 matching lines...) Expand all Loading... |
62 // Returns |true| on success. | 65 // Returns |true| on success. |
63 virtual bool SetVolume(double volume) = 0; | 66 virtual bool SetVolume(double volume) = 0; |
64 | 67 |
65 // Gets the playback volume, with range [0.0, 1.0] inclusive. | 68 // Gets the playback volume, with range [0.0, 1.0] inclusive. |
66 virtual void GetVolume(double* volume) = 0; | 69 virtual void GetVolume(double* volume) = 0; |
67 }; | 70 }; |
68 | 71 |
69 } // namespace media | 72 } // namespace media |
70 | 73 |
71 #endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_ | 74 #endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_ |
OLD | NEW |