Submitted By:            Randy McMurchy <randy_at_linuxfromscratch_dot_org>
Date:                    2007-08-17
Initial Package Version: 1.0.3
Upstream Status:         In upstream CVS
Origin:                  Upstream CVS (http://cvs.exit1.org/cgi-bin/viewcvs.cgi/)
Description:             Fixes compilation with updated libmpeg3-1.7 API
Special Notes:           You must run autoconf to generate a new configure script
                         before you build the package

$Id: transcode-1.0.3-libmpeg3_fixes-1.patch 1864 2007-08-17 15:33:37Z randy $


diff -Nau transcode-1.0.3-orig/config.h.in transcode-1.0.3/config.h.in
--- transcode-1.0.3-orig/config.h.in	2007-04-16 18:08:09.000000000 +0000
+++ transcode-1.0.3/config.h.in	2007-08-17 14:46:27.000000000 +0000
@@ -423,6 +423,9 @@
 /* lame version */
 #undef TC_LAME_VERSION
 
+/* libmpeg3 version */
+#undef TC_LIBMPEG3_VERSION
+
 /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
 #undef TIME_WITH_SYS_TIME



diff -Nau transcode-1.0.3-orig/configure.in transcode-1.0.3/configure.in 
--- transcode-1.0.3-orig/configure.in	2007-04-16 17:51:08.000000000 +0000
+++ transcode-1.0.3/configure.in	2007-08-17 14:45:07.000000000 +0000
@@ -1083,7 +1083,34 @@
   if test x"$libmpeg3_inc" = x"no" ; then
     have_libmpeg3="no"
     TC_PKG_ERROR(libmpeg3, libmpeg3.h, no, libmpeg3, [http://heroinewarrior.com/libmpeg3/],
-      [cannot compile libmpeg3.h])
+      [cannot compile libmpeg3 program])
+  fi
+
+  save_CPPFLAGS="$CPPFLAGS"
+  save_LIBS="$LIBS"
+  CPPFLAGS="$CPPFLAGS $LIBMPEG3_CFLAGS"
+  LIBS="$LIBS $LIBMPEG3_LIBS"
+
+  AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "libmpeg3.h"
+int main (int argc, char *argv[])
+{
+    printf("%i%i%i\n", mpeg3_major(), mpeg3_minor(), mpeg3_release());
+    return 0;
+}],
+  [libmpeg3_version="`./conftest$ac_exeext`"],
+  [TC_PKG_ERROR(libmpeg3, libmpeg3.h, no, libmpeg3, [http://heroinewarrior.com/libmpeg3/],
+      [cannot compile libmpeg3 test program])],,
+  [echo $ac_n "cross compiling; assumed OK... $ac_c"])
+
+  CPPFLAGS="$save_CPPFLAGS"
+  LIBS="$save_LIBS"
+
+  if test x"$have_libmpeg3" = x"yes" ; then
+    AC_DEFINE_UNQUOTED([TC_LIBMPEG3_VERSION], $libmpeg3_version, [libmpeg3 version])
   fi
 fi
 TC_PKG_HAVE(libmpeg3, LIBMPEG3)


diff -Nau transcode-1.0.3-orig/import/import_mpeg3.c transcode-1.0.3/import/import_mpeg3.c
--- transcode-1.0.3-orig/import/import_mpeg3.c	2005-07-04 07:23:01.000000000 +0000
+++ transcode-1.0.3/import/import_mpeg3.c	2007-08-17 14:47:25.000000000 +0000
@@ -67,8 +67,10 @@
 
 MOD_open
 {
-
-  int i;
+  int i = 0;
+#if TC_LIBMPEG3_VERSION >= 170
+  int retcode = 0;
+#endif
 
   param->fd = NULL;
 
@@ -79,15 +81,25 @@
   if (param->flag == TC_VIDEO) {
       if (!file) {
 	  if (!file_a) {
+#if TC_LIBMPEG3_VERSION >= 170
+	      if((file = mpeg3_open(vob->video_in_file, &retcode))==NULL) {
+		  fprintf(stderr, "open file failed with error %i\n", retcode);
+#else
 	      if((file = mpeg3_open(vob->video_in_file))==NULL) {
-		  fprintf(stderr, "open file failed\n");
+		  fprintf(stderr, "open file failed with error\n");
+#endif
 		  return(TC_IMPORT_ERROR);
 	      }
 	      if (verbose & TC_DEBUG)
                   printf("[%s] Opened video NO copy\n", MOD_NAME);
 	  } else if (file_a) {
+#if TC_LIBMPEG3_VERSION >= 170
+	      if((file = mpeg3_open_copy(vob->video_in_file, file_a, &retcode))==NULL) {
+		  fprintf(stderr, "open file failed with error %i\n", retcode);
+#else
 	      if((file = mpeg3_open_copy(vob->video_in_file, file_a))==NULL) {
-		  fprintf(stderr, "open file failed\n");
+		  fprintf(stderr, "open file failed with error\n");
+#endif
 		  return(TC_IMPORT_ERROR);
 	      }
 	      if (verbose & TC_DEBUG)
@@ -98,15 +110,25 @@
   if (param->flag == TC_AUDIO) {
       if (!file_a) {
 	  if (!file) {
+#if TC_LIBMPEG3_VERSION >= 170
+	      if((file_a = mpeg3_open(vob->audio_in_file, &retcode))==NULL) {
+		  fprintf(stderr, "open file failed with error %i\n", retcode);
+#else
 	      if((file_a = mpeg3_open(vob->audio_in_file))==NULL) {
-		  fprintf(stderr, "open audio file failed\n");
+		  fprintf(stderr, "open file failed with error\n");
+#endif
 		  return(TC_IMPORT_ERROR);
 	      }
 	      if (verbose & TC_DEBUG)
                   printf("[%s] Opened audio NO copy\n", MOD_NAME);
 	  } else if (file) {
+#if TC_LIBMPEG3_VERSION >= 170
+	      if((file_a = mpeg3_open_copy(vob->audio_in_file, file, &retcode))==NULL) {
+		  fprintf(stderr, "open file failed\n");
+#else
 	      if((file_a = mpeg3_open_copy(vob->audio_in_file, file))==NULL) {
-		  fprintf(stderr, "open_copy audio file failed\n");
+		  fprintf(stderr, "open file failed\n");
+#endif
 		  return(TC_IMPORT_ERROR);
 	      }
 	      if (verbose & TC_DEBUG)
@@ -121,11 +143,6 @@
       int a_rate, a_chan;
       long a_samp;
 
-#ifdef ARCH_X86  /* until otherwise confirmed to work elsewhere */
-#ifdef HAVE_MMX
-      mpeg3_set_mmx(file_a, 1);
-#endif
-#endif
       mpeg3_set_cpus(file_a,1);
 
   
@@ -184,11 +201,6 @@
 
     if(!mpeg3_check_sig(vob->video_in_file)) return(TC_IMPORT_ERROR);
 
-#ifdef ARCH_X86  /* until otherwise confirmed to work elsewhere */
-#ifdef HAVE_MMX
-    mpeg3_set_mmx(file, 1);
-#endif
-#endif
     mpeg3_set_cpus(file,1);
 

 
