diff --git a/configure.in b/configure.in index ceabb49d..b36f6ce0 100644 --- a/configure.in +++ b/configure.in @@ -131,14 +131,17 @@ AC_LANG_POP([C]) LIBS="$save_LIBS" PKG_CHECK_EXISTS([libavresample], [ - PKG_CHECK_MODULES(LIBAV, [ libavcodec libavformat libswscale libavutil libavresample ]) + PKG_CHECK_MODULES(LIBAV, [ libavformat libavcodec libswscale libavresample libavutil ]) ], [ - PKG_CHECK_MODULES(LIBAV, [ libavcodec libavformat libswscale libavutil ]) + PKG_CHECK_MODULES(LIBAV, [ libavformat libavcodec libswscale libavutil ]) ]) -dnl Check for av_lock_manager (ffmpeg >= 0.5.1) save_LIBS="$LIBS" +dnl Check for av_lock_manager (ffmpeg >= 0.5.1) AC_CHECK_LIB([avcodec], [av_lockmgr_register], , AC_MSG_ERROR([libav (ffmpeg) >= 0.5.1 required])) +dnl Check for avcodec_find_best_pix_fmt_of_list (is only in ffmpeg, not libav) +AC_CHECK_LIB([avcodec], [avcodec_find_best_pix_fmt_of_list], + AC_DEFINE(FFMPEG_INCOMPATIBLE_API, 1, [Define to 1 if you have ffmpeg (and not libav).])) LIBS="$save_LIBS" # Check for libavformat >= 53; url -> avio switch diff --git a/src/artwork.c b/src/artwork.c index 57fe4718..b0ec29e9 100644 --- a/src/artwork.c +++ b/src/artwork.c @@ -293,7 +293,11 @@ artwork_rescale(AVFormatContext *src_ctx, int s, int out_w, int out_h, int forma #endif #if LIBAVCODEC_VERSION_MAJOR >= 55 || (LIBAVCODEC_VERSION_MAJOR == 54 && LIBAVCODEC_VERSION_MINOR >= 35) +# ifndef FFMPEG_INCOMPATIBLE_API dst->pix_fmt = avcodec_find_best_pix_fmt2((enum AVPixelFormat *)img_encoder->pix_fmts, src->pix_fmt, 1, NULL); +# else + dst->pix_fmt = avcodec_find_best_pix_fmt_of_list((enum AVPixelFormat *)img_encoder->pix_fmts, src->pix_fmt, 1, NULL); +# endif #else const enum PixelFormat *pix_fmts; int64_t pix_fmt_mask = 0;