Chromium Code Reviews| Index: media/filters/audio_renderer_sink.h |
| =================================================================== |
| --- media/filters/audio_renderer_sink.h (revision 0) |
| +++ media/filters/audio_renderer_sink.h (revision 0) |
| @@ -0,0 +1,66 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MEDIA_FILTERS_AUDIO_RENDERER_SINK_H_ |
| +#define MEDIA_FILTERS_AUDIO_RENDERER_SINK_H_ |
| + |
| +#include <vector> |
| +#include "base/basictypes.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "media/audio/audio_parameters.h" |
| + |
| +namespace media { |
| + |
| +// AudioRendererSink is an interface representing the end-point for |
| +// rendered audio in the renderer process. An implementation is expected to |
| +// periodically call Render() on a callback object. The normal implementation |
|
henrika (OOO until Aug 14)
2011/12/19 14:27:05
And a non-normal implementation would do what ;-)
Chris Rogers
2011/12/19 21:40:35
RenderAudioSourceProvider is an example in this CL
henrika (OOO until Aug 14)
2011/12/20 21:01:01
typical instead of normal?
|
| +// will talk with the browser process to get a rendered audio stream to the |
| +// audio hardware. |
| + |
| +class AudioRendererSink |
| + : public base::RefCountedThreadSafe<media::AudioRendererSink> { |
| + public: |
| + class RenderCallback { |
| + public: |
| + virtual void Render(const std::vector<float*>& audio_data, |
| + size_t number_of_frames, |
| + size_t audio_delay_milliseconds) = 0; |
| + |
| + virtual void SetAudioRendererSink(media::AudioRendererSink* audio_sink) { } |
|
henrika (OOO until Aug 14)
2011/12/19 14:27:05
What about adding a comment on this method?
Chris Rogers
2011/12/19 21:40:35
Tommi had a similar comment about this method in a
henrika (OOO until Aug 14)
2011/12/20 21:01:01
Seems like you did changes here already. No furthe
|
| + |
| + protected: |
| + virtual ~RenderCallback() { } |
|
tommi (sloooow) - chröme
2011/12/19 15:26:24
{}
Chris Rogers
2011/12/19 21:40:35
Done.
|
| + }; |
| + |
| + virtual ~AudioRendererSink() { } |
|
tommi (sloooow) - chröme
2011/12/19 15:26:24
{}
Chris Rogers
2011/12/19 21:40:35
Done.
|
| + |
| + // Initialize() sets important information about the audio stream format. |
|
henrika (OOO until Aug 14)
2011/12/19 14:27:05
nit, don't think we have to list the function name
Chris Rogers
2011/12/19 21:40:35
Done.
|
| + // It must be called before any of the other methods. |
| + virtual void Initialize(size_t buffer_size, |
| + int channels, |
| + double sample_rate, |
| + AudioParameters::Format latency_format, |
| + RenderCallback* callback) = 0; |
| + |
| + // Starts audio playback. |
| + virtual void Start() = 0; |
| + |
| + // Stops audio playback. |
| + virtual void Stop() = 0; |
| + |
| + // Pauses playback. |
| + virtual void Pause(bool flush) = 0; |
| + |
| + // Resumes playback after calling Pause(). |
| + virtual void Play() = 0; |
| + |
| + // Sets the playback volume, with range [0.0, 1.0] inclusive. |
| + // Returns |true| on success. |
| + virtual bool SetVolume(double volume) = 0; |
| +}; |
| + |
| +} // namespace media |
| + |
| +#endif // MEDIA_FILTERS_AUDIO_RENDERER_SINK_H_ |