aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2012-04-23 16:55:11 +0200
committerNicolas George <nicolas.george@normalesup.org>2012-04-24 16:35:15 +0200
commitfd2cd64fc9c29b5bcce2a0a332fa8d65134343ab (patch)
tree8dc7f89e6113085ab3d9e1b084b940bce6385330
parent62b745a6d3411c584bbac08374d7547060440809 (diff)
downloadffmpeg-fd2cd64fc9c29b5bcce2a0a332fa8d65134343ab.tar.gz
avfiltergraph: fix format selection.
The old code had two bugs: For audio filters, the format was not set. For video filters, if several links reference the same format list, the same format must be selected in the end. This is done by setting formats->format_count to 1: the other links sharing the reference will therefore have only one choice. If the heuristic does not pick the first format, the selected format must also be moved to the first position.
-rw-r--r--libavfilter/avfiltergraph.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 23d40425f0..9d7b956fa0 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -269,12 +269,12 @@ static void pick_format(AVFilterLink *link, AVFilterLink *ref)
enum PixelFormat p = link->in_formats->formats[i];
best= avcodec_find_best_pix_fmt2(best, p, ref->format, has_alpha, NULL);
}
- link->format = best;
- }else
- link->format = link->in_formats->formats[0];
+ link->in_formats->formats[0] = best;
+ }
}
link->in_formats->format_count = 1;
+ link->format = link->in_formats->formats[0];
avfilter_formats_unref(&link->in_formats);
avfilter_formats_unref(&link->out_formats);