mirror of
https://github.com/mpv-player/mpv
synced 2024-11-18 21:16:10 +01:00
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.
This commit is contained in:
parent
782c8e72ff
commit
370c5cc834
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user