Browse code

avfiltergraph: change the syntax of avfilter_graph_parse()

Make it returns the list of open inputs and outputs, so it can be
reused by applications.

Breaks API/ABI.

Stefano Sabatini authored on 2011/06/11 22:16:02
Showing 6 changed files
... ...
@@ -13,6 +13,9 @@ libavutil:   2011-04-18
13 13
 
14 14
 API changes, most recent first:
15 15
 
16
+2011-06-12 - xxxxxxx - lavfi 2.16.0 - avfilter_graph_parse()
17
+  Change avfilter_graph_parse() signature.
18
+
16 19
 2011-06-xx - xxxxxxx - lavu 51.6.0 - opt.h
17 20
   Add av_opt_flag_is_set().
18 21
 
... ...
@@ -418,7 +418,7 @@ static int configure_video_filters(AVInputStream *ist, AVOutputStream *ost)
418 418
         inputs->pad_idx = 0;
419 419
         inputs->next    = NULL;
420 420
 
421
-        if ((ret = avfilter_graph_parse(ost->graph, ost->avfilter, inputs, outputs, NULL)) < 0)
421
+        if ((ret = avfilter_graph_parse(ost->graph, ost->avfilter, &inputs, &outputs, NULL)) < 0)
422 422
             return ret;
423 423
         av_freep(&ost->avfilter);
424 424
     } else {
... ...
@@ -1708,7 +1708,7 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
1708 1708
         inputs->pad_idx = 0;
1709 1709
         inputs->next    = NULL;
1710 1710
 
1711
-        if ((ret = avfilter_graph_parse(graph, vfilters, inputs, outputs, NULL)) < 0)
1711
+        if ((ret = avfilter_graph_parse(graph, vfilters, &inputs, &outputs, NULL)) < 0)
1712 1712
             goto the_end;
1713 1713
         av_freep(&vfilters);
1714 1714
     } else {
... ...
@@ -26,8 +26,8 @@
26 26
 #include "libavutil/samplefmt.h"
27 27
 
28 28
 #define LIBAVFILTER_VERSION_MAJOR  2
29
-#define LIBAVFILTER_VERSION_MINOR 15
30
-#define LIBAVFILTER_VERSION_MICRO  1
29
+#define LIBAVFILTER_VERSION_MINOR 16
30
+#define LIBAVFILTER_VERSION_MICRO  0
31 31
 
32 32
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
33 33
                                                LIBAVFILTER_VERSION_MINOR, \
... ...
@@ -112,12 +112,14 @@ typedef struct AVFilterInOut {
112 112
  *
113 113
  * @param graph   the filter graph where to link the parsed graph context
114 114
  * @param filters string to be parsed
115
- * @param inputs  linked list to the inputs of the graph
116
- * @param outputs linked list to the outputs of the graph
115
+ * @param inputs  linked list to the inputs of the graph, may be NULL.
116
+ *                It is updated to contain the list of open inputs after the parsing.
117
+ * @param outputs linked list to the outputs of the graph, may be NULL.
118
+ *                It is updated to contain the list of open outputs after the parsing.
117 119
  * @return zero on success, a negative AVERROR code on error
118 120
  */
119 121
 int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
120
-                         AVFilterInOut *inputs, AVFilterInOut *outputs,
122
+                         AVFilterInOut **inputs, AVFilterInOut **outputs,
121 123
                          void *log_ctx);
122 124
 
123 125
 #endif /* AVFILTER_AVFILTERGRAPH_H */
... ...
@@ -328,8 +328,8 @@ static int parse_outputs(const char **buf, AVFilterInOut **curr_inputs,
328 328
 }
329 329
 
330 330
 int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
331
-                         AVFilterInOut *open_inputs,
332
-                         AVFilterInOut *open_outputs, void *log_ctx)
331
+                         AVFilterInOut **open_inputs, AVFilterInOut **open_outputs,
332
+                         void *log_ctx)
333 333
 {
334 334
     int index = 0, ret;
335 335
     char chr = 0;
... ...
@@ -341,7 +341,7 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
341 341
         const char *filterchain = filters;
342 342
         filters += strspn(filters, WHITESPACES);
343 343
 
344
-        if ((ret = parse_inputs(&filters, &curr_inputs, &open_outputs, log_ctx)) < 0)
344
+        if ((ret = parse_inputs(&filters, &curr_inputs, open_outputs, log_ctx)) < 0)
345 345
             goto fail;
346 346
 
347 347
         if ((ret = parse_filter(&filter, &filters, graph, index, log_ctx)) < 0)
... ...
@@ -350,14 +350,14 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
350 350
         if (filter->input_count == 1 && !curr_inputs && !index) {
351 351
             /* First input can be omitted if it is "[in]" */
352 352
             const char *tmp = "[in]";
353
-            if ((ret = parse_inputs(&tmp, &curr_inputs, &open_outputs, log_ctx)) < 0)
353
+            if ((ret = parse_inputs(&tmp, &curr_inputs, open_outputs, log_ctx)) < 0)
354 354
                 goto fail;
355 355
         }
356 356
 
357
-        if ((ret = link_filter_inouts(filter, &curr_inputs, &open_inputs, log_ctx)) < 0)
357
+        if ((ret = link_filter_inouts(filter, &curr_inputs, open_inputs, log_ctx)) < 0)
358 358
             goto fail;
359 359
 
360
-        if ((ret = parse_outputs(&filters, &curr_inputs, &open_inputs, &open_outputs,
360
+        if ((ret = parse_outputs(&filters, &curr_inputs, open_inputs, open_outputs,
361 361
                                  log_ctx)) < 0)
362 362
             goto fail;
363 363
 
... ...
@@ -382,10 +382,10 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
382 382
         goto fail;
383 383
     }
384 384
 
385
-    if (open_inputs && !strcmp(open_inputs->name, "out") && curr_inputs) {
385
+    if (*open_inputs && !strcmp((*open_inputs)->name, "out") && curr_inputs) {
386 386
         /* Last output can be omitted if it is "[out]" */
387 387
         const char *tmp = "[out]";
388
-        if ((ret = parse_outputs(&tmp, &curr_inputs, &open_inputs, &open_outputs,
388
+        if ((ret = parse_outputs(&tmp, &curr_inputs, open_inputs, open_outputs,
389 389
                                  log_ctx)) < 0)
390 390
             goto fail;
391 391
     }
... ...
@@ -396,8 +396,8 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
396 396
     for (; graph->filter_count > 0; graph->filter_count--)
397 397
         avfilter_free(graph->filters[graph->filter_count - 1]);
398 398
     av_freep(&graph->filters);
399
-    free_inout(open_inputs);
400
-    free_inout(open_outputs);
399
+    free_inout(*open_inputs);
400
+    free_inout(*open_outputs);
401 401
     free_inout(curr_inputs);
402 402
     return ret;
403 403
 }