OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/mac/audio_manager_mac.h" | 5 #include "media/audio/mac/audio_manager_mac.h" |
6 | 6 |
7 #include <CoreAudio/AudioHardware.h> | 7 #include <CoreAudio/AudioHardware.h> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 kAudioHardwarePropertyDefaultOutputDevice; | 196 kAudioHardwarePropertyDefaultOutputDevice; |
197 | 197 |
198 result = AudioObjectGetPropertyData(kAudioObjectSystemObject, | 198 result = AudioObjectGetPropertyData(kAudioObjectSystemObject, |
199 &property_address, | 199 &property_address, |
200 0, | 200 0, |
201 0, | 201 0, |
202 &device_size, | 202 &device_size, |
203 &audio_device_id); | 203 &audio_device_id); |
204 } else { | 204 } else { |
205 // Non-default device. | 205 // Non-default device. |
206 base::mac::ScopedCFTypeRef<CFStringRef> | 206 base::ScopedCFTypeRef<CFStringRef> uid( |
207 uid(base::SysUTF8ToCFStringRef(device_id)); | 207 base::SysUTF8ToCFStringRef(device_id)); |
208 AudioValueTranslation value; | 208 AudioValueTranslation value; |
209 value.mInputData = &uid; | 209 value.mInputData = &uid; |
210 value.mInputDataSize = sizeof(CFStringRef); | 210 value.mInputDataSize = sizeof(CFStringRef); |
211 value.mOutputData = &audio_device_id; | 211 value.mOutputData = &audio_device_id; |
212 value.mOutputDataSize = device_size; | 212 value.mOutputDataSize = device_size; |
213 UInt32 translation_size = sizeof(AudioValueTranslation); | 213 UInt32 translation_size = sizeof(AudioValueTranslation); |
214 | 214 |
215 property_address.mSelector = kAudioHardwarePropertyDeviceForUID; | 215 property_address.mSelector = kAudioHardwarePropertyDeviceForUID; |
216 result = AudioObjectGetPropertyData(kAudioObjectSystemObject, | 216 result = AudioObjectGetPropertyData(kAudioObjectSystemObject, |
217 &property_address, | 217 &property_address, |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 current_sample_rate_ = new_sample_rate; | 601 current_sample_rate_ = new_sample_rate; |
602 current_output_device_ = new_output_device; | 602 current_output_device_ = new_output_device; |
603 NotifyAllOutputDeviceChangeListeners(); | 603 NotifyAllOutputDeviceChangeListeners(); |
604 } | 604 } |
605 | 605 |
606 AudioManager* CreateAudioManager() { | 606 AudioManager* CreateAudioManager() { |
607 return new AudioManagerMac(); | 607 return new AudioManagerMac(); |
608 } | 608 } |
609 | 609 |
610 } // namespace media | 610 } // namespace media |
OLD | NEW |