Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
c5a1b18f
Commit
c5a1b18f
authored
Jul 08, 2013
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/drawtext: add support for printing frame metadata
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
87fb18c3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
1 deletion
+18
-1
filters.texi
doc/filters.texi
+3
-0
version.h
libavfilter/version.h
+1
-1
vf_drawtext.c
libavfilter/vf_drawtext.c
+14
-0
No files found.
doc/filters.texi
View file @
c5a1b18f
...
@@ -3328,6 +3328,9 @@ It can accept an argument: a strftime() format string.
...
@@ -3328,6 +3328,9 @@ It can accept an argument: a strftime() format string.
The time at which the filter is running, expressed in the local time zone.
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
Frame metadata. It must take one argument specifying metadata key.
@item n, frame_num
@item n, frame_num
The frame number, starting from 0.
The frame number, starting from 0.
...
...
libavfilter/version.h
View file @
c5a1b18f
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
#define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MINOR 79
#define LIBAVFILTER_VERSION_MINOR 79
#define LIBAVFILTER_VERSION_MICRO 10
0
#define LIBAVFILTER_VERSION_MICRO 10
1
#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, \
...
...
libavfilter/vf_drawtext.c
View file @
c5a1b18f
...
@@ -165,6 +165,7 @@ typedef struct {
...
@@ -165,6 +165,7 @@ typedef struct {
int
tc24hmax
;
///< 1 if timecode is wrapped to 24 hours, 0 otherwise
int
tc24hmax
;
///< 1 if timecode is wrapped to 24 hours, 0 otherwise
int
reload
;
///< reload text file for each frame
int
reload
;
///< reload text file for each frame
int
start_number
;
///< starting frame number for n/frame_num var
int
start_number
;
///< starting frame number for n/frame_num var
AVDictionary
*
metadata
;
}
DrawTextContext
;
}
DrawTextContext
;
#define OFFSET(x) offsetof(DrawTextContext, x)
#define OFFSET(x) offsetof(DrawTextContext, x)
...
@@ -620,6 +621,17 @@ static int func_frame_num(AVFilterContext *ctx, AVBPrint *bp,
...
@@ -620,6 +621,17 @@ static int func_frame_num(AVFilterContext *ctx, AVBPrint *bp,
return
0
;
return
0
;
}
}
static
int
func_metadata
(
AVFilterContext
*
ctx
,
AVBPrint
*
bp
,
char
*
fct
,
unsigned
argc
,
char
**
argv
,
int
tag
)
{
DrawTextContext
*
s
=
ctx
->
priv
;
AVDictionaryEntry
*
e
=
av_dict_get
(
s
->
metadata
,
argv
[
0
],
NULL
,
0
);
if
(
e
&&
e
->
value
)
av_bprintf
(
bp
,
"%s"
,
e
->
value
);
return
0
;
}
#if !HAVE_LOCALTIME_R
#if !HAVE_LOCALTIME_R
static
void
localtime_r
(
const
time_t
*
t
,
struct
tm
*
tm
)
static
void
localtime_r
(
const
time_t
*
t
,
struct
tm
*
tm
)
{
{
...
@@ -677,6 +689,7 @@ static const struct drawtext_function {
...
@@ -677,6 +689,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
},
};
};
static
int
eval_function
(
AVFilterContext
*
ctx
,
AVBPrint
*
bp
,
char
*
fct
,
static
int
eval_function
(
AVFilterContext
*
ctx
,
AVBPrint
*
bp
,
char
*
fct
,
...
@@ -985,6 +998,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
...
@@ -985,6 +998,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
NAN
:
frame
->
pts
*
av_q2d
(
inlink
->
time_base
);
NAN
:
frame
->
pts
*
av_q2d
(
inlink
->
time_base
);
s
->
var_values
[
VAR_PICT_TYPE
]
=
frame
->
pict_type
;
s
->
var_values
[
VAR_PICT_TYPE
]
=
frame
->
pict_type
;
s
->
metadata
=
av_frame_get_metadata
(
frame
);
draw_text
(
ctx
,
frame
,
frame
->
width
,
frame
->
height
);
draw_text
(
ctx
,
frame
,
frame
->
width
,
frame
->
height
);
...
...
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