X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fmodules%2Fmod_libavcodec%2Ftrgt_av.cpp;h=e067761dc1dec668329bf19b791410f5a273a88f;hb=85c06910386d5072c6b55de777587bc5d46ba205;hp=8a3e373dbe68f3e49df8de42a4b5da5408776f0f;hpb=d061d675f5eecd50db043141ae5d2ad3edde83b7;p=synfig.git 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 8a3e373..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; } @@ -674,7 +691,11 @@ public: if(!(format->flags & AVFMT_NOFILE)) { /* close the output file */ +#if LIBAVFORMAT_VERSION_INT >= (52<<16) + url_fclose(formatc->pb); +#else url_fclose(&formatc->pb); +#endif } /* free the stream */