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.
Unified · Split
| @@ -15,6 +15,9 @@ libavutil: 2011-04-18 · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | API changes, most recent first: |
| 17 | 17 | |
| 18 | +2012-06-04 - xxxxxxx - lafi 2.78.100 | |
| 19 | + Add avfilter_default_filter_name() function in avfilter.h. | |
| 20 | + | |
| 18 | 21 | 2012-05-24 - xxxxxxx - lavu 51.54.100 |
| 19 | 22 | Move AVPALETTE_SIZE and AVPALETTE_COUNT macros from |
| 20 | 23 | libavcodec/avcodec.h to libavutil/pixfmt.h. |
| @@ -55,7 +55,7 @@ static const AVOption options[] = { · 54 unmodified lines | ||
| 55 | 55 | |
| 56 | 56 | static const AVClass aformat_class = { |
| 57 | 57 | .class_name = "aformat filter", |
| 58 | − .item_name = av_default_item_name, | |
| 58 | + .item_name = avfilter_default_filter_name, | |
| 59 | 59 | .option = options, |
| 60 | 60 | .version = LIBAVUTIL_VERSION_INT, |
| 61 | 61 | .category = AV_CLASS_CATEGORY_FILTER, |
| @@ -186,7 +186,7 @@ static const AVOption options[] = { · 185 unmodified lines | ||
| 186 | 186 | |
| 187 | 187 | static const AVClass amix_class = { |
| 188 | 188 | .class_name = "amix filter", |
| 189 | − .item_name = av_default_item_name, | |
| 189 | + .item_name = avfilter_default_filter_name, | |
| 190 | 190 | .option = options, |
| 191 | 191 | .version = LIBAVUTIL_VERSION_INT, |
| 192 | 192 | }; |
| @@ -50,7 +50,7 @@ static const AVOption options[] = { · 49 unmodified lines | ||
| 50 | 50 | |
| 51 | 51 | static const AVClass async_class = { |
| 52 | 52 | .class_name = "asyncts filter", |
| 53 | − .item_name = av_default_item_name, | |
| 53 | + .item_name = avfilter_default_filter_name, | |
| 54 | 54 | .option = options, |
| 55 | 55 | .version = LIBAVUTIL_VERSION_INT, |
| 56 | 56 | }; |
| @@ -48,14 +48,9 @@ static const AVOption silencedetect_options[] = { · 47 unmodified lines | ||
| 48 | 48 | { NULL }, |
| 49 | 49 | }; |
| 50 | 50 | |
| 51 | −static const char *silencedetect_get_name(void *ctx) | |
| 52 | −{ | |
| 53 | − return "silencedetect"; | |
| 54 | −} | |
| 55 | − | |
| 56 | 51 | static const AVClass silencedetect_class = { |
| 57 | 52 | .class_name = "SilenceDetectContext", |
| 58 | − .item_name = silencedetect_get_name, | |
| 53 | + .item_name = avfilter_default_filter_name, | |
| 59 | 54 | .option = silencedetect_options, |
| 60 | 55 | }; |
| 61 | 56 | |
| @@ -78,14 +78,9 @@ static const AVOption eval_options[]= { · 77 unmodified lines | ||
| 78 | 78 | {NULL}, |
| 79 | 79 | }; |
| 80 | 80 | |
| 81 | −static const char *eval_get_name(void *ctx) | |
| 82 | −{ | |
| 83 | − return "aevalsrc"; | |
| 84 | −} | |
| 85 | − | |
| 86 | 81 | static const AVClass eval_class = { |
| 87 | 82 | "AEvalSrcContext", |
| 88 | − eval_get_name, | |
| 83 | + avfilter_default_filter_name, | |
| 89 | 84 | eval_options |
| 90 | 85 | }; |
| 91 | 86 | |
| @@ -53,14 +53,9 @@ static const AVOption anullsrc_options[]= { · 52 unmodified lines | ||
| 53 | 53 | { NULL }, |
| 54 | 54 | }; |
| 55 | 55 | |
| 56 | −static const char *anullsrc_get_name(void *ctx) | |
| 57 | −{ | |
| 58 | − return "anullsrc"; | |
| 59 | −} | |
| 60 | − | |
| 61 | 56 | static const AVClass anullsrc_class = { |
| 62 | 57 | "ANullSrcContext", |
| 63 | − anullsrc_get_name, | |
| 58 | + avfilter_default_filter_name, | |
| 64 | 59 | anullsrc_options |
| 65 | 60 | }; |
| 66 | 61 | |
| @@ -366,15 +366,15 @@ static int pad_count(const AVFilterPad *pads) · 365 unmodified lines | ||
| 366 | 366 | return count; |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | −static const char *filter_name(void *p) | |
| 369 | +const char *avfilter_default_filter_name(void *filter_ctx) | |
| 370 | 370 | { |
| 371 | − AVFilterContext *filter = p; | |
| 372 | − return filter->filter->name; | |
| 371 | + AVFilterContext *ctx = filter_ctx; | |
| 372 | + return ctx->name ? ctx->name : ctx->filter->name; | |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | static const AVClass avfilter_class = { |
| 376 | 376 | .class_name = "AVFilter", |
| 377 | − .item_name = filter_name, | |
| 377 | + .item_name = avfilter_default_filter_name, | |
| 378 | 378 | .version = LIBAVUTIL_VERSION_INT, |
| 379 | 379 | .category = AV_CLASS_CATEGORY_FILTER, |
| 380 | 380 | }; |
| @@ -634,6 +634,12 @@ struct AVFilterContext { · 633 unmodified lines | ||
| 634 | 634 | struct AVFilterCommand *command_queue; |
| 635 | 635 | }; |
| 636 | 636 | |
| 637 | +/** | |
| 638 | + * Print the name of the filter given a filter context. | |
| 639 | + */ | |
| 640 | +const char *avfilter_default_filter_name(void *filter_ctx); | |
| 641 | + | |
| 642 | + | |
| 637 | 643 | #if FF_API_PACKING |
| 638 | 644 | enum AVFilterPacking { |
| 639 | 645 | AVFILTER_PACKED = 0, |
| @@ -36,7 +36,7 @@ · 35 unmodified lines | ||
| 36 | 36 | |
| 37 | 37 | static const AVClass filtergraph_class = { |
| 38 | 38 | .class_name = "AVFilterGraph", |
| 39 | − .item_name = av_default_item_name, | |
| 39 | + .item_name = avfilter_default_filter_name, | |
| 40 | 40 | .version = LIBAVUTIL_VERSION_INT, |
| 41 | 41 | }; |
| 42 | 42 | |
| @@ -255,7 +255,7 @@ static const AVOption audio_options[] = { · 254 unmodified lines | ||
| 255 | 255 | |
| 256 | 256 | static const AVClass abuffer_class = { |
| 257 | 257 | .class_name = "abuffer source", |
| 258 | − .item_name = av_default_item_name, | |
| 258 | + .item_name = avfilter_default_filter_name, | |
| 259 | 259 | .option = audio_options, |
| 260 | 260 | .version = LIBAVUTIL_VERSION_INT, |
| 261 | 261 | .category = AV_CLASS_CATEGORY_FILTER, |
| @@ -78,14 +78,9 @@ static const AVOption movie_options[]= { · 77 unmodified lines | ||
| 78 | 78 | {NULL}, |
| 79 | 79 | }; |
| 80 | 80 | |
| 81 | −static const char *movie_get_name(void *ctx) | |
| 82 | −{ | |
| 83 | − return "movie"; | |
| 84 | −} | |
| 85 | − | |
| 86 | 81 | static const AVClass movie_class = { |
| 87 | 82 | "MovieContext", |
| 88 | − movie_get_name, | |
| 83 | + avfilter_default_filter_name, | |
| 89 | 84 | movie_options |
| 90 | 85 | }; |
| 91 | 86 | |
| @@ -29,7 +29,7 @@ · 28 unmodified lines | ||
| 29 | 29 | #include "libavutil/avutil.h" |
| 30 | 30 | |
| 31 | 31 | #define LIBAVFILTER_VERSION_MAJOR 2 |
| 32 | −#define LIBAVFILTER_VERSION_MINOR 77 | |
| 32 | +#define LIBAVFILTER_VERSION_MINOR 78 | |
| 33 | 33 | #define LIBAVFILTER_VERSION_MICRO 100 |
| 34 | 34 | |
| 35 | 35 | #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ |
| @@ -54,14 +54,9 @@ static const AVOption ass_options[] = { · 53 unmodified lines | ||
| 54 | 54 | {NULL}, |
| 55 | 55 | }; |
| 56 | 56 | |
| 57 | −static const char *ass_get_name(void *ctx) | |
| 58 | −{ | |
| 59 | − return "ass"; | |
| 60 | −} | |
| 61 | − | |
| 62 | 57 | static const AVClass ass_class = { |
| 63 | 58 | "AssContext", |
| 64 | − ass_get_name, | |
| 59 | + avfilter_default_filter_name, | |
| 65 | 60 | ass_options |
| 66 | 61 | }; |
| 67 | 62 | |
| @@ -57,14 +57,9 @@ static const AVOption blackdetect_options[] = { · 56 unmodified lines | ||
| 57 | 57 | { NULL }, |
| 58 | 58 | }; |
| 59 | 59 | |
| 60 | −static const char *blackdetect_get_name(void *ctx) | |
| 61 | −{ | |
| 62 | − return "blackdetect"; | |
| 63 | −} | |
| 64 | − | |
| 65 | 60 | static const AVClass blackdetect_class = { |
| 66 | 61 | .class_name = "BlackDetectContext", |
| 67 | − .item_name = blackdetect_get_name, | |
| 62 | + .item_name = avfilter_default_filter_name, | |
| 68 | 63 | .option = blackdetect_options, |
| 69 | 64 | }; |
| 70 | 65 | |
| @@ -149,14 +149,9 @@ static const AVOption delogo_options[]= { · 148 unmodified lines | ||
| 149 | 149 | {NULL}, |
| 150 | 150 | }; |
| 151 | 151 | |
| 152 | −static const char *delogo_get_name(void *ctx) | |
| 153 | −{ | |
| 154 | − return "delogo"; | |
| 155 | −} | |
| 156 | − | |
| 157 | 152 | static const AVClass delogo_class = { |
| 158 | 153 | .class_name = "DelogoContext", |
| 159 | − .item_name = delogo_get_name, | |
| 154 | + .item_name = avfilter_default_filter_name, | |
| 160 | 155 | .option = delogo_options, |
| 161 | 156 | }; |
| 162 | 157 | |
| @@ -205,14 +205,9 @@ static const AVOption drawtext_options[]= { · 204 unmodified lines | ||
| 205 | 205 | {NULL}, |
| 206 | 206 | }; |
| 207 | 207 | |
| 208 | −static const char *drawtext_get_name(void *ctx) | |
| 209 | −{ | |
| 210 | − return "drawtext"; | |
| 211 | −} | |
| 212 | − | |
| 213 | 208 | static const AVClass drawtext_class = { |
| 214 | 209 | "DrawTextContext", |
| 215 | − drawtext_get_name, | |
| 210 | + avfilter_default_filter_name, | |
| 216 | 211 | drawtext_options |
| 217 | 212 | }; |
| 218 | 213 | |
| @@ -69,14 +69,9 @@ static const AVOption fade_options[] = { · 68 unmodified lines | ||
| 69 | 69 | {NULL}, |
| 70 | 70 | }; |
| 71 | 71 | |
| 72 | −static const char *fade_get_name(void *ctx) | |
| 73 | −{ | |
| 74 | − return "fade"; | |
| 75 | −} | |
| 76 | − | |
| 77 | 72 | static const AVClass fade_class = { |
| 78 | 73 | "FadeContext", |
| 79 | − fade_get_name, | |
| 74 | + avfilter_default_filter_name, | |
| 80 | 75 | fade_options |
| 81 | 76 | }; |
| 82 | 77 | |
| @@ -60,7 +60,7 @@ static const AVOption options[] = { · 59 unmodified lines | ||
| 60 | 60 | |
| 61 | 61 | static const AVClass class = { |
| 62 | 62 | .class_name = "FPS filter", |
| 63 | − .item_name = av_default_item_name, | |
| 63 | + .item_name = avfilter_default_filter_name, | |
| 64 | 64 | .option = options, |
| 65 | 65 | .version = LIBAVUTIL_VERSION_INT, |
| 66 | 66 | }; |
| @@ -89,14 +89,9 @@ static const AVOption lut_options[] = { · 88 unmodified lines | ||
| 89 | 89 | {NULL}, |
| 90 | 90 | }; |
| 91 | 91 | |
| 92 | −static const char *lut_get_name(void *ctx) | |
| 93 | −{ | |
| 94 | − return "lut"; | |
| 95 | −} | |
| 96 | − | |
| 97 | 92 | static const AVClass lut_class = { |
| 98 | 93 | "LutContext", |
| 99 | − lut_get_name, | |
| 94 | + avfilter_default_filter_name, | |
| 100 | 95 | lut_options |
| 101 | 96 | }; |
| 102 | 97 | |
| @@ -101,14 +101,9 @@ static const AVOption overlay_options[] = { · 100 unmodified lines | ||
| 101 | 101 | {NULL}, |
| 102 | 102 | }; |
| 103 | 103 | |
| 104 | −static const char *overlay_get_name(void *ctx) | |
| 105 | −{ | |
| 106 | − return "overlay"; | |
| 107 | −} | |
| 108 | − | |
| 109 | 104 | static const AVClass overlay_class = { |
| 110 | 105 | "OverlayContext", |
| 111 | − overlay_get_name, | |
| 106 | + avfilter_default_filter_name, | |
| 112 | 107 | overlay_options |
| 113 | 108 | }; |
| 114 | 109 | |
| @@ -76,14 +76,9 @@ static const AVOption cellauto_options[] = { · 75 unmodified lines | ||
| 76 | 76 | { NULL }, |
| 77 | 77 | }; |
| 78 | 78 | |
| 79 | −static const char *cellauto_get_name(void *ctx) | |
| 80 | −{ | |
| 81 | − return "cellauto"; | |
| 82 | −} | |
| 83 | − | |
| 84 | 79 | static const AVClass cellauto_class = { |
| 85 | 80 | "CellAutoContext", |
| 86 | − cellauto_get_name, | |
| 81 | + avfilter_default_filter_name, | |
| 87 | 82 | cellauto_options |
| 88 | 83 | }; |
| 89 | 84 | |
| @@ -95,14 +95,9 @@ static const AVOption life_options[] = { · 94 unmodified lines | ||
| 95 | 95 | { NULL }, |
| 96 | 96 | }; |
| 97 | 97 | |
| 98 | −static const char *life_get_name(void *ctx) | |
| 99 | −{ | |
| 100 | − return "life"; | |
| 101 | −} | |
| 102 | − | |
| 103 | 98 | static const AVClass life_class = { |
| 104 | 99 | "LifeContext", |
| 105 | − life_get_name, | |
| 100 | + avfilter_default_filter_name, | |
| 106 | 101 | life_options |
| 107 | 102 | }; |
| 108 | 103 | |
| @@ -103,14 +103,9 @@ static const AVOption mandelbrot_options[] = { · 102 unmodified lines | ||
| 103 | 103 | {NULL}, |
| 104 | 104 | }; |
| 105 | 105 | |
| 106 | −static const char *mandelbrot_get_name(void *ctx) | |
| 107 | −{ | |
| 108 | − return "mandelbrot"; | |
| 109 | −} | |
| 110 | − | |
| 111 | 106 | static const AVClass mandelbrot_class = { |
| 112 | 107 | "MBContext", |
| 113 | − mandelbrot_get_name, | |
| 108 | + avfilter_default_filter_name, | |
| 114 | 109 | mandelbrot_options |
| 115 | 110 | }; |
| 116 | 111 | |
| @@ -82,14 +82,9 @@ static const AVOption mptestsrc_options[]= { · 81 unmodified lines | ||
| 82 | 82 | { NULL }, |
| 83 | 83 | }; |
| 84 | 84 | |
| 85 | −static const char *mptestsrc_get_name(void *ctx) | |
| 86 | −{ | |
| 87 | − return "mptestsrc"; | |
| 88 | −} | |
| 89 | − | |
| 90 | 85 | static const AVClass mptestsrc_class = { |
| 91 | 86 | "MPTestContext", |
| 92 | − mptestsrc_get_name, | |
| 87 | + avfilter_default_filter_name, | |
| 93 | 88 | mptestsrc_options |
| 94 | 89 | }; |
| 95 | 90 | |
| @@ -156,14 +156,9 @@ static int request_frame(AVFilterLink *outlink) · 155 unmodified lines | ||
| 156 | 156 | |
| 157 | 157 | #if CONFIG_NULLSRC_FILTER |
| 158 | 158 | |
| 159 | −static const char *nullsrc_get_name(void *ctx) | |
| 160 | −{ | |
| 161 | − return "nullsrc"; | |
| 162 | −} | |
| 163 | − | |
| 164 | 159 | static const AVClass nullsrc_class = { |
| 165 | 160 | .class_name = "NullSourceContext", |
| 166 | − .item_name = nullsrc_get_name, | |
| 161 | + .item_name = avfilter_default_filter_name, | |
| 167 | 162 | .option = testsrc_options, |
| 168 | 163 | }; |
| 169 | 164 | |
| @@ -196,14 +191,9 @@ AVFilter avfilter_vsrc_nullsrc = { · 26 unmodified lines | ||
| 196 | 191 | |
| 197 | 192 | #if CONFIG_TESTSRC_FILTER |
| 198 | 193 | |
| 199 | −static const char *testsrc_get_name(void *ctx) | |
| 200 | −{ | |
| 201 | − return "testsrc"; | |
| 202 | −} | |
| 203 | − | |
| 204 | 194 | static const AVClass testsrc_class = { |
| 205 | 195 | .class_name = "TestSourceContext", |
| 206 | − .item_name = testsrc_get_name, | |
| 196 | + .item_name = avfilter_default_filter_name, | |
| 207 | 197 | .option = testsrc_options, |
| 208 | 198 | }; |
| 209 | 199 | |
| @@ -423,14 +413,9 @@ AVFilter avfilter_vsrc_testsrc = { · 213 unmodified lines | ||
| 423 | 413 | |
| 424 | 414 | #if CONFIG_RGBTESTSRC_FILTER |
| 425 | 415 | |
| 426 | −static const char *rgbtestsrc_get_name(void *ctx) | |
| 427 | −{ | |
| 428 | − return "rgbtestsrc"; | |
| 429 | −} | |
| 430 | − | |
| 431 | 416 | static const AVClass rgbtestsrc_class = { |
| 432 | 417 | .class_name = "RGBTestSourceContext", |
| 433 | − .item_name = rgbtestsrc_get_name, | |
| 418 | + .item_name = avfilter_default_filter_name, | |
| 434 | 419 | .option = testsrc_options, |
| 435 | 420 | }; |
| 436 | 421 | |