[PR] avutil/slicethread: fix build without threading support (PR #24318)
michaelni via ffmpeg-devel <[email protected]>
| Newsgroups | gmane.comp.video.ffmpeg.devel |
|---|---|
| Message-ID | <[email protected]> |
PR #24318 opened by michaelni
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24318
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24318.patch
The backwards compatibility wrappers for the deprecated
avpriv_slicethread_{create,execute}() dereference AVSliceThread, whose
definition only exists in the threaded branch of the file. A build
without pthreads/w32threads/os2threads therefore failed with
"dereferencing pointer to incomplete type 'AVSliceThread'".
Move the wrappers into the threaded branch and give the no-threads
branch stubs for the deprecated API matching those of create2/execute2.
>From 9a7d2f271e27534f23304b70475641393545d8d8 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Sat, 29 Aug 2026 16:12:57 +0200
Subject: [PATCH] avutil/slicethread: fix build without threading support
The backwards compatibility wrappers for the deprecated
avpriv_slicethread_{create,execute}() dereference AVSliceThread, whose
definition only exists in the threaded branch of the file. A build
without pthreads/w32threads/os2threads therefore failed with
"dereferencing pointer to incomplete type 'AVSliceThread'".
Move the wrappers into the threaded branch and give the no-threads
branch stubs for the deprecated API matching those of create2/execute2.
---
libavutil/slicethread.c | 64 ++++++++++++++++++++++++++---------------
1 file changed, 41 insertions(+), 23 deletions(-)
diff --git a/libavutil/slicethread.c b/libavutil/slicethread.c
index 65566f0169..60f0f8e55d 100644
--- a/libavutil/slicethread.c
+++ b/libavutil/slicethread.c
@@ -278,29 +278,6 @@ av_cold void avpriv_slicethread_free(AVSliceThread **pctx)
av_freep(pctx);
}
-#else /* HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS32THREADS */
-
-int avpriv_slicethread_create2(AVSliceThread **pctx, void *priv,
- int (*worker_func)(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads),
- int (*main_func)(void *priv),
- int nb_threads)
-{
- *pctx = NULL;
- return AVERROR(ENOSYS);
-}
-
-int avpriv_slicethread_execute2(AVSliceThread *ctx, int nb_jobs, int execute_main)
-{
- av_assert0(0);
-}
-
-void avpriv_slicethread_free(AVSliceThread **pctx)
-{
- av_assert0(!pctx || !*pctx);
-}
-
-#endif /* HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS32THREADS */
-
/**
* Backwards compatibility wrapper for the deprecated avpriv_ slicethread API.
*/
@@ -345,3 +322,44 @@ void avpriv_slicethread_execute(AVSliceThread *ctx, int nb_jobs, int execute_mai
}
#endif /* LIBAVUTIL_VERSION_MAJOR < 62 */
+
+#else /* HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS32THREADS */
+
+int avpriv_slicethread_create2(AVSliceThread **pctx, void *priv,
+ int (*worker_func)(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads),
+ int (*main_func)(void *priv),
+ int nb_threads)
+{
+ *pctx = NULL;
+ return AVERROR(ENOSYS);
+}
+
+int avpriv_slicethread_execute2(AVSliceThread *ctx, int nb_jobs, int execute_main)
+{
+ av_assert0(0);
+}
+
+void avpriv_slicethread_free(AVSliceThread **pctx)
+{
+ av_assert0(!pctx || !*pctx);
+}
+
+#if LIBAVUTIL_VERSION_MAJOR < 62
+
+int avpriv_slicethread_create(AVSliceThread **pctx, void *priv,
+ void (*worker_func)(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads),
+ void (*main_func)(void *priv),
+ int nb_threads)
+{
+ *pctx = NULL;
+ return AVERROR(ENOSYS);
+}
+
+void avpriv_slicethread_execute(AVSliceThread *ctx, int nb_jobs, int execute_main)
+{
+ av_assert0(0);
+}
+
+#endif /* LIBAVUTIL_VERSION_MAJOR < 62 */
+
+#endif /* HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS32THREADS */
--
2.52.0
_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]