Commit 602d0bfe authored by Michael Niedermayer's avatar Michael Niedermayer

Merge branch 'frame_num_offset' of https://github.com/mjmvisser/FFmpeg

Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents f8ca8138 2090abcc
...@@ -3068,6 +3068,10 @@ The x and y offsets for the text shadow position with respect to the ...@@ -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 position of the text. They can be either positive or negative
values. Default value for both is "0". values. Default value for both is "0".
@item start_number
The starting frame number for the n/frame_num variable. The default value
is "0".
@item tabsize @item tabsize
The size in number of spaces to use for rendering the tab. The size in number of spaces to use for rendering the tab.
Default value is 4. Default value is 4.
......
...@@ -164,6 +164,7 @@ typedef struct { ...@@ -164,6 +164,7 @@ typedef struct {
AVTimecode tc; ///< timecode context AVTimecode tc; ///< timecode context
int tc24hmax; ///< 1 if timecode is wrapped to 24 hours, 0 otherwise int tc24hmax; ///< 1 if timecode is wrapped to 24 hours, 0 otherwise
int reload; ///< reload text file for each frame int reload; ///< reload text file for each frame
int start_number; ///< starting frame number for n/frame_num var
} DrawTextContext; } DrawTextContext;
#define OFFSET(x) offsetof(DrawTextContext, x) #define OFFSET(x) offsetof(DrawTextContext, x)
...@@ -198,6 +199,7 @@ static const AVOption drawtext_options[]= { ...@@ -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}, {"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}, {"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}, {"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 */
{ "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" }, { "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" },
...@@ -978,7 +980,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) ...@@ -978,7 +980,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
if ((ret = load_textfile(ctx)) < 0) if ((ret = load_textfile(ctx)) < 0)
return ret; return ret;
s->var_values[VAR_N] = inlink->frame_count; s->var_values[VAR_N] = inlink->frame_count+s->start_number;
s->var_values[VAR_T] = frame->pts == AV_NOPTS_VALUE ? s->var_values[VAR_T] = frame->pts == AV_NOPTS_VALUE ?
NAN : frame->pts * av_q2d(inlink->time_base); NAN : frame->pts * av_q2d(inlink->time_base);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment