Repository: xbmc/xbmc
File: xbmc/cores/AudioEngine/Sinks/windows/AESinkFactoryWin.h (C/C++)

Code before:
  AEDataFormat subFormatType;
};

//! @todo
//! Sample formats go from float -> 32 bit int -> 24 bit int (packed in 32) -> -> 24 bit int -> 16 bit int */
//! versions of Kodi before 14.0 had a bug which made S24NE4MSB the first format selected
//! this bug worked around some driver bug of some IEC958 devices which report S32 but can't handle it
//! correctly. So far I have never seen and WASAPI device using S32 and don't think probing S24 before
//! S32 has any negative impact.
static const sampleFormat testFormats[] = { {KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, 32, 32, AE_FMT_FLOAT},
                                            {KSDATAFORMAT_SUBTYPE_PCM, 32, 24, AE_FMT_S24NE4MSB},
                                            {KSDATAFORMAT_SUBTYPE_PCM, 32, 32, AE_FMT_S32NE},
                                            {KSDATAFORMAT_SUBTYPE_PCM, 24, 24, AE_FMT_S24NE3},
                                            {KSDATAFORMAT_SUBTYPE_PCM, 16, 16, AE_FMT_S16NE} };

struct RendererDetail
{
  std::string strDeviceId;
  std::string strDescription;
  std::string strWinDevType;
  std::string strDeviceEnumerator;
  AEDeviceType eDeviceType;
  unsigned int nChannels;
  unsigned int uiChannelMask;
  bool bDefault;
  WAVEFORMATEX wfx;
};

struct IAEWASAPIDevice
{
  std::string deviceId;
  virtual int Release() = 0;
  virtual HRESULT Activate(IAudioClient** ppAudioClient) = 0;
  virtual bool IsUSBDevice() = 0;
};

class CAESinkFactoryWin
{
public:
  /*
    Gets list of available audio renderers - using MMDevice
  */
  static std::vector<RendererDetail> GetRendererDetails();
  /*
    Gets list of available audio renderers - using WinRT
  */
  static std::vector<RendererDetail> GetRendererDetailsWinRT();
  /*
    Gets default device id
  */
  static std::string GetDefaultDeviceId();

Review comment (suggestion):
Not seems necessary add this new member. This is used to obtain channels and channelMask and this info is already present in the struct.

Should be possible do same that in GetRendererDetailsWinRT()

https://github.com/xbmc/xbmc/blob/5ad9f62225b645ced2324c0402954a40dc3f4793/xbmc/cores/AudioEngine/Sinks/windows/AESinkFactoryWinRT.cpp#L90-L92

Code after:
  AEDataFormat subFormatType;
};

//! @todo
//! Sample formats go from float -> 32 bit int -> 24 bit int (packed in 32) -> -> 24 bit int -> 16 bit int */
//! versions of Kodi before 14.0 had a bug which made S24NE4MSB the first format selected
//! this bug worked around some driver bug of some IEC958 devices which report S32 but can't handle it
//! correctly. So far I have never seen and WASAPI device using S32 and don't think probing S24 before
//! S32 has any negative impact.
static const sampleFormat testFormats[] = { {KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, 32, 32, AE_FMT_FLOAT},
                                            {KSDATAFORMAT_SUBTYPE_PCM, 32, 24, AE_FMT_S24NE4MSB},
                                            {KSDATAFORMAT_SUBTYPE_PCM, 32, 32, AE_FMT_S32NE},
                                            {KSDATAFORMAT_SUBTYPE_PCM, 24, 24, AE_FMT_S24NE3},
                                            {KSDATAFORMAT_SUBTYPE_PCM, 16, 16, AE_FMT_S16NE} };

struct RendererDetail
{
  std::string strDeviceId;
  std::string strDescription;
  std::string strWinDevType;
  std::string strDeviceEnumerator;
  AEDeviceType eDeviceType;
  unsigned int nChannels;
  unsigned int uiChannelMask;
  unsigned long m_samplesPerSec; //!< Sample rate of the system default format
  bool bDefault;
};

struct IAEWASAPIDevice
{
  std::string deviceId;
  virtual int Release() = 0;
  virtual HRESULT Activate(IAudioClient** ppAudioClient) = 0;
  virtual bool IsUSBDevice() = 0;
};

class CAESinkFactoryWin
{
public:
  /*
    Gets list of available audio renderers - using MMDevice
  */
  static std::vector<RendererDetail> GetRendererDetails();
  /*
    Gets list of available audio renderers - using WinRT
  */
  static std::vector<RendererDetail> GetRendererDetailsWinRT();
  /*
    Gets default device id
  */
  static std::string GetDefaultDeviceId();