summaryrefslogtreecommitdiff
path: root/libavcodec/codec_internal.h
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-08-29 15:03:21 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-09-03 15:42:57 +0200
commit73fada029c527fda6c248785a948c61249fd4b2d (patch)
treef8c785ff529107f76d5b4b3f3647a3ec6bb1bef6 /libavcodec/codec_internal.h
parent48286d4d98e6417dff397d6f15e6b2ca3310f0ca (diff)
avcodec/codec_internal: Add macros for update_thread_context(_for_user)
It reduces typing: Before this patch, there were 11 callbacks that exceeded the 80 char line length limit; now there are zero. It also allows to remove ONLY_IF_THREADS_ENABLED() in libavutil/internal.h. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/codec_internal.h')
-rw-r--r--libavcodec/codec_internal.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/libavcodec/codec_internal.h b/libavcodec/codec_internal.h
index 310e243d84..2d9b4f6460 100644
--- a/libavcodec/codec_internal.h
+++ b/libavcodec/codec_internal.h
@@ -264,6 +264,18 @@ typedef struct FFCodec {
#define CODEC_LONG_NAME(str) .p.long_name = str
#endif
+#if HAVE_THREADS
+#define UPDATE_THREAD_CONTEXT(func) \
+ .update_thread_context = (func)
+#define UPDATE_THREAD_CONTEXT_FOR_USER(func) \
+ .update_thread_context_for_user = (func)
+#else
+#define UPDATE_THREAD_CONTEXT(func) \
+ .update_thread_context = NULL
+#define UPDATE_THREAD_CONTEXT_FOR_USER(func) \
+ .update_thread_context_for_user = NULL
+#endif
+
#define FF_CODEC_DECODE_CB(func) \
.cb_type = FF_CODEC_CB_TYPE_DECODE, \
.cb.decode = (func)