| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <CoreAudio/AudioHardware.h> | 5 #include <CoreAudio/AudioHardware.h> |
| 6 | 6 |
| 7 #include "base/at_exit.h" | |
| 8 #include "media/audio/fake_audio_input_stream.h" | 7 #include "media/audio/fake_audio_input_stream.h" |
| 9 #include "media/audio/fake_audio_output_stream.h" | 8 #include "media/audio/fake_audio_output_stream.h" |
| 10 #include "media/audio/mac/audio_manager_mac.h" | 9 #include "media/audio/mac/audio_manager_mac.h" |
| 11 #include "media/audio/mac/audio_output_mac.h" | 10 #include "media/audio/mac/audio_output_mac.h" |
| 12 | 11 |
| 13 bool AudioManagerMac::HasAudioOutputDevices() { | 12 bool AudioManagerMac::HasAudioOutputDevices() { |
| 14 AudioDeviceID output_device_id = kAudioObjectUnknown; | 13 AudioDeviceID output_device_id = kAudioObjectUnknown; |
| 15 AudioObjectPropertyAddress property_address = { | 14 AudioObjectPropertyAddress property_address = { |
| 16 kAudioHardwarePropertyDefaultOutputDevice, // mSelector | 15 kAudioHardwarePropertyDefaultOutputDevice, // mSelector |
| 17 kAudioObjectPropertyScopeGlobal, // mScope | 16 kAudioObjectPropertyScopeGlobal, // mScope |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 void AudioManagerMac::UnMuteAll() { | 67 void AudioManagerMac::UnMuteAll() { |
| 69 // TODO(cpu): implement. | 68 // TODO(cpu): implement. |
| 70 } | 69 } |
| 71 | 70 |
| 72 // Called by the stream when it has been released by calling Close(). | 71 // Called by the stream when it has been released by calling Close(). |
| 73 void AudioManagerMac::ReleaseOutputStream( | 72 void AudioManagerMac::ReleaseOutputStream( |
| 74 PCMQueueOutAudioOutputStream* stream) { | 73 PCMQueueOutAudioOutputStream* stream) { |
| 75 delete stream; | 74 delete stream; |
| 76 } | 75 } |
| 77 | 76 |
| 78 namespace { | 77 // static |
| 79 | 78 AudioManager* AudioManager::CreateAudioManager() { |
| 80 AudioManagerMac* g_audio_manager = NULL; | 79 return new AudioManagerMac(); |
| 81 | |
| 82 } // namespace. | |
| 83 | |
| 84 void DestroyAudioManagerMac(void* param) { | |
| 85 delete g_audio_manager; | |
| 86 g_audio_manager = NULL; | |
| 87 } | 80 } |
| 88 | |
| 89 // By convention, the AudioManager is not thread safe. | |
| 90 AudioManager* AudioManager::GetAudioManager() { | |
| 91 if (!g_audio_manager) { | |
| 92 g_audio_manager = new AudioManagerMac(); | |
| 93 base::AtExitManager::RegisterCallback(&DestroyAudioManagerMac, NULL); | |
| 94 } | |
| 95 return g_audio_manager; | |
| 96 } | |
| OLD | NEW |