]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/blob - libavfilter/avfiltergraph.h
Remove usage of AVFilterGraphDesc outside avfiltergraph.c
[frescor/ffmpeg.git] / libavfilter / avfiltergraph.h
1 /*
2  * Filter graphs
3  * copyright (c) 2007 Bobby Bingham
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21
22 #ifndef FFMPEG_AVFILTERGRAPH_H
23 #define FFMPEG_AVFILTERGRAPH_H
24
25 #include "avfilter.h"
26
27 /** Linked-list of filters to create for an AVFilterGraphDesc */
28 typedef struct AVFilterGraphDescFilter
29 {
30     int index;              ///< filter instance index
31     char *filter;           ///< name of filter type
32     char *args;             ///< filter parameters
33     struct AVFilterGraphDescFilter *next;
34 } AVFilterGraphDescFilter;
35
36 /** Linked-list of links between filters */
37 typedef struct AVFilterGraphDescLink
38 {
39     /* TODO: allow referencing pads by name, not just by index */
40     int src;                ///< index of the source filter
41     unsigned srcpad;        ///< index of the output pad on the source filter
42
43     int dst;                ///< index of the dest filter
44     unsigned dstpad;        ///< index of the input pad on the dest filter
45
46     struct AVFilterGraphDescLink *next;
47 } AVFilterGraphDescLink;
48
49 /** Linked-list of filter pads to be exported from the graph */
50 typedef struct AVFilterGraphDescExport
51 {
52     /* TODO: allow referencing pads by name, not just by index */
53     char *name;             ///< name of the exported pad
54     int filter;             ///< index of the filter
55     unsigned pad;           ///< index of the pad to be exported
56
57     struct AVFilterGraphDescExport *next;
58 } AVFilterGraphDescExport;
59
60 /** Description of a graph to be loaded from a file, etc */
61 typedef struct
62 {
63     AVFilterGraphDescFilter *filters;   ///< filters in the graph
64     AVFilterGraphDescLink   *links;     ///< links between the filters
65     AVFilterGraphDescExport *inputs;    ///< inputs to export
66     AVFilterGraphDescExport *outputs;   ///< outputs to export
67 } AVFilterGraphDesc;
68
69 typedef struct AVFilterGraph {
70     unsigned filter_count;
71     AVFilterContext **filters;
72 } AVFilterGraph;
73
74 /**
75  * Add to a graph a graph described by a string.
76  * @param graph   the filter graph where to link the parsed graph context
77  * @param filters string to be parsed
78  * @param in      input to the graph to be parsed (TODO: allow several)
79  * @param inpad   pad index of the input
80  * @param in      output to the graph to be parsed (TODO: allow several)
81  * @param inpad   pad index of the output
82  * @return        zero on success, -1 on error
83  */
84 int avfilter_graph_parse_chain(AVFilterGraph *graph, const char *filters, AVFilterContext *in, int inpad, AVFilterContext *out, int outpad);
85
86 /**
87  * Free a filter graph description.
88  * @param desc The graph description to free
89  */
90 void avfilter_graph_free_desc(AVFilterGraphDesc *desc);
91
92 /**
93  * Add an existing filter instance to a filter graph.
94  * @param graph  The filter graph
95  * @param filter The filter to be added
96  */
97 void avfilter_graph_add_filter(AVFilterGraph *graphctx, AVFilterContext *filter);
98
99 /**
100  * Configure the formats of all the links in the graph.
101  */
102 int avfilter_graph_config_formats(AVFilterGraph *graphctx);
103
104 /**
105  * Configure the parameters (resolution, etc) of all links in the graph.
106  */
107 int avfilter_graph_config_links(AVFilterGraph *graphctx);
108
109
110 int graph_load_from_desc3(AVFilterGraph *ctx, AVFilterGraphDesc *desc,
111                           AVFilterContext *in, int inpad,
112                           AVFilterContext *out, int outpad);
113
114 #endif  /* FFMPEG_AVFILTERGRAPH_H */