1 /*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg 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 * FFmpeg 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 FFmpeg; 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_BUFFERSRC_H
20 #define AVFILTER_BUFFERSRC_H
21
22 /**
23 * @file
24 * @ingroup lavfi_buffersrc
25 * Memory buffer source API.
26 */
27
29
30 /**
31 * @defgroup lavfi_buffersrc Buffer source API
32 * @ingroup lavfi
33 * @{
34 */
35
36 enum {
37
38 /**
39 * Do not check for format changes.
40 */
42
43 /**
44 * Immediately push the frame to the output.
45 */
47
48 /**
49 * Keep a reference to the frame.
50 * If the frame if reference-counted, create a new reference; otherwise
51 * copy the frame data.
52 */
54
55 };
56
57 /**
58 * Get the number of failed requests.
59 *
60 * A failed request is when the request_frame method is called while no
61 * frame is present in the buffer.
62 * The number is reset when a frame is added.
63 */
65
66 /**
67 * This structure contains the parameters describing the frames that will be
68 * passed to this filter.
69 *
70 * It should be allocated with av_buffersrc_parameters_alloc() and freed with
71 * av_free(). All the allocated fields in it remain owned by the caller.
72 */
74 /**
75 * video: the pixel format, value corresponds to enum AVPixelFormat
76 * audio: the sample format, value corresponds to enum AVSampleFormat
77 */
79 /**
80 * The timebase to be used for the timestamps on the input frames.
81 */
83
84 /**
85 * Video only, the display dimensions of the input frames.
86 */
88
89 /**
90 * Video only, the sample (pixel) aspect ratio.
91 */
93
94 /**
95 * Video only, the frame rate of the input video. This field must only be
96 * set to a non-zero value if input stream has a known constant framerate
97 * and should be left at its initial value if the framerate is variable or
98 * unknown.
99 */
101
102 /**
103 * Video with a hwaccel pixel format only. This should be a reference to an
104 * AVHWFramesContext instance describing the input frames.
105 */
107
108 /**
109 * Audio only, the audio sampling rate in samples per second.
110 */
112
113 /**
114 * Audio only, the audio channel layout
115 */
117
118 /**
119 * Video only, the YUV colorspace and range.
120 */
123
126
127 /**
128 * Video only, the alpha mode.
129 */
132
133 /**
134 * Allocate a new AVBufferSrcParameters instance. It should be freed by the
135 * caller with av_free().
136 */
138
139 /**
140 * Initialize the buffersrc or abuffersrc filter with the provided parameters.
141 * This function may be called multiple times, the later calls override the
142 * previous ones. Some of the parameters may also be set through AVOptions, then
143 * whatever method is used last takes precedence.
144 *
145 * @param ctx an instance of the buffersrc or abuffersrc filter
146 * @param param the stream parameters. The frames later passed to this filter
147 * must conform to those parameters. All the allocated fields in
148 * param remain owned by the caller, libavfilter will make internal
149 * copies or references when necessary.
150 * @return 0 on success, a negative AVERROR code on failure.
151 */
153
154 /**
155 * Add a frame to the buffer source.
156 *
157 * @param ctx an instance of the buffersrc filter
158 * @param frame frame to be added. If the frame is reference counted, this
159 * function will make a new reference to it. Otherwise the frame data will be
160 * copied.
161 *
162 * @return 0 on success, a negative AVERROR on error
163 *
164 * This function is equivalent to av_buffersrc_add_frame_flags() with the
165 * AV_BUFFERSRC_FLAG_KEEP_REF flag.
166 */
169
170 /**
171 * Add a frame to the buffer source.
172 *
173 * @param ctx an instance of the buffersrc filter
174 * @param frame frame to be added. If the frame is reference counted, this
175 * function will take ownership of the reference(s) and reset the frame.
176 * Otherwise the frame data will be copied. If this function returns an error,
177 * the input frame is not touched.
178 *
179 * @return 0 on success, a negative AVERROR on error.
180 *
181 * @note the difference between this function and av_buffersrc_write_frame() is
182 * that av_buffersrc_write_frame() creates a new reference to the input frame,
183 * while this function takes ownership of the reference passed to it.
184 *
185 * This function is equivalent to av_buffersrc_add_frame_flags() without the
186 * AV_BUFFERSRC_FLAG_KEEP_REF flag.
187 */
190
191 /**
192 * Add a frame to the buffer source.
193 *
194 * By default, if the frame is reference-counted, this function will take
195 * ownership of the reference(s) and reset the frame. This can be controlled
196 * using the flags.
197 *
198 * If this function returns an error, the input frame is not touched.
199 *
200 * @param buffer_src pointer to a buffer source context
201 * @param frame a frame, or NULL to mark EOF
202 * @param flags a combination of AV_BUFFERSRC_FLAG_*
203 * @return >= 0 in case of success, a negative AVERROR code
204 * in case of failure
205 */
209
210 /**
211 * Close the buffer source after EOF.
212 *
213 * This is similar to passing NULL to av_buffersrc_add_frame_flags()
214 * except it takes the timestamp of the EOF, i.e. the timestamp of the end
215 * of the last frame.
216 */
218
219 /**
220 * @}
221 */
222
223 #endif /* AVFILTER_BUFFERSRC_H */