summaryrefslogtreecommitdiff
path: root/libavfilter
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2012-06-01 14:46:54 +0200
committerStefano Sabatini <stefasab@gmail.com>2012-06-04 00:54:57 +0200
commit4d6a8a2bdb19c4380cc458759b7bd221942a028f (patch)
tree1488a8dd15ae00c556a1363e760370fcce8a597b /libavfilter
parent7d82020fcb7f81fcbbd30b7546ba62af45f1a33c (diff)
lavfi: add avfilter_default_filter_name()
The function is modelled after av_default_item_name(), and will print the name of the instance filter if defined, otherwise the name of the filter. This allows to show the instance name in the log, which is useful when debugging complex filter graphs.
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/af_aformat.c2
-rw-r--r--libavfilter/af_amix.c2
-rw-r--r--libavfilter/af_asyncts.c2
-rw-r--r--libavfilter/af_silencedetect.c7
-rw-r--r--libavfilter/asrc_aevalsrc.c7
-rw-r--r--libavfilter/asrc_anullsrc.c7
-rw-r--r--libavfilter/avfilter.c8
-rw-r--r--libavfilter/avfilter.h6
-rw-r--r--libavfilter/avfiltergraph.c2
-rw-r--r--libavfilter/buffersrc.c2
-rw-r--r--libavfilter/src_movie.c7
-rw-r--r--libavfilter/version.h2
-rw-r--r--libavfilter/vf_ass.c7
-rw-r--r--libavfilter/vf_blackdetect.c7
-rw-r--r--libavfilter/vf_delogo.c7
-rw-r--r--libavfilter/vf_drawtext.c7
-rw-r--r--libavfilter/vf_fade.c7
-rw-r--r--libavfilter/vf_fps.c2
-rw-r--r--libavfilter/vf_lut.c7
-rw-r--r--libavfilter/vf_overlay.c7
-rw-r--r--libavfilter/vsrc_cellauto.c7
-rw-r--r--libavfilter/vsrc_life.c7
-rw-r--r--libavfilter/vsrc_mandelbrot.c7
-rw-r--r--libavfilter/vsrc_mptestsrc.c7
-rw-r--r--libavfilter/vsrc_testsrc.c21
25 files changed, 35 insertions, 119 deletions
diff --git a/libavfilter/af_aformat.c b/libavfilter/af_aformat.c
index 35e7db880a..1fcaee7535 100644
--- a/libavfilter/af_aformat.c
+++ b/libavfilter/af_aformat.c
@@ -55,7 +55,7 @@ static const AVOption options[] = {
static const AVClass aformat_class = {
.class_name = "aformat filter",
- .item_name = av_default_item_name,
+ .item_name = avfilter_default_filter_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_FILTER,
diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c
index d4af9a4234..03e643a012 100644
--- a/libavfilter/af_amix.c
+++ b/libavfilter/af_amix.c
@@ -186,7 +186,7 @@ static const AVOption options[] = {
static const AVClass amix_class = {
.class_name = "amix filter",
- .item_name = av_default_item_name,
+ .item_name = avfilter_default_filter_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
};
diff --git a/libavfilter/af_asyncts.c b/libavfilter/af_asyncts.c
index adb5347a80..1d97f1ad6a 100644
--- a/libavfilter/af_asyncts.c
+++ b/libavfilter/af_asyncts.c
@@ -50,7 +50,7 @@ static const AVOption options[] = {
static const AVClass async_class = {
.class_name = "asyncts filter",
- .item_name = av_default_item_name,
+ .item_name = avfilter_default_filter_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
};
diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c
index 76001ce1d9..b8057e4393 100644
--- a/libavfilter/af_silencedetect.c
+++ b/libavfilter/af_silencedetect.c
@@ -48,14 +48,9 @@ static const AVOption silencedetect_options[] = {
{ NULL },
};
-static const char *silencedetect_get_name(void *ctx)
-{
- return "silencedetect";
-}
-
static const AVClass silencedetect_class = {
.class_name = "SilenceDetectContext",
- .item_name = silencedetect_get_name,
+ .item_name = avfilter_default_filter_name,
.option = silencedetect_options,
};
diff --git a/libavfilter/asrc_aevalsrc.c b/libavfilter/asrc_aevalsrc.c
index f259d142e9..b336b57922 100644
--- a/libavfilter/asrc_aevalsrc.c
+++ b/libavfilter/asrc_aevalsrc.c
@@ -78,14 +78,9 @@ static const AVOption eval_options[]= {
{NULL},
};
-static const char *eval_get_name(void *ctx)
-{
- return "aevalsrc";
-}
-
static const AVClass eval_class = {
"AEvalSrcContext",
- eval_get_name,
+ avfilter_default_filter_name,
eval_options
};
diff --git a/libavfilter/asrc_anullsrc.c b/libavfilter/asrc_anullsrc.c
index 61fdc3241e..6cd49e60fe 100644
--- a/libavfilter/asrc_anullsrc.c
+++ b/libavfilter/asrc_anullsrc.c
@@ -53,14 +53,9 @@ static const AVOption anullsrc_options[]= {
{ NULL },
};
-static const char *anullsrc_get_name(void *ctx)
-{
- return "anullsrc";
-}
-
static const AVClass anullsrc_class = {
"ANullSrcContext",
- anullsrc_get_name,
+ avfilter_default_filter_name,
anullsrc_options
};
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 0c3e7edb11..b56106a857 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -366,15 +366,15 @@ static int pad_count(const AVFilterPad *pads)
return count;
}
-static const char *filter_name(void *p)
+const char *avfilter_default_filter_name(void *filter_ctx)
{
- AVFilterContext *filter = p;
- return filter->filter->name;
+ AVFilterContext *ctx = filter_ctx;
+ return ctx->name ? ctx->name : ctx->filter->name;
}
static const AVClass avfilter_class = {
.class_name = "AVFilter",
- .item_name = filter_name,
+ .item_name = avfilter_default_filter_name,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_FILTER,
};
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index c9d63d65f7..10803c54fa 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -634,6 +634,12 @@ struct AVFilterContext {
struct AVFilterCommand *command_queue;
};
+/**
+ * Print the name of the filter given a filter context.
+ */
+const char *avfilter_default_filter_name(void *filter_ctx);
+
+
#if FF_API_PACKING
enum AVFilterPacking {
AVFILTER_PACKED = 0,
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 8d2312e05d..3918a0fcb0 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -36,7 +36,7 @@
static const AVClass filtergraph_class = {
.class_name = "AVFilterGraph",
- .item_name = av_default_item_name,
+ .item_name = avfilter_default_filter_name,
.version = LIBAVUTIL_VERSION_INT,
};
diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index 0c60caf942..6536542b1e 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -255,7 +255,7 @@ static const AVOption audio_options[] = {
static const AVClass abuffer_class = {
.class_name = "abuffer source",
- .item_name = av_default_item_name,
+ .item_name = avfilter_default_filter_name,
.option = audio_options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_FILTER,
diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
index 21e4e3f122..8262e0027a 100644
--- a/libavfilter/src_movie.c
+++ b/libavfilter/src_movie.c
@@ -78,14 +78,9 @@ static const AVOption movie_options[]= {
{NULL},
};
-static const char *movie_get_name(void *ctx)
-{
- return "movie";
-}
-
static const AVClass movie_class = {
"MovieContext",
- movie_get_name,
+ avfilter_default_filter_name,
movie_options
};
diff --git a/libavfilter/version.h b/libavfilter/version.h
index c44c45ee5e..76f649ea01 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -29,7 +29,7 @@
#include "libavutil/avutil.h"
#define LIBAVFILTER_VERSION_MAJOR 2
-#define LIBAVFILTER_VERSION_MINOR 77
+#define LIBAVFILTER_VERSION_MINOR 78
#define LIBAVFILTER_VERSION_MICRO 100
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
diff --git a/libavfilter/vf_ass.c b/libavfilter/vf_ass.c
index c828699ae1..3503b2665f 100644
--- a/libavfilter/vf_ass.c
+++ b/libavfilter/vf_ass.c
@@ -54,14 +54,9 @@ static const AVOption ass_options[] = {
{NULL},
};
-static const char *ass_get_name(void *ctx)
-{
- return "ass";
-}
-
static const AVClass ass_class = {
"AssContext",
- ass_get_name,
+ avfilter_default_filter_name,
ass_options
};
diff --git a/libavfilter/vf_blackdetect.c b/libavfilter/vf_blackdetect.c
index ea45f0522e..909cb377bf 100644
--- a/libavfilter/vf_blackdetect.c
+++ b/libavfilter/vf_blackdetect.c
@@ -57,14 +57,9 @@ static const AVOption blackdetect_options[] = {
{ NULL },
};
-static const char *blackdetect_get_name(void *ctx)
-{
- return "blackdetect";
-}
-
static const AVClass blackdetect_class = {
.class_name = "BlackDetectContext",
- .item_name = blackdetect_get_name,
+ .item_name = avfilter_default_filter_name,
.option = blackdetect_options,
};
diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c
index ffef1c7155..e0dc9a2d6f 100644
--- a/libavfilter/vf_delogo.c
+++ b/libavfilter/vf_delogo.c
@@ -149,14 +149,9 @@ static const AVOption delogo_options[]= {
{NULL},
};
-static const char *delogo_get_name(void *ctx)
-{
- return "delogo";
-}
-
static const AVClass delogo_class = {
.class_name = "DelogoContext",
- .item_name = delogo_get_name,
+ .item_name = avfilter_default_filter_name,
.option = delogo_options,
};
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index 898bbd40c4..c51341b8b5 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -205,14 +205,9 @@ static const AVOption drawtext_options[]= {
{NULL},
};
-static const char *drawtext_get_name(void *ctx)
-{
- return "drawtext";
-}
-
static const AVClass drawtext_class = {
"DrawTextContext",
- drawtext_get_name,
+ avfilter_default_filter_name,
drawtext_options
};
diff --git a/libavfilter/vf_fade.c b/libavfilter/vf_fade.c
index a38387f184..6c795b0da9 100644
--- a/libavfilter/vf_fade.c
+++ b/libavfilter/vf_fade.c
@@ -69,14 +69,9 @@ static const AVOption fade_options[] = {
{NULL},
};
-static const char *fade_get_name(void *ctx)
-{
- return "fade";
-}
-
static const AVClass fade_class = {
"FadeContext",
- fade_get_name,
+ avfilter_default_filter_name,
fade_options
};
diff --git a/libavfilter/vf_fps.c b/libavfilter/vf_fps.c
index d12070c49a..cd66e3fe0a 100644
--- a/libavfilter/vf_fps.c
+++ b/libavfilter/vf_fps.c
@@ -60,7 +60,7 @@ static const AVOption options[] = {
static const AVClass class = {
.class_name = "FPS filter",
- .item_name = av_default_item_name,
+ .item_name = avfilter_default_filter_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
};
diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c
index c0b8607953..831a8bff9a 100644
--- a/libavfilter/vf_lut.c
+++ b/libavfilter/vf_lut.c
@@ -89,14 +89,9 @@ static const AVOption lut_options[] = {
{NULL},
};
-static const char *lut_get_name(void *ctx)
-{
- return "lut";
-}
-
static const AVClass lut_class = {
"LutContext",
- lut_get_name,
+ avfilter_default_filter_name,
lut_options
};
diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index 65712a8cde..8217f6da52 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -101,14 +101,9 @@ static const AVOption overlay_options[] = {
{NULL},
};
-static const char *overlay_get_name(void *ctx)
-{
- return "overlay";
-}
-
static const AVClass overlay_class = {
"OverlayContext",
- overlay_get_name,
+ avfilter_default_filter_name,
overlay_options
};
diff --git a/libavfilter/vsrc_cellauto.c b/libavfilter/vsrc_cellauto.c
index d17b5e453c..93bdded590 100644
--- a/libavfilter/vsrc_cellauto.c
+++ b/libavfilter/vsrc_cellauto.c
@@ -76,14 +76,9 @@ static const AVOption cellauto_options[] = {
{ NULL },
};
-static const char *cellauto_get_name(void *ctx)
-{
- return "cellauto";
-}
-
static const AVClass cellauto_class = {
"CellAutoContext",
- cellauto_get_name,
+ avfilter_default_filter_name,
cellauto_options
};
diff --git a/libavfilter/vsrc_life.c b/libavfilter/vsrc_life.c
index 028c90bc2d..9b6305dfd9 100644
--- a/libavfilter/vsrc_life.c
+++ b/libavfilter/vsrc_life.c
@@ -95,14 +95,9 @@ static const AVOption life_options[] = {
{ NULL },
};
-static const char *life_get_name(void *ctx)
-{
- return "life";
-}
-
static const AVClass life_class = {
"LifeContext",
- life_get_name,
+ avfilter_default_filter_name,
life_options
};
diff --git a/libavfilter/vsrc_mandelbrot.c b/libavfilter/vsrc_mandelbrot.c
index 9d442007e3..92b4b387e8 100644
--- a/libavfilter/vsrc_mandelbrot.c
+++ b/libavfilter/vsrc_mandelbrot.c
@@ -103,14 +103,9 @@ static const AVOption mandelbrot_options[] = {
{NULL},
};
-static const char *mandelbrot_get_name(void *ctx)
-{
- return "mandelbrot";
-}
-
static const AVClass mandelbrot_class = {
"MBContext",
- mandelbrot_get_name,
+ avfilter_default_filter_name,
mandelbrot_options
};
diff --git a/libavfilter/vsrc_mptestsrc.c b/libavfilter/vsrc_mptestsrc.c
index 3043204d2f..c7521dfd22 100644
--- a/libavfilter/vsrc_mptestsrc.c
+++ b/libavfilter/vsrc_mptestsrc.c
@@ -82,14 +82,9 @@ static const AVOption mptestsrc_options[]= {
{ NULL },
};
-static const char *mptestsrc_get_name(void *ctx)
-{
- return "mptestsrc";
-}
-
static const AVClass mptestsrc_class = {
"MPTestContext",
- mptestsrc_get_name,
+ avfilter_default_filter_name,
mptestsrc_options
};
diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index 7cf29eeefc..95bf168fc4 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -156,14 +156,9 @@ static int request_frame(AVFilterLink *outlink)
#if CONFIG_NULLSRC_FILTER
-static const char *nullsrc_get_name(void *ctx)
-{
- return "nullsrc";
-}
-
static const AVClass nullsrc_class = {
.class_name = "NullSourceContext",
- .item_name = nullsrc_get_name,
+ .item_name = avfilter_default_filter_name,
.option = testsrc_options,
};
@@ -196,14 +191,9 @@ AVFilter avfilter_vsrc_nullsrc = {
#if CONFIG_TESTSRC_FILTER
-static const char *testsrc_get_name(void *ctx)
-{
- return "testsrc";
-}
-
static const AVClass testsrc_class = {
.class_name = "TestSourceContext",
- .item_name = testsrc_get_name,
+ .item_name = avfilter_default_filter_name,
.option = testsrc_options,
};
@@ -423,14 +413,9 @@ AVFilter avfilter_vsrc_testsrc = {
#if CONFIG_RGBTESTSRC_FILTER
-static const char *rgbtestsrc_get_name(void *ctx)
-{
- return "rgbtestsrc";
-}
-
static const AVClass rgbtestsrc_class = {
.class_name = "RGBTestSourceContext",
- .item_name = rgbtestsrc_get_name,
+ .item_name = avfilter_default_filter_name,
.option = testsrc_options,
};