Hi Guys

With 1.0.0beta2 the xvid guys have changed a bunch of things that cause
the avifile configure script to barf on xvid.  There seems to be a bunch
of changes needed.

After some experimentation it seems very difficult to actually obtain
the build number from the code, so instead I've looked at how to
actually do the test necessary.  The simplest way seems to be to take
the version declared in the header and try to init the core xvid module
entry point xvid_global (replacing xvid_init) with the appropriate
headers.  If this returns an error status, the header version of the API
is not supported by the library.

It would also appear that the library no longer gives the API it
supports, only the version number it actually is.  The api_version
variable is gone and it's equivalent returns only the version number. 
There doesn't seem to be a way to check the api version of the library
against the constants defined in xvid.h - a global grep of the sources
didn't reveal anything being set to any API constant anywhere.  What
I've done is modify the code of the test to compare the version of the
xvid.h header to the range of APIs supported by the library itself. 
This seems a reasonable configure safeguard against mis-installed
versions.

Given that xvid_init is gone and now replaced my xvid_global I'm
suspecting there may be compile problems too, but we shall see.  This is
enough for tonight! :-)

Enclosed below is a patch that fixes the m4 file for xvid from which
configure is derived by autogen.sh so that it now works with both
xvidcore version 1.0.0beta2 and version 0.9.x.

Hope this is useful.

Regards, Bevis.

*** m4/xvid.m4.orig	2003-12-22 13:14:07.000000000 +1100
--- m4/xvid.m4	2003-12-24 23:29:05.000000000 +1100
***************
*** 54,66 ****
  
  int main ()
  {
    XVID_INIT_PARAM xinit;
    system("touch conf.xvidtest");
  
    xinit.cpu_flags = 0;
    xvid_init(NULL, 0, &xinit, NULL);
  
!   if (xinit.api_version == API_VERSION) {
      return 0;
    } else {
      printf("Header file and library are out of sync. Header file supports\n"
--- 54,88 ----
  
  int main ()
  {
+ #ifdef XVID_API    /* name of API_VERSION after xvid 1.x.x */
+   xvid_gbl_init_t xinit;
+ 
+   memset(&xinit,0,sizeof(xvid_gbl_init_t));
+   xinit.version = XVID_VERSION;
+ #else
    XVID_INIT_PARAM xinit;
+ #endif
    system("touch conf.xvidtest");
  
+ #ifdef XVID_API
+   xinit.cpu_flags = 0;
+   /* XVID_GBL_INIT is actual opt=0 but if we want to determine */
+   /* the actual version of the library we need to call it with */
+   /* XVID_GBL_INFO and then look at actual_version...          */
+   if( xvid_global(NULL, XVID_GBL_INIT, &xinit, NULL) == XVID_ERR_VERSION )
+   {
+ 	printf("xvid_global(INIT) reports XVID_ERR_VERSION\n"); 
+ 	printf("This would imply the header file and library are out of sync.\n");
+ 	return 1;
+   }
+   return 0;
+ #else
    xinit.cpu_flags = 0;
    xvid_init(NULL, 0, &xinit, NULL);
+ #endif
  
! #ifndef XVID_API
!   if (xinit.api_version == API_VERSION) {  /* for older versions of xvid */
      return 0;
    } else {
      printf("Header file and library are out of sync. Header file supports\n"
***************
*** 69,74 ****
--- 91,97 ----
  	   xinit.api_version >> 16, xinit.api_version & 0xFFFF);
      return 1;
    }
+ #endif
  }		       ],
  		       [ ac_cv_val_HAVE_XVID=yes ],
  		       [ ac_cv_val_HAVE_XVID=no ],

Reply via email to