summaryrefslogtreecommitdiff
path: root/libavfilter
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2009-01-26 20:21:25 +0000
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2009-01-26 20:21:25 +0000
commit822005ed45b994a30cd190312a74f1b144b6cd4a (patch)
tree58fe8c7ff08a2f8503f07b30981cf32c64ce9f4f /libavfilter
parente1b6bdbb834fed855a810a1003aa73842f4db456 (diff)
Implement avfilter_graph_check_validity().
Originally committed as revision 16809 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/avfilter.h2
-rw-r--r--libavfilter/avfiltergraph.c30
-rw-r--r--libavfilter/avfiltergraph.h10
3 files changed, 41 insertions, 1 deletions
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index f0d221c56b..61ce1ad27a 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -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, \
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index ccb275c6f9..72c0fd2ca2 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -46,6 +46,36 @@ int avfilter_graph_add_filter(AVFilterGraph *graph, AVFilterContext *filter)
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;
diff --git a/libavfilter/avfiltergraph.h b/libavfilter/avfiltergraph.h
index dee8a90425..716d9199f1 100644
--- a/libavfilter/avfiltergraph.h
+++ b/libavfilter/avfiltergraph.h
@@ -45,6 +45,16 @@ AVFilterContext *avfilter_graph_get_filter(AVFilterGraph *graph, char *name);
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);