blob: b15e96701c94e67eb3c232d4361dbc9139a307ad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_
#define CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_
#include "base/basictypes.h"
#include "content/common/content_export.h"
namespace media {
class AudioRendererSink;
}
namespace content {
// A factory for creating AudioRendererSinks. There is a global factory
// function that can be installed for the purposes of testing to provide
// a specialized AudioRendererSink class.
// This class uses the same pattern as content::RenderViewHostFactory.
class CONTENT_EXPORT AudioDeviceFactory {
public:
// Creates an AudioRendererSink using the currently registered factory,
// or the default one if no factory is registered. Ownership of the returned
// pointer will be passed to the caller.
static media::AudioRendererSink* Create();
protected:
AudioDeviceFactory();
virtual ~AudioDeviceFactory();
// You can derive from this class and specify an implementation for this
// function to create a different kind of AudioRendererSink for testing.
virtual media::AudioRendererSink* CreateAudioDevice() = 0;
private:
// The current globally registered factory. This is NULL when we should
// create the default AudioRendererSinks.
static AudioDeviceFactory* factory_;
DISALLOW_COPY_AND_ASSIGN(AudioDeviceFactory);
};
} // namespace content
#endif // CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_FACTORY_H_
|