[vlc-commits] mmdevice: add a way to disable passthrough
Thomas Guillem
git at videolan.org
Fri Dec 15 11:05:49 CET 2017
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Dec 14 16:42:04 2017 +0100| [d913ae19b425c3d001f1fefd241802f9f5e47aee] | committer: 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
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d913ae19b425c3d001f1fefd241802f9f5e47aee
---
modules/audio_output/mmdevice.c | 36 ++++++++++++++++++++++++++++++++++++
modules/audio_output/mmdevice.h | 5 +++++
modules/audio_output/wasapi.c | 4 ++--
3 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/modules/audio_output/mmdevice.c b/modules/audio_output/mmdevice.c
index e141d721e1..b5fbe16855 100644
--- a/modules/audio_output/mmdevice.c
+++ b/modules/audio_output/mmdevice.c
@@ -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()
diff --git a/modules/audio_output/mmdevice.h b/modules/audio_output/mmdevice.h
index f68f8c007b..00050d7504 100644
--- a/modules/audio_output/mmdevice.h
+++ b/modules/audio_output/mmdevice.h
@@ -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;
/**
diff --git a/modules/audio_output/wasapi.c b/modules/audio_output/wasapi.c
index bd4e0ec767..e6bb71ff88 100644
--- a/modules/audio_output/wasapi.c
+++ b/modules/audio_output/wasapi.c
@@ -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
More information about the vlc-commits
mailing list