Browse code

vf_overlay: handles expression evaluation of frame size change in frame-by-frame evalutaion mode

vf_overlay video filter accepts expressions in its parameters. In
'frame-by-frame' evaluation mode it recalculates them regularly, but
incoming video frame size changes did not reflect in their values. So if
you used width or height of any source videos in expressions as
parameters, they stayed on their initial values. This patch corrects
this bug.

Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu>
Reviewed-by: Paul B Mahol <onemda@gmail.com
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>

Bela Bodecs authored on 2016/01/20 04:22:06
Showing 1 changed files
... ...
@@ -599,6 +599,11 @@ static AVFrame *do_blend(AVFilterContext *ctx, AVFrame *mainpic,
599 599
             NAN : mainpic->pts * av_q2d(inlink->time_base);
600 600
         s->var_values[VAR_POS] = pos == -1 ? NAN : pos;
601 601
 
602
+        s->var_values[VAR_OVERLAY_W] = s->var_values[VAR_OW] = second->width;
603
+        s->var_values[VAR_OVERLAY_H] = s->var_values[VAR_OH] = second->height;
604
+        s->var_values[VAR_MAIN_W   ] = s->var_values[VAR_MW] = mainpic->width;
605
+        s->var_values[VAR_MAIN_H   ] = s->var_values[VAR_MH] = mainpic->height;
606
+
602 607
         eval_expr(ctx);
603 608
         av_log(ctx, AV_LOG_DEBUG, "n:%f t:%f pos:%f x:%f xi:%d y:%f yi:%d\n",
604 609
                s->var_values[VAR_N], s->var_values[VAR_T], s->var_values[VAR_POS],