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 AudioInputDevice; |
13 class AudioRendererSink; | 13 class AudioRendererSink; |
14 } | 14 } |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 // A factory for creating AudioRendererSinks. There is a global factory | 18 // A factory for creating AudioRendererSinks. There is a global factory |
19 // 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 |
20 // a specialized AudioRendererSink class. | 20 // a specialized AudioRendererSink class. |
21 class CONTENT_EXPORT AudioDeviceFactory { | 21 class CONTENT_EXPORT AudioDeviceFactory { |
22 public: | 22 public: |
23 // Creates an AudioRendererSink using the currently registered factory, | 23 // Creates an AudioRendererSink using the currently registered factory, |
24 // 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 |
25 // pointer will be passed to the caller. | 25 // pointer will be passed to the caller. |render_view_id| refers to the |
26 static media::AudioRendererSink* NewOutputDevice(); | 26 // source of the output. |
27 static media::AudioRendererSink* NewOutputDevice( | |
scherkus (not reviewing)
2012/10/18 01:56:28
nit: this appears to fit on one line
miu
2012/10/18 03:27:26
Done.
| |
28 int render_view_id); | |
27 | 29 |
28 // TODO(henrika): Update AudioInputDevice to inherit from an interface | 30 // TODO(henrika): Update AudioInputDevice to inherit from an interface |
29 // similar to AudioRendererSink, but for input. Same for the callback | 31 // similar to AudioRendererSink, but for input. Same for the callback |
30 // interfaces. | 32 // interfaces. |
31 static media::AudioInputDevice* NewInputDevice(); | 33 // Creates an AudioInputDevice using the currently registered factory, or the |
34 // default one if no factory is registered. Caller owns the returned object. | |
35 // |render_view_id| refers to the consumer of the input. | |
36 static media::AudioInputDevice* NewInputDevice( | |
37 int render_view_id); | |
32 | 38 |
33 protected: | 39 protected: |
34 AudioDeviceFactory(); | 40 AudioDeviceFactory(); |
35 virtual ~AudioDeviceFactory(); | 41 virtual ~AudioDeviceFactory(); |
36 | 42 |
37 // You can derive from this class and specify an implementation for these | 43 // You can derive from this class and specify an implementation for these |
38 // functions to provide alternate audio device implementations. | 44 // functions to provide alternate audio device implementations. |
39 // If the return value of either of these function is NULL, we fall back | 45 // If the return value of either of these function is NULL, we fall back |
40 // on the default implementation. | 46 // on the default implementation. |
41 virtual media::AudioRendererSink* CreateOutputDevice() = 0; | 47 virtual media::AudioRendererSink* CreateOutputDevice(int render_view_id) = 0; |
42 virtual media::AudioInputDevice* CreateInputDevice() = 0; | 48 virtual media::AudioInputDevice* CreateInputDevice(int render_view_id) = 0; |
43 | 49 |
44 private: | 50 private: |
45 // The current globally registered factory. This is NULL when we should | 51 // The current globally registered factory. This is NULL when we should |
46 // create the default AudioRendererSinks. | 52 // create the default AudioRendererSinks. |
47 static AudioDeviceFactory* factory_; | 53 static AudioDeviceFactory* factory_; |
48 | 54 |
49 DISALLOW_COPY_AND_ASSIGN(AudioDeviceFactory); | 55 DISALLOW_COPY_AND_ASSIGN(AudioDeviceFactory); |
50 }; | 56 }; |
51 | 57 |
52 } // namespace content | 58 } // namespace content |
53 | 59 |
54 #endif // CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_ | 60 #endif // CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_ |
OLD | NEW |