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
76613618
Commit
76613618
authored
Aug 31, 2017
by
Nicolas George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi: add helper functions and macros for activate.
parent
e952d4b7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
0 deletions
+98
-0
avfilter.c
libavfilter/avfilter.c
+20
-0
filters.h
libavfilter/filters.h
+78
-0
No files found.
libavfilter/avfilter.c
View file @
76613618
...
...
@@ -1668,6 +1668,26 @@ void ff_inlink_request_frame(AVFilterLink *link)
ff_filter_set_ready
(
link
->
src
,
100
);
}
void
ff_inlink_set_status
(
AVFilterLink
*
link
,
int
status
)
{
if
(
link
->
status_out
)
return
;
link
->
frame_wanted_out
=
0
;
link
->
frame_blocked_in
=
0
;
ff_avfilter_link_set_out_status
(
link
,
status
,
AV_NOPTS_VALUE
);
while
(
ff_framequeue_queued_frames
(
&
link
->
fifo
))
{
AVFrame
*
frame
=
ff_framequeue_take
(
&
link
->
fifo
);
av_frame_free
(
&
frame
);
}
if
(
!
link
->
status_in
)
link
->
status_in
=
status
;
}
int
ff_outlink_get_status
(
AVFilterLink
*
link
)
{
return
link
->
status_in
;
}
const
AVClass
*
avfilter_get_class
(
void
)
{
return
&
avfilter_class
;
...
...
libavfilter/filters.h
View file @
76613618
...
...
@@ -140,6 +140,12 @@ int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts
*/
void
ff_inlink_request_frame
(
AVFilterLink
*
link
);
/**
* Set the status on an input link.
* Also discard all frames in the link's FIFO.
*/
void
ff_inlink_set_status
(
AVFilterLink
*
link
,
int
status
);
/**
* Test if a frame is wanted on an output link.
*/
...
...
@@ -148,6 +154,11 @@ static inline int ff_outlink_frame_wanted(AVFilterLink *link)
return
link
->
frame_wanted_out
;
}
/**
* Get the status on an output link.
*/
int
ff_outlink_get_status
(
AVFilterLink
*
link
);
/**
* Set the status field of a link from the source filter.
* The pts should reflect the timestamp of the status change,
...
...
@@ -160,4 +171,71 @@ static inline void ff_outlink_set_status(AVFilterLink *link, int status, int64_t
ff_avfilter_link_set_in_status
(
link
,
status
,
pts
);
}
/**
* Forward the status on an output link to an input link.
* If the status is set, it will discard all queued frames and this macro
* will return immediately.
*/
#define FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink) do { \
int ret = ff_outlink_get_status(outlink); \
if (ret) { \
ff_inlink_set_status(inlink, ret); \
return 0; \
} \
} while (0)
/**
* Forward the status on an output link to all input links.
* If the status is set, it will discard all queued frames and this macro
* will return immediately.
*/
#define FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, filter) do { \
int ret = ff_outlink_get_status(outlink); \
if (ret) { \
unsigned i; \
for (i = 0; i < filter->nb_inputs; i++) \
ff_inlink_set_status(filter->inputs[i], ret); \
return 0; \
} \
} while (0)
/**
* Acknowledge the status on an input link and forward it to an output link.
* If the status is set, this macro will return immediately.
*/
#define FF_FILTER_FORWARD_STATUS(inlink, outlink) do { \
int status; \
int64_t pts; \
if (ff_inlink_acknowledge_status(inlink, &status, &pts)) { \
ff_outlink_set_status(outlink, status, pts); \
return 0; \
} \
} while (0)
/**
* Acknowledge the status on an input link and forward it to an output link.
* If the status is set, this macro will return immediately.
*/
#define FF_FILTER_FORWARD_STATUS_ALL(inlink, filter) do { \
int status; \
int64_t pts; \
if (ff_inlink_acknowledge_status(inlink, &status, &pts)) { \
unsigned i; \
for (i = 0; i < filter->nb_outputs; i++) \
ff_outlink_set_status(filter->outputs[i], status, pts); \
return 0; \
} \
} while (0)
/**
* Forward the frame_wanted_out flag from an output link to an input link.
* If the flag is set, this macro will return immediately.
*/
#define FF_FILTER_FORWARD_WANTED(outlink, inlink) do { \
if (ff_outlink_frame_wanted(outlink)) { \
ff_inlink_request_frame(inlink); \
return 0; \
} \
} while (0)
#endif
/* AVFILTER_FILTERS_H */
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