[FFmpeg-devel] [PATCH 3/3] drawtext: allow burning the timecode.

Clément Bœsch clement.boesch at smartjog.com
Tue Dec 6 11:47:44 CET 2011


On Tue, Dec 06, 2011 at 11:37:39AM +0100, Clément Bœsch wrote:
> From: Clément Bœsch <clement.boesch at smartjog.com>
> 
> ---
>  doc/filters.texi          |    7 +++++++
>  libavfilter/vf_drawtext.c |   23 ++++++++++++++++++++++-
>  2 files changed, 29 insertions(+), 1 deletions(-)
> 
[...]
> @@ -659,6 +673,8 @@ static int draw_text(AVFilterContext *ctx, AVFilterBufferRef *picref,
>      uint8_t *buf = dtext->expanded_text;
>      int buf_size = dtext->expanded_text_size;
>  
> +    char tcbuf[sizeof("hh:mm:ss.ff")];
> +

(This is locally moved to the scope opened bellow...)

>      if(dtext->basetime != AV_NOPTS_VALUE)
>          now= picref->pts*av_q2d(ctx->inputs[0]->time_base) + dtext->basetime/1000000;
>  
> @@ -681,6 +697,11 @@ static int draw_text(AVFilterContext *ctx, AVFilterBufferRef *picref,
>          buf_size *= 2;
>      } while ((buf = av_realloc(buf, buf_size)));
>  
> +    if (dtext->tc.str) {
> +        ff_timecode_to_string(tcbuf, &dtext->tc, dtext->frame_id++);
> +        buf = av_asprintf("%s%s", dtext->text, tcbuf);
> +    }
> +
>      if (!buf)
>          return AVERROR(ENOMEM);
>      text = dtext->expanded_text = buf;

-- 
Clément B.


More information about the ffmpeg-devel mailing list