[FFmpeg-cvslog] added start_number parameter to drawtext to permit an offset to n/ frame_num var

Mark Visser git at videolan.org
Wed Jun 19 01:37:58 CEST 2013


ffmpeg | branch: master | Mark Visser <mjmvisser at gmail.com> | Tue May 21 16:14:46 2013 -0400| [0defc77e9deb081c11c4b5cc44891c712e07b92b] | committer: Mark Visser

added start_number parameter to drawtext to permit an offset to n/frame_num var

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

 doc/filters.texi          |    4 ++++
 libavfilter/vf_drawtext.c |    4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 6e616b2..694e5a1 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -3068,6 +3068,10 @@ The x and y offsets for the text shadow position with respect to the
 position of the text. They can be either positive or negative
 values. Default value for both is "0".
 
+ at item start_number
+The starting frame number for the n/frame_num variable. The default value
+is "0".
+
 @item tabsize
 The size in number of spaces to use for rendering the tab.
 Default value is 4.
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index 157bfc7..fcdf53a 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -164,6 +164,7 @@ typedef struct {
     AVTimecode  tc;                 ///< timecode context
     int tc24hmax;                   ///< 1 if timecode is wrapped to 24 hours, 0 otherwise
     int reload;                     ///< reload text file for each frame
+    int start_number;               ///< starting frame number for n/frame_num var
 } DrawTextContext;
 
 #define OFFSET(x) offsetof(DrawTextContext, x)
@@ -198,6 +199,7 @@ static const AVOption drawtext_options[]= {
     {"rate",            "set rate (timecode only)",         OFFSET(tc_rate),       AV_OPT_TYPE_RATIONAL, {.dbl=0},           0,  INT_MAX, FLAGS},
     {"reload",     "reload text file for each frame",                       OFFSET(reload),     AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS},
     {"fix_bounds", "if true, check and fix text coords to avoid clipping",  OFFSET(fix_bounds), AV_OPT_TYPE_INT, {.i64=1}, 0, 1, FLAGS},
+    {"start_number", "start frame number for n/frame_num variable", OFFSET(start_number), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS},
 
     /* FT_LOAD_* flags */
     { "ft_load_flags", "set font loading flags for libfreetype", OFFSET(ft_load_flags), AV_OPT_TYPE_FLAGS, { .i64 = FT_LOAD_DEFAULT | FT_LOAD_RENDER}, 0, INT_MAX, FLAGS, "ft_load_flags" },
@@ -614,7 +616,7 @@ static int func_frame_num(AVFilterContext *ctx, AVBPrint *bp,
 {
     DrawTextContext *s = ctx->priv;
 
-    av_bprintf(bp, "%d", (int)s->var_values[VAR_N]);
+    av_bprintf(bp, "%d", (int)s->var_values[VAR_N]+s->start_number);
     return 0;
 }
 



More information about the ffmpeg-cvslog mailing list