| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/linux/audio_manager_linux.h" | 5 #include "media/audio/linux/audio_manager_linux.h" |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "media/audio/linux/alsa_output.h" | 9 #include "media/audio/linux/alsa_output.h" |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| 12 AudioManagerLinux* g_audio_manager = NULL; | 12 AudioManagerLinux* g_audio_manager = NULL; |
| 13 } // namespace | 13 } // namespace |
| 14 | 14 |
| 15 // Implementation of AudioManager. | 15 // Implementation of AudioManager. |
| 16 bool AudioManagerLinux::HasAudioDevices() { | 16 bool AudioManagerLinux::HasAudioDevices() { |
| 17 // TODO(ajwong): Make this actually query audio devices. | 17 // TODO(ajwong): Make this actually query audio devices. |
| 18 return true; | 18 return true; |
| 19 } | 19 } |
| 20 | 20 |
| 21 AudioOutputStream* AudioManagerLinux::MakeAudioStream(Format format, | 21 AudioOutputStream* AudioManagerLinux::MakeAudioStream(Format format, |
| 22 int channels, | 22 int channels, |
| 23 int sample_rate, | 23 int sample_rate, |
| 24 char bits_per_sample) { | 24 char bits_per_sample) { |
| 25 // TODO(ajwong): Do we want to be able to configure the device? plug:default | 25 // TODO(ajwong): Do we want to be able to configure the device? default |
| 26 // should work correctly for all mono/stereo, but not surround, which needs | 26 // should work correctly for all mono/stereo, but not surround, which needs |
| 27 // surround40, surround51, etc. | 27 // surround40, surround51, etc. |
| 28 // | 28 // |
| 29 // http://0pointer.de/blog/projects/guide-to-sound-apis.html | 29 // http://0pointer.de/blog/projects/guide-to-sound-apis.html |
| 30 AlsaPCMOutputStream* stream = | 30 AlsaPCMOutputStream* stream = |
| 31 new AlsaPCMOutputStream(AlsaPCMOutputStream::kDefaultDevice, | 31 new AlsaPCMOutputStream(AlsaPCMOutputStream::kDefaultDevice, |
| 32 100 /* 100ms minimal buffer */, | 32 100 /* 100ms minimal buffer */, |
| 33 format, channels, sample_rate, bits_per_sample); | 33 format, channels, sample_rate, bits_per_sample); |
| 34 return stream; | 34 return stream; |
| 35 } | 35 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 62 g_audio_manager = NULL; | 62 g_audio_manager = NULL; |
| 63 } | 63 } |
| 64 | 64 |
| 65 AudioManager* AudioManager::GetAudioManager() { | 65 AudioManager* AudioManager::GetAudioManager() { |
| 66 if (!g_audio_manager) { | 66 if (!g_audio_manager) { |
| 67 g_audio_manager = new AudioManagerLinux(); | 67 g_audio_manager = new AudioManagerLinux(); |
| 68 base::AtExitManager::RegisterCallback(&DestroyAudioManagerLinux, NULL); | 68 base::AtExitManager::RegisterCallback(&DestroyAudioManagerLinux, NULL); |
| 69 } | 69 } |
| 70 return g_audio_manager; | 70 return g_audio_manager; |
| 71 } | 71 } |
| OLD | NEW |