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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/environment.h" | 8 #include "base/environment.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 "default", | 43 "default", |
44 "dmix", | 44 "dmix", |
45 "null", | 45 "null", |
46 "pulse", | 46 "pulse", |
47 "surround", | 47 "surround", |
48 }; | 48 }; |
49 | 49 |
50 // static | 50 // static |
51 void AudioManagerAlsa::ShowLinuxAudioInputSettings() { | 51 void AudioManagerAlsa::ShowLinuxAudioInputSettings() { |
52 scoped_ptr<base::Environment> env(base::Environment::Create()); | 52 scoped_ptr<base::Environment> env(base::Environment::Create()); |
53 CommandLine command_line(CommandLine::NO_PROGRAM); | 53 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); |
54 switch (base::nix::GetDesktopEnvironment(env.get())) { | 54 switch (base::nix::GetDesktopEnvironment(env.get())) { |
55 case base::nix::DESKTOP_ENVIRONMENT_GNOME: | 55 case base::nix::DESKTOP_ENVIRONMENT_GNOME: |
56 command_line.SetProgram(base::FilePath("gnome-volume-control")); | 56 command_line.SetProgram(base::FilePath("gnome-volume-control")); |
57 break; | 57 break; |
58 case base::nix::DESKTOP_ENVIRONMENT_KDE3: | 58 case base::nix::DESKTOP_ENVIRONMENT_KDE3: |
59 case base::nix::DESKTOP_ENVIRONMENT_KDE4: | 59 case base::nix::DESKTOP_ENVIRONMENT_KDE4: |
60 command_line.SetProgram(base::FilePath("kmix")); | 60 command_line.SetProgram(base::FilePath("kmix")); |
61 break; | 61 break; |
62 case base::nix::DESKTOP_ENVIRONMENT_UNITY: | 62 case base::nix::DESKTOP_ENVIRONMENT_UNITY: |
63 command_line.SetProgram(base::FilePath("gnome-control-center")); | 63 command_line.SetProgram(base::FilePath("gnome-control-center")); |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 buffer_size = user_buffer_size; | 328 buffer_size = user_buffer_size; |
329 | 329 |
330 return AudioParameters( | 330 return AudioParameters( |
331 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, | 331 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, |
332 sample_rate, bits_per_sample, buffer_size, AudioParameters::NO_EFFECTS); | 332 sample_rate, bits_per_sample, buffer_size, AudioParameters::NO_EFFECTS); |
333 } | 333 } |
334 | 334 |
335 AudioOutputStream* AudioManagerAlsa::MakeOutputStream( | 335 AudioOutputStream* AudioManagerAlsa::MakeOutputStream( |
336 const AudioParameters& params) { | 336 const AudioParameters& params) { |
337 std::string device_name = AlsaPcmOutputStream::kAutoSelectDevice; | 337 std::string device_name = AlsaPcmOutputStream::kAutoSelectDevice; |
338 if (CommandLine::ForCurrentProcess()->HasSwitch( | 338 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
339 switches::kAlsaOutputDevice)) { | 339 switches::kAlsaOutputDevice)) { |
340 device_name = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 340 device_name = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
341 switches::kAlsaOutputDevice); | 341 switches::kAlsaOutputDevice); |
342 } | 342 } |
343 return new AlsaPcmOutputStream(device_name, params, wrapper_.get(), this); | 343 return new AlsaPcmOutputStream(device_name, params, wrapper_.get(), this); |
344 } | 344 } |
345 | 345 |
346 AudioInputStream* AudioManagerAlsa::MakeInputStream( | 346 AudioInputStream* AudioManagerAlsa::MakeInputStream( |
347 const AudioParameters& params, const std::string& device_id) { | 347 const AudioParameters& params, const std::string& device_id) { |
348 std::string device_name = (device_id == AudioManagerBase::kDefaultDeviceId) ? | 348 std::string device_name = (device_id == AudioManagerBase::kDefaultDeviceId) ? |
349 AlsaPcmInputStream::kAutoSelectDevice : device_id; | 349 AlsaPcmInputStream::kAutoSelectDevice : device_id; |
350 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAlsaInputDevice)) { | 350 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
351 device_name = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 351 switches::kAlsaInputDevice)) { |
| 352 device_name = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
352 switches::kAlsaInputDevice); | 353 switches::kAlsaInputDevice); |
353 } | 354 } |
354 | 355 |
355 return new AlsaPcmInputStream(this, device_name, params, wrapper_.get()); | 356 return new AlsaPcmInputStream(this, device_name, params, wrapper_.get()); |
356 } | 357 } |
357 | 358 |
358 } // namespace media | 359 } // namespace media |
OLD | NEW |