diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2012-11-22 12:08:45 +0100 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2012-11-22 13:14:19 +0100 |
commit | eb87b340e8c8ad3902e9dc0857724c8f659a113f (patch) | |
tree | 99be87cac993a3952cea6a7b25dbe3b8b3f6eaf0 /libavfilter/vf_drawtext.c | |
parent | dcbf72836c90d077067248a0ddc4e4c7556e2461 (diff) | |
download | ffmpeg-eb87b340e8c8ad3902e9dc0857724c8f659a113f.tar.gz |
lavfi/drawtext: add support for printing frame numbers
Fix trac ticket #1949.
Diffstat (limited to 'libavfilter/vf_drawtext.c')
-rw-r--r-- | libavfilter/vf_drawtext.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c index a78a3ea9bf..96512ab390 100644 --- a/libavfilter/vf_drawtext.c +++ b/libavfilter/vf_drawtext.c @@ -611,6 +611,15 @@ static int func_pts(AVFilterContext *ctx, AVBPrint *bp, return 0; } +static int func_frame_num(AVFilterContext *ctx, AVBPrint *bp, + char *fct, unsigned argc, char **argv, int tag) +{ + DrawTextContext *dtext = ctx->priv; + + av_bprintf(bp, "%d", (int)dtext->var_values[VAR_N]); + return 0; +} + #if !HAVE_LOCALTIME_R static void localtime_r(const time_t *t, struct tm *tm) { @@ -643,6 +652,8 @@ static const struct drawtext_function { { "pts", 0, 0, 0, func_pts }, { "gmtime", 0, 1, 'G', func_strftime }, { "localtime", 0, 1, 'L', func_strftime }, + { "frame_num", 0, 0, 0, func_frame_num }, + { "n", 0, 0, 0, func_frame_num }, }; static int eval_function(AVFilterContext *ctx, AVBPrint *bp, char *fct, |