mp3: Properly use AVCodecContext API
[platform/upstream/libav.git] / libavfilter / buffersink.h
1 /*
2  * This file is part of Libav.
3  *
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.
8  *
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.
13  *
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
17  */
18
19 #ifndef AVFILTER_BUFFERSINK_H
20 #define AVFILTER_BUFFERSINK_H
21
22 /**
23  * @file
24  * @ingroup lavfi_buffersink
25  * memory buffer sink API
26  */
27
28 #include "avfilter.h"
29
30 /**
31  * @defgroup lavfi_buffersink Buffer sink API
32  * @ingroup lavfi
33  * @{
34  */
35
36 #if FF_API_AVFILTERBUFFER
37 /**
38  * Get a buffer with filtered data from sink and put it in buf.
39  *
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
44  *            output.
45  *
46  * @return >= 0 in case of success, a negative AVERROR code in case of
47  *         failure.
48  */
49 attribute_deprecated
50 int av_buffersink_read(AVFilterContext *ctx, AVFilterBufferRef **buf);
51
52 /**
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.
56  *
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
63  *            output.
64  *
65  * @warning do not mix this function with av_buffersink_read(). Use only one or
66  * the other with a single sink, not both.
67  */
68 attribute_deprecated
69 int av_buffersink_read_samples(AVFilterContext *ctx, AVFilterBufferRef **buf,
70                                int nb_samples);
71 #endif
72
73 /**
74  * Get a frame with filtered data from sink and put it in frame.
75  *
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()
79  *
80  * @return
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.
86  */
87 int av_buffersink_get_frame(AVFilterContext *ctx, AVFrame *frame);
88
89 /**
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.
93  *
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.
99  *
100  * @return The return codes have the same meaning as for
101  *         av_buffersink_get_samples().
102  *
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.
105  */
106 int av_buffersink_get_samples(AVFilterContext *ctx, AVFrame *frame, int nb_samples);
107
108 /**
109  * @}
110  */
111
112 #endif /* AVFILTER_BUFFERSINK_H */