Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / media / audio / cras / audio_manager_cras.h
blobd55756dc3f2a5beef49835475e84c22eee4ddc9d
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>
10 #include <string>
12 #include "base/compiler_specific.h"
13 #include "base/memory/ref_counted.h"
14 #include "media/audio/audio_manager_base.h"
16 namespace media {
18 class MEDIA_EXPORT AudioManagerCras : public AudioManagerBase {
19 public:
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);
47 protected:
48 ~AudioManagerCras() override;
50 AudioParameters GetPreferredOutputStreamParameters(
51 const std::string& output_device_id,
52 const AudioParameters& input_params) override;
54 private:
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 // Holds the name and ID of the virtual beamforming devices.
65 const AudioDeviceName beamforming_on_device_name_;
66 const AudioDeviceName beamforming_off_device_name_;
68 // Stores the mic positions field from the device.
69 std::vector<Point> mic_positions_;
71 DISALLOW_COPY_AND_ASSIGN(AudioManagerCras);
74 } // namespace media
76 #endif // MEDIA_AUDIO_CRAS_AUDIO_MANAGER_CRAS_H_