Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
d360ddf0
"README.md" did not exist on "e6c460e3ead413511940af1d6300d70167b3d1d6"
Commit
d360ddf0
authored
8 years ago
by
Nicolas George
Browse files
Options
Downloads
Patches
Plain Diff
lavfi: add helpers to consume frames from link FIFOs.
parent
2e5af443
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libavfilter/avfilter.c
+52
-0
52 additions, 0 deletions
libavfilter/avfilter.c
libavfilter/filters.h
+42
-0
42 additions, 0 deletions
libavfilter/filters.h
with
94 additions
and
0 deletions
libavfilter/avfilter.c
+
52
−
0
View file @
d360ddf0
...
...
@@ -1501,6 +1501,58 @@ int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts
return
1
;
}
int
ff_inlink_check_available_frame
(
AVFilterLink
*
link
)
{
return
ff_framequeue_queued_frames
(
&
link
->
fifo
)
>
0
;
}
int
ff_inlink_check_available_samples
(
AVFilterLink
*
link
,
unsigned
min
)
{
uint64_t
samples
=
ff_framequeue_queued_samples
(
&
link
->
fifo
);
av_assert1
(
min
);
return
samples
>=
min
||
(
link
->
status_in
&&
samples
);
}
static
void
consume_update
(
AVFilterLink
*
link
,
const
AVFrame
*
frame
)
{
ff_inlink_process_commands
(
link
,
frame
);
link
->
dst
->
is_disabled
=
!
ff_inlink_evaluate_timeline_at_frame
(
link
,
frame
);
link
->
frame_count_out
++
;
}
int
ff_inlink_consume_frame
(
AVFilterLink
*
link
,
AVFrame
**
rframe
)
{
AVFrame
*
frame
;
*
rframe
=
NULL
;
if
(
!
ff_inlink_check_available_frame
(
link
))
return
0
;
frame
=
ff_framequeue_take
(
&
link
->
fifo
);
consume_update
(
link
,
frame
);
*
rframe
=
frame
;
return
1
;
}
int
ff_inlink_consume_samples
(
AVFilterLink
*
link
,
unsigned
min
,
unsigned
max
,
AVFrame
**
rframe
)
{
AVFrame
*
frame
;
int
ret
;
av_assert1
(
min
);
*
rframe
=
NULL
;
if
(
!
ff_inlink_check_available_samples
(
link
,
min
))
return
0
;
if
(
link
->
status_in
)
min
=
FFMIN
(
min
,
ff_framequeue_queued_samples
(
&
link
->
fifo
));
ret
=
take_samples
(
link
,
min
,
link
->
max_samples
,
&
frame
);
if
(
ret
<
0
)
return
ret
;
consume_update
(
link
,
frame
);
*
rframe
=
frame
;
return
1
;
}
int
ff_inlink_make_frame_writable
(
AVFilterLink
*
link
,
AVFrame
**
rframe
)
{
AVFrame
*
frame
=
*
rframe
;
...
...
This diff is collapsed.
Click to expand it.
libavfilter/filters.h
+
42
−
0
View file @
d360ddf0
...
...
@@ -54,6 +54,48 @@ int ff_inlink_process_commands(AVFilterLink *link, const AVFrame *frame);
*/
int
ff_inlink_evaluate_timeline_at_frame
(
AVFilterLink
*
link
,
const
AVFrame
*
frame
);
/**
* Test if a frame is available on the link.
* @return >0 if a frame is available
*/
int
ff_inlink_check_available_frame
(
AVFilterLink
*
link
);
/**
* Test if enough samples are available on the link.
* @return >0 if enough samples are available
* @note on EOF and error, min becomes 1
*/
int
ff_inlink_check_available_samples
(
AVFilterLink
*
link
,
unsigned
min
);
/**
* Take a frame from the link's FIFO and update the link's stats.
*
* If ff_inlink_check_available_frame() was previously called, the
* preferred way of expressing it is "av_assert1(ret);" immediately after
* ff_inlink_consume_frame(). Negative error codes must still be checked.
*
* @note May trigger process_command() and/or update is_disabled.
* @return >0 if a frame is available,
* 0 and set rframe to NULL if no frame available,
* or AVERROR code
*/
int
ff_inlink_consume_frame
(
AVFilterLink
*
link
,
AVFrame
**
rframe
);
/**
* Take samples from the link's FIFO and update the link's stats.
*
* If ff_inlink_check_available_samples() was previously called, the
* preferred way of expressing it is "av_assert1(ret);" immediately after
* ff_inlink_consume_samples(). Negative error codes must still be checked.
*
* @note May trigger process_command() and/or update is_disabled.
* @return >0 if a frame is available,
* 0 and set rframe to NULL if no frame available,
* or AVERROR code
*/
int
ff_inlink_consume_samples
(
AVFilterLink
*
link
,
unsigned
min
,
unsigned
max
,
AVFrame
**
rframe
);
/**
* Make sure a frame is writable.
* This is similar to av_frame_make_writable() except it uses the link's
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment