| 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" |
| 7 #include "media/audio/fake_audio_input_stream.h" | 8 #include "media/audio/fake_audio_input_stream.h" |
| 8 #include "media/audio/fake_audio_output_stream.h" | 9 #include "media/audio/fake_audio_output_stream.h" |
| 9 #include "media/audio/mac/audio_manager_mac.h" | 10 #include "media/audio/mac/audio_manager_mac.h" |
| 10 #include "media/audio/mac/audio_output_mac.h" | 11 #include "media/audio/mac/audio_output_mac.h" |
| 11 | 12 |
| 12 bool AudioManagerMac::HasAudioOutputDevices() { | 13 bool AudioManagerMac::HasAudioOutputDevices() { |
| 13 AudioDeviceID output_device_id = kAudioObjectUnknown; | 14 AudioDeviceID output_device_id = kAudioObjectUnknown; |
| 14 AudioObjectPropertyAddress property_address = { | 15 AudioObjectPropertyAddress property_address = { |
| 15 kAudioHardwarePropertyDefaultOutputDevice, // mSelector | 16 kAudioHardwarePropertyDefaultOutputDevice, // mSelector |
| 16 kAudioObjectPropertyScopeGlobal, // mScope | 17 kAudioObjectPropertyScopeGlobal, // mScope |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 void AudioManagerMac::UnMuteAll() { | 68 void AudioManagerMac::UnMuteAll() { |
| 68 // TODO(cpu): implement. | 69 // TODO(cpu): implement. |
| 69 } | 70 } |
| 70 | 71 |
| 71 // Called by the stream when it has been released by calling Close(). | 72 // Called by the stream when it has been released by calling Close(). |
| 72 void AudioManagerMac::ReleaseOutputStream( | 73 void AudioManagerMac::ReleaseOutputStream( |
| 73 PCMQueueOutAudioOutputStream* stream) { | 74 PCMQueueOutAudioOutputStream* stream) { |
| 74 delete stream; | 75 delete stream; |
| 75 } | 76 } |
| 76 | 77 |
| 77 // static | 78 namespace { |
| 78 AudioManager* AudioManager::CreateAudioManager() { | 79 |
| 79 return new AudioManagerMac(); | 80 AudioManagerMac* g_audio_manager = NULL; |
| 81 |
| 82 } // namespace. |
| 83 |
| 84 void DestroyAudioManagerMac(void* param) { |
| 85 delete g_audio_manager; |
| 86 g_audio_manager = NULL; |
| 80 } | 87 } |
| 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 |