OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ | 5 #ifndef MEDIA_FILTERS_REFERENCE_AUDIO_RENDERER_H_ |
6 #define MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ | 6 #define MEDIA_FILTERS_REFERENCE_AUDIO_RENDERER_H_ |
7 | 7 |
8 // This is the default implementation of AudioRenderer, which uses the audio | 8 // This is the reference implementation of AudioRenderer, which uses the audio |
9 // interfaces to open an audio device. Although it cannot be used in the | 9 // interfaces to open an audio device. It cannot be used in the sandbox, but is |
10 // sandbox, it serves as a reference implementation and can be used in other | 10 // used in other applications such as the test player. |
11 // applications such as the test player. | |
12 // | 11 // |
13 // Note: THIS IS NOT THE AUDIO RENDERER USED IN CHROME. | 12 // Note: THIS IS NOT THE AUDIO RENDERER USED IN CHROME. |
14 // | 13 // |
15 // See src/chrome/renderer/media/audio_renderer_impl.h for chrome's | 14 // See src/chrome/renderer/media/audio_renderer_impl.h for chrome's |
16 // implementation. | 15 // implementation. |
17 | 16 |
18 #include <deque> | 17 #include <deque> |
19 | 18 |
20 #include "media/audio/audio_io.h" | 19 #include "media/audio/audio_io.h" |
21 #include "media/base/buffers.h" | 20 #include "media/base/buffers.h" |
22 #include "media/base/filters.h" | 21 #include "media/base/filters.h" |
23 #include "media/filters/audio_renderer_base.h" | 22 #include "media/filters/audio_renderer_base.h" |
24 | 23 |
25 namespace media { | 24 namespace media { |
26 | 25 |
27 class MEDIA_EXPORT AudioRendererImpl | 26 class MEDIA_EXPORT ReferenceAudioRenderer |
28 : public AudioRendererBase, | 27 : public AudioRendererBase, |
29 public AudioOutputStream::AudioSourceCallback { | 28 public AudioOutputStream::AudioSourceCallback { |
30 public: | 29 public: |
31 AudioRendererImpl(); | 30 ReferenceAudioRenderer(); |
32 virtual ~AudioRendererImpl(); | 31 virtual ~ReferenceAudioRenderer(); |
33 | 32 |
34 // Filter implementation. | 33 // Filter implementation. |
35 virtual void SetPlaybackRate(float playback_rate); | 34 virtual void SetPlaybackRate(float playback_rate); |
36 | 35 |
37 // AudioRenderer implementation. | 36 // AudioRenderer implementation. |
38 virtual void SetVolume(float volume); | 37 virtual void SetVolume(float volume); |
39 | 38 |
40 // AudioSourceCallback implementation. | 39 // AudioSourceCallback implementation. |
41 virtual uint32 OnMoreData(AudioOutputStream* stream, uint8* dest, | 40 virtual uint32 OnMoreData(AudioOutputStream* stream, uint8* dest, |
42 uint32 len, AudioBuffersState buffers_state); | 41 uint32 len, AudioBuffersState buffers_state); |
43 virtual void OnClose(AudioOutputStream* stream); | 42 virtual void OnClose(AudioOutputStream* stream); |
44 virtual void OnError(AudioOutputStream* stream, int code); | 43 virtual void OnError(AudioOutputStream* stream, int code); |
45 | 44 |
46 protected: | 45 protected: |
47 // AudioRendererBase implementation. | 46 // AudioRendererBase implementation. |
48 virtual bool OnInitialize(int bits_per_channel, | 47 virtual bool OnInitialize(int bits_per_channel, |
49 ChannelLayout channel_layout, | 48 ChannelLayout channel_layout, |
50 int sample_rate); | 49 int sample_rate); |
51 virtual void OnStop(); | 50 virtual void OnStop(); |
52 | 51 |
53 private: | 52 private: |
54 // Audio output stream device. | 53 // Audio output stream device. |
55 AudioOutputStream* stream_; | 54 AudioOutputStream* stream_; |
56 int bytes_per_second_; | 55 int bytes_per_second_; |
57 | 56 |
58 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); | 57 DISALLOW_COPY_AND_ASSIGN(ReferenceAudioRenderer); |
59 }; | 58 }; |
60 | 59 |
61 } // namespace media | 60 } // namespace media |
62 | 61 |
63 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ | 62 #endif // MEDIA_FILTERS_REFERENCE_AUDIO_RENDERER_H_ |
OLD | NEW |