--- /dev/null
+--- avifile-0.7-0.7.38/m4/xvid.m4.orig 2003-12-29 23:26:52.197966008 +0100
++++ avifile-0.7-0.7.38/m4/xvid.m4 2003-12-29 23:29:36.804941944 +0100
+@@ -54,19 +54,18 @@
+
+ int main ()
+ {
+- XVID_INIT_PARAM xinit;
++ xvid_gbl_init_t xinit;
++ int i;
+ system("touch conf.xvidtest");
+
++ xinit.version = XVID_VERSION;
+ xinit.cpu_flags = 0;
+- xvid_init(NULL, 0, &xinit, NULL);
++ i = xvid_global(NULL, 0, &xinit, NULL);
+
+- if (xinit.api_version == API_VERSION) {
++ if (i != XVID_ERR_VERSION) {
+ return 0;
+ } else {
+- printf("Header file and library are out of sync. Header file supports\n"
+- "version %d.%d API and shared library supports version %d.%d API.\n",
+- API_VERSION >> 16, API_VERSION & 0xFFFF,
+- xinit.api_version >> 16, xinit.api_version & 0xFFFF);
++ printf("Headers and library version mismatch.\n");
+ return 1;
+ }
+ } ],
+--- avifile-0.7-0.7.38/plugins/libxvid/fillplugins.h.orig 2003-03-23 01:57:47.000000000 +0100
++++ avifile-0.7-0.7.38/plugins/libxvid/fillplugins.h 2003-12-29 22:36:21.944634536 +0100
+@@ -28,7 +28,7 @@
+ XVIDCSTR(interlacing);
+ XVIDCSTR(quant_type);
+
+-#if API_VERSION >= ((2 << 16) | (1))
++#if XVID_API >= XVID_MAKE_API(2, 1)
+ XVIDCSTR(inter4v);
+ XVIDCSTR(diamond_search);
+ XVIDCSTR(adaptive_quant);
+--- avifile-0.7-0.7.38/plugins/libxvid/xvid.cpp.orig 2003-05-20 16:39:20.000000000 +0200
++++ avifile-0.7-0.7.38/plugins/libxvid/xvid.cpp 2003-12-30 00:36:58.431521312 +0100
+@@ -55,13 +55,15 @@
+ if (m_pHandle)
+ return -1;
+
+- XVID_INIT_PARAM init;
+- XVID_DEC_PARAM param;
++ xvid_gbl_init_t init;
++ xvid_dec_create_t param;
+
++ init.version = XVID_VERSION;
+ init.cpu_flags = 0;
+ //init.cpu_flags = XVID_CPU_FORCE;// | XVID_CPU_MMX;
+- xvid_init(NULL, 0, &init, NULL);
++ xvid_global(NULL, 0, &init, NULL);
+
++ param.version = XVID_VERSION;
+ param.width = m_Dest.biWidth;
+ param.height = labs(m_Dest.biHeight);
+
+@@ -88,10 +90,11 @@
+ int is_keyframe, bool render = true,
+ CImage** pOut = 0)
+ {
+- XVID_DEC_FRAME param;
++ xvid_dec_frame_t param;
+ if (!size || !m_pHandle)
+ return 0;
+ //AVM_WRITE(strDebug, "csp: 0x%x bitcount: %d height: %d\n", csp, m_Dest.biBitCount, m_Dest.biHeight);
++ param.version = XVID_VERSION;
+ param.bitstream = (void*) src;
+ param.length = size;
+
+@@ -107,74 +110,63 @@
+ case 16:
+ if (csp == 3)
+ {
+- param.colorspace = XVID_CSP_RGB565;
++ param.output.csp = XVID_CSP_RGB565;
+ break;
+ }
+ // 16 bit with csp == 0 is 15bit
+ /* fall through */
+ case 15:
+- param.colorspace = XVID_CSP_RGB555;
++ param.output.csp = XVID_CSP_RGB555;
+ break;
+ case 24:
+- param.colorspace = XVID_CSP_RGB24;
++ param.output.csp = XVID_CSP_BGR;
+ break;
+ case 32:
+- param.colorspace = XVID_CSP_RGB32;
++ param.output.csp = XVID_CSP_RGBA;
+ break;
+ default:
+ return -1;
+ }
+ if (pImage->GetFmt()->biHeight > 0)
+- param.colorspace |= XVID_CSP_VFLIP;
++ param.output.csp |= XVID_CSP_VFLIP;
+ // RGB also doesn't seems work;
+- param.colorspace = XVID_CSP_USER;
++ param.output.csp = XVID_CSP_USER;
+ break;
+ case fccYV12:
+- //param.colorspace = XVID_CSP_YV12;
+- param.colorspace = XVID_CSP_USER;
++ //param.output.csp = XVID_CSP_YV12;
++ param.output.csp = XVID_CSP_USER;
+ break;
+ case fccI420:
+- param.colorspace = XVID_CSP_I420; // untested
++ param.output.csp = XVID_CSP_I420; // untested
+ break;
+ case fccYUY2:
+- param.colorspace = XVID_CSP_YUY2;
++ param.output.csp = XVID_CSP_YUY2;
+ break;
+ case fccYVYU:
+- param.colorspace = XVID_CSP_YVYU;
++ param.output.csp = XVID_CSP_YVYU;
+ break;
+ case fccUYVY:
+- param.colorspace = XVID_CSP_UYVY;
++ param.output.csp = XVID_CSP_UYVY;
+ break;
+ default:
+ return -1;
+ }
+- //printf("XXXXXXXXXX %d %d %d\n", size, m_Dest.biWidth, param.colorspace);
++ //printf("XXXXXXXXXX %d %d %d\n", size, m_Dest.biWidth, param.output.csp);
+
+- param.stride = pImage->Width(); //+6;
+- param.image = pImage->Data();
++ param.output.stride[0] = pImage->Width(); //+6;
++ param.output.plane[0] = pImage->Data();
+ pImage->SetQuality((float) m_iLastPPMode / MAX_QUALITY);
+ }
+ else
+- param.colorspace = XVID_CSP_NULL;
++ param.output.csp = XVID_CSP_NULL;
+
+ if (xvid_decore(m_pHandle, XVID_DEC_DECODE, ¶m, NULL) != 0)
+ return -1;
+
+- if (param.colorspace == XVID_CSP_USER)
++ if (param.output.csp == XVID_CSP_USER)
+ {
+- // internal format of XVID data - using for YV12
+- // for some reason I couldn't read YV12 with CSP setting
+- struct dp
+- {
+- const uint8_t *y;
+- const uint8_t *u;
+- const uint8_t *v;
+- int stride_y;
+- int stride_uv;
+- };
+- const struct dp* d = (const struct dp*) param.image;
+- const uint8_t* p[3] = { d->y, d->v, d->u };
+- int s[3] = { d->stride_y, d->stride_uv, d->stride_uv };
++ void* p[3] = { param.output.plane[0], param.output.plane[1], param.output.plane[2] };
++ int s[3] = { param.output.stride[0], param.output.stride[1], param.output.stride[2] };
+ BitmapInfo bi(m_Dest);
+ bi.SetSpace(fccYV12);
+ CImage ci(&bi, (const uint8_t**) p, s, false);
+@@ -242,7 +234,8 @@
+ void* m_pHandle;
+ int m_iQuant;
+ bool m_bRtMode;
+- int general;
++ int vol_flags;
++ int vop_flags;
+ int motion;
+ public:
+ XVID_VideoEncoder(const CodecInfo& info, fourcc_t compressor, const BITMAPINFOHEADER& bh)
+@@ -259,40 +252,43 @@
+ virtual int EncodeFrame(const CImage* src, void* dest, int* is_keyframe, uint_t* size, int* lpckid=0)
+ {
+ int xerr;
+- XVID_ENC_FRAME param;
+- XVID_ENC_STATS result;
++ xvid_enc_frame_t param;
++ xvid_enc_stats_t result;
++ param.version = XVID_VERSION;
++ result.version = XVID_VERSION;
+ param.bitstream = dest;
+
+ switch (m_bh.biCompression)
+ {
+ case 0:
+- param.colorspace = XVID_CSP_RGB24;
++ param.input.csp = XVID_CSP_BGR;
+ break;
+ case fccYUY2:
+- param.colorspace = XVID_CSP_YUY2;
++ param.input.csp = XVID_CSP_YUY2;
+ break;
+ case fccYV12:
+- param.colorspace = XVID_CSP_YV12;
++ param.input.csp = XVID_CSP_YV12;
+ break;
+ case fccI420:
+- param.colorspace = XVID_CSP_I420;
++ param.input.csp = XVID_CSP_I420;
+ break;
+ }
+
+- param.image = (void*) src->Data();
++ param.input.plane[0] = (void*) src->Data();
+ param.length = -1; // this is written by the routine
+ param.quant = 0;
+- param.intra = (!m_uiFrames++) ? 1 : -1;
++ //param.intra = (!m_uiFrames++) ? 1 : -1;
+
+-#if API_VERSION >= (2 << 16)
+- param.general = general;
++#if XVID_API >= XVID_MAKE_API(2, 0)
++ param.vol_flags = vol_flags;
++ param.vop_flags = vop_flags;
+ param.motion = motion;
+ #endif
+ if (m_bRtMode)
+ {
+ param.quant=m_iQuant;
+ // let encoder decide if frame is INTER/INTRA
+- param.intra=-1;
++ //param.intra=-1;
+ xerr = xvid_encore(m_pHandle, XVID_ENC_ENCODE, ¶m, &result);
+ }
+ else
+@@ -300,11 +296,11 @@
+ xerr = xvid_encore(m_pHandle, XVID_ENC_ENCODE, ¶m, &result);
+ }
+
+- //printf("%d %d %d\n", param.intra, param.colorspace, param.length);
++ //printf("%d %d %d\n", param.intra, param.input.csp, param.length);
+ // xframe.quant = QUANTI; // is quant != 0, use a fixed quant (and ignore bitrate)
+
+ if (is_keyframe)
+- *is_keyframe = param.intra ? 16 : 0;
++ *is_keyframe = (param.type == XVID_KEYFRAME) ? 16 : 0;
+ if (size)
+ *size = param.length;
+ return 0;
+@@ -331,14 +327,16 @@
+ {
+ int xerr;
+
+- XVID_INIT_PARAM xinit;
+- XVID_ENC_PARAM param;
++ xvid_gbl_init_t xinit;
++ xvid_enc_create_t param;
+
+ m_uiFrames = 0;
++ xinit.version = XVID_VERSION;
+ xinit.cpu_flags = 0;
+- xvid_init(NULL, 0, &xinit, NULL);
++ xvid_global(NULL, 0, &xinit, NULL);
+
+ memset(¶m, 0, sizeof(param));
++ param.version = XVID_VERSION;
+ param.width = m_bh.biWidth;
+ param.height = labs(m_bh.biHeight);
+
+@@ -348,17 +346,17 @@
+
+ PluginGetAttrInt(m_Info, xvidstr_rc_bitrate, &t);
+
+-#if API_VERSION >= ((2 << 16) | (1))
+- param.rc_bitrate = t; // such API change are not funny at all
++#if XVID_API >= XVID_MAKE_API(2, 1)
++ //param.rc_bitrate = t; // such API change are not funny at all
+ #else
+ param.bitrate = t;
+ #endif
+
+-#if API_VERSION >= (2 << 16)
++#if XVID_API >= XVID_MAKE_API(2, 0)
+ PluginGetAttrInt(m_Info, xvidstr_rc_buffer, &t);
+
+-#if API_VERSION >= ((2 << 16) | (1))
+- param.rc_buffer = t;
++#if XVID_API >= XVID_MAKE_API(2, 1)
++ //param.rc_buffer = t;
+ #else
+ param.rc_buffersize = t;
+ #endif
+@@ -366,48 +364,20 @@
+ switch (t)
+ {
+ default:
+- case 0: general = XVID_H263QUANT; break;
+- case 1: general = XVID_MPEGQUANT; break;
++ case 0: vol_flags = 0; break;
++ case 1: vol_flags = XVID_VOL_MPEGQUANT; break;
+ }
+
+-#if API_VERSION >= ((2 << 16) | (1))
+ PluginGetAttrInt(m_Info, xvidstr_inter4v, &t);
+- if (t) general |= XVID_INTER4V;
++ if (t) vop_flags |= XVID_VOP_INTER4V;
+
+ PluginGetAttrInt(m_Info, xvidstr_diamond_search, &t);
+- if (t) general |= PMV_HALFPELDIAMOND16 | PMV_HALFPELDIAMOND8;
+-
+- PluginGetAttrInt(m_Info, xvidstr_adaptive_quant, &t);
+- if (t) general |= XVID_ADAPTIVEQUANT;
+-#endif
+- PluginGetAttrInt(m_Info, xvidstr_halfpel, &t);
+- if (t) general |= XVID_HALFPEL;
++ if (t) vop_flags |= XVID_VOP_HALFPEL;
+
+-#ifdef XVID_INTERLACING
++#ifdef XVID_VOL_INTERLACING
+ PluginGetAttrInt(m_Info, xvidstr_interlacing, &t);
+- if (t) general |= XVID_INTERLACING;
+-#endif
+- PluginGetAttrInt(m_Info, xvidstr_lum_masking, &t);
+- if (t) general |= XVID_LUMIMASKING;
+-
+- // table from the xvid sample source code
+- static const int motion_presets[7] =
+- {
+- 0,
+- PMV_EARLYSTOP16,
+- PMV_EARLYSTOP16,
+- PMV_EARLYSTOP16 | PMV_HALFPELREFINE16,
+- PMV_EARLYSTOP16 | PMV_HALFPELREFINE16,
+- PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 | PMV_EARLYSTOP8
+- | PMV_HALFPELREFINE8,
+- PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 | PMV_EXTSEARCH16
+- | PMV_EARLYSTOP8 | PMV_HALFPELREFINE8 | PMV_EXTSEARCH8
+-#ifdef XVID_INTERLACING
+- | PMV_USESQUARES16 | PMV_USESQUARES8
++ if (t) vol_flags |= XVID_VOL_INTERLACING;
+ #endif
+- };
+- PluginGetAttrInt(m_Info, xvidstr_motion_search, &t);
+- motion = (t >= 0 && t < 7) ? motion_presets[t] : 0;
+
+ #if 0
+ // Motion estimation options
+@@ -434,8 +404,8 @@
+ PluginGetAttrInt(m_Info, xvidstr_rc_reaction_ratio, ¶m.rc_reaction_ratio);
+ PluginGetAttrInt(m_Info, xvidstr_motion_search, ¶m.motion_search);
+ #endif
+- PluginGetAttrInt(m_Info, xvidstr_max_quantizer, ¶m.max_quantizer);
+- PluginGetAttrInt(m_Info, xvidstr_min_quantizer, ¶m.min_quantizer);
++ PluginGetAttrInt(m_Info, xvidstr_max_quantizer, ¶m.max_quant[0]);
++ PluginGetAttrInt(m_Info, xvidstr_min_quantizer, ¶m.min_quant[0]);
+ PluginGetAttrInt(m_Info, xvidstr_max_key_interval, ¶m.max_key_interval);
+ // fast deinterlace
+ // use bidirectional coding