@@ -10953,6 +10953,9 @@ It can accept an argument: a strftime() format string.
The time at which the filter is running, expressed in the local time zone.
It can accept an argument: a strftime() format string.
+@item rtctime
+The time at which the filter is running, can use the same format as @samp{pts}.
+
@item metadata
Frame metadata. Takes one or two arguments.
@@ -31,7 +31,7 @@
#define LIBAVFILTER_VERSION_MAJOR 8
#define LIBAVFILTER_VERSION_MINOR 0
-#define LIBAVFILTER_VERSION_MICRO 101
+#define LIBAVFILTER_VERSION_MICRO 102
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
@@ -51,6 +51,7 @@
#include "libavutil/opt.h"
#include "libavutil/random_seed.h"
#include "libavutil/parseutils.h"
+#include "libavutil/time.h"
#include "libavutil/timecode.h"
#include "libavutil/time_internal.h"
#include "libavutil/tree.h"
@@ -959,12 +960,11 @@ static int func_pict_type(AVFilterContext *ctx, AVBPrint *bp,
return 0;
}
-static int func_pts(AVFilterContext *ctx, AVBPrint *bp,
- char *fct, unsigned argc, char **argv, int tag)
+static int func_time_common(AVFilterContext *ctx, AVBPrint *bp,
+ char *fct, unsigned argc, char **argv, int tag,
+ double pts)
{
- DrawTextContext *s = ctx->priv;
const char *fmt;
- double pts = s->var_values[VAR_T];
int ret;
fmt = argc >= 1 ? argv[0] : "flt";
@@ -1019,6 +1019,21 @@ static int func_pts(AVFilterContext *ctx, AVBPrint *bp,
return 0;
}
+static int func_pts(AVFilterContext *ctx, AVBPrint *bp,
+ char *fct, unsigned argc, char **argv, int tag)
+{
+ DrawTextContext *s = ctx->priv;
+ double pts = s->var_values[VAR_T];
+ return func_time_common(ctx, bp, fct, argc, argv, tag, pts);
+}
+
+static int func_rtctime(AVFilterContext *ctx, AVBPrint *bp,
+ char *fct, unsigned argc, char **argv, int tag)
+{
+ double pts = av_gettime() / 1000000.0;
+ return func_time_common(ctx, bp, fct, argc, argv, tag, pts);
+}
+
static int func_frame_num(AVFilterContext *ctx, AVBPrint *bp,
char *fct, unsigned argc, char **argv, int tag)
{
@@ -1153,6 +1168,7 @@ static const struct drawtext_function {
{ "pts", 0, 3, 0, func_pts },
{ "gmtime", 0, 1, 'G', func_strftime },
{ "localtime", 0, 1, 'L', func_strftime },
+ { "rtctime", 0, 3, 0, func_rtctime },
{ "frame_num", 0, 0, 0, func_frame_num },
{ "n", 0, 0, 0, func_frame_num },
{ "metadata", 1, 2, 0, func_metadata },