summaryrefslogtreecommitdiff
path: root/libavfilter
diff options
context:
space:
mode:
authorClément Bœsch <clement.boesch@smartjog.com>2012-03-12 09:16:04 +0100
committerClément Bœsch <ubitux@gmail.com>2012-03-12 18:17:02 +0100
commit4fe544879006daea3db9a9d3e0d849187f86376b (patch)
tree7ecd3c43e8aad877f6b059b0c58edc6d5d6fe92b /libavfilter
parent88c76c7d2291c98449d0e6b920f676a72bdd18c1 (diff)
lavfi/drawtext: add 24 hours wrapping option for timecode.
Fixes ticket #1044.
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/vf_drawtext.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index 32371c03fd..89b0be1190 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -161,6 +161,7 @@ typedef struct {
char *tc_opt_string; ///< specified timecode option string
AVRational tc_rate; ///< frame rate for timecode
AVTimecode tc; ///< timecode context
+ int tc24hmax; ///< 1 if timecode is wrapped to 24 hours, 0 otherwise
int frame_id;
} DrawTextContext;
@@ -183,6 +184,7 @@ static const AVOption drawtext_options[]= {
{"basetime", "set base time", OFFSET(basetime), AV_OPT_TYPE_INT64, {.dbl=AV_NOPTS_VALUE}, INT64_MIN, INT64_MAX },
{"draw", "if false do not draw", OFFSET(d_expr), AV_OPT_TYPE_STRING, {.str="1"}, CHAR_MIN, CHAR_MAX },
{"timecode", "set initial timecode", OFFSET(tc_opt_string), AV_OPT_TYPE_STRING, {.str=NULL}, CHAR_MIN, CHAR_MAX },
+{"tc24hmax", "set 24 hours max (timecode only)", OFFSET(tc24hmax), AV_OPT_TYPE_INT, {.dbl=0}, 0, 1 },
{"r", "set rate (timecode only)", OFFSET(tc_rate), AV_OPT_TYPE_RATIONAL, {.dbl=0}, 0, INT_MAX },
{"rate", "set rate (timecode only)", OFFSET(tc_rate), AV_OPT_TYPE_RATIONAL, {.dbl=0}, 0, INT_MAX },
{"fix_bounds", "if true, check and fix text coords to avoid clipping",
@@ -351,6 +353,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
dtext->tc_opt_string, ctx);
if (ret < 0)
return ret;
+ if (dtext->tc24hmax)
+ dtext->tc.flags |= AV_TIMECODE_FLAG_24HOURSMAX;
if (!dtext->text)
dtext->text = av_strdup("");
}