[FFmpeg-devel] [PATCH 8/8] lavfi: make FFFilterContext private to generic code

Anton Khirnov anton at khirnov.net
Sat Aug 17 11:13:58 EEST 2024


Nothing in it needs to be visible to filters.
---
 libavfilter/avfilter.c          |  6 ++++++
 libavfilter/avfilter_internal.h | 18 ++++++++++++++++++
 libavfilter/filters.h           | 25 ++-----------------------
 3 files changed, 26 insertions(+), 23 deletions(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index c89a7ab508..8a2a9e0593 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -1647,3 +1647,9 @@ int ff_outlink_frame_wanted(AVFilterLink *link)
     FilterLinkInternal * const li = ff_link_internal(link);
     return li->frame_wanted_out;
 }
+
+int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func,
+                      void *arg, int *ret, int nb_jobs)
+{
+    return fffilterctx(ctx)->execute(ctx, func, arg, ret, nb_jobs);
+}
diff --git a/libavfilter/avfilter_internal.h b/libavfilter/avfilter_internal.h
index 8386183745..ec3933b1d1 100644
--- a/libavfilter/avfilter_internal.h
+++ b/libavfilter/avfilter_internal.h
@@ -92,6 +92,24 @@ static inline FilterLinkInternal *ff_link_internal(AVFilterLink *link)
     return (FilterLinkInternal*)link;
 }
 
+typedef struct FFFilterContext {
+    /**
+     * The public AVFilterContext. See avfilter.h for it.
+     */
+    AVFilterContext p;
+
+    avfilter_execute_func *execute;
+
+    // 1 when avfilter_init_*() was successfully called on this filter
+    // 0 otherwise
+    int initialized;
+} FFFilterContext;
+
+static inline FFFilterContext *fffilterctx(AVFilterContext *ctx)
+{
+    return (FFFilterContext*)ctx;
+}
+
 typedef struct AVFilterCommand {
     double time;                ///< time expressed in seconds
     char *command;              ///< command
diff --git a/libavfilter/filters.h b/libavfilter/filters.h
index 636753b26a..0053ad4303 100644
--- a/libavfilter/filters.h
+++ b/libavfilter/filters.h
@@ -199,24 +199,6 @@ static inline FilterLink* ff_filter_link(AVFilterLink *link)
     return (FilterLink*)link;
 }
 
-typedef struct FFFilterContext {
-    /**
-     * The public AVFilterContext. See avfilter.h for it.
-     */
-    AVFilterContext p;
-
-    avfilter_execute_func *execute;
-
-    // 1 when avfilter_init_*() was successfully called on this filter
-    // 0 otherwise
-    int initialized;
-} FFFilterContext;
-
-static inline FFFilterContext *fffilterctx(AVFilterContext *ctx)
-{
-    return (FFFilterContext*)ctx;
-}
-
 /**
  * The filter is aware of hardware frames, and any hardware frame context
  * should not be automatically propagated through it.
@@ -614,10 +596,7 @@ int ff_append_outpad_free_name(AVFilterContext *f, AVFilterPad *p);
  */
 int ff_fmt_is_in(int fmt, const int *fmts);
 
-static av_always_inline int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func,
-                                              void *arg, int *ret, int nb_jobs)
-{
-    return fffilterctx(ctx)->execute(ctx, func, arg, ret, nb_jobs);
-}
+int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func,
+                      void *arg, int *ret, int nb_jobs);
 
 #endif /* AVFILTER_FILTERS_H */
-- 
2.43.0



More information about the ffmpeg-devel mailing list