Browse code

Add avfilter_graph_config().

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

Stefano Sabatini authored on 2010/10/16 19:20:53
Showing 7 changed files
... ...
@@ -13,6 +13,9 @@ libavutil:   2009-03-08
13 13
 
14 14
 API changes, most recent first:
15 15
 
16
+2010-10-16 - r25502 - lavfi 1.52.0 - avfilter_graph_config()
17
+  Add the function avfilter_graph_config() in avfiltergraph.h.
18
+
16 19
 2010-10-15 - r25493 - lavf 52.83.0 - metadata API
17 20
   Change demuxers to export metadata in generic format and
18 21
   muxers to accept generic format. Deprecate the public
... ...
@@ -452,12 +452,7 @@ static int configure_filters(AVInputStream *ist, AVOutputStream *ost)
452 452
             return ret;
453 453
     }
454 454
 
455
-    /* configure all the filter links */
456
-    if ((ret = avfilter_graph_check_validity(graph, NULL)) < 0)
457
-        return ret;
458
-    if ((ret = avfilter_graph_config_formats(graph, NULL)) < 0)
459
-        return ret;
460
-    if ((ret = avfilter_graph_config_links(graph, NULL)) < 0)
455
+    if ((ret = avfilter_graph_config(graph, NULL)) < 0)
461 456
         return ret;
462 457
 
463 458
     codec->width  = ist->output_video_filter->inputs[0]->w;
... ...
@@ -1849,9 +1849,8 @@ static int video_thread(void *arg)
1849 1849
     avfilter_graph_add_filter(graph, filt_src);
1850 1850
     avfilter_graph_add_filter(graph, filt_out);
1851 1851
 
1852
-    if(avfilter_graph_check_validity(graph, NULL))           goto the_end;
1853
-    if(avfilter_graph_config_formats(graph, NULL))           goto the_end;
1854
-    if(avfilter_graph_config_links(graph, NULL))             goto the_end;
1852
+    if (avfilter_graph_config(graph, NULL) < 0)
1853
+        goto the_end;
1855 1854
 
1856 1855
     is->out_video_filter = filt_out;
1857 1856
 #endif
... ...
@@ -25,8 +25,8 @@
25 25
 #include "libavutil/avutil.h"
26 26
 
27 27
 #define LIBAVFILTER_VERSION_MAJOR  1
28
-#define LIBAVFILTER_VERSION_MINOR 51
29
-#define LIBAVFILTER_VERSION_MICRO  1
28
+#define LIBAVFILTER_VERSION_MINOR 52
29
+#define LIBAVFILTER_VERSION_MICRO  0
30 30
 
31 31
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
32 32
                                                LIBAVFILTER_VERSION_MINOR, \
... ...
@@ -202,3 +202,16 @@ int avfilter_graph_config_formats(AVFilterGraph *graph, AVClass *log_ctx)
202 202
     return 0;
203 203
 }
204 204
 
205
+int avfilter_graph_config(AVFilterGraph *graphctx, AVClass *log_ctx)
206
+{
207
+    int ret;
208
+
209
+    if ((ret = avfilter_graph_check_validity(graphctx, log_ctx)))
210
+        return ret;
211
+    if ((ret = avfilter_graph_config_formats(graphctx, log_ctx)))
212
+        return ret;
213
+    if ((ret = avfilter_graph_config_links(graphctx, log_ctx)))
214
+        return ret;
215
+
216
+    return 0;
217
+}
... ...
@@ -70,6 +70,14 @@ int avfilter_graph_config_links(AVFilterGraph *graphctx, AVClass *log_ctx);
70 70
 int avfilter_graph_config_formats(AVFilterGraph *graphctx, AVClass *log_ctx);
71 71
 
72 72
 /**
73
+ * Check validity and configure all the links and formats in the graph.
74
+ *
75
+ * @see avfilter_graph_check_validity(), avfilter_graph_config_links(),
76
+ * avfilter_graph_config_formats()
77
+ */
78
+int avfilter_graph_config(AVFilterGraph *graphctx, AVClass *log_ctx);
79
+
80
+/**
73 81
  * Free a graph and destroy its links.
74 82
  */
75 83
 void avfilter_graph_destroy(AVFilterGraph *graph);
... ...
@@ -152,9 +152,7 @@ int main(int argc, char **argv)
152 152
         return 1;
153 153
     }
154 154
 
155
-    if (avfilter_graph_check_validity(graph, NULL) ||
156
-        avfilter_graph_config_formats(graph, NULL) ||
157
-        avfilter_graph_config_links  (graph, NULL))
155
+    if (avfilter_graph_config(graph, NULL) < 0)
158 156
         return 1;
159 157
 
160 158
     print_digraph(outfile, graph);