From 370c5cc834f455106e682f8af4255a9bc671a01b Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 9 Nov 2013 00:30:42 +0100 Subject: af: always remove auto-inserted filters, improve error message It's probably better if all auto-inserted filters are removed when doing an af_add operation. If they're really needed, they will be automatically re-added. Fix the error message. It used to be for an actual internal error, but now it happens when format negotiation fails, e.g. when trying to use spdif and real audio filters. --- audio/filter/af.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/audio/filter/af.c b/audio/filter/af.c index 4c7d2e9bf5..9c39173f1b 100644 --- a/audio/filter/af.c +++ b/audio/filter/af.c @@ -509,6 +509,7 @@ static int af_fix_rate(struct af_stream *s, struct af_instance **p_af, // In that case, you should always rebuild the filter chain, or abort. static int af_reinit(struct af_stream *s) { + remove_auto_inserted_filters(s); // Start with the second filter, as the first filter is the special input // filter which needs no initialization. struct af_instance *af = s->first->next; @@ -573,8 +574,8 @@ static int af_reinit(struct af_stream *s) return af_config_equals(&s->output, &s->filter_output) ? AF_OK : AF_ERROR; negotiate_error: - mp_msg(MSGT_AFILTER, MSGL_ERR, "[libaf] Unable to correct audio format. " - "This error should never occur, please send a bug report.\n"); + mp_msg(MSGT_AFILTER, MSGL_ERR, "[libaf] Unable to convert audio input " + "format to output format.\n"); af_print_filter_chain(s, af, MSGL_ERR); return AF_ERROR; } @@ -652,8 +653,6 @@ int af_init(struct af_stream *s) } } - remove_auto_inserted_filters(s); - if (af_reinit(s) != AF_OK) { // Something is stuffed audio out will not work mp_msg(MSGT_AFILTER, MSGL_ERR, "Could not create audio filter chain.\n"); -- cgit v1.2.3