From ea36c44e84496a35562dab6cb03d2ca9a938224f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 29 Aug 2011 20:51:31 +0200 Subject: [PATCH] avfilter_graph_queue_command: Allow queueing commands out of order Signed-off-by: Michael Niedermayer --- libavfilter/avfiltergraph.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index 430f0d1699..075e15672c 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -294,13 +294,16 @@ int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const for (i = 0; i < graph->filter_count; i++) { AVFilterContext *filter = graph->filters[i]; if(filter && (!strcmp(target, "all") || !strcmp(target, filter->name) || !strcmp(target, filter->filter->name))){ - AVFilterCommand **que = &filter->command_queue; - while(*que) que = &(*que)->next; + AVFilterCommand **que = &filter->command_queue, *next; + while(*que && (*que)->time <= ts) + que = &(*que)->next; + next= *que; *que= av_mallocz(sizeof(AVFilterCommand)); (*que)->command = av_strdup(command); (*que)->arg = av_strdup(arg); (*que)->time = ts; (*que)->flags = flags; + (*que)->next = next; if(flags & AVFILTER_CMD_FLAG_ONE) return 0; }