| 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 "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 | 10 |
| 11 namespace media { | 11 namespace media { |
| 12 class AudioInputDevice; | 12 class AudioInputDevice; |
| 13 class AudioOutputDevice; |
| 13 } | 14 } |
| 14 | 15 |
| 15 namespace content { | 16 namespace content { |
| 16 | 17 |
| 17 class RendererAudioOutputDevice; | 18 // A factory for creating AudioOutputDevices and AudioInputDevices. There is a |
| 18 | 19 // global factory function that can be installed for the purposes of testing to |
| 19 // A factory for creating RendererAudioOutputDevices. There is a global factory | 20 // provide specialized implementations. |
| 20 // function that can be installed for the purposes of testing to provide | |
| 21 // a specialized AudioRendererSink class. | |
| 22 class AudioDeviceFactory { | 21 class AudioDeviceFactory { |
| 23 public: | 22 public: |
| 24 // Creates a RendererAudioOutputDevice using the currently registered factory. | 23 // Creates an AudioOutputDevice using the currently registered factory. |
| 25 static scoped_refptr<RendererAudioOutputDevice> NewOutputDevice(); | 24 // |render_view_id| refers to the render view containing the entity producing |
| 25 // the audio. |
| 26 static scoped_refptr<media::AudioOutputDevice> NewOutputDevice( |
| 27 int render_view_id); |
| 26 | 28 |
| 27 // Creates an AudioInputDevice using the currently registered factory, | 29 // Creates an AudioInputDevice using the currently registered factory. |
| 28 static scoped_refptr<media::AudioInputDevice> NewInputDevice(); | 30 // |render_view_id| refers to the render view containing the entity consuming |
| 31 // the audio. |
| 32 static scoped_refptr<media::AudioInputDevice> NewInputDevice( |
| 33 int render_view_id); |
| 29 | 34 |
| 30 protected: | 35 protected: |
| 31 AudioDeviceFactory(); | 36 AudioDeviceFactory(); |
| 32 virtual ~AudioDeviceFactory(); | 37 virtual ~AudioDeviceFactory(); |
| 33 | 38 |
| 34 // You can derive from this class and specify an implementation for these | 39 // You can derive from this class and specify an implementation for these |
| 35 // functions to provide alternate audio device implementations. | 40 // functions to provide alternate audio device implementations. |
| 36 // If the return value of either of these function is NULL, we fall back | 41 // If the return value of either of these function is NULL, we fall back |
| 37 // on the default implementation. | 42 // on the default implementation. |
| 38 virtual RendererAudioOutputDevice* CreateOutputDevice() = 0; | 43 virtual media::AudioOutputDevice* CreateOutputDevice(int render_view_id) = 0; |
| 39 virtual media::AudioInputDevice* CreateInputDevice() = 0; | 44 virtual media::AudioInputDevice* CreateInputDevice(int render_view_id) = 0; |
| 40 | 45 |
| 41 private: | 46 private: |
| 42 // The current globally registered factory. This is NULL when we should | 47 // The current globally registered factory. This is NULL when we should |
| 43 // create the default AudioRendererSinks. | 48 // create the default AudioRendererSinks. |
| 44 static AudioDeviceFactory* factory_; | 49 static AudioDeviceFactory* factory_; |
| 45 | 50 |
| 46 DISALLOW_COPY_AND_ASSIGN(AudioDeviceFactory); | 51 DISALLOW_COPY_AND_ASSIGN(AudioDeviceFactory); |
| 47 }; | 52 }; |
| 48 | 53 |
| 49 } // namespace content | 54 } // namespace content |
| 50 | 55 |
| 51 #endif // CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_ | 56 #endif // CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_ |
| OLD | NEW |