diff options
Diffstat (limited to 'libmpcodecs/ad_ffmpeg.c')
-rw-r--r-- | libmpcodecs/ad_ffmpeg.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c index 9d1b8356ad..c954fb2311 100644 --- a/libmpcodecs/ad_ffmpeg.c +++ b/libmpcodecs/ad_ffmpeg.c @@ -22,7 +22,6 @@ #include "config.h" #include "mp_msg.h" -#include "help_mp.h" #include "ad_internal.h" #include "libaf/reorder_ch.h" @@ -68,7 +67,7 @@ static int init(sh_audio_t *sh_audio) lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh_audio->codec->dll); if(!lavc_codec){ - mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_MissingLAVCcodec,sh_audio->codec->dll); + mp_tmsg(MSGT_DECAUDIO,MSGL_ERR,"Cannot find codec '%s' in libavcodec...\n",sh_audio->codec->dll); return 0; } @@ -108,7 +107,7 @@ static int init(sh_audio_t *sh_audio) /* open it */ if (avcodec_open(lavc_context, lavc_codec) < 0) { - mp_msg(MSGT_DECAUDIO,MSGL_ERR, MSGTR_CantOpenCodec); + mp_tmsg(MSGT_DECAUDIO,MSGL_ERR, "Could not open codec.\n"); return 0; } mp_msg(MSGT_DECAUDIO,MSGL_V,"INFO: libavcodec \"%s\" init OK!\n", lavc_codec->name); @@ -143,19 +142,18 @@ static int init(sh_audio_t *sh_audio) mp_msg(MSGT_DECAUDIO, MSGL_FATAL, "Unsupported sample format\n"); return 0; } - if(sh_audio->wf){ + /* If the audio is AAC the container level data may be unreliable + * because of SBR handling problems (possibly half real sample rate at + * container level). Default AAC decoding with ad_faad has used codec-level + * values for a long time without generating complaints so it should be OK. + */ + if (sh_audio->wf && lavc_context->codec_id != CODEC_ID_AAC) { // If the decoder uses the wrong number of channels all is lost anyway. // sh_audio->channels=sh_audio->wf->nChannels; - - if (lavc_context->codec_id == CODEC_ID_AAC && - sh_audio->samplerate == 2*sh_audio->wf->nSamplesPerSec) { - mp_msg(MSGT_DECAUDIO, MSGL_WARN, - "Ignoring broken container sample rate for ACC with SBR\n"); - } else if (sh_audio->wf->nSamplesPerSec) - sh_audio->samplerate=sh_audio->wf->nSamplesPerSec; - + if (sh_audio->wf->nSamplesPerSec) + sh_audio->samplerate=sh_audio->wf->nSamplesPerSec; if (sh_audio->wf->nAvgBytesPerSec) - sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec; + sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec; } sh_audio->samplesize=af_fmt2bits(sh_audio->sample_format)/ 8; return 1; @@ -166,7 +164,7 @@ static void uninit(sh_audio_t *sh) AVCodecContext *lavc_context = sh->context; if (avcodec_close(lavc_context) < 0) - mp_msg(MSGT_DECVIDEO, MSGL_ERR, MSGTR_CantCloseCodec); + mp_tmsg(MSGT_DECVIDEO, MSGL_ERR, "Could not close codec.\n"); av_freep(&lavc_context->extradata); av_freep(&lavc_context); } |