Commit ae9c4959 authored by Thomas Guillem's avatar Thomas Guillem

aout: mmdevice: setup DTS_HD output only when needed

parent 542c20c7
...@@ -1095,6 +1095,9 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt) ...@@ -1095,6 +1095,9 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
case MM_PASSTHROUGH_ENABLED: case MM_PASSTHROUGH_ENABLED:
if (b_hdmi) if (b_hdmi)
return -1; return -1;
else if (fmt->i_format == VLC_CODEC_DTS)
var_SetBool(aout, "dtshd", false );
/* falltrough */
case MM_PASSTHROUGH_ENABLED_HD: case MM_PASSTHROUGH_ENABLED_HD:
break; break;
} }
......
...@@ -445,8 +445,8 @@ static unsigned vlc_CheckWaveOrder (const WAVEFORMATEX *restrict wf, ...@@ -445,8 +445,8 @@ static unsigned vlc_CheckWaveOrder (const WAVEFORMATEX *restrict wf,
} }
static HRESULT Restart(aout_stream_t *s, audio_sample_format_t *restrict pfmt, static HRESULT Start(aout_stream_t *s, audio_sample_format_t *restrict pfmt,
const GUID *sid, bool force_dts_spdif) const GUID *sid)
{ {
static INIT_ONCE freq_once = INIT_ONCE_STATIC_INIT; static INIT_ONCE freq_once = INIT_ONCE_STATIC_INIT;
...@@ -467,6 +467,17 @@ static HRESULT Restart(aout_stream_t *s, audio_sample_format_t *restrict pfmt, ...@@ -467,6 +467,17 @@ static HRESULT Restart(aout_stream_t *s, audio_sample_format_t *restrict pfmt,
audio_sample_format_t fmt = *pfmt; audio_sample_format_t fmt = *pfmt;
bool b_spdif = AOUT_FMT_SPDIF(&fmt); bool b_spdif = AOUT_FMT_SPDIF(&fmt);
bool b_hdmi = AOUT_FMT_HDMI(&fmt); bool b_hdmi = AOUT_FMT_HDMI(&fmt);
bool b_dtshd = false;
if (fmt.i_format == VLC_CODEC_DTS)
{
b_dtshd = var_GetBool(s->obj.parent, "dtshd");
if (b_dtshd)
{
b_hdmi = true;
b_spdif = false;
}
}
void *pv; void *pv;
HRESULT hr = aout_stream_Activate(s, &IID_IAudioClient, NULL, &pv); HRESULT hr = aout_stream_Activate(s, &IID_IAudioClient, NULL, &pv);
...@@ -477,17 +488,6 @@ static HRESULT Restart(aout_stream_t *s, audio_sample_format_t *restrict pfmt, ...@@ -477,17 +488,6 @@ static HRESULT Restart(aout_stream_t *s, audio_sample_format_t *restrict pfmt,
} }
sys->client = pv; sys->client = pv;
if (fmt.i_format == VLC_CODEC_DTS && !force_dts_spdif && fmt.i_rate >= 48000
&& var_InheritInteger(s, "mmdevice-passthrough") == MM_PASSTHROUGH_ENABLED_HD)
{
/* Try to configure the output rate (IEC958 rate) at 768kHz. Indeed,
* DTS-HD (and other DTS extensions like DTS-X) can only be transmitted
* at 768kHz. We'll also be able to transmit DTS-Core only at this
* rate. */
b_spdif = false;
b_hdmi = true;
}
if (b_spdif) if (b_spdif)
{ {
vlc_SpdifToWave(pwfe, &fmt); vlc_SpdifToWave(pwfe, &fmt);
...@@ -544,7 +544,8 @@ static HRESULT Restart(aout_stream_t *s, audio_sample_format_t *restrict pfmt, ...@@ -544,7 +544,8 @@ static HRESULT Restart(aout_stream_t *s, audio_sample_format_t *restrict pfmt,
"fallback to 48kHz (S/PDIF)"); "fallback to 48kHz (S/PDIF)");
IAudioClient_Release(sys->client); IAudioClient_Release(sys->client);
free(sys); free(sys);
return Restart(s, pfmt, sid, true); var_SetBool(s->obj.parent, "dtshd", false);
return Start(s, pfmt, sid);
} }
msg_Err(s, "cannot negotiate audio format (error 0x%lx)%s", hr, msg_Err(s, "cannot negotiate audio format (error 0x%lx)%s", hr,
hr == AUDCLNT_E_UNSUPPORTED_FORMAT hr == AUDCLNT_E_UNSUPPORTED_FORMAT
...@@ -619,12 +620,6 @@ error: ...@@ -619,12 +620,6 @@ error:
return hr; return hr;
} }
static HRESULT Start(aout_stream_t *s, audio_sample_format_t *restrict pfmt,
const GUID *sid)
{
return Restart(s, pfmt, sid, false);
}
static void Stop(aout_stream_t *s) static void Stop(aout_stream_t *s)
{ {
aout_stream_sys_t *sys = s->sys; aout_stream_sys_t *sys = s->sys;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment