summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-10-05 18:53:02 +0200
committerwm4 <wm4@nowhere>2015-10-05 19:12:23 +0200
commit54fbda2ba40de1d94d49cef2c46160eb7ffa195a (patch)
tree0749d3a757f8abee199222bf08f802b2a7c2a4f1 /player
parente694d6736699d385772a3942aad52bba4bb7caf9 (diff)
downloadmpv-54fbda2ba40de1d94d49cef2c46160eb7ffa195a.tar.bz2
mpv-54fbda2ba40de1d94d49cef2c46160eb7ffa195a.tar.xz
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.)
Diffstat (limited to 'player')
-rw-r--r--player/audio.c10
1 files changed, 6 insertions, 4 deletions
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;