[vlc-devel] [PATCH 16/16] wasapi: handle AUDIO_CHANNELS_TYPE_AMBISONICS
Thomas Guillem
thomas at gllm.fr
Fri Jul 7 16:03:02 CEST 2017
---
modules/audio_output/wasapi.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/modules/audio_output/wasapi.c b/modules/audio_output/wasapi.c
index e4803b2c6f..948deb24eb 100644
--- a/modules/audio_output/wasapi.c
+++ b/modules/audio_output/wasapi.c
@@ -480,9 +480,25 @@ static HRESULT Restart(aout_stream_t *s, audio_sample_format_t *restrict pfmt,
AUDCLNT_SHAREMODE shared_mode;
REFERENCE_TIME buffer_duration;
audio_sample_format_t fmt = *pfmt;
-
+ bool low_latency = false;
bool b_spdif = AOUT_FMT_SPDIF(&fmt);
bool b_hdmi = AOUT_FMT_HDMI(&fmt);
+
+ if (fmt.channels_type == AUDIO_CHANNELS_TYPE_AMBISONICS)
+ {
+ fmt.channels_type = AUDIO_CHANNELS_TYPE_PHYSICAL;
+ assert(!b_spdif && !b_hdmi);
+
+ /* Request the maximum numbers of channels. The closest channel
+ * configuration will be used to configure ambisonics filters */
+ fmt.i_original_channels = fmt.i_physical_channels = AOUT_CHANS_7_1;
+ aout_FormatPrepare(&fmt);
+
+ /* Setup low latency in order to quickly react to ambisonics filters
+ * viewpoint changes. */
+ low_latency = true;
+ }
+
if (b_spdif && !b_hdmi && fmt.i_format == VLC_CODEC_DTS && !force_dts_spdif
&& fmt.i_rate >= 48000)
{
@@ -512,7 +528,8 @@ static HRESULT Restart(aout_stream_t *s, audio_sample_format_t *restrict pfmt,
{
vlc_ToWave(pwfe, &fmt);
shared_mode = AUDCLNT_SHAREMODE_SHARED;
- buffer_duration = AOUT_MAX_PREPARE_TIME * 10;
+ buffer_duration = (low_latency ? AOUT_MIN_PREPARE_TIME
+ : AOUT_MAX_PREPARE_TIME) * 10;
}
else
{
--
2.11.0
More information about the vlc-devel
mailing list