Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(496)

Side by Side Diff: media/audio/mac/audio_manager_mac.cc

Issue 210009: AudioHardwareGetProperty is deprecated in Mac OS X 10.6 ("Snow Leopard") (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 <CoreAudio/AudioHardware.h> 5 #include <CoreAudio/AudioHardware.h>
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "media/audio/fake_audio_output_stream.h" 8 #include "media/audio/fake_audio_output_stream.h"
9 #include "media/audio/mac/audio_manager_mac.h" 9 #include "media/audio/mac/audio_manager_mac.h"
10 #include "media/audio/mac/audio_output_mac.h" 10 #include "media/audio/mac/audio_output_mac.h"
11 11
12 bool AudioManagerMac::HasAudioDevices() { 12 bool AudioManagerMac::HasAudioDevices() {
13 AudioDeviceID output_device_id = 0; 13 AudioDeviceID output_device_id = kAudioObjectUnknown;
14 size_t size = sizeof(output_device_id); 14 AudioObjectPropertyAddress property_address = {
15 OSStatus err = AudioHardwareGetProperty( 15 kAudioHardwarePropertyDefaultOutputDevice, // mSelector
16 kAudioHardwarePropertyDefaultOutputDevice, &size, &output_device_id); 16 kAudioObjectPropertyScopeGlobal, // mScope
17 return ((err == noErr) && (output_device_id > 0)); 17 kAudioObjectPropertyElementMaster // mElement
18 };
19 size_t output_device_id_size = sizeof(output_device_id);
20 OSStatus err = AudioObjectGetPropertyData(kAudioObjectSystemObject,
21 &property_address,
22 0, // inQualifierDataSize
23 NULL, // inQualifierData
24 &output_device_id_size,
25 &output_device_id);
26 return err == kAudioHardwareNoError &&
27 output_device_id != kAudioObjectUnknown;
18 } 28 }
19 29
20 AudioOutputStream* AudioManagerMac::MakeAudioStream(Format format, int channels, 30 AudioOutputStream* AudioManagerMac::MakeAudioStream(Format format, int channels,
21 int sample_rate, 31 int sample_rate,
22 char bits_per_sample) { 32 char bits_per_sample) {
23 if (format == AUDIO_MOCK) 33 if (format == AUDIO_MOCK)
24 return FakeAudioOutputStream::MakeFakeStream(); 34 return FakeAudioOutputStream::MakeFakeStream();
25 else if (format != AUDIO_PCM_LINEAR) 35 else if (format != AUDIO_PCM_LINEAR)
26 return NULL; 36 return NULL;
27 return new PCMQueueOutAudioOutputStream(this, channels, sample_rate, 37 return new PCMQueueOutAudioOutputStream(this, channels, sample_rate,
(...skipping 25 matching lines...) Expand all
53 } 63 }
54 64
55 // By convention, the AudioManager is not thread safe. 65 // By convention, the AudioManager is not thread safe.
56 AudioManager* AudioManager::GetAudioManager() { 66 AudioManager* AudioManager::GetAudioManager() {
57 if (!g_audio_manager) { 67 if (!g_audio_manager) {
58 g_audio_manager = new AudioManagerMac(); 68 g_audio_manager = new AudioManagerMac();
59 base::AtExitManager::RegisterCallback(&DestroyAudioManagerMac, NULL); 69 base::AtExitManager::RegisterCallback(&DestroyAudioManagerMac, NULL);
60 } 70 }
61 return g_audio_manager; 71 return g_audio_manager;
62 } 72 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698