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=93f0d08b84326092e93cedc3686bf2fa70bec3dc;hpb=bbf05c1d5f53f61ec5b033c5c305a497d8389d46;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 93f0d08..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 @@ -286,7 +289,7 @@ public: class VideoEncoder { public: - AVFrame *encodable; //for compressiong and output to a file (in compatible pixel format) + AVFrame *encodable; //for compression and output to a file (in compatible pixel format) vector videobuffer; @@ -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); @@ -454,7 +471,7 @@ public: return true; } - void close(AVFormatContext *formatc, AVStream *stream) + void close(AVFormatContext */*formatc*/, AVStream *stream) { if(stream) avcodec_close(stream->codec); @@ -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 */ @@ -745,7 +766,7 @@ public: } // add an audio output stream - AVStream *add_audio_stream(int codec_id,const AudioInfo &aInfo) + AVStream *add_audio_stream(int codec_id,const AudioInfo &/*aInfo*/) { AVCodecContext *context; AVStream *stream; @@ -905,7 +926,7 @@ Target_LibAVCodec::end_frame() } bool -Target_LibAVCodec::start_frame(synfig::ProgressCallback *callback) +Target_LibAVCodec::start_frame(synfig::ProgressCallback */*callback*/) { //prepare all the color buffer stuff, etc. @@ -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");