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
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_
6 #define CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_
8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h"
12 class AudioInputDevice;
13 class AudioOutputDevice;
18 // A factory for creating AudioOutputDevices and AudioInputDevices. There is a
19 // global factory function that can be installed for the purposes of testing to
20 // provide specialized implementations.
21 class AudioDeviceFactory {
23 // Creates an AudioOutputDevice using the currently registered factory.
24 // |render_view_id| refers to the render view containing the entity producing
26 static scoped_refptr<media::AudioOutputDevice> NewOutputDevice(
29 // Creates an AudioInputDevice using the currently registered factory.
30 // |render_view_id| refers to the render view containing the entity consuming
32 static scoped_refptr<media::AudioInputDevice> NewInputDevice(
37 virtual ~AudioDeviceFactory();
39 // You can derive from this class and specify an implementation for these
40 // functions to provide alternate audio device implementations.
41 // If the return value of either of these function is NULL, we fall back
42 // on the default implementation.
43 virtual media::AudioOutputDevice* CreateOutputDevice(int render_view_id) = 0;
44 virtual media::AudioInputDevice* CreateInputDevice(int render_view_id) = 0;
47 // The current globally registered factory. This is NULL when we should
48 // create the default AudioRendererSinks.
49 static AudioDeviceFactory* factory_;
51 DISALLOW_COPY_AND_ASSIGN(AudioDeviceFactory);
54 } // namespace content
56 #endif // CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_