Commit 4d6a8a2b authored by Stefano Sabatini's avatar Stefano Sabatini

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.
parent 7d82020f
...@@ -15,6 +15,9 @@ libavutil: 2011-04-18 ...@@ -15,6 +15,9 @@ libavutil: 2011-04-18
API changes, most recent first: 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 2012-05-24 - xxxxxxx - lavu 51.54.100
Move AVPALETTE_SIZE and AVPALETTE_COUNT macros from Move AVPALETTE_SIZE and AVPALETTE_COUNT macros from
libavcodec/avcodec.h to libavutil/pixfmt.h. libavcodec/avcodec.h to libavutil/pixfmt.h.
......
...@@ -55,7 +55,7 @@ static const AVOption options[] = { ...@@ -55,7 +55,7 @@ static const AVOption options[] = {
static const AVClass aformat_class = { static const AVClass aformat_class = {
.class_name = "aformat filter", .class_name = "aformat filter",
.item_name = av_default_item_name, .item_name = avfilter_default_filter_name,
.option = options, .option = options,
.version = LIBAVUTIL_VERSION_INT, .version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_FILTER, .category = AV_CLASS_CATEGORY_FILTER,
......
...@@ -186,7 +186,7 @@ static const AVOption options[] = { ...@@ -186,7 +186,7 @@ static const AVOption options[] = {
static const AVClass amix_class = { static const AVClass amix_class = {
.class_name = "amix filter", .class_name = "amix filter",
.item_name = av_default_item_name, .item_name = avfilter_default_filter_name,
.option = options, .option = options,
.version = LIBAVUTIL_VERSION_INT, .version = LIBAVUTIL_VERSION_INT,
}; };
......
...@@ -50,7 +50,7 @@ static const AVOption options[] = { ...@@ -50,7 +50,7 @@ static const AVOption options[] = {
static const AVClass async_class = { static const AVClass async_class = {
.class_name = "asyncts filter", .class_name = "asyncts filter",
.item_name = av_default_item_name, .item_name = avfilter_default_filter_name,
.option = options, .option = options,
.version = LIBAVUTIL_VERSION_INT, .version = LIBAVUTIL_VERSION_INT,
}; };
......
...@@ -48,14 +48,9 @@ static const AVOption silencedetect_options[] = { ...@@ -48,14 +48,9 @@ static const AVOption silencedetect_options[] = {
{ NULL }, { NULL },
}; };
static const char *silencedetect_get_name(void *ctx)
{
return "silencedetect";
}
static const AVClass silencedetect_class = { static const AVClass silencedetect_class = {
.class_name = "SilenceDetectContext", .class_name = "SilenceDetectContext",
.item_name = silencedetect_get_name, .item_name = avfilter_default_filter_name,
.option = silencedetect_options, .option = silencedetect_options,
}; };
......
...@@ -78,14 +78,9 @@ static const AVOption eval_options[]= { ...@@ -78,14 +78,9 @@ static const AVOption eval_options[]= {
{NULL}, {NULL},
}; };
static const char *eval_get_name(void *ctx)
{
return "aevalsrc";
}
static const AVClass eval_class = { static const AVClass eval_class = {
"AEvalSrcContext", "AEvalSrcContext",
eval_get_name, avfilter_default_filter_name,
eval_options eval_options
}; };
......
...@@ -53,14 +53,9 @@ static const AVOption anullsrc_options[]= { ...@@ -53,14 +53,9 @@ static const AVOption anullsrc_options[]= {
{ NULL }, { NULL },
}; };
static const char *anullsrc_get_name(void *ctx)
{
return "anullsrc";
}
static const AVClass anullsrc_class = { static const AVClass anullsrc_class = {
"ANullSrcContext", "ANullSrcContext",
anullsrc_get_name, avfilter_default_filter_name,
anullsrc_options anullsrc_options
}; };
......
...@@ -366,15 +366,15 @@ static int pad_count(const AVFilterPad *pads) ...@@ -366,15 +366,15 @@ static int pad_count(const AVFilterPad *pads)
return count; return count;
} }
static const char *filter_name(void *p) const char *avfilter_default_filter_name(void *filter_ctx)
{ {
AVFilterContext *filter = p; AVFilterContext *ctx = filter_ctx;
return filter->filter->name; return ctx->name ? ctx->name : ctx->filter->name;
} }
static const AVClass avfilter_class = { static const AVClass avfilter_class = {
.class_name = "AVFilter", .class_name = "AVFilter",
.item_name = filter_name, .item_name = avfilter_default_filter_name,
.version = LIBAVUTIL_VERSION_INT, .version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_FILTER, .category = AV_CLASS_CATEGORY_FILTER,
}; };
......
...@@ -634,6 +634,12 @@ struct AVFilterContext { ...@@ -634,6 +634,12 @@ struct AVFilterContext {
struct AVFilterCommand *command_queue; 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 #if FF_API_PACKING
enum AVFilterPacking { enum AVFilterPacking {
AVFILTER_PACKED = 0, AVFILTER_PACKED = 0,
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
static const AVClass filtergraph_class = { static const AVClass filtergraph_class = {
.class_name = "AVFilterGraph", .class_name = "AVFilterGraph",
.item_name = av_default_item_name, .item_name = avfilter_default_filter_name,
.version = LIBAVUTIL_VERSION_INT, .version = LIBAVUTIL_VERSION_INT,
}; };
......
...@@ -255,7 +255,7 @@ static const AVOption audio_options[] = { ...@@ -255,7 +255,7 @@ static const AVOption audio_options[] = {
static const AVClass abuffer_class = { static const AVClass abuffer_class = {
.class_name = "abuffer source", .class_name = "abuffer source",
.item_name = av_default_item_name, .item_name = avfilter_default_filter_name,
.option = audio_options, .option = audio_options,
.version = LIBAVUTIL_VERSION_INT, .version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_FILTER, .category = AV_CLASS_CATEGORY_FILTER,
......
...@@ -78,14 +78,9 @@ static const AVOption movie_options[]= { ...@@ -78,14 +78,9 @@ static const AVOption movie_options[]= {
{NULL}, {NULL},
}; };
static const char *movie_get_name(void *ctx)
{
return "movie";
}
static const AVClass movie_class = { static const AVClass movie_class = {
"MovieContext", "MovieContext",
movie_get_name, avfilter_default_filter_name,
movie_options movie_options
}; };
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "libavutil/avutil.h" #include "libavutil/avutil.h"
#define LIBAVFILTER_VERSION_MAJOR 2 #define LIBAVFILTER_VERSION_MAJOR 2
#define LIBAVFILTER_VERSION_MINOR 77 #define LIBAVFILTER_VERSION_MINOR 78
#define LIBAVFILTER_VERSION_MICRO 100 #define LIBAVFILTER_VERSION_MICRO 100
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
......
...@@ -54,14 +54,9 @@ static const AVOption ass_options[] = { ...@@ -54,14 +54,9 @@ static const AVOption ass_options[] = {
{NULL}, {NULL},
}; };
static const char *ass_get_name(void *ctx)
{
return "ass";
}
static const AVClass ass_class = { static const AVClass ass_class = {
"AssContext", "AssContext",
ass_get_name, avfilter_default_filter_name,
ass_options ass_options
}; };
......
...@@ -57,14 +57,9 @@ static const AVOption blackdetect_options[] = { ...@@ -57,14 +57,9 @@ static const AVOption blackdetect_options[] = {
{ NULL }, { NULL },
}; };
static const char *blackdetect_get_name(void *ctx)
{
return "blackdetect";
}
static const AVClass blackdetect_class = { static const AVClass blackdetect_class = {
.class_name = "BlackDetectContext", .class_name = "BlackDetectContext",
.item_name = blackdetect_get_name, .item_name = avfilter_default_filter_name,
.option = blackdetect_options, .option = blackdetect_options,
}; };
......
...@@ -149,14 +149,9 @@ static const AVOption delogo_options[]= { ...@@ -149,14 +149,9 @@ static const AVOption delogo_options[]= {
{NULL}, {NULL},
}; };
static const char *delogo_get_name(void *ctx)
{
return "delogo";
}
static const AVClass delogo_class = { static const AVClass delogo_class = {
.class_name = "DelogoContext", .class_name = "DelogoContext",
.item_name = delogo_get_name, .item_name = avfilter_default_filter_name,
.option = delogo_options, .option = delogo_options,
}; };
......
...@@ -205,14 +205,9 @@ static const AVOption drawtext_options[]= { ...@@ -205,14 +205,9 @@ static const AVOption drawtext_options[]= {
{NULL}, {NULL},
}; };
static const char *drawtext_get_name(void *ctx)
{
return "drawtext";
}
static const AVClass drawtext_class = { static const AVClass drawtext_class = {
"DrawTextContext", "DrawTextContext",
drawtext_get_name, avfilter_default_filter_name,
drawtext_options drawtext_options
}; };
......
...@@ -69,14 +69,9 @@ static const AVOption fade_options[] = { ...@@ -69,14 +69,9 @@ static const AVOption fade_options[] = {
{NULL}, {NULL},
}; };
static const char *fade_get_name(void *ctx)
{
return "fade";
}
static const AVClass fade_class = { static const AVClass fade_class = {
"FadeContext", "FadeContext",
fade_get_name, avfilter_default_filter_name,
fade_options fade_options
}; };
......
...@@ -60,7 +60,7 @@ static const AVOption options[] = { ...@@ -60,7 +60,7 @@ static const AVOption options[] = {
static const AVClass class = { static const AVClass class = {
.class_name = "FPS filter", .class_name = "FPS filter",
.item_name = av_default_item_name, .item_name = avfilter_default_filter_name,
.option = options, .option = options,
.version = LIBAVUTIL_VERSION_INT, .version = LIBAVUTIL_VERSION_INT,
}; };
......
...@@ -89,14 +89,9 @@ static const AVOption lut_options[] = { ...@@ -89,14 +89,9 @@ static const AVOption lut_options[] = {
{NULL}, {NULL},
}; };
static const char *lut_get_name(void *ctx)
{
return "lut";
}
static const AVClass lut_class = { static const AVClass lut_class = {
"LutContext", "LutContext",
lut_get_name, avfilter_default_filter_name,
lut_options lut_options
}; };
......
...@@ -101,14 +101,9 @@ static const AVOption overlay_options[] = { ...@@ -101,14 +101,9 @@ static const AVOption overlay_options[] = {
{NULL}, {NULL},
}; };
static const char *overlay_get_name(void *ctx)
{
return "overlay";
}
static const AVClass overlay_class = { static const AVClass overlay_class = {
"OverlayContext", "OverlayContext",
overlay_get_name, avfilter_default_filter_name,
overlay_options overlay_options
}; };
......
...@@ -76,14 +76,9 @@ static const AVOption cellauto_options[] = { ...@@ -76,14 +76,9 @@ static const AVOption cellauto_options[] = {
{ NULL }, { NULL },
}; };
static const char *cellauto_get_name(void *ctx)
{
return "cellauto";
}
static const AVClass cellauto_class = { static const AVClass cellauto_class = {
"CellAutoContext", "CellAutoContext",
cellauto_get_name, avfilter_default_filter_name,
cellauto_options cellauto_options
}; };
......
...@@ -95,14 +95,9 @@ static const AVOption life_options[] = { ...@@ -95,14 +95,9 @@ static const AVOption life_options[] = {
{ NULL }, { NULL },
}; };
static const char *life_get_name(void *ctx)
{
return "life";
}
static const AVClass life_class = { static const AVClass life_class = {
"LifeContext", "LifeContext",
life_get_name, avfilter_default_filter_name,
life_options life_options
}; };
......
...@@ -103,14 +103,9 @@ static const AVOption mandelbrot_options[] = { ...@@ -103,14 +103,9 @@ static const AVOption mandelbrot_options[] = {
{NULL}, {NULL},
}; };
static const char *mandelbrot_get_name(void *ctx)
{
return "mandelbrot";
}
static const AVClass mandelbrot_class = { static const AVClass mandelbrot_class = {
"MBContext", "MBContext",
mandelbrot_get_name, avfilter_default_filter_name,
mandelbrot_options mandelbrot_options
}; };
......
...@@ -82,14 +82,9 @@ static const AVOption mptestsrc_options[]= { ...@@ -82,14 +82,9 @@ static const AVOption mptestsrc_options[]= {
{ NULL }, { NULL },
}; };
static const char *mptestsrc_get_name(void *ctx)
{
return "mptestsrc";
}
static const AVClass mptestsrc_class = { static const AVClass mptestsrc_class = {
"MPTestContext", "MPTestContext",
mptestsrc_get_name, avfilter_default_filter_name,
mptestsrc_options mptestsrc_options
}; };
......
...@@ -156,14 +156,9 @@ static int request_frame(AVFilterLink *outlink) ...@@ -156,14 +156,9 @@ static int request_frame(AVFilterLink *outlink)
#if CONFIG_NULLSRC_FILTER #if CONFIG_NULLSRC_FILTER
static const char *nullsrc_get_name(void *ctx)
{
return "nullsrc";
}
static const AVClass nullsrc_class = { static const AVClass nullsrc_class = {
.class_name = "NullSourceContext", .class_name = "NullSourceContext",
.item_name = nullsrc_get_name, .item_name = avfilter_default_filter_name,
.option = testsrc_options, .option = testsrc_options,
}; };
...@@ -196,14 +191,9 @@ AVFilter avfilter_vsrc_nullsrc = { ...@@ -196,14 +191,9 @@ AVFilter avfilter_vsrc_nullsrc = {
#if CONFIG_TESTSRC_FILTER #if CONFIG_TESTSRC_FILTER
static const char *testsrc_get_name(void *ctx)
{
return "testsrc";
}
static const AVClass testsrc_class = { static const AVClass testsrc_class = {
.class_name = "TestSourceContext", .class_name = "TestSourceContext",
.item_name = testsrc_get_name, .item_name = avfilter_default_filter_name,
.option = testsrc_options, .option = testsrc_options,
}; };
...@@ -423,14 +413,9 @@ AVFilter avfilter_vsrc_testsrc = { ...@@ -423,14 +413,9 @@ AVFilter avfilter_vsrc_testsrc = {
#if CONFIG_RGBTESTSRC_FILTER #if CONFIG_RGBTESTSRC_FILTER
static const char *rgbtestsrc_get_name(void *ctx)
{
return "rgbtestsrc";
}
static const AVClass rgbtestsrc_class = { static const AVClass rgbtestsrc_class = {
.class_name = "RGBTestSourceContext", .class_name = "RGBTestSourceContext",
.item_name = rgbtestsrc_get_name, .item_name = avfilter_default_filter_name,
.option = testsrc_options, .option = testsrc_options,
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment