1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

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.
This commit is contained in:
Stefano Sabatini 2012-06-01 14:46:54 +02:00
parent 7d82020fcb
commit 4d6a8a2bdb
26 changed files with 38 additions and 119 deletions

View File

@ -15,6 +15,9 @@ libavutil: 2011-04-18
API changes, most recent first:
2012-06-04 - xxxxxxx - lafi 2.78.100
Add avfilter_default_filter_name() function in avfilter.h.
2012-05-24 - xxxxxxx - lavu 51.54.100
Move AVPALETTE_SIZE and AVPALETTE_COUNT macros from
libavcodec/avcodec.h to libavutil/pixfmt.h.

View File

@ -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,

View File

@ -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,
};

View File

@ -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,
};

View File

@ -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,
};

View File

@ -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
};

View File

@ -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
};

View File

@ -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,
};

View File

@ -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,

View File

@ -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,
};

View File

@ -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,

View File

@ -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
};

View File

@ -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, \

View File

@ -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
};

View File

@ -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,
};

View File

@ -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,
};

View File

@ -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
};

View File

@ -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
};

View File

@ -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,
};

View File

@ -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
};

View File

@ -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
};

View File

@ -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
};

View File

@ -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
};

View File

@ -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
};

View File

@ -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
};

View File

@ -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,
};