[FFmpeg-cvslog] vf_overlay: handles expression evaluation of frame size change in frame-by-frame evalutaion mode

Bela Bodecs git at videolan.org
Tue Jan 19 23:32:26 CET 2016


ffmpeg | branch: master | Bela Bodecs <bodecsb at vivanet.hu> | Tue Jan 19 20:22:06 2016 +0100| [cc83177db4e08bb11908a8a8387859e2e8fcb162] | committer: Michael Niedermayer

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 at vivanet.hu>
Reviewed-by: Paul B Mahol <onemda at gmail.com
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cc83177db4e08bb11908a8a8387859e2e8fcb162
---

 libavfilter/vf_overlay.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index 7457820..3eac7f0 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -599,6 +599,11 @@ static AVFrame *do_blend(AVFilterContext *ctx, AVFrame *mainpic,
             NAN : mainpic->pts * av_q2d(inlink->time_base);
         s->var_values[VAR_POS] = pos == -1 ? NAN : pos;
 
+        s->var_values[VAR_OVERLAY_W] = s->var_values[VAR_OW] = second->width;
+        s->var_values[VAR_OVERLAY_H] = s->var_values[VAR_OH] = second->height;
+        s->var_values[VAR_MAIN_W   ] = s->var_values[VAR_MW] = mainpic->width;
+        s->var_values[VAR_MAIN_H   ] = s->var_values[VAR_MH] = mainpic->height;
+
         eval_expr(ctx);
         av_log(ctx, AV_LOG_DEBUG, "n:%f t:%f pos:%f x:%f xi:%d y:%f yi:%d\n",
                s->var_values[VAR_N], s->var_values[VAR_T], s->var_values[VAR_POS],



More information about the ffmpeg-cvslog mailing list