chrome.bluetoothSocket: clean-up Listen functions
[chromium-blink-merge.git] / content / renderer / media / audio_device_factory.h
blob3865753d8d04b7c39a8c5ade3355cf28bf8ca237
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"
12 namespace media {
13 class AudioInputDevice;
14 class AudioOutputDevice;
17 namespace content {
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 {
23 public:
24 // Creates an AudioOutputDevice using the currently registered factory.
25 // |render_view_id| and |render_frame_id| refer to the render view and render
26 // frame containing the entity producing the audio.
27 static scoped_refptr<media::AudioOutputDevice> NewOutputDevice(
28 int render_view_id, int render_frame_id);
30 // Creates an AudioInputDevice using the currently registered factory.
31 // |render_view_id| refers to the render view containing the entity consuming
32 // the audio.
33 static scoped_refptr<media::AudioInputDevice> NewInputDevice(
34 int render_view_id);
36 protected:
37 AudioDeviceFactory();
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_view_id) = 0;
45 virtual media::AudioInputDevice* CreateInputDevice(int render_view_id) = 0;
47 private:
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_