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 virtual bool HasAudioOutputDevices() override
;
24 virtual bool HasAudioInputDevices() override
;
25 virtual void ShowAudioInputSettings() override
;
26 virtual void GetAudioInputDeviceNames(
27 AudioDeviceNames
* device_names
) override
;
28 virtual void GetAudioOutputDeviceNames(
29 AudioDeviceNames
* device_names
) override
;
30 virtual AudioParameters
GetInputStreamParameters(
31 const std::string
& device_id
) override
;
32 virtual void SetHasKeyboardMic() override
;
34 // AudioManagerBase implementation.
35 virtual AudioOutputStream
* MakeLinearOutputStream(
36 const AudioParameters
& params
) override
;
37 virtual AudioOutputStream
* MakeLowLatencyOutputStream(
38 const AudioParameters
& params
,
39 const std::string
& device_id
) override
;
40 virtual AudioInputStream
* MakeLinearInputStream(
41 const AudioParameters
& params
, const std::string
& device_id
) override
;
42 virtual AudioInputStream
* MakeLowLatencyInputStream(
43 const AudioParameters
& params
, const std::string
& device_id
) override
;
45 static snd_pcm_format_t
BitsToFormat(int bits_per_sample
);
48 virtual ~AudioManagerCras();
50 virtual 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_