lavfi: remove request/poll and drawing functions from public API on next bump
[platform/upstream/libav.git] / libavfilter / internal.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_INTERNAL_H
20 #define AVFILTER_INTERNAL_H
21
22 /**
23  * @file
24  * internal API functions
25  */
26
27 #include "avfilter.h"
28
29 /** default handler for freeing audio/video buffer when there are no references left */
30 void ff_avfilter_default_free_buffer(AVFilterBuffer *buf);
31
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);
34
35 #define FF_DPRINTF_START(ctx, func) av_dlog(NULL, "%-16s: ", #func)
36
37 void ff_dlog_link(void *ctx, AVFilterLink *link, int end);
38
39 /**
40  * Insert a new pad.
41  *
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
47  *                   numbering to change
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.
51  */
52 void ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off,
53                    AVFilterPad **pads, AVFilterLink ***links,
54                    AVFilterPad *newpad);
55
56 /** Insert a new input pad for the filter. */
57 static inline void ff_insert_inpad(AVFilterContext *f, unsigned index,
58                                    AVFilterPad *p)
59 {
60     ff_insert_pad(index, &f->input_count, offsetof(AVFilterLink, dstpad),
61                   &f->input_pads, &f->inputs, p);
62 }
63
64 /** Insert a new output pad for the filter. */
65 static inline void ff_insert_outpad(AVFilterContext *f, unsigned index,
66                                     AVFilterPad *p)
67 {
68     ff_insert_pad(index, &f->output_count, offsetof(AVFilterLink, srcpad),
69                   &f->output_pads, &f->outputs, p);
70 }
71
72 /**
73  * Poll a frame from the filter chain.
74  *
75  * @param  link the input link
76  * @return the number of immediately available frames, a negative
77  * number in case of error
78  */
79 int ff_poll_frame(AVFilterLink *link);
80
81 /**
82  * Request an input frame from the filter at the other end of the link.
83  *
84  * @param link the input link
85  * @return     zero on success
86  */
87 int ff_request_frame(AVFilterLink *link);
88
89 #endif /* AVFILTER_INTERNAL_H */