[FFmpeg-cvslog] lavfi/avfilter: move AVFilterContext.command_queue to FFFilterContext

Anton Khirnov git at videolan.org
Mon Oct 7 11:58:05 EEST 2024


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Oct  3 20:44:38 2024 +0200| [4472bddb18f332ad95e789277b4071881ad41019] | committer: Anton Khirnov

lavfi/avfilter: move AVFilterContext.command_queue to FFFilterContext

It is private to generic filtering code.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4472bddb18f332ad95e789277b4071881ad41019
---

 libavfilter/avfilter.c          | 13 +++++++------
 libavfilter/avfilter.h          |  6 ++++++
 libavfilter/avfilter_internal.h |  2 ++
 libavfilter/avfiltergraph.c     |  3 ++-
 4 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index dfb30002b1..86bf7773e1 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -80,10 +80,11 @@ static void tlog_ref(void *ctx, AVFrame *ref, int end)
 
 static void command_queue_pop(AVFilterContext *filter)
 {
-    AVFilterCommand *c= filter->command_queue;
+    FFFilterContext *ctxi = fffilterctx(filter);
+    AVFilterCommand *c    = ctxi->command_queue;
     av_freep(&c->arg);
     av_freep(&c->command);
-    filter->command_queue= c->next;
+    ctxi->command_queue = c->next;
     av_free(c);
 }
 
@@ -828,9 +829,8 @@ void avfilter_free(AVFilterContext *filter)
     av_freep(&filter->inputs);
     av_freep(&filter->outputs);
     av_freep(&filter->priv);
-    while(filter->command_queue){
+    while (ctxi->command_queue)
         command_queue_pop(filter);
-    }
     av_opt_free(filter);
     av_expr_free(ctxi->enable);
     ctxi->enable = NULL;
@@ -1545,7 +1545,8 @@ int ff_inlink_make_frame_writable(AVFilterLink *link, AVFrame **rframe)
 
 int ff_inlink_process_commands(AVFilterLink *link, const AVFrame *frame)
 {
-    AVFilterCommand *cmd = link->dst->command_queue;
+    FFFilterContext *ctxi = fffilterctx(link->dst);
+    AVFilterCommand *cmd  = ctxi->command_queue;
 
     while(cmd && cmd->time <= frame->pts * av_q2d(link->time_base)){
         av_log(link->dst, AV_LOG_DEBUG,
@@ -1553,7 +1554,7 @@ int ff_inlink_process_commands(AVFilterLink *link, const AVFrame *frame)
                cmd->time, cmd->command, cmd->arg);
         avfilter_process_command(link->dst, cmd->command, cmd->arg, 0, 0, cmd->flags);
         command_queue_pop(link->dst);
-        cmd= link->dst->command_queue;
+        cmd = ctxi->command_queue;
     }
     return 0;
 }
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index e3de3ec9ba..c99fc8f912 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -498,7 +498,13 @@ struct AVFilterContext {
      */
     int nb_threads;
 
+#if FF_API_CONTEXT_PUBLIC
+    /**
+     * @deprecated unused
+     */
+    attribute_deprecated
     struct AVFilterCommand *command_queue;
+#endif
 
     char *enable_str;               ///< enable expression string
 #if FF_API_CONTEXT_PUBLIC
diff --git a/libavfilter/avfilter_internal.h b/libavfilter/avfilter_internal.h
index 38c7c5b53e..c2a2378d61 100644
--- a/libavfilter/avfilter_internal.h
+++ b/libavfilter/avfilter_internal.h
@@ -114,6 +114,8 @@ typedef struct FFFilterContext {
     struct AVExpr *enable;
     ///< variable values for the enable expression
     double *var_values;
+
+    struct AVFilterCommand *command_queue;
 } FFFilterContext;
 
 static inline FFFilterContext *fffilterctx(AVFilterContext *ctx)
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 7bc7700743..c6472876bf 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -1348,8 +1348,9 @@ int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const
 
     for (i = 0; i < graph->nb_filters; i++) {
         AVFilterContext *filter = graph->filters[i];
+        FFFilterContext *ctxi   = fffilterctx(filter);
         if(filter && (!strcmp(target, "all") || !strcmp(target, filter->name) || !strcmp(target, filter->filter->name))){
-            AVFilterCommand **queue = &filter->command_queue, *next;
+            AVFilterCommand **queue = &ctxi->command_queue, *next;
             while (*queue && (*queue)->time <= ts)
                 queue = &(*queue)->next;
             next = *queue;



More information about the ffmpeg-cvslog mailing list