yading@10: /* yading@10: * yading@10: * This file is part of Libav. yading@10: * yading@10: * Libav is free software; you can redistribute it and/or yading@10: * modify it under the terms of the GNU Lesser General Public yading@10: * License as published by the Free Software Foundation; either yading@10: * version 2.1 of the License, or (at your option) any later version. yading@10: * yading@10: * Libav is distributed in the hope that it will be useful, yading@10: * but WITHOUT ANY WARRANTY; without even the implied warranty of yading@10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU yading@10: * Lesser General Public License for more details. yading@10: * yading@10: * You should have received a copy of the GNU Lesser General Public yading@10: * License along with Libav; if not, write to the Free Software yading@10: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA yading@10: */ yading@10: yading@10: #ifndef AVFILTER_BUFFERSRC_H yading@10: #define AVFILTER_BUFFERSRC_H yading@10: yading@10: /** yading@10: * @file yading@10: * Memory buffer source API. yading@10: */ yading@10: yading@10: #include "libavcodec/avcodec.h" yading@10: #include "avfilter.h" yading@10: yading@10: enum { yading@10: yading@10: /** yading@10: * Do not check for format changes. yading@10: */ yading@10: AV_BUFFERSRC_FLAG_NO_CHECK_FORMAT = 1, yading@10: yading@10: #if FF_API_AVFILTERBUFFER yading@10: /** yading@10: * Ignored yading@10: */ yading@10: AV_BUFFERSRC_FLAG_NO_COPY = 2, yading@10: #endif yading@10: yading@10: /** yading@10: * Immediately push the frame to the output. yading@10: */ yading@10: AV_BUFFERSRC_FLAG_PUSH = 4, yading@10: yading@10: /** yading@10: * Keep a reference to the frame. yading@10: * If the frame if reference-counted, create a new reference; otherwise yading@10: * copy the frame data. yading@10: */ yading@10: AV_BUFFERSRC_FLAG_KEEP_REF = 8, yading@10: yading@10: }; yading@10: yading@10: /** yading@10: * Add buffer data in picref to buffer_src. yading@10: * yading@10: * @param buffer_src pointer to a buffer source context yading@10: * @param picref a buffer reference, or NULL to mark EOF yading@10: * @param flags a combination of AV_BUFFERSRC_FLAG_* yading@10: * @return >= 0 in case of success, a negative AVERROR code yading@10: * in case of failure yading@10: */ yading@10: int av_buffersrc_add_ref(AVFilterContext *buffer_src, yading@10: AVFilterBufferRef *picref, int flags); yading@10: yading@10: /** yading@10: * Get the number of failed requests. yading@10: * yading@10: * A failed request is when the request_frame method is called while no yading@10: * frame is present in the buffer. yading@10: * The number is reset when a frame is added. yading@10: */ yading@10: unsigned av_buffersrc_get_nb_failed_requests(AVFilterContext *buffer_src); yading@10: yading@10: #if FF_API_AVFILTERBUFFER yading@10: /** yading@10: * Add a buffer to the filtergraph s. yading@10: * yading@10: * @param buf buffer containing frame data to be passed down the filtergraph. yading@10: * This function will take ownership of buf, the user must not free it. yading@10: * A NULL buf signals EOF -- i.e. no more frames will be sent to this filter. yading@10: * yading@10: * @deprecated use av_buffersrc_write_frame() or av_buffersrc_add_frame() yading@10: */ yading@10: attribute_deprecated yading@10: int av_buffersrc_buffer(AVFilterContext *s, AVFilterBufferRef *buf); yading@10: #endif yading@10: yading@10: /** yading@10: * Add a frame to the buffer source. yading@10: * yading@10: * @param s an instance of the buffersrc filter. yading@10: * @param frame frame to be added. If the frame is reference counted, this yading@10: * function will make a new reference to it. Otherwise the frame data will be yading@10: * copied. yading@10: * yading@10: * @return 0 on success, a negative AVERROR on error yading@10: * yading@10: * This function is equivalent to av_buffersrc_add_frame_flags() with the yading@10: * AV_BUFFERSRC_FLAG_KEEP_REF flag. yading@10: */ yading@10: int av_buffersrc_write_frame(AVFilterContext *s, const AVFrame *frame); yading@10: yading@10: /** yading@10: * Add a frame to the buffer source. yading@10: * yading@10: * @param s an instance of the buffersrc filter. yading@10: * @param frame frame to be added. If the frame is reference counted, this yading@10: * function will take ownership of the reference(s) and reset the frame. yading@10: * Otherwise the frame data will be copied. If this function returns an error, yading@10: * the input frame is not touched. yading@10: * yading@10: * @return 0 on success, a negative AVERROR on error. yading@10: * yading@10: * @note the difference between this function and av_buffersrc_write_frame() is yading@10: * that av_buffersrc_write_frame() creates a new reference to the input frame, yading@10: * while this function takes ownership of the reference passed to it. yading@10: * yading@10: * This function is equivalent to av_buffersrc_add_frame_flags() without the yading@10: * AV_BUFFERSRC_FLAG_KEEP_REF flag. yading@10: */ yading@10: int av_buffersrc_add_frame(AVFilterContext *ctx, AVFrame *frame); yading@10: yading@10: /** yading@10: * Add a frame to the buffer source. yading@10: * yading@10: * By default, if the frame is reference-counted, this function will take yading@10: * ownership of the reference(s) and reset the frame. This can be controled yading@10: * using the flags. yading@10: * yading@10: * If this function returns an error, the input frame is not touched. yading@10: * yading@10: * @param buffer_src pointer to a buffer source context yading@10: * @param frame a frame, or NULL to mark EOF yading@10: * @param flags a combination of AV_BUFFERSRC_FLAG_* yading@10: * @return >= 0 in case of success, a negative AVERROR code yading@10: * in case of failure yading@10: */ yading@10: int av_buffersrc_add_frame_flags(AVFilterContext *buffer_src, yading@10: AVFrame *frame, int flags); yading@10: yading@10: yading@10: #endif /* AVFILTER_BUFFERSRC_H */