[vlc-commits] [Git][videolan/vlc][3.0.x] 2 commits: buildsystem: detect new libspatialaudio

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Apr 11 11:39:38 UTC 2026



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
62b5f87e by Marvin Scholz at 2026-04-10T13:21:56+02: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)

(cherry picked from commit 93c2e6ec320016a3b3a3764db44fc7434d37d031) (edited)
edited:
- VLC 3 doesn't have meson
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
ea82edcc by Marvin Scholz at 2026-04-10T13:22:02+02:00
modules: spatialaudio: compat with new API

This merely makes it build with the new API and doesn't yet migrate
to newer APIs.

(cherry picked from commit a41efcaf1d0b799f0d85d2ca0c59a9c677153cc4) (rebased)
rebased:
- VLC 3 still has the spatialaudio-headphones option
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -


2 changed files:

- configure.ac
- modules/audio_filter/channel_mixer/spatialaudio.cpp


Changes:

=====================================
configure.ac
=====================================
@@ -2895,6 +2895,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
=====================================
@@ -43,6 +43,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 CFG_PREFIX "spatialaudio-"
 
 #define DEFAULT_HRTF_PATH "hrtfs" DIR_SEP "dodeca_and_7channel_3DSL_HRTF.sofa"
@@ -460,10 +477,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;
@@ -509,7 +534,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;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2d8e0f8cf5935dca3917ce015299eb91480d8167...ea82edcc10c2daad60fa4be8013eac25b7ed8f0f

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2d8e0f8cf5935dca3917ce015299eb91480d8167...ea82edcc10c2daad60fa4be8013eac25b7ed8f0f
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list