Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas George <george@nsup.org>2016-12-21 01:23:29 +0300
committerNicolas George <george@nsup.org>2017-01-12 16:06:16 +0300
commitdb4a71c0ff4a925d1c2d0b5bde6e2760ec55b2d0 (patch)
treea948b2ddedf1de0061eb77ca31dc412dbebffd0c /libavfilter/avfilter.c
parentd360ddf03b8461dbc78c90b40cab3cc14d449f07 (diff)
lavfi: use the consume helpers in ff_filter_frame_to_filter().
Diffstat (limited to 'libavfilter/avfilter.c')
-rw-r--r--libavfilter/avfilter.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index f545e050bc..b2a6b58cea 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -1253,24 +1253,25 @@ static int take_samples(AVFilterLink *link, unsigned min, unsigned max,
int ff_filter_frame_to_filter(AVFilterLink *link)
{
- AVFrame *frame;
+ AVFrame *frame = NULL;
AVFilterContext *dst = link->dst;
int ret;
av_assert1(ff_framequeue_queued_frames(&link->fifo));
- if (link->min_samples) {
- int min = link->min_samples;
- 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;
- } else {
- frame = ff_framequeue_take(&link->fifo);
+ ret = link->min_samples ?
+ ff_inlink_consume_samples(link, link->min_samples, link->max_samples, &frame) :
+ ff_inlink_consume_frame(link, &frame);
+ av_assert1(ret);
+ if (ret < 0) {
+ av_assert1(!frame);
+ return ret;
}
/* The filter will soon have received a new frame, that may allow it to
produce one or more: unblock its outputs. */
filter_unblock(dst);
+ /* AVFilterPad.filter_frame() expect frame_count_out to have the value
+ before the frame; ff_filter_frame_framed() will re-increment it. */
+ link->frame_count_out--;
ret = ff_filter_frame_framed(link, frame);
if (ret < 0 && ret != link->status_out) {
ff_avfilter_link_set_out_status(link, ret, AV_NOPTS_VALUE);