Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
e6844457 by Steve Lhomme at 2026-02-18T08:53:54+00:00
configure: select wether the [posix|win32]/process.c will be built

- - - - -
98f3ac33 by Steve Lhomme at 2026-02-18T08:53:54+00:00
configure: add a global define to notify process.c is compiled

- - - - -
c4d2fd04 by Steve Lhomme at 2026-02-18T08:53:54+00:00
meson: add a global define to notify process.c is compiled

- - - - -
5bd972a9 by Steve Lhomme at 2026-02-18T08:53:54+00:00
missing: use HAVE_VLC_PROCESS_SPAWN instead of local guessing

And don't use weak linking so we know when the define is not correct anymore
(the function will be defined twice).

- - - - -
22db4493 by Steve Lhomme at 2026-02-18T08:53:54+00:00
missing: simplify code

- we only need vlc_spawn.h for the vlc_spawn declarations
- HAVE_WEAK_SPAWNP can be set all the time except it's not supported on Windows
- UWP doesn't build win32/spawn.c so we need HAVE_WEAK_SPAWNP

- - - - -
cfb274f6 by Steve Lhomme at 2026-02-18T08:53:54+00:00
test: preparser: disable tests with external process where it can't be run

We could still test the part that use the internal preparser.

- - - - -
6c176b4e by Steve Lhomme at 2026-02-18T08:53:54+00:00
medialibrary: disable external preparser on all platforms it can't be run

This also covers OS/2.

- - - - -
7088c14d by Steve Lhomme at 2026-02-18T08:53:54+00:00
playlist: disable external preparser on all platforms it can't be run

This also covers OS/2.

- - - - -
63dd4d49 by Steve Lhomme at 2026-02-18T08:53:54+00:00
preparser: never call the external preparser on unsupported platforms

And log an error in an external processing is requested on an unsupported 
platform.

We fallback to internal processing. Otherwise the preparsing will always fail.
And this may block (lib)vlc.

- - - - -


13 changed files:

- config.h.meson
- configure.ac
- modules/misc/medialibrary/MetadataExtractor.cpp
- modules/misc/medialibrary/Thumbnailer.cpp
- modules/misc/medialibrary/fs/fs.cpp
- src/Makefile.am
- src/meson.build
- src/missing.c
- src/playlist/playlist.c
- src/preparser/preparser.c
- test/src/preparser/cmp_internal_external.c
- test/src/preparser/thumbnail.c
- test/src/preparser/thumbnail_to_files.c


Changes:

=====================================
config.h.meson
=====================================
@@ -443,6 +443,9 @@
 /* Define to 1 if you have the `vasprintf' function. */
 #mesondefine HAVE_VASPRINTF
 
+/* Define to 1 if vlc_process_Spawn() is usable. */
+#mesondefine HAVE_VLC_PROCESS_SPAWN
+
 /* Define to 1 if you have the `vmsplice' function. */
 #mesondefine HAVE_VMSPLICE
 


=====================================
configure.ac
=====================================
@@ -113,6 +113,8 @@ HAVE_IOS_OR_TVOS="0"
 HAVE_XROS="0"
 HAVE_WATCHOS="0"
 
+HAVE_PROCESS_SPAWN="1"
+
 dnl  Set x86 asm flags and defines
 X86ASMFLAGS=""
 case "${host_cpu}" in
@@ -220,6 +222,7 @@ int foo() { return my_array[0]; }
              #endif],
              [HAVE_IOS="1"
              HAVE_IOS_OR_TVOS="1"
+             HAVE_PROCESS_SPAWN="0"
              ac_cv_func_wordexp=no],
              [HAVE_OSX="1"])
 
@@ -233,6 +236,7 @@ int foo() { return my_array[0]; }
              HAVE_IOS="0"
              HAVE_OSX="0"
              HAVE_XROS="0"
+             HAVE_PROCESS_SPAWN="0"
              ac_cv_func_fork=no
              ],)
 
@@ -246,6 +250,7 @@ int foo() { return my_array[0]; }
              HAVE_OSX="0"
              HAVE_TVOS="0"
              HAVE_IOS_OR_TVOS="0"
+             HAVE_PROCESS_SPAWN="0"
              ac_cv_func_fork=no
              ],)
 
@@ -259,6 +264,7 @@ int foo() { return my_array[0]; }
              HAVE_OSX="0"
              HAVE_TVOS="0"
              HAVE_IOS_OR_TVOS="0"
+             HAVE_PROCESS_SPAWN="0"
              ac_cv_func_fork=no
              ],)
 
@@ -419,6 +425,7 @@ int foo() { return my_array[0]; }
     AC_CHECK_FUNCS([if_nametoindex])
     X86ASMFLAGS="-f aout"
     X86ASMDEFS="-DARCH_X86_64=0 -DPREFIX"
+    HAVE_PROCESS_SPAWN="0"
     ;;
   *emscripten*)
     SYS=emscripten
@@ -427,6 +434,7 @@ int foo() { return my_array[0]; }
     CXXFLAGS="${CXXFLAGS} -pthread"
     ac_cv_func_if_nameindex=yes
     ac_cv_header_sys_shm_h=no
+    HAVE_PROCESS_SPAWN="0"
     ;;
   *)
     SYS="${host_os}"
@@ -441,6 +449,7 @@ case "${host_os}" in
     AC_MSG_CHECKING([Check Android API version])
     ANDROID_API="`echo ${host_os} | tr -c -d '[[:digit:]]'`"
     AC_MSG_RESULT([${ANDROID_API}])
+    HAVE_PROCESS_SPAWN="0"
 
     dnl GLESv2 and EGL are provided by android NDK without .pc files
     GLES2_LIBS="-lGLESv2"
@@ -516,6 +525,11 @@ AM_CONDITIONAL([HAVE_WATCHOS],    [test "${HAVE_WATCHOS}" 
= "1"])
 
 AM_CONDITIONAL([HAVE_LIBANL],  [test "${HAVE_LIBANL}" = "1"])
 
+AM_CONDITIONAL([HAVE_PROCESS_SPAWN],  [test "${HAVE_PROCESS_SPAWN}" = "1"])
+AM_COND_IF([HAVE_PROCESS_SPAWN], [
+  AC_DEFINE([HAVE_VLC_PROCESS_SPAWN], [1], [Define to 1 if vlc_process_Spawn() 
is usable.])
+])
+
 AM_CONDITIONAL([HAVE_WIN32],   [test "${SYS}" = "mingw32"])
 AM_CONDITIONAL([HAVE_WIN64],   [test "${HAVE_WIN64}" = "1"]) dnl Only used for 
the packaging
 AM_CONDITIONAL([HAVE_WINSTORE], [test "$vlc_winstore_app" = "1"])


=====================================
modules/misc/medialibrary/MetadataExtractor.cpp
=====================================
@@ -22,10 +22,6 @@
 # include "config.h"
 #endif
 
-#ifdef __APPLE__
-# include <TargetConditionals.h>
-#endif
-
 #include "medialibrary.h"
 
 #include <vlc_image.h>
@@ -97,7 +93,7 @@ MetadataExtractor::MetadataExtractor( vlc_object_t* parent )
         .max_parser_threads = 1,
         .max_thumbnailer_threads = 0,
         .timeout = VLC_TICK_FROM_SEC(5),
-#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IPHONE)
+#if !defined(HAVE_VLC_PROCESS_SPAWN)
         .external_process = false,
 #else
         .external_process = true,


=====================================
modules/misc/medialibrary/Thumbnailer.cpp
=====================================
@@ -22,10 +22,6 @@
 # include "config.h"
 #endif
 
-#ifdef __APPLE__
-# include <TargetConditionals.h>
-#endif
-
 #include "medialibrary.h"
 
 #include <vlc_fs.h>
@@ -44,7 +40,7 @@ Thumbnailer::Thumbnailer( vlc_medialibrary_module_t* ml )
         .max_parser_threads = 0,
         .max_thumbnailer_threads = 1,
         .timeout = VLC_TICK_FROM_SEC( 3 ),
-#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IPHONE)
+#if !defined(HAVE_VLC_PROCESS_SPAWN)
         .external_process = false,
 #else
         .external_process = true,


=====================================
modules/misc/medialibrary/fs/fs.cpp
=====================================
@@ -22,10 +22,6 @@
 # include "config.h"
 #endif
 
-#ifdef __APPLE__
-# include <TargetConditionals.h>
-#endif
-
 #include <algorithm>
 #include <vlc_services_discovery.h>
 #include <medialibrary/IDeviceLister.h>
@@ -52,7 +48,7 @@ SDFileSystemFactory::SDFileSystemFactory(vlc_object_t *parent,
         .max_parser_threads = 1,
         .max_thumbnailer_threads = 0,
         .timeout = VLC_TICK_FROM_SEC(15),
-#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IPHONE)
+#if !defined(HAVE_VLC_PROCESS_SPAWN)
         .external_process = false,
 #else
         .external_process = true,


=====================================
src/Makefile.am
=====================================
@@ -530,6 +530,9 @@ endif
 endif
 
 if !HAVE_WIN32
+if HAVE_PROCESS_SPAWN
+libvlccore_la_SOURCES += posix/process.c
+endif
 if !HAVE_OS2
 libvlccore_la_SOURCES += \
        posix/filesystem.c \
@@ -548,8 +551,7 @@ libvlccore_la_SOURCES += \
 libvlccore_la_LIBADD += $(LIBEXECINFO)
 if HAVE_OSX
 libvlccore_la_SOURCES += \
-       posix/spawn.c \
-       posix/process.c
+       posix/spawn.c
 endif
 if !HAVE_DARWIN
 if !HAVE_EMSCRIPTEN
@@ -560,8 +562,7 @@ libvlccore_la_SOURCES += \
        posix/error.c \
        posix/picture.c \
        posix/spawn.c \
-       posix/specific.c \
-       posix/process.c
+       posix/specific.c
 if HAVE_LIBANL
 libvlccore_la_SOURCES += \
        linux/getaddrinfo.c


=====================================
src/meson.build
=====================================
@@ -334,12 +334,14 @@ if host_system == 'darwin'
         'posix/wait.c',
     ]
     if have_osx
+        cdata.set('HAVE_VLC_PROCESS_SPAWN', 1)
         libvlccore_sources += [
             'posix/spawn.c',
             'posix/process.c',
         ]
     endif
 elif host_system == 'windows'
+    cdata.set('HAVE_VLC_PROCESS_SPAWN', 1)
     libvlccore_sources += [
         'win32/dirs-common.c',
         'win32/error.c',
@@ -385,6 +387,7 @@ else
     ]
 
     if host_system != 'android'
+        cdata.set('HAVE_VLC_PROCESS_SPAWN', 1)
         libvlccore_sources += [
             'posix/dirs.c',
             'posix/error.c',


=====================================
src/missing.c
=====================================
@@ -148,21 +148,14 @@ _Noreturn void vlc_control_cancel (vlc_cleanup_t *cleaner)
 }
 #endif
 
-#if !defined(_WIN32)
-# define HAVE_WEAK_SPAWN
+#if !defined(_WIN32) // VLC_WEAK not supported
+# define HAVE_WEAK_SPAWNP
+#elif !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
 # define HAVE_WEAK_SPAWNP
-#else
-# if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
-#  define HAVE_WEAK_SPAWNP
-# endif
-#endif
-
-#if defined(HAVE_WEAK_SPAWN) || defined(HAVE_WEAK_SPAWNP)
-#include <errno.h>
-#include <vlc_spawn.h>
 #endif
 
 #if defined(HAVE_WEAK_SPAWNP)
+#include <vlc_spawn.h>
 VLC_WEAK
 int vlc_spawn(pid_t *pid, const char *file, const int *fds,
               const char *const *args)
@@ -187,8 +180,8 @@ int vlc_waitpid(pid_t pid)
 }
 #endif
 
-#if defined(HAVE_WEAK_SPAWN)
-VLC_WEAK struct vlc_process *
+#if !defined(HAVE_VLC_PROCESS_SPAWN)
+struct vlc_process *
 vlc_process_Spawn(const char *path, int argc, const char *const *argv)
 {
     VLC_UNUSED(path);
@@ -197,7 +190,7 @@ vlc_process_Spawn(const char *path, int argc, const char 
*const *argv)
     return NULL;
 }
 
-VLC_WEAK int
+int
 vlc_process_Terminate(struct vlc_process *process, bool kill_process)
 {
     VLC_UNUSED(process);
@@ -206,7 +199,7 @@ vlc_process_Terminate(struct vlc_process *process, bool 
kill_process)
     return -1;
 }
 
-VLC_WEAK ssize_t
+ssize_t
 vlc_process_fd_Read(struct vlc_process *process, uint8_t *buf, size_t size,
                     vlc_tick_t timeout_ms)
 {
@@ -218,7 +211,7 @@ vlc_process_fd_Read(struct vlc_process *process, uint8_t 
*buf, size_t size,
     return -1;
 }
 
-VLC_WEAK ssize_t
+ssize_t
 vlc_process_fd_Write(struct vlc_process *process, const uint8_t *buf, size_t 
size,
                      vlc_tick_t timeout_ms)
 {


=====================================
src/playlist/playlist.c
=====================================
@@ -22,10 +22,6 @@
 # include "config.h"
 #endif
 
-#ifdef __APPLE__
-# include <TargetConditionals.h>
-#endif
-
 #include "playlist.h"
 
 #include <vlc_common.h>
@@ -49,10 +45,10 @@ vlc_playlist_New(vlc_object_t *parent, enum 
vlc_playlist_preparsing rec,
             .types = VLC_PREPARSER_TYPE_PARSE | 
VLC_PREPARSER_TYPE_FETCHMETA_LOCAL,
             .max_parser_threads = preparse_max_threads,
             .timeout = preparse_timeout,
-#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IPHONE)
-            .external_process = false,
+#if !defined(HAVE_VLC_PROCESS_SPAWN)
+        .external_process = false,
 #else
-            .external_process = true,
+        .external_process = true,
 #endif
         };
         playlist->parser = vlc_preparser_New(parent, &cfg);


=====================================
src/preparser/preparser.c
=====================================
@@ -40,7 +40,17 @@ vlc_preparser_t *vlc_preparser_New(vlc_object_t *obj,
     if (preparser == NULL) {
         return NULL;
     }
+#if defined(HAVE_VLC_PROCESS_SPAWN)
+    const bool external_process = cfg->external_process;
+#else
     if (cfg->external_process) {
+        assert(!cfg->external_process);
+        msg_Err(obj, "external preparser requested on unsupported platform");
+        return NULL;
+    }
+    const bool external_process = false;
+#endif
+    if (external_process) {
         preparser->sys = vlc_preparser_external_New(preparser, obj, cfg);
     } else {
         preparser->sys = vlc_preparser_internal_New(preparser, obj, cfg);


=====================================
test/src/preparser/cmp_internal_external.c
=====================================
@@ -254,6 +254,9 @@ static void test_preparser_cmp(vlc_object_t *obj, int i)
 
 int main( void )
 {
+#if !defined(HAVE_VLC_PROCESS_SPAWN)
+    return 77;
+#else
     test_init();
 
     static const char * argv[] = {
@@ -268,4 +271,5 @@ int main( void )
     }
 
     libvlc_release( vlc );
+#endif
 }


=====================================
test/src/preparser/thumbnail.c
=====================================
@@ -249,9 +249,11 @@ int main( void )
     test_thumbnails( vlc, false );
     test_cancel_thumbnail( vlc, false );
 
+#if !defined(HAVE_VLC_PROCESS_SPAWN)
     fprintf(stderr, "Run with external preparser...\n");
     test_thumbnails( vlc, true );
     test_cancel_thumbnail( vlc, true );
+#endif
 
 
     libvlc_release( vlc );


=====================================
test/src/preparser/thumbnail_to_files.c
=====================================
@@ -372,11 +372,13 @@ int main(int argc, const char *argv[])
     if (ret != 0) {
         goto end;
     }
+#if !defined(HAVE_VLC_PROCESS_SPAWN)
     fprintf(stderr, "Run with external preparser...\n");
     ret = run_test(vlc, true);
     if (ret != 0) {
         goto end;
     }
+#endif
 
 end:
     libvlc_release(vlc);



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/49c0baf169ad3cf83146a1d7d98caf05120d1ed6...63dd4d49e4449202d21c769fc3ada7f5b60b3433

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/49c0baf169ad3cf83146a1d7d98caf05120d1ed6...63dd4d49e4449202d21c769fc3ada7f5b60b3433
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

Reply via email to