[FFmpeg-cvslog] avfiltergraph: add an AVClass to AVFilterGraph on next major bump.

Anton Khirnov git at videolan.org
Mon Apr 2 00:52:51 CEST 2012


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sun Mar 18 11:27:38 2012 +0100| [996f9f0c3280552d293c3dbe4266938927fd5908] | committer: Anton Khirnov

avfiltergraph: add an AVClass to AVFilterGraph on next major bump.

It will be used for logging, possibly also AVOptions.

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

 libavfilter/avfiltergraph.c |   16 +++++++++++++++-
 libavfilter/avfiltergraph.h |    4 ++++
 libavfilter/version.h       |    8 ++++++++
 3 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 8c43251..9b73cc9 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -27,9 +27,23 @@
 #include "avfiltergraph.h"
 #include "internal.h"
 
+#include "libavutil/log.h"
+
+static const AVClass filtergraph_class = {
+    .class_name = "AVFilterGraph",
+    .item_name  = av_default_item_name,
+    .version    = LIBAVUTIL_VERSION_INT,
+};
+
 AVFilterGraph *avfilter_graph_alloc(void)
 {
-    return av_mallocz(sizeof(AVFilterGraph));
+    AVFilterGraph *ret = av_mallocz(sizeof(AVFilterGraph));
+    if (!ret)
+        return NULL;
+#if FF_API_GRAPH_AVCLASS
+    ret->av_class = &filtergraph_class;
+#endif
+    return ret;
 }
 
 void avfilter_graph_free(AVFilterGraph **graph)
diff --git a/libavfilter/avfiltergraph.h b/libavfilter/avfiltergraph.h
index f9cf5cd..733d1c4 100644
--- a/libavfilter/avfiltergraph.h
+++ b/libavfilter/avfiltergraph.h
@@ -23,8 +23,12 @@
 #define AVFILTER_AVFILTERGRAPH_H
 
 #include "avfilter.h"
+#include "libavutil/log.h"
 
 typedef struct AVFilterGraph {
+#if FF_API_GRAPH_AVCLASS
+    const AVClass *av_class;
+#endif
     unsigned filter_count;
     AVFilterContext **filters;
 
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 09d6700..d84b67f 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -40,4 +40,12 @@
                                            LIBAVFILTER_VERSION_MICRO)
 #define LIBAVFILTER_BUILD       LIBAVFILTER_VERSION_INT
 
+/**
+ * Those FF_API_* defines are not part of public API.
+ * They may change, break or disappear at any time.
+ */
+#ifndef FF_API_GRAPH_AVCLASS
+#define FF_API_GRAPH_AVCLASS            (LIBAVFILTER_VERSION_MAJOR > 2)
+#endif
+
 #endif // AVFILTER_VERSION_H



More information about the ffmpeg-cvslog mailing list