From: pabs3 Date: Sat, 16 Aug 2008 02:02:21 +0000 (+0000) Subject: Apply 2036627, fix Debian 487639: for mod_libav, allow the use of libswscale instead... X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=a46bd51d2a00f57d4e5335b77181d93e6b796ee9;p=synfig.git Apply 2036627, fix Debian 487639: for mod_libav, allow the use of libswscale instead of the depreciated img_convert function. Patch by Gerco git-svn-id: https://synfig.svn.sourceforge.net/svnroot/synfig@2031 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-core/trunk/AUTHORS b/synfig-core/trunk/AUTHORS index c04d6f4..8ad298b 100644 --- a/synfig-core/trunk/AUTHORS +++ b/synfig-core/trunk/AUTHORS @@ -13,6 +13,7 @@ Andreas Jochens Chris Moore (dooglus) Martin Michlmayr Carlos López González (genete) +Gerco Translators: diff --git a/synfig-core/trunk/configure.ac b/synfig-core/trunk/configure.ac index 2e7e7b0..79ea10b 100644 --- a/synfig-core/trunk/configure.ac +++ b/synfig-core/trunk/configure.ac @@ -246,6 +246,33 @@ if test $with_libavcodec = "yes" ; then { } ; fi +if test $with_libavcodec = "yes" ; then { + AC_ARG_WITH(libswscale, + [AS_HELP_STRING([--without-libswscale], + [disable support for libswscale (Default=auto)])], + [], + [with_libswscale="yes"] + ) + + if test $with_libswscale != "no" ; then { + AC_CHECK_LIB(swscale, sws_getContext, [], [echo no; with_libswscale="no"], []) + } ; fi + + if test $with_libswscale = "yes" ; then { + LIBAVCODEC_LIBS="$LIBAVCODEC_LIBS -lswscale" + AM_CONDITIONAL(HAVE_LIBSWSCALE, true) + } else { + AM_CONDITIONAL(HAVE_LIBSWSCALE, false) + AC_CHECK_LIB(avcodec, img_convert, + [AC_MSG_RESULT([ *** Using deprecated function img_convert.])], + [AC_MSG_FAILURE([Neither libswscale nor function img_convert was found.])], + [] + ) + } ; fi +} else { + AM_CONDITIONAL(HAVE_LIBSWSCALE, false) +} ; fi + # FREETYPE2 CHECK-------------------- @@ -647,6 +674,7 @@ ETL_CFLAGS -----------------------> $ETL_CFLAGS FreeType2 ------------------------> $with_freetype fontconfig -----------------------> $with_fontconfig libavcodec -----------------------> $with_libavcodec +libswscale -----------------------> $with_libswscale vImage ---------------------------> $with_vimage ImageMagick ----------------------> $with_imagemagick Magick++ -------------------------> $with_magickpp diff --git a/synfig-core/trunk/src/modules/mod_libavcodec/trgt_av.cpp b/synfig-core/trunk/src/modules/mod_libavcodec/trgt_av.cpp index f1d9333..e067761 100644 --- a/synfig-core/trunk/src/modules/mod_libavcodec/trgt_av.cpp +++ b/synfig-core/trunk/src/modules/mod_libavcodec/trgt_av.cpp @@ -36,6 +36,9 @@ extern "C" { #include +#ifdef HAVE_LIBSWSCALE +# include +#endif } #include @@ -389,9 +392,23 @@ public: if ( pict && context->pix_fmt != PIX_FMT_RGB24 ) { //We're using RGBA at the moment, write custom conversion code later (get less accuracy errors) +#ifdef HAVE_LIBSWSCALE + struct SwsContext* img_convert_ctx = + sws_getContext(context->width, context->height, PIX_FMT_RGB24, + context->width, context->height, context->pix_fmt, + SWS_BICUBIC, NULL, NULL, NULL); + + sws_scale(img_convert_ctx, pict->data, pict->linesize, + + 0, context->height, encodable->data, + encodable->linesize); + + sws_freeContext (img_convert_ctx); +#else img_convert((AVPicture *)encodable, context->pix_fmt, (AVPicture *)pict, PIX_FMT_RGB24, context->width, context->height); +#endif pict = encodable; }