Chromium Code Reviews| 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 <vector> | |
| 9 #include "base/basictypes.h" | |
| 10 #include "base/memory/ref_counted.h" | |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "media/audio/audio_parameters.h" | |
| 13 | |
| 14 namespace media { | |
| 15 | |
| 16 // AudioRendererSink is an interface representing the end-point for | |
| 17 // rendered audio in the renderer process. An implementation is expected to | |
| 18 // periodically call Render() on a callback object. The normal implementation | |
| 19 // will talk with the browser process to get a rendered audio stream to the | |
| 20 // audio hardware. | |
| 21 | |
| 22 class AudioRendererSink | |
| 23 : public base::RefCountedThreadSafe<media::AudioRendererSink> { | |
| 24 public: | |
| 25 class RenderCallback { | |
| 26 public: | |
| 27 virtual void Render(const std::vector<float*>& audio_data, | |
| 28 size_t number_of_frames, | |
| 29 size_t audio_delay_milliseconds) = 0; | |
| 30 | |
| 31 virtual void SetAudioRendererSink(media::AudioRendererSink* audio_sink) {} | |
|
acolwell GONE FROM CHROMIUM
2011/12/19 23:01:49
I too believe this should be removed. Conceptually
Chris Rogers
2011/12/19 23:28:14
That settles it! I'm moving this directly into Au
Chris Rogers
2011/12/21 01:38:17
Done.
| |
| 32 | |
| 33 protected: | |
| 34 virtual ~RenderCallback() {} | |
| 35 }; | |
| 36 | |
| 37 virtual ~AudioRendererSink() {} | |
| 38 | |
| 39 // Sets important information about the audio stream format. | |
| 40 // It must be called before any of the other methods. | |
| 41 virtual void Initialize(size_t buffer_size, | |
| 42 int channels, | |
| 43 double sample_rate, | |
| 44 AudioParameters::Format latency_format, | |
| 45 RenderCallback* callback) = 0; | |
| 46 | |
| 47 // Starts audio playback. | |
| 48 virtual void Start() = 0; | |
| 49 | |
| 50 // Stops audio playback. | |
| 51 virtual void Stop() = 0; | |
| 52 | |
| 53 // Pauses playback. | |
| 54 virtual void Pause(bool flush) = 0; | |
| 55 | |
| 56 // Resumes playback after calling Pause(). | |
| 57 virtual void Play() = 0; | |
| 58 | |
| 59 // Sets the playback volume, with range [0.0, 1.0] inclusive. | |
| 60 // Returns |true| on success. | |
| 61 virtual bool SetVolume(double volume) = 0; | |
| 62 }; | |
| 63 | |
| 64 } // namespace media | |
| 65 | |
| 66 #endif // MEDIA_FILTERS_AUDIO_RENDERER_SINK_H_ | |
| OLD | NEW |