avfilter_graph_queue_command: Allow queueing commands out of order

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2011-08-29 20:51:31 +02:00
parent 37f9de59d1
commit ea36c44e84
1 changed files with 5 additions and 2 deletions

View File

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