Le nonidi 9 nivôse, an CCXXV, Nicolas George a écrit : > Signed-off-by: Nicolas George <geo...@nsup.org> > --- > libavfilter/buffersink.c | 214 > +++++++++++++---------------------------------- > 1 file changed, 56 insertions(+), 158 deletions(-) > > > Minor changes to accomodate the previous changes. Since diff is not very > smart about it, better read the code than the patch.
This patch and the previous one still lack a review. For convenience, here is an excerpt of the file after the patch containing the parts that are mostly rewritten and unreadable with diff. Regards, -- Nicolas George
int attribute_align_arg av_buffersink_get_frame(AVFilterContext *ctx, AVFrame *frame) { return av_buffersink_get_frame_flags(ctx, frame, 0); } static int return_or_keep_frame(BufferSinkContext *buf, AVFrame *out, AVFrame *in, int flags) { if ((flags & AV_BUFFERSINK_FLAG_PEEK)) { buf->peeked_frame = in; return out ? av_frame_ref(out, in) : 0; } else { av_assert1(out); buf->peeked_frame = NULL; av_frame_move_ref(out, in); av_frame_free(&in); return 0; } } static int get_frame_internal(AVFilterContext *ctx, AVFrame *frame, int flags, int samples) { BufferSinkContext *buf = ctx->priv; AVFilterLink *inlink = ctx->inputs[0]; int status, ret; AVFrame *cur_frame; int64_t pts; if (buf->peeked_frame) return return_or_keep_frame(buf, frame, buf->peeked_frame, flags); while (1) { ret = samples ? ff_inlink_consume_samples(inlink, samples, samples, &cur_frame) : ff_inlink_consume_frame(inlink, &cur_frame); if (ret < 0) { return ret; } else if (ret) { /* TODO return the frame instead of copying it */ return return_or_keep_frame(buf, frame, cur_frame, flags); } else if (ff_inlink_acknowledge_status(inlink, &status, &pts)) { return status; } else if ((flags & AV_BUFFERSINK_FLAG_NO_REQUEST)) { return AVERROR(EAGAIN); } else if (inlink->frame_wanted_out) { ret = ff_filter_graph_run_once(ctx->graph); if (ret < 0) return ret; } else { ff_inlink_request_frame(inlink); } } } int attribute_align_arg av_buffersink_get_frame_flags(AVFilterContext *ctx, AVFrame *frame, int flags) { return get_frame_internal(ctx, frame, flags, ctx->inputs[0]->min_samples); } int attribute_align_arg av_buffersink_get_samples(AVFilterContext *ctx, AVFrame *frame, int nb_samples) { return get_frame_internal(ctx, frame, 0, nb_samples); } /* snip av_a?buffersink_params_alloc() */ static av_cold int common_init(AVFilterContext *ctx) { BufferSinkContext *buf = ctx->priv; buf->warning_limit = 100; return 0; } static int activate(AVFilterContext *ctx) { BufferSinkContext *buf = ctx->priv; if (buf->warning_limit && ff_framequeue_queued_frames(&ctx->inputs[0]->fifo) >= buf->warning_limit) { av_log(ctx, AV_LOG_WARNING, "%d buffers queued in %s, something may be wrong.\n", buf->warning_limit, (char *)av_x_if_null(ctx->name, ctx->filter->name)); buf->warning_limit *= 10; } /* The frame is queued, the rest is up to get_frame_internal */ return 0; }
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel