OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MEDIA_FILTERS_AUDIO_RENDERER_SINK_H_ |
| 6 #define MEDIA_FILTERS_AUDIO_RENDERER_SINK_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 |
| 12 namespace media { |
| 13 |
| 14 // AudioRendererSink is an abstract base class representing the end-point for |
| 15 // rendered audio in the renderer process. An implementation is expected to |
| 16 // periodically call Render() on a callback object. A typical implementation |
| 17 // will talk with the browser process to get a rendered audio stream to the |
| 18 // audio hardware. |
| 19 |
| 20 class AudioRendererSink |
| 21 : public base::RefCountedThreadSafe<media::AudioRendererSink> { |
| 22 public: |
| 23 class RenderCallback { |
| 24 public: |
| 25 virtual void Render(const std::vector<float*>& audio_data, |
| 26 size_t number_of_frames, |
| 27 size_t audio_delay_milliseconds) = 0; |
| 28 |
| 29 virtual void SetAudioRendererSink(media::AudioRendererSink* audio_sink) { } |
| 30 |
| 31 protected: |
| 32 virtual ~RenderCallback() { } |
| 33 }; |
| 34 |
| 35 // Starts audio playback. Returns |true| on success. |
| 36 virtual bool Start() = 0; |
| 37 |
| 38 // Stops audio playback. Returns |true| on success. |
| 39 virtual bool Stop() = 0; |
| 40 |
| 41 // Sets the playback volume, with range [0.0, 1.0] inclusive. |
| 42 // Returns |true| on success. |
| 43 virtual bool SetVolume(double volume) = 0; |
| 44 }; |
| 45 |
| 46 } // namespace media |
| 47 |
| 48 #endif // MEDIA_FILTERS_AUDIO_RENDERER_SINK_H_ |
OLD | NEW |