Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
93c2e6ec by Marvin Scholz at 2026-02-17T13:07:55+00:00
buildsystem: detect new libspatialaudio
We can use the presence of the version header to detect libspatialaudio
0.4.0 or higher. (For more granular checks in the future, the defines
from the version header can be checked)
- - - - -
a41efcaf by Marvin Scholz at 2026-02-17T13:07:55+00:00
modules: spatialaudio: compat with new API
This merely makes it build with the new API and doesn't yet migrate
to newer APIs.
- - - - -
3 changed files:
- configure.ac
- modules/audio_filter/channel_mixer/spatialaudio.cpp
- modules/audio_filter/meson.build
Changes:
=====================================
configure.ac
=====================================
@@ -2966,6 +2966,15 @@ dnl Ambisonic channel mixer and binauralizer plugin
dnl
PKG_ENABLE_MODULES_VLC([SPATIALAUDIO], [], [spatialaudio], [Ambisonic channel
mixer and binauralizer], [auto])
+AS_IF([test -n ${SPATIALAUDIO_CFLAGS+set}], [
+ VLC_SAVE_FLAGS
+ AX_APPEND_FLAG([$SPATIALAUDIO_CFLAGS], [CFLAGS])
+ AC_CHECK_HEADER([spatialaudio/SpatialaudioVersion.h], [
+ AX_APPEND_FLAG([-DHAVE_SPATIALAUDIOVERSION_H=1], [SPATIALAUDIO_CFLAGS])
+ ])
+ VLC_RESTORE_FLAGS
+])
+
dnl
dnl theora decoder plugin
dnl
=====================================
modules/audio_filter/channel_mixer/spatialaudio.cpp
=====================================
@@ -44,6 +44,23 @@
#include <spatialaudio/Ambisonics.h>
#include <spatialaudio/SpeakersBinauralizer.h>
+#ifdef HAVE_SPATIALAUDIOVERSION_H
+# include <spatialaudio/SpatialaudioVersion.h>
+#else
+# define SPATIALAUDIO_API_VERSION_MAJOR 0
+#endif
+
+#if SPATIALAUDIO_API_VERSION_MAJOR >= 2
+ using namespace spaudio;
+ using CAmbisonicBinauralizer = spaudio::AmbisonicBinauralizer;
+ using CAmbisonicDecoder = spaudio::AmbisonicDecoder;
+ using CAmbisonicProcessor = spaudio::AmbisonicProcessor;
+ using CAmbisonicZoomer = spaudio::AmbisonicZoomer;
+ using CAmbisonicSpeaker = spaudio::AmbisonicSpeaker;
+ using CBFormat = spaudio::BFormat;
+ #define kAmblib_CustomSpeakerSetUp
Amblib_SpeakerSetUps::kAmblib_CustomSpeakerSetUp
+#endif
+
#define DEFAULT_HRTF_PATH "hrtfs" DIR_SEP "dodeca_and_7channel_3DSL_HRTF.sofa"
#define HRTF_FILE_TEXT N_("HRTF file for the binauralization")
@@ -487,10 +504,18 @@ static int Open(vlc_object_t *p_this)
p_sys->mode = filter_spatialaudio::AMBISONICS_DECODER;
unsigned i_nbChannels =
aout_FormatNbChannels(&p_filter->fmt_out.audio);
- if (i_nbChannels == 1
- || !p_sys->speakerDecoder.Configure(p_sys->i_order, true,
- kAmblib_CustomSpeakerSetUp,
- i_nbChannels))
+ bool ok = false;
+ if (i_nbChannels > 1) {
+#if SPATIALAUDIO_API_VERSION_MAJOR >= 2
+ ok = p_sys->speakerDecoder.Configure(p_sys->i_order, true,
+ AMB_BLOCK_TIME_LEN, p_filter->fmt_in.audio.i_rate,
+ kAmblib_CustomSpeakerSetUp, i_nbChannels);
+#else
+ ok = p_sys->speakerDecoder.Configure(p_sys->i_order, true,
+ kAmblib_CustomSpeakerSetUp, i_nbChannels);
+#endif
+ }
+ if (!ok)
{
msg_Err(p_filter, "Error creating the Ambisonics decoder.");
delete p_sys;
@@ -539,7 +564,13 @@ static int Open(vlc_object_t *p_this)
return VLC_EGENERIC;
}
+#if SPATIALAUDIO_API_VERSION_MAJOR >= 2
+ if (!p_sys->zoomer.Configure(p_sys->i_order, true,
+ AMB_BLOCK_TIME_LEN,
+ p_filter->fmt_in.audio.i_rate))
+#else
if (!p_sys->zoomer.Configure(p_sys->i_order, true, 0))
+#endif
{
msg_Err(p_filter, "Error creating the ambisonic zoomer.");
delete p_sys;
=====================================
modules/audio_filter/meson.build
=====================================
@@ -157,10 +157,16 @@ vlc_modules += {
# Spatial audio (ambisonics/binaural) mixer
spatial_dep = dependency('spatialaudio', required: get_option('spatialaudio'))
if spatial_dep.found()
+ spatial_extra_cflags = []
+ if (spatial_dep.version().version_compare('>= 0.4.0'))
+ spatial_extra_cflags += ['-DHAVE_SPATIALAUDIOVERSION_H=1']
+ endif
+
vlc_modules += {
'name' : 'spatialaudio',
'sources' : files('channel_mixer/spatialaudio.cpp'),
- 'dependencies' : [spatial_dep]
+ 'dependencies' : [spatial_dep],
+ 'c_args' : spatial_extra_cflags
}
endif
@@ -242,4 +248,3 @@ if rnnoise_dep.found()
'dependencies' : [m_lib, rnnoise_dep]
}
endif
-
View it on GitLab:
https://code.videolan.org/videolan/vlc/-/compare/14ccbdbb0db4175be4178b69df5586bbdd5cb54e...a41efcaf1d0b799f0d85d2ca0c59a9c677153cc4
--
View it on GitLab:
https://code.videolan.org/videolan/vlc/-/compare/14ccbdbb0db4175be4178b69df5586bbdd5cb54e...a41efcaf1d0b799f0d85d2ca0c59a9c677153cc4
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits