Repair legacy filescanners (broken by libav conditions)

This commit is contained in:
ejurgensen 2014-03-12 22:54:30 +01:00
parent 81b285a79e
commit f6e9ddbc41

View File

@ -695,9 +695,15 @@ scan_metadata_ffmpeg(char *file, struct media_file_info *mfi)
} }
skip_extract: skip_extract:
#if LIBAVFORMAT_VERSION_MAJOR >= 54 || (LIBAVFORMAT_VERSION_MAJOR == 53 && LIBAVFORMAT_VERSION_MINOR >= 21)
avformat_close_input(&ctx);
#else
av_close_input_file(ctx);
#endif
if (mdcount == 0) if (mdcount == 0)
{ {
#if LIBAVFORMAT_VERSION_MAJOR < 53 || (LIBAVFORMAT_VERSION_MAJOR == 53 && LIBAVFORMAT_VERSION_MINOR < 21) #if LIBAVFORMAT_VERSION_MAJOR < 54 || (LIBAVFORMAT_VERSION_MAJOR == 54 && LIBAVFORMAT_VERSION_MINOR < 35)
/* ffmpeg doesn't support FLAC nor Musepack metadata, /* ffmpeg doesn't support FLAC nor Musepack metadata,
* and is buggy for some WMA variants, so fall back to the * and is buggy for some WMA variants, so fall back to the
* legacy format-specific parsers until it gets fixed */ * legacy format-specific parsers until it gets fixed */
@ -706,14 +712,12 @@ scan_metadata_ffmpeg(char *file, struct media_file_info *mfi)
|| (codec_id == CODEC_ID_WMALOSSLESS)) || (codec_id == CODEC_ID_WMALOSSLESS))
{ {
DPRINTF(E_WARN, L_SCAN, "Falling back to legacy WMA scanner\n"); DPRINTF(E_WARN, L_SCAN, "Falling back to legacy WMA scanner\n");
av_close_input_file(ctx);
return (scan_get_wmainfo(file, mfi) ? 0 : -1); return (scan_get_wmainfo(file, mfi) ? 0 : -1);
} }
#ifdef FLAC #ifdef FLAC
else if (codec_id == CODEC_ID_FLAC) else if (codec_id == CODEC_ID_FLAC)
{ {
DPRINTF(E_WARN, L_SCAN, "Falling back to legacy FLAC scanner\n"); DPRINTF(E_WARN, L_SCAN, "Falling back to legacy FLAC scanner\n");
av_close_input_file(ctx);
return (scan_get_flacinfo(file, mfi) ? 0 : -1); return (scan_get_flacinfo(file, mfi) ? 0 : -1);
} }
#endif /* FLAC */ #endif /* FLAC */
@ -722,7 +726,6 @@ scan_metadata_ffmpeg(char *file, struct media_file_info *mfi)
|| (codec_id == CODEC_ID_MUSEPACK8)) || (codec_id == CODEC_ID_MUSEPACK8))
{ {
DPRINTF(E_WARN, L_SCAN, "Falling back to legacy Musepack scanner\n"); DPRINTF(E_WARN, L_SCAN, "Falling back to legacy Musepack scanner\n");
av_close_input_file(ctx);
return (scan_get_mpcinfo(file, mfi) ? 0 : -1); return (scan_get_mpcinfo(file, mfi) ? 0 : -1);
} }
#endif /* MUSEPACK */ #endif /* MUSEPACK */
@ -736,11 +739,6 @@ scan_metadata_ffmpeg(char *file, struct media_file_info *mfi)
mfi->title = strdup(mfi->fname); mfi->title = strdup(mfi->fname);
/* All done */ /* All done */
#if LIBAVFORMAT_VERSION_MAJOR >= 54 || (LIBAVFORMAT_VERSION_MAJOR == 53 && LIBAVFORMAT_VERSION_MINOR >= 21)
avformat_close_input(&ctx);
#else
av_close_input_file(ctx);
#endif
return 0; return 0;
} }