From cc69650e76269a3b419e6a73eb06e12284e91974 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 31 May 2017 17:42:03 +0200 Subject: af, vf: improvements to libavfilter bridge Add the "lavfi-" prefix (details see manpage additons). Tag the filter name as "(lavfi)" in the verbose filter list output. --- audio/filter/af.c | 8 +++++++- audio/filter/af.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'audio') diff --git a/audio/filter/af.c b/audio/filter/af.c index 189c12b875..0df0f28bb6 100644 --- a/audio/filter/af.c +++ b/audio/filter/af.c @@ -163,11 +163,14 @@ static struct af_instance *af_create(struct af_stream *s, char *name, lavfi_name = name; lavfi_args = args; args = NULL; + if (strncmp(lavfi_name, "lavfi-", 6) == 0) + lavfi_name += 6; } MP_VERBOSE(s, "Adding filter %s \n", name); struct af_instance *af = talloc_zero(NULL, struct af_instance); *af = (struct af_instance) { + .full_name = talloc_strdup(af, name), .info = desc.p, .data = talloc_zero(af, struct mp_audio), .log = mp_log_new(af, s->log, name), @@ -192,6 +195,7 @@ static struct af_instance *af_create(struct af_stream *s, char *name, assert(opts->opt->type == &m_option_type_keyvalue_list); if (m_config_set_option_raw(config, opts, &lavfi_args, 0) < 0) goto error; + af->full_name = talloc_asprintf(af, "%s (lavfi)", af->full_name); } af->priv = config->optstruct; @@ -271,7 +275,7 @@ static void af_print_filter_chain(struct af_stream *s, struct af_instance *at, struct af_instance *af = s->first; while (af) { char b[128] = {0}; - mp_snprintf_cat(b, sizeof(b), " [%s] ", af->info->name); + mp_snprintf_cat(b, sizeof(b), " [%s] ", af->full_name); if (af->label) mp_snprintf_cat(b, sizeof(b), "\"%s\" ", af->label); if (af->data) @@ -518,6 +522,7 @@ struct af_stream *af_new(struct mpv_global *global) static const struct af_info in = { .name = "in" }; s->first = talloc(s, struct af_instance); *s->first = (struct af_instance) { + .full_name = "in", .info = &in, .log = s->log, .control = input_control, @@ -529,6 +534,7 @@ struct af_stream *af_new(struct mpv_global *global) static const struct af_info out = { .name = "out" }; s->last = talloc(s, struct af_instance); *s->last = (struct af_instance) { + .full_name = "out", .info = &out, .log = s->log, .control = output_control, diff --git a/audio/filter/af.h b/audio/filter/af.h index 9c7b1fbfa5..553fc03e32 100644 --- a/audio/filter/af.h +++ b/audio/filter/af.h @@ -52,6 +52,7 @@ struct af_info { // Linked list of audio filters struct af_instance { const struct af_info *info; + char *full_name; struct mp_log *log; struct MPOpts *opts; struct replaygain_data *replaygain_data; -- cgit v1.2.3