Libav
internal.h
Go to the documentation of this file.
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_INTERNAL_H
20 #define AVFILTER_INTERNAL_H
21 
27 #include "libavutil/internal.h"
28 #include "avfilter.h"
29 #include "thread.h"
30 #include "version.h"
31 
35 struct AVFilterPad {
41  const char *name;
42 
47 
54  AVFrame *(*get_video_buffer)(AVFilterLink *link, int w, int h);
55 
62  AVFrame *(*get_audio_buffer)(AVFilterLink *link, int nb_samples);
63 
74  int (*filter_frame)(AVFilterLink *link, AVFrame *frame);
75 
85  int (*poll_frame)(AVFilterLink *link);
86 
94  int (*request_frame)(AVFilterLink *link);
95 
110  int (*config_props)(AVFilterLink *link);
111 
119 
127 };
128 
130  void *thread;
132 };
133 
136 };
137 
139 int ff_fmt_is_in(int fmt, const int *fmts);
140 
141 #define FF_DPRINTF_START(ctx, func) av_log(NULL, AV_LOG_TRACE, "%-16s: ", #func)
142 
143 void ff_dlog_link(void *ctx, AVFilterLink *link, int end);
144 
158 void ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off,
159  AVFilterPad **pads, AVFilterLink ***links,
160  AVFilterPad *newpad);
161 
163 static inline void ff_insert_inpad(AVFilterContext *f, unsigned index,
164  AVFilterPad *p)
165 {
166  ff_insert_pad(index, &f->nb_inputs, offsetof(AVFilterLink, dstpad),
167  &f->input_pads, &f->inputs, p);
168 }
169 
171 static inline void ff_insert_outpad(AVFilterContext *f, unsigned index,
172  AVFilterPad *p)
173 {
174  ff_insert_pad(index, &f->nb_outputs, offsetof(AVFilterLink, srcpad),
175  &f->output_pads, &f->outputs, p);
176 }
177 
185 int ff_poll_frame(AVFilterLink *link);
186 
193 int ff_request_frame(AVFilterLink *link);
194 
206 int ff_filter_frame(AVFilterLink *link, AVFrame *frame);
207 
216 AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name);
217 
222 
223 #endif /* AVFILTER_INTERNAL_H */
This structure describes decoded (raw) audio or video data.
Definition: frame.h:140
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:747
Main libavfilter public API header.
Libavfilter version macros.
int() avfilter_execute_func(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
A function executing multiple jobs, possibly in parallel.
Definition: avfilter.h:600
enum AVMediaType type
AVFilterPad type.
Definition: internal.h:46
const char * name
Pad name.
Definition: internal.h:41
AVFilterLink ** inputs
array of pointers to input links
Definition: avfilter.h:270
AVFilterPad * output_pads
array of output pads
Definition: avfilter.h:273
int(* poll_frame)(AVFilterLink *link)
Frame poll callback.
Definition: internal.h:85
int ff_fmt_is_in(int fmt, const int *fmts)
Tell is a format is contained in the provided list terminated by -1.
Definition: formats.c:154
void ff_dlog_link(void *ctx, AVFilterLink *link, int end)
Definition: avfilter.c:240
A filter pad used for either input or output.
Definition: internal.h:35
AVFilterPad * input_pads
array of input pads
Definition: avfilter.h:269
unsigned nb_outputs
number of output pads
Definition: avfilter.h:275
void ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off, AVFilterPad **pads, AVFilterLink ***links, AVFilterPad *newpad)
Insert a new pad.
Definition: avfilter.c:56
common internal API header
static void filter(MpegAudioContext *s, int ch, const short *samples, int incr)
Definition: mpegaudioenc.c:307
int(* config_props)(AVFilterLink *link)
Link configuration callback.
Definition: internal.h:110
unsigned nb_inputs
number of input pads
Definition: avfilter.h:271
static void ff_insert_outpad(AVFilterContext *f, unsigned index, AVFilterPad *p)
Insert a new output pad for the filter.
Definition: internal.h:171
AVFormatContext * ctx
Definition: movenc.c:48
int needs_writable
The filter expects writable frames from its input link, duplicating data buffers if needed...
Definition: internal.h:126
void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter)
Remove a filter from a graph;.
Definition: avfiltergraph.c:89
Filter definition.
Definition: avfilter.h:120
int index
Definition: gxfenc.c:72
AVMediaType
Definition: avutil.h:192
AVFilterLink ** outputs
array of pointers to output links
Definition: avfilter.h:274
int(* filter_frame)(AVFilterLink *link, AVFrame *frame)
Filtering callback.
Definition: internal.h:74
avfilter_execute_func * execute
Definition: internal.h:135
avfilter_execute_func * thread_execute
Definition: internal.h:131
static void ff_insert_inpad(AVFilterContext *f, unsigned index, AVFilterPad *p)
Insert a new input pad for the filter.
Definition: internal.h:163
int(* request_frame)(AVFilterLink *link)
Frame request callback.
Definition: internal.h:94
An instance of a filter.
Definition: avfilter.h:262
int ff_poll_frame(AVFilterLink *link)
Poll a frame from the filter chain.
Definition: avfilter.c:276
AVFilterContext * ff_filter_alloc(const AVFilter *filter, const char *inst_name)
Allocate a new filter context and return it.
Definition: avfilter.c:411
int needs_fifo
The filter expects a fifo to be inserted on its input link, typically because it has a delay...
Definition: internal.h:118
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
Definition: avfilter.c:264