gimp-gap r814 - in trunk: . gap libgapvidapi libgapvidutil vid_common vid_enc_rawframes vid_enc_single



Author: wolfgangh
Date: Sat Feb 21 17:32:45 2009
New Revision: 814
URL: http://svn.gnome.org/viewvc/gimp-gap?rev=814&view=rev

Log:
fix remaining build problems of #571444, fixes on videoindex creation and usage

Modified:
   trunk/ChangeLog
   trunk/Makefile.am
   trunk/configure.in
   trunk/gap/Makefile.am
   trunk/gap/gap_arr_dialog.c
   trunk/gap/gap_arr_dialog.h
   trunk/gap/gap_audio_extract.c
   trunk/gap/gap_audio_extract.h
   trunk/gap/gap_frame_fetcher.c
   trunk/gap/gap_frame_fetcher.h
   trunk/gap/gap_player_dialog.c
   trunk/gap/gap_story_dialog.c
   trunk/gap/gap_story_render_audio.c
   trunk/gap/gap_story_render_audio.h
   trunk/gap/gap_story_render_lossless.c
   trunk/gap/gap_story_render_processor.c
   trunk/gap/gap_story_render_processor.h
   trunk/gap/gap_story_render_types.h
   trunk/gap/gap_video_index_creator.c
   trunk/libgapvidapi/gap_vid_api_ffmpeg.c
   trunk/libgapvidutil/gap_gve_story.h
   trunk/vid_common/gap_cme_gui.c
   trunk/vid_enc_rawframes/gap_enc_rawframes_main.c
   trunk/vid_enc_single/gap_enc_singleframes_main.c

Modified: trunk/Makefile.am
==============================================================================
--- trunk/Makefile.am	(original)
+++ trunk/Makefile.am	Sat Feb 21 17:32:45 2009
@@ -8,17 +8,23 @@
 LIBGAPVIDAPI=libgapvidapi
 endif
 
-# todo: videoencoders depend on different libs
-#       but all of them use the GAP_VIDEOAPI_SUPPORT
-#       for storyboard based encoding
-#       compilation should depend primary on those other libs
-if GAP_VIDEOAPI_SUPPORT
+# note: videoencoders all use GAP_VIDEOAPI_SUPPORT
+#       for storyboard based encoding, but this is optional
+#       The storyboard processor can be configured without GAP_VIDEOAPI_SUPPORT
+#       with the restiriction that cliptype MOVIE is not supported in that case.
+#       therefore compilation of the video encoders no longer depends on GAP_VIDEOAPI_SUPPORT
+### if GAP_VIDEOAPI_SUPPORT
 LIBGAPVIDUTIL=libgapvidutil
 VID_COMMON=vid_common
-VID_ENC_FFMPEG=vid_enc_ffmpeg
 VID_ENC_RAWFRAMES=vid_enc_rawframes
 VID_ENC_SINGLE=vid_enc_single
 VID_ENC_AVI=vid_enc_avi
+##  endif
+
+# the ffmpeg based video encoder depends on ENABLE_GVA_LIBAVFORMAT_SUPPORT
+# and is not bulit when disabled.
+if ENABLE_GVA_LIBAVFORMAT_SUPPORT
+VID_ENC_FFMPEG=vid_enc_ffmpeg
 endif
 
 

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Sat Feb 21 17:32:45 2009
@@ -137,31 +137,6 @@
   fi
 
 
-dnl ### checks for liba52 (once was required for ffmpeg dvd audio support)
-dnl ### recent ffmpeg no longer supports linking with liba52 (now wants libfaac libfaad libmp3lame)
-dnl ### will be reoved in future (when update to recent ffmpeg has proofed stable)
-dnl
-dnl the check result does not matter unless libavformat is linked or built later on.
-FF_LIBA52=""
-a52_warn=""
-AC_ARG_ENABLE(ff_liba52,
-              [  --disable-ff-liba52          configure libavformat without liba52 disables DVD audio support])
-  if test "x$enable_ff_liba52" != "xno"; then
-    AC_CHECK_LIB(a52, a52_init,
-        [AC_CHECK_HEADER(a52dec/a52.h,
-          FF_LIBA52="-la52",
-          a52_warn="$NEW_LINE ** a52 header file (a52.h) not found (there will be no DVD audio support)")],
-      a52_warn="a52 library (liba52) not found (there will be no DVD audio support)")    
-  fi
-dnl
-dnl old libavformat could be configured to link liba52.a statical --enable-liba52 
-dnl   or dynamical --enable-liba52bin  (open liba52.so.0 at runtime )
-dnl currently only the  --enable-liba52bin option is handled automatically.
-dnl
-dnl NOTE: if only the static library liba52.a is installed, and the dynamical liba52.so.0 is missing 
-dnl       the detection via AC_CHECK_LIB macro fails.
-dnl 
-
 dnl ## libmp3lame lame/lame.h lame_init -lmp3lame -lm
 
 dnl check for libmp3lame library (useful for ffmpeg audio MP3 support)
@@ -217,8 +192,11 @@
 
 
 dnl check for x264 library (additional for ffmpeg video codec support)
-dnl ### TODO check are no longer sufficient for recent ffmeg 2009.01.31.
+dnl ### TODO check are no longer sufficient for recent ffmpeg 2009.01.31.
 dnl ### check shall verify the condition "X264_BUILD >= 65
+dnl ### Note that the missing check it is not critical, since ffmpeg configure script has such a check
+dnl ###      and turns off x264 support when older versions are detected, and prints an error like this:
+dnl ###          ERROR: libx264 version must be >= 0.65.
 dnl the check result does not matter unless libavformat is linked or built later on.
 FF_LIBX264=""
 x264_warn=""
@@ -233,11 +211,20 @@
   fi
 
 
-dnl ### TODO remove the next 2 lines when checks for recent libx264 are fixed.
-FF_LIBX264=""
-x264_warn=" WARNING checks for libx264 ar not up to date, ffmpeg is configured without libx264"
-
+dnl check for xvid library (additional for ffmpeg open xvid video codec support)
+dnl the check result does not matter unless libavformat is linked or built later on.
+xvid_warn=""
 FF_LIBXVID=""
+AC_ARG_ENABLE(ff_libxvid,
+              [  --disable-ff-libxvid         configure libavformat without optional open source variant of xvid video codec])
+  if test "x$enable_ff_libxvid" != "xno"; then
+    AC_CHECK_LIB(xvidcore, xvid_global,
+      [AC_CHECK_HEADER(xvid.h,
+          FF_LIBXVID="-lxvidcore",
+          xvid_warn="$NEW_LINE xvid header file (xvid.h) not found (not critical, but no open xvid video codec support)")],
+      xvid_warn="$NEW_LINE xvid library (libxvidcore) not found (not critical, but no open xvid video codec support)")   
+  fi
+
 
 
 dnl Test for videoapisupport
@@ -360,18 +347,18 @@
       FFMPEG_LIBAVCODEC_A="$FFMPEG_DIR/libavcodec/${LIBPREF}avcodec${LIBSUF}"
       FFMPEG_LIBAVUTIL_A="$FFMPEG_DIR/libavutil/${LIBPREF}avutil${LIBSUF}"
       dnl
-      dnl ffmpeg can be configured to use external codec libs liba52, x264, xvid ....
+      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_LIBA52 $FF_LIBX264 $FF_LIBXVID $FF_BZIP2 $FF_LIBMP3LAME $FF_LIBFAAC $FF_LIBFAAD"
+      FFMPEG_EXTLIBS="$FF_LIBX264 $FF_LIBXVID $FF_BZIP2 $FF_LIBMP3LAME $FF_LIBFAAC $FF_LIBFAAD"
 
       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 "
 
       vid_ffmpeg_warning="
           $x264_warn
-          $a52_warn 
+          $xvid_warn
           $ffbz2_warn 
           $mp3lame_warn 
           $faac_warn 
@@ -392,16 +379,6 @@
       	 FFMPEG_CONFIGURE_OPTIONS="$FFMPEG_CONFIGURE_OPTIONS --disable-bzlib"
       fi
 
-      dnl ### TODO recent ffmpeg no longer supports the option ---enable-liba52bin
-      dnl but now wants other audio libraries --enable-libmp3lame --enable-libfaac --enable-libfaad
-      dnl if test "x$FF_LIBA52" != "x"; then
-         dnl libavformat can be configured to link liba52.a statical --enable-liba52 
-         dnl   or dynamical --enable-liba52bin  (open liba52.so.0 at runtime )
-         dnl   2007.05.17 test with dynamically linked liba52.so.0 did not work properly.
-         dnl              (link ok, but audio extracting test delivered trashed wav file
-      	 dnl FFMPEG_CONFIGURE_OPTIONS="$FFMPEG_CONFIGURE_OPTIONS --enable-liba52bin"
-      dnl fi
-
       dnl configure ffmpeg with optional audio libraries --enable-libmp3lame --enable-libfaac --enable-libfaad
       if test "x$FF_LIBMP3LAME" != "x"; then
       	 FFMPEG_CONFIGURE_OPTIONS="$FFMPEG_CONFIGURE_OPTIONS --enable-libmp3lame"
@@ -414,9 +391,14 @@
       fi
 
       dnl configure ffmpeg libx264 usage (for optional H.264 codec support via libx264)
-      dnl if test "x$FF_LIBX264" != "x"; then
-      	 dnl FFMPEG_CONFIGURE_OPTIONS="$FFMPEG_CONFIGURE_OPTIONS --enable-libfaac"
-      dnl fi
+      if test "x$FF_LIBX264" != "x"; then
+      	 FFMPEG_CONFIGURE_OPTIONS="$FFMPEG_CONFIGURE_OPTIONS --enable-libx264"
+      fi
+
+      dnl configure ffmpeg libxvid usage (for optional open xvid codec support via libxvid)
+      if test "x$FF_LIBXVID" != "x"; then
+      	 FFMPEG_CONFIGURE_OPTIONS="$FFMPEG_CONFIGURE_OPTIONS --enable-libxvid"
+      fi
       
 
       echo "================================="
@@ -462,12 +444,6 @@
 gimp-gap is configured without libavformat
    This reduces the number of supported videoformats both for read and write
    access. libavformat, libavcodec and libavutil are part of $FFMPEG_DIRNAME.
- 
-Warning: checks for libavformat, libavcodec and libavutil are not implemented yet.
-You can get ffmpeg at:
-    http://www.ffmpeg.org/
-    or http://ffmpeg.mplayerhq.hu/download.html
-    (old http://ffmpeg.sourceforge.net)
 "
         GAP_VLIBS_FFMPEG=" "
         GAP_VINCS_FFMPEG=" "
@@ -480,13 +456,13 @@
 dnl ------------------------
 dnl libmpeg3 is used in one of the decoder implementations in the GAP
 dnl Video API (GVA) as far as i know this lib is available only on
-dnl UNIX systems dnl the current gimp-gap includes the libmpeg3-1.5.4
+dnl UNIX systems dnl the current gimp-gap includes the libmpeg3-1.8
 dnl as (unmaintained) sourcetree and calls the libmpeg3 configure
 dnl script.  The generated Makefile will call the libmpeg3 original
 dnl Makefile to build the library libmpeg3.a linking with gimp-gap
 dnl modules is now done statically.
 dnl
-REQ_LIBMPEG3_VERSION="1.5.4"
+REQ_LIBMPEG3_VERSION="1.8"
 
 
 dnl where to find the libmpeg3 sourcedir
@@ -649,7 +625,7 @@
   if test "x$enable_libmpeg3" != "xno"; then
     dnl
     dnl the original tarball from http:www.heroinewarrior.com of
-    dnl libmpeg3-1.5.4 comes without installation help for the library
+    dnl libmpeg3-1.8 comes without installation help for the library
     dnl and its headers.  but (some ?) LINUX distributors provide
     dnl installation rpm packages for libmpeg3
     dnl
@@ -659,7 +635,7 @@
     dnl the current debian) disable CSS decryption.
     dnl
     dnl one solution to face those problems is to get the tarball with
-    dnl the full sourcetree of the libmpeg3-1.5.4 library configure
+    dnl the full sourcetree of the libmpeg3-1.8 library configure
     dnl and make the libmpeg3 from sourcetree and then link statically
     dnl by specifying the option --with-libmpeg3srcdir.
     dnl
@@ -791,7 +767,7 @@
               [  --disable-libxvidcore        don't build with libxvidcore])
   if test "x$enable_libxvidcore" != "xno"; then
     dnl
-    dnl check for libxvidcore 1.0.0
+    dnl check for libxvidcore
     dnl
     xvid_err=""
     AC_CHECK_LIB(xvidcore, xvid_encore,

Modified: trunk/gap/Makefile.am
==============================================================================
--- trunk/gap/Makefile.am	(original)
+++ trunk/gap/Makefile.am	Sat Feb 21 17:32:45 2009
@@ -19,6 +19,8 @@
 if GAP_VIDEOAPI_SUPPORT
 GAPVIDEOAPI = $(top_builddir)/libgapvidapi/libgapvidapi.a  $(GAPVIDEOAPI_EXTLIBS)
 INC_GAPVIDEOAPI = -I$(top_srcdir)/libgapvidapi $(GAPVIDEOAPI_EXTINCS)
+GAP_VIDEO_EXTRACT = gap_video_extract
+GAP_VIDEO_INDEX = gap_video_index
 endif
 
 LIBGAPBASE  = $(top_builddir)/libgapbase/libgapbase.a
@@ -104,8 +106,8 @@
 	gap_player		\
 	gap_onion		\
 	gap_storyboard		\
-	gap_video_extract	\
-	gap_video_index		\
+	$(GAP_VIDEO_EXTRACT)	\
+	$(GAP_VIDEO_INDEX)	\
 	gap_wr_color_curve	\
 	gap_wr_color_levels	\
 	gap_wr_color_huesat	\
@@ -404,11 +406,11 @@
 gap_morph_LDADD =            $(LIBGIMPGAP)  $(LIBGAPBASE) $(GIMP_LIBS)
 gap_name2layer_LDADD =       $(LIBGIMPGAP)  $(LIBGAPBASE) $(GIMP_LIBS)
 gap_navigator_dialog_LDADD = $(LIBGIMPGAP)  $(LIBGAPBASE) $(GIMP_LIBS)
-gap_player_LDADD =           $(GAPVIDEOAPI) $(LIBGAPBASE) $(WAVPLAYCLIENT) ${LIBGAPSTORY} $(GIMP_LIBS)
+gap_player_LDADD =           $(GAPVIDEOAPI) $(WAVPLAYCLIENT) ${LIBGAPSTORY} $(LIBGAPBASE) $(GIMP_LIBS)
 gap_onion_LDADD =            $(LIBGIMPGAP)  $(LIBGAPBASE) $(GIMP_LIBS)
-gap_storyboard_LDADD =       $(GAPVIDEOAPI) $(LIBGAPBASE) $(WAVPLAYCLIENT) ${LIBGAPSTORY} $(GIMP_LIBS)
-gap_video_extract_LDADD =    $(GAPVIDEOAPI) $(LIBGAPBASE) $(WAVPLAYCLIENT) ${LIBGAPSTORY} $(GIMP_LIBS)
-gap_video_index_LDADD =      $(GAPVIDEOAPI) $(LIBGAPBASE) $(LIBGAPSTORY)  $(GIMP_LIBS)
+gap_storyboard_LDADD =       $(GAPVIDEOAPI) $(WAVPLAYCLIENT) ${LIBGAPSTORY} $(LIBGAPBASE) $(GIMP_LIBS)
+gap_video_extract_LDADD =    $(GAPVIDEOAPI) $(WAVPLAYCLIENT) ${LIBGAPSTORY} $(LIBGAPBASE) $(GIMP_LIBS)
+gap_video_index_LDADD =      $(GAPVIDEOAPI) $(LIBGAPSTORY) $(LIBGAPBASE)  $(GIMP_LIBS)
 gap_wr_opacity_LDADD =       $(LIBGIMPGAP)  $(LIBGAPBASE) $(GIMP_LIBS)
 gap_wr_trans_LDADD =         $(LIBGIMPGAP)  $(LIBGAPBASE) $(GIMP_LIBS)
 gap_wr_color_curve_LDADD =   $(LIBGIMPGAP)  $(LIBGAPBASE) $(GIMP_LIBS)

Modified: trunk/gap/gap_arr_dialog.c
==============================================================================
--- trunk/gap/gap_arr_dialog.c	(original)
+++ trunk/gap/gap_arr_dialog.c	Sat Feb 21 17:32:45 2009
@@ -1279,7 +1279,15 @@
   arrint_ptr->dlg = gtk_dialog_new ();
   g_object_set_data (G_OBJECT (arrint_ptr->dlg), GAP_ARR_INTERFACE_PTR, (gpointer)arrint_ptr);
   gtk_window_set_title (GTK_WINDOW (arrint_ptr->dlg), title_txt);
-  gtk_window_set_position (GTK_WINDOW (arrint_ptr->dlg), GTK_WIN_POS_MOUSE);
+
+  // hof: on my Gnome windowmanger (openSUSE 11.11) pop ups created with gtk_dialog_new
+  // often open BEHIND other windows.
+  //
+  // As workaround i commented out placing the pop up on mouse position
+  // (because this would completeley hide the popup behind the other window
+  // when the popup is smaller)
+  
+  // gtk_window_set_position (GTK_WINDOW (arrint_ptr->dlg), GTK_WIN_POS_MOUSE);
   g_signal_connect (G_OBJECT (arrint_ptr->dlg), "destroy",
 		    G_CALLBACK (arr_close_callback),
 		    NULL);
@@ -1833,23 +1841,16 @@
 }  /* end gap_arr_overwrite_file_dialog */
 
 
-/* ============================================================================
+/* ----------------------------
  * gap_arr_msg_win
- *   print a message both to stdout
- *   and to a dialog window with OK button (only when run INTERACTIVE)
- * ============================================================================
+ * ----------------------------
+ *  print a message both to stdout
+ *  and to the gimp image window (only when run INTERACTIVE)
+ *
  */
-
 void
 gap_arr_msg_win(GimpRunMode run_mode, const char *msg)
 {
-  static GapArrButtonArg  l_argv[1];
-  int               l_argc;  
-  
-  l_argv[0].but_txt  = GTK_STOCK_OK;
-  l_argv[0].but_val  = 0;
-  l_argc             = 1;
-
   if(msg)
   {
     if(*msg)
@@ -1864,6 +1865,43 @@
   }
 }    /* end  gap_arr_msg_win */
 
+/* ----------------------------
+ * gap_arr_msg_popup
+ * ----------------------------
+ *  print a message both to stdout
+ *  and to a popup dialog window with OK button (only when run INTERACTIVE)
+ *
+ */
+void gap_arr_msg_popup(GimpRunMode run_mode, const char *msg)
+{
+  static GapArrButtonArg  b_argv[1];
+  static GapArrArg  argv[1];
+
+  b_argv[1].but_txt  = GTK_STOCK_OK;
+  b_argv[1].but_val  = TRUE;
+
+  gap_arr_arg_init(&argv[0], GAP_ARR_WGT_LABEL);
+  argv[0].label_txt = msg;
+  
+
+  if(msg)
+  {
+    if(*msg)
+    {
+       printf("%s\n", msg);
+
+       if(run_mode == GIMP_RUN_INTERACTIVE)
+       {
+         gap_arr_std_dialog ( _("GAP Message")
+                            ,""
+                            ,G_N_ELEMENTS(argv),   argv
+                            ,G_N_ELEMENTS(b_argv), b_argv
+                            ,-1  /* default value is Cancel */
+                            );
+       }
+    }
+  }
+}    /* end gap_arr_msg_popup  */
 
 /* --------------------------------------
  * p_mkdir_from_file_if_not_exists

Modified: trunk/gap/gap_arr_dialog.h
==============================================================================
--- trunk/gap/gap_arr_dialog.h	(original)
+++ trunk/gap/gap_arr_dialog.h	Sat Feb 21 17:32:45 2009
@@ -203,6 +203,7 @@
 gboolean gap_arr_overwrite_file_dialog(const char *filename);
 
 void gap_arr_msg_win(GimpRunMode run_mode, const char *msg);
+void gap_arr_msg_popup(GimpRunMode run_mode, const char *msg);
 
 gboolean gap_arr_create_vindex_permission(const char *videofile
       , const char *vindex_file

Modified: trunk/gap/gap_audio_extract.c
==============================================================================
--- trunk/gap/gap_audio_extract.c	(original)
+++ trunk/gap/gap_audio_extract.c	Sat Feb 21 17:32:45 2009
@@ -36,7 +36,6 @@
 
 
 /* GAP includes */
-#include "gap_vid_api.h"
 #include "gap_audio_util.h"
 #include "gap_audio_wav.h"
 #include "gap_audio_extract.h"
@@ -47,6 +46,7 @@
 
 
 
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
 /* ---------------------
  * p_init_progress
  * ---------------------
@@ -70,8 +70,10 @@
     }
   }
 }  /* end p_init_progress */  
+#endif
 
 
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
 /* ---------------------
  * p_do_progress
  * ---------------------
@@ -101,8 +103,10 @@
   }
 
 }  /* end p_do_progress */  
+#endif
 
 
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
 /* ----------------------------------
  * p_audio_extract_rewrite_wav_header
  * ----------------------------------
@@ -132,8 +136,9 @@
                       );
 
 }  /* end p_audio_extract_rewrite_wav_header */
+#endif
 
-
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
 /* -------------------------
  * gap_audio_extract_as_wav
  * -------------------------
@@ -156,7 +161,6 @@
    ,  gpointer user_data
    )
 {
-#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
    int l_audio_channels;
    int l_sample_rate;
    long l_audio_samples;
@@ -310,11 +314,12 @@
     g_free(left_ptr);
     g_free(right_ptr);
   }
-#endif
   return;
 }  /* end gap_audio_extract_as_wav */
+#endif
 
 
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
 /* ---------------------------------
  * gap_audio_extract_from_videofile
  * ---------------------------------
@@ -345,7 +350,6 @@
   , gpointer user_data
   )
 {
-#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
   t_GVA_Handle   *gvahand;
 
   /* --------- OPEN the videofile --------------- */
@@ -482,6 +486,6 @@
         
      }
   }
-#endif
   return;
 }  /* end gap_audio_extract_from_videofile */
+#endif

Modified: trunk/gap/gap_audio_extract.h
==============================================================================
--- trunk/gap/gap_audio_extract.h	(original)
+++ trunk/gap/gap_audio_extract.h	Sat Feb 21 17:32:45 2009
@@ -16,9 +16,23 @@
 #include "libgimp/gimp.h"
 
 /* GAP includes */
+
+
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
 #include "gap_vid_api.h"
+#else
+#ifndef GAP_STUBTYPE_GVA_HANDLE
+typedef gpointer t_GVA_Handle;
+#define GAP_STUBTYPE_GVA_HANDLE
+#endif
+#endif
+
+
 #include "gap-intl.h"
 
+
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
+
 /* -------------------------
  * gap_audio_extract_as_wav
  * -------------------------
@@ -70,4 +84,5 @@
    , gpointer user_data
    );
 
+#endif          /*   GAP_ENABLE_VIDEOAPI_SUPPORT */
 #endif          /* end  GAP_AUDIO_EXTRACT_H */

Modified: trunk/gap/gap_frame_fetcher.c
==============================================================================
--- trunk/gap/gap_frame_fetcher.c	(original)
+++ trunk/gap/gap_frame_fetcher.c	Sat Feb 21 17:32:45 2009
@@ -80,7 +80,6 @@
 #include "gap_libgimpgap.h"
 #include "gap_lib_common_defs.h"
 #include "gap_file_util.h"
-#include "gap_vid_api.h"
 #include "gap_layer_copy.h"
 //#include "gap_fmac_name.h"
 
@@ -376,8 +375,6 @@
 
 
 #ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
-
-
 /* ----------------------------------------------------
  * p_drop_gvahand_cache_elem1
  * ----------------------------------------------------
@@ -405,8 +402,10 @@
     }
   }
 }  /* end p_drop_gvahand_cache_elem1 */
+#endif
 
 
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
 /* ----------------------------------------------------
  * p_drop_vidhandle_cache
  * ----------------------------------------------------
@@ -437,10 +436,12 @@
   
 
 }  /* end p_drop_vidhandle_cache */
+#endif
 
 
 
 
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
 /* ----------------------------------------------------
  * p_ffetch_get_open_gvahand
  * ----------------------------------------------------
@@ -537,7 +538,6 @@
   }
   return(l_gvahand);
 }  /* end p_ffetch_get_open_gvahand */
-
 #endif
 
 /* -----------------------------------------
@@ -833,7 +833,9 @@
   gap_frame_fetch_delete_list_of_duplicated_images(-1);
 
   p_drop_image_cache();
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
   p_drop_vidhandle_cache();
+#endif
 }  /* end gap_frame_fetch_drop_resources */
 
 
@@ -941,7 +943,9 @@
       printf("gap_frame_fetch_unregister_user: no more resource users, DROP cached duplicates and video handles\n");
     }
     gap_frame_fetch_delete_list_of_duplicated_images(-1);
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
     p_drop_vidhandle_cache();
+#endif
   }
 
 }  /* end gap_frame_fetch_unregister_user */

Modified: trunk/gap/gap_frame_fetcher.h
==============================================================================
--- trunk/gap/gap_frame_fetcher.h	(original)
+++ trunk/gap/gap_frame_fetcher.h	Sat Feb 21 17:32:45 2009
@@ -36,7 +36,7 @@
 #define _GAP_FRAME_FETCHER_H
 
 #include "libgimp/gimp.h"
-#include "libgimp/gimp.h"
+
 #ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
 #include "gap_vid_api.h"
 #else

Modified: trunk/gap/gap_player_dialog.c
==============================================================================
--- trunk/gap/gap_player_dialog.c	(original)
+++ trunk/gap/gap_player_dialog.c	Sat Feb 21 17:32:45 2009
@@ -377,6 +377,7 @@
 static char *       p_build_otone_audiofilename(const char *videofilename, gint32 atrack, const char *suffix);
 static gboolean     p_check_otone_workfile_up_to_date(const char *videofilename, const char *audiofilename,
                               gint32 l_extract_audiotrack);
+static void         p_update_ainfo_for_videofile(GapPlayerMainGlobalParams *gpp);
 
 
 /* -----------------------------
@@ -941,10 +942,12 @@
     return(FALSE);
   }
 
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
   if (GVA_file_get_mtime(l_audiofilename) < GVA_file_get_mtime(videofilename))
   {
     return(FALSE);
   }
+#endif
 
   return (TRUE);
 
@@ -989,11 +992,13 @@
   if (gpp->audio_auto_offset_by_framenr == TRUE)
   {
     gint32 localFramenr;
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
     if (gpp->gvahand)
     {
       l_referedClipSpeed = gpp->gvahand->framerate;
       l_samplerate = gpp->gvahand->samplerate;
     }
+#endif
     
     localFramenr = p_get_audio_relevant_FrameNr(gpp, gpp->play_current_framenr);
     
@@ -1011,6 +1016,7 @@
 
   offset_start_samples = offset_start_sec * l_samplerate;
   
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
   if(gap_debug)
   {
     printf("p_audio_start_play  original_speed:%.3f refSpeed:%.3f audio_frame_offset:%d l_samples:%d l_samplerate:%d (gvahand:%d) offset_start_samples:%d\n\n"
@@ -1023,6 +1029,7 @@
       ,offset_start_samples
       );
   }
+#endif
   
   
   if(l_referedClipSpeed > 0)
@@ -1549,6 +1556,60 @@
 
 
 /* --------------------------------
+ * p_update_ainfo_for_videofile
+ * --------------------------------
+ * typical called after creation of a videoindex
+ * to update the total_frames information
+ * (that may have changed from the guess value to
+ * an exact value when all frames were counted)
+ */
+static void
+p_update_ainfo_for_videofile(GapPlayerMainGlobalParams *gpp)
+{
+  GapAnimInfo   *ainfo_ptr;
+
+  if(gpp == NULL)
+  {
+    return;
+  }
+
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
+  if(gap_debug)
+  {
+    printf("p_update_ainfo_for_videofile  gpp->ainfo_ptr:%d gpp->gvahand:%d\n"
+      , (int)gpp->ainfo_ptr
+      , (int)gpp->gvahand
+      );
+  }
+
+  ainfo_ptr = gpp->ainfo_ptr;
+  if ((ainfo_ptr == NULL) || (gpp->gvahand == NULL))
+  {
+    return;
+  }
+
+
+  if(ainfo_ptr->ainfo_type == GAP_AINFO_MOVIE)
+  {
+    if(gpp->gvahand->all_frames_counted)
+    {
+      if(gap_debug)
+      {
+        printf("p_update_ainfo_for_videofile  ainfo_ptr->frame_cnt:%d gpp->gvahand->total_frames:%d\n"
+          , (int)ainfo_ptr->frame_cnt
+          , (int)gpp->gvahand->total_frames
+          );
+      }
+      ainfo_ptr->frame_cnt = gpp->gvahand->total_frames;
+      ainfo_ptr->last_frame_nr = gpp->gvahand->total_frames;
+    }
+   }
+#endif
+
+}  /* end p_update_ainfo_for_videofile*/
+
+
+/* --------------------------------
  * p_alloc_ainfo_for_videofile
  * --------------------------------
  * get anim information from filename for videofiles
@@ -1658,12 +1719,18 @@
  * -----------------------------
  * get anim information from imagename or image_id
  * NO operation when Player is in storyboard mode
+ * when called with a negative image_id
+ * then assume that gpp->imagename refers to a videofile
+ * and try to allocate anim info from videofile.
  */
 static void
 p_reload_ainfo_ptr(GapPlayerMainGlobalParams *gpp, gint32 image_id)
 {
-  gpp->image_id = image_id;
+  gboolean l_hasImagename;
 
+  gpp->image_id = image_id;
+  l_hasImagename = FALSE;
+  
   if(gpp->stb_ptr)    { return; }
   if(gpp->ainfo_ptr)  { gap_lib_free_ainfo(&gpp->ainfo_ptr); }
 
@@ -1680,10 +1747,19 @@
       return;
     }
     gpp->ainfo_ptr = gap_lib_alloc_ainfo_from_name(gpp->imagename, gpp->run_mode);
+    l_hasImagename = TRUE;
   }
   else
   {
-    /* normal mode */
+    char  *imagename;
+
+    imagename = gimp_image_get_filename(image_id);
+    if (imagename)
+    {
+      l_hasImagename = TRUE;
+      g_free(imagename);
+    }
+    /* normal mode using anim frames or single image */
     gpp->ainfo_ptr = gap_lib_alloc_ainfo(gpp->image_id, gpp->run_mode);
   }
 
@@ -1705,7 +1781,7 @@
       gpp->ainfo_ptr->height = gpp->imageheight;
     }
 
-    if(gpp->ainfo_ptr->frame_cnt != 0)
+    if((gpp->ainfo_ptr->frame_cnt != 0) && (l_hasImagename == TRUE))
     {
       GapVinVideoInfo *vin_ptr;
 
@@ -1751,21 +1827,23 @@
       gpp->ainfo_ptr->first_frame_nr = 1;
       gpp->ainfo_ptr->last_frame_nr = 1;
       gpp->original_speed = 24.0;
+      
     }
   }
 
 }  /* end p_reload_ainfo_ptr */
 
 
-/* -----------------------------
+/* --------------------------------
  * p_update_ainfo_dependent_widgets
- * -----------------------------
+ * --------------------------------
  */
 static void
 p_update_ainfo_dependent_widgets(GapPlayerMainGlobalParams *gpp)
 {
   gdouble l_lower;
   gdouble l_upper;
+  gdouble l_value;
 
   if(gpp == NULL) { return; }
   if(gpp->ainfo_ptr == NULL) { return; }
@@ -1773,6 +1851,7 @@
   l_lower = (gdouble)gpp->ainfo_ptr->first_frame_nr;
   l_upper = (gdouble)gpp->ainfo_ptr->last_frame_nr;
 
+
   GTK_ADJUSTMENT(gpp->from_spinbutton_adj)->lower = l_lower;
   GTK_ADJUSTMENT(gpp->from_spinbutton_adj)->upper = l_upper;
   GTK_ADJUSTMENT(gpp->from_spinbutton_adj)->value = CLAMP(GTK_ADJUSTMENT(gpp->from_spinbutton_adj)->value
@@ -1787,11 +1866,21 @@
                           , (gfloat) CLAMP(GTK_ADJUSTMENT(gpp->to_spinbutton_adj)->value, l_lower, l_upper)
                           );
 
+  l_value = CLAMP(GTK_ADJUSTMENT(gpp->framenr_spinbutton_adj)->value, l_lower, l_upper);
+
+  if(gap_debug)
+  {
+    printf("## tmp p_update_ainfo_dependent_widgets adj l_value:%.2f  l_lower:%.2f  l_upper:%.2f\n"
+        ,(float)l_value
+        ,(float)l_lower
+        ,(float)l_upper
+        );
+  }
+
   GTK_ADJUSTMENT(gpp->framenr_spinbutton_adj)->lower = l_lower;
   GTK_ADJUSTMENT(gpp->framenr_spinbutton_adj)->upper = l_upper;
-  gtk_adjustment_set_value( GTK_ADJUSTMENT(gpp->framenr_spinbutton_adj)
-                          , (gfloat)CLAMP(GTK_ADJUSTMENT(gpp->framenr_spinbutton_adj)->value, l_lower, l_upper)
-                          );
+  gtk_adjustment_set_value( GTK_ADJUSTMENT(gpp->framenr_spinbutton_adj), l_value);
+
 }  /* end p_update_ainfo_dependent_widgets */
 
 
@@ -2294,6 +2383,7 @@
                                GapPlayerMainGlobalParams *gpp)
 {
 #ifdef GAP_ENABLE_AUDIO_SUPPORT
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
   gboolean    l_otone_is_up_to_date;
   gint32      l_extract_audiotrack;
   gint32      l_begin_frame_nr;
@@ -2467,7 +2557,8 @@
   if(l_audiofilename)        { g_free(l_audiofilename); }
   if(l_audiofilename_cancel) { g_free(l_audiofilename_cancel);}
 
-#endif
+#endif  /* GAP_ENABLE_VIDEOAPI_SUPPORT */
+#endif  /* GAP_ENABLE_VIDEOAPI_SUPPORT */
 }  /* end on_audio_otone_extract_button_clicked */
 
 
@@ -2584,26 +2675,24 @@
 }  /* end p_close_videofile */
 
 
+
 /* --------------------------------
- * p_open_videofile
+ * p_reopen_videofile
  * --------------------------------
  */
 static void
-p_open_videofile(GapPlayerMainGlobalParams *gpp
+p_reopen_videofile(GapPlayerMainGlobalParams *gpp
                 , char *filename
                 , gint32 seltrack
                 , gdouble delace
                 , const char *preferred_decoder
                 )
 {
-#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
-  char *vindex_file;
   const char *l_preferred_decoder;
-  gboolean    l_have_valid_vindex;
+
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
 
   p_close_videofile(gpp);
-  vindex_file = NULL;
-  l_have_valid_vindex = FALSE;
 
   /* use global preferred_decoder setting per default */
   l_preferred_decoder = gpp->preferred_decoder;
@@ -2641,6 +2730,13 @@
     gpp->gvahand->progress_cb_user_data = gpp;
     gpp->gvahand->fptr_progress_callback = p_vid_progress_callback;
 
+    if(gap_debug)
+    {
+      printf("## p_reopen_videofile gpp->gvahand->total_frames:%d\n"
+          ,(int)gpp->gvahand->total_frames
+          );
+    }
+
     /* printf("PLAYER: open fptr_progress_callback FPTR:%d\n"
      *       , (int)gpp->gvahand->fptr_progress_callback);
      */
@@ -2657,10 +2753,6 @@
       if(dec_elem->decoder_name)
       {
         gpp->progress_bar_idle_txt = g_strdup(dec_elem->decoder_name);
-        vindex_file = GVA_build_videoindex_filename(gpp->gva_videofile
-                                             ,1  /* track */
-                                             ,dec_elem->decoder_name
-                                             );
       }
       else
       {
@@ -2668,6 +2760,54 @@
       }
     }
 
+  }
+#endif
+}  /* end p_reopen_videofile */
+
+
+
+/* --------------------------------
+ * p_open_videofile
+ * --------------------------------
+ * open videofile handle
+ * with checks for video index creation.
+ * in case where video index creation is recommanded
+ * this is done after asking the user for permission.
+ */
+static void
+p_open_videofile(GapPlayerMainGlobalParams *gpp
+                , char *filename
+                , gint32 seltrack
+                , gdouble delace
+                , const char *preferred_decoder
+                )
+{
+  char *vindex_file;
+  gboolean    l_have_valid_vindex;
+  l_have_valid_vindex = FALSE;
+
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
+
+  p_reopen_videofile(gpp, filename, seltrack, delace, preferred_decoder);
+
+  vindex_file = NULL;
+
+  if(gpp->gvahand)
+  {
+    /* set decoder name as progress idle text */
+    {
+      t_GVA_DecoderElem *dec_elem;
+
+      dec_elem = (t_GVA_DecoderElem *)gpp->gvahand->dec_elem;
+      if(dec_elem->decoder_name)
+      {
+        vindex_file = GVA_build_videoindex_filename(gpp->gva_videofile
+                                             ,1  /* track */
+                                             ,dec_elem->decoder_name
+                                             );
+      }
+    }
+    
     if(gpp->gvahand->vindex)
     {
       if(gpp->gvahand->vindex->total_frames > 0)
@@ -2729,7 +2869,14 @@
 
         if(!gpp->cancel_video_api)
         {
-          if(gpp->gvahand->vindex == NULL)
+          if(gpp->gvahand->vindex != NULL)
+          {
+            p_update_ainfo_for_videofile(gpp);
+            p_update_ainfo_dependent_widgets(gpp);
+
+            p_reopen_videofile(gpp, filename, seltrack, delace, preferred_decoder);
+          }
+          else
           {
             g_message(_("No videoindex available. "
                         "Access is limited to (slow) sequential read "
@@ -2751,7 +2898,7 @@
   }
 /* printf("PLAYER: open END\n"); */
 #endif
-
+  
 }  /* end p_open_videofile */
 
 
@@ -2930,6 +3077,13 @@
     {
       if((gpp->imagename) && (gpp->gvahand->all_frames_counted))
       {
+        if(gap_debug)
+        {
+          printf("p_fetch_videoframe  CALL p_update_ainfo_dependent_widgets ainfo_ptr->frame_cnt:%d gpp->gvahand->total_frames:%d\n"
+            , (int)gpp->ainfo_ptr->frame_cnt
+            , (int)gpp->gvahand->total_frames
+            );
+        }
         gpp->ainfo_ptr->frame_cnt = gpp->gvahand->total_frames;
         gpp->ainfo_ptr->last_frame_nr = gpp->gvahand->total_frames;
         p_update_ainfo_dependent_widgets(gpp);
@@ -8362,6 +8516,7 @@
   }
   else
   {
+
     if(gpp->imagename)
     {
       p_reload_ainfo_ptr(gpp, -1);
@@ -8378,9 +8533,12 @@
         return;
       }
 
-      if(0 != gap_lib_chk_framerange(gpp->ainfo_ptr))
+      if (gpp->standalone_mode == TRUE)
       {
-        return;
+        if(0 != gap_lib_chk_framerange(gpp->ainfo_ptr))
+        {
+          return;
+        }
       }
     }
   }

Modified: trunk/gap/gap_story_dialog.c
==============================================================================
--- trunk/gap/gap_story_dialog.c	(original)
+++ trunk/gap/gap_story_dialog.c	Sat Feb 21 17:32:45 2009
@@ -1790,7 +1790,6 @@
     }
   }
 
-
   if(sgpp->plp)
   {
     if(sgpp->plp->stb_ptr)
@@ -1815,7 +1814,10 @@
 
   if(sgpp->plp == NULL)
   {
-    if(gap_debug) printf("p_story_call_player: 1.st start\n");
+    if(gap_debug)
+    {
+      printf("p_story_call_player: 1.st start\n");
+    }
 
     /* 1. START mode */
     sgpp->plp = (GapPlayerMainGlobalParams *)g_malloc0(sizeof(GapPlayerMainGlobalParams));
@@ -1875,7 +1877,10 @@
   }
   else
   {
-    if(gap_debug) printf("p_story_call_player: RE start\n");
+    if(gap_debug)
+    {
+      printf("p_story_call_player: RE start\n");
+    }
 
     sgpp->plp->aspect_ratio = aspect_ratio;
 
@@ -2433,20 +2438,20 @@
   gint32 imagewidth;
   gint32 imageheight;
   long   framenr;
-  char  *basename;
-  char  *imagename;
 
 
 
   imagewidth = gimp_image_width(sgpp->image_id);
   imageheight = gimp_image_height(sgpp->image_id);
-  imagename = gimp_image_get_filename(sgpp->image_id);
-
-  basename = gap_lib_alloc_basename(imagename, &framenr);
 
-  if(basename)
+  if(gap_debug)
   {
-    p_story_call_player(sgpp
+    printf("p_player_img_mode_cb: init player from image:id:%d\n"
+       , sgpp->image_id
+       );
+  }
+
+  p_story_call_player(sgpp
                      ,NULL              /* Play Normal mode without storyboard */
                      ,NULL              /* no imagename mode */
                      ,imagewidth
@@ -2464,15 +2469,6 @@
                      ,1                /* stb_in_track (not relevant here) */
                      ,FALSE            /* stb_composite (not relevant here) */
                      );
-    g_free(basename);
-  }
-
-  if(imagename)
-  {
-    g_free(imagename);
-  }
-
-
 }  /* end p_player_img_mode_cb */
 
 
@@ -8180,31 +8176,6 @@
   gimp_ui_init ("storyboard", FALSE);
   gap_stock_init();
 
-  /* workaround:
-   *  the current implementation of the STORYBOARD dialog
-   *  crashes if the invoker image is not a numbered anim frame. (dont know why)
-   *  The following workaround checks for anim frame to avoid the crash
-   *  but both crash and this check should be removed in the future.
-   */
-  {
-    GapAnimInfo *ainfo_ptr;
-    int chk_rc;
-
-    ainfo_ptr = gap_lib_alloc_ainfo(sgpp->image_id, sgpp->run_mode);
-    gap_lib_dir_ainfo(ainfo_ptr);
-
-    if(ainfo_ptr != NULL)
-    {
-       chk_rc = gap_lib_chk_framerange(ainfo_ptr);
-       gap_lib_free_ainfo(&ainfo_ptr);
-
-       if(0 != chk_rc)
-       {
-         return;
-       }
-    }
-  }
-
   /*  The Storyboard dialog  */
   sgpp->run = FALSE;
   sgpp->curr_selection = NULL;

Modified: trunk/gap/gap_story_render_audio.c
==============================================================================
--- trunk/gap/gap_story_render_audio.c	(original)
+++ trunk/gap/gap_story_render_audio.c	Sat Feb 21 17:32:45 2009
@@ -37,7 +37,16 @@
 #include "gap_audio_util.h"
 #include "gap_audio_wav.h"
 #include "gap_story_sox.h"
+
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
 #include "gap_vid_api.h"
+#else
+#ifndef GAP_STUBTYPE_GVA_HANDLE
+typedef gpointer t_GVA_Handle;
+#define GAP_STUBTYPE_GVA_HANDLE
+#endif
+#endif
+
 #include "gap_story_file.h"
 #include "gap_layer_copy.h"
 #include "gap_story_render_processor.h"
@@ -104,6 +113,7 @@
                  ,gdouble *mix_scale         /* OUT */
                  );
 
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
 static void     p_extract_audioblock(t_GVA_Handle *gvahand
                 		     , FILE  *fp_wav
                 		     , gdouble samples_to_extract
@@ -117,7 +127,7 @@
                                    , gdouble max_play_sec
 				   , GapStoryRenderVidHandle *vidhand  /* for progress */
                                    );
-
+#endif
 
 
 
@@ -724,6 +734,7 @@
 
 
 
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
 /* ----------------------------------------------------
  * p_extract_audioblock
  * ----------------------------------------------------
@@ -751,6 +762,7 @@
 
   if(gap_debug) printf("p_extract_audioblock samples_to_extract:%d\n", (int)samples_to_extract);
 
+
   /* audio block read (blocksize covers playbacktime for 250 frames */
   l_left_to_read = (long)samples_to_extract;
   l_block_read = (double)(250.0) / (double)gvahand->framerate * (double)sample_rate;
@@ -832,11 +844,14 @@
   g_free(left_ptr);
   g_free(right_ptr);
 
+
   if(gap_debug) printf("p_extract_audioblock: END\n");
 
 }  /* end p_extract_audioblock */
+#endif
 
 
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
 /* ----------------------------------------------------
  * p_extract_audiopart
  * ----------------------------------------------------
@@ -939,6 +954,7 @@
 
 }  /* end p_extract_audiopart */
 
+#endif
 
 
 
@@ -1151,6 +1167,7 @@
      }
      if(l_audscan_required)
      {
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
         if(aud_type == GAP_AUT_MOVIE)
         {
            t_GVA_Handle *gvahand;
@@ -1327,6 +1344,8 @@
                g_free(l_errtxt);
            }
         }
+#endif
+        
         if(aud_type == GAP_AUT_AUDIOFILE)
         {
           if(g_file_test(aud_elem->audiofile, G_FILE_TEST_EXISTS))

Modified: trunk/gap/gap_story_render_audio.h
==============================================================================
--- trunk/gap/gap_story_render_audio.h	(original)
+++ trunk/gap/gap_story_render_audio.h	Sat Feb 21 17:32:45 2009
@@ -31,7 +31,16 @@
 #define GAP_STORY_RENDER_AUDIO_H
 
 #include "libgimp/gimp.h"
+
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
 #include "gap_vid_api.h"
+#else
+#ifndef GAP_STUBTYPE_GVA_HANDLE
+typedef gpointer t_GVA_Handle;
+#define GAP_STUBTYPE_GVA_HANDLE
+#endif
+#endif
+
 #include "gap_story_file.h"
 #include "gap_lib_common_defs.h"
 #include "gap_story_render_processor.h"

Modified: trunk/gap/gap_story_render_lossless.c
==============================================================================
--- trunk/gap/gap_story_render_lossless.c	(original)
+++ trunk/gap/gap_story_render_lossless.c	Sat Feb 21 17:32:45 2009
@@ -29,6 +29,8 @@
  * 2008.06.11  hof  - created (moved stuff from the former gap_gve_story_render_processor to this  new module)
  */
 
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
+
 /* ----------------------------------------------------
  * p_debug_print_vcodec_missmatch
  * ----------------------------------------------------
@@ -1093,6 +1095,7 @@
 } /* end p_story_attempt_fetch_chunk */
 
 
+#endif
 
 
 /* ----------------------------------------------------
@@ -1188,6 +1191,9 @@
 
   l_videofile = NULL;     /* NULL: also used as flag for "MUST fetch regular uncompressed frame" */
 
+
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
+
   if(filtermacro_file)
   {
      if(*filtermacro_file != '\0')
@@ -1241,6 +1247,7 @@
   }
   last_videofile = l_videofile;
 
+#endif
 
   if(l_videofile != NULL)
   {

Modified: trunk/gap/gap_story_render_processor.c
==============================================================================
--- trunk/gap/gap_story_render_processor.c	(original)
+++ trunk/gap/gap_story_render_processor.c	Sat Feb 21 17:32:45 2009
@@ -72,7 +72,6 @@
 #include "gap_file_util.h"
 #include "gap_audio_util.h"
 #include "gap_audio_wav.h"
-#include "gap_vid_api.h"
 #include "gap_story_file.h"
 #include "gap_layer_copy.h"
 #include "gap_story_render_audio.h"
@@ -2955,7 +2954,9 @@
     if(frn_elem->ext)               { g_free(frn_elem->ext);}
     if(frn_elem->filtermacro_file)  { g_free(frn_elem->filtermacro_file);}
 
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
     if(frn_elem->gvahand)           { GVA_close(frn_elem->gvahand);}
+#endif
 
     frn_next = (GapStoryRenderFrameRangeElem *)frn_elem->next;
     g_free(frn_elem);
@@ -4470,6 +4471,7 @@
 {
   GapStoryRenderFrameRangeElem *frn_elem;
   t_GVA_Handle *gvahand;
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
 
   for (frn_elem = vidhand->frn_list; frn_elem != NULL; frn_elem = (GapStoryRenderFrameRangeElem *)frn_elem->next)
   {
@@ -4486,6 +4488,7 @@
       }
     }
   }
+#endif
   return(NULL);  /* nothing found to steal from, return NULL */
 
 } /* end p_try_to_steal_gvahand */
@@ -4806,11 +4809,12 @@
              , &l_deinterlace
              , &l_threshold
              );
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
   if (l_deinterlace != 0)
   {
     GVA_delace_drawable(drawable_id, l_deinterlace, l_threshold);
   }
-
+#endif
 }  /* end p_conditional_delace_drawable */
 
 
@@ -4909,6 +4913,8 @@
 {
   gfd->tmp_image_id = -1;
 
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
+
   if(gfd->frn_elem->gvahand == NULL)
   {
      /* before we open a new GVA videohandle, lets check
@@ -5033,6 +5039,7 @@
      gfd->frn_elem->gvahand->image_id = -1;
      gfd->frn_elem->gvahand->layer_id = -1;
   }
+#endif
 }  /* end p_stb_render_movie */
 
 

Modified: trunk/gap/gap_story_render_processor.h
==============================================================================
--- trunk/gap/gap_story_render_processor.h	(original)
+++ trunk/gap/gap_story_render_processor.h	Sat Feb 21 17:32:45 2009
@@ -32,7 +32,16 @@
 #define GAP_STORY_RENDER_PROCESSOR_H
 
 #include "libgimp/gimp.h"
+
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
 #include "gap_vid_api.h"
+#else
+#ifndef GAP_STUBTYPE_GVA_HANDLE
+typedef gpointer t_GVA_Handle;
+#define GAP_STUBTYPE_GVA_HANDLE
+#endif
+#endif
+
 #include "gap_story_file.h"
 #include "gap_lib_common_defs.h"
 #include "gap_story_render_types.h"

Modified: trunk/gap/gap_story_render_types.h
==============================================================================
--- trunk/gap/gap_story_render_types.h	(original)
+++ trunk/gap/gap_story_render_types.h	Sat Feb 21 17:32:45 2009
@@ -32,7 +32,16 @@
 #define GAP_STORY_RENDER_TYPES_H
 
 #include "libgimp/gimp.h"
+
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
 #include "gap_vid_api.h"
+#else
+#ifndef GAP_STUBTYPE_GVA_HANDLE
+typedef gpointer t_GVA_Handle;
+#define GAP_STUBTYPE_GVA_HANDLE
+#endif
+#endif
+
 #include "gap_story_file.h"
 #include "gap_lib_common_defs.h"
 

Modified: trunk/gap/gap_video_index_creator.c
==============================================================================
--- trunk/gap/gap_video_index_creator.c	(original)
+++ trunk/gap/gap_video_index_creator.c	Sat Feb 21 17:32:45 2009
@@ -382,20 +382,27 @@
 {
   t_GVA_Handle  *gvahand;
 
+  /* first check the filename for known video extensions (.avi, .mpeg ...)
+   * before attempt to open as video.
+   * Note that the check_sig call of the gap_vid_api_gimp.c API implementation
+   * allows access to anim frames via the videoapi.
+   * But it does not make sense to detect anim frame images as video here, where
+   * video index creation makes no sense and therefore is not supported.
+   */
 
-  gvahand =  GVA_open_read_pref(filename
+  if(gap_story_filename_is_videofile_by_ext(filename))
+  {
+    gvahand =  GVA_open_read_pref(filename
                                   , seltrack
                                   , 1 /* aud_track */
                                   , preferred_decoder
                                   , FALSE  /* use MMX if available (disable_mmx == FALSE) */
                                   );
-
-
-
-  if(gvahand)
-  {
-    GVA_close(gvahand);
-    return(TRUE);
+    if(gvahand)
+    {
+      GVA_close(gvahand);
+      return(TRUE);
+    }
   }
 
   return(FALSE);

Modified: trunk/libgapvidapi/gap_vid_api_ffmpeg.c
==============================================================================
--- trunk/libgapvidapi/gap_vid_api_ffmpeg.c	(original)
+++ trunk/libgapvidapi/gap_vid_api_ffmpeg.c	Sat Feb 21 17:32:45 2009
@@ -551,7 +551,9 @@
       if(gvahand->vindex->videoindex_filename)
       {
         printf("IDX: p_wrapper_ffmpeg_open_read: vindex->videoindex_filename %s\n"
+               "  vindex->total_frames:%d\n"
               , gvahand->vindex->videoindex_filename
+              , gvahand->vindex->total_frames
               );
       }
       else
@@ -938,11 +940,16 @@
          /* EOF reached */
          if (gap_debug)
          {
-           printf("p_wrapper_ffmpeg_get_next_frame: EOF reached (or read ERROR)\n");
+           printf("p_wrapper_ffmpeg_get_next_frame: EOF reached (or read ERROR)"
+                  "  (old)total_frames:%d current_frame_nr:%d all_frames_counted:%d\n"
+              ,(int) gvahand->total_frames
+              ,(int) gvahand->current_frame_nr
+              ,(int) gvahand->all_frames_counted
+              );
          }
          l_record_url_offset = -1;
          
-         if (gvahand->all_frames_counted != TRUE)
+         if (!gvahand->all_frames_counted)
          {
            gvahand->total_frames = gvahand->current_frame_nr;
            gvahand->all_frames_counted = TRUE;
@@ -1841,11 +1848,15 @@
   {
      gint64  seek_pos;
      gint32  l_idx;
-     
+     gint32  l_extra_tries_at_end;
+
+     l_extra_tries_at_end = 0;
+
      if(gap_debug)
      {
-       printf("VIDEO INDEX is available for videofile:%s\n"
+       printf("VIDEO INDEX is available for videofile:%s vindex->tabsize_used:%d\n"
          , gvahand->filename
+         , (int)vindex->tabsize_used
          );
      }
      
@@ -1860,6 +1871,8 @@
 
        /* make sure that table access limited to used tablesize
         * (this allows usage of incomplete indexes)
+        * Note that the last index entry is not used,
+        * because positioning after the last keyframe does not work properly
         */
        if(l_idx > vindex->tabsize_used -1)
        {
@@ -1963,7 +1976,7 @@
                );
              }
              
-             l_synctries = 4 + MAX_PREV_OFFSET +(vindex->stepsize * GVA_IDX_SYNC_STEPSIZE);
+             l_synctries = 4 + MAX_PREV_OFFSET + (vindex->stepsize * GVA_IDX_SYNC_STEPSIZE) + l_extra_tries_at_end;
 
              /* SYNC READ loop
               * seek to offest found in the index table
@@ -2025,6 +2038,17 @@
                l_potentialCanditate = FALSE;
                l_rc_rd = p_wrapper_ffmpeg_get_next_frame(gvahand);
 
+               if(l_rc_rd != GVA_RET_OK)
+               {
+                 l_extra_tries_at_end += vindex->stepsize;
+                 l_synctries = -1;
+                 if(gap_debug)
+                 {
+                   printf("EOF or ERROR while SEEK_SYNC_LOOP l_extra_tries_at_end:%d\n", (int)l_extra_tries_at_end);
+                 }
+                 break;
+               }
+//
 //               printf("SEEK_SYNC_LOOP: idx_frame_len:%d  got_frame_length16:%d  Key:%d dts:%lld\n"
 //                    , (int)vindex->ofs_tab[l_idx_target].frame_length
 //                    , (int)handle->got_frame_length16
@@ -2591,6 +2615,7 @@
            }
 
            l_debug_msg[0] = "\n";
+           l_debug_msg[1] = "\0";
 #ifdef GAP_DEBUG_FF_NATIVE_SEEK
            {
              g_snprintf(&l_debug_msg[0], sizeof(l_debug_msg)
@@ -2711,7 +2736,9 @@
                  l_retry = FALSE;
                  p_inc_native_timecode_seek_failcount(gvahand);
                }
-               printf("%s**   Timecode OVERFLOW: curr: %lld oflow:%lld  prev:%lld pprev:%lld (wanted:%lld)\n"
+               if(gap_debug)
+               {
+                 printf("%s**   Timecode OVERFLOW: curr: %lld oflow:%lld  prev:%lld pprev:%lld (wanted:%lld)\n"
                   , l_debug_msg
                   , l_curr_timecode
                   , l_overflow_timecode
@@ -2719,6 +2746,7 @@
                   , l_pprev_timecode
                   , l_wanted_timecode
                   );
+               }
                l_retcode = GVA_RET_ERROR;
                break;
            }
@@ -3139,9 +3167,17 @@
     printf("VINDEX done, critical_timecodesteps_found:%d\n"
            "             master_handle->all_timecodes_verified %d\n"
            "             master_handle->prefere_native_seek %d\n"
+           "             gvahand->frame_counter: %d\n"
+           "             gvahand->all_frames_counted: %d\n"
+           "             gvahand->cancel_operation: %d\n"
+           "             gvahand->total_frames: %d\n"
       , (int)master_handle->critical_timecodesteps_found
       , (int)master_handle->all_timecodes_verified
       , (int)master_handle->prefere_native_seek
+      , (int)gvahand->frame_counter
+      , (int)gvahand->all_frames_counted
+      , (int)gvahand->cancel_operation
+      , (int)gvahand->total_frames
       );
   }
 

Modified: trunk/libgapvidutil/gap_gve_story.h
==============================================================================
--- trunk/libgapvidutil/gap_gve_story.h	(original)
+++ trunk/libgapvidutil/gap_gve_story.h	Sat Feb 21 17:32:45 2009
@@ -42,7 +42,16 @@
 #define GAP_GVE_STORY_H
 
 #include "libgimp/gimp.h"
+
+#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
 #include "gap_vid_api.h"
+#else
+#ifndef GAP_STUBTYPE_GVA_HANDLE
+typedef gpointer t_GVA_Handle;
+#define GAP_STUBTYPE_GVA_HANDLE
+#endif
+#endif
+
 #include "gap_story_file.h"
 #include "gap_story_render_processor.h"
 #include "gap_frame_fetcher.h"

Modified: trunk/vid_common/gap_cme_gui.c
==============================================================================
--- trunk/vid_common/gap_cme_gui.c	(original)
+++ trunk/vid_common/gap_cme_gui.c	Sat Feb 21 17:32:45 2009
@@ -691,11 +691,19 @@
                                 GIMP_INT_STORE_LABEL, l_ecp->menu_name,
                                 -1);
 
+#ifdef ENABLE_GVA_LIBAVFORMAT
      /* set FFMPEG as default encoder (if this encoder is installed) */
      if(strcmp(l_ecp->vid_enc_plugin, GAP_PLUGIN_NAME_FFMPEG_ENCODE) == 0)
      {
          l_active_menu_nr = l_ecp->menu_nr;
      }
+#else
+     /* set AVI as default encoder (if this encoder is installed) */
+     if(strcmp(l_ecp->vid_enc_plugin, GAP_PLUGIN_NAME_AVI_ENCODE) == 0)
+     {
+         l_active_menu_nr = l_ecp->menu_nr;
+     }
+#endif
      l_ecp =  (GapGveEncList *)l_ecp->next;
      l_idx++;
   }

Modified: trunk/vid_enc_rawframes/gap_enc_rawframes_main.c
==============================================================================
--- trunk/vid_enc_rawframes/gap_enc_rawframes_main.c	(original)
+++ trunk/vid_enc_rawframes/gap_enc_rawframes_main.c	Sat Feb 21 17:32:45 2009
@@ -517,10 +517,7 @@
 gint
 p_rawframe_encode_dialog(GapGveRawGlobalParams *gpp)
 {
-  if(gpp->val.run_mode == GIMP_RUN_INTERACTIVE)
-  {
-    g_message(_("the rawframe Encoder has no encoder specific Parameters"));
-  }
+  gap_arr_msg_popup(GIMP_RUN_INTERACTIVE, _("the rawframe Encoder has no encoder specific Parameters"));
   return 0;
 }  /* end p_rawframe_encode_dialog */
 

Modified: trunk/vid_enc_single/gap_enc_singleframes_main.c
==============================================================================
--- trunk/vid_enc_single/gap_enc_singleframes_main.c	(original)
+++ trunk/vid_enc_single/gap_enc_singleframes_main.c	Sat Feb 21 17:32:45 2009
@@ -508,10 +508,7 @@
 gint
 p_singleframe_encode_dialog(GapGveSingleGlobalParams *gpp)
 {
-  if(gpp->val.run_mode == GIMP_RUN_INTERACTIVE)
-  {
-    g_message(_("the Singleframe Encoder has no encoder specific Parameters"));
-  }
+  gap_arr_msg_popup(GIMP_RUN_INTERACTIVE, _("the Singleframe Encoder has no encoder specific Parameters"));
   return 0;
 }  /* end p_singleframe_encode_dialog */
 



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