Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
2ac6a3d1
Commit
2ac6a3d1
authored
Nov 27, 2012
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/drawtext: add support to expansion of generic expressions
parent
2cfa6fd0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
1 deletion
+33
-1
filters.texi
doc/filters.texi
+10
-0
version.h
libavfilter/version.h
+1
-1
vf_drawtext.c
libavfilter/vf_drawtext.c
+22
-0
No files found.
doc/filters.texi
View file @
2ac6a3d1
...
...
@@ -2075,6 +2075,16 @@ The following functions are available:
@table @command
@item expr, e
The expression evaluation result.
It must take one argument specifying the expression to be evaluated,
which accepts the same constants and functions as the @var{x} and
@var{y} values. Note that not all constants should be used, for
example the text size is not known when evaluating the expression, so
the constants @var{text_w} and @var{text_h} will have an undefined
value.
@item gmtime
The time at which the filter is running, expressed in UTC.
It can accept an argument: a strftime() format string.
...
...
libavfilter/version.h
View file @
2ac6a3d1
...
...
@@ -30,7 +30,7 @@
#define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MINOR 23
#define LIBAVFILTER_VERSION_MICRO 10
3
#define LIBAVFILTER_VERSION_MICRO 10
4
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
...
...
libavfilter/vf_drawtext.c
View file @
2ac6a3d1
...
...
@@ -643,12 +643,34 @@ static int func_strftime(AVFilterContext *ctx, AVBPrint *bp,
return
0
;
}
static
int
func_eval_expr
(
AVFilterContext
*
ctx
,
AVBPrint
*
bp
,
char
*
fct
,
unsigned
argc
,
char
**
argv
,
int
tag
)
{
DrawTextContext
*
dtext
=
ctx
->
priv
;
double
res
;
int
ret
;
ret
=
av_expr_parse_and_eval
(
&
res
,
argv
[
0
],
var_names
,
dtext
->
var_values
,
NULL
,
NULL
,
fun2_names
,
fun2
,
&
dtext
->
prng
,
0
,
ctx
);
if
(
ret
<
0
)
av_log
(
ctx
,
AV_LOG_ERROR
,
"Expression '%s' for the expr text expansion function is not valid
\n
"
,
argv
[
0
]);
else
av_bprintf
(
bp
,
"%f"
,
res
);
return
ret
;
}
static
const
struct
drawtext_function
{
const
char
*
name
;
unsigned
argc_min
,
argc_max
;
int
tag
;
/** opaque argument to func */
int
(
*
func
)(
AVFilterContext
*
,
AVBPrint
*
,
char
*
,
unsigned
,
char
**
,
int
);
}
functions
[]
=
{
{
"expr"
,
1
,
1
,
0
,
func_eval_expr
},
{
"e"
,
1
,
1
,
0
,
func_eval_expr
},
{
"pts"
,
0
,
0
,
0
,
func_pts
},
{
"gmtime"
,
0
,
1
,
'G'
,
func_strftime
},
{
"localtime"
,
0
,
1
,
'L'
,
func_strftime
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment