[FFmpeg-devel] [PATCH 2/2] avfiltergraph: call query_formats on inputs first.

Nicolas George nicolas.george at normalesup.org
Sun Jun 3 22:01:27 CEST 2012


This is a temporary workaround for amerge,
until format renegociation is implemented.

Should fix trac ticket #1400.

Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
 libavfilter/avfiltergraph.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 92a8722..ecf5c1e 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -222,8 +222,14 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
     AVFilterFormats *samplerates;
     int scaler_count = 0, resampler_count = 0;
 
+    for (j = 0; j < 2; j++) {
     /* ask all the sub-filters for their supported media formats */
     for (i = 0; i < graph->filter_count; i++) {
+        /* Call query_formats on sources first.
+           This is a temporary workaround for amerge,
+           until format renegociation is implemented. */
+        if (!graph->filters[i]->input_count == j)
+            continue;
         if (graph->filters[i]->filter->query_formats)
             ret = graph->filters[i]->filter->query_formats(graph->filters[i]);
         else
@@ -231,6 +237,7 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
         if (ret < 0)
             return ret;
     }
+    }
 
     /* go through and merge as many format lists as possible */
     for (i = 0; i < graph->filter_count; i++) {
-- 
1.7.10



More information about the ffmpeg-devel mailing list