From 77eac2ec3494080f1dfbc1fd55ff6aba7effd466 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Mon, 26 Nov 2012 04:47:29 +0200 Subject: audio: improve decoder open failure handling Reinitialize sh_audio->samplesize and sample_format before falling back to another audio decoder (some decoders rely on default values). Remove code setting these fields from demux_mkv and demux_lavf (no decoder should depend on demuxer-set values for these fields). Conflicts: audio/decode/ad_lavc.c Merged from mplayer2 commit 6b9567. The changes to ad_lavc.c are not merged, as they are very specific to the mplayer2 libavresample hack; we deplanarize manually, so we can't get unsupported sample formats yet (except on raw audio with "pcm_f64le", as we don't support AV_SAMPLE_FMT_DBL in the audio chain). --- audio/decode/dec_audio.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'audio') diff --git a/audio/decode/dec_audio.c b/audio/decode/dec_audio.c index 9e03371d19..90967fdea0 100644 --- a/audio/decode/dec_audio.c +++ b/audio/decode/dec_audio.c @@ -64,6 +64,8 @@ static int init_audio_codec(sh_audio_t *sh_audio) { assert(!sh_audio->initialized); resync_audio_stream(sh_audio); + sh_audio->samplesize = 2; + sh_audio->sample_format = AF_FORMAT_S16_NE; if ((af_cfg.force & AF_INIT_FORMAT_MASK) == AF_INIT_FLOAT) { int fmt = AF_FORMAT_FLOAT_NE; if (sh_audio->ad_driver->control(sh_audio, ADCTRL_QUERY_FORMAT, -- cgit v1.2.3