[FFmpeg-cvslog] r16809 - in trunk/libavfilter: avfilter.h avfiltergraph.c avfiltergraph.h

stefano subversion
Mon Jan 26 21:21:26 CET 2009


Author: stefano
Date: Mon Jan 26 21:21:25 2009
New Revision: 16809

Log:
Implement avfilter_graph_check_validity().

Modified:
   trunk/libavfilter/avfilter.h
   trunk/libavfilter/avfiltergraph.c
   trunk/libavfilter/avfiltergraph.h

Modified: trunk/libavfilter/avfilter.h
==============================================================================
--- trunk/libavfilter/avfilter.h	Mon Jan 26 20:46:47 2009	(r16808)
+++ trunk/libavfilter/avfilter.h	Mon Jan 26 21:21:25 2009	(r16809)
@@ -23,7 +23,7 @@
 #define AVFILTER_AVFILTER_H
 
 #define LIBAVFILTER_VERSION_MAJOR  0
-#define LIBAVFILTER_VERSION_MINOR  2
+#define LIBAVFILTER_VERSION_MINOR  3
 #define LIBAVFILTER_VERSION_MICRO  0
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \

Modified: trunk/libavfilter/avfiltergraph.c
==============================================================================
--- trunk/libavfilter/avfiltergraph.c	Mon Jan 26 20:46:47 2009	(r16808)
+++ trunk/libavfilter/avfiltergraph.c	Mon Jan 26 21:21:25 2009	(r16809)
@@ -46,6 +46,36 @@ int avfilter_graph_add_filter(AVFilterGr
     return 0;
 }
 
+int avfilter_graph_check_validity(AVFilterGraph *graph, AVClass *log_ctx)
+{
+    AVFilterContext *filt;
+    int i, j;
+
+    for (i=0; i < graph->filter_count; i++) {
+        filt = graph->filters[i];
+
+        for (j = 0; j < filt->input_count; j++) {
+            if (!filt->inputs[j] || !filt->inputs[j]->src) {
+                av_log(log_ctx, AV_LOG_ERROR,
+                       "Input pad \"%s\" for the filter \"%s\" of type \"%s\" not connected to any source\n",
+                       filt->input_pads[j].name, filt->name, filt->filter->name);
+                return -1;
+            }
+        }
+
+        for (j = 0; j < filt->output_count; j++) {
+            if (!filt->outputs[j] || !filt->outputs[j]->dst) {
+                av_log(log_ctx, AV_LOG_ERROR,
+                       "Output pad \"%s\" for the filter \"%s\" of type \"%s\" not connected to any destination\n",
+                       filt->output_pads[j].name, filt->name, filt->filter->name);
+                return -1;
+            }
+        }
+    }
+
+    return 0;
+}
+
 AVFilterContext *avfilter_graph_get_filter(AVFilterGraph *graph, char *name)
 {
     int i;

Modified: trunk/libavfilter/avfiltergraph.h
==============================================================================
--- trunk/libavfilter/avfiltergraph.h	Mon Jan 26 20:46:47 2009	(r16808)
+++ trunk/libavfilter/avfiltergraph.h	Mon Jan 26 21:21:25 2009	(r16809)
@@ -45,6 +45,16 @@ AVFilterContext *avfilter_graph_get_filt
 int avfilter_graph_add_filter(AVFilterGraph *graphctx, AVFilterContext *filter);
 
 /**
+ * Check for the validity of \p graph.
+ *
+ * A graph is considered valid if all its input and output pads are
+ * connected.
+ *
+ * @return 0 in case of success, a negative value otherwise
+ */
+int avfilter_graph_check_validity(AVFilterGraph *graphctx, AVClass *log_ctx);
+
+/**
  * Configure the formats of all the links in the graph.
  */
 int avfilter_graph_config_formats(AVFilterGraph *graphctx);




More information about the ffmpeg-cvslog mailing list