Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AE][DS] fixed: set the right subtype and channelmask. #2399

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ extern HWND g_hWnd;


DEFINE_GUID( _KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, WAVE_FORMAT_IEEE_FLOAT, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 ); DEFINE_GUID( _KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, WAVE_FORMAT_IEEE_FLOAT, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 );
DEFINE_GUID( _KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF, WAVE_FORMAT_DOLBY_AC3_SPDIF, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 ); DEFINE_GUID( _KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF, WAVE_FORMAT_DOLBY_AC3_SPDIF, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 );
DEFINE_GUID( _KSDATAFORMAT_SUBTYPE_DOLBY_MLP, 0x0000000c, 0x0cea, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
DEFINE_GUID( _KSDATAFORMAT_SUBTYPE_DTS_HD, 0x0000000b, 0x0cea, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
DEFINE_GUID( _KSDATAFORMAT_SUBTYPE_DOLBY_DIGITAL_PLUS, 0x0000000a, 0x0cea, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);


#define EXIT_ON_FAILURE(hr, reason, ...) if(FAILED(hr)) {CLog::Log(LOGERROR, reason " - %s", __VA_ARGS__, WASAPIErrToStr(hr)); goto failed;} #define EXIT_ON_FAILURE(hr, reason, ...) if(FAILED(hr)) {CLog::Log(LOGERROR, reason " - %s", __VA_ARGS__, WASAPIErrToStr(hr)); goto failed;}


Expand Down Expand Up @@ -202,11 +205,38 @@ bool CAESinkDirectSound::Initialize(AEAudioFormat &format, std::string &device)
wfxex.Format.nSamplesPerSec = format.m_sampleRate; wfxex.Format.nSamplesPerSec = format.m_sampleRate;
if (AE_IS_RAW(format.m_dataFormat)) if (AE_IS_RAW(format.m_dataFormat))
{ {
wfxex.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
wfxex.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT; wfxex.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT;
wfxex.Format.wFormatTag = WAVE_FORMAT_DOLBY_AC3_SPDIF;
wfxex.SubFormat = _KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF;
wfxex.Format.wBitsPerSample = 16; wfxex.Format.wBitsPerSample = 16;
wfxex.Format.nChannels = 2;
switch(format.m_dataFormat)
{
case AE_FMT_TRUEHD:
wfxex.SubFormat = _KSDATAFORMAT_SUBTYPE_DOLBY_MLP;
wfxex.dwChannelMask |= SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY |
SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT |
SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT;
break;

case AE_FMT_DTSHD:
wfxex.SubFormat = _KSDATAFORMAT_SUBTYPE_DTS_HD;
wfxex.dwChannelMask |= SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY |
SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT |
SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT;
break;

case AE_FMT_EAC3:
wfxex.SubFormat = _KSDATAFORMAT_SUBTYPE_DOLBY_DIGITAL_PLUS;
break;

case AE_FMT_AC3:
case AE_FMT_DTS:
default:
wfxex.Format.wFormatTag = WAVE_FORMAT_DOLBY_AC3_SPDIF;
wfxex.SubFormat = _KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF;
wfxex.Format.nChannels = 2;
break;
}
} }
else else
{ {
Expand Down