Pushed. >On 5/7/18, 6:47 PM, "vdi...@akamai.com" <vdi...@akamai.com> wrote: > >From: Vishwanath Dixit <vdi...@akamai.com> > >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. >--- > doc/filters.texi | 4 ++++ > libavfilter/vf_drawtext.c | 8 ++++++++ > 2 files changed, 12 insertions(+) > >diff --git a/doc/filters.texi b/doc/filters.texi >index 33e27e1..6e306f1 100644 >--- a/doc/filters.texi >+++ b/doc/filters.texi >@@ -8134,6 +8134,10 @@ local time zone time. > > The second argument is an offset added to the timestamp. > >+If the format is set to @code{hms}, a third argument @code{24HH} may be >+supplied to present the hour part of the formatted timestamp in 24h format >+(00-23). >+ > If the format is set to @code{localtime} or @code{gmtime}, > a third argument may be supplied: a strftime() format string. > By default, @var{YYYY-MM-DD HH:MM:SS} format will be used. >diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c >index e8905a4..3affa73 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, >-- >1.9.1 >
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel