| 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/logging.h" |
| 10 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 11 #include "media/audio/audio_parameters.h" | 12 #include "media/audio/audio_parameters.h" |
| 12 #include "media/base/audio_bus.h" | 13 #include "media/base/audio_bus.h" |
| 13 #include "media/base/media_export.h" | 14 #include "media/base/media_export.h" |
| 14 | 15 |
| 15 namespace media { | 16 namespace media { |
| 16 | 17 |
| 17 // AudioRendererSink is an interface representing the end-point for | 18 // AudioRendererSink is an interface representing the end-point for |
| 18 // rendered audio. An implementation is expected to | 19 // rendered audio. An implementation is expected to |
| 19 // periodically call Render() on a callback object. | 20 // periodically call Render() on a callback object. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 34 | 35 |
| 35 // Signals an error has occurred. | 36 // Signals an error has occurred. |
| 36 virtual void OnRenderError() = 0; | 37 virtual void OnRenderError() = 0; |
| 37 | 38 |
| 38 protected: | 39 protected: |
| 39 virtual ~RenderCallback() {} | 40 virtual ~RenderCallback() {} |
| 40 }; | 41 }; |
| 41 | 42 |
| 42 // Sets important information about the audio stream format. | 43 // Sets important information about the audio stream format. |
| 43 // It must be called before any of the other methods. | 44 // It must be called before any of the other methods. |
| 44 // For clients wishing to have synchronized input and output, | |
| 45 // |params| may specify |input_channels| > 0, representing a | |
| 46 // number of input channels which will be at the same sample-rate | |
| 47 // and buffer-size as the output as specified in |params|. | |
| 48 // In this case, the callback's RenderIO() method will be called instead | |
| 49 // of Render(), providing the synchronized input data at the same time as | |
| 50 // when new output data is to be rendered. | |
| 51 virtual void Initialize(const AudioParameters& params, | 45 virtual void Initialize(const AudioParameters& params, |
| 52 RenderCallback* callback) = 0; | 46 RenderCallback* callback) = 0; |
| 53 | 47 |
| 54 // Starts audio playback. | 48 // Starts audio playback. |
| 55 virtual void Start() = 0; | 49 virtual void Start() = 0; |
| 56 | 50 |
| 57 // Stops audio playback. | 51 // Stops audio playback. |
| 58 virtual void Stop() = 0; | 52 virtual void Stop() = 0; |
| 59 | 53 |
| 60 // Pauses playback. | 54 // Pauses playback. |
| 61 virtual void Pause() = 0; | 55 virtual void Pause() = 0; |
| 62 | 56 |
| 63 // Resumes playback after calling Pause(). | 57 // Resumes playback after calling Pause(). |
| 64 virtual void Play() = 0; | 58 virtual void Play() = 0; |
| 65 | 59 |
| 66 // Sets the playback volume, with range [0.0, 1.0] inclusive. | 60 // Sets the playback volume, with range [0.0, 1.0] inclusive. |
| 67 // Returns |true| on success. | 61 // Returns |true| on success. |
| 68 virtual bool SetVolume(double volume) = 0; | 62 virtual bool SetVolume(double volume) = 0; |
| 69 | 63 |
| 70 protected: | 64 protected: |
| 71 friend class base::RefCountedThreadSafe<AudioRendererSink>; | 65 friend class base::RefCountedThreadSafe<AudioRendererSink>; |
| 72 virtual ~AudioRendererSink() {} | 66 virtual ~AudioRendererSink() {} |
| 73 }; | 67 }; |
| 74 | 68 |
| 75 } // namespace media | 69 } // namespace media |
| 76 | 70 |
| 77 #endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_ | 71 #endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_ |
| OLD | NEW |