Browse code

Make filter graph description parsing code independent of the code to read said description from a file.

Commited in SoC by Bobby Bingham on 2007-12-22 17:16:21

Originally committed as revision 12714 to svn://svn.ffmpeg.org/ffmpeg/trunk

Vitor Sessak authored on 2008/04/05 05:07:50
Showing 1 changed files
... ...
@@ -57,6 +57,16 @@ typedef struct AVFilterGraphDescExport
57 57
     struct AVFilterGraphDescExport *next;
58 58
 } AVFilterGraphDescExport;
59 59
 
60
+/** Sections of a filter graph description */
61
+typedef enum
62
+{
63
+    SEC_NONE = 0,
64
+    SEC_FILTERS,
65
+    SEC_LINKS,
66
+    SEC_INPUTS,
67
+    SEC_OUTPUTS
68
+} AVFilterGraphDescSection;
69
+
60 70
 /** Description of a graph to be loaded from a file, etc */
61 71
 typedef struct
62 72
 {
... ...
@@ -66,6 +76,30 @@ typedef struct
66 66
     AVFilterGraphDescExport *outputs;   ///< outputs to export
67 67
 } AVFilterGraphDesc;
68 68
 
69
+typedef struct
70
+{
71
+    AVFilterGraphDescSection section;   ///< current section being parsed
72
+
73
+    AVFilterGraphDescFilter **filterp;  ///< last parsed filter
74
+    AVFilterGraphDescLink   **linkp;    ///< last parsed link
75
+    AVFilterGraphDescExport **inputp;   ///< last parsed exported input
76
+    AVFilterGraphDescExport **outputp;  ///< last parsed exported output
77
+} AVFilterGraphDescParser;
78
+
79
+/** Parse a line of a filter graph description.
80
+ * @param desc   Pointer to an AVFilterGraphDesc pointer. If *desc is NULL,
81
+ *               a new AVFilterGraphDesc structure will be created for you.
82
+ *               Must be the same between multiple invocations when parsing
83
+ *               the same description.
84
+ * @param parser Parser state. Must be the same between multiple invocations
85
+ *               when parsing the same description
86
+ * @param line   Line of the graph description to parse.
87
+ * @return       Zero on success, negative on error.
88
+ */
89
+int avfilter_graph_parse_desc(AVFilterGraphDesc **desc,
90
+                              AVFilterGraphDescParser **parser,
91
+                              char *line);
92
+
69 93
 /**
70 94
  * Load a filter graph description from a file
71 95
  * @param filename Name of the file from which to load the description