OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_AUDIO_RENDERER_IMPL_H_ |
6 #define MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ | 6 #define MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ |
7 | 7 |
8 // This is the default implementation of AudioRenderer, which uses the audio | 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 | 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 | 10 // sandbox, it serves as a reference implementation and can be used in other |
(...skipping 11 matching lines...) Expand all Loading... |
22 namespace media { | 22 namespace media { |
23 | 23 |
24 class AudioRendererImpl : public AudioRendererBase, | 24 class AudioRendererImpl : public AudioRendererBase, |
25 public AudioOutputStream::AudioSourceCallback { | 25 public AudioOutputStream::AudioSourceCallback { |
26 public: | 26 public: |
27 // FilterFactory provider. | 27 // FilterFactory provider. |
28 static FilterFactory* CreateFilterFactory() { | 28 static FilterFactory* CreateFilterFactory() { |
29 return new FilterFactoryImpl0<AudioRendererImpl>(); | 29 return new FilterFactoryImpl0<AudioRendererImpl>(); |
30 } | 30 } |
31 | 31 |
32 static bool IsMediaFormatSupported(const MediaFormat* media_format); | 32 static bool IsMediaFormatSupported(const MediaFormat& media_format); |
33 | 33 |
34 // MediaFilter implementation. | 34 // MediaFilter implementation. |
35 virtual void SetPlaybackRate(float playback_rate); | 35 virtual void SetPlaybackRate(float playback_rate); |
36 | 36 |
37 // AudioRenderer implementation. | 37 // AudioRenderer implementation. |
38 virtual void SetVolume(float volume); | 38 virtual void SetVolume(float volume); |
39 | 39 |
40 // AudioSourceCallback implementation. | 40 // AudioSourceCallback implementation. |
41 virtual size_t OnMoreData(AudioOutputStream* stream, void* dest, size_t len); | 41 virtual size_t OnMoreData(AudioOutputStream* stream, void* dest, size_t len); |
42 virtual void OnClose(AudioOutputStream* stream); | 42 virtual void OnClose(AudioOutputStream* stream); |
43 virtual void OnError(AudioOutputStream* stream, int code); | 43 virtual void OnError(AudioOutputStream* stream, int code); |
44 | 44 |
45 protected: | 45 protected: |
46 // Only allow a factory to create this class. | 46 // Only allow a factory to create this class. |
47 friend class FilterFactoryImpl0<AudioRendererImpl>; | 47 friend class FilterFactoryImpl0<AudioRendererImpl>; |
48 AudioRendererImpl(); | 48 AudioRendererImpl(); |
49 virtual ~AudioRendererImpl(); | 49 virtual ~AudioRendererImpl(); |
50 | 50 |
51 // AudioRendererBase implementation. | 51 // AudioRendererBase implementation. |
52 virtual bool OnInitialize(const MediaFormat* media_format); | 52 virtual bool OnInitialize(const MediaFormat& media_format); |
53 virtual void OnStop(); | 53 virtual void OnStop(); |
54 | 54 |
55 private: | 55 private: |
56 // Audio output stream device. | 56 // Audio output stream device. |
57 AudioOutputStream* stream_; | 57 AudioOutputStream* stream_; |
58 | 58 |
59 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); | 59 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); |
60 }; | 60 }; |
61 | 61 |
62 } // namespace media | 62 } // namespace media |
63 | 63 |
64 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ | 64 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ |
OLD | NEW |