OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_ |
6 #define CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_ | 6 #define CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 | 10 |
11 namespace media { | 11 namespace media { |
| 12 class AudioInputDevice; |
12 class AudioRendererSink; | 13 class AudioRendererSink; |
13 } | 14 } |
14 | 15 |
15 class AudioInputDevice; | |
16 | |
17 namespace content { | 16 namespace content { |
18 | 17 |
19 // A factory for creating AudioRendererSinks. There is a global factory | 18 // A factory for creating AudioRendererSinks. There is a global factory |
20 // function that can be installed for the purposes of testing to provide | 19 // function that can be installed for the purposes of testing to provide |
21 // a specialized AudioRendererSink class. | 20 // a specialized AudioRendererSink class. |
22 // This class uses the same pattern as content::RenderViewHostFactory. | |
23 class CONTENT_EXPORT AudioDeviceFactory { | 21 class CONTENT_EXPORT AudioDeviceFactory { |
24 public: | 22 public: |
25 // Creates an AudioRendererSink using the currently registered factory, | 23 // Creates an AudioRendererSink using the currently registered factory, |
26 // or the default one if no factory is registered. Ownership of the returned | 24 // or the default one if no factory is registered. Ownership of the returned |
27 // pointer will be passed to the caller. | 25 // pointer will be passed to the caller. |
28 static media::AudioRendererSink* NewOutputDevice(); | 26 static media::AudioRendererSink* NewOutputDevice(); |
29 | 27 |
30 // TODO(henrika): Update AudioInputDevice to inherit from an interface | 28 // TODO(henrika): Update AudioInputDevice to inherit from an interface |
31 // similar to AudioRendererSink, but for input. Same for the callback | 29 // similar to AudioRendererSink, but for input. Same for the callback |
32 // interfaces. | 30 // interfaces. |
33 static AudioInputDevice* NewInputDevice(); | 31 static media::AudioInputDevice* NewInputDevice(); |
34 | 32 |
35 protected: | 33 protected: |
36 AudioDeviceFactory(); | 34 AudioDeviceFactory(); |
37 virtual ~AudioDeviceFactory(); | 35 virtual ~AudioDeviceFactory(); |
38 | 36 |
39 // You can derive from this class and specify an implementation for these | 37 // You can derive from this class and specify an implementation for these |
40 // functions to provide alternate audio device implementations. | 38 // functions to provide alternate audio device implementations. |
41 // If the return value of either of these function is NULL, we fall back | 39 // If the return value of either of these function is NULL, we fall back |
42 // on the default implementation. | 40 // on the default implementation. |
43 virtual media::AudioRendererSink* CreateOutputDevice() = 0; | 41 virtual media::AudioRendererSink* CreateOutputDevice() = 0; |
44 virtual AudioInputDevice* CreateInputDevice() = 0; | 42 virtual media::AudioInputDevice* CreateInputDevice() = 0; |
45 | 43 |
46 private: | 44 private: |
47 // The current globally registered factory. This is NULL when we should | 45 // The current globally registered factory. This is NULL when we should |
48 // create the default AudioRendererSinks. | 46 // create the default AudioRendererSinks. |
49 static AudioDeviceFactory* factory_; | 47 static AudioDeviceFactory* factory_; |
50 | 48 |
51 DISALLOW_COPY_AND_ASSIGN(AudioDeviceFactory); | 49 DISALLOW_COPY_AND_ASSIGN(AudioDeviceFactory); |
52 }; | 50 }; |
53 | 51 |
54 } // namespace content | 52 } // namespace content |
55 | 53 |
56 #endif // CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_ | 54 #endif // CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_ |
OLD | NEW |