2 * This file is part of Libav.
4 * Libav is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * Libav is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with Libav; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 #ifndef AVFILTER_BUFFERSINK_H
20 #define AVFILTER_BUFFERSINK_H
24 * @ingroup lavfi_buffersink
25 * memory buffer sink API
31 * @defgroup lavfi_buffersink Buffer sink API
36 #if FF_API_AVFILTERBUFFER
38 * Get a buffer with filtered data from sink and put it in buf.
40 * @param ctx pointer to a context of a buffersink or abuffersink AVFilter.
41 * @param buf pointer to the buffer will be written here if buf is non-NULL. buf
42 * must be freed by the caller using avfilter_unref_buffer().
43 * Buf may also be NULL to query whether a buffer is ready to be
46 * @return >= 0 in case of success, a negative AVERROR code in case of
50 int av_buffersink_read(AVFilterContext *ctx, AVFilterBufferRef **buf);
53 * Same as av_buffersink_read, but with the ability to specify the number of
54 * samples read. This function is less efficient than av_buffersink_read(),
55 * because it copies the data around.
57 * @param ctx pointer to a context of the abuffersink AVFilter.
58 * @param buf pointer to the buffer will be written here if buf is non-NULL. buf
59 * must be freed by the caller using avfilter_unref_buffer(). buf
60 * will contain exactly nb_samples audio samples, except at the end
61 * of stream, when it can contain less than nb_samples.
62 * Buf may also be NULL to query whether a buffer is ready to be
65 * @warning do not mix this function with av_buffersink_read(). Use only one or
66 * the other with a single sink, not both.
69 int av_buffersink_read_samples(AVFilterContext *ctx, AVFilterBufferRef **buf,
74 * Get a frame with filtered data from sink and put it in frame.
76 * @param ctx pointer to a context of a buffersink or abuffersink AVFilter.
77 * @param frame pointer to an allocated frame that will be filled with data.
78 * The data must be freed using av_frame_unref() / av_frame_free()
81 * - >= 0 if a frame was successfully returned.
82 * - AVERROR(EAGAIN) if no frames are available at this point; more
83 * input frames must be added to the filtergraph to get more output.
84 * - AVERROR_EOF if there will be no more output frames on this sink.
85 * - A different negative AVERROR code in other failure cases.
87 int av_buffersink_get_frame(AVFilterContext *ctx, AVFrame *frame);
90 * Same as av_buffersink_get_frame(), but with the ability to specify the number
91 * of samples read. This function is less efficient than
92 * av_buffersink_get_frame(), because it copies the data around.
94 * @param ctx pointer to a context of the abuffersink AVFilter.
95 * @param frame pointer to an allocated frame that will be filled with data.
96 * The data must be freed using av_frame_unref() / av_frame_free()
97 * frame will contain exactly nb_samples audio samples, except at
98 * the end of stream, when it can contain less than nb_samples.
100 * @return The return codes have the same meaning as for
101 * av_buffersink_get_samples().
103 * @warning do not mix this function with av_buffersink_get_frame(). Use only one or
104 * the other with a single sink, not both.
106 int av_buffersink_get_samples(AVFilterContext *ctx, AVFrame *frame, int nb_samples);
112 #endif /* AVFILTER_BUFFERSINK_H */