3 * copyright (c) 2007 Bobby Bingham
5 * This file is part of FFmpeg.
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.
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.
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
22 #ifndef FFMPEG_AVFILTER_GRAPH_H
23 #define FFMPEG_AVFILTER_GRAPH_H
27 /** Linked-list of filters to create for an AVFilterGraphDesc */
28 typedef struct AVFilterGraphDescFilter
30 char *name; ///< filter instance name
31 char *filter; ///< name of filter type
32 char *args; ///< filter parameters
33 struct AVFilterGraphDescFilter *next;
34 } AVFilterGraphDescFilter;
36 /** Linked-list of links between filters */
37 typedef struct AVFilterGraphDescLink
39 /* TODO: allow referencing pads by name, not just by index */
40 char *src; ///< name of the source filter
41 unsigned srcpad; ///< index of the output pad on the source filter
43 char *dst; ///< name of the dest filter
44 unsigned dstpad; ///< index of the input pad on the dest filter
46 struct AVFilterGraphDescLink *next;
47 } AVFilterGraphDescLink;
49 /** Linked-list of filter pads to be exported from the graph */
50 typedef struct AVFilterGraphDescExport
52 /* TODO: allow referencing pads by name, not just by index */
53 char *name; ///< name of the exported pad
54 char *filter; ///< name of the filter
55 unsigned pad; ///< index of the pad to be exported
57 struct AVFilterGraphDescExport *next;
58 } AVFilterGraphDescExport;
60 /** Sections of a filter graph description */
68 } AVFilterGraphDescSection;
70 /** Description of a graph to be loaded from a file, etc */
73 AVFilterGraphDescFilter *filters; ///< filters in the graph
74 AVFilterGraphDescLink *links; ///< links between the filters
75 AVFilterGraphDescExport *inputs; ///< inputs to export
76 AVFilterGraphDescExport *outputs; ///< outputs to export
81 AVFilterGraphDescSection section; ///< current section being parsed
83 AVFilterGraphDescFilter **filterp; ///< last parsed filter
84 AVFilterGraphDescLink **linkp; ///< last parsed link
85 AVFilterGraphDescExport **inputp; ///< last parsed exported input
86 AVFilterGraphDescExport **outputp; ///< last parsed exported output
87 } AVFilterGraphDescParser;
90 * Parse a graph composed of a simple chain of filters which is described by
92 * @param filters String listing filters and their arguments.
93 * @return The parsed graph description.
95 AVFilterGraphDesc *avfilter_graph_parse_chain(const char *filters);
97 /** Parse a line of a filter graph description.
98 * @param desc Pointer to an AVFilterGraphDesc pointer. If *desc is NULL,
99 * a new AVFilterGraphDesc structure will be created for you.
100 * Must be the same between multiple invocations when parsing
101 * the same description.
102 * @param parser Parser state. Must be the same between multiple invocations
103 * when parsing the same description
104 * @param line Line of the graph description to parse.
105 * @return Zero on success, negative on error.
107 int avfilter_graph_parse_desc(AVFilterGraphDesc **desc,
108 AVFilterGraphDescParser **parser,
112 * Load a filter graph description from a file
113 * @param filename Name of the file from which to load the description
114 * @return Pointer to the description on success. NULL on failure
116 AVFilterGraphDesc *avfilter_graph_load_desc(const char *filename);
119 * Free a filter graph description
120 * @param desc The graph description to free
122 void avfilter_graph_free_desc(AVFilterGraphDesc *desc);
125 * Add an existing filter instance to a filter graph.
126 * @param graph The filter graph
127 * @param filter The filter to be added
129 void avfilter_graph_add_filter(AVFilterContext *graphctx, AVFilterContext *filter);
132 * Configure the formats of all the links in the graph
134 int avfilter_graph_config_formats(AVFilterContext *graphctx);
137 * Configure the resolution, etc of all links in the graph
139 int avfilter_graph_config_links(AVFilterContext *graphctx);
141 #endif /* FFMPEG_AVFILTER_H */