Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
|
acolwell GONE FROM CHROMIUM
2011/12/21 22:53:56
I think this should go in media/base so it is in t
Chris Rogers
2011/12/22 00:54:33
Done.
| |
| 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 | |
|
acolwell GONE FROM CHROMIUM
2011/12/21 22:53:56
Remove "in the renderer process". media is techinc
Chris Rogers
2011/12/22 00:54:33
Done.
| |
| 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 { | |
|
acolwell GONE FROM CHROMIUM
2011/12/21 22:53:56
Please convert this to
typedef base::Callback<voi
Chris Rogers
2011/12/22 00:54:33
I think it would be better to defer this change to
| |
| 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 protected: | |
| 32 virtual ~RenderCallback() {} | |
| 33 }; | |
| 34 | |
| 35 virtual ~AudioRendererSink() {} | |
| 36 | |
| 37 // Sets important information about the audio stream format. | |
| 38 // It must be called before any of the other methods. | |
| 39 virtual void Initialize(size_t buffer_size, | |
| 40 int channels, | |
| 41 double sample_rate, | |
| 42 AudioParameters::Format latency_format, | |
| 43 RenderCallback* callback) = 0; | |
|
acolwell GONE FROM CHROMIUM
2011/12/21 22:53:56
Change to const RenderCallback&.
| |
| 44 | |
| 45 // Starts audio playback. | |
| 46 virtual void Start() = 0; | |
| 47 | |
| 48 // Stops audio playback. | |
| 49 virtual void Stop() = 0; | |
| 50 | |
| 51 // Pauses playback. | |
| 52 virtual void Pause(bool flush) = 0; | |
| 53 | |
| 54 // Resumes playback after calling Pause(). | |
| 55 virtual void Play() = 0; | |
| 56 | |
| 57 // Sets the playback volume, with range [0.0, 1.0] inclusive. | |
| 58 // Returns |true| on success. | |
| 59 virtual bool SetVolume(double volume) = 0; | |
| 60 | |
| 61 // Gets the playback volume, with range [0.0, 1.0] inclusive. | |
| 62 virtual void GetVolume(double* volume); | |
| 63 }; | |
| 64 | |
| 65 } // namespace media | |
| 66 | |
| 67 #endif // MEDIA_FILTERS_AUDIO_RENDERER_SINK_H_ | |
| OLD | NEW |