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.
Showing the changes to libavfilter/avfilter.c (1 of 26 files). Show all
Unified · Split
| @@ -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 | }; |