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=06b5bdd43e6602fded9196b3e79f7cd4a1dd45c0;hpb=445a408d3821ecffd9e93dd98f9ab1a3927e3be0;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 06b5bdd..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; } @@ -406,7 +423,7 @@ public: if( context->coded_frame && context->coded_frame->key_frame) pkt.flags |= PKT_FLAG_KEY; - //cludge for raw picture format (they said they'd fix) + //kluge for raw picture format (they said they'd fix) if (formatc->oformat->flags & AVFMT_RAWPICTURE) { ret = av_write_frame(formatc, &pkt); @@ -642,7 +659,7 @@ public: void CleanUp() { - int i; + unsigned int i; if(picture) free_picture(picture); @@ -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 */ @@ -929,7 +950,7 @@ Target_LibAVCodec::end_scanline() bool Target_LibAVCodec::init() { - //hardcode test for mpeg + //hardcoded test for mpeg if(!data->Initialize(filename.c_str(),NULL)) { synfig::warning("Unable to Initialize the audio video encoders");