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