Commit d913ae19 authored by Thomas Guillem's avatar Thomas Guillem

mmdevice: add a way to disable passthrough

cf. http://nucblog.net/2017/03/intel-releases-the-final-hdmi-firmware-for-apollo-and-kaby-lake/

There will be always bugs in  OSes, drivers, HDMI firmwares, or HDMI receivers.
The users will always need a way to disable passthrough if it doesn't work.
Contrary to other OSes like Linux or macOS, I didn't find any way to disable
passthrough for a codec.

Refs #18112
Fixes #19279
parent 685f792f
......@@ -1084,6 +1084,22 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
if (sys->dev == NULL)
return -1;
const bool b_spdif = AOUT_FMT_SPDIF(fmt);
const bool b_hdmi = AOUT_FMT_HDMI(fmt);
if (b_spdif || b_hdmi)
{
switch (var_InheritInteger(aout, "mmdevice-passthrough"))
{
case MM_PASSTHROUGH_DISABLED:
return -1;
case MM_PASSTHROUGH_ENABLED:
if (b_hdmi)
return -1;
case MM_PASSTHROUGH_ENABLED_HD:
break;
}
}
aout_stream_t *s = vlc_object_create(aout, sizeof (*s));
if (unlikely(s == NULL))
return -1;
......@@ -1261,9 +1277,25 @@ static void Close(vlc_object_t *obj)
vlc_join(sys->thread, NULL);
DeleteCriticalSection(&sys->lock);
free(sys);
}
#define MM_PASSTHROUGH_TEXT N_( \
"HDMI/SPDIF audio passthrough")
#define MM_PASSTHROUGH_LONGTEXT N_( \
"Change this value if you have issue with HD codecs when using a HDMI receiver.")
static const int pi_mmdevice_passthrough_values[] = {
MM_PASSTHROUGH_DISABLED,
MM_PASSTHROUGH_ENABLED,
MM_PASSTHROUGH_ENABLED_HD,
};
static const char *const ppsz_mmdevice_passthrough_texts[] = {
N_("Disabled"),
N_("Enabled (without HD codecs)"),
N_("Enabled"),
};
vlc_module_begin()
set_shortname("MMDevice")
set_description(N_("Windows Multimedia Device output"))
......@@ -1274,4 +1306,8 @@ vlc_module_begin()
add_module("mmdevice-backend", "aout stream", "any",
N_("Output back-end"), N_("Audio output back-end interface."),
true)
add_integer( "mmdevice-passthrough", MM_PASSTHROUGH_DEFAULT,
MM_PASSTHROUGH_TEXT, MM_PASSTHROUGH_LONGTEXT, false )
change_integer_list( pi_mmdevice_passthrough_values,
ppsz_mmdevice_passthrough_texts )
vlc_module_end()
......@@ -21,6 +21,11 @@
#ifndef VLC_AOUT_MMDEVICE_H
# define VLC_AOUT_MMDEVICE_H 1
#define MM_PASSTHROUGH_DISABLED 0
#define MM_PASSTHROUGH_ENABLED 1
#define MM_PASSTHROUGH_ENABLED_HD 2
#define MM_PASSTHROUGH_DEFAULT MM_PASSTHROUGH_ENABLED_HD
typedef struct aout_stream aout_stream_t;
/**
......
......@@ -477,8 +477,8 @@ static HRESULT Restart(aout_stream_t *s, audio_sample_format_t *restrict pfmt,
}
sys->client = pv;
if (b_spdif && !b_hdmi && fmt.i_format == VLC_CODEC_DTS && !force_dts_spdif
&& fmt.i_rate >= 48000)
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
......
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