X-Git-Url: http://git.ffmpeg.org/gitweb/ffmpeg.git/blobdiff_plain/4e48aa86563279bf833b3ebcc2eaa1ff97189d91..ba7dfe5c50b2b618b54ff1e7c3972b07d172f163:/libavfilter/buffersrc.h diff --git a/libavfilter/buffersrc.h b/libavfilter/buffersrc.h index 452c691b09..0ca4d963a6 100644 --- a/libavfilter/buffersrc.h +++ b/libavfilter/buffersrc.h @@ -22,29 +22,64 @@ /** * @file + * @ingroup lavfi_buffersrc * Memory buffer source API. */ #include "avfilter.h" /** - * Add a buffer to the filtergraph s. + * @defgroup lavfi_buffersrc Buffer source API + * @ingroup lavfi + * @{ + */ + +#if FF_API_AVFILTERBUFFER +/** + * Add a buffer to a filtergraph. * + * @param ctx an instance of the buffersrc filter * @param buf buffer containing frame data to be passed down the filtergraph. * This function will take ownership of buf, the user must not free it. * A NULL buf signals EOF -- i.e. no more frames will be sent to this filter. + * + * @deprecated use av_buffersrc_write_frame() or av_buffersrc_add_frame() + */ +attribute_deprecated +int av_buffersrc_buffer(AVFilterContext *ctx, AVFilterBufferRef *buf); +#endif + +/** + * Add a frame to the buffer source. + * + * @param ctx an instance of the buffersrc filter + * @param frame frame to be added. If the frame is reference counted, this + * function will make a new reference to it. Otherwise the frame data will be + * copied. + * + * @return 0 on success, a negative AVERROR on error */ -int av_buffersrc_buffer(AVFilterContext *s, AVFilterBufferRef *buf); +int av_buffersrc_write_frame(AVFilterContext *ctx, const AVFrame *frame); /** * Add a frame to the buffer source. * - * @param s an instance of the buffersrc filter. - * @param frame frame to be added. + * @param ctx an instance of the buffersrc filter + * @param frame frame to be added. If the frame is reference counted, this + * function will take ownership of the reference(s) and reset the frame. + * Otherwise the frame data will be copied. If this function returns an error, + * the input frame is not touched. + * + * @return 0 on success, a negative AVERROR on error. * - * @warning frame data will be memcpy()ed, which may be a big performance - * hit. Use av_buffersrc_buffer() to avoid copying the data. + * @note the difference between this function and av_buffersrc_write_frame() is + * that av_buffersrc_write_frame() creates a new reference to the input frame, + * while this function takes ownership of the reference passed to it. + */ +int av_buffersrc_add_frame(AVFilterContext *ctx, AVFrame *frame); + +/** + * @} */ -int av_buffersrc_write_frame(AVFilterContext *s, const AVFrame *frame); #endif /* AVFILTER_BUFFERSRC_H */