History

lavfi: support automatically inserting the fifo filter when needed.

This breaks libavfilter ABI.

Anton Khirnov committed 14 years ago

Commit 58b049f1 parent fa066236 files · +79 −64Browse files

Showing the changes to libavfilter/avfiltergraph.c (1 of 6 files). Show all

Unified · Split

libavfilter/avfiltergraph.c+40−0
@@ -591,12 +591,52 @@ static int graph_config_formats(AVFilterGraph *graph, AVClass *log_ctx) · 590 unmodified lines
591 return 0;591 return 0;
592}592}
593 593
594static int graph_insert_fifos(AVFilterGraph *graph, AVClass *log_ctx)
595{
596 AVFilterContext *f;
597 int i, j, ret;
598 int fifo_count = 0;
599
600 for (i = 0; i < graph->filter_count; i++) {
601 f = graph->filters[i];
602
603 for (j = 0; j < f->nb_inputs; j++) {
604 AVFilterLink *link = f->inputs[j];
605 AVFilterContext *fifo_ctx;
606 AVFilter *fifo;
607 char name[32];
608
609 if (!link->dstpad->needs_fifo)
610 continue;
611
612 fifo = f->inputs[j]->type == AVMEDIA_TYPE_VIDEO ?
613 avfilter_get_by_name("fifo") :
614 avfilter_get_by_name("afifo");
615
616 snprintf(name, sizeof(name), "auto-inserted fifo %d", fifo_count++);
617
618 ret = avfilter_graph_create_filter(&fifo_ctx, fifo, name, NULL,
619 NULL, graph);
620 if (ret < 0)
621 return ret;
622
623 ret = avfilter_insert_filter(link, fifo_ctx, 0, 0);
624 if (ret < 0)
625 return ret;
626 }
627 }
628
629 return 0;
630}
631
594int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx)632int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx)
595{633{
596 int ret;634 int ret;
597 635
598 if ((ret = graph_check_validity(graphctx, log_ctx)))636 if ((ret = graph_check_validity(graphctx, log_ctx)))
599 return ret;637 return ret;
638 if ((ret = graph_insert_fifos(graphctx, log_ctx)) < 0)
639 return ret;
600 if ((ret = graph_config_formats(graphctx, log_ctx)))640 if ((ret = graph_config_formats(graphctx, log_ctx)))
601 return ret;641 return ret;
602 if ((ret = graph_config_links(graphctx, log_ctx)))642 if ((ret = graph_config_links(graphctx, log_ctx)))

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t