Browse code

avfilter_graph_queue_command: Allow queueing commands out of order

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2011/08/30 03:51:31
Showing 1 changed files
... ...
@@ -294,13 +294,16 @@ int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const
294 294
     for (i = 0; i < graph->filter_count; i++) {
295 295
         AVFilterContext *filter = graph->filters[i];
296 296
         if(filter && (!strcmp(target, "all") || !strcmp(target, filter->name) || !strcmp(target, filter->filter->name))){
297
-            AVFilterCommand **que = &filter->command_queue;
298
-            while(*que) que = &(*que)->next;
297
+            AVFilterCommand **que = &filter->command_queue, *next;
298
+            while(*que && (*que)->time <= ts)
299
+                que = &(*que)->next;
300
+            next= *que;
299 301
             *que= av_mallocz(sizeof(AVFilterCommand));
300 302
             (*que)->command = av_strdup(command);
301 303
             (*que)->arg     = av_strdup(arg);
302 304
             (*que)->time    = ts;
303 305
             (*que)->flags   = flags;
306
+            (*que)->next    = next;
304 307
             if(flags & AVFILTER_CMD_FLAG_ONE)
305 308
                 return 0;
306 309
         }