From 54fbda2ba40de1d94d49cef2c46160eb7ffa195a Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 5 Oct 2015 18:53:02 +0200 Subject: audio: add option for falling back to ao_null The manpage entry explains this. (Maybe this option could be always enabled and removed. I don't quite remember what valid use-cases there are for just disabling audio entirely, other than that this is also needed for audio decoder init failure.) --- player/audio.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'player') diff --git a/player/audio.c b/player/audio.c index 92c4bbae19..4bcf69a00f 100644 --- a/player/audio.c +++ b/player/audio.c @@ -260,11 +260,15 @@ void reinit_audio_chain(struct MPContext *mpctx) } if (!mpctx->ao) { + bool spdif_fallback = af_fmt_is_spdif(afs->output.format) && + mpctx->d_audio->spdif_passthrough; + bool ao_null_fallback = opts->ao_null_fallback && !spdif_fallback; + mp_chmap_remove_useless_channels(&afs->output.channels, &opts->audio_output_channels); mp_audio_set_channels(&afs->output, &afs->output.channels); - mpctx->ao = ao_init_best(mpctx->global, mpctx->input, + mpctx->ao = ao_init_best(mpctx->global, ao_null_fallback, mpctx->input, mpctx->encode_lavc_ctx, afs->output.rate, afs->output.format, afs->output.channels); @@ -283,9 +287,7 @@ void reinit_audio_chain(struct MPContext *mpctx) if (!mpctx->ao) { // If spdif was used, try to fallback to PCM. - if (af_fmt_is_spdif(afs->output.format) && - mpctx->d_audio->spdif_passthrough) - { + if (spdif_fallback) { mpctx->d_audio->spdif_passthrough = false; if (!audio_init_best_codec(mpctx->d_audio)) goto init_error; -- cgit v1.2.3