FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
buffersrc.h
Go to the documentation of this file.
1 /*
2  *
3  * This file is part of FFmpeg.
4  *
5  * FFmpeg is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * FFmpeg is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with FFmpeg; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #ifndef AVFILTER_BUFFERSRC_H
21 #define AVFILTER_BUFFERSRC_H
22 
23 /**
24  * @file
25  * @ingroup lavfi_buffersrc
26  * Memory buffer source API.
27  */
28 
29 #include "libavcodec/avcodec.h"
30 #include "avfilter.h"
31 
32 /**
33  * @defgroup lavfi_buffersrc Buffer source API
34  * @ingroup lavfi
35  * @{
36  */
37 
38 enum {
39 
40  /**
41  * Do not check for format changes.
42  */
44 
45  /**
46  * Immediately push the frame to the output.
47  */
49 
50  /**
51  * Keep a reference to the frame.
52  * If the frame if reference-counted, create a new reference; otherwise
53  * copy the frame data.
54  */
56 
57 };
58 
59 /**
60  * Get the number of failed requests.
61  *
62  * A failed request is when the request_frame method is called while no
63  * frame is present in the buffer.
64  * The number is reset when a frame is added.
65  */
67 
68 /**
69  * Add a frame to the buffer source.
70  *
71  * @param ctx an instance of the buffersrc filter
72  * @param frame frame to be added. If the frame is reference counted, this
73  * function will make a new reference to it. Otherwise the frame data will be
74  * copied.
75  *
76  * @return 0 on success, a negative AVERROR on error
77  *
78  * This function is equivalent to av_buffersrc_add_frame_flags() with the
79  * AV_BUFFERSRC_FLAG_KEEP_REF flag.
80  */
83 
84 /**
85  * Add a frame to the buffer source.
86  *
87  * @param ctx an instance of the buffersrc filter
88  * @param frame frame to be added. If the frame is reference counted, this
89  * function will take ownership of the reference(s) and reset the frame.
90  * Otherwise the frame data will be copied. If this function returns an error,
91  * the input frame is not touched.
92  *
93  * @return 0 on success, a negative AVERROR on error.
94  *
95  * @note the difference between this function and av_buffersrc_write_frame() is
96  * that av_buffersrc_write_frame() creates a new reference to the input frame,
97  * while this function takes ownership of the reference passed to it.
98  *
99  * This function is equivalent to av_buffersrc_add_frame_flags() without the
100  * AV_BUFFERSRC_FLAG_KEEP_REF flag.
101  */
104 
105 /**
106  * Add a frame to the buffer source.
107  *
108  * By default, if the frame is reference-counted, this function will take
109  * ownership of the reference(s) and reset the frame. This can be controlled
110  * using the flags.
111  *
112  * If this function returns an error, the input frame is not touched.
113  *
114  * @param buffer_src pointer to a buffer source context
115  * @param frame a frame, or NULL to mark EOF
116  * @param flags a combination of AV_BUFFERSRC_FLAG_*
117  * @return >= 0 in case of success, a negative AVERROR code
118  * in case of failure
119  */
122  AVFrame *frame, int flags);
123 
124 
125 /**
126  * @}
127  */
128 
129 #endif /* AVFILTER_BUFFERSRC_H */
This structure describes decoded (raw) audio or video data.
Definition: frame.h:181
AVFormatContext * ctx
Definition: movenc-test.c:48
Main libavfilter public API header.
Immediately push the frame to the output.
Definition: buffersrc.h:48
static AVFrame * frame
Keep a reference to the frame.
Definition: buffersrc.h:55
Libavcodec external API header.
unsigned av_buffersrc_get_nb_failed_requests(AVFilterContext *buffer_src)
Get the number of failed requests.
Definition: buffersrc.c:206
static int flags
Definition: cpu.c:47
#define av_warn_unused_result
Definition: attributes.h:56
av_warn_unused_result int av_buffersrc_write_frame(AVFilterContext *ctx, const AVFrame *frame)
Add a frame to the buffer source.
Definition: buffersrc.c:79
av_warn_unused_result int av_buffersrc_add_frame_flags(AVFilterContext *buffer_src, AVFrame *frame, int flags)
Add a frame to the buffer source.
Definition: buffersrc.c:93
An instance of a filter.
Definition: avfilter.h:304
av_warn_unused_result int av_buffersrc_add_frame(AVFilterContext *ctx, AVFrame *frame)
Add a frame to the buffer source.
Definition: buffersrc.c:85
Do not check for format changes.
Definition: buffersrc.h:43