| 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 #include "media/audio/alsa/audio_manager_alsa.h" | 5 #include "media/audio/alsa/audio_manager_alsa.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/environment.h" | 10 #include "base/environment.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 AudioParameters AudioManagerAlsa::GetInputStreamParameters( | 121 AudioParameters AudioManagerAlsa::GetInputStreamParameters( |
| 122 const std::string& device_id) { | 122 const std::string& device_id) { |
| 123 static const int kDefaultInputBufferSize = 1024; | 123 static const int kDefaultInputBufferSize = 1024; |
| 124 | 124 |
| 125 return AudioParameters( | 125 return AudioParameters( |
| 126 AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO, | 126 AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO, |
| 127 kDefaultSampleRate, 16, kDefaultInputBufferSize); | 127 kDefaultSampleRate, 16, kDefaultInputBufferSize); |
| 128 } | 128 } |
| 129 | 129 |
| 130 const char* AudioManagerAlsa::GetName() { |
| 131 return "ALSA"; |
| 132 } |
| 133 |
| 130 void AudioManagerAlsa::GetAlsaAudioDevices(StreamType type, | 134 void AudioManagerAlsa::GetAlsaAudioDevices(StreamType type, |
| 131 AudioDeviceNames* device_names) { | 135 AudioDeviceNames* device_names) { |
| 132 // Constants specified by the ALSA API for device hints. | 136 // Constants specified by the ALSA API for device hints. |
| 133 static const char kPcmInterfaceName[] = "pcm"; | 137 static const char kPcmInterfaceName[] = "pcm"; |
| 134 int card = -1; | 138 int card = -1; |
| 135 | 139 |
| 136 // Loop through the sound cards to get ALSA device hints. | 140 // Loop through the sound cards to get ALSA device hints. |
| 137 while (!wrapper_->CardNext(&card) && card >= 0) { | 141 while (!wrapper_->CardNext(&card) && card >= 0) { |
| 138 void** hints = NULL; | 142 void** hints = NULL; |
| 139 int error = wrapper_->DeviceNameHint(card, kPcmInterfaceName, &hints); | 143 int error = wrapper_->DeviceNameHint(card, kPcmInterfaceName, &hints); |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 367 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 364 switches::kAlsaInputDevice)) { | 368 switches::kAlsaInputDevice)) { |
| 365 device_name = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 369 device_name = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 366 switches::kAlsaInputDevice); | 370 switches::kAlsaInputDevice); |
| 367 } | 371 } |
| 368 | 372 |
| 369 return new AlsaPcmInputStream(this, device_name, params, wrapper_.get()); | 373 return new AlsaPcmInputStream(this, device_name, params, wrapper_.get()); |
| 370 } | 374 } |
| 371 | 375 |
| 372 } // namespace media | 376 } // namespace media |
| OLD | NEW |