[FFmpeg-devel] [PATCH] avfilter: add w/h parameters in timeline

Clément Bœsch u at pkh.me
Fri Oct 10 23:33:41 CEST 2014


On Mon, Oct 06, 2014 at 05:02:30PM +0200, Stefano Sabatini wrote:
> On date Monday 2014-10-06 13:11:03 +0200, Clément Bœsch encoded:
> > Fixes Ticket #4008.
> > ---
> >  libavfilter/avfilter.c | 21 +++++++++++++++++++--
> >  1 file changed, 19 insertions(+), 2 deletions(-)
> 
> Missing docs updates, and micro bump.
> > 
> > diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
> > index 7b11467..3805912 100644
> > --- a/libavfilter/avfilter.c
> > +++ b/libavfilter/avfilter.c
> > @@ -381,8 +381,23 @@ int ff_poll_frame(AVFilterLink *link)
> >      return min;
> >  }
> >  
> > -static const char *const var_names[] = {   "t",   "n",   "pos",        NULL };
> > -enum                                   { VAR_T, VAR_N, VAR_POS, VAR_VARS_NB };
> > +static const char *const var_names[] = {
> > +    "t",
> > +    "n",
> > +    "pos",
> > +    "w",
> > +    "h",
> > +    NULL
> > +};
> > +
> > +enum {
> > +    VAR_T,
> > +    VAR_N,
> > +    VAR_POS,
> > +    VAR_W,
> > +    VAR_H,
> > +    VAR_VARS_NB
> > +};
> >  
> >  static int set_enable_expr(AVFilterContext *ctx, const char *expr)
> >  {
> > @@ -1071,6 +1086,8 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame)
> >          int64_t pos = av_frame_get_pkt_pos(out);
> >          dstctx->var_values[VAR_N] = link->frame_count;
> >          dstctx->var_values[VAR_T] = pts == AV_NOPTS_VALUE ? NAN : pts * av_q2d(link->time_base);
> > +        dstctx->var_values[VAR_W] = link->w;
> > +        dstctx->var_values[VAR_H] = link->h;
> >          dstctx->var_values[VAR_POS] = pos == -1 ? NAN : pos;
> >  
> >          dstctx->is_disabled = fabs(av_expr_eval(dstctx->enable, dstctx->var_values, NULL)) < 0.5;
> > -- 
> 
> LGTM otherwise, thanks.

Applied (a while ago).

Ideally we should probably add the ability to the drawtext filter to not
draw anything when the text is outbound, if anyone is willing to work on
this...

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141010/109ba89d/attachment.asc>


More information about the ffmpeg-devel mailing list