[FFmpeg-devel] [PATCH 3/3] Add avfilter_graph_config().
Stefano Sabatini
stefano.sabatini-lala
Thu Oct 14 11:47:26 CEST 2010
---
ffmpeg.c | 7 +------
ffplay.c | 6 ++----
libavfilter/avfiltergraph.c | 13 +++++++++++++
libavfilter/avfiltergraph.h | 8 ++++++++
4 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/ffmpeg.c b/ffmpeg.c
index bb4563d..c90375a 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -450,12 +450,7 @@ static int configure_filters(AVInputStream *ist, AVOutputStream *ost)
return ret;
}
- /* configure all the filter links */
- if ((ret = avfilter_graph_check_validity(graph, NULL)) < 0)
- return ret;
- if ((ret = avfilter_graph_config_formats(graph, NULL)) < 0)
- return ret;
- if ((ret = avfilter_graph_config_links(graph, NULL)) < 0)
+ if ((ret = avfilter_graph_config(graph, NULL)) < 0)
return ret;
codec->width = ist->output_video_filter->inputs[0]->w;
diff --git a/ffplay.c b/ffplay.c
index 93208e2..9db160e 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1849,10 +1849,8 @@ static int video_thread(void *arg)
avfilter_graph_add_filter(graph, filt_src);
avfilter_graph_add_filter(graph, filt_out);
- if(avfilter_graph_check_validity(graph, NULL)) goto the_end;
- if(avfilter_graph_config_formats(graph, NULL)) goto the_end;
- if(avfilter_graph_config_links(graph, NULL)) goto the_end;
-
+ if (avfilter_graph_config(graph, NULL))
+ goto the_end;
is->out_video_filter = filt_out;
#endif
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 2123c28..baffc51 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -202,3 +202,16 @@ int avfilter_graph_config_formats(AVFilterGraph *graph, AVClass *log_ctx)
return 0;
}
+int avfilter_graph_config(AVFilterGraph *graphctx, AVClass *log_ctx)
+{
+ int ret;
+
+ if ((ret = avfilter_graph_check_validity(graphctx, log_ctx)))
+ return ret;
+ if ((ret = avfilter_graph_config_formats(graphctx, log_ctx)))
+ return ret;
+ if ((ret = avfilter_graph_config_links(graphctx, log_ctx)))
+ return ret;
+
+ return 0;
+}
diff --git a/libavfilter/avfiltergraph.h b/libavfilter/avfiltergraph.h
index 23fc57c..efb9cc0 100644
--- a/libavfilter/avfiltergraph.h
+++ b/libavfilter/avfiltergraph.h
@@ -70,6 +70,14 @@ int avfilter_graph_config_links(AVFilterGraph *graphctx, AVClass *log_ctx);
int avfilter_graph_config_formats(AVFilterGraph *graphctx, AVClass *log_ctx);
/**
+ * Check validity and configure all the links and formats in the graph.
+ *
+ * @see avfilter_graph_check_validity(), avfilter_graph_config_links(),
+ * avfilter_graph_config_formats()
+ */
+int avfilter_graph_config(AVFilterGraph *graphctx, AVClass *log_ctx);
+
+/**
* Free a graph and destroy its links.
*/
void avfilter_graph_destroy(AVFilterGraph *graph);
--
1.7.1
More information about the ffmpeg-devel
mailing list