gimp-gap r826 - in trunk: . libgapbase vid_common



Author: wolfgangh
Date: Sat Apr  4 07:03:12 2009
New Revision: 826
URL: http://svn.gnome.org/viewvc/gimp-gap?rev=826&view=rev

Log:
fixes for build in Win32 MinGW environment

Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/libgapbase/gap_val_file.c
   trunk/vid_common/gap_cme_main.c

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Sat Apr  4 07:03:12 2009
@@ -74,14 +74,33 @@
 esac
 AC_MSG_RESULT([$target_or_host])
 
+dnl prefix and suffix of librarynames (for win32 environment)
+dnl notes:
+dnl older gimp-gap releases automatically used .lib suffix (MSVC style) when build runs in MinGW
+dnl Win32 environment. (see notes on bug #324854 reported 2005.12.23 for details)
+dnl Now i have setup a MinGW build environment based on gcc where
+dnl ffmpeg-0.5 libraries are built in unix typical stlye ending with extension .a
+dnl i added the configure option --enable-win32libnames to support
+dnl old behaviour (but build with MSVC is not tested and not fully supported and probably may fail)
+
+MINGW_LIBPREF="lib"
+MINGW_LIBSUF=".a"
+
+AC_ARG_ENABLE(win32libnames,
+              [  --enable-win32libnames     use MSVC style for library extension .lib instead of .a on MinGW environment])
+  if test "x$enable_win32libnames" = "xyes"; then
+    MINGW_LIBPREF=""
+    MINGW_LIBSUF=".lib"
+  fi
+  
 
 AC_MSG_CHECKING([for native Win32])
 case "$target_or_host" in
   *-*-mingw*)
     os_win32=yes
     PATHSEP=';'
-    LIBPREF=""
-    LIBSUF=".lib"
+    LIBPREF="$MINGW_LIBPREF"
+    LIBSUF="$MINGW_LIBSUF"
     ;;
   *)
     os_win32=no
@@ -363,15 +382,19 @@
       FFMPEG_LIBAVFORMAT_A="$FFMPEG_DIR/libavformat/${LIBPREF}avformat${LIBSUF}"
       FFMPEG_LIBAVCODEC_A="$FFMPEG_DIR/libavcodec/${LIBPREF}avcodec${LIBSUF}"
       FFMPEG_LIBAVUTIL_A="$FFMPEG_DIR/libavutil/${LIBPREF}avutil${LIBSUF}"
+      FFMPEG_LIBAVDEVICE_A="$FFMPEG_DIR/libavdevice/${LIBPREF}avdevice${LIBSUF}"
       dnl
       dnl ffmpeg can be configured to use external codec libs x264, xvid ....
       dnl options for ffmpeg ext libs configuration will be passed to ffmpeg/configure
       dnl if some of those libs are installed (and not explicitly disabled)
-
+      
       FFMPEG_EXTLIBS="$FF_LIBX264 $FF_LIBXVID $FF_BZIP2 $FF_LIBMP3LAME $FF_LIBFAAC $FF_LIBFAAD"
+      if  test "x$os_win32" = "xyes"; then
+        FFMPEG_EXTLIBS="$FFMPEG_EXTLIBS -lws2_32"
+      fi
 
-      GAP_VLIBS_FFMPEG=" $FFMPEG_LIBAVFORMAT_A $FFMPEG_LIBAVCODEC_A $FFMPEG_LIBAVUTIL_A $FFMPEG_EXTLIBS"
-      GAP_VINCS_FFMPEG=" -I$FFMPEG_DIR -I$FFMPEG_DIR/libavcodec -I$FFMPEG_DIR/libavformat -I$FFMPEG_DIR/libavutil "
+      GAP_VLIBS_FFMPEG="  $FFMPEG_LIBAVDEVICE_A $FFMPEG_LIBAVFORMAT_A $FFMPEG_LIBAVCODEC_A $FFMPEG_LIBAVUTIL_A $FFMPEG_EXTLIBS "
+      GAP_VINCS_FFMPEG=" -I$FFMPEG_DIR -I$FFMPEG_DIR/libavcodec -I$FFMPEG_DIR/libavformat -I$FFMPEG_DIR/libavutil -I$FFMPEG_DIR/libavdevice "
 
       vid_ffmpeg_warning="
           $x264_warn
@@ -417,6 +440,13 @@
       	 FFMPEG_CONFIGURE_OPTIONS="$FFMPEG_CONFIGURE_OPTIONS --enable-libxvid"
       fi
       
+      if  test "x$os_win32" = "xyes"; then
+         dnl here we could check for required win32 api version on MonGW Win32 Systems.
+         dnl for now always disable devices on MinGW (that requires latest win32 api to compile)
+         dnl disabling devices is not critical since GIMP-GAP does not use ffmpeg features that
+         dnl require other access than plain videofile io.
+      	 FFMPEG_CONFIGURE_OPTIONS="$FFMPEG_CONFIGURE_OPTIONS --disable-devices"
+      fi
 
       echo "================================="
       echo "Calling FFMPEG configure script options: $FFMPEG_CONFIGURE_OPTIONS"
@@ -424,11 +454,18 @@
       
       cd "$FFMPEG_DIR"
       ./configure $FFMPEG_CONFIGURE_OPTIONS
+      FF_CONFIGURE_RETCODE=$?
       cd "$pwd_dir"
       
       echo "================================="
       echo "FFMPEG configure script done options: $FFMPEG_CONFIGURE_OPTIONS"
+      echo "FFMPEG configure retcode: $FF_CONFIGURE_RETCODE"
       echo "================================="
+
+      if test "$FF_CONFIGURE_RETCODE" != "0"; then
+         vid_ffmpeg_warning="ffmpeg configure script FAILED (--disable-libavformat was activated due to this ERROR)"
+         build_ffmpeg_libs_yesno="no"
+      fi
       
       dnl
       dnl
@@ -570,7 +607,7 @@
 "
   fi
   
-  if test "$xenable_libmpeg3" != "no"; then
+  if test "x$enable_libmpeg3" != "xno"; then
 
 
     if test -f "$with_preinstalled_libmpeg3"; then
@@ -595,7 +632,7 @@
 "
   
   fi;
-  if test "$xenable_libmpeg3" != "no"; then
+  if test "x$enable_libmpeg3" != "xno"; then
     if test -f "$with_preinstalled_libmpeg3incdir/libmpeg3.h"; then
       if test -d "$with_preinstalled_libmpeg3incdir/audio"; then
 	:

Modified: trunk/libgapbase/gap_val_file.c
==============================================================================
--- trunk/libgapbase/gap_val_file.c	(original)
+++ trunk/libgapbase/gap_val_file.c	Sat Apr  4 07:03:12 2009
@@ -182,7 +182,6 @@
   GapValTextFileLines *txf_ptr_prev;
   GapValTextFileLines *txf_ptr_root;
   char         l_buf[4000];
-  int   l_len;
   int   line_nr;
   
   line_nr = 0;
@@ -194,7 +193,6 @@
     while(NULL != fgets(l_buf, 4000-1, l_fp))
     {
       line_nr++;
-      l_len = strlen("(framerate ");
       txf_ptr = g_malloc0(sizeof(GapValTextFileLines));
       txf_ptr->line = g_strdup(l_buf);
       txf_ptr->line_nr=line_nr;
@@ -248,7 +246,7 @@
         fprintf(fp, "%s%d%s %s\n"
                , keyptr->keyword   /* "(keyword " */
                , (int)*val_ptr          /* value */
-	       , term_ptr
+               , term_ptr
                , keyptr->comment
                );
       }
@@ -256,14 +254,19 @@
     case GAP_VAL_GINT64:
       {
         gint64 *val_ptr;
-      
+        char   *l_str;
+
+
         val_ptr = (gint64 *)keyptr->val_ptr;
-        fprintf(fp, "%s%lld%s %s\n"
+        l_str = g_strdup_printf("%s%lld%s %s"
                , keyptr->keyword   /* "(keyword " */
                , *val_ptr          /* value */
-	       , term_ptr
+	           , term_ptr
                , keyptr->comment
                );
+        fprintf(fp, "%s\n", l_str);
+        g_free(l_str);
+
       }
       break;
     case GAP_VAL_GDOUBLE:
@@ -281,7 +284,7 @@
         fprintf(fp, "%s%s%s %s\n"
                , keyptr->keyword   /* "(keyword " */
                , l_dbl_str         /* value */
-	       , term_ptr
+               , term_ptr
                , keyptr->comment
                );
       }
@@ -295,7 +298,7 @@
         {
           fprintf(fp, "%syes%s %s\n"
                , keyptr->keyword   /* "(keyword " */
-	       , term_ptr
+               , term_ptr
                , keyptr->comment
                );
         }
@@ -303,7 +306,7 @@
         {
           fprintf(fp, "%sno%s %s\n"
                , keyptr->keyword   /* "(keyword " */
-	       , term_ptr
+               , term_ptr
                , keyptr->comment
                );
         }
@@ -318,7 +321,7 @@
         {
           fprintf(fp, "%syes%s %s\n"
                , keyptr->keyword   /* "(keyword " */
-	       , term_ptr
+               , term_ptr
                , keyptr->comment
                );
         }
@@ -328,7 +331,7 @@
           {
             fprintf(fp, "%sno%s %s\n"
                , keyptr->keyword   /* "(keyword " */
-	       , term_ptr
+               , term_ptr
                , keyptr->comment
                );
           }
@@ -337,11 +340,11 @@
             fprintf(fp, "%s%d%s %s\n"
                , keyptr->keyword   /* "(keyword " */
                , (int)*val_ptr     /* value */
-	       , term_ptr
+               , term_ptr
                , keyptr->comment
                );
           }
-	    }
+            }
       }
       break;
     case GAP_VAL_STRING:
@@ -373,7 +376,7 @@
         }
                
         fprintf(fp, "\"%s %s\n"
-	       , term_ptr
+               , term_ptr
                , keyptr->comment
                );
         
@@ -412,6 +415,11 @@
    
   l_rc = -1;
 
+  for(keyptr=keylist; keyptr != NULL; keyptr = (GapValKeyList*)keyptr->next)
+  {
+     keyptr->done_flag = FALSE;
+  }   /* end for keylist loop */
+
   if(filename)
   {
       txf_ptr_root = gap_val_load_textfile(filename);
@@ -463,11 +471,11 @@
          }
          else
          {
-	   if(hdr_text)
-	   {
+           if(hdr_text)
+           {
              /* write header if file was empty or not existent */
              fprintf(l_fp, "%s\n", hdr_text);
-	   }
+           }
          }
          
          /* write the unhandled key/values (where key was not found in the file before) */
@@ -516,7 +524,7 @@
              l_len = strlen(keyptr->keyword);
              if(strncmp(txf_ptr->line, keyptr->keyword, l_len) == 0)
              {
-	       l_cnt_keys++;
+               l_cnt_keys++;
                switch(keyptr->dataype)
                {
                  case GAP_VAL_GINT32:
@@ -582,7 +590,7 @@
                         {
                           *val_ptr = atol(&txf_ptr->line[l_len]);
                         }
-		      }
+                      }
                    }
                    break;
                  case GAP_VAL_STRING:
@@ -592,13 +600,13 @@
                       gint32   l_idx;
                       
                       val_ptr = (gchar *)keyptr->val_ptr;
-		      while(txf_ptr->line[l_len] == ' ')
-		      {
-		        l_len++;  /* skip spaces between keyword and starting quote */
-		      }
+                      while(txf_ptr->line[l_len] == ' ')
+                      {
+                        l_len++;  /* skip spaces between keyword and starting quote */
+                      }
                       if(txf_ptr->line[l_len] == '"')
                       {
-		        l_len++;  /* skip starting quote */
+                        l_len++;  /* skip starting quote */
                         esc_flag = FALSE;
                         for(l_idx=0; l_idx < MIN(4000-l_len, keyptr->len); l_idx++)
                         {

Modified: trunk/vid_common/gap_cme_main.c
==============================================================================
--- trunk/vid_common/gap_cme_main.c	(original)
+++ trunk/vid_common/gap_cme_main.c	Sat Apr  4 07:03:12 2009
@@ -374,7 +374,7 @@
       /* wait 8 seconds to give the encoder process a chance to exit 
        * (and/or accept a possible cancel request)
        */
-      sleep(8);
+      usleep(800000);
 
       if(gap_debug)
       {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]