Debian Codegraph @

xbmc/cores/AudioEngine/Sinks/osx/CoreAudioStream.h

raw
1 /*
2 * Copyright (C) 2011-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9 #pragma once
10
11 #include "threads/Event.h"
12
13 #include <list>
14 #include <vector>
15
16 #include <CoreAudio/CoreAudio.h>
17 #include <IOKit/audio/IOAudioTypes.h>
18
19
20 typedef std::vector<AudioStreamID> AudioStreamIdList;
21 typedef std::vector<AudioStreamRangedDescription> StreamFormatList;
22
23 class CCoreAudioStream
24 {
25 public:
26 CCoreAudioStream();
27 virtual ~CCoreAudioStream();
28
29 bool Open(AudioStreamID streamId);
30 void Close(bool restore = true);
31
32 AudioStreamID GetId() const {return m_StreamId;}
33 UInt32 GetDirection();
34 static UInt32 GetTerminalType(AudioStreamID id);
35 UInt32 GetNumLatencyFrames();
36 bool GetVirtualFormat(AudioStreamBasicDescription *pDesc);
37 bool GetPhysicalFormat(AudioStreamBasicDescription *pDesc);
38 bool SetVirtualFormat(AudioStreamBasicDescription *pDesc);
39 bool SetPhysicalFormat(AudioStreamBasicDescription *pDesc);
40 bool GetAvailableVirtualFormats(StreamFormatList *pList);
41 bool GetAvailablePhysicalFormats(StreamFormatList *pList);
42 static bool GetAvailableVirtualFormats(AudioStreamID id, StreamFormatList *pList);
43 static bool GetAvailablePhysicalFormats(AudioStreamID id, StreamFormatList *pList);
44 static bool IsDigitalOutput(AudioStreamID id);
45 static bool GetStartingChannelInDevice(AudioStreamID id, UInt32 &startingChannel);
46
47 protected:
48 static OSStatus HardwareStreamListener(AudioObjectID inObjectID,
49 UInt32 inNumberAddresses, const AudioObjectPropertyAddress inAddresses[], void* inClientData);
50
51 CEvent m_virtual_format_event;
52 CEvent m_physical_format_event;
53
54 AudioStreamID m_StreamId = 0;
55 AudioStreamBasicDescription m_OriginalVirtualFormat;
56 AudioStreamBasicDescription m_OriginalPhysicalFormat;
57 };