On Wed, Jul 30, 2014 at 11:44:47PM +0200, Nicolas George wrote: > Also deprecate adding a NULL frame to mark EOF. > > TODO APIchanges entry, version bump. > > Signed-off-by: Nicolas George <geo...@nsup.org> > --- > libavfilter/buffersrc.c | 40 ++++++++++++++++++++++++++++++---------- > libavfilter/buffersrc.h | 15 +++++++++++++++ > 2 files changed, 45 insertions(+), 10 deletions(-) > > diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c > index 27d3db0..6d71587 100644 > --- a/libavfilter/buffersrc.c > +++ b/libavfilter/buffersrc.c > @@ -63,6 +63,7 @@ typedef struct BufferSourceContext { > char *channel_layout_str; > > int eof; > + int64_t eof_pts; > } BufferSourceContext; > > #define CHECK_VIDEO_PARAM_CHANGE(s, c, width, height, format)\ > @@ -77,6 +78,27 @@ typedef struct BufferSourceContext { > return AVERROR(EINVAL);\ > } > > +static int push_if_flag(AVFilterContext *ctx, int flags) > +{ > + return (flags & AV_BUFFERSRC_FLAG_PUSH) ? > + ctx->output_pads[0].request_frame(ctx->outputs[0]) : 0; > +} > + > +int av_buffersrc_close(AVFilterContext *ctx, int64_t pts, int flags) > +{ > + BufferSourceContext *s = ctx->priv; > + > + if (pts == AV_NOPTS_VALUE) { > + av_log(ctx, AV_LOG_WARNING, "No EOF timestamp\n"); > + /* FIXME use duration for audio */ > + pts = av_rescale_q(ctx->outputs[0]->current_pts, > + AV_TIME_BASE_Q, ctx->outputs[0]->time_base) + 1; > + } > + s->eof_pts = pts; > + s->eof = 1; > + return push_if_flag(ctx, flags); > +} > + > int attribute_align_arg av_buffersrc_write_frame(AVFilterContext *ctx, const > AVFrame *frame) > { > return av_buffersrc_add_frame_flags(ctx, (AVFrame *)frame, > @@ -125,8 +147,7 @@ static int > av_buffersrc_add_frame_internal(AVFilterContext *ctx, > s->nb_failed_requests = 0; > > if (!frame) { > - s->eof = 1; > - return 0; > + return av_buffersrc_close(ctx, AV_NOPTS_VALUE, flags); > } else if (s->eof) > return AVERROR(EINVAL); > > @@ -177,11 +198,7 @@ static int > av_buffersrc_add_frame_internal(AVFilterContext *ctx, > return ret; > } > > - if ((flags & AV_BUFFERSRC_FLAG_PUSH)) > - if ((ret = ctx->output_pads[0].request_frame(ctx->outputs[0])) < 0) > - return ret; > - > - return 0; > + return push_if_flag(ctx, flags); > }
some of this patch seems to be factorizing code, other add fuctionality like ff_filter_link_close() all LGTM i think but maybe should be split [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB When you are offended at any man's fault, turn to yourself and study your own failings. Then you will forget your anger. -- Epictetus
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel