Browse code

Change the signature of parse_filter() to make it return an error code.

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

Stefano Sabatini authored on 2010/11/08 03:39:54
Showing 1 changed files
... ...
@@ -141,12 +141,11 @@ static int create_filter(AVFilterContext **filt_ctx, AVFilterGraph *ctx, int ind
141 141
 /**
142 142
  * Parse "filter=params"
143 143
  */
144
-static AVFilterContext *parse_filter(const char **buf, AVFilterGraph *graph,
145
-                                     int index, AVClass *log_ctx)
144
+static int parse_filter(AVFilterContext **filt_ctx, const char **buf, AVFilterGraph *graph,
145
+                        int index, AVClass *log_ctx)
146 146
 {
147 147
     char *opts = NULL;
148 148
     char *name = av_get_token(buf, "=,;[\n");
149
-    AVFilterContext *filt_ctx;
150 149
     int ret;
151 150
 
152 151
     if (**buf == '=') {
... ...
@@ -154,10 +153,10 @@ static AVFilterContext *parse_filter(const char **buf, AVFilterGraph *graph,
154 154
         opts = av_get_token(buf, "[],;\n");
155 155
     }
156 156
 
157
-    ret = create_filter(&filt_ctx, graph, index, name, opts, log_ctx);
157
+    ret = create_filter(filt_ctx, graph, index, name, opts, log_ctx);
158 158
     av_free(name);
159 159
     av_free(opts);
160
-    return filt_ctx;
160
+    return ret;
161 161
 }
162 162
 
163 163
 static void free_inout(AVFilterInOut *head)
... ...
@@ -326,9 +325,7 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
326 326
         if (parse_inputs(&filters, &curr_inputs, &open_outputs, log_ctx) < 0)
327 327
             goto fail;
328 328
 
329
-        filter = parse_filter(&filters, graph, index, log_ctx);
330
-
331
-        if (!filter)
329
+        if (parse_filter(&filter, &filters, graph, index, log_ctx) < 0)
332 330
             goto fail;
333 331
 
334 332
         if (filter->input_count == 1 && !curr_inputs && !index) {