]> git.sesse.net Git - ffmpeg/commitdiff
avfiltergraph: add an AVClass to AVFilterGraph on next major bump.
authorAnton Khirnov <anton@khirnov.net>
Sun, 18 Mar 2012 10:27:38 +0000 (11:27 +0100)
committerAnton Khirnov <anton@khirnov.net>
Sun, 1 Apr 2012 07:03:35 +0000 (09:03 +0200)
It will be used for logging, possibly also AVOptions.

libavfilter/avfiltergraph.c
libavfilter/avfiltergraph.h
libavfilter/version.h

index 8c43251c4cc11ce32fc1ef3a41fe0961351513ec..9b73cc95ab69807cacbac7a9f8778b1c7b7a12a3 100644 (file)
 #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)
index f9cf5cd3f900d204125f3fc719257cf25de052d1..733d1c4a51ce7ab90210c2ee731c8e2bf2dc0b4b 100644 (file)
 #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;
 
index 09d6700d1285573ad25937508824ac278b674b0c..d84b67ff761ea4ffa05f8524a482e09f66fe4459 100644 (file)
                                            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