diff options
Diffstat (limited to 'libmpcodecs/ad_ffmpeg.c')
-rw-r--r-- | libmpcodecs/ad_ffmpeg.c | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c index 0bfc5e5f0a..a20689eab8 100644 --- a/libmpcodecs/ad_ffmpeg.c +++ b/libmpcodecs/ad_ffmpeg.c @@ -38,11 +38,12 @@ static const ad_info_t info = { - "FFmpeg/libavcodec audio decoders", + "libavcodec audio decoders", "ffmpeg", - "Nick Kurshev", - "ffmpeg.sf.net", - "" + "", + "", + "", + .print_name = "libavcodec", }; LIBAD_EXTERN(ffmpeg) @@ -112,16 +113,31 @@ static int init(sh_audio_t *sh_audio) AVCodecContext *lavc_context; AVCodec *lavc_codec; - mp_msg(MSGT_DECAUDIO, MSGL_V, "FFmpeg's libavcodec audio codec\n"); - - lavc_codec = avcodec_find_decoder_by_name(sh_audio->codec->dll); - if (!lavc_codec) { - mp_tmsg(MSGT_DECAUDIO, MSGL_ERR, - "Cannot find codec '%s' in libavcodec...\n", - sh_audio->codec->dll); + if (sh_audio->codec->dll) { + lavc_codec = avcodec_find_decoder_by_name(sh_audio->codec->dll); + if (!lavc_codec) { + mp_tmsg(MSGT_DECAUDIO, MSGL_ERR, + "Cannot find codec '%s' in libavcodec...\n", + sh_audio->codec->dll); + return 0; + } + } else if (!sh_audio->libav_codec_id) { + mp_tmsg(MSGT_DECAUDIO, MSGL_INFO, "No Libav codec ID known. " + "Generic lavc decoder is not applicable.\n"); return 0; + } else { + lavc_codec = avcodec_find_decoder(sh_audio->libav_codec_id); + if (!lavc_codec) { + mp_tmsg(MSGT_DECAUDIO, MSGL_INFO, "Libavcodec has no decoder " + "for this codec\n"); + return 0; + } } + sh_audio->codecname = lavc_codec->long_name; + if (!sh_audio->codecname) + sh_audio->codecname = lavc_codec->name; + struct priv *ctx = talloc_zero(NULL, struct priv); sh_audio->context = ctx; lavc_context = avcodec_alloc_context3(lavc_codec); @@ -217,6 +233,7 @@ static int init(sh_audio_t *sh_audio) static void uninit(sh_audio_t *sh) { + sh->codecname = NULL; struct priv *ctx = sh->context; if (!ctx) return; |