• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef MEDIA_AUDIO_MAC_AGGREGATE_DEVICE_MANAGER_H_
6 #define MEDIA_AUDIO_MAC_AGGREGATE_DEVICE_MANAGER_H_
7 
8 #include <CoreAudio/CoreAudio.h>
9 
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "media/base/media_export.h"
13 
14 namespace media {
15 
16 class MEDIA_EXPORT AggregateDeviceManager {
17  public:
18   AggregateDeviceManager();
19   ~AggregateDeviceManager();
20 
21   // Lazily creates an aggregate device based on the default
22   // input and output devices.
23   // It will either return a valid device or kAudioDeviceUnknown
24   // if the default devices are not suitable for aggregate devices.
25   AudioDeviceID GetDefaultAggregateDevice();
26 
27  private:
28   // The caller is responsible for releasing the CFStringRef.
29   static CFStringRef GetDeviceUID(AudioDeviceID id);
30 
31   static void GetDeviceName(AudioDeviceID id, char* name, UInt32 size);
32   static UInt32 GetClockDomain(AudioDeviceID device_id);
33   static OSStatus GetPluginID(AudioObjectID* id);
34 
35   CFMutableDictionaryRef CreateAggregateDeviceDictionary(
36       AudioDeviceID input_id,
37       AudioDeviceID output_id);
38 
39   CFMutableArrayRef CreateSubDeviceArray(CFStringRef input_device_UID,
40                                          CFStringRef output_device_UID);
41 
42   OSStatus CreateAggregateDevice(AudioDeviceID input_id,
43                                  AudioDeviceID output_id,
44                                  AudioDeviceID* aggregate_device);
45   void DestroyAggregateDevice();
46 
47   AudioObjectID plugin_id_;
48   AudioDeviceID input_device_;
49   AudioDeviceID output_device_;
50 
51   AudioDeviceID aggregate_device_;
52 
53   DISALLOW_COPY_AND_ASSIGN(AggregateDeviceManager);
54 };
55 
56 }  // namespace media
57 
58 #endif  // MEDIA_AUDIO_MAC_AGGREGATE_DEVICE_MANAGER_H_
59