Add preprocessor macro FFMPEG_INCOMPATIBLE_API and use it, so

we use avcodec_find_best_pix_fmt_of_list for ffmpeg. Also rearrange
ffmpeg/libav libraries according to ffmpeg FAQ.
This commit is contained in:
ejurgensen 2014-01-12 22:34:57 +01:00
parent 60f43c94c9
commit 3f33f33310
2 changed files with 10 additions and 3 deletions

View File

@ -131,14 +131,17 @@ AC_LANG_POP([C])
LIBS="$save_LIBS" LIBS="$save_LIBS"
PKG_CHECK_EXISTS([libavresample], [ 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" 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])) 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" LIBS="$save_LIBS"
# Check for libavformat >= 53; url -> avio switch # Check for libavformat >= 53; url -> avio switch

View File

@ -293,7 +293,11 @@ artwork_rescale(AVFormatContext *src_ctx, int s, int out_w, int out_h, int forma
#endif #endif
#if LIBAVCODEC_VERSION_MAJOR >= 55 || (LIBAVCODEC_VERSION_MAJOR == 54 && LIBAVCODEC_VERSION_MINOR >= 35) #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); 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 #else
const enum PixelFormat *pix_fmts; const enum PixelFormat *pix_fmts;
int64_t pix_fmt_mask = 0; int64_t pix_fmt_mask = 0;