1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

lavfi/avfilter: move AVFilterContext.command_queue to FFFilterContext

It is private to generic filtering code.
This commit is contained in:
Anton Khirnov 2024-10-03 20:44:38 +02:00
parent 71f176e3ce
commit 4472bddb18
4 changed files with 17 additions and 7 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -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)

View File

@ -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;