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
8f222573
Commit
8f222573
authored
Mar 13, 2020
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/f_sendcmd: add more useful variables
parent
86e599d9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
filters.texi
doc/filters.texi
+9
-0
f_sendcmd.c
libavfilter/f_sendcmd.c
+13
-1
No files found.
doc/filters.texi
View file @
8f222573
...
...
@@ -23711,6 +23711,15 @@ The count of the input frame for video or audio, starting from 0.
@
item
T
The
time
in
seconds
of
the
current
frame
.
@
item
TS
The
start
time
in
seconds
of
the
current
command
interval
.
@
item
TE
The
end
time
in
seconds
of
the
current
command
interval
.
@
item
TI
The
interpolated
time
of
the
current
command
interval
,
TI
=
(
T
-
TS
)
/
(
TE
-
TS
).
@
end
table
@
end
table
...
...
libavfilter/f_sendcmd.c
View file @
8f222573
...
...
@@ -43,6 +43,9 @@ static const char *const var_names[] = {
"T"
,
/* frame time in seconds */
"POS"
,
/* original position in the file of the frame */
"PTS"
,
/* frame pts */
"TS"
,
/* interval start time in seconds */
"TE"
,
/* interval end time in seconds */
"TI"
,
/* interval interpolated value: TI = (T - TS) / (TE - TS) */
NULL
};
...
...
@@ -51,6 +54,9 @@ enum var_name {
VAR_T
,
VAR_POS
,
VAR_PTS
,
VAR_TS
,
VAR_TE
,
VAR_TI
,
VAR_VARS_NB
};
...
...
@@ -517,11 +523,17 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *ref)
if
(
cmd
->
flags
&
flags
)
{
if
(
cmd
->
flags
&
COMMAND_FLAG_EXPR
)
{
double
var_values
[
VAR_VARS_NB
],
res
;
double
start
=
TS2T
(
interval
->
start_ts
,
AV_TIME_BASE_Q
);
double
end
=
TS2T
(
interval
->
end_ts
,
AV_TIME_BASE_Q
);
double
current
=
TS2T
(
ref
->
pts
,
inlink
->
time_base
);
var_values
[
VAR_N
]
=
inlink
->
frame_count_in
;
var_values
[
VAR_POS
]
=
ref
->
pkt_pos
==
-
1
?
NAN
:
ref
->
pkt_pos
;
var_values
[
VAR_PTS
]
=
TS2D
(
ref
->
pts
);
var_values
[
VAR_T
]
=
TS2T
(
ref
->
pts
,
inlink
->
time_base
);
var_values
[
VAR_T
]
=
current
;
var_values
[
VAR_TS
]
=
start
;
var_values
[
VAR_TE
]
=
end
;
var_values
[
VAR_TI
]
=
(
current
-
start
)
/
(
end
-
start
);
if
((
ret
=
av_expr_parse_and_eval
(
&
res
,
cmd
->
arg
,
var_names
,
var_values
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
0
,
NULL
))
<
0
)
{
...
...
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