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_INTERNAL_H
20 #define AVFILTER_INTERNAL_H
24 * internal API functions
29 /** default handler for freeing audio/video buffer when there are no references left */
30 void ff_avfilter_default_free_buffer(AVFilterBuffer *buf);
32 /** Tell is a format is contained in the provided list terminated by -1. */
33 int ff_fmt_is_in(int fmt, const int *fmts);
35 #define FF_DPRINTF_START(ctx, func) av_dlog(NULL, "%-16s: ", #func)
37 void ff_dlog_link(void *ctx, AVFilterLink *link, int end);
42 * @param idx Insertion point. Pad is inserted at the end if this point
43 * is beyond the end of the list of pads.
44 * @param count Pointer to the number of pads in the list
45 * @param padidx_off Offset within an AVFilterLink structure to the element
46 * to increment when inserting a new pad causes link
48 * @param pads Pointer to the pointer to the beginning of the list of pads
49 * @param links Pointer to the pointer to the beginning of the list of links
50 * @param newpad The new pad to add. A copy is made when adding.
52 void ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off,
53 AVFilterPad **pads, AVFilterLink ***links,
56 /** Insert a new input pad for the filter. */
57 static inline void ff_insert_inpad(AVFilterContext *f, unsigned index,
60 ff_insert_pad(index, &f->input_count, offsetof(AVFilterLink, dstpad),
61 &f->input_pads, &f->inputs, p);
64 /** Insert a new output pad for the filter. */
65 static inline void ff_insert_outpad(AVFilterContext *f, unsigned index,
68 ff_insert_pad(index, &f->output_count, offsetof(AVFilterLink, srcpad),
69 &f->output_pads, &f->outputs, p);
73 * Poll a frame from the filter chain.
75 * @param link the input link
76 * @return the number of immediately available frames, a negative
77 * number in case of error
79 int ff_poll_frame(AVFilterLink *link);
82 * Request an input frame from the filter at the other end of the link.
84 * @param link the input link
85 * @return zero on success
87 int ff_request_frame(AVFilterLink *link);
89 #endif /* AVFILTER_INTERNAL_H */