1 // Copyright 2013 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_CRAS_AUDIO_MANAGER_CRAS_H_
6 #define MEDIA_AUDIO_CRAS_AUDIO_MANAGER_CRAS_H_
8 #include <cras_types.h>
12 #include "base/compiler_specific.h"
13 #include "base/memory/ref_counted.h"
14 #include "media/audio/audio_manager_base.h"
18 class MEDIA_EXPORT AudioManagerCras
: public AudioManagerBase
{
20 AudioManagerCras(AudioLogFactory
* audio_log_factory
);
22 // AudioManager implementation.
23 bool HasAudioOutputDevices() override
;
24 bool HasAudioInputDevices() override
;
25 void ShowAudioInputSettings() override
;
26 void GetAudioInputDeviceNames(AudioDeviceNames
* device_names
) override
;
27 void GetAudioOutputDeviceNames(AudioDeviceNames
* device_names
) override
;
28 AudioParameters
GetInputStreamParameters(
29 const std::string
& device_id
) override
;
30 void SetHasKeyboardMic() override
;
32 // AudioManagerBase implementation.
33 AudioOutputStream
* MakeLinearOutputStream(
34 const AudioParameters
& params
) override
;
35 AudioOutputStream
* MakeLowLatencyOutputStream(
36 const AudioParameters
& params
,
37 const std::string
& device_id
) override
;
38 AudioInputStream
* MakeLinearInputStream(
39 const AudioParameters
& params
,
40 const std::string
& device_id
) override
;
41 AudioInputStream
* MakeLowLatencyInputStream(
42 const AudioParameters
& params
,
43 const std::string
& device_id
) override
;
45 static snd_pcm_format_t
BitsToFormat(int bits_per_sample
);
48 ~AudioManagerCras() override
;
50 AudioParameters
GetPreferredOutputStreamParameters(
51 const std::string
& output_device_id
,
52 const AudioParameters
& input_params
) override
;
55 // Called by MakeLinearOutputStream and MakeLowLatencyOutputStream.
56 AudioOutputStream
* MakeOutputStream(const AudioParameters
& params
);
58 // Called by MakeLinearInputStream and MakeLowLatencyInputStream.
59 AudioInputStream
* MakeInputStream(const AudioParameters
& params
,
60 const std::string
& device_id
);
62 bool has_keyboard_mic_
;
64 DISALLOW_COPY_AND_ASSIGN(AudioManagerCras
);
69 #endif // MEDIA_AUDIO_CRAS_AUDIO_MANAGER_CRAS_H_