[FFmpeg-cvslog] avfilter: add a pointer from links to graph.

Nicolas George git at videolan.org
Mon Apr 23 14:30:38 CEST 2012


ffmpeg | branch: master | Nicolas George <nicolas.george at normalesup.org> | Thu Apr 19 12:43:33 2012 +0200| [e0761feec4dc9d10bd0fa58a0472b69277563e92] | committer: Nicolas George

avfilter: add a pointer from links to graph.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e0761feec4dc9d10bd0fa58a0472b69277563e92
---

 libavfilter/avfilter.h      |    6 ++++++
 libavfilter/avfiltergraph.c |   16 ++++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index f110623..b0b8cd0 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -690,6 +690,12 @@ struct AVFilterLink {
     AVRational time_base;
 
     struct AVFilterPool *pool;
+
+    /**
+     * Graph the filter belongs to.
+     */
+    struct AVFilterGraph *graph;
+
 };
 
 /**
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 334d718..e46ace5 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -374,6 +374,21 @@ int ff_avfilter_graph_config_formats(AVFilterGraph *graph, AVClass *log_ctx)
     return 0;
 }
 
+static void ff_avfilter_graph_config_pointers(AVFilterGraph *graph,
+                                              AVClass *log_ctx)
+{
+    unsigned i, j;;
+    AVFilterContext *f;
+
+    for (i = 0; i < graph->filter_count; i++) {
+        f = graph->filters[i];
+        for (j = 0; j < f->input_count; j++)
+            f->inputs[j]->graph = graph;
+        for (j = 0; j < f->output_count; j++)
+            f->outputs[j]->graph = graph;
+    }
+}
+
 int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx)
 {
     int ret;
@@ -384,6 +399,7 @@ int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx)
         return ret;
     if ((ret = ff_avfilter_graph_config_links(graphctx, log_ctx)))
         return ret;
+    ff_avfilter_graph_config_pointers(graphctx, log_ctx);
 
     return 0;
 }



More information about the ffmpeg-cvslog mailing list