| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_AUDIO_CRAS_AUDIO_MANAGER_CRAS_H_ | 5 #ifndef MEDIA_AUDIO_CRAS_AUDIO_MANAGER_CRAS_H_ |
| 6 #define MEDIA_AUDIO_CRAS_AUDIO_MANAGER_CRAS_H_ | 6 #define MEDIA_AUDIO_CRAS_AUDIO_MANAGER_CRAS_H_ |
| 7 | 7 |
| 8 #include <cras_types.h> | 8 #include <cras_types.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "media/audio/audio_manager_base.h" | 15 #include "media/audio/audio_manager_base.h" |
| 16 | 16 |
| 17 namespace media { | 17 namespace media { |
| 18 | 18 |
| 19 class MEDIA_EXPORT AudioManagerCras : public AudioManagerBase { | 19 class MEDIA_EXPORT AudioManagerCras : public AudioManagerBase { |
| 20 public: | 20 public: |
| 21 AudioManagerCras( | 21 AudioManagerCras( |
| 22 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 22 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 23 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, | 23 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, |
| 24 AudioLogFactory* audio_log_factory); | 24 AudioLogFactory* audio_log_factory); |
| 25 ~AudioManagerCras() override; |
| 25 | 26 |
| 26 // AudioManager implementation. | 27 // AudioManager implementation. |
| 27 bool HasAudioOutputDevices() override; | 28 bool HasAudioOutputDevices() override; |
| 28 bool HasAudioInputDevices() override; | 29 bool HasAudioInputDevices() override; |
| 29 void ShowAudioInputSettings() override; | 30 void ShowAudioInputSettings() override; |
| 30 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override; | 31 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override; |
| 31 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override; | 32 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override; |
| 32 AudioParameters GetInputStreamParameters( | 33 AudioParameters GetInputStreamParameters( |
| 33 const std::string& device_id) override; | 34 const std::string& device_id) override; |
| 34 const char* GetName() override; | 35 const char* GetName() override; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 50 const std::string& device_id, | 51 const std::string& device_id, |
| 51 const LogCallback& log_callback) override; | 52 const LogCallback& log_callback) override; |
| 52 | 53 |
| 53 static snd_pcm_format_t BitsToFormat(int bits_per_sample); | 54 static snd_pcm_format_t BitsToFormat(int bits_per_sample); |
| 54 | 55 |
| 55 // Checks if |device_id| corresponds to the default device. | 56 // Checks if |device_id| corresponds to the default device. |
| 56 // Set |is_input| to true for capture devices, false for output. | 57 // Set |is_input| to true for capture devices, false for output. |
| 57 bool IsDefault(const std::string& device_id, bool is_input); | 58 bool IsDefault(const std::string& device_id, bool is_input); |
| 58 | 59 |
| 59 protected: | 60 protected: |
| 60 ~AudioManagerCras() override; | |
| 61 | |
| 62 AudioParameters GetPreferredOutputStreamParameters( | 61 AudioParameters GetPreferredOutputStreamParameters( |
| 63 const std::string& output_device_id, | 62 const std::string& output_device_id, |
| 64 const AudioParameters& input_params) override; | 63 const AudioParameters& input_params) override; |
| 65 | 64 |
| 66 private: | 65 private: |
| 67 // Called by MakeLinearOutputStream and MakeLowLatencyOutputStream. | 66 // Called by MakeLinearOutputStream and MakeLowLatencyOutputStream. |
| 68 AudioOutputStream* MakeOutputStream(const AudioParameters& params, | 67 AudioOutputStream* MakeOutputStream(const AudioParameters& params, |
| 69 const std::string& device_id); | 68 const std::string& device_id); |
| 70 | 69 |
| 71 // Called by MakeLinearInputStream and MakeLowLatencyInputStream. | 70 // Called by MakeLinearInputStream and MakeLowLatencyInputStream. |
| 72 AudioInputStream* MakeInputStream(const AudioParameters& params, | 71 AudioInputStream* MakeInputStream(const AudioParameters& params, |
| 73 const std::string& device_id); | 72 const std::string& device_id); |
| 74 | 73 |
| 75 void GetAudioDeviceNamesImpl(bool is_input, AudioDeviceNames* device_names); | 74 void GetAudioDeviceNamesImpl(bool is_input, AudioDeviceNames* device_names); |
| 76 | 75 |
| 77 void AddBeamformingDevices(AudioDeviceNames* device_names); | 76 void AddBeamformingDevices(AudioDeviceNames* device_names); |
| 78 | 77 |
| 79 // Stores the mic positions field from the device. | 78 // Stores the mic positions field from the device. |
| 80 std::vector<Point> mic_positions_; | 79 std::vector<Point> mic_positions_; |
| 81 | 80 |
| 82 const char* beamforming_on_device_id_; | 81 const char* beamforming_on_device_id_; |
| 83 const char* beamforming_off_device_id_; | 82 const char* beamforming_off_device_id_; |
| 84 | 83 |
| 85 DISALLOW_COPY_AND_ASSIGN(AudioManagerCras); | 84 DISALLOW_COPY_AND_ASSIGN(AudioManagerCras); |
| 86 }; | 85 }; |
| 87 | 86 |
| 88 } // namespace media | 87 } // namespace media |
| 89 | 88 |
| 90 #endif // MEDIA_AUDIO_CRAS_AUDIO_MANAGER_CRAS_H_ | 89 #endif // MEDIA_AUDIO_CRAS_AUDIO_MANAGER_CRAS_H_ |
| OLD | NEW |