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"
10 #include "content/common/content_export.h"
13 class AudioInputDevice
;
14 class AudioOutputDevice
;
19 // A factory for creating AudioOutputDevices and AudioInputDevices. There is a
20 // global factory function that can be installed for the purposes of testing to
21 // provide specialized implementations.
22 class CONTENT_EXPORT AudioDeviceFactory
{
24 // Creates an AudioOutputDevice using the currently registered factory.
25 // |render_frame_id| refers to the RenderFrame containing the entity
26 // producing the audio.
27 static scoped_refptr
<media::AudioOutputDevice
> NewOutputDevice(
30 // Creates an AudioInputDevice using the currently registered factory.
31 // |render_frame_id| refers to the RenderFrame containing the entity
32 // consuming the audio.
33 static scoped_refptr
<media::AudioInputDevice
> NewInputDevice(
38 virtual ~AudioDeviceFactory();
40 // You can derive from this class and specify an implementation for these
41 // functions to provide alternate audio device implementations.
42 // If the return value of either of these function is NULL, we fall back
43 // on the default implementation.
44 virtual media::AudioOutputDevice
* CreateOutputDevice(int render_frame_id
) = 0;
45 virtual media::AudioInputDevice
* CreateInputDevice(int render_frame_id
) = 0;
48 // The current globally registered factory. This is NULL when we should
49 // create the default AudioRendererSinks.
50 static AudioDeviceFactory
* factory_
;
52 DISALLOW_COPY_AND_ASSIGN(AudioDeviceFactory
);
55 } // namespace content
57 #endif // CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_