diff -Nru osdpip-git-20120212-orig/decoder.c osdpip-git-20120212-deprecated_ffmpeg/decoder.c --- osdpip-git-20120212-orig/decoder.c 2012-02-12 12:41:01.000000000 +0000 +++ osdpip-git-20120212-deprecated_ffmpeg/decoder.c 2012-04-01 13:22:22.000000000 +0000 @@ -34,8 +34,16 @@ printf("codec not found\n"); return -1; } +#ifdef FF_API_ALLOC_CONTEXT + m_Context = avcodec_alloc_context3(m_Codec); +#else m_Context = avcodec_alloc_context(); +#endif //FF_API_ALLOC_CONTEXT +#ifdef FF_API_AVCODEC_OPEN + if (avcodec_open2(m_Context, m_Codec, NULL) < 0) +#else if (avcodec_open(m_Context, m_Codec) < 0) +#endif //FF_API_AVCODEC_OPEN { printf("could not open codec\n"); return -1; @@ -106,6 +114,19 @@ return -1; } +#ifdef FF_API_OLD_AVOPTIONS + av_opt_set_int(context, "srcw", m_Context->width - (OsdPipSetup.CropLeft + OsdPipSetup.CropRight), 0); + av_opt_set_int(context, "srch", m_Context->height - (OsdPipSetup.CropTop + OsdPipSetup.CropBottom), 0); + av_opt_set_int(context, "src_format", PIX_FMT_YUV420P, 0); + av_opt_set_int(context, "dstw", m_Width, 0); + av_opt_set_int(context, "dsth", m_Height, 0); +#ifdef USE_NEW_FFMPEG_HEADERS + av_opt_set_int(context, "dst_format", ConvertToRGB ? PIX_FMT_RGB32 : PIX_FMT_YUV420P, 0); +#else + av_opt_set_int(context, "dst_format", ConvertToRGB ? PIX_FMT_RGBA32 : PIX_FMT_YUV420P, 0); +#endif + av_opt_set_int(context, "sws_flags", SWS_LANCZOS, 0); +#else //FF_API_OLD_AVOPTIONS av_set_int(context, "srcw", m_Context->width - (OsdPipSetup.CropLeft + OsdPipSetup.CropRight)); av_set_int(context, "srch", m_Context->height - (OsdPipSetup.CropTop + OsdPipSetup.CropBottom)); av_set_int(context, "src_format", PIX_FMT_YUV420P); @@ -117,6 +138,7 @@ av_set_int(context, "dst_format", ConvertToRGB ? PIX_FMT_RGBA32 : PIX_FMT_YUV420P); #endif av_set_int(context, "sws_flags", SWS_LANCZOS); +#endif //FF_API_OLD_AVOPTIONS if (sws_init_context(context, NULL, NULL) < 0) { printf("Error initializing conversion context.\n"); diff -Nru osdpip-git-20120212-orig/osdpip.c osdpip-git-20120212-deprecated_ffmpeg/osdpip.c --- osdpip-git-20120212-orig/osdpip.c 2012-04-01 13:08:42.000000000 +0000 +++ osdpip-git-20120212-deprecated_ffmpeg/osdpip.c 2012-04-01 13:17:59.000000000 +0000 @@ -70,8 +70,10 @@ bool cPluginOsdpip::Initialize(void) { +#ifndef FF_API_AVCODEC_INIT // must be called before using avcodec lib avcodec_init(); +#endif //FF_API_AVCODEC_INIT // register all the codecs (you can also register only the codec // you wish to have smaller code) avcodec_register_all();