aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-05-15 16:01:54 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-05-20 16:39:03 +0200
commit9225513242b48b7423cec1956b4216720173f0bc (patch)
tree01c8915420af40ff247134ac85c3fce145b33605
parent4b5ff9b63ef36ef2008cf18ee352eabe34501d8e (diff)
downloadffmpeg-9225513242b48b7423cec1956b4216720173f0bc.tar.gz
vf_scale: support dynamically changing input parameters.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavfilter/vf_scale.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index 810a6d3ef1..3106ccfa72 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -275,6 +275,23 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
AVFilterLink *outlink = link->dst->outputs[0];
AVFilterBufferRef *outpicref;
+ if( picref->video->w != link->w
+ || picref->video->h != link->h
+ || picref->format != link->format) {
+ AVFilterLink *out_link;
+ int ret;
+ snprintf(scale->w_expr, sizeof(scale->w_expr)-1, "%d", outlink->w);
+ snprintf(scale->h_expr, sizeof(scale->h_expr)-1, "%d", outlink->h);
+
+ link->dst->inputs[0]->format = picref->format;
+ link->dst->inputs[0]->w = picref->video->w;
+ link->dst->inputs[0]->h = picref->video->h;
+
+ if ((ret = config_props(outlink)) < 0)
+ av_assert0(0); //what to do here ?
+ }
+
+
if (!scale->sws) {
avfilter_start_frame(outlink, avfilter_ref_buffer(picref, ~0));
return;