mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-14 11:00:08 +01:00
avfilter/vf_drawtext: add optional default value to metadata function
Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
This commit is contained in:
committed by
Paul B Mahol
parent
3674a53d17
commit
ee104580c5
@@ -6682,7 +6682,12 @@ The time at which the filter is running, expressed in the local time zone.
|
|||||||
It can accept an argument: a strftime() format string.
|
It can accept an argument: a strftime() format string.
|
||||||
|
|
||||||
@item metadata
|
@item metadata
|
||||||
Frame metadata. It must take one argument specifying metadata key.
|
Frame metadata. Takes one or two arguments.
|
||||||
|
|
||||||
|
The first argument is mandatory and specifies the metadata key.
|
||||||
|
|
||||||
|
The second argument is optional and specifies a default value, used when the
|
||||||
|
metadata key is not found or empty.
|
||||||
|
|
||||||
@item n, frame_num
|
@item n, frame_num
|
||||||
The frame number, starting from 0.
|
The frame number, starting from 0.
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#define LIBAVFILTER_VERSION_MAJOR 6
|
#define LIBAVFILTER_VERSION_MAJOR 6
|
||||||
#define LIBAVFILTER_VERSION_MINOR 41
|
#define LIBAVFILTER_VERSION_MINOR 41
|
||||||
#define LIBAVFILTER_VERSION_MICRO 100
|
#define LIBAVFILTER_VERSION_MICRO 101
|
||||||
|
|
||||||
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
|
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
|
||||||
LIBAVFILTER_VERSION_MINOR, \
|
LIBAVFILTER_VERSION_MINOR, \
|
||||||
|
|||||||
@@ -860,6 +860,8 @@ static int func_metadata(AVFilterContext *ctx, AVBPrint *bp,
|
|||||||
|
|
||||||
if (e && e->value)
|
if (e && e->value)
|
||||||
av_bprintf(bp, "%s", e->value);
|
av_bprintf(bp, "%s", e->value);
|
||||||
|
else if (argc >= 2)
|
||||||
|
av_bprintf(bp, "%s", argv[1]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -975,7 +977,7 @@ static const struct drawtext_function {
|
|||||||
{ "localtime", 0, 1, 'L', func_strftime },
|
{ "localtime", 0, 1, 'L', func_strftime },
|
||||||
{ "frame_num", 0, 0, 0, func_frame_num },
|
{ "frame_num", 0, 0, 0, func_frame_num },
|
||||||
{ "n", 0, 0, 0, func_frame_num },
|
{ "n", 0, 0, 0, func_frame_num },
|
||||||
{ "metadata", 1, 1, 0, func_metadata },
|
{ "metadata", 1, 2, 0, func_metadata },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int eval_function(AVFilterContext *ctx, AVBPrint *bp, char *fct,
|
static int eval_function(AVFilterContext *ctx, AVBPrint *bp, char *fct,
|
||||||
|
|||||||
Reference in New Issue
Block a user