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
e7e4c8df
Commit
e7e4c8df
authored
Dec 20, 2016
by
Nicolas George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi: add ff_inlink_evaluate_timeline_at_frame().
parent
0e3d2496
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
13 deletions
+29
-13
avfilter.c
libavfilter/avfilter.c
+21
-13
filters.h
libavfilter/filters.h
+8
-0
No files found.
libavfilter/avfilter.c
View file @
e7e4c8df
...
@@ -1100,7 +1100,6 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame)
...
@@ -1100,7 +1100,6 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame)
AVFilterContext
*
dstctx
=
link
->
dst
;
AVFilterContext
*
dstctx
=
link
->
dst
;
AVFilterPad
*
dst
=
link
->
dstpad
;
AVFilterPad
*
dst
=
link
->
dstpad
;
int
ret
;
int
ret
;
int64_t
pts
;
if
(
!
(
filter_frame
=
dst
->
filter_frame
))
if
(
!
(
filter_frame
=
dst
->
filter_frame
))
filter_frame
=
default_filter_frame
;
filter_frame
=
default_filter_frame
;
...
@@ -1112,24 +1111,15 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame)
...
@@ -1112,24 +1111,15 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame)
}
}
ff_inlink_process_commands
(
link
,
frame
);
ff_inlink_process_commands
(
link
,
frame
);
dstctx
->
is_disabled
=
!
ff_inlink_evaluate_timeline_at_frame
(
link
,
frame
);
pts
=
frame
->
pts
;
/* TODO reindent */
if
(
dstctx
->
enable_str
)
{
int64_t
pos
=
av_frame_get_pkt_pos
(
frame
);
dstctx
->
var_values
[
VAR_N
]
=
link
->
frame_count_out
;
dstctx
->
var_values
[
VAR_T
]
=
pts
==
AV_NOPTS_VALUE
?
NAN
:
pts
*
av_q2d
(
link
->
time_base
);
dstctx
->
var_values
[
VAR_W
]
=
link
->
w
;
dstctx
->
var_values
[
VAR_H
]
=
link
->
h
;
dstctx
->
var_values
[
VAR_POS
]
=
pos
==
-
1
?
NAN
:
pos
;
dstctx
->
is_disabled
=
fabs
(
av_expr_eval
(
dstctx
->
enable
,
dstctx
->
var_values
,
NULL
))
<
0
.
5
;
if
(
dstctx
->
is_disabled
&&
if
(
dstctx
->
is_disabled
&&
(
dstctx
->
filter
->
flags
&
AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
))
(
dstctx
->
filter
->
flags
&
AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
))
filter_frame
=
default_filter_frame
;
filter_frame
=
default_filter_frame
;
}
ret
=
filter_frame
(
link
,
frame
);
ret
=
filter_frame
(
link
,
frame
);
link
->
frame_count_out
++
;
link
->
frame_count_out
++
;
ff_update_link_current_pts
(
link
,
pts
);
ff_update_link_current_pts
(
link
,
frame
->
pts
);
return
ret
;
return
ret
;
fail:
fail:
...
@@ -1575,6 +1565,24 @@ int ff_inlink_process_commands(AVFilterLink *link, const AVFrame *frame)
...
@@ -1575,6 +1565,24 @@ int ff_inlink_process_commands(AVFilterLink *link, const AVFrame *frame)
return
0
;
return
0
;
}
}
int
ff_inlink_evaluate_timeline_at_frame
(
AVFilterLink
*
link
,
const
AVFrame
*
frame
)
{
AVFilterContext
*
dstctx
=
link
->
dst
;
int64_t
pts
=
frame
->
pts
;
int64_t
pos
=
av_frame_get_pkt_pos
(
frame
);
if
(
!
dstctx
->
enable_str
)
return
1
;
dstctx
->
var_values
[
VAR_N
]
=
link
->
frame_count_out
;
dstctx
->
var_values
[
VAR_T
]
=
pts
==
AV_NOPTS_VALUE
?
NAN
:
pts
*
av_q2d
(
link
->
time_base
);
dstctx
->
var_values
[
VAR_W
]
=
link
->
w
;
dstctx
->
var_values
[
VAR_H
]
=
link
->
h
;
dstctx
->
var_values
[
VAR_POS
]
=
pos
==
-
1
?
NAN
:
pos
;
return
fabs
(
av_expr_eval
(
dstctx
->
enable
,
dstctx
->
var_values
,
NULL
))
>=
0
.
5
;
}
const
AVClass
*
avfilter_get_class
(
void
)
const
AVClass
*
avfilter_get_class
(
void
)
{
{
return
&
avfilter_class
;
return
&
avfilter_class
;
...
...
libavfilter/filters.h
View file @
e7e4c8df
...
@@ -46,6 +46,14 @@ void ff_filter_set_ready(AVFilterContext *filter, unsigned priority);
...
@@ -46,6 +46,14 @@ void ff_filter_set_ready(AVFilterContext *filter, unsigned priority);
*/
*/
int
ff_inlink_process_commands
(
AVFilterLink
*
link
,
const
AVFrame
*
frame
);
int
ff_inlink_process_commands
(
AVFilterLink
*
link
,
const
AVFrame
*
frame
);
/**
* Evaluate the timeline expression of the link for the time and properties
* of the frame.
* @return >0 if enabled, 0 if disabled
* @note It does not update link->dst->is_disabled.
*/
int
ff_inlink_evaluate_timeline_at_frame
(
AVFilterLink
*
link
,
const
AVFrame
*
frame
);
/**
/**
* Make sure a frame is writable.
* Make sure a frame is writable.
* This is similar to av_frame_make_writable() except it uses the link's
* This is similar to av_frame_make_writable() except it uses the link's
...
...
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