summaryrefslogtreecommitdiff
path: root/libavfilter
diff options
context:
space:
mode:
authorVishwanath Dixit <vdixit@akamai.com>2018-05-07 18:46:42 +0530
committerKarthick Jeyapal <kjeyapal@akamai.com>2018-06-04 10:57:45 +0530
commit37abfe8c2dd9d222534d5b6929fb7ffda9fa5b15 (patch)
tree1f7e9b754cda8413c9528f9504428fc6591d1386 /libavfilter
parent2bd24d4a37e9793295730d383471a4b3711b0f8c (diff)
avfilter/drawtext: present 'hms' formatted 'pts' in 24h format
HMS is formatted as HH:MM:SS.mmm, but, HH part is not limited to 24 hours. For example, the the drawn text may look like this: 243029:20:30.342. To present the timestamp in more readable and user friendly format, this patch provides an additional option to limit the hour part in the range 0-23. Note: Actually the above required format can be obtained with format options 'localtime' and 'gmtime', but, milliseconds part is not supported in those formats.
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/vf_drawtext.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index e8905a40d3..3affa736c7 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -916,6 +916,14 @@ static int func_pts(AVFilterContext *ctx, AVBPrint *bp,
sign = '-';
ms = -ms;
}
+ if (argc >= 3) {
+ if (!strcmp(argv[2], "24HH")) {
+ ms %= 24 * 60 * 60 * 1000;
+ } else {
+ av_log(ctx, AV_LOG_ERROR, "Invalid argument '%s'\n", argv[2]);
+ return AVERROR(EINVAL);
+ }
+ }
av_bprintf(bp, "%c%02d:%02d:%02d.%03d", sign,
(int)(ms / (60 * 60 * 1000)),
(int)(ms / (60 * 1000)) % 60,