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 MEDIA_AUDIO_LINUX_AUDIO_MANAGER_LINUX_H_
6 #define MEDIA_AUDIO_LINUX_AUDIO_MANAGER_LINUX_H_
9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/threading/thread.h"
12 #include "media/audio/audio_manager_base.h"
18 class MEDIA_EXPORT AudioManagerLinux
: public AudioManagerBase
{
22 static void ShowLinuxAudioInputSettings();
24 // Implementation of AudioManager.
25 virtual bool HasAudioOutputDevices() OVERRIDE
;
26 virtual bool HasAudioInputDevices() OVERRIDE
;
27 virtual void ShowAudioInputSettings() OVERRIDE
;
28 virtual void GetAudioInputDeviceNames(media::AudioDeviceNames
* device_names
)
30 virtual AudioParameters
GetInputStreamParameters(
31 const std::string
& device_id
) OVERRIDE
;
33 // Implementation of AudioManagerBase.
34 virtual AudioOutputStream
* MakeLinearOutputStream(
35 const AudioParameters
& params
) OVERRIDE
;
36 virtual AudioOutputStream
* MakeLowLatencyOutputStream(
37 const AudioParameters
& params
,
38 const std::string
& input_device_id
) OVERRIDE
;
39 virtual AudioInputStream
* MakeLinearInputStream(
40 const AudioParameters
& params
, const std::string
& device_id
) OVERRIDE
;
41 virtual AudioInputStream
* MakeLowLatencyInputStream(
42 const AudioParameters
& params
, const std::string
& device_id
) OVERRIDE
;
45 virtual ~AudioManagerLinux();
47 virtual AudioParameters
GetPreferredOutputStreamParameters(
48 const AudioParameters
& input_params
) OVERRIDE
;
56 // Gets a list of available ALSA input devices.
57 void GetAlsaAudioInputDevices(media::AudioDeviceNames
* device_names
);
59 // Gets the ALSA devices' names and ids.
60 void GetAlsaDevicesInfo(void** hint
, media::AudioDeviceNames
* device_names
);
62 // Checks if the specific ALSA device is available.
63 bool IsAlsaDeviceAvailable(const char* device_name
);
65 // Returns true if a device is present for the given stream type.
66 bool HasAnyAlsaAudioDevice(StreamType stream
);
68 // Called by MakeLinearOutputStream and MakeLowLatencyOutputStream.
69 AudioOutputStream
* MakeOutputStream(const AudioParameters
& params
);
71 // Called by MakeLinearInputStream and MakeLowLatencyInputStream.
72 AudioInputStream
* MakeInputStream(const AudioParameters
& params
,
73 const std::string
& device_id
);
75 scoped_ptr
<AlsaWrapper
> wrapper_
;
77 DISALLOW_COPY_AND_ASSIGN(AudioManagerLinux
);
82 #endif // MEDIA_AUDIO_LINUX_AUDIO_MANAGER_LINUX_H_