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.
5 #ifndef MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_
6 #define MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_
8 // This is the default implementation of AudioRenderer, which uses the audio
9 // interfaces to open an audio device. Although it cannot be used in the
10 // sandbox, it serves as a reference implementation and can be used in other
11 // applications such as the test player.
13 // Note: THIS IS NOT THE AUDIO RENDERER USED IN CHROME.
15 // See src/chrome/renderer/media/audio_renderer_impl.h for chrome's
20 #include "media/audio/audio_io.h"
21 #include "media/base/buffers.h"
22 #include "media/base/filters.h"
23 #include "media/filters/audio_renderer_base.h"
27 class AudioRendererImpl
28 : public AudioRendererBase
,
29 public AudioOutputStream::AudioSourceCallback
{
32 virtual ~AudioRendererImpl();
34 // Filter implementation.
35 virtual void SetPlaybackRate(float playback_rate
);
37 // AudioRenderer implementation.
38 virtual void SetVolume(float volume
);
40 // AudioSourceCallback implementation.
41 virtual uint32
OnMoreData(AudioOutputStream
* stream
, uint8
* dest
,
42 uint32 len
, AudioBuffersState buffers_state
);
43 virtual void OnClose(AudioOutputStream
* stream
);
44 virtual void OnError(AudioOutputStream
* stream
, int code
);
47 // AudioRendererBase implementation.
48 virtual bool OnInitialize(const AudioDecoderConfig
& config
);
49 virtual void OnStop();
52 // Audio output stream device.
53 AudioOutputStream
* stream_
;
54 int bytes_per_second_
;
56 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl
);
61 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_