Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
AEDeviceEnumerationOSX Class Reference

#include <AEDeviceEnumerationOSX.h>

Public Member Functions

 AEDeviceEnumerationOSX (AudioDeviceID deviceID)
 C'tor - initialises the Enumerator and calls Enumerate.
 
 ~AEDeviceEnumerationOSX ()=default
 
CADeviceList GetDeviceInfoList () const
 Gets the device list which was enumerated by the last call to Enumerate (which is also called in c'tor).
 
bool Enumerate ()
 Fetches all metadata from the CoreAudio device which is needed to generate a proper DeviceList for AE This method is always called from C'tor but can be called multiple times if the streams of a device changed. This fills m_caStreamInfos. After this call - GetDeviceInfoList will reflect the Enumerated metadata.
 
unsigned int GetNumPlanes () const
 Returns the number of Planes for a device. This will be 1 for non-planar devices and > 1 for planar devices.
 
bool IsPlanar () const
 Checks if the m_deviceID belongs to a planar or non-planar device.
 
bool FindSuitableFormatForStream (UInt32 &streamIdx, const AEAudioFormat &format, bool virt, AudioStreamBasicDescription &outputFormat, AudioStreamID &outputStream) const
 Tries to find a suitable CoreAudio format which matches the given AEAudioFormat as close as possible.
 
const std::string & GetMasterDeviceName () const
 Returns the device name which belongs to m_deviceID without any stream/source suffixes.
 
void GetAEChannelMap (CAEChannelInfo &channelMap, unsigned int channelsPerFrame) const
 Tries to return a proper channelmap from CA in a format AE understands.
 
float ScoreFormat (const AudioStreamBasicDescription &formatDesc, const AEAudioFormat &format) const
 Scores a format based on:
 

Constructor & Destructor Documentation

◆ AEDeviceEnumerationOSX()

AEDeviceEnumerationOSX::AEDeviceEnumerationOSX ( AudioDeviceID deviceID)

C'tor - initialises the Enumerator and calls Enumerate.

Parameters
deviceID- the CoreAudio Device ID which will be the base of the enumerated device list

◆ ~AEDeviceEnumerationOSX()

AEDeviceEnumerationOSX::~AEDeviceEnumerationOSX ( )
default

Member Function Documentation

◆ Enumerate()

bool AEDeviceEnumerationOSX::Enumerate ( )

Fetches all metadata from the CoreAudio device which is needed to generate a proper DeviceList for AE This method is always called from C'tor but can be called multiple times if the streams of a device changed. This fills m_caStreamInfos. After this call - GetDeviceInfoList will reflect the Enumerated metadata.

Returns
false when streamlist couldn't be fetched from device - else true

◆ FindSuitableFormatForStream()

bool AEDeviceEnumerationOSX::FindSuitableFormatForStream ( UInt32 & streamIdx,
const AEAudioFormat & format,
bool virt,
AudioStreamBasicDescription & outputFormat,
AudioStreamID & outputStream ) const

Tries to find a suitable CoreAudio format which matches the given AEAudioFormat as close as possible.

Parameters
streamIdx[in/out] - if streamIdx != INT_MAX only formats of the given streamIdx are checked if streamIdx == INT_MAX - formats of all streams in the device are considered On success this parameter returns the selected streamIdx.
format[in] - the requested AE format which should be matched to the stream formats of CA
outputFormat[out] - the found CA format which matches best to the requested AE format
outputStream[out] - the coreaudio streamid which contains the coreaudio format returned in outputFormat
Returns
true if a matching corea audio format was found - else false

◆ GetAEChannelMap()

void AEDeviceEnumerationOSX::GetAEChannelMap ( CAEChannelInfo & channelMap,
unsigned int channelsPerFrame ) const

Tries to return a proper channelmap from CA in a format AE understands.

Parameters
channelMap[in/out] - returns the found channelmap in AE format if initialised with a map the number of channels is used to determine if stereo or multichannel map should be fetched
channelsPerFrame[int] - the number of channels which should be mapped (also decides if stereo or multichannel map is fetched similar to channelMap param)

◆ GetDeviceInfoList()

CADeviceList AEDeviceEnumerationOSX::GetDeviceInfoList ( ) const

Gets the device list which was enumerated by the last call to Enumerate (which is also called in c'tor).

Returns
Returns the device list.

◆ GetMasterDeviceName()

const std::string & AEDeviceEnumerationOSX::GetMasterDeviceName ( ) const
inline

Returns the device name which belongs to m_deviceID without any stream/source suffixes.

Returns
the CA device name

◆ GetNumPlanes()

unsigned int AEDeviceEnumerationOSX::GetNumPlanes ( ) const

Returns the number of Planes for a device. This will be 1 for non-planar devices and > 1 for planar devices.

Returns
Number of planes for this device.

◆ IsPlanar()

bool AEDeviceEnumerationOSX::IsPlanar ( ) const
inline

Checks if the m_deviceID belongs to a planar or non-planar device.

Returns
true if m_deviceID belongs to a planar device - else false.

◆ ScoreFormat()

float AEDeviceEnumerationOSX::ScoreFormat ( const AudioStreamBasicDescription & formatDesc,
const AEAudioFormat & format ) const

Scores a format based on:

  1. Matching passthrough characteristics (i.e. passthrough flag)
  2. Matching sample rate.
  3. Matching bits per channel (or higher).
  4. Matching number of channels (or higher).
Parameters
formatDesc[in] - The CA FormatDescription which should be scored
format[in] - the AE format which should be matched as good as possible
Returns
- the score of formatDesc - higher scores indicate better matching to "format" (scores > 10000 indicate passthrough formats)

The documentation for this class was generated from the following files: