[gimp-gap/gap-2-8] various fixes for 64bit linux and windows7 environment



commit a8928df80a42aaa27d91b3b77553de634bf8e046
Author: Wolfgang Hofer <wolfgangh svn gnome org>
Date:   Sat May 10 13:24:59 2014 +0200

    various fixes for 64bit linux and windows7 environment

 ChangeLog                                      |  101 ++++
 configure.in                                   |   14 +-
 extern_libs/configure_options_ffmpeg_win32.txt |    6 +-
 gap/gap_arr_dialog.c                           |  213 ++++++++-
 gap/gap_arr_dialog.h                           |   20 +
 gap/gap_audio_wav.c                            |    3 +-
 gap/gap_detail_tracking_main.c                 |    1 -
 gap/gap_drawable_vref_parasite.c               |    3 +-
 gap/gap_fmac_context.h                         |    2 +-
 gap/gap_frame_fetcher.c                        |    6 +-
 gap/gap_lib.c                                  |   76 +++-
 gap/gap_lib.h                                  |    1 +
 gap/gap_mov_dialog.c                           |   89 +++-
 gap/gap_mov_dialog.h                           |   18 +-
 gap/gap_mov_exec.c                             |  650 ++++++++++++++++++++----
 gap/gap_mov_exec.h                             |   10 +
 gap/gap_mov_main.c                             |   11 +-
 gap/gap_mov_render.c                           |    5 +-
 gap/gap_mov_xml_par.c                          |  104 +---
 gap/gap_navigator_dialog.c                     |    2 +-
 gap/gap_onion_base.h                           |    3 +-
 gap/gap_player_dialog.c                        |    8 +
 gap/gap_story_att_trans_dlg.c                  |  143 +++---
 gap/gap_story_dialog.c                         |  225 +++++----
 gap/gap_story_file.c                           |   67 ++-
 gap/gap_story_file.h                           |    4 +
 gap/gap_story_main.h                           |    3 +-
 gap/gap_story_properties.c                     |   92 +++-
 gap/gap_story_undo_types.h                     |    8 +-
 gap/gimplastvaldesc.c                          |   17 +-
 libgapbase/gap_base.c                          |    4 +-
 libgapbase/gap_base.h                          |    6 +-
 libgapbase/gap_file_util.c                     |   57 ++-
 libgapbase/gap_file_util.h                     |    9 +-
 libgapvidapi/gap_vid_api.h                     |    4 +-
 libgapvidapi/gap_vid_api_util.c                |    2 +-
 libgapvidapi/gap_vid_api_vidindex.c            |    2 +-
 libgapvidutil/gap_gve_misc_util.c              |    7 +-
 libgapvidutil/gap_gve_xvid.c                   |    2 +-
 vid_common/gap_cme_callbacks.c                 |  132 +++---
 vid_common/gap_cme_gui.c                       |  243 ++++++---
 vid_common/gap_cme_main.c                      |   11 +-
 vid_enc_ffmpeg/Makefile.am                     |    1 +
 vid_enc_ffmpeg/ff_x264_aac_hq.preset           |  204 ++++++++
 44 files changed, 1974 insertions(+), 615 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4c739a9..415b336 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,104 @@
+2014-05-09 Wolfgang Hofer <hof gimp org>
+
+- provide additional video encoder preset file: ff_x264_aac_hq.preset
+  that uses the AAC audio codec.
+  The other ff_x264_hq.preset uses the AC3 codec that is not supported
+  by some players (as the Media player on my Windows7 64bit machine)
+
+- Movepath now supports unlimted number of controlpoints
+  (old implementation was restricted to maximal 1024 controlpoints)
+
+- various fixes (found at tests on linux64 bit and windows 64 bit crosscomiple environment)
+    - g_stat shall use GStatBuf
+    - timestamps shall use time_t  (gap_file_get_mtime, gap_base_get_current_time)
+    - fixed crash in query of some plug-ins @ gimp_lastval_desc_register call.
+       (use fopen mode "wb" and "rb" -- do not mix "w" & "rb")
+    - fixed crash in storyboard rendering when move path transition is used.
+       (procedure gap_mov_exec_new_GapMovValues   
+         must initialize:  pvals->dst_group_name_path_string = NULL;
+       )
+    - fixed crash in storyboard dialog
+      - at attempt to copy a clip when storyboard was not yet saved 
+        (and internal filename is still NULL)
+        both via copy/paste or with drag&drop
+      - sporadic crash at open clip property dialog window
+         (memory overwrite @ gap_story_pw_properties_dialog
+          in the loop that should reset the 3 elements of the array 
+          pw->pw_mask_anchor_radio_button_arr)
+
+    - added gap_dialog_new  with same interface as gimp_dialog_new
+        - shall fix crash on attempt to move the dialog window 
+          with the mouse on Windows7 64 bit system
+          (-- this issue is not yet fixed ---)
+        - open the dialog as "Normal Toplevel Window"
+           (e.g. in foreground and with minimize/maximize/close widget decorations)
+
+
+    Windows64 bit cross compilation was done on SuSE 13.1 Virtual machine
+
+    Setup Linux For GIMP-GAP cross compilation
+    o) installed most dependency libs from openSuSE 13.1 windows 64 bit
+    o) have a script to setup environment varbles 
+       (PREFIX, LD_LIBRARY_PATH and other stuff see the gimp wiki crsosscompile page)
+    o) crosscompiled some dependency libs that were not provided as binary by openSUSE 13.1
+    o) crosscompiled gimp-2.8.10 (see gimp wiki crsosscompile page)
+    o) configured GAP:
+    
+       -) Add the options:
+              --enable-cross-compile  --target-os=mingw32  --arch=x86_64
+          to the file:  extern_libs/configure_options_ffmpeg_win32.txt
+       -) run autogen.sh (or configure) with the following configure options:
+           ./configure  --prefix=$PREFIX --host=x86_64-w64-mingw32 --disable-libmpeg3 --disable-ff-libxvid
+   
+
+   * ChangeLog
+   * configure.in
+   * extern_libs/configure_options_ffmpeg_win32.txt
+   * gap/gap_arr_dialog.c
+   * gap/gap_arr_dialog.h
+   * gap/gap_audio_wav.c
+   * gap/gap_detail_tracking_main.c
+   * gap/gap_drawable_vref_parasite.c
+   * gap/gap_fmac_context.h
+   * gap/gap_frame_fetcher.c
+   * gap/gap_lib.c
+   * gap/gap_lib.h
+   * gap/gap_mov_dialog.c
+   * gap/gap_mov_dialog.h
+   * gap/gap_mov_exec.c
+   * gap/gap_mov_exec.h
+   * gap/gap_mov_main.c
+   * gap/gap_mov_render.c
+   * gap/gap_mov_xml_par.c
+   * gap/gap_navigator_dialog.c
+   * gap/gap_onion_base.h
+   * gap/gap_player_dialog.c
+   * gap/gap_story_att_trans_dlg.c
+   * gap/gap_story_dialog.c
+   * gap/gap_story_file.c
+   * gap/gap_story_file.h
+   * gap/gap_story_main.h
+   * gap/gap_story_properties.c
+   * gap/gap_story_undo_types.h
+   * gap/gimplastvaldesc.c
+   * libgapbase/gap_base.c
+   * libgapbase/gap_base.h
+   * libgapbase/gap_file_util.c
+   * libgapbase/gap_file_util.h
+   * libgapvidapi/gap_vid_api.h
+   * libgapvidapi/gap_vid_api_util.c
+   * libgapvidapi/gap_vid_api_vidindex.c
+   * libgapvidutil/gap_gve_misc_util.c
+   * libgapvidutil/gap_gve_xvid.c
+   * vid_common/gap_cme_callbacks.c
+   * vid_common/gap_cme_gui.c
+   * vid_common/gap_cme_main.c
+   * vid_enc_ffmpeg/Makefile.am
+
+
+   * vid_enc_ffmpeg/ff_x264_aac_hq.preset    # new file
+
+
 2014-02-27 Wolfgang Hofer <hof gimp org>
 
 - fixed bug in the GAP video API that caused endless loop in
diff --git a/configure.in b/configure.in
index 6e46b80..a999847 100644
--- a/configure.in
+++ b/configure.in
@@ -306,8 +306,20 @@ X264_REQUIRED_INC='#ifdef HAVE_STDINT_H
 #include <stdint.h>
 #endif'
 
+FF_POTENTIAL_LIBX264=""
 FF_LIBX264=""
 x264_warn=""
+AC_ARG_ENABLE(ff_shared_libx264,
+              [  --disable-ff-shared-libx264         use static linking for H264 video codec library])
+  if test "x$enable_ff_shared_libx264" != "xno"; then
+      FF_POTENTIAL_LIBX264=`$PKG_CONFIG --libs x264`
+  else
+      FF_LIBX264_DIR=`$PKG_CONFIG --libs-only-L x264 | sed 's/ *$//'`
+      LEN_LIBX264_DIR=`expr length "$FF_LIBX264_DIR"`
+      STATIC_FF_LIBX264_DIR=`expr substr "$FF_LIBX264_DIR" 3 $LEN_LIBX264_DIR`
+      FF_POTENTIAL_LIBX264="$STATIC_FF_LIBX264_DIR/libx264.a"
+  fi
+
 AC_ARG_ENABLE(ff_libx264,
               [  --disable-ff-libx264         configure libavformat without optional open source variant of 
H264 video codec])
 dnl  if test "x$enable_ff_libx264" != "xno"; then
@@ -325,7 +337,7 @@ dnl  fi
     else
       AC_CHECK_LIB(x264, x264_encoder_close,
         [AC_CHECK_HEADER(x264.h,
-          FF_LIBX264=`$PKG_CONFIG --libs x264`,
+          FF_LIBX264="$FF_POTENTIAL_LIBX264",
           x264_warn="$NEW_LINE x264 header file (x264.h) not found (not critical, but no open H264 video 
codec support)",
           $X264_REQUIRED_INC)],
         x264_warn="$NEW_LINE x264 library (libx264) not found (not critical, but no open H264 video codec 
support)")
diff --git a/extern_libs/configure_options_ffmpeg_win32.txt b/extern_libs/configure_options_ffmpeg_win32.txt
index 96a69b6..bd58208 100644
--- a/extern_libs/configure_options_ffmpeg_win32.txt
+++ b/extern_libs/configure_options_ffmpeg_win32.txt
@@ -1,7 +1,8 @@
  --disable-ffmpeg  --disable-ffplay  --disable-ffprobe  --disable-ffserver --disable-shared --enable-static 
--enable-gpl --enable-mmx --enable-mmx2 --disable-vaapi  --disable-devices --disable-pthreads  
--disable-altivec  --disable-sse --disable-neon
 #
 # This file provides configuration options for ffmpeg
-# and is included while GIMP-GAP configure scriptruns the ffmpeg configuration on Windows environment.
+# and is included while GIMP-GAP configure script runs the ffmpeg configuration on Mingw Windows environment.
+# (or on crosscompilation with windows OS as target both for win32 and win64 target architecture)
 #
 # Notes:
 #  there is another variant of this file for Linux and Unix-like Os named: configure_options_ffmpeg.txt
@@ -43,4 +44,7 @@
 #  --enable-swscale
 #  --enable-nonfree
 # options for the ffmpeg configure
+#
+# cross compilation for windows 64 bit target (on openSUSE 13.1 64 bit build machine)
+#  --enable-cross-compile  --target-os=mingw32  --arch=x86_64
 
diff --git a/gap/gap_arr_dialog.c b/gap/gap_arr_dialog.c
index 4ef26cb..d5cfc45 100644
--- a/gap/gap_arr_dialog.c
+++ b/gap/gap_arr_dialog.c
@@ -86,13 +86,13 @@
 
 #include "config.h"
 
+#include <glib/gstdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <errno.h>
 
-#include <glib/gstdio.h>
 
 /* GIMP includes */
 #include "gtk/gtk.h"
@@ -2184,3 +2184,214 @@ gap_arr_create_vindex_permission(const char *videofile, const char *vindex_file
 
   return (l_rc);
 }  /* end gap_arr_create_vindex_permission */
+
+
+
+/*---------------------------------- */
+/*---------------------------------- */
+/*---------------------------------- */
+
+GtkWidget *
+gap_dialog_add_button (GtkWidget  *dialog,
+                        const gchar *button_text,
+                        gint         response_id)
+{
+  GtkWidget *button;
+
+
+  if(gap_debug)
+  {
+   printf("gap_dialog_add_button %s response_id:%d\n"
+       ,button_text
+       ,response_id
+       );
+  }
+
+
+  button = gtk_dialog_add_button (GTK_DIALOG (dialog), button_text,
+                                  response_id);
+  gtk_widget_show (button);
+
+  if (response_id == GTK_RESPONSE_OK)
+    {
+      gtk_dialog_set_default_response (GTK_DIALOG (dialog),
+                                       GTK_RESPONSE_OK);
+    }
+
+  return button;
+}
+
+void
+gap_dialog_add_buttons_valist (GtkWidget *dialog,
+                                va_list     args)
+{
+  const gchar *button_text;
+  gint         response_id;
+
+  if(gap_debug)
+  {
+    printf("gap_dialog_add_buttons_valist START\n");
+  }
+
+  while ((button_text = va_arg (args, const gchar *)))
+    {
+      response_id = va_arg (args, gint);
+
+      gap_dialog_add_button (dialog, button_text, response_id);
+    }
+}
+
+
+
+static void
+gap_dialog_help (GtkWidget *widget, GtkWidget *dialog)
+{
+  GimpHelpFunc    help_func;
+  const gchar    *help_id;
+ 
+  if(gap_debug)
+  {
+    printf("gap_dialog_help START\n");
+  }
+
+  help_func = (GimpHelpFunc) g_object_get_data (G_OBJECT (widget)
+                                                       , "HelpFunc"
+                                                       );
+  help_id = (const gchar *) g_object_get_data (G_OBJECT (widget)
+                                                       , "HelpId"
+                                                       );
+
+  if ((help_id != NULL) && (dialog != NULL))
+  {
+    if (help_func != NULL)
+    {
+      /* call user help function */   
+      help_func (help_id, dialog);
+    }
+    else
+    { 
+      /* call gimp standard help function */
+      gimp_standard_help_func(help_id, dialog);
+    }
+  }
+}
+
+
+
+GtkWidget *
+gap_dialog_new_valist (const gchar    *title,
+                        const gchar    *role,
+                        GtkWidget      *parent,
+                        GtkDialogFlags  flags,
+                        GimpHelpFunc    help_func,
+                        const gchar    *help_id,
+                        va_list         args)
+{
+  GtkWidget *dlg;
+  if(gap_debug)
+  {
+    printf("gap_dialog_new_valist START\n");
+  }
+
+  g_return_val_if_fail (title != NULL, NULL);
+  g_return_val_if_fail (role != NULL, NULL);
+  g_return_val_if_fail (parent == NULL || GTK_IS_WIDGET (parent), NULL);
+
+
+  dlg = gtk_dialog_new ();
+  gtk_window_set_type_hint (GTK_WINDOW (dlg), GDK_WINDOW_TYPE_HINT_NORMAL);
+  if(gap_debug)
+  {
+    printf("gap_dialog_new_valist set title:%s\n", title);
+  }
+  gtk_window_set_title (GTK_WINDOW (dlg), title);
+  
+  gap_dialog_add_buttons_valist (dlg, args);
+
+
+  if(help_id != NULL)
+  {
+      GtkWidget *action_area = gtk_dialog_get_action_area (dlg);
+      GtkWidget *help_button = gtk_button_new_from_stock (GTK_STOCK_HELP);
+
+      g_object_set_data (G_OBJECT (help_button), "HelpFunc", (gpointer)help_func);
+      g_object_set_data (G_OBJECT (help_button), "HelpId", (gpointer)help_id);
+      
+      gtk_box_pack_end (GTK_BOX (action_area), help_button,
+                        FALSE, TRUE, 0);
+      gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (action_area),
+                                          help_button, TRUE);
+      gtk_widget_show (help_button);
+
+      g_signal_connect (G_OBJECT (help_button), "clicked",
+                      G_CALLBACK(gap_dialog_help),
+                      dlg);
+  }
+  else
+  {
+    if(gap_debug)
+    {
+      printf("gap_dialog_new_valist: help_id is NULL\n");
+    }
+  }
+  return dlg;
+}
+
+
+/* ------------------------------
+ * gap_dialog_new
+ * ------------------------------
+ * has same signature as gimp_dialog_new
+ * but forces creation with hint GDK_WINDOW_TYPE_HINT_NORMAL
+ * to behave like normal toplevel window
+ * (e.g. has default decoreations of the Window manager
+ * typical close, maximize, minimize widgets
+ * and shall open in front of other windows..)
+ */
+
+GtkWidget *
+gap_dialog_new (const gchar    *title,
+                 const gchar    *role,
+                 GtkWidget      *parent,
+                 GtkDialogFlags  flags,
+                 GimpHelpFunc    help_func,
+                 const gchar    *help_id,
+                 ...)
+{
+  GtkWidget *dialog;
+  va_list    args;
+  if(gap_debug)
+  {
+    printf("gap_dialog_new START\n");
+  }
+
+  g_return_val_if_fail (parent == NULL || GTK_IS_WIDGET (parent), NULL);
+  g_return_val_if_fail (title != NULL, NULL);
+  g_return_val_if_fail (role != NULL, NULL);
+
+  if(gap_debug)
+  {
+    printf("gap_dialog_new title:%s role:%s parent:%d flags:%d\n"
+       ,title
+       ,role
+       ,(int)parent
+       ,(int)flags
+       );
+  }
+
+  va_start (args, help_id);
+
+  dialog = gap_dialog_new_valist (title, role,
+                                  parent, flags,
+                                  help_func, help_id,
+                                  args);
+
+  va_end (args);
+
+  if(gap_debug)
+  {
+    printf("gap_dialog_new DONE, dialog:%d\n", (int)dialog);
+  }
+
+  return dialog;
+}
diff --git a/gap/gap_arr_dialog.h b/gap/gap_arr_dialog.h
index a3fb888..5f9f228 100644
--- a/gap/gap_arr_dialog.h
+++ b/gap/gap_arr_dialog.h
@@ -210,4 +210,24 @@ gboolean gap_arr_create_vindex_permission(const char *videofile
       , gint32 seek_status
       );
 
+
+
+GtkWidget *
+gap_dialog_new (const gchar    *title,
+                 const gchar    *role,
+                 GtkWidget      *parent,
+                 GtkDialogFlags  flags,
+                 GimpHelpFunc    help_func,
+                 const gchar    *help_id,
+                 ...);
+
+GtkWidget *
+gap_dialog_new_valist (const gchar    *title,
+                        const gchar    *role,
+                        GtkWidget      *parent,
+                        GtkDialogFlags  flags,
+                        GimpHelpFunc    help_func,
+                        const gchar    *help_id,
+                        va_list         args);
+
 #endif
diff --git a/gap/gap_audio_wav.c b/gap/gap_audio_wav.c
index 746300e..591981d 100644
--- a/gap/gap_audio_wav.c
+++ b/gap/gap_audio_wav.c
@@ -15,6 +15,7 @@
 #include "unistd.h"
 #include <errno.h>
 #include "stdlib.h"
+#include <time.h>
 
 #include <glib/gstdio.h>
 
@@ -208,7 +209,7 @@ static FILE *
 p_wav_open_seek_data_private(const char *filename, unsigned char *audata)
 {
   FILE        *fp;
-  struct stat  l_stat_buf;
+  GStatBuf     l_stat_buf;
   size_t       l_len_to_read;
   size_t       l_len_read;
 
diff --git a/gap/gap_detail_tracking_main.c b/gap/gap_detail_tracking_main.c
index 1addc14..dde56aa 100644
--- a/gap/gap_detail_tracking_main.c
+++ b/gap/gap_detail_tracking_main.c
@@ -84,7 +84,6 @@ int gap_debug = 0;  /* 1 == print debug infos , 0 dont print debug infos */
 #define PLUG_IN_COPYRIGHT   "Wolfgang Hofer"
 #define PLUG_IN_HELP_ID     "gap-plug-detail-tracking"
 
-
 static void  query (void);
 static void  run (const gchar *name,          /* name of plugin */
      gint nparams,               /* number of in-paramters */
diff --git a/gap/gap_drawable_vref_parasite.c b/gap/gap_drawable_vref_parasite.c
index 88e7da0..130ae93 100644
--- a/gap/gap_drawable_vref_parasite.c
+++ b/gap/gap_drawable_vref_parasite.c
@@ -49,10 +49,9 @@ gap_dvref_debug_print_GapDrawableVideoRef(GapDrawableVideoRef *dvref)
     }
     if(dvref->videofile == NULL)
     {
-      printf("GapDrawableVideoRef: videofile:(null)  frame:%d seltrack:%d (%s)\n"
+      printf("GapDrawableVideoRef: videofile:(null)  frame:%d seltrack:%d\n"
         ,dvref->para.framenr
         ,dvref->para.seltrack
-        ,&dvref->para.preferred_decoder[0]
         );
       return;
     }
diff --git a/gap/gap_fmac_context.h b/gap/gap_fmac_context.h
index 48e57f2..c0d062f 100644
--- a/gap/gap_fmac_context.h
+++ b/gap/gap_fmac_context.h
@@ -45,7 +45,7 @@ typedef struct GapFmacRefEntry {
   gint32      frame_nr;
   gint32      stackposition;
   gint32      track;
-  gint32      mtime;
+  time_t      mtime;
   char        filename[1024];
   char        parentpositions[300];
   struct GapFmacRefEntry *next;
diff --git a/gap/gap_frame_fetcher.c b/gap/gap_frame_fetcher.c
index f8670f4..145ea8d 100644
--- a/gap/gap_frame_fetcher.c
+++ b/gap/gap_frame_fetcher.c
@@ -219,8 +219,8 @@ static gint32 ffetch_gva_frames_to_keep_cached();
 static void
 p_init_GapImageCacheParasitePointers(GapImageCacheParasitePointers *paraPtr, guchar *parasite_data)
 {
-  paraPtr->mtime_ptr =       (gint32 *)parasite_data;
-  paraPtr->ffetch_id_ptr =   (gint32 *)&parasite_data[sizeof(gint32)];
+  paraPtr->mtime_ptr =       (time_t *)parasite_data;
+  paraPtr->ffetch_id_ptr =   (gint32 *)&parasite_data[sizeof(time_t)];
   paraPtr->type_ptr =        (gint32 *)&parasite_data[2 * sizeof(gint32)];
   paraPtr->orig_width_ptr =  (gint32 *)&parasite_data[3 * sizeof(gint32)];
   paraPtr->orig_height_ptr = (gint32 *)&parasite_data[4 * sizeof(gint32)];
@@ -402,7 +402,7 @@ p_find_cache_image(const char* filename, gint32 ffetch_user_id
       if ((*(paraPtr->type_ptr) == cachedImageType)
       && (strcmp(filename, paraPtr->filename_ptr) == 0))
       {
-        gint32 mtimefile;
+        time_t mtimefile;
 
         mtimefile = gap_file_get_mtime(filename);
         if(mtimefile == *(paraPtr->mtime_ptr))
diff --git a/gap/gap_lib.c b/gap/gap_lib.c
index 6bec84b..7b7e1c4 100644
--- a/gap/gap_lib.c
+++ b/gap/gap_lib.c
@@ -123,6 +123,7 @@
 #endif
 
 /* GAP includes */
+#include "gap_base.h"
 #include "gap_arr_dialog.h"
 #include "gap_image.h"
 #include "gap_layer_copy.h"
@@ -676,7 +677,7 @@ p_do_active_layer_tracking(gint32 image_id
 int
 gap_lib_file_exists(const char *fname)
 {
-  struct stat  l_stat_buf;
+  GStatBuf     l_stat_buf;
   long         l_len;
 
   /* File Laenge ermitteln */
@@ -803,8 +804,8 @@ int
 gap_lib_file_copy(char *fname, char *fname_copy)
 {
   FILE        *l_fp;
-  char                     *l_buffer;
-  struct stat               l_stat_buf;
+  char        *l_buffer;
+  GStatBuf     l_stat_buf;
   long         l_len;
 
   if(gap_debug) printf("gap_lib_file_copy src:%s dst:%s\n", fname, fname_copy);
@@ -1553,8 +1554,7 @@ gap_lib_alloc_ainfo_from_name(const char *imagename, GimpRunMode run_mode)
      return (NULL);
    }
 
-   l_ainfo_ptr = (GapAnimInfo*)g_malloc(sizeof(GapAnimInfo));
-   if(l_ainfo_ptr == NULL) return(NULL);
+   l_ainfo_ptr = g_new0(GapAnimInfo, 1);
 
    l_ainfo_ptr->basename = NULL;
    l_ainfo_ptr->new_filename = NULL;
@@ -1602,9 +1602,8 @@ gap_lib_alloc_ainfo_unsaved_image(gint32 image_id)
 {
    GapAnimInfo   *l_ainfo_ptr;
 
-   l_ainfo_ptr = (GapAnimInfo*)g_malloc(sizeof(GapAnimInfo));
-   if(l_ainfo_ptr == NULL) return(NULL);
-
+   l_ainfo_ptr = g_new0(GapAnimInfo, 1);
+ 
    l_ainfo_ptr->basename = NULL;
    l_ainfo_ptr->new_filename = NULL;
    l_ainfo_ptr->extension = NULL;
@@ -1629,6 +1628,60 @@ gap_lib_alloc_ainfo_unsaved_image(gint32 image_id)
 
 }    /* end gap_lib_alloc_ainfo_unsaved_image */
 
+/* ============================================================================
+ * gap_lib_dir_ainfo_duplicate
+ *
+ * duplicate the specified ainfo structure from unsaved image.
+ * ============================================================================
+ */
+GapAnimInfo *
+gap_lib_dir_ainfo_duplicate(GapAnimInfo *ainfo_ptr)
+{
+  GapAnimInfo   *l_ainfo_ptr;
+
+  l_ainfo_ptr = NULL;
+  if(ainfo_ptr != NULL)
+  {
+    l_ainfo_ptr = g_new0(GapAnimInfo, 1);
+
+    l_ainfo_ptr->image_id = ainfo_ptr->image_id;
+    
+    if(ainfo_ptr->basename != NULL)
+    {
+      l_ainfo_ptr->basename = g_strdup(ainfo_ptr->basename);
+    }
+    if(ainfo_ptr->extension != NULL)
+    {
+      l_ainfo_ptr->extension = ainfo_ptr->extension;
+    }
+    if(ainfo_ptr->new_filename != NULL)
+    {
+      l_ainfo_ptr->new_filename = ainfo_ptr->new_filename;
+    }
+    if(ainfo_ptr->old_filename != NULL)
+    {
+      l_ainfo_ptr->old_filename = ainfo_ptr->old_filename;
+    }
+
+    l_ainfo_ptr->frame_nr = ainfo_ptr->frame_nr;
+    l_ainfo_ptr->run_mode = ainfo_ptr->run_mode;
+    l_ainfo_ptr->width = ainfo_ptr->width;
+    l_ainfo_ptr->height = ainfo_ptr->height;
+    l_ainfo_ptr->frame_cnt = ainfo_ptr->frame_cnt;
+ 
+    l_ainfo_ptr->curr_frame_nr = ainfo_ptr->curr_frame_nr;
+    l_ainfo_ptr->first_frame_nr = ainfo_ptr->first_frame_nr;
+    l_ainfo_ptr->last_frame_nr = ainfo_ptr->last_frame_nr;
+    l_ainfo_ptr->frame_nr_before_curr_frame_nr = ainfo_ptr->frame_nr_before_curr_frame_nr;
+    l_ainfo_ptr->frame_nr_after_curr_frame_nr = ainfo_ptr->frame_nr_after_curr_frame_nr;
+
+    l_ainfo_ptr->ainfo_type = ainfo_ptr->ainfo_type;
+    l_ainfo_ptr->seltrack = ainfo_ptr->seltrack;
+    l_ainfo_ptr->delace = ainfo_ptr->delace;
+    l_ainfo_ptr->density = ainfo_ptr->density;
+  }
+  return(l_ainfo_ptr);
+}
 
 
 /* ============================================================================
@@ -2426,7 +2479,7 @@ p_decide_save_as(gint32 image_id, const char *sav_name, const char *final_sav_na
     }
   }
 
-cleanup:
+/* cleanup: */
   g_free(l_basename);
   g_free(l_extension);
   g_free(l_lowerExtension);
@@ -2659,7 +2712,7 @@ p_lib_save_named_image_1(gint32 image_id, const char *sav_name, GimpRunMode run_
                                       "jpeg-save-options");
     if(gap_debug)
     {
-      printf("DEBUG: jpg_save_parasite %d\n", (int)jpg_save_parasite);
+      printf("DEBUG: jpg_save_parasite %ld\n", (long)jpg_save_parasite);
     }
     if (jpg_save_parasite)
     {
@@ -3122,10 +3175,8 @@ gap_lib_load_image (char *lod_name)
   char  *l_lowerExt;
   char  *l_tmpname;
   gint32 l_tmp_image_id;
-  int    l_rc;
   gboolean l_configured_for_ufraw;
 
-  l_rc = 0;
   l_tmpname = NULL;
   l_configured_for_ufraw = FALSE;
   l_ext = gap_lib_alloc_extension(lod_name);
@@ -4198,3 +4249,4 @@ gap_lib_framefile_with_framenr_exists(GapAnimInfo *ainfo_ptr, long frame_nr)
   return (l_rc);
 
 }       /* end gap_lib_framefile_with_framenr_exists */
+
diff --git a/gap/gap_lib.h b/gap/gap_lib.h
index b400e75..bad272c 100644
--- a/gap/gap_lib.h
+++ b/gap/gap_lib.h
@@ -76,6 +76,7 @@ char*        gap_lib_alloc_extension(const char *imagename);
 GapAnimInfo* gap_lib_alloc_ainfo_from_name(const char *imagename, GimpRunMode run_mode);
 GapAnimInfo* gap_lib_alloc_ainfo(gint32 image_id, GimpRunMode run_mode);
 GapAnimInfo* gap_lib_alloc_ainfo_unsaved_image(gint32 image_id);
+GapAnimInfo* gap_lib_dir_ainfo_duplicate(GapAnimInfo *ainfo_ptr);
 int          gap_lib_dir_ainfo(GapAnimInfo *ainfo_ptr);
 int          gap_lib_chk_framerange(GapAnimInfo *ainfo_ptr);
 int          gap_lib_chk_framechange(GapAnimInfo *ainfo_ptr);
diff --git a/gap/gap_mov_dialog.c b/gap/gap_mov_dialog.c
index 4193490..0ad628e 100644
--- a/gap/gap_mov_dialog.c
+++ b/gap/gap_mov_dialog.c
@@ -26,6 +26,7 @@
  */
 
 /* revision history:
+ * gimp    2.8.10;  2014/05/07  hof: support unlimited number of controlpoints.
  * gimp    2.1.0b;  2004/11/04  hof: replaced deprecated option_menu by combo box
  * gimp    2.1.0b;  2004/08/14  hof: feature: point navigation + SHIFT ==> mov_follow_keyframe
  * gimp    2.1.0b;  2004/08/10  hof: bugfix save/load Pathpoints work again.
@@ -546,7 +547,7 @@ gap_mov_dlg_move_dialog    (GapMovData *mov_ptr)
   gboolean isStandaloneGui;
 
 
-  mgp = g_new( t_mov_gui_stuff, 1 );
+  mgp = g_new0( t_mov_gui_stuff, 1 );
   mgp->shell = NULL;
   mgp->pointfile_name = NULL;
 
@@ -593,17 +594,16 @@ gap_mov_dlg_edit_movepath_dialog (gint32 frame_image_id, gint32 drawable_id
   gboolean isStandaloneGui;
   GapMovData  l_mov_data;
   gboolean isXmlLoadOk;
-  gboolean l_rc;
 
   if(gap_debug)
   {
      printf("gap_mov_dlg_edit_movepath_dialog START frame_image_id:%d drawable_id:%d xml:%s\n"
-           " fptr:%d data:%d\n"
+           " fptr:%ld data:%ld\n"
       ,(int)frame_image_id
       ,(int)drawable_id
       ,xml_paramfile
-      ,(int)close_fptr
-      ,(int)callback_data
+      ,(long)close_fptr
+      ,(long)callback_data
       );
   }
 
@@ -664,7 +664,6 @@ gap_mov_dlg_edit_movepath_dialog (gint32 frame_image_id, gint32 drawable_id
   }
 
 
-  l_rc = FALSE;
   if(ainfo_ptr != NULL)
   {
     l_mov_data.val_ptr = pvals_edit;
@@ -717,8 +716,8 @@ p_gap_mov_dlg_move_dialog(t_mov_gui_stuff *mgp
 
   if(gap_debug)
   {
-    printf("gap_mov_dlg_move_dialog START mgp:%d isRecordOnlyMode:%d isStandaloneGui:%d\n"
-      , (int)mgp
+    printf("gap_mov_dlg_move_dialog START mgp:%ld isRecordOnlyMode:%d isStandaloneGui:%d\n"
+      , (long)mgp
       , (int)isRecordOnlyMode
       , (int)isStandaloneGui
       );
@@ -726,7 +725,7 @@ p_gap_mov_dlg_move_dialog(t_mov_gui_stuff *mgp
   if(mgp == NULL)
   {
     printf("error can't alloc path_preview structure\n");
-    return -1;
+    return;
   }
   mgp->close_fptr = close_fptr;
   mgp->callback_data = callback_data;
@@ -1550,7 +1549,10 @@ mov_apv_callback (GtkWidget *widget,
   vin_ptr = gap_vin_get_all(mgp->ainfo_ptr->basename);
   if(vin_ptr)
   {
-     if(vin_ptr->framerate > 0) argv[2].flt_ret = vin_ptr->framerate;
+     if(vin_ptr->framerate > 0)
+     {
+       argv[2].flt_ret = vin_ptr->framerate;
+     }
      g_free(vin_ptr);
    }
   argv[2].has_default = TRUE;
@@ -1684,12 +1686,11 @@ p_copy_point(gint to_idx, gint from_idx)
  * straight lines and assign them to N-controlpoints.
  * this procedure uses the number of frames to be handled
  * as the wanted number of contolpoints.
- * (but constrain to the maximum allowed number of contolpoints)
+ * (and reallocates the point table when needed)
  */
 static void
 mov_grab_bezier_path(t_mov_gui_stuff *mgp, gint32 vectors_id, gint32 stroke_id, const char *vectorname)
 {
-  gint32 image_id;
   gint             num_lines;
   gint             num_points;
   gdouble          max_distance;
@@ -1698,11 +1699,10 @@ mov_grab_bezier_path(t_mov_gui_stuff *mgp, gint32 vectors_id, gint32 stroke_id,
   gdouble          precision;
   gint             l_ii;
 
-  image_id = mgp->ainfo_ptr->image_id;
   step_length = 1.0;
 
   num_points = 1 + abs(pvals->dst_range_end - pvals->dst_range_start);
-  num_points = MIN((GAP_MOV_MAX_POINT-2), num_points);
+  gap_mov_exec_dim_point_table(pvals, num_points + 2);
   num_lines = num_points -1;
 
   distance   = 0.0;
@@ -1774,7 +1774,7 @@ mov_grab_bezier_path(t_mov_gui_stuff *mgp, gint32 vectors_id, gint32 stroke_id,
  * straight lines and assign them to N-controlpoints.
  * this procedure uses the number of frames to be handled
  * as the wanted number of contolpoints.
- * (but constrain to the maximum allowed number of contolpoints)
+ * (reallocates the point table when needed)
  */
 static void
 mov_grab_anchorpoints_path(t_mov_gui_stuff *mgp,
@@ -1800,7 +1800,7 @@ mov_grab_anchorpoints_path(t_mov_gui_stuff *mgp,
     l_idx = 0;
     l_ii = 0;
 
-    while(l_idx < GAP_MOV_MAX_POINT -2)
+    while(TRUE)
     {
       if(gap_debug)
       {
@@ -1844,6 +1844,11 @@ mov_grab_anchorpoints_path(t_mov_gui_stuff *mgp,
                                );
         }
 
+        if(l_idx >= pvals->point_table_size)
+        {
+          gap_mov_exec_dim_point_table(pvals, l_idx + GAP_MOV_POINT_EXPAND_SIZE);
+        }
+
         pvals->point_idx_max = l_idx;
         p_clear_one_point(l_idx);
         pvals->point[l_idx].p_x = point_x;
@@ -2020,7 +2025,7 @@ mov_upd_seg_labels(GtkWidget *widget, t_mov_gui_stuff *mgp)
 {
   if(gap_debug)
   {
-    printf("mov_upd_seg_labels START mgp:%d widget:%d\n", (int)mgp, (int)widget);
+    printf("mov_upd_seg_labels START mgp:%ld widget:%ld\n", (long)mgp, (long)widget);
   }
 
   if(mgp != NULL)
@@ -2078,8 +2083,15 @@ mov_padd_callback (GtkWidget *widget,
   gint l_idx;
 
   if(gap_debug) printf("mov_padd_callback\n");
+  
+  if (pvals->point_idx_max +2 >= pvals->point_table_size)
+  {
+    gap_mov_exec_dim_point_table(pvals, pvals->point_table_size + GAP_MOV_POINT_EXPAND_SIZE);
+  }
+  
+  
   l_idx = pvals->point_idx_max;
-  if (l_idx < GAP_MOV_MAX_POINT -2)
+  if (l_idx < pvals->point_table_size -2)
   {
     /* advance to next point */
     p_points_to_tab(mgp);
@@ -2100,8 +2112,15 @@ mov_pins_callback (GtkWidget *widget,
   gint l_idx;
 
   if(gap_debug) printf("mov_pins_callback\n");
+
+  if (pvals->point_idx_max +2 >= pvals->point_table_size)
+  {
+    gap_mov_exec_dim_point_table(pvals, pvals->point_table_size + GAP_MOV_POINT_EXPAND_SIZE);
+  }
+
+
   l_idx = pvals->point_idx_max;
-  if (l_idx < GAP_MOV_MAX_POINT -2)
+  if (l_idx < pvals->point_table_size -2)
   {
     /* advance to next point */
     p_points_to_tab(mgp);
@@ -4519,7 +4538,8 @@ mov_path_framerange_box_create(t_mov_gui_stuff *mgp
   row = 0;
 
   /* the start frame scale_entry */
-  adj = gimp_scale_entry_new( GTK_TABLE (table), 0, row,        /* table col, row */
+  adj = (GtkAdjustment *)
+        gimp_scale_entry_new( GTK_TABLE (table), 0, row,        /* table col, row */
                           _("From Frame:"),                     /* label text */
                           SCALE_WIDTH, ENTRY_WIDTH,             /* scalesize spinsize */
                           (gdouble)pvals->dst_range_start,      /* value */
@@ -4543,7 +4563,8 @@ mov_path_framerange_box_create(t_mov_gui_stuff *mgp
   row++;
 
   /* the end frame scale_entry */
-  adj = gimp_scale_entry_new( GTK_TABLE (table), 0, row,          /* table col, row */
+  adj = (GtkAdjustment *)
+        gimp_scale_entry_new( GTK_TABLE (table), 0, row,          /* table col, row */
                           _("To Frame:"),                       /* label text */
                           SCALE_WIDTH, ENTRY_WIDTH,             /* scalesize spinsize */
                           (gdouble)pvals->dst_range_end,        /* value */
@@ -4567,7 +4588,8 @@ mov_path_framerange_box_create(t_mov_gui_stuff *mgp
   row++;
 
   /* the Layerstack scale_entry */
-  adj = gimp_scale_entry_new( GTK_TABLE (table), 0, row,          /* table col, row */
+  adj = (GtkAdjustment *)
+        gimp_scale_entry_new( GTK_TABLE (table), 0, row,          /* table col, row */
                           _("Layerstack:"),                     /* label text */
                           SCALE_WIDTH, ENTRY_WIDTH,             /* scalesize spinsize */
                           (gdouble)pvals->dst_layerstack,       /* value */
@@ -6156,13 +6178,14 @@ static void
 mov_path_acceleration_adjustment_update(GtkWidget *widget,
                             gint *val )
 {
-  gint old_val;
   t_mov_gui_stuff *mgp;
 
   mgp = g_object_get_data( G_OBJECT(widget), "mgp" );
 
-  if(mgp == NULL) return;
-  old_val = *val;
+  if(mgp == NULL)
+  {
+    return;
+  }
   gimp_int_adjustment_update(GTK_ADJUSTMENT(widget), (gpointer)val);
   p_points_to_tab(mgp);
   mov_upd_seg_labels(NULL, mgp);
@@ -6480,7 +6503,6 @@ GimpDrawable *
 p_get_prevw_drawable (t_mov_gui_stuff *mgp)
 {
   GapMovCurrent l_curr;
-  gint      l_nlayers;
 
   l_curr.isSingleFrame = FALSE;
   l_curr.singleMovObjLayerId = pvals->src_layer_id;
@@ -6545,6 +6567,13 @@ p_get_prevw_drawable (t_mov_gui_stuff *mgp)
      }
     }
 
+    if(gap_debug)
+    {
+      printf("p_get_prevw_drawable before gap_mov_exec_set_handle_offsets pvals:%ld pvals->src_image_id:%d\n"
+          ,(long)pvals
+          ,(int)pvals->src_image_id
+          );
+    }
     /* set offsets (in cur_ptr)
      *  according to handle_mode and src_img dimension (pvals)
      */
@@ -6553,7 +6582,10 @@ p_get_prevw_drawable (t_mov_gui_stuff *mgp)
     /* render: add source layer to (temporary) preview image */
     gap_mov_render_render(pvals->tmp_image_id, pvals, &l_curr);
 
-    if(l_curr.src_layers != NULL) g_free(l_curr.src_layers);
+    if(l_curr.src_layers != NULL)
+    {
+      g_free(l_curr.src_layers);
+    }
     l_curr.src_layers = NULL;
   }
 
@@ -6959,7 +6991,7 @@ gap_mov_dlg_move_dialog_singleframe(GapMovSingleFrame *singleFramePtr)
   argv[l_ii].int_default = argv[l_ii].int_ret;
 
 
-  if(TRUE == gap_arr_ok_cancel_dialog( _("Copy Audiofile as Wavefile"),
+  if(TRUE == gap_arr_ok_cancel_dialog( _("Movepath rendering for a single frame"),
                                  _("Settings"),
                                   G_N_ELEMENTS(argv), argv))
   {
@@ -6972,3 +7004,4 @@ gap_mov_dlg_move_dialog_singleframe(GapMovSingleFrame *singleFramePtr)
   return (-1);  /*  dialog cancelled */
 
 }  /* end gap_mov_dlg_move_dialog_singleframe */
+
diff --git a/gap/gap_mov_dialog.h b/gap/gap_mov_dialog.h
index f6f800a..f5ede9c 100644
--- a/gap/gap_mov_dialog.h
+++ b/gap/gap_mov_dialog.h
@@ -1,5 +1,5 @@
 /* gap_mov_dialog.h
- * 1997.11.06 hof (Wolfgang Hofer)
+ * 2014.05.07 hof (Wolfgang Hofer)
  *
  * GAP ... Gimp Animation Plugins
  *
@@ -27,6 +27,7 @@
 #define _GAP_MOV_DIALOG_H
 
 /* revision history:
+ * gimp    2.8.10;  2014/05/07  hof: support unlimited number of controlpoints.
  * gimp    1.3.20d; 2003/10/14  hof: added bluebox stuff
  * gimp    1.3.20d; 2003/10/05  hof: added tweenindex (twix)
  * gimp    1.3.20c; 2003/09/29  hof: new features: perspective transformation, tween_layer and trace_layer
@@ -36,6 +37,7 @@
  *                                   increased controlpoint Limit GAP_MOV_MAX_POINT (from 256 -> 1024)
  * gimp    1.1.20a; 2000/04/25  hof: support for keyframes, anim_preview
  * version 0.96.02; 1998.07.25  hof: added clip_to_img
+ *                   1997.11.06 hof: created
  */
 
 #include "gap_bluebox.h"
@@ -173,7 +175,8 @@ typedef struct {
 
 } GapMovPoint;
 
-#define GAP_MOV_MAX_POINT 1024
+#define GAP_MOV_POINT_INITIAL_SIZE 1024
+#define GAP_MOV_POINT_EXPAND_SIZE 512
 
 /*
  * Notes:
@@ -213,9 +216,14 @@ typedef struct {
         gint           tracelayer_enable;
         gint           tween_steps;     /* 0 == no virtual tweens between frames */
 
-        gint    point_idx;           /* 0 upto MAX_POINT -1 */
-        gint    point_idx_max;       /* 0 upto MAX_POINT -1 */
-        GapMovPoint point[GAP_MOV_MAX_POINT];
+        gint    point_idx;           /* current point index starting at 0 */
+        gint    point_idx_max;       /* index of last valid point starting at 0 */
+        gint    point_table_size;    /* number of currently allocetd GapMovPoint elementgs in point table */
+        GapMovPoint *point;       /* dynamic allocated point table 
+                                   * note that this is not a list, but a table 
+                                   * that is reallocated when inital size 
+                                   * GAP_MOV_POINT_INITIAL_SIZE is not big enough
+                                   */
 
         gint    dst_range_start;  /* use current frame as default */
         gint    dst_range_end;
diff --git a/gap/gap_mov_exec.c b/gap/gap_mov_exec.c
index 29b06ce..744214c 100644
--- a/gap/gap_mov_exec.c
+++ b/gap/gap_mov_exec.c
@@ -93,10 +93,14 @@ static void     p_init_curr_ptr_with_1st_controlpoint(GapMovCurrent *cur_ptr, Ga
 static gint32   p_duplicate_layer(gint32 layerId);
 
 static long     p_mov_execute_or_query(GapMovData *mov_ptr, GapMovQuery *mov_query);
+static long     p_mov_execute_or_query_2(GapMovData *mov_ptr, GapMovQuery *mov_query, gdouble  
*l_flt_timing);
 static gint32   p_mov_execute_singleframe(GapMovData *mov_ptr);
+static gint32   p_mov_execute_singleframe_2(GapMovData *mov_ptr, gdouble  *l_flt_timing);
 
 
 static long     p_mov_execute(GapMovData *mov_ptr);
+static gint32   p_mov_exec_anim_preview_2(GapMovValues *pvals_orig, GapAnimInfo *ainfo_ptr, gint 
preview_frame_nr, GapMovValues  *apv_pvals);
+
 static gdouble  p_calc_angle(gint p1x, gint p1y, gint p2x, gint p2y);
 static gdouble  p_rotatate_less_than_180(gdouble angle, gdouble angle_new, gint *turns);
 
@@ -135,7 +139,8 @@ static gint     p_calculate_settings_for_current_FrameTween(
                    , GapMovQuery *mov_query
                    );
 
-
+static void  p_reset_cache_GapMovValues(GapMovValues *pvals);
+static void  p_dup_cache_GapMovValues(GapMovValues *dstValues, GapMovValues *srcValues);
 
 /* -----------------------------------------------
  * gap_mov_exec_set_iteration_relevant_src_layers
@@ -431,7 +436,10 @@ p_mov_call_render(GapMovData *mov_ptr, GapMovCurrent *cur_ptr, gint apv_layersta
       {
         /* We are generating the Animation on the ORIGINAL FRAMES */
         /* ------------------------------------------------------ */
-        if(ainfo_ptr->new_filename != NULL) g_free(ainfo_ptr->new_filename);
+        if(ainfo_ptr->new_filename != NULL)
+        {
+          g_free(ainfo_ptr->new_filename);
+        }
         ainfo_ptr->new_filename = gap_lib_alloc_fname(ainfo_ptr->basename,
                                           cur_ptr->dst_frame_nr,
                                           ainfo_ptr->extension);
@@ -492,7 +500,10 @@ p_mov_call_render(GapMovData *mov_ptr, GapMovCurrent *cur_ptr, gint apv_layersta
       else
       {
          /* anim preview exact mode uses original frames */
-         if(ainfo_ptr->new_filename != NULL) g_free(ainfo_ptr->new_filename);
+         if(ainfo_ptr->new_filename != NULL)
+         {
+           g_free(ainfo_ptr->new_filename);
+         }
          ainfo_ptr->new_filename = gap_lib_alloc_fname(ainfo_ptr->basename,
                                            cur_ptr->dst_frame_nr,
                                            ainfo_ptr->extension);
@@ -507,6 +518,11 @@ p_mov_call_render(GapMovData *mov_ptr, GapMovCurrent *cur_ptr, gint apv_layersta
          if((mov_ptr->val_ptr->apv_scalex != 100.0) || (mov_ptr->val_ptr->apv_scaley != 100.0))
          {
            gint32      l_size_x, l_size_y;
+           
+           if(gap_debug)
+           {
+             printf("p_mov_call_render l_tmp_image_id:%d before gimp_image_width\n", (int)l_tmp_image_id);
+           }
 
            l_size_x = (gimp_image_width(l_tmp_image_id) * mov_ptr->val_ptr->apv_scalex) / 100;
            l_size_y = (gimp_image_height(l_tmp_image_id) * mov_ptr->val_ptr->apv_scaley) / 100;
@@ -731,7 +747,14 @@ p_mov_advance_src_frame_no_fetch(GapMovCurrent *cur_ptr, GapMovValues  *pvals)
   long    l_stepsize_autoskip;
 
   /* limit step factor to number of available frames -1 */
-  l_step_speed_factor = MIN(pvals->step_speed_factor, (gdouble)(pvals->cache_ainfo_ptr->frame_cnt -1));
+  if(pvals->cache_ainfo_ptr == NULL)
+  {
+    l_step_speed_factor = pvals->step_speed_factor;
+  }
+  else
+  {
+    l_step_speed_factor = MIN(pvals->step_speed_factor, (gdouble)(pvals->cache_ainfo_ptr->frame_cnt -1));  
+  }
   if(pvals->tween_steps > 0)
   {
     /* when we have tweens, the speed_factor must be divided (the +1 is for the real frame) */
@@ -1693,6 +1716,14 @@ gap_mov_exec_set_handle_offsets_singleframe(GapMovValues *val_ptr, GapMovCurrent
 {
   guint    l_src_width, l_src_height;         /* dimensions of the source image */
 
+   if(gap_debug)
+   {
+     printf("gap_mov_exec_set_handle_offsets_singleframe singleMovObjImageId:%d before gimp_image_width\n"
+         , (int)cur_ptr->singleMovObjImageId
+         );
+   }
+
+
    /* get dimensions of source image (in single frame mode: same as frame image)  */
    l_src_width  = gimp_image_width(cur_ptr->singleMovObjImageId);
    l_src_height = gimp_image_height(cur_ptr->singleMovObjImageId);
@@ -1876,6 +1907,30 @@ p_duplicate_layer(gint32 layerId)
 long
 p_mov_execute_or_query(GapMovData *mov_ptr, GapMovQuery *mov_query)
 {
+   long l_rc;
+   gdouble  *l_flt_timing;   /* timing table in relative frame numbers (0.0 == the first handled frame) */
+   if(gap_debug)
+   {
+     printf("p_mov_execute_or_query START  mov_ptr:%ld  mov_query:%ld\n"
+        ,(long)mov_ptr
+        ,(long)mov_query
+        );
+   }
+
+   l_flt_timing = g_new0(gdouble, mov_ptr->val_ptr->point_table_size); 
+   l_rc = p_mov_execute_or_query_2(mov_ptr, mov_query, l_flt_timing);
+   g_free(l_flt_timing);
+
+   if(gap_debug)
+   {
+     printf("p_mov_execute_or_query DONE\n");
+   }
+   return (l_rc);
+}
+
+long
+p_mov_execute_or_query_2(GapMovData *mov_ptr, GapMovQuery *mov_query, gdouble  *flt_timing_tab)
+{
    GapMovCurrent l_current_data;
    GapMovCurrent *cur_ptr;
    GapMovValues  *val_ptr;
@@ -1891,16 +1946,19 @@ p_mov_execute_or_query(GapMovData *mov_ptr, GapMovQuery *mov_query)
    long     l_fridx;
    gdouble  l_flt_count;
    gint     l_rc;
-   gint     l_nlayers;
    gint     l_idk;
    gint     l_prev_keyframe;
    gint     l_apv_layerstack;
-   gdouble  l_flt_timing[GAP_MOV_MAX_POINT];   /* timing table in relative frame numbers (0.0 == the first 
handled frame) */
 
    gint startOfSegmentIndex;
    gint endOfSegmentIndex;
    gint frameNrAtEndOfSegment;
 
+   if(gap_debug)
+   {
+     printf("p_mov_execute_or_query_2 START\n");
+   }
+
 
    if(mov_ptr->val_ptr->src_image_id < 0)
    {
@@ -2092,11 +2150,11 @@ p_mov_execute_or_query(GapMovData *mov_ptr, GapMovQuery *mov_query)
    l_fpl = ((gdouble)l_frames - 1.0) / ((gdouble)(l_points -1));
    if(gap_debug) printf("p_mov_execute: initial l_fpl=%f\n", l_fpl);
 
-   /* calculate l_flt_timing controlpoint timing table considering keyframes */
+   /* calculate flt_timing_tab controlpoint timing table considering keyframes */
    l_prev_keyptidx = 0;
    l_prev_keyframe = 0;
-   l_flt_timing[0] = 0.0;
-   l_flt_timing[l_points -1] = l_frames -1;
+   flt_timing_tab[0] = 0.0;
+   flt_timing_tab[l_points -1] = l_frames -1;
    l_flt_count = 0.0;
    for(l_ptidx=1;  l_ptidx < l_points - 1; l_ptidx++)
    {
@@ -2131,7 +2189,7 @@ p_mov_execute_or_query(GapMovData *mov_ptr, GapMovQuery *mov_query)
        }
      }
      l_flt_count += l_fpl;
-     l_flt_timing[l_ptidx] = l_flt_count;
+     flt_timing_tab[l_ptidx] = l_flt_count;
 
      if((l_fpl < 1.0) && (mov_query == NULL))
      {
@@ -2172,7 +2230,7 @@ p_mov_execute_or_query(GapMovData *mov_ptr, GapMovQuery *mov_query)
      printf("p_mov_execute: --- CONTROLPOINT relative frametiming TABLE -----\n");
      for(l_ptidx=0;  l_ptidx < l_points; l_ptidx++)
      {
-       printf("p_mov_execute: l_flt_timing[%02d] = %f\n", (int)l_ptidx, (float)l_flt_timing[l_ptidx]);
+       printf("p_mov_execute: flt_timing_tab[%02d] = %f\n", (int)l_ptidx, (float)flt_timing_tab[l_ptidx]);
      }
    }
 
@@ -2189,8 +2247,8 @@ p_mov_execute_or_query(GapMovData *mov_ptr, GapMovQuery *mov_query)
 
      if(gap_debug)
      {
-      printf("\np_mov_execute: l_fridx=%ld, l_flt_timing[l_ptidx]=%f, l_rc=%d l_ptidx=%d, 
l_prev_keyptidx=%d\n",
-                           l_fridx, (float)l_flt_timing[l_ptidx], (int)l_rc, (int)l_ptidx, 
(int)l_prev_keyptidx);
+      printf("\np_mov_execute: l_fridx=%ld, flt_timing_tab[l_ptidx]=%f, l_rc=%d l_ptidx=%d, 
l_prev_keyptidx=%d\n",
+                           l_fridx, (float)flt_timing_tab[l_ptidx], (int)l_rc, (int)l_ptidx, 
(int)l_prev_keyptidx);
      }
 
      if(l_rc != 0)
@@ -2242,7 +2300,7 @@ p_mov_execute_or_query(GapMovData *mov_ptr, GapMovQuery *mov_query)
       }
 
 
-      if((gdouble)l_fridx > l_flt_timing[l_ptidx])
+      if((gdouble)l_fridx > flt_timing_tab[l_ptidx])
       {
          /*  fix for object jumps forth and back as reported in #607927 */
          if(val_ptr->point[l_ptidx].keyframe > 0)
@@ -2260,9 +2318,9 @@ p_mov_execute_or_query(GapMovData *mov_ptr, GapMovQuery *mov_query)
 
            if(gap_debug)
            {
-              printf("p_mov_execute: advance to controlpoint l_ptidx=%d, l_flt_timing[l_ptidx]=%f  
startOfSegmentIndex:%d endOfSegmentIndex:%d\n"
+              printf("p_mov_execute: advance to controlpoint l_ptidx=%d, flt_timing_tab[l_ptidx]=%f  
startOfSegmentIndex:%d endOfSegmentIndex:%d\n"
                      , (int)l_ptidx
-                     , (float)l_flt_timing[l_ptidx]
+                     , (float)flt_timing_tab[l_ptidx]
                      , (int)startOfSegmentIndex
                      , (int)endOfSegmentIndex
                      );
@@ -2277,7 +2335,7 @@ p_mov_execute_or_query(GapMovData *mov_ptr, GapMovQuery *mov_query)
          }
       }
 
-      l_fpl = (l_flt_timing[l_ptidx] - l_flt_timing[l_ptidx -1]); /* float frames per line */
+      l_fpl = (flt_timing_tab[l_ptidx] - flt_timing_tab[l_ptidx -1]); /* float frames per line */
 
       l_tw_cnt = (gdouble)(val_ptr->tween_steps +1);
 
@@ -2292,7 +2350,7 @@ p_mov_execute_or_query(GapMovData *mov_ptr, GapMovQuery *mov_query)
         if(l_fpl != 0.0)
         {
             l_flt_posfactor  = (   (((gdouble)l_fridx * l_tw_cnt) - (gdouble)val_ptr->twix)
-                               - (l_flt_timing[l_ptidx -1] * l_tw_cnt)
+                               - (flt_timing_tab[l_ptidx -1] * l_tw_cnt)
                              ) / (l_fpl * l_tw_cnt);
         }
         else
@@ -2409,14 +2467,17 @@ p_mov_execute_or_query(GapMovData *mov_ptr, GapMovQuery *mov_query)
    val_ptr->tmpsel_image_id = -1;
    val_ptr->tmpsel_channel_id = -1;
 
-   if(cur_ptr->src_layers != NULL) g_free(cur_ptr->src_layers);
+   if(cur_ptr->src_layers != NULL)
+   {
+     g_free(cur_ptr->src_layers);
+   }
 
    cur_ptr->src_layers = NULL;
 
 
    return l_rc;
 
-}       /* end p_mov_execute_or_query */
+}       /* end p_mov_execute_or_query_2 */
 
 
 
@@ -2440,11 +2501,35 @@ p_mov_execute_or_query(GapMovData *mov_ptr, GapMovQuery *mov_query)
 static gint32
 p_mov_execute_singleframe(GapMovData *mov_ptr)
 {
+  gint32 l_rc;
+  gdouble  *l_flt_timing;   /* timing table in relative frame numbers (0.0 == the first handled frame) */
+
+  if(gap_debug)
+  {
+    printf("p_mov_execute_singleframe START\n");
+  }
+
+  l_flt_timing = g_new0(gdouble, mov_ptr->val_ptr->point_table_size); 
+  l_rc = p_mov_execute_singleframe_2(mov_ptr, l_flt_timing);
+  g_free(l_flt_timing);
+
+  if(gap_debug)
+  {
+    printf("p_mov_execute_singleframe DONE\n");
+  }
+
+  return (l_rc);
+  
+}
+
+static gint32
+p_mov_execute_singleframe_2(GapMovData *mov_ptr, gdouble *flt_timing_tab)
+{
    GapMovCurrent l_current_data;
    GapMovCurrent *cur_ptr;
    GapMovValues  *val_ptr;
 
-   gdouble  l_percentage;
+   //gdouble  l_percentage;
    gdouble  l_fpl;             /* frames_per_line */
    long     l_frame_step;
    gdouble  l_frames;
@@ -2458,7 +2543,6 @@ p_mov_execute_singleframe(GapMovData *mov_ptr)
    gint     l_idk;
    gint     l_prev_keyframe;
    gint     l_apv_layerstack;
-   gdouble  l_flt_timing[GAP_MOV_MAX_POINT];   /* timing table in relative frame numbers (0.0 == the first 
handled frame) */
 
    gint startOfSegmentIndex;
    gint endOfSegmentIndex;
@@ -2477,7 +2561,7 @@ p_mov_execute_singleframe(GapMovData *mov_ptr)
 
   frameNrAtEndOfSegment = 0;
   l_apv_layerstack = 0;
-  l_percentage = 0.0;
+  //l_percentage = 0.0;
 
   if(mov_ptr->dst_ainfo_ptr->run_mode == GIMP_RUN_INTERACTIVE)
   {
@@ -2602,11 +2686,11 @@ p_mov_execute_singleframe(GapMovData *mov_ptr)
      printf("p_mov_execute_singleframe: initial l_fpl=%f\n", l_fpl);
    }
 
-   /* calculate l_flt_timing controlpoint timing table considering keyframes */
+   /* calculate flt_timing_tab controlpoint timing table considering keyframes */
    l_prev_keyptidx = 0;
    l_prev_keyframe = 0;
-   l_flt_timing[0] = 0.0;
-   l_flt_timing[l_points -1] = l_frames -1;
+   flt_timing_tab[0] = 0.0;
+   flt_timing_tab[l_points -1] = l_frames -1;
    l_flt_count = 0.0;
    for(l_ptidx=1;  l_ptidx < l_points - 1; l_ptidx++)
    {
@@ -2641,7 +2725,7 @@ p_mov_execute_singleframe(GapMovData *mov_ptr)
        }
      }
      l_flt_count += l_fpl;
-     l_flt_timing[l_ptidx] = l_flt_count;
+     flt_timing_tab[l_ptidx] = l_flt_count;
 
      if(l_fpl < 1.0)
      {
@@ -2655,7 +2739,7 @@ p_mov_execute_singleframe(GapMovData *mov_ptr)
      printf("p_mov_execute_singleframe: --- CONTROLPOINT relative frametiming TABLE -----\n");
      for(l_ptidx=0;  l_ptidx < l_points; l_ptidx++)
      {
-       printf("p_mov_execute_singleframe: l_flt_timing[%02d] = %f\n", (int)l_ptidx, 
(float)l_flt_timing[l_ptidx]);
+       printf("p_mov_execute_singleframe: flt_timing_tab[%02d] = %f\n", (int)l_ptidx, 
(float)flt_timing_tab[l_ptidx]);
      }
    }
 
@@ -2679,8 +2763,8 @@ p_mov_execute_singleframe(GapMovData *mov_ptr)
 
      if(gap_debug)
      {
-       printf("\np_mov_execute_singleframe: l_fridx=%ld, l_flt_timing[l_ptidx]=%f, l_rc=%d l_ptidx=%d, 
l_prev_keyptidx=%d\n",
-                           l_fridx, (float)l_flt_timing[l_ptidx], (int)l_rc, (int)l_ptidx, 
(int)l_prev_keyptidx);
+       printf("\np_mov_execute_singleframe: l_fridx=%ld, flt_timing_tab[l_ptidx]=%f, l_rc=%d l_ptidx=%d, 
l_prev_keyptidx=%d\n",
+                           l_fridx, (float)flt_timing_tab[l_ptidx], (int)l_rc, (int)l_ptidx, 
(int)l_prev_keyptidx);
        if (isProcessingFramePhase)
        {
          printf("Now l_fridx is the frame index that triggers processing relevant Single Frame Phase\n");
@@ -2694,7 +2778,7 @@ p_mov_execute_singleframe(GapMovData *mov_ptr)
       /* advance frame_nr, (1st frame was done outside this loop) */
       cur_ptr->dst_frame_nr += l_frame_step;  /* +1  or -1 */
 
-      if((gdouble)l_fridx > l_flt_timing[l_ptidx])
+      if((gdouble)l_fridx > flt_timing_tab[l_ptidx])
       {
          /*  fix for object jumps forth and back as reported in #607927 */
          if(val_ptr->point[l_ptidx].keyframe > 0)
@@ -2712,9 +2796,9 @@ p_mov_execute_singleframe(GapMovData *mov_ptr)
 
            if(gap_debug)
            {
-              printf("p_mov_execute_singleframe: advance to controlpoint l_ptidx=%d, 
l_flt_timing[l_ptidx]=%f  startOfSegmentIndex:%d endOfSegmentIndex:%d\n"
+              printf("p_mov_execute_singleframe: advance to controlpoint l_ptidx=%d, 
flt_timing_tab[l_ptidx]=%f  startOfSegmentIndex:%d endOfSegmentIndex:%d\n"
                      , (int)l_ptidx
-                     , (float)l_flt_timing[l_ptidx]
+                     , (float)flt_timing_tab[l_ptidx]
                      , (int)startOfSegmentIndex
                      , (int)endOfSegmentIndex
                      );
@@ -2729,7 +2813,7 @@ p_mov_execute_singleframe(GapMovData *mov_ptr)
          }
       }
 
-      l_fpl = (l_flt_timing[l_ptidx] - l_flt_timing[l_ptidx -1]); /* float frames per line */
+      l_fpl = (flt_timing_tab[l_ptidx] - flt_timing_tab[l_ptidx -1]); /* float frames per line */
 
       l_tw_cnt = (gdouble)(val_ptr->tween_steps +1);
 
@@ -2744,7 +2828,7 @@ p_mov_execute_singleframe(GapMovData *mov_ptr)
         if(l_fpl != 0.0)
         {
             l_flt_posfactor  = (   (((gdouble)l_fridx * l_tw_cnt) - (gdouble)val_ptr->twix)
-                               - (l_flt_timing[l_ptidx -1] * l_tw_cnt)
+                               - (flt_timing_tab[l_ptidx -1] * l_tw_cnt)
                              ) / (l_fpl * l_tw_cnt);
         }
         else
@@ -2837,7 +2921,7 @@ p_mov_execute_singleframe(GapMovData *mov_ptr)
 
    return l_rc;
 
-}       /* end p_mov_execute_singleframe */
+}        /* end p_mov_execute_singleframe_2 */
 
 
 
@@ -2882,10 +2966,26 @@ p_mov_execute(GapMovData *mov_ptr)
 gint32
 gap_mov_exec_anim_preview(GapMovValues *pvals_orig, GapAnimInfo *ainfo_ptr, gint preview_frame_nr)
 {
+  gint32 l_rc;
+  GapMovValues  *apv_pvals;
+  apv_pvals = gap_mov_exec_new_GapMovValues();
+
+  /* copy all settings, points (this also includes 
+   * reallocate the point table in dstValues to same size as the srcValues 
+   */
+  gap_mov_exec_copy_GapMovValues(apv_pvals, pvals_orig);
+  l_rc = p_mov_exec_anim_preview_2(pvals_orig, ainfo_ptr, preview_frame_nr, apv_pvals);
+  
+  gap_mov_exec_free_GapMovValues(apv_pvals);
+  
+  return (l_rc);
+}
+
+static gint32
+p_mov_exec_anim_preview_2(GapMovValues *pvals_orig, GapAnimInfo *ainfo_ptr, gint preview_frame_nr, 
GapMovValues  *apv_pvals)
+{
   GapMovData    apv_mov_data;
-  GapMovValues  apv_mov_vals;
   GapMovData    *l_mov_ptr;
-  GapMovValues  *l_pvals;
   gint        l_idx;
   gint32      l_size_x, l_size_y;
   gint32      l_tmp_image_id;
@@ -2902,22 +3002,14 @@ gap_mov_exec_anim_preview(GapMovValues *pvals_orig, GapAnimInfo *ainfo_ptr, gint
   gint32     l_unit;
 
   l_mov_ptr = &apv_mov_data;
-  l_pvals = &apv_mov_vals;
-
-  /* copy settings */
-  memcpy(l_pvals, pvals_orig, sizeof(GapMovValues));
-  l_mov_ptr->val_ptr = l_pvals;
+  l_mov_ptr->val_ptr = apv_pvals;
   l_mov_ptr->dst_ainfo_ptr = ainfo_ptr;
 
   /* init local cached src image for anim preview generation.
    * (never mix cached src image for normal and anim preview
    *  because anim previews are often scaled down)
    */
-  l_pvals->cache_src_image_id  = -1;
-  l_pvals->cache_tmp_image_id  = -1;
-  l_pvals->cache_tmp_layer_id  = -1;
-  l_pvals->cache_frame_number  = -1;
-  l_pvals->cache_ainfo_ptr = NULL;
+  p_reset_cache_GapMovValues(apv_pvals);
 
   /* -1 assume no tmp_image (use unscaled original source) */
   l_tmp_image_id = -1;
@@ -2925,35 +3017,43 @@ gap_mov_exec_anim_preview(GapMovValues *pvals_orig, GapAnimInfo *ainfo_ptr, gint
   l_stack_pos_list = NULL;
 
   /* Scale (down) needed ? */
-  if((l_pvals->apv_scalex != 100.0) || (l_pvals->apv_scaley != 100.0))
+  if((apv_pvals->apv_scalex != 100.0) || (apv_pvals->apv_scaley != 100.0))
   {
     /* scale the controlpoint koords */
-    for(l_idx = 0; l_idx <= l_pvals->point_idx_max; l_idx++)
+    for(l_idx = 0; l_idx <= apv_pvals->point_idx_max; l_idx++)
     {
-      l_pvals->point[l_idx].p_x  = (l_pvals->point[l_idx].p_x * l_pvals->apv_scalex) / 100;
-      l_pvals->point[l_idx].p_y  = (l_pvals->point[l_idx].p_y * l_pvals->apv_scaley) / 100;
+      apv_pvals->point[l_idx].p_x  = (apv_pvals->point[l_idx].p_x * apv_pvals->apv_scalex) / 100;
+      apv_pvals->point[l_idx].p_y  = (apv_pvals->point[l_idx].p_y * apv_pvals->apv_scaley) / 100;
     }
 
     /* for the FRAME based step modes we cant Scale here,
      * we have to scale later (at fetch time of the frame)
      */
-    if(l_pvals->src_stepmode < GAP_STEP_FRAME)
+    if(apv_pvals->src_stepmode < GAP_STEP_FRAME)
     {
       /* copy and scale the source object image */
       l_tmp_image_id = gimp_image_duplicate(pvals_orig->src_image_id);
       gimp_image_undo_disable (l_tmp_image_id);
-      l_pvals->src_image_id = l_tmp_image_id;
+      apv_pvals->src_image_id = l_tmp_image_id;
+
 
-      l_size_x = MAX(1, (gimp_image_width(l_tmp_image_id) * l_pvals->apv_scalex) / 100);
-      l_size_y = MAX(1, (gimp_image_height(l_tmp_image_id) * l_pvals->apv_scaley) / 100);
+      if(gap_debug)
+      {
+        printf("p_mov_exec_anim_preview_2 l_tmp_image_id:%d before gimp_image_width\n"
+         , (int)l_tmp_image_id
+         );
+      }
+
+      l_size_x = MAX(1, (gimp_image_width(l_tmp_image_id) * apv_pvals->apv_scalex) / 100);
+      l_size_y = MAX(1, (gimp_image_height(l_tmp_image_id) * apv_pvals->apv_scaley) / 100);
       gimp_image_scale(l_tmp_image_id, l_size_x, l_size_y);
 
       /* findout the src_layer id in the scaled copy by its stackpositions in image and layergroups */
-      l_pvals->src_layer_id = -1;
+      apv_pvals->src_layer_id = -1;
       l_stack_pos_list = gap_image_get_tree_position_list(pvals_orig->src_layer_id);
       if (l_stack_pos_list == NULL)
       {
-        printf("ERROR: gap_mov_exec_anim_preview GOT no stack position list (original image_id %d)\n",
+        printf("ERROR: p_mov_exec_anim_preview_2 GOT no stack position list (original image_id %d)\n",
                 (int)pvals_orig->src_image_id);
         gimp_image_delete(l_tmp_image_id);
         return (-1);
@@ -2961,14 +3061,14 @@ gap_mov_exec_anim_preview(GapMovValues *pvals_orig, GapAnimInfo *ainfo_ptr, gint
       else
       {
         l_stackpos =  l_stack_pos_list->stack_position;
-        l_pvals->src_layer_id =
+        apv_pvals->src_layer_id =
            gap_image_get_layer_id_by_tree_position_list(l_tmp_image_id, l_stack_pos_list);
 
         gap_image_gfree_tree_position_list(l_stack_pos_list);
       }
-      if (l_pvals->src_layer_id < 0)
+      if (apv_pvals->src_layer_id < 0)
       {
-        printf("ERROR: gap_mov_exec_anim_preview Failed to find corresponding layer orig image_id %d 
copy:%d)\n"
+        printf("ERROR: p_mov_exec_anim_preview_2 Failed to find corresponding layer orig image_id %d 
copy:%d)\n"
                 , (int)pvals_orig->src_image_id
                 , (int)l_tmp_image_id
                 );
@@ -2979,7 +3079,7 @@ gap_mov_exec_anim_preview(GapMovValues *pvals_orig, GapAnimInfo *ainfo_ptr, gint
 
       if(gap_debug)
       {
-        printf("gap_mov_exec_anim_preview: orig  src_image_id:%d src_layer:%d, stackpos:%d name:%s\n"
+        printf("p_mov_exec_anim_preview_2: orig  src_image_id:%d src_layer:%d, stackpos:%d name:%s\n"
                ,(int)pvals_orig->src_image_id
                ,(int)pvals_orig->src_layer_id
                ,(int)l_stackpos
@@ -2987,8 +3087,8 @@ gap_mov_exec_anim_preview(GapMovValues *pvals_orig, GapAnimInfo *ainfo_ptr, gint
                  );
         printf("   Scaled src_image_id:%d scaled_src_layer:%d name:%s\n"
                ,(int)l_tmp_image_id
-               ,(int)l_pvals->src_layer_id
-               , gimp_item_get_name(l_pvals->src_layer_id)
+               ,(int)apv_pvals->src_layer_id
+               , gimp_item_get_name(apv_pvals->src_layer_id)
                );
       }
     }
@@ -2997,14 +3097,16 @@ gap_mov_exec_anim_preview(GapMovValues *pvals_orig, GapAnimInfo *ainfo_ptr, gint
 
   if(gap_debug)
   {
-    printf("gap_mov_exec_anim_preview: src_image_id %d (orig:%d)\n"
-           , (int) l_pvals->src_image_id
-           , (int) pvals_orig->src_image_id);
+    printf("p_mov_exec_anim_preview_2: src_image_id %d (orig:%d) before gimp_image_width 
ainfo_ptr->image_id:%d\n"
+           , (int) apv_pvals->src_image_id
+           , (int) pvals_orig->src_image_id
+           , (int) ainfo_ptr->image_id
+           );
   }
 
   /* create the animated preview multilayer image in (scaled) framesize */
-  l_width  = (gimp_image_width(ainfo_ptr->image_id) * l_pvals->apv_scalex) / 100;
-  l_height = (gimp_image_height(ainfo_ptr->image_id) * l_pvals->apv_scaley) / 100;
+  l_width  = (gimp_image_width(ainfo_ptr->image_id) * apv_pvals->apv_scalex) / 100;
+  l_height = (gimp_image_height(ainfo_ptr->image_id) * apv_pvals->apv_scaley) / 100;
   l_type   = gimp_image_base_type(ainfo_ptr->image_id);
   l_unit   = gimp_image_get_unit(ainfo_ptr->image_id);
   gimp_image_get_resolution(ainfo_ptr->image_id, &l_xresoulution, &l_yresoulution);
@@ -3014,12 +3116,12 @@ gap_mov_exec_anim_preview(GapMovValues *pvals_orig, GapAnimInfo *ainfo_ptr, gint
   gimp_image_set_unit(l_mlayer_image_id, l_unit);
   gimp_image_undo_disable (l_mlayer_image_id);
 
-  l_pvals->apv_mlayer_image = l_mlayer_image_id;
+  apv_pvals->apv_mlayer_image = l_mlayer_image_id;
 
   if(gap_debug)
   {
-    printf("gap_mov_exec_anim_preview: apv_mlayer_image %d\n"
-           , (int) l_pvals->apv_mlayer_image);
+    printf("p_mov_exec_anim_preview_2: apv_mlayer_image %d\n"
+           , (int) apv_pvals->apv_mlayer_image);
   }
 
   l_tmp_frame_id = -1;
@@ -3034,7 +3136,7 @@ gap_mov_exec_anim_preview(GapMovValues *pvals_orig, GapAnimInfo *ainfo_ptr, gint
                                  ainfo_ptr->extension);
 
     /* APV_MODE (Wich frames to use in the preview?)  */
-    switch(l_pvals->apv_mode)
+    switch(apv_pvals->apv_mode)
     {
       case GAP_APV_QUICK:
         /* use an empty dummy frame for all frames */
@@ -3073,10 +3175,10 @@ gap_mov_exec_anim_preview(GapMovValues *pvals_orig, GapAnimInfo *ainfo_ptr, gint
         l_tmp_frame_id = gimp_image_duplicate(ainfo_ptr->image_id);
       }
       gimp_image_undo_disable (l_tmp_frame_id);
-      if((l_pvals->apv_scalex != 100.0) || (l_pvals->apv_scaley != 100.0))
+      if((apv_pvals->apv_scalex != 100.0) || (apv_pvals->apv_scaley != 100.0))
       {
-        l_size_x = (gimp_image_width(l_tmp_frame_id) * l_pvals->apv_scalex) / 100;
-        l_size_y = (gimp_image_height(l_tmp_frame_id) * l_pvals->apv_scaley) / 100;
+        l_size_x = (gimp_image_width(l_tmp_frame_id) * apv_pvals->apv_scalex) / 100;
+        l_size_y = (gimp_image_height(l_tmp_frame_id) * apv_pvals->apv_scaley) / 100;
         gimp_image_scale(l_tmp_frame_id, l_size_x, l_size_y);
       }
     }
@@ -3088,12 +3190,12 @@ gap_mov_exec_anim_preview(GapMovValues *pvals_orig, GapAnimInfo *ainfo_ptr, gint
     }
   }
 
-  l_pvals->apv_src_frame = l_tmp_frame_id;
+  apv_pvals->apv_src_frame = l_tmp_frame_id;
 
   if(gap_debug)
   {
-    printf("gap_mov_exec_anim_preview: apv_src_frame %d\n"
-           , (int) l_pvals->apv_src_frame);
+    printf("p_mov_exec_anim_preview_2: apv_src_frame %d\n"
+           , (int) apv_pvals->apv_src_frame);
   }
 
 
@@ -3101,16 +3203,16 @@ gap_mov_exec_anim_preview(GapMovValues *pvals_orig, GapAnimInfo *ainfo_ptr, gint
   /* --------------------------------- */
   l_rc = p_mov_execute(l_mov_ptr);
 
-  if(l_pvals->cache_tmp_image_id >= 0)
+  if(apv_pvals->cache_tmp_image_id >= 0)
   {
      if(gap_debug)
      {
-        printf("gap_mov_exec_anim_preview: DELETE cache_tmp_image_id:%d\n",
-                 (int)l_pvals->cache_tmp_image_id);
+        printf("p_mov_exec_anim_preview_2: DELETE cache_tmp_image_id:%d\n",
+                 (int)apv_pvals->cache_tmp_image_id);
      }
      /* destroy the cached frame image */
-     gimp_image_delete(l_pvals->cache_tmp_image_id);
-     l_pvals->cache_tmp_image_id = -1;
+     gimp_image_delete(apv_pvals->cache_tmp_image_id);
+     apv_pvals->cache_tmp_image_id = -1;
   }
 
   if(l_rc < 0)
@@ -3136,8 +3238,7 @@ gap_mov_exec_anim_preview(GapMovValues *pvals_orig, GapAnimInfo *ainfo_ptr, gint
   }
 
   return(l_mlayer_image_id);
-}       /* end gap_mov_exec_anim_preview */
-
+}       /* end p_mov_exec_anim_preview_2 */
 
 
 
@@ -3365,10 +3466,20 @@ gap_mov_exec_gap_load_pointfile(char *filename, GapMovValues *pvals)
          }
          if(l_idx == -1)
          {
-           if((l_cnt < 2) || (l_i2 > GAP_MOV_MAX_POINT) || (l_i1 > l_i2))
+           /* we are scanning the initial line
+            * where l_i1 is the current point
+            * and l_i2 is the total numer of control points to be read
+            */
+           if((l_cnt < 2) || (l_i1 > l_i2))
            {
+             /* error because too few values, or current point index overflow */
              break;
            }
+           if(l_i2 >= pvals->point_table_size)
+           {
+             /* reallocate bigger point table */
+             gap_mov_exec_dim_point_table(pvals, l_i2 + 2);
+           }
            pvals->point_idx     = l_i1;
            pvals->point_idx_max = l_i2 -1;
            l_idx = 0;
@@ -3534,7 +3645,10 @@ gap_mov_exec_gap_load_pointfile(char *filename, GapMovValues *pvals)
            l_idx ++;
          }
 
-         if(l_idx > pvals->point_idx_max) break;
+         if(l_idx > pvals->point_idx_max)
+         {
+           break;
+         }
        }
     }
 
@@ -4008,39 +4122,37 @@ gap_mov_exec_query(GapMovValues *val_ptr, GapAnimInfo *ainfo_ptr, GapMovQuery *m
 {
   GapMovData    l_mov_data;
   GapMovData   *l_mov_ptr;
-  GapMovValues  l_mov_vals;
   GapMovValues *l_pvals;
 
   l_mov_ptr = &l_mov_data;
-  l_pvals = &l_mov_vals;
 
   if((mov_query != NULL) && (val_ptr != NULL))
   {
+    l_pvals = gap_mov_exec_new_GapMovValues();
     /* init query results */
     mov_query->pathSegmentLengthInPixels = 0.0;
     mov_query->maxSpeedInPixelsPerFrame = 0.0;
     mov_query->minSpeedInPixelsPerFrame = -1.0;
     mov_query->segmentNumber = 0;
     /* copy settings */
-    memcpy(l_pvals, val_ptr, sizeof(GapMovValues));
+    gap_mov_exec_copy_GapMovValues(l_pvals, val_ptr);
     l_mov_ptr->val_ptr = l_pvals;
     l_mov_ptr->dst_ainfo_ptr = ainfo_ptr;
 
-    /* init local cached src image for anim preview generation.
-     * (never mix cached src image for normal and anim preview
-     *  because anim previews are often scaled down)
+    /* init local cached src image for parameter query.
      */
-    l_pvals->cache_src_image_id  = -1;
-    l_pvals->cache_tmp_image_id  = -1;
-    l_pvals->cache_tmp_layer_id  = -1;
-    l_pvals->cache_frame_number  = -1;
-    l_pvals->cache_ainfo_ptr = NULL;
+    p_reset_cache_GapMovValues(l_pvals);
 
     p_mov_execute_or_query(l_mov_ptr, mov_query);
     if(mov_query->minSpeedInPixelsPerFrame < 0)
     {
       mov_query->minSpeedInPixelsPerFrame = -1.0;
     }
+    
+    p_dup_cache_GapMovValues(val_ptr, l_pvals);
+    
+    gap_mov_exec_free_GapMovValues(l_pvals);
+
   }
 }
 
@@ -4061,11 +4173,24 @@ void gap_mov_exec_set_handle_offsets(GapMovValues *val_ptr, GapMovCurrent *cur_p
    if((val_ptr->src_stepmode < GAP_STEP_FRAME)
    || (val_ptr->cache_tmp_image_id < 0))
    {
+     if(gap_debug)
+     {
+        /// ERRRROR src_image_id == 0
+        printf("gap_mov_exec_set_handle_offsets  before gimp_image_width src_image_id:%d\n"
+         , (int)val_ptr->src_image_id
+         );
+     }
      l_src_width  = gimp_image_width(val_ptr->src_image_id);
      l_src_height = gimp_image_height(val_ptr->src_image_id);
    }
    else
    {
+     if(gap_debug)
+     {
+        printf("gap_mov_exec_set_handle_offsets  before gimp_image_width cache_tmp_image_id:%d\n"
+         , (int)val_ptr->cache_tmp_image_id
+         );
+     }
      /* for Frame Based Modes use the cached tmp image */
      l_src_width  = gimp_image_width(val_ptr->cache_tmp_image_id);
      l_src_height = gimp_image_height(val_ptr->cache_tmp_image_id);
@@ -4118,6 +4243,38 @@ gap_mov_exec_get_default_rotate_threshold()
 
 
 /* ------------------------------------
+ * p_reset_cache_GapMovValues
+ * ------------------------------------
+ * this procedure resets cache references
+ * gap_mov_exec_free_GapMovValues
+ */
+static void
+p_reset_cache_GapMovValues(GapMovValues *pvals)
+{
+  pvals->cache_src_image_id = -1;
+  pvals->cache_tmp_image_id = -1;
+  pvals->cache_tmp_layer_id = -1;
+  pvals->cache_frame_number = -1;
+  if(pvals->cache_ainfo_ptr != NULL)
+  {
+    gap_lib_free_ainfo(&pvals->cache_ainfo_ptr);
+    pvals->cache_ainfo_ptr = NULL;
+  }
+}
+
+static void
+p_dup_cache_GapMovValues(GapMovValues *dstValues, GapMovValues *srcValues)
+{
+  p_reset_cache_GapMovValues(dstValues);
+  dstValues->cache_src_image_id = srcValues->cache_src_image_id;
+  dstValues->cache_tmp_image_id = srcValues->cache_tmp_image_id;
+  dstValues->cache_tmp_layer_id = srcValues->cache_tmp_layer_id;
+  dstValues->cache_frame_number = srcValues->cache_frame_number;
+  dstValues->cache_ainfo_ptr = gap_lib_dir_ainfo_duplicate(srcValues->cache_ainfo_ptr);
+}
+
+
+/* ------------------------------------
  * gap_mov_exec_new_GapMovValues
  * ------------------------------------
  */
@@ -4125,7 +4282,7 @@ GapMovValues *gap_mov_exec_new_GapMovValues()
 {
   GapMovValues *pvals;
 
-  pvals = g_new (GapMovValues, 1);
+  pvals = g_new0 (GapMovValues, 1);
 
   pvals->version = GAP_MOV_INT_VERSION;
   pvals->rotate_threshold = gap_mov_exec_get_default_rotate_threshold();
@@ -4138,7 +4295,6 @@ GapMovValues *gap_mov_exec_new_GapMovValues()
   pvals->src_filename = NULL;
 
 
-
   pvals->dst_image_id = -1;
   pvals->tmp_image_id = -1;
   pvals->tmpsel_image_id = -1;
@@ -4155,10 +4311,9 @@ GapMovValues *gap_mov_exec_new_GapMovValues()
   pvals->cache_tmp_layer_id = -1;
   pvals->cache_frame_number = -1;
   pvals->cache_ainfo_ptr = NULL;
-  pvals->point_idx = 0;
-  pvals->point_idx_max = 0;
   pvals->src_apply_bluebox  = 0;
   pvals->bbp  = NULL;
+  pvals->bbp_pv  = NULL;
 
   pvals->step_speed_factor = 1.0;
   pvals->tracelayer_enable = FALSE;
@@ -4169,12 +4324,238 @@ GapMovValues *gap_mov_exec_new_GapMovValues()
   pvals->tween_opacity_desc = 80.0;
   
   pvals->dst_group_name_delimiter = g_strdup("/");
+  pvals->dst_group_name_path_string = NULL;
+
+  pvals->point_idx = 0;
+  pvals->point_idx_max = 0;
+  pvals->point_table_size = 0;
+  pvals->point = NULL;
+  gap_mov_exec_dim_point_table(pvals, GAP_MOV_POINT_INITIAL_SIZE);
+
 
   return(pvals);
 
 }  /* end gap_mov_exec_new_GapMovValues */
 
 
+/* ------------------------------------
+ * gap_mov_exec_free_GapMovValues
+ * ------------------------------------
+ */
+void 
+gap_mov_exec_free_GapMovValues(GapMovValues *pvals)
+{
+  if(pvals)
+  {
+    if(pvals->src_filename != NULL)
+    {
+      g_free(pvals->src_filename);
+    }
+    if(pvals->point)
+    {
+      g_free(pvals->point);
+    }
+    if(pvals->bbp != NULL)
+    {
+      g_free(pvals->bbp);
+    }
+    if(pvals->bbp_pv != NULL)
+    {
+      g_free(pvals->bbp_pv);
+    }
+    
+    if(pvals->apv_gap_paste_buff != NULL)
+    {
+      g_free(pvals->apv_gap_paste_buff);
+    }
+    
+    if (pvals->cache_ainfo_ptr != NULL)
+    {
+      gap_lib_free_ainfo(&pvals->cache_ainfo_ptr);
+    }
+    
+    if(pvals->dst_group_name_path_string)
+    {
+      g_free(pvals->dst_group_name_path_string);
+    }
+
+    if(pvals->dst_group_name_delimiter)
+    {
+      g_free(pvals->dst_group_name_delimiter);
+    }    
+    
+    g_free(pvals);
+  }
+}  /* end gap_mov_exec_free_GapMovValues */
+
+
+/* ------------------------------------------
+ * gap_mov_exec_copy_GapMovValues
+ * ------------------------------------------
+ * copies all settings inclusive the controlpoint table,
+ */
+void
+gap_mov_exec_copy_GapMovValues(GapMovValues *dstValues, GapMovValues *srcValues)
+{
+  gint ii;
+
+  if(gap_debug)
+  {
+    printf("gap_mov_exec_copy_GapMovValues START\n");
+  }
+
+  /* redim the point table in dstValues to same size as the srcValues */
+  gap_mov_exec_dim_point_table(dstValues, srcValues->point_table_size);
+
+  dstValues->version = srcValues->version;
+  dstValues->recordedFrameWidth = srcValues->recordedFrameWidth;
+  dstValues->recordedFrameHeight = srcValues->recordedFrameHeight;
+  dstValues->recordedObjWidth = srcValues->recordedObjWidth;
+  dstValues->recordedObjHeight = srcValues->recordedObjHeight;
+  dstValues->total_frames = srcValues->total_frames;
+  dstValues->src_layerstack = srcValues->src_layerstack;
+  dstValues->src_image_id = srcValues->src_image_id;
+  dstValues->src_layer_id = srcValues->src_layer_id;
+  dstValues->src_handle = srcValues->src_handle;
+  dstValues->src_stepmode = srcValues->src_stepmode;
+  dstValues->src_selmode = srcValues->src_selmode;
+  dstValues->src_paintmode = srcValues->src_paintmode;
+  dstValues->src_force_visible = srcValues->src_force_visible;
+  dstValues->src_apply_bluebox = srcValues->src_apply_bluebox;
+  dstValues->clip_to_img = srcValues->clip_to_img;
+  dstValues->tmpsel_image_id = srcValues->tmpsel_image_id;
+  dstValues->tmpsel_channel_id = srcValues->tmpsel_channel_id;
+
+  
+  dstValues->step_speed_factor = srcValues->step_speed_factor;
+  dstValues->tween_opacity_initial = srcValues->tween_opacity_initial;
+  dstValues->tween_opacity_desc = srcValues->tween_opacity_desc;
+  dstValues->trace_opacity_initial = srcValues->trace_opacity_initial;
+  dstValues->trace_opacity_desc = srcValues->trace_opacity_desc;
+  dstValues->tracelayer_enable = srcValues->tracelayer_enable;
+  dstValues->tween_steps = srcValues->tween_steps;
+
+
+  dstValues->point_idx = srcValues->point_idx;
+  dstValues->point_idx_max = srcValues->point_idx_max;
+
+  /* copy controlpoint data for all points */
+  for(ii=0; ii <= srcValues->point_idx_max; ii++)
+  {
+    memcpy(&dstValues->point[ii], &srcValues->point[ii], sizeof(GapMovPoint));
+  }
+
+
+  dstValues->dst_range_start = srcValues->dst_range_start;
+  dstValues->dst_range_end = srcValues->dst_range_end;
+  dstValues->dst_layerstack = srcValues->dst_layerstack;
+
+
+
+
+  dstValues->dst_image_id = srcValues->dst_image_id;
+  dstValues->tmp_image_id = srcValues->tmp_image_id;
+  dstValues->tmp_alt_image_id = srcValues->tmp_alt_image_id;
+  dstValues->tmp_alt_framenr = srcValues->tmp_alt_framenr;
+  
+  /*
+   *  NOT copied are apv values for animated preview 
+   *    apv_gap_paste_buff
+   */ 
+  dstValues->apv_mode = srcValues->apv_mode;
+  dstValues->apv_mlayer_image = srcValues->apv_mlayer_image;
+  dstValues->apv_framerate = srcValues->apv_framerate;
+  dstValues->apv_scalex = srcValues->apv_scalex;
+  dstValues->apv_scaley = srcValues->apv_scaley;
+
+  dstValues->tween_image_id = srcValues->tween_image_id;
+  dstValues->tween_layer_id = srcValues->tween_layer_id;
+  dstValues->trace_image_id = srcValues->trace_image_id;
+  dstValues->trace_layer_id = srcValues->trace_layer_id;
+  dstValues->twix = srcValues->twix;
+
+
+  dstValues->rotate_threshold = srcValues->rotate_threshold;
+
+  if(dstValues->dst_group_name_path_string != NULL)
+  {
+    if(gap_debug)
+    {
+      printf("gap_mov_exec_copy_GapMovValues g_free dstValues->dst_group_name_path_string\n");
+    }
+    g_free(dstValues->dst_group_name_path_string);
+    dstValues->dst_group_name_path_string = NULL;
+  }
+  if(srcValues->dst_group_name_path_string != NULL)
+  {
+    dstValues->dst_group_name_path_string = g_strdup(srcValues->dst_group_name_path_string);
+  }
+
+  if(dstValues->dst_group_name_delimiter != NULL)
+  {
+    if(gap_debug)
+    {
+      printf("gap_mov_exec_copy_GapMovValues g_free dstValues->dst_group_name_delimiter\n");
+    }
+    g_free(dstValues->dst_group_name_delimiter);
+    dstValues->dst_group_name_delimiter = NULL;
+  }
+  if(srcValues->dst_group_name_delimiter != NULL)
+  {
+    dstValues->dst_group_name_delimiter = g_strdup(srcValues->dst_group_name_delimiter);
+  }
+  if(dstValues->src_filename != NULL)
+  {
+    if(gap_debug)
+    {
+      printf("gap_mov_exec_copy_GapMovValues g_free dstValues->src_filename\n");
+    }
+    g_free(dstValues->src_filename);
+    dstValues->src_filename = NULL;
+  }
+  if(srcValues->src_filename != NULL)
+  {
+    dstValues->src_filename = g_strdup(srcValues->src_filename);
+  }
+
+  /* copy the bluebox parameter values */
+  if(dstValues->bbp != NULL)
+  {
+    if(gap_debug)
+    {
+      printf("gap_mov_exec_copy_GapMovValues g_free dstValues->bbp\n");
+    }
+    g_free(dstValues->bbp);
+    dstValues->bbp = NULL;
+  }
+  if(srcValues->bbp != NULL)
+  {
+    dstValues->bbp = g_new(GapBlueboxGlobalParams, 1);
+    memcpy(dstValues->bbp, srcValues->bbp, sizeof(GapBlueboxGlobalParams));
+  }
+
+  if(dstValues->bbp_pv != NULL)
+  {
+    if(gap_debug)
+    {
+      printf("gap_mov_exec_copy_GapMovValues g_free dstValues->bbp_pv\n");
+    }
+    g_free(dstValues->bbp_pv);
+    dstValues->bbp_pv = NULL;
+  }
+  if(srcValues->bbp_pv != NULL)
+  {
+    dstValues->bbp_pv = g_new(GapBlueboxGlobalParams, 1);
+    memcpy(dstValues->bbp_pv, srcValues->bbp_pv, sizeof(GapBlueboxGlobalParams));
+  }
+
+
+  /* copy cached rferences */
+  p_dup_cache_GapMovValues(dstValues, srcValues);
+
+}  /* end gap_mov_exec_copy_GapMovValues */
+
+
 /* ----------------------------------
  * gap_mov_exec_move_path_singleframe
  * ----------------------------------
@@ -4299,7 +4680,7 @@ gap_mov_exec_check_valid_xml_paramfile(const char *filename)
                                      );
     }
   }
-  g_free(pvals);
+  gap_mov_exec_free_GapMovValues(pvals);
 
   return (isXmlLoadOk);
 
@@ -4366,7 +4747,66 @@ gap_mov_exec_move_path_singleframe_directcall(gint32 frame_image_id
        );
   }
 
-  g_free(pvals);
+  gap_mov_exec_free_GapMovValues(pvals);
   return (result_layer_id);
 
 }  /* end gap_mov_exec_move_path_singleframe_directcall  */
+
+
+/* ------------------------------
+ * gap_mov_exec_dim_point_table
+ * ------------------------------
+ */
+void
+gap_mov_exec_dim_point_table(GapMovValues *pvals, gint num_points)
+{
+   GapMovPoint *new_points;
+   
+   if(pvals->point != NULL)
+   {
+     if ((pvals->point_table_size >= num_points)
+     &&  (pvals->point_idx_max < pvals->point_table_size)) 
+     {
+       /* the table is alredy big enough, nothing left to do */
+       if(gap_debug)
+       {
+         printf("gap_mov_exec_dim_point_table num:%d point_idx_max:%d KEEP point_table_size:%d \n"
+           , (int)num_points
+           , (int)pvals->point_idx_max
+           , (int)pvals->point_table_size
+           );
+       }
+       return;
+     }
+     else
+     {
+       gint ii;
+       new_points = g_new0(GapMovPoint, num_points);
+
+       /* copy all used points to new_points */
+       for(ii = 0; ii <= pvals->point_idx_max; ii++)
+       {
+         memcpy(&new_points[ii], &pvals->point[ii], sizeof(GapMovPoint));
+       }
+       g_free(pvals->point);
+     }
+   }
+   else
+   {
+     new_points = g_new0(GapMovPoint, num_points);
+   }
+   
+   pvals->point_table_size = num_points;
+   pvals->point = new_points;
+   
+   if(gap_debug)
+   {
+     printf("gap_mov_exec_dim_point_table num:%d point_idx_max:%d NEW point_table_size:%d \n"
+       , (int)num_points
+       , (int)pvals->point_idx_max
+       , (int)pvals->point_table_size
+       );
+   }
+}  /* end gap_mov_exec_dim_point_table */
+
+
diff --git a/gap/gap_mov_exec.h b/gap/gap_mov_exec.h
index 7fe8cd6..f8d0f3c 100644
--- a/gap/gap_mov_exec.h
+++ b/gap/gap_mov_exec.h
@@ -59,9 +59,19 @@ void    gap_mov_exec_query(GapMovValues *val_ptr, GapAnimInfo *ainfo_ptr, GapMov
 gdouble gap_mov_exec_get_default_rotate_threshold();
 
 GapMovValues *gap_mov_exec_new_GapMovValues();
+void gap_mov_exec_free_GapMovValues(GapMovValues *pvals);
+void gap_mov_exec_copy_GapMovValues(GapMovValues *dstValues, GapMovValues *srcValues);
 
 gboolean  gap_mov_exec_check_valid_xml_paramfile(const char *filename);
 
+/* ------------------------------
+ * gap_mov_exec_dim_point_table
+ * ------------------------------
+ * (re) allocate point table when actual size is smaller than specified num_points
+ * e.g. this procedure does never shrink an already allocated point table,
+ * but just makes sure it can hold up to num_points.
+ */
+void gap_mov_exec_dim_point_table(GapMovValues *pvals, gint num_points);
 
 /* ---------------------------------------------
  * gap_mov_exec_move_path_singleframe_directcall
diff --git a/gap/gap_mov_main.c b/gap/gap_mov_main.c
index bd96f0b..dec29eb 100644
--- a/gap/gap_mov_main.c
+++ b/gap/gap_mov_main.c
@@ -307,7 +307,6 @@ query ()
                          " - keyframe_abs numbers must be 0 (== not fixed) or a frame_number within the 
affected frame range\n"
                          " - keyframes_abs must be in sequence (ascending or descending)\n"
                          " - the first and last controlpoint are always implicit keyframes, and should be 
passed with keyframe_abs = 0\n"
-                         " - the number of controlpoints is limited to a maximum of %d.\n"
                          "   the number of controlpoints must be passed in all argc_* parameters\n"
                          "If the TraceLayer feature is turned on, an additional layer\n"
                          "  is inserted below the moving object. This Tracelayer shows all steps\n"
@@ -315,8 +314,8 @@ query ()
                          "With TweenSteps you can calculate virtual Frames between 2 destination frames\n"
                          "  all these Steps are collected in another additional Layer.\n"
                          "  this Tweenlayer is added below the moving Object in all handled destination 
Frames\n"
-                         "See also (plug_in_gap_move_path, plug_in_gap_move)",
-                         (int)GAP_MOV_MAX_POINT);
+                         "See also (plug_in_gap_move_path, plug_in_gap_move)"
+                         );
 
   gimp_install_procedure(PLUGIN_NAME_GAP_MOVE_PATH_EXT,
                          "This plugin copies layer(s) from one sourceimage or source animation to multiple 
frames on disk,\n"
@@ -487,7 +486,7 @@ run (const gchar *name
       {
         l_rc_image = gap_mov_exec_move_path(run_mode, image_id, pvals, NULL, 0, 0);
       }
-      g_free(pvals);
+      gap_mov_exec_free_GapMovValues(pvals);
   }
   else if (strcmp (name, PLUGIN_NAME_GAP_MOVE_SINGLEFRAME) == 0)
   {
@@ -553,7 +552,7 @@ run (const gchar *name
           gimp_set_data(PLUGIN_NAME_GAP_MOVE_SINGLEFRAME, &singleframevals, sizeof(singleframevals));
         }
       }
-      g_free(pvals);
+      gap_mov_exec_free_GapMovValues(pvals);
 
   }
   else if ((strcmp (name, PLUGIN_NAME_GAP_MOVE_PATH_EXT) == 0)
@@ -670,7 +669,7 @@ run (const gchar *name
       {
         l_rc_image = gap_mov_exec_move_path(run_mode, image_id, pvals, pointfile, l_rotation_follow, 
(gdouble)l_startangle);
       }
-      g_free(pvals);
+      gap_mov_exec_free_GapMovValues(pvals);
       if(pointfile != NULL)
       {
         g_free(pointfile);
diff --git a/gap/gap_mov_render.c b/gap/gap_mov_render.c
index 04e72dc..4a1a98a 100644
--- a/gap/gap_mov_render.c
+++ b/gap/gap_mov_render.c
@@ -739,7 +739,7 @@ gap_mov_render_render(gint32 image_id, GapMovValues *val_ptr, GapMovCurrent *cur
 
   if(gap_debug)
   {
-    printf("gap_mov_render_render: frame/layer: %ld/%ld  X=%f, Y=%f\n"
+    printf("gap_mov_render_render: frame/layer: %d/%d  X=%f, Y=%f\n"
                 "       Width=%f Height=%f\n"
                 "       Opacity=%f  Rotate=%f  clip_to_img = %d force_visibility = %d\n"
                 "       src_stepmode = %d rotate_threshold=%.7f\n"
@@ -755,7 +755,7 @@ gap_mov_render_render(gint32 image_id, GapMovValues *val_ptr, GapMovCurrent *cur
                      val_ptr->src_stepmode,
                      val_ptr->rotate_threshold,
                     cur_ptr->singleMovObjLayerId,
-                    gimp_item_get_image(cur_ptr->singleMovObjLayerId),
+                    (cur_ptr->singleMovObjLayerId >= 0) ? gimp_item_get_image(cur_ptr->singleMovObjLayerId) 
:-44,
                     image_id
                     );
   }
@@ -1402,3 +1402,4 @@ gap_mov_render_create_or_replace_tempsel_image(gint32 channel_id
                           );
   }
 }  /* end gap_mov_render_create_or_replace_tempsel_image */
+
diff --git a/gap/gap_mov_xml_par.c b/gap/gap_mov_xml_par.c
index f5b2d33..2019b86 100644
--- a/gap/gap_mov_xml_par.c
+++ b/gap/gap_mov_xml_par.c
@@ -1,5 +1,5 @@
 /* gap_mov_xml_par.c
- * 2011.03.09 hof (Wolfgang Hofer)
+ * 2014.05.07 hof (Wolfgang Hofer)
  *
  * GAP ... Gimp Animation Plugins
  *
@@ -842,8 +842,12 @@ p_xml_parse_element_controlpoints(const gchar         *element_name,
 
       if(userDataPtr->isParseOk)
       {
-        if((numberOfPoints < GAP_MOV_MAX_POINT) && (numberOfPoints > 0))
+        if(numberOfPoints > 0)
         {
+          if (numberOfPoints > userDataPtr->pvals->point_table_size)
+          {
+            gap_mov_exec_dim_point_table(userDataPtr->pvals, numberOfPoints + 2);
+          }
           userDataPtr->pvals->point_idx_max = numberOfPoints -1;
         }
         else
@@ -868,7 +872,7 @@ p_xml_parse_element_controlpoints(const gchar         *element_name,
 static void
 p_set_load_defaults_for_one_controlpoint(GapMovValues *pvals, gint idx)
 {
-  if((idx >= 0) && (idx < GAP_MOV_MAX_POINT))
+  if((idx >= 0) && (idx < pvals->point_table_size))
   {
     pvals->point[idx].p_x  = 0;
     pvals->point[idx].p_y  = 0;
@@ -916,9 +920,9 @@ p_xml_parse_element_controlpoint(const gchar         *element_name,
   const gchar **name_cursor = attribute_names;
   const gchar **value_cursor = attribute_values;
 
-  if(count >= GAP_MOV_MAX_POINT)
+  if(count >= userDataPtr->pvals->point_table_size)
   {
-    userDataPtr->isParseOk = FALSE;
+    gap_mov_exec_dim_point_table(userDataPtr->pvals, count + GAP_MOV_POINT_EXPAND_SIZE);
   }
 
   p_set_load_defaults_for_one_controlpoint(userDataPtr->pvals, count);
@@ -1046,10 +1050,13 @@ p_start_xml_element (GMarkupParseContext *context,
     const gchar         *element_name,
     const gchar        **attribute_names,
     const gchar        **attribute_values,
-    GapMovXmlUserData   *userDataPtr,
+    gpointer           user_data,
     GError             **error)
 {
   gint jj;
+  GapMovXmlUserData   *userDataPtr;
+  
+  userDataPtr = (GapMovXmlUserData *)user_data;
 
   if(gap_debug)
   {
@@ -1105,9 +1112,13 @@ p_start_xml_element (GMarkupParseContext *context,
 static void
 p_end_xml_element (GMarkupParseContext *context,
     const gchar         *element_name,
-    GapMovXmlUserData   *userDataPtr,
+    gpointer             user_data,
     GError             **error)
 {
+  GapMovXmlUserData   *userDataPtr;
+
+  userDataPtr = (GapMovXmlUserData *)user_data;
+
   if(gap_debug)
   {
     printf("p_end_xml_element: %s\n", element_name);
@@ -1179,80 +1190,20 @@ p_copy_transformed_values(GapMovValues *dstValues, GapMovValues *srcValues
 {
   gint ii;
 
-  dstValues->version = srcValues->version;
-  dstValues->rotate_threshold = srcValues->rotate_threshold;
-  dstValues->recordedFrameWidth = srcValues->recordedFrameWidth;
-  dstValues->recordedFrameHeight = srcValues->recordedFrameHeight;
-  dstValues->recordedObjWidth = srcValues->recordedObjWidth;
-  dstValues->recordedObjHeight = srcValues->recordedObjHeight;
-  dstValues->dst_range_start = srcValues->dst_range_start;
-  dstValues->dst_range_end = srcValues->dst_range_end;
-  dstValues->total_frames = srcValues->total_frames;
-  dstValues->tween_steps = srcValues->tween_steps;
-  dstValues->tween_opacity_initial = srcValues->tween_opacity_initial;
-  dstValues->tween_opacity_desc = srcValues->tween_opacity_desc;
-  dstValues->tracelayer_enable = srcValues->tracelayer_enable;
-  dstValues->trace_opacity_initial = srcValues->trace_opacity_initial;
-  dstValues->trace_opacity_desc = srcValues->trace_opacity_desc;
-  dstValues->src_stepmode = srcValues->src_stepmode;
-  dstValues->src_handle = srcValues->src_handle;
-  dstValues->src_selmode = srcValues->src_selmode;
-  dstValues->src_paintmode = srcValues->src_paintmode;
-  dstValues->dst_layerstack = srcValues->dst_layerstack;
-  if(dstValues->dst_group_name_path_string != NULL)
-  {
-    g_free(dstValues->dst_group_name_path_string);
-    dstValues->dst_group_name_path_string = NULL;
-  }
-  if(srcValues->dst_group_name_path_string != NULL)
-  {
-    dstValues->dst_group_name_path_string = g_strdup(srcValues->dst_group_name_path_string);
-  }
-
-  if(dstValues->dst_group_name_delimiter != NULL)
-  {
-    g_free(dstValues->dst_group_name_delimiter);
-    dstValues->dst_group_name_delimiter = NULL;
-  }
-  if(srcValues->dst_group_name_delimiter != NULL)
-  {
-    dstValues->dst_group_name_delimiter = g_strdup(srcValues->dst_group_name_delimiter);
-  }
-  dstValues->step_speed_factor = srcValues->step_speed_factor;
-  dstValues->src_force_visible = srcValues->src_force_visible;
-  dstValues->clip_to_img = srcValues->clip_to_img;
-  dstValues->src_apply_bluebox = srcValues->src_apply_bluebox;
-  dstValues->src_layerstack = srcValues->src_layerstack;
-
-  if(dstValues->src_filename != NULL)
-  {
-    g_free(dstValues->src_filename);
-    dstValues->src_filename = NULL;
-  }
-  if(srcValues->src_filename != NULL)
-  {
-    dstValues->src_filename = g_strdup(srcValues->src_filename);
-  }
-
-  if(dstValues->bbp != NULL)
-  {
-    g_free(dstValues->bbp);
-    dstValues->bbp = NULL;
-  }
-  if(srcValues->bbp != NULL)
+  if(gap_debug)
   {
-    dstValues->bbp = g_new(GapBlueboxGlobalParams, 1);
-    memcpy(dstValues->bbp, srcValues->bbp, sizeof(GapBlueboxGlobalParams));
+    printf("p_copy_transformed_values START\n");
   }
 
+  /* copy all settings, points (this also includes 
+   * reallocate the point table in dstValues to same size as the srcValues 
+   */
+  gap_mov_exec_copy_GapMovValues(dstValues, srcValues);
 
-  dstValues->point_idx = srcValues->point_idx;
-  dstValues->point_idx_max = srcValues->point_idx_max;
 
-  /* copy controlpoint data for all points and transform coordinates */
+  /* transform coordinates */
   for(ii=0; ii <= srcValues->point_idx_max; ii++)
   {
-    memcpy(&dstValues->point[ii], &srcValues->point[ii], sizeof(GapMovPoint));
 
     dstValues->point[ii].p_x = p_transform_path_coordinate(srcValues->point[ii].p_x
                                     , srcValues->recordedFrameWidth
@@ -1424,12 +1375,14 @@ gap_mov_xml_par_load(const char *filename, GapMovValues *productiveValues
   if(tmpValues->bbp != NULL)
   {
     g_free(tmpValues->bbp);
+    tmpValues->bbp = NULL;
   }
   if(tmpValues->src_filename != NULL)
   {
     g_free(tmpValues->src_filename);
+    tmpValues->src_filename = NULL;
   }
-  g_free(tmpValues);
+  gap_mov_exec_free_GapMovValues(tmpValues);
 
   g_free(userDataPtr);
 
@@ -1768,3 +1721,4 @@ gap_mov_xml_par_save(char *filename, GapMovValues *pvals)
   }
   return -1;
 }  /* end gap_mov_xml_par_save */
+
diff --git a/gap/gap_navigator_dialog.c b/gap/gap_navigator_dialog.c
index c812747..ce5e6a8 100644
--- a/gap/gap_navigator_dialog.c
+++ b/gap/gap_navigator_dialog.c
@@ -2512,7 +2512,7 @@ navi_render_preview (FrameWidget *fw)
    }
    else
    {
-     struct stat  l_stat;
+     GStatBuf     l_stat;
      gchar       *l_frame_filename;
      gboolean     l_can_use_cached_thumbnail;
      gboolean     l_referenced_frame_exists;
diff --git a/gap/gap_onion_base.h b/gap/gap_onion_base.h
index d3a24cd..a5941a2 100644
--- a/gap/gap_onion_base.h
+++ b/gap/gap_onion_base.h
@@ -41,6 +41,7 @@
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <time.h>
 
 /* #include <locale.h> */
 #include <gap-intl.h>
@@ -65,7 +66,7 @@
 #define GAP_ONION_REFMODE_BIDRIECTIONAL_DOUBLE   2
 
 typedef struct GapOnionBaseParasite_data {
-   long         timestamp;      /* UTC timecode of creation time */
+   time_t       timestamp;      /* UTC timecode of creation time */
    gint32       tattoo;         /* unique tattoo */
 } GapOnionBaseParasite_data;
 
diff --git a/gap/gap_player_dialog.c b/gap/gap_player_dialog.c
index 440b3b0..03ffb4c 100644
--- a/gap/gap_player_dialog.c
+++ b/gap/gap_player_dialog.c
@@ -3895,6 +3895,14 @@ p_render_display_free_image_id(GapPlayerMainGlobalParams *gpp
    , gint32  flip_status
   )
 {
+  if (image_id < 0)
+  {
+    if(gap_debug)
+    {
+      printf("p_render_display_free_image_id: WARNING invalid image_id:%d\n", (int)image_id);
+    }
+    return;
+  }
   /* there is no need for undo on this scratch image
    * so we turn undo off for performance reasons
    */
diff --git a/gap/gap_story_att_trans_dlg.c b/gap/gap_story_att_trans_dlg.c
index a130541..37567fa 100644
--- a/gap/gap_story_att_trans_dlg.c
+++ b/gap/gap_story_att_trans_dlg.c
@@ -88,7 +88,7 @@
 
 extern int gap_debug;  /* 1 == print debug infos , 0 dont print debug infos */
 
-static gdouble  p_getConvertFactor(gint att_type_idx);
+static gdouble  p_getConvertFactor(glong att_type_idx);
 static void     p_attw_prop_response(GtkWidget *widget
                   , gint       response_id
                   , GapStbAttrWidget *attw
@@ -103,15 +103,15 @@ static void     p_attw_update_properties(GapStbAttrWidget *attw);
 static void     p_attw_update_sensitivity(GapStbAttrWidget *attw);
 static gdouble  p_get_default_attribute(GapStbAttrWidget *attw
                      , GdkEventButton  *bevent
-                     , gint att_type_idx
+                     , glong att_type_idx
                      , gboolean form_value);
 
 static void     p_attw_start_button_clicked_callback(GtkWidget *widget
                   , GdkEventButton  *bevent
-                  , gint att_type_idx);
+                  , glong att_type_idx);
 static void     p_attw_end_button_clicked_callback(GtkWidget *widget
                   , GdkEventButton  *bevent
-                  , gint att_type_idx);
+                  , glong att_type_idx);
 
 static void     p_copy_duration_to_all(gint32 duration, GapStbAttrWidget *attw);
 static void     p_attw_overlap_dur_button_clicked_callback(GtkWidget *widget
@@ -119,7 +119,7 @@ static void     p_attw_overlap_dur_button_clicked_callback(GtkWidget *widget
                   , GapStbAttrWidget *attw);
 static void     p_attw_dur_button_clicked_callback(GtkWidget *widget
                   , GdkEventButton  *bevent
-                  , gint att_type_idx);
+                  , glong att_type_idx);
 static void     p_attw_gdouble_adjustment_callback(GtkObject *obj, gdouble *val);
 static void     p_duration_dependent_refresh(GapStbAttrWidget *attw);
 static void     p_attw_duration_adjustment_callback(GtkObject *obj, gint32 *val);
@@ -132,21 +132,21 @@ static gboolean p_attw_preview_events_cb (GtkWidget *widget
                        , GdkEvent  *event
                        , GapStbAttrWidget *attw);
 static void     p_calculate_prefetch_render_attributes(GapStbAttrWidget *attw
-                       , gint img_idx
+                       , glong img_idx
                        , GapStoryCalcAttr  *calc_attr_ptr
                        );
 static void     p_calculate_render_attributes(GapStbAttrWidget *attw
-                       , gint img_idx
+                       , glong img_idx
                        , GapStoryCalcAttr  *calc_attr
                        );
-static void     p_check_and_make_opre_default_layer(GapStbAttrWidget *attw, gint img_idx);
-static void     p_check_and_make_orig_default_layer(GapStbAttrWidget *attw, gint img_idx);
+static void     p_check_and_make_opre_default_layer(GapStbAttrWidget *attw, glong img_idx);
+static void     p_check_and_make_orig_default_layer(GapStbAttrWidget *attw, glong img_idx);
 static gint32   p_create_color_layer(GapStbAttrWidget *attw, gint32 image_id
                     , const char *name, gint stackposition, gdouble opacity
                     , gdouble red, gdouble green, gdouble blue);
 static gint32   p_create_base_layer(GapStbAttrWidget *attw, gint32 image_id);
 static gint32   p_create_deco_layer(GapStbAttrWidget *attw, gint32 image_id);
-static void     p_create_gfx_image(GapStbAttrWidget *attw, gint img_idx);
+static void     p_create_gfx_image(GapStbAttrWidget *attw, glong img_idx);
 static void     p_delete_gfx_images(GapStbAttrWidget *attw);
 static void     p_adjust_stackposition(gint32 image_id, gint32 layer_id, gint position);
 
@@ -157,7 +157,7 @@ static gboolean p_create_transformed_layer_movepath(gint32 image_id
                                                   , GapStoryCalcAttr  *calculated
                                                   , gint32 stackposition, const char *layername
                                                   , GapStbAttrWidget *attw
-                                                  , gint img_idx
+                                                  , glong img_idx
                                                   );
 
 static void     p_create_transformed_layer(gint32 image_id
@@ -167,15 +167,15 @@ static void     p_create_transformed_layer(gint32 image_id
                     , gint32 stackposition
                     , const char *layername
                     , GapStbAttrWidget *attw
-                    , gint img_idx
+                    , glong img_idx
                     , gboolean enableMovepath
                     );
-static gboolean p_calculate_prefetch_visibility(GapStbAttrWidget *attw, gint img_idx);
+static gboolean p_calculate_prefetch_visibility(GapStbAttrWidget *attw, glong img_idx);
 
-static void     p_render_gfx(GapStbAttrWidget *attw, gint img_idx);
+static void     p_render_gfx(GapStbAttrWidget *attw, glong img_idx);
 
-static void     p_update_framenr_labels(GapStbAttrWidget *attw, gint img_idx, gint32 framenr);
-static gint32   p_get_relevant_duration(GapStbAttrWidget *attw, gint img_idx);
+static void     p_update_framenr_labels(GapStbAttrWidget *attw, glong img_idx, gint32 framenr);
+static gint32   p_get_relevant_duration(GapStbAttrWidget *attw, glong img_idx);
 static void     p_update_full_preview_gfx(GapStbAttrWidget *attw);
 
 static gboolean p_stb_req_equals_layer_info(GapStbAttrLayerInfo *linfo
@@ -199,11 +199,11 @@ static void     p_orig_layer_frame_fetcher(GapStbAttrWidget *attw
                     , GapStbAttrLayerInfo *linfo);
 
 static gint32   p_calc_and_set_display_framenr(GapStbAttrWidget *attw
-                    , gint   img_idx
+                    , long   img_idx
                     , gint32 duration);
 
 static void     p_create_or_replace_orig_and_opre_layer (GapStbAttrWidget *attw
-                         , gint   img_idx
+                         , long   img_idx
                          , gint32 duration);
 static gint32   p_fetch_video_frame_as_layer(GapStbMainGlobalParams *sgpp
                    , const char *video_filename
@@ -242,14 +242,14 @@ static void     p_create_and_attach_pv_widgets(GapStbAttrWidget *attw
                  , gint row
                  , gint col_start
                  , gint col_end
-                 , gint img_idx
+                 , glong img_idx
                  );
 static void     p_create_and_attach_att_arr_widgets(const char *row_title
                  , GapStbAttrWidget *attw
                  , GtkWidget *table
                  , gint row
                  , gint column
-                 , gint att_type_idx
+                 , glong att_type_idx
                  , gdouble lower_constraint
                  , gdouble upper_constraint
                  , gdouble step_increment
@@ -270,7 +270,7 @@ static void     p_create_and_attach_att_arr_widgets(const char *row_title
 
 
 static gdouble
-p_getConvertFactor(gint att_type_idx)
+p_getConvertFactor(glong att_type_idx)
 {
   if ((att_type_idx == GAP_STB_ATT_TYPE_ROTATE)
   ||  (att_type_idx == GAP_STB_ATT_TYPE_MOVEPATH))
@@ -307,9 +307,9 @@ p_attw_prop_response(GtkWidget *widget
                   )
 {
   GtkWidget *dlg;
-  GapStbMainGlobalParams  *sgpp;
+  /* GapStbMainGlobalParams  *sgpp; */
 
-  sgpp = attw->sgpp;
+  /* sgpp = attw->sgpp; */
   switch (response_id)
   {
     case GAP_STORY_ATT_RESPONSE_RESET:
@@ -635,7 +635,7 @@ p_attw_update_sensitivity(GapStbAttrWidget *attw)
 static gdouble
 p_get_default_attribute(GapStbAttrWidget *attw
                      , GdkEventButton  *bevent
-                     , gint att_type_idx
+                     , glong att_type_idx
                      , gboolean form_value)
 {
   if(bevent)
@@ -702,7 +702,7 @@ p_get_default_attribute(GapStbAttrWidget *attw
 static void
 p_attw_start_button_clicked_callback(GtkWidget *widget
                , GdkEventButton  *bevent
-               , gint att_type_idx)
+               , glong att_type_idx)
 {
   GapStbAttrWidget *attw;
   attw = g_object_get_data( G_OBJECT(widget), OBJ_DATA_KEY_ATTW );
@@ -733,7 +733,7 @@ p_attw_start_button_clicked_callback(GtkWidget *widget
 static void
 p_attw_end_button_clicked_callback(GtkWidget *widget
                , GdkEventButton  *bevent
-               , gint att_type_idx)
+               , glong att_type_idx)
 {
   GapStbAttrWidget *attw;
   attw = g_object_get_data( G_OBJECT(widget), OBJ_DATA_KEY_ATTW );
@@ -815,7 +815,7 @@ p_attw_overlap_dur_button_clicked_callback(GtkWidget *widget
 static void
 p_attw_dur_button_clicked_callback(GtkWidget *widget
                , GdkEventButton  *bevent
-               , gint att_type_idx)
+               , glong att_type_idx)
 {
   GapStbAttrWidget *attw;
   attw = g_object_get_data( G_OBJECT(widget), OBJ_DATA_KEY_ATTW );
@@ -848,9 +848,9 @@ p_attw_gdouble_adjustment_callback(GtkObject *obj, gdouble *val)
 {
   GapStbAttrWidget *attw;
   gdouble l_val;
-  gint    att_type_idx;
+  glong   att_type_idx;
 
-  att_type_idx = (gint) g_object_get_data( G_OBJECT(obj), "att_type_idx" );
+  att_type_idx = (glong) g_object_get_data( G_OBJECT(obj), "att_type_idx" );
   attw = g_object_get_data( G_OBJECT(obj), OBJ_DATA_KEY_ATTW );
   if(attw)
   {
@@ -910,8 +910,8 @@ p_attw_duration_adjustment_callback(GtkObject *obj, gint32 *val)
       l_val = RINT (GTK_ADJUSTMENT(obj)->value);
       if(gap_debug)
       {
-        printf("gint32_adjustment_callback: obj:%d old_val:%d val:%d\n"
-             ,(int)obj
+        printf("gint32_adjustment_callback: obj:%ld old_val:%d val:%d\n"
+             ,(long)obj
              ,(int)*val
              ,(int)l_val
              );
@@ -947,8 +947,8 @@ p_attw_accel_adjustment_callback(GtkObject *obj, gint32 *val)
       l_val = RINT (GTK_ADJUSTMENT(obj)->value);
       if(gap_debug)
       {
-        printf("accel gint32_adjustment_callback: obj:%d old_val:%d val:%d\n"
-             ,(int)obj
+        printf("accel gint32_adjustment_callback: obj:%ld old_val:%d val:%d\n"
+             ,(long)obj
              ,(int)*val
              ,(int)l_val
              );
@@ -1036,10 +1036,10 @@ p_attw_preview_events_cb (GtkWidget *widget
                        , GdkEvent  *event
                        , GapStbAttrWidget *attw)
 {
-  GdkEventExpose *eevent;
-  GdkEventButton *bevent;
-  GapStbMainGlobalParams  *sgpp;
-  gint                     img_idx;
+  /* GapStbMainGlobalParams  *sgpp; */
+  /* GdkEventButton *bevent; */
+  /* GdkEventExpose *eevent; */
+  glong                    img_idx;
   gboolean                 enableStoryboardDebugFeatures;
 
 
@@ -1049,9 +1049,9 @@ p_attw_preview_events_cb (GtkWidget *widget
     /* the attribute widget is not initialized no action allowed */
     return FALSE;
   }
-  sgpp = attw->sgpp;
+  /* sgpp = attw->sgpp; */
 
-  img_idx = (gint)g_object_get_data( G_OBJECT(widget), OBJ_DATA_KEY_IMG_IDX );
+  img_idx = (glong)g_object_get_data( G_OBJECT(widget), OBJ_DATA_KEY_IMG_IDX );
   if(img_idx != 0)
   {
     img_idx = 1;
@@ -1061,7 +1061,7 @@ p_attw_preview_events_cb (GtkWidget *widget
   switch (event->type)
   {
     case GDK_BUTTON_PRESS:
-      bevent = (GdkEventButton *) event;
+      /* bevent = (GdkEventButton *) event; */
 
       // TODO: define actions when button pressed.
 
@@ -1079,13 +1079,13 @@ p_attw_preview_events_cb (GtkWidget *widget
     case GDK_EXPOSE:
       if(gap_debug)
       {
-        printf("p_attw_preview_events_cb GDK_EXPOSE widget:%d  img_idx:%d\n"
-                              , (int)widget
-                              , (int)img_idx
+        printf("p_attw_preview_events_cb GDK_EXPOSE widget:%ld  img_idx:%ld\n"
+                              , (long)widget
+                              , (long)img_idx
                               );
       }
 
-      eevent = (GdkEventExpose *) event;
+      /* eevent = (GdkEventExpose *) event; */
 
       gap_pview_repaint(attw->gfx_tab[img_idx].pv_ptr);
       gdk_flush ();
@@ -1116,7 +1116,7 @@ p_attw_preview_events_cb (GtkWidget *widget
  */
 static void
 p_calculate_prefetch_render_attributes(GapStbAttrWidget *attw
-    , gint img_idx
+    , glong img_idx
     , GapStoryCalcAttr  *calc_attr_ptr
     )
 {
@@ -1174,7 +1174,7 @@ p_calculate_prefetch_render_attributes(GapStbAttrWidget *attw
  */
 static void
 p_calculate_render_attributes(GapStbAttrWidget *attw
-    , gint img_idx
+    , glong img_idx
     , GapStoryCalcAttr  *calc_attr_ptr
     )
 {
@@ -1238,7 +1238,7 @@ p_calculate_render_attributes(GapStbAttrWidget *attw
  * if NOT create a faked opre layer at master size.
  */
 static void
-p_check_and_make_opre_default_layer(GapStbAttrWidget *attw, gint img_idx)
+p_check_and_make_opre_default_layer(GapStbAttrWidget *attw, glong img_idx)
 {
   if(attw->gfx_tab[img_idx].opre_layer_id < 0)
   {
@@ -1279,7 +1279,7 @@ p_check_and_make_opre_default_layer(GapStbAttrWidget *attw, gint img_idx)
  * if NOT create a faked orig layers at master size.
  */
 static void
-p_check_and_make_orig_default_layer(GapStbAttrWidget *attw, gint img_idx)
+p_check_and_make_orig_default_layer(GapStbAttrWidget *attw, glong img_idx)
 {
   if(attw->gfx_tab[img_idx].orig_layer_id < 0)
   {
@@ -1408,13 +1408,13 @@ p_create_base_layer(GapStbAttrWidget *attw, gint32 image_id)
   red   = 0.86;
   green = 0.85;
   blue  = 0.84;
-  alpha = 1.0;
+  alpha = 100.0;      /* full opaque */
 
   layer_id = p_create_color_layer(attw
     , image_id
     , LAYERNAME_BASE
     , LAYERSTACK_BASE
-    , 100.0            /* full opaque */
+    , alpha
     , red
     , green
     , blue
@@ -1436,13 +1436,13 @@ p_create_deco_layer(GapStbAttrWidget *attw, gint32 image_id)
   red   = 0.86;
   green = 0.85;
   blue  = 0.84;
-  alpha = 1.0;
+  alpha = 60.0;      /* 60% opaque */
 
   layer_id = p_create_color_layer(attw
     , image_id
     , LAYERNAME_DECO
     , LAYERSTACK_TOP
-    , 60.0            /* 70% opaque */
+    , alpha
     , red
     , green
     , blue
@@ -1456,7 +1456,7 @@ p_create_deco_layer(GapStbAttrWidget *attw, gint32 image_id)
  * -----------------------------------------
  */
 static void
-p_create_gfx_image(GapStbAttrWidget *attw, gint img_idx)
+p_create_gfx_image(GapStbAttrWidget *attw, glong img_idx)
 {
   gint32 image_id;
 
@@ -1549,7 +1549,7 @@ p_create_transformed_layer_movepath(gint32 image_id
   , GapStoryCalcAttr  *calculated
   , gint32 stackposition, const char *layername
   , GapStbAttrWidget *attw
-  , gint img_idx
+  , glong img_idx
   )
 {
   char    *movepath_file_xml;
@@ -1726,7 +1726,7 @@ p_create_transformed_layer(gint32 image_id
   , gint32 stackposition
   , const char *layername
   , GapStbAttrWidget *attw
-  , gint img_idx
+  , glong img_idx
   , gboolean enableMovepath
   )
 {
@@ -1821,7 +1821,7 @@ p_create_transformed_layer(gint32 image_id
  * -----------------------------------------
  */
 static gboolean
-p_calculate_prefetch_visibility(GapStbAttrWidget *attw, gint img_idx)
+p_calculate_prefetch_visibility(GapStbAttrWidget *attw, glong img_idx)
 {
   gboolean prefetch_visible;
 
@@ -1854,7 +1854,7 @@ p_calculate_prefetch_visibility(GapStbAttrWidget *attw, gint img_idx)
  * it creates empty default representations, where master size is assumed.
  */
 static void
-p_render_gfx(GapStbAttrWidget *attw, gint img_idx)
+p_render_gfx(GapStbAttrWidget *attw, glong img_idx)
 {
   GapStoryCalcAttr  calculate_curr_attributes;
   GapStoryCalcAttr  calculate_pref_attributes;
@@ -1925,7 +1925,7 @@ p_render_gfx(GapStbAttrWidget *attw, gint img_idx)
  * for the specified start or end gfx_preview (via img_idx)
  */
 static void
-p_update_framenr_labels(GapStbAttrWidget *attw, gint img_idx, gint32 framenr)
+p_update_framenr_labels(GapStbAttrWidget *attw, glong img_idx, gint32 framenr)
 {
   char    txt_buf[100];
   gdouble l_speed_fps;
@@ -1963,7 +1963,7 @@ p_update_framenr_labels(GapStbAttrWidget *attw, gint img_idx, gint32 framenr)
  * -----------------------------------------
  */
 static gint32
-p_get_relevant_duration(GapStbAttrWidget *attw, gint img_idx)
+p_get_relevant_duration(GapStbAttrWidget *attw, glong img_idx)
 {
   gint32 duration;
 
@@ -1999,7 +1999,7 @@ p_get_relevant_duration(GapStbAttrWidget *attw, gint img_idx)
 static void
 p_update_full_preview_gfx(GapStbAttrWidget *attw)
 {
-   gint img_idx;
+   glong img_idx;
 
    for(img_idx = 0; img_idx < GAP_STB_ATT_GFX_ARRAY_MAX; img_idx++)
    {
@@ -2349,7 +2349,7 @@ p_orig_layer_frame_fetcher(GapStbAttrWidget *attw
  */
 static gint32
 p_calc_and_set_display_framenr(GapStbAttrWidget *attw
-                         , gint   img_idx
+                         , long   img_idx
                          , gint32 duration)
 {
    gint32     l_framenr_start;
@@ -2409,7 +2409,7 @@ p_calc_and_set_display_framenr(GapStbAttrWidget *attw
  */
 static void
 p_create_or_replace_orig_and_opre_layer (GapStbAttrWidget *attw
-                         , gint   img_idx
+                         , long   img_idx
                          , gint32 duration)
 {
    gint32     l_framenr_start;
@@ -2916,7 +2916,7 @@ p_edit_movepath_closed_callback(gpointer ptr)
 
     if(attw->pvals != NULL)
     {
-      g_free(attw->pvals);
+      gap_mov_exec_free_GapMovValues(attw->pvals);
       attw->pvals = NULL;
     }
 
@@ -2997,11 +2997,11 @@ p_attw_movepath_edit_button_cb ( GtkWidget *w
 
   if(gap_debug)
   {
-      printf("p_attw_movepath_edit_button_cb frame_image_id:%d obj_image_id:%d obj_layer_id:%d attw:%d\n"
+      printf("p_attw_movepath_edit_button_cb frame_image_id:%d obj_image_id:%d obj_layer_id:%d attw:%ld\n"
         ,(int)attw->movepath_frame_image_id
         ,(int)attw->movepath_obj_image_id
         ,(int)attw->movepath_obj_layer_id
-        ,(int)attw
+        ,(long)attw
         );
   }
 
@@ -3123,7 +3123,7 @@ p_create_and_attach_pv_widgets(GapStbAttrWidget *attw
    , gint row
    , gint col_start
    , gint col_end
-   , gint img_idx
+   , glong img_idx
   )
 {
   GtkWidget *vbox2;
@@ -3259,7 +3259,7 @@ p_create_and_attach_att_arr_widgets(const char *row_title
    , GtkWidget *table
    , gint row
    , gint column
-   , gint att_type_idx
+   , glong att_type_idx
    , gdouble lower_constraint
    , gdouble upper_constraint
    , gdouble step_increment
@@ -3420,7 +3420,7 @@ p_create_and_attach_att_arr_widgets(const char *row_title
   /* the Duration value spinbutton */
   adj = gtk_adjustment_new ( *att_arr_value_dur_ptr
                            , 0
-                           , 999999
+                           , GAP_STB_ATT_MAX_DUR
                            , 1
                            , 10
                            , 0
@@ -3550,7 +3550,7 @@ gap_story_attw_properties_dialog (GapStbAttrWidget *attw)
                          ,GTK_STOCK_CLOSE,  GTK_RESPONSE_CLOSE
                          ,NULL);
   }
-  gtk_window_set_type_hint (dlg, GDK_WINDOW_TYPE_HINT_NORMAL);
+  gtk_window_set_type_hint (GTK_WINDOW(dlg), GDK_WINDOW_TYPE_HINT_NORMAL);
 
   attw->attw_prop_dialog = dlg;
 
@@ -3697,7 +3697,7 @@ gap_story_attw_properties_dialog (GapStbAttrWidget *attw)
   row++;
 
   {
-    gint att_type_idx;
+    glong att_type_idx;
     gint col = 0;
 
 
@@ -3877,7 +3877,7 @@ gap_story_attw_properties_dialog (GapStbAttrWidget *attw)
       , col
       , att_type_idx
       ,  1.0       /* lower constraint for the from/to values */
-      ,  10000.0   /* upper constraint for the from/to values */
+      ,  GAP_STB_ATT_MAX_MOVPATH_DBL   /* upper constraint for the from/to values */
       , 1.0        /* step increment   for the from/to values  */
       , 10.0       /* page increment   for the from/to values */
       , 0.0        /* page size        for the from/to values */
@@ -4136,3 +4136,4 @@ gap_story_att_fw_properties_dialog (GapStbFrameWidget *fw)
     gap_story_att_stb_elem_properties_dialog(tabw, fw->stb_elem_refptr, fw->stb_refptr);
   }
 }  /* end gap_story_att_fw_properties_dialog */
+
diff --git a/gap/gap_story_dialog.c b/gap/gap_story_dialog.c
index e923eaa..ca060e3 100644
--- a/gap/gap_story_dialog.c
+++ b/gap/gap_story_dialog.c
@@ -389,8 +389,8 @@ static gboolean p_tabw_scroll_event_cb ( GtkWidget *widget
 static void     story_dlg_response (GtkWidget *widget,
                     gint       response_id,
                     GapStbMainGlobalParams *sgpp);
-static void     story_dlg_destroy (GtkWidget *widget,
-                    GapStbMainGlobalParams *sgpp);
+// static void     story_dlg_destroy (GtkWidget *widget,
+//                     GapStbMainGlobalParams *sgpp);
 
 
 static void     p_recreate_tab_widgets(GapStoryBoard *stb
@@ -2697,7 +2697,10 @@ static void
 p_tabw_add_elem (GapStbTabWidgets *tabw, GapStbMainGlobalParams *sgpp, GapStoryBoard *stb_dst)
 {
   GapStoryElem *stb_elem;
-  if(gap_debug) printf("p_tabw_add_elem\n");
+  if(gap_debug)
+  {
+    printf("p_tabw_add_elem\n");
+  }
 
   if(sgpp == NULL)    { return; }
   if(tabw == NULL)    { return; }
@@ -3481,7 +3484,9 @@ gap_story_pw_single_clip_playback(GapStbPropWidget *pw)
 
     p_get_begin_and_end_for_single_clip_playback(&l_begin_frame, &l_end_frame, pw->stb_elem_refptr);
     imagename = gap_story_get_filename_from_elem(pw->stb_elem_refptr);
-    p_story_call_player(pw->sgpp
+    if (imagename != NULL)
+    {
+      p_story_call_player(pw->sgpp
                      ,NULL             /* No storyboard pointer */
                      ,imagename
                      ,imagewidth
@@ -3499,7 +3504,8 @@ gap_story_pw_single_clip_playback(GapStbPropWidget *pw)
                      ,tabw->vtrack             /* stb_in_track (not relevant here) */
                      ,FALSE                    /* stb_composite (not relevant here) */
                      );
-    g_free(imagename);
+      g_free(imagename);
+    }
   }
 }  /* end gap_story_pw_single_clip_playback */
 
@@ -5145,13 +5151,7 @@ p_menu_win_quit_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
 {
   if(gap_debug) printf("p_menu_win_quit_cb\n");
 
-  if(p_close_one_or_both_lists(sgpp
-                              , TRUE  /* check_cliplist */
-                              , TRUE  /* check_storyboard */
-                              ))
-  {
-    story_dlg_response(widget, GTK_RESPONSE_CANCEL, sgpp);
-  }
+  story_dlg_response(widget, GTK_RESPONSE_CANCEL, sgpp);
 
 }  /* end p_menu_win_quit_cb */
 
@@ -7413,14 +7413,23 @@ story_dlg_response (GtkWidget *widget,
 {
   GtkWidget *dialog;
 
+  if(gap_debug)
+  {
+    printf("story_dlg_response response_id:%d sgpp:%d\n"
+       , (int)response_id
+       , (int)sgpp
+       );
+  }
+
   switch (response_id)
   {
     case GTK_RESPONSE_OK:
       if(sgpp)
       {
         if (GTK_WIDGET_VISIBLE (sgpp->shell_window))
+        {
           gtk_widget_hide (sgpp->shell_window);
-
+        }
         sgpp->run = TRUE;
       }
 
@@ -7428,12 +7437,25 @@ story_dlg_response (GtkWidget *widget,
       dialog = NULL;
       if(sgpp)
       {
-        gap_story_vthumb_close_videofile(sgpp);
-        dialog = sgpp->shell_window;
-        if(dialog)
+        if(p_close_one_or_both_lists(sgpp
+                              , TRUE  /* check_cliplist */
+                              , TRUE  /* check_storyboard */
+                              ))
         {
-          sgpp->shell_window = NULL;
-          gtk_widget_destroy (dialog);
+          if(gap_debug) printf("story_dlg_response got CLOSE permisson\n");
+
+          gap_story_vthumb_close_videofile(sgpp);
+          dialog = sgpp->shell_window;
+          if(dialog)
+          {
+            sgpp->shell_window = NULL;
+            gtk_widget_destroy (dialog);
+          }
+        }
+        else
+        {
+          if(gap_debug) printf("story_dlg_response CLOSE permisson denied\n");
+          return;
         }
       }
       gtk_main_quit ();
@@ -7445,39 +7467,39 @@ story_dlg_response (GtkWidget *widget,
  * story_dlg_destroy
  * ---------------------------------
  */
-static void
-story_dlg_destroy (GtkWidget *widget,
-                 GapStbMainGlobalParams *sgpp_1)
-{
-  GtkWidget *dialog;
-  GapStbMainGlobalParams *sgpp;
-
-  dialog = NULL;
-
-  if(sgpp_1 != NULL)
-  {
-    sgpp = sgpp_1;
-  }
-  else
-  {
-    sgpp = (GapStbMainGlobalParams *)g_object_get_data(G_OBJECT(widget), "sgpp");
-  }
-
-
-  if(sgpp)
-  {
-    gap_story_vthumb_close_videofile(sgpp);
-    dialog = sgpp->shell_window;
-    if(dialog)
-    {
-      sgpp->shell_window = NULL;
-      gtk_widget_destroy (dialog);
-    }
-  }
-
-  gtk_main_quit ();
-
-}  /* end story_dlg_destroy */
+// static void
+// story_dlg_destroy (GtkWidget *widget,
+//                  GapStbMainGlobalParams *sgpp_1)
+// {
+//   GtkWidget *dialog;
+//   GapStbMainGlobalParams *sgpp;
+// 
+//   dialog = NULL;
+// 
+//   if(sgpp_1 != NULL)
+//   {
+//     sgpp = sgpp_1;
+//   }
+//   else
+//   {
+//     sgpp = (GapStbMainGlobalParams *)g_object_get_data(G_OBJECT(widget), "sgpp");
+//   }
+// 
+// 
+//   if(sgpp)
+//   {
+//     gap_story_vthumb_close_videofile(sgpp);
+//     dialog = sgpp->shell_window;
+//     if(dialog)
+//     {
+//       sgpp->shell_window = NULL;
+//       gtk_widget_destroy (dialog);
+//     }
+//   }
+// 
+//   gtk_main_quit ();
+// 
+// }  /* end story_dlg_destroy */
 
 
 
@@ -8770,42 +8792,42 @@ gap_storyboard_dialog(GapStbMainGlobalParams *sgpp, GapStbCreationParams  *scrp)
    *  Help via Menu-Item
    */
 // // NO longer use gimp_dialog_new because the window gets no minimize widget when created this way !
-// //
-//   dialog = gimp_dialog_new (_("Storyboard"), "storyboard",
-//                                NULL, 0,
-//                                gimp_standard_help_func, NULL, /* GAP_STORYBOARD_EDIT_HELP_ID */
-//                                NULL);
-//   g_signal_connect (G_OBJECT (dialog), "response",
-//                     G_CALLBACK (story_dlg_response),
-//                     sgpp);
-//   /* the vbox */
-//   vbox = gtk_vbox_new (FALSE, 0);
-//   // gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
-//   gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), vbox,
-//                       TRUE, TRUE, 0);
-//   gtk_widget_show (vbox);
-
- {
-   gimp_ui_init ("storyboard", TRUE);
-
-   dialog = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-   gtk_window_set_title (GTK_WINDOW (dialog), _("Storyboard"));
-   gtk_window_set_role (GTK_WINDOW (dialog), "storybord-editor");
-
-   g_object_set_data (G_OBJECT (dialog), "sgpp"
-                          , (gpointer)sgpp);
-
-   g_signal_connect (dialog, "destroy",
-                     G_CALLBACK (story_dlg_destroy),
-                     sgpp);
-
-   gimp_help_connect (dialog, gimp_standard_help_func, GAP_STORY_PLUG_IN_PROC, NULL);
-
-   /* the vbox */
-   vbox = gtk_vbox_new (FALSE, 0);
-   gtk_container_add (GTK_CONTAINER (dialog), vbox);
-   gtk_widget_show (vbox);
- }
+// // Note that gap_dialog_new creates the dialog as Normal toplevel window...
+  dialog = gap_dialog_new (_("Storyboard"), "storyboard",
+                               NULL, 0,
+                               gimp_standard_help_func, NULL, /* GAP_STORYBOARD_EDIT_HELP_ID */
+                               NULL);
+  g_signal_connect (G_OBJECT (dialog), "response",
+                    G_CALLBACK (story_dlg_response),
+                    sgpp);
+  /* the vbox */
+  vbox = gtk_vbox_new (FALSE, 0);
+  // gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
+  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), vbox,
+                      TRUE, TRUE, 0);
+  gtk_widget_show (vbox);
+
+//  {
+//    gimp_ui_init ("storyboard", TRUE);
+// 
+//    dialog = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+//    gtk_window_set_title (GTK_WINDOW (dialog), _("Storyboard"));
+//    gtk_window_set_role (GTK_WINDOW (dialog), "storybord-editor");
+// 
+//    g_object_set_data (G_OBJECT (dialog), "sgpp"
+//                           , (gpointer)sgpp);
+// 
+//    g_signal_connect (dialog, "destroy",
+//                      G_CALLBACK (story_dlg_destroy),
+//                      sgpp);
+// 
+//    gimp_help_connect (dialog, gimp_standard_help_func, GAP_STORY_PLUG_IN_PROC, NULL);
+// 
+//    /* the vbox */
+//    vbox = gtk_vbox_new (FALSE, 0);
+//    gtk_container_add (GTK_CONTAINER (dialog), vbox);
+//    gtk_widget_show (vbox);
+//  }
 
 
   sgpp->shell_window = dialog;
@@ -9591,7 +9613,34 @@ p_tabw_master_prop_dialog(GapStbTabWidgets *tabw, gboolean new_flag)
   {
      GapStoryBoard *stb_dup;
 
-     gap_stb_undo_push(tabw, GAP_STB_FEATURE_PROPERTIES_MASTER);
+
+     if(new_flag)
+     {
+       if(tabw == sgpp->stb_widgets)
+       {
+         /* replace the internal copy of the name in the GapStoryBoard struct */
+         if(sgpp->stb->storyboardfile)
+         {
+           g_free(sgpp->stb->storyboardfile);
+         }
+         sgpp->stb->storyboardfile = g_strdup(sgpp->storyboard_filename);
+       }
+       else
+       {
+         /* replace the internal copy of the name in the GapStoryBoard struct */
+         if(sgpp->cll->storyboardfile)
+         {
+           g_free(sgpp->cll->storyboardfile);
+         }
+         sgpp->cll->storyboardfile = g_strdup(sgpp->cliplist_filename);
+
+       }
+     }
+     else
+     {
+       gap_stb_undo_push(tabw, GAP_STB_FEATURE_PROPERTIES_MASTER);
+     }
+
 
      stb_dup = gap_story_duplicate_active_and_mask_section(stb_dst);
 
diff --git a/gap/gap_story_file.c b/gap/gap_story_file.c
index 3dd2fbc..8b91f62 100644
--- a/gap/gap_story_file.c
+++ b/gap/gap_story_file.c
@@ -161,7 +161,7 @@ gap_story_debug_fprint_elem(FILE *fp, GapStoryElem *stb_elem)
   }
   else
   {
-    fprintf(fp, "\n  gap_story_debug_print_elem:  stb_elem: %d\n", (int)stb_elem);
+    fprintf(fp, "\n  gap_story_debug_print_elem:  stb_elem: %ld\n", (long)stb_elem);
 
     fprintf(fp, "  gap_story_debug_print_elem: START\n");
     fprintf(fp, "  record_type: %d  %s\n", (int)stb_elem->record_type
@@ -301,8 +301,8 @@ gap_story_debug_fprint_elem(FILE *fp, GapStoryElem *stb_elem)
     fprintf(fp, "  mask_stepsize: %f\n", (float)stb_elem->mask_stepsize);
     fprintf(fp, "  mask_disable:  %d\n", (int)stb_elem->mask_disable);
 
-    fprintf(fp, "  comment ptr:%d\n", (int)stb_elem->comment);
-    fprintf(fp, "  next    ptr:%d\n", (int)stb_elem->next);
+    fprintf(fp, "  comment ptr:%ld\n", (long)stb_elem->comment);
+    fprintf(fp, "  next    ptr:%ld\n", (long)stb_elem->next);
   }
   fflush(fp);
 }  /* end gap_story_debug_fprint_elem */
@@ -322,7 +322,7 @@ gap_story_debug_fprint_list(FILE *fp, GapStoryBoard *stb)
   GapStoryElem *stb_elem;
   gint ii;
 
-  fprintf(fp, "\n\ngap_story_debug_print_list:  START stb: %d\n", (int)stb);
+  fprintf(fp, "\n\ngap_story_debug_print_list:  START stb: %ld\n", (long)stb);
 
   if(stb == NULL)
   {
@@ -387,7 +387,7 @@ gap_story_debug_fprint_list(FILE *fp, GapStoryBoard *stb)
 
   }
 
-  fprintf(fp, "\ngap_story_debug_print_list:  END stb: %d\n", (int)stb);
+  fprintf(fp, "\ngap_story_debug_print_list:  END stb: %ld\n", (long)stb);
   fflush(fp);
 }  /* end gap_story_debug_fprint_list */
 
@@ -797,7 +797,7 @@ gap_story_new_elem(GapStoryRecordType record_type)
     stb_elem->next = NULL;
   }
 
-  if(gap_debug) printf("gap_story_new_elem: RETURN stb_elem ptr: %d\n", (int)stb_elem );
+  if(gap_debug) printf("gap_story_new_elem: RETURN stb_elem ptr: %ld\n", (long)stb_elem );
   return(stb_elem);
 }  /* end gap_story_new_elem */
 
@@ -2346,7 +2346,14 @@ gap_story_lists_merge(GapStoryBoard *stb_dst
     }
     else
     {
-      if (strcmp(stb_dst->storyboardfile, stb_src->storyboardfile) != 0)
+      if (gap_debug)
+      {
+        printf("gap_story_lists_merge dst:%s src:%s\n"
+           ,(stb_dst->storyboardfile != NULL) ? stb_dst->storyboardfile : "<null>"
+           ,(stb_src->storyboardfile != NULL) ? stb_src->storyboardfile : "<null>"
+           );
+      }
+      if (p_null_strcmp(stb_dst->storyboardfile, stb_src->storyboardfile) != TRUE)
       {
         /* convert VID_PLAY_SECTION to VID_PLAY_BLACKSECTION
          * because we copy from another storyboard into a main section.
@@ -3378,10 +3385,10 @@ p_story_parse_line(GapStoryBoard *stb, char *longline
         stb_elem->file_line_nr = longlinenr;
         stb_elem->orig_src_line = g_strdup(multi_lines);
         stb_elem->track = l_track_nr;
-        if(*l_from_ptr)     { stb_elem->att_arr_value_from[ii]  = p_scan_gdouble(l_from_ptr, 1.0, 10000.0, 
stb); }
-        if(*l_to_ptr)       { stb_elem->att_arr_value_to[ii]    = p_scan_gdouble(l_to_ptr,   0.0, 10000.0, 
stb); }
+        if(*l_from_ptr)     { stb_elem->att_arr_value_from[ii]  = p_scan_gdouble(l_from_ptr, 1.0, 
GAP_STB_ATT_MAX_MOVPATH_DBL, stb); }
+        if(*l_to_ptr)       { stb_elem->att_arr_value_to[ii]    = p_scan_gdouble(l_to_ptr,   0.0, 
GAP_STB_ATT_MAX_MOVPATH_DBL, stb); }
         else                { stb_elem->att_arr_value_to[ii]    = stb_elem->att_arr_value_from[ii]; }
-        if(*l_dur_ptr)      { stb_elem->att_arr_value_dur[ii]   = p_scan_gint32(l_dur_ptr,  0, 10000, stb); }
+        if(*l_dur_ptr)      { stb_elem->att_arr_value_dur[ii]   = p_scan_gint32(l_dur_ptr,  0, 
GAP_STB_ATT_MAX_DUR, stb); }
         if(*l_xml_ptr)      { stb_elem->att_movepath_file_xml   = g_strdup(l_xml_ptr); }
         else                { stb_elem->att_arr_enable[ii] = FALSE; }
 
@@ -3438,7 +3445,7 @@ p_story_parse_line(GapStoryBoard *stb, char *longline
         if(*l_from_ptr)     { stb_elem->att_arr_value_from[ii]  = p_scan_gdouble(l_from_ptr, 0.0, 1.0, stb); 
}
         if(*l_to_ptr)       { stb_elem->att_arr_value_to[ii]    = p_scan_gdouble(l_to_ptr,   0.0, 1.0, stb); 
}
         else                { stb_elem->att_arr_value_to[ii]    = stb_elem->att_arr_value_from[ii]; }
-        if(*l_dur_ptr)      { stb_elem->att_arr_value_dur[ii]   = p_scan_gint32(l_dur_ptr,  0, 999, stb); }
+        if(*l_dur_ptr)      { stb_elem->att_arr_value_dur[ii]   = p_scan_gint32(l_dur_ptr,  0, 
GAP_STB_ATT_MAX_DUR, stb); }
 
         p_assign_accel_attr(stb_elem, stb, l_accel_ptr, ii);
 
@@ -3466,7 +3473,7 @@ p_story_parse_line(GapStoryBoard *stb, char *longline
         if(*l_from_ptr)     { stb_elem->att_arr_value_from[ii]  = p_scan_gdouble(l_from_ptr, -36000.0, 
36000.0, stb); }
         if(*l_to_ptr)       { stb_elem->att_arr_value_to[ii]    = p_scan_gdouble(l_to_ptr,   -36000.0, 
36000.0, stb); }
         else                { stb_elem->att_arr_value_to[ii]    = stb_elem->att_arr_value_from[ii]; }
-        if(*l_dur_ptr)      { stb_elem->att_arr_value_dur[ii]   = p_scan_gint32(l_dur_ptr,  0, 999, stb); }
+        if(*l_dur_ptr)      { stb_elem->att_arr_value_dur[ii]   = p_scan_gint32(l_dur_ptr,  0, 
GAP_STB_ATT_MAX_DUR, stb); }
 
         p_assign_accel_attr(stb_elem, stb, l_accel_ptr, ii);
 
@@ -3494,7 +3501,7 @@ p_story_parse_line(GapStoryBoard *stb, char *longline
         if(*l_from_ptr)     { stb_elem->att_arr_value_from[ii]  = p_scan_gdouble(l_from_ptr, 0.0001, 999.9, 
stb); }
         if(*l_to_ptr)       { stb_elem->att_arr_value_to[ii]    = p_scan_gdouble(l_to_ptr,   0.0001, 999.9, 
stb); }
         else                { stb_elem->att_arr_value_to[ii]    = stb_elem->att_arr_value_from[ii]; }
-        if(*l_dur_ptr)      { stb_elem->att_arr_value_dur[ii]   = p_scan_gint32(l_dur_ptr,  0, 999, stb); }
+        if(*l_dur_ptr)      { stb_elem->att_arr_value_dur[ii]   = p_scan_gint32(l_dur_ptr,  0, 
GAP_STB_ATT_MAX_DUR, stb); }
 
         p_assign_accel_attr(stb_elem, stb, l_accel_ptr, ii);
 
@@ -3522,7 +3529,7 @@ p_story_parse_line(GapStoryBoard *stb, char *longline
         if(*l_from_ptr)     { stb_elem->att_arr_value_from[ii]  = p_scan_gdouble(l_from_ptr, 0.0001, 999.9, 
stb); }
         if(*l_to_ptr)       { stb_elem->att_arr_value_to[ii]    = p_scan_gdouble(l_to_ptr,   0.0001, 999.9, 
stb); }
         else                { stb_elem->att_arr_value_to[ii]    = stb_elem->att_arr_value_from[ii]; }
-        if(*l_dur_ptr)      { stb_elem->att_arr_value_dur[ii]   = p_scan_gint32(l_dur_ptr,  0, 999, stb); }
+        if(*l_dur_ptr)      { stb_elem->att_arr_value_dur[ii]   = p_scan_gint32(l_dur_ptr,  0, 
GAP_STB_ATT_MAX_DUR, stb); }
 
         p_assign_accel_attr(stb_elem, stb, l_accel_ptr, ii);
 
@@ -3550,7 +3557,7 @@ p_story_parse_line(GapStoryBoard *stb, char *longline
         if(*l_from_ptr)     { stb_elem->att_arr_value_from[ii]  = p_scan_gdouble(l_from_ptr, -99999.9, 
99999.9, stb); }
         if(*l_to_ptr)       { stb_elem->att_arr_value_to[ii]    = p_scan_gdouble(l_to_ptr,   -99999.9, 
99999.9, stb); }
         else                { stb_elem->att_arr_value_to[ii]    = stb_elem->att_arr_value_from[ii]; }
-        if(*l_dur_ptr)      { stb_elem->att_arr_value_dur[ii]   = p_scan_gint32(l_dur_ptr,  0, 999, stb); }
+        if(*l_dur_ptr)      { stb_elem->att_arr_value_dur[ii]   = p_scan_gint32(l_dur_ptr,  0, 
GAP_STB_ATT_MAX_DUR, stb); }
 
         p_assign_accel_attr(stb_elem, stb, l_accel_ptr, ii);
 
@@ -3578,7 +3585,7 @@ p_story_parse_line(GapStoryBoard *stb, char *longline
         if(*l_from_ptr)     { stb_elem->att_arr_value_from[ii]  = p_scan_gdouble(l_from_ptr, -99999.9, 
99999.9, stb); }
         if(*l_to_ptr)       { stb_elem->att_arr_value_to[ii]    = p_scan_gdouble(l_to_ptr,   -99999.9, 
99999.9, stb); }
         else                { stb_elem->att_arr_value_to[ii]    = stb_elem->att_arr_value_from[ii]; }
-        if(*l_dur_ptr)      { stb_elem->att_arr_value_dur[ii]   = p_scan_gint32(l_dur_ptr,  0, 999, stb); }
+        if(*l_dur_ptr)      { stb_elem->att_arr_value_dur[ii]   = p_scan_gint32(l_dur_ptr,  0, 
GAP_STB_ATT_MAX_DUR, stb); }
 
         p_assign_accel_attr(stb_elem, stb, l_accel_ptr, ii);
 
@@ -4700,7 +4707,7 @@ gap_story_parse(const gchar *filename)
       {
         if(gap_debug)
         {
-          printf("\nCALCULATE NFRAMES for stb_elem: %d\n", (int)stb_elem);
+          printf("\nCALCULATE NFRAMES for stb_elem: %ld\n", (long)stb_elem);
           gap_story_debug_print_elem(stb_elem);
         }
 
@@ -4720,7 +4727,7 @@ gap_story_parse(const gchar *filename)
    */
   stb->active_section = gap_story_find_main_section(stb);
 
-  if(gap_debug) printf("gap_story_parse: RET ptr:%d\n", (int)stb);
+  if(gap_debug) printf("gap_story_parse: RET ptr:%ld\n", (long)stb);
 
   stb->unsaved_changes = FALSE;
   return(stb);
@@ -5981,7 +5988,7 @@ p_story_save_video_list(GapStoryBoard *stb, FILE *fp, gint32 save_track
          */
       case GAP_STBREC_VID_SECTION:
         {
-          gint   l_delace_int;
+          /* gint   l_delace_int; */
           const char *l_gap_stb_key_vid_play_section;
           if (stb_elem->record_type == GAP_STBREC_VID_SECTION)
           {
@@ -5997,7 +6004,7 @@ p_story_save_video_list(GapStoryBoard *stb, FILE *fp, gint32 save_track
                                   ,&l_parnam_tab
                                   );
           p_story_save_comments(fp, stb_elem);
-          l_delace_int = (int)stb_elem->delace;
+          /* l_delace_int = (int)stb_elem->delace; */
           fprintf(fp, "%s    %s:%d %s:\"%s\" %s:%06d %s:%06d %s:%s %s:%d "
                       "%s:%s"
                , l_gap_stb_key_vid_play_section
@@ -6170,17 +6177,23 @@ p_story_get_filename_from_elem (GapStoryElem *stb_elem, gint32 in_framenr)
     {
       case GAP_STBREC_VID_MOVIE:
       case GAP_STBREC_VID_IMAGE:
-        filename = g_strdup(stb_elem->orig_filename);
+        if(stb_elem->orig_filename != NULL)
+        {
+          filename = g_strdup(stb_elem->orig_filename);
+        }
         break;
       case GAP_STBREC_VID_FRAMES:
-        if(in_framenr < 0)
+        if(stb_elem->basename != NULL)
         {
-          in_framenr = stb_elem->from_frame;
-        }
-        filename = gap_lib_alloc_fname(stb_elem->basename
+          if(in_framenr < 0)
+          {
+            in_framenr = stb_elem->from_frame;
+          }
+          filename = gap_lib_alloc_fname(stb_elem->basename
                                       , in_framenr
                                       , stb_elem->ext
                                       );
+        }
 
         break;
       default:
@@ -9108,10 +9121,10 @@ gap_story_file_calculate_render_attributes(GapStoryCalcAttr *result_attr
 
   if(keep_proportions)
   {
-    gdouble l_vid_prop;
+    /* gdouble l_vid_prop; */
     gdouble l_frame_prop;
 
-    l_vid_prop = (gdouble)vid_width / (gdouble)vid_height;
+    /* l_vid_prop = (gdouble)vid_width / (gdouble)vid_height; */
     l_frame_prop = (gdouble)frame_width / (gdouble)frame_height;
 
 
diff --git a/gap/gap_story_file.h b/gap/gap_story_file.h
index 403a841..4d2b15b 100644
--- a/gap/gap_story_file.h
+++ b/gap/gap_story_file.h
@@ -61,6 +61,10 @@
 #define GAP_GIMPRC_VIDEO_STORYBOARD_RESOURCE_LOG_INTERVAL      "video-storyboard-resource-log-interval"
 #define GAP_GIMPRC_VIDEO_ENCODER_FFMPEG_MULTIPROCESSOR_ENABLE  "video-enoder-ffmpeg-multiprocessor-enable"
 
+#define GAP_STB_ATT_MAX_DUR            999999
+#define GAP_STB_ATT_MAX_MOVPATH_DBL    999999.0
+
+
 /* GapStoryRecordType enum values are superset of GapLibAinfoType
  * from the sourcefile gap_lib.h
  */
diff --git a/gap/gap_story_main.h b/gap/gap_story_main.h
index 2cb6bb0..81918bc 100644
--- a/gap/gap_story_main.h
+++ b/gap/gap_story_main.h
@@ -65,6 +65,7 @@ typedef gpointer t_GVA_Handle;
 /* max flip request and delace modes (for dimensions of radio button tables) */
 #define GAP_MAX_FLIP_REQUEST  4
 #define GAP_MAX_DELACE_MODES  5
+#define GAP_STB_MAX_MASK_ANCHOR_MODES 3
 
 typedef enum
   {
@@ -205,7 +206,7 @@ typedef struct GapStbPropWidget  /* nickname: pw */
   GtkWidget  *mask_anchor_label;
   GtkWidget  *pingpong_label;
   GtkWidget  *pw_mask_enable_toggle;
-  GtkWidget  *pw_mask_anchor_radio_button_arr[3];
+  GtkWidget  *pw_mask_anchor_radio_button_arr[GAP_STB_MAX_MASK_ANCHOR_MODES];
   GtkObject  *pw_spinbutton_mask_stepsize_adj;
 
   /* for filermacro handling */
diff --git a/gap/gap_story_properties.c b/gap/gap_story_properties.c
index 3e68bc0..5347329 100644
--- a/gap/gap_story_properties.c
+++ b/gap/gap_story_properties.c
@@ -59,6 +59,7 @@
 #include "gap_story_vthumb.h"
 #include "gap_accel_char.h"
 #include "gap_accel_da.h"
+#include "gap_arr_dialog.h"
 
 
 #include "gap-intl.h"
@@ -67,9 +68,9 @@
 #define GAP_STORY_CLIP_PROP_HELP_ID  "plug-in-gap-storyboard-clip-prop"
 #define GAP_STORY_MASK_PROP_HELP_ID  "plug-in-gap-storyboard-mask-prop"
 
-#define GAP_STORY_RESPONSE_RESET 1
-#define GAP_STORY_RESPONSE_SCENE_SPLIT 2
-#define GAP_STORY_RESPONSE_SCENE_END   3
+#define GAP_STORY_RESPONSE_RESET ((gint)1)
+#define GAP_STORY_RESPONSE_SCENE_SPLIT ((gint)2)
+#define GAP_STORY_RESPONSE_SCENE_END   ((gint)3)
 #define PW_ENTRY_WIDTH        300
 #define PW_COMMENT_WIDTH      480
 #define PW_SCALE_WIDTH        300
@@ -1632,7 +1633,10 @@ p_pw_check_ainfo_range(GapStbPropWidget *pw, char *filename)
   gdouble l_upper;
   gdouble l_val;
 
-  if(gap_debug) printf("PROP AINFO CHECK\n");
+  if(gap_debug)
+  {
+    printf("PROP AINFO CHECK  START\n");
+  }
 
   /* default: allow maximum range
    * (for movies we dont know the exactnumber of frames
@@ -1726,6 +1730,10 @@ p_pw_check_ainfo_range(GapStbPropWidget *pw, char *filename)
     gtk_adjustment_set_value(GTK_ADJUSTMENT(pw->pw_spinbutton_to_adj)
                             , CLAMP(l_val, l_lower, l_upper));
   }
+  if(gap_debug)
+  {
+    printf("PROP AINFO CHECK DONE\n");
+  }
 
 }  /* end p_pw_check_ainfo_range */
 
@@ -3927,6 +3935,11 @@ gap_story_pw_properties_dialog (GapStbPropWidget *pw)
   GapStbTabWidgets *tabw;
   gdouble           l_lower_limit;
 
+  if(gap_debug)
+  {
+    printf("gap_story_pw_properties_dialog START\n");
+  }
+
 
   if(pw == NULL) { return (NULL); }
   if(pw->pw_prop_dialog != NULL) { return(NULL); }   /* is already open */
@@ -3934,6 +3947,10 @@ gap_story_pw_properties_dialog (GapStbPropWidget *pw)
   tabw = (GapStbTabWidgets *)pw->tabw;
   if(tabw == NULL) { return (NULL); }
 
+  if(gap_debug)
+  {
+    printf("gap_story_pw_properties_dialog before p_pw_clear_widgets\n");
+  }
   p_pw_clear_widgets(pw);
 
 
@@ -3946,11 +3963,17 @@ gap_story_pw_properties_dialog (GapStbPropWidget *pw)
     }
   }
 
+  if(gap_debug)
+  {
+    printf("gap_story_pw_properties_dialog before dialog_new\n");
+  }
+
+
   if(pw->is_mask_definition)
   {
     if(pw->stb_elem_bck)
     {
-      dlg = gimp_dialog_new (_("Mask Properties"), "gap_story_clip_properties"
+      dlg = gap_dialog_new (_("Mask Properties"), "gap_story_clip_properties"
                          ,NULL, 0
                          ,gimp_standard_help_func, GAP_STORY_MASK_PROP_HELP_ID
 
@@ -3960,7 +3983,7 @@ gap_story_pw_properties_dialog (GapStbPropWidget *pw)
     }
     else
     {
-      dlg = gimp_dialog_new (_("Mask Properties"), "gap_story_clip_properties"
+      dlg = gap_dialog_new (_("Mask Properties"), "gap_story_clip_properties"
                          ,NULL, 0
                          ,gimp_standard_help_func, GAP_STORY_MASK_PROP_HELP_ID
 
@@ -3972,7 +3995,7 @@ gap_story_pw_properties_dialog (GapStbPropWidget *pw)
   {
     if(pw->stb_elem_bck)
     {
-      dlg = gimp_dialog_new (_("Clip Properties"), "gap_story_clip_properties"
+      dlg = gap_dialog_new (_("Clip Properties"), "gap_story_clip_properties"
                          ,NULL, 0
                          ,gimp_standard_help_func, GAP_STORY_CLIP_PROP_HELP_ID
 
@@ -3984,7 +4007,7 @@ gap_story_pw_properties_dialog (GapStbPropWidget *pw)
     }
     else
     {
-      dlg = gimp_dialog_new (_("Clip Properties"), "gap_story_clip_properties"
+      dlg = gap_dialog_new (_("Clip Properties"), "gap_story_clip_properties"
                          ,NULL, 0
                          ,gimp_standard_help_func, GAP_STORY_CLIP_PROP_HELP_ID
 
@@ -3992,11 +4015,16 @@ gap_story_pw_properties_dialog (GapStbPropWidget *pw)
                          ,_("Auto Scene Split"), GAP_STORY_RESPONSE_SCENE_SPLIT
                          ,GTK_STOCK_CLOSE,  GTK_RESPONSE_CLOSE
                          ,NULL);
-    }
+   }
   }
 
   pw->pw_prop_dialog = dlg;
 
+  if(gap_debug)
+  {
+    printf("gap_story_pw_properties_dialog before g_signal_connect dlg:%d\n", (int)dlg);
+  }
+
   g_signal_connect (G_OBJECT (dlg), "response",
                     G_CALLBACK (p_pw_prop_response),
                     pw);
@@ -5056,13 +5084,26 @@ gap_story_pw_properties_dialog (GapStbPropWidget *pw)
 
   if(!pw->is_mask_definition)
   {
+    if(gap_debug)
+    {
+      printf("gap_story_pw_properties_dialog before p_pw_set_strings_for_mask_name_combo\n");
+    }
     p_pw_set_strings_for_mask_name_combo(pw);
   }
 
 
   /*  Show the main containers  */
+  if(gap_debug)
+  {
+    printf("gap_story_pw_properties_dialog before gtk_widget_show(main_vbox)\n");
+  }
+
+  gtk_widget_show(main_vbox);
 
-  gtk_widget_show (main_vbox);
+  if(gap_debug)
+  {
+    printf("gap_story_pw_properties_dialog DONE return dlg:%d\n", (int)dlg);
+  }
 
   return(dlg);
 }  /* end gap_story_pw_properties_dialog */
@@ -5079,6 +5120,11 @@ gap_story_stb_elem_properties_dialog ( GapStbTabWidgets *tabw
   GapStbPropWidget *pw;
   gint idx;
 
+  if(gap_debug)
+  {
+    printf("gap_story_stb_elem_properties_dialog START\n");
+  }
+
   /* check if already open */
   for(pw=tabw->pw; pw!=NULL; pw=(GapStbPropWidget *)pw->next)
   {
@@ -5093,6 +5139,10 @@ gap_story_stb_elem_properties_dialog ( GapStbTabWidgets *tabw
     {
       if(pw->stb_elem_refptr->story_id == stb_elem->story_id)
       {
+        if(gap_debug)
+        {
+          printf("gap_story_stb_elem_properties_dialog calling gtk_window_present (window to front)\n");
+        }
         /* Properties for the selected element already open
          * bring the window to front
          */
@@ -5104,13 +5154,21 @@ gap_story_stb_elem_properties_dialog ( GapStbTabWidgets *tabw
 
   if(pw == NULL)
   {
-    pw = g_new(GapStbPropWidget ,1);
+    if(gap_debug)
+    {
+      printf("gap_story_stb_elem_properties_dialog pw is NULL calling g_new0(GapStbPropWidget ,1)\n");
+    }
+    pw = g_new0(GapStbPropWidget ,1);
     pw->stb_elem_bck = NULL;
     pw->next = tabw->pw;
     tabw->pw = pw;
   }
   if(pw->stb_elem_bck)
   {
+    if(gap_debug)
+    {
+      printf("gap_story_stb_elem_properties_dialog pw->stb_elem_bck is NOT NULL, calling 
gap_story_elem_free\n");
+    }
     gap_story_elem_free(&pw->stb_elem_bck);
   }
   pw->stb_elem_bck = NULL;
@@ -5141,7 +5199,7 @@ gap_story_stb_elem_properties_dialog ( GapStbTabWidgets *tabw
   {
     pw->pw_flip_request_radio_button_arr[idx] = NULL;
   }
-  for(idx=0; idx < sizeof(pw->pw_mask_anchor_radio_button_arr); idx++)
+  for(idx=0; idx < GAP_STB_MAX_MASK_ANCHOR_MODES; idx++)
   {
     pw->pw_mask_anchor_radio_button_arr[idx] = NULL;
   }
@@ -5164,6 +5222,12 @@ gap_story_stb_elem_properties_dialog ( GapStbTabWidgets *tabw
 
 
   pw->pw_prop_dialog = gap_story_pw_properties_dialog(pw);
+  if(gap_debug)
+  {
+    printf("gap_story_stb_elem_properties_dialog pw->pw_prop_dialog:%d\n"
+          ,(int)pw->pw_prop_dialog
+          );
+  }
   if(pw->pw_prop_dialog)
   {
     gtk_widget_show(pw->pw_prop_dialog);
@@ -5171,6 +5235,10 @@ gap_story_stb_elem_properties_dialog ( GapStbTabWidgets *tabw
     p_pv_pview_render(pw);
     p_pw_dialog_init_dnd(pw);
   }
+  if(gap_debug)
+  {
+    printf("gap_story_stb_elem_properties_dialog DONE\n");
+  }
 }  /* end gap_story_stb_elem_properties_dialog */
 
 /* -------------------------------
diff --git a/gap/gap_story_undo_types.h b/gap/gap_story_undo_types.h
index 1bb0baa..d23960f 100644
--- a/gap/gap_story_undo_types.h
+++ b/gap/gap_story_undo_types.h
@@ -27,6 +27,12 @@
 #ifndef _GAP_STORY_UNDO_TYPES_H
 #define _GAP_STORY_UNDO_TYPES_H
 
+#include <time.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+
 #include "libgimp/gimp.h"
 #include "gap_story_file.h"
 #include <gtk/gtk.h>
@@ -60,7 +66,7 @@ typedef struct GapStoryUndoFileSnapshot {
   char       *filename;
   char       *filecontent;
   gint32      filesize;
-  gint32      mtimefile;
+  time_t      mtimefile;
 }  GapStoryUndoFileSnapshot;
 
 
diff --git a/gap/gimplastvaldesc.c b/gap/gimplastvaldesc.c
index fedce7d..6bd8e18 100644
--- a/gap/gimplastvaldesc.c
+++ b/gap/gimplastvaldesc.c
@@ -256,8 +256,8 @@ gimp_lastval_desc_update(void)
   gchar   *next_line_ptr;
   gint32 l_idx;
   gint32 l_filesize;
-  long   l_timestamp;
-  struct stat stat_buf;
+  time_t   l_timestamp;
+  GStatBuf stat_buf;
   
   arg_cnt = 0;
 
@@ -511,7 +511,7 @@ p_load_lastval_desc_file(const gchar *fname)
 {
   FILE  *fp;
   gint32 file_size;
-  struct stat stat_buf;
+  GStatBuf stat_buf;
   gchar *file_buff;
 
   file_size = 0;
@@ -547,10 +547,10 @@ p_fwrite_lastvals_desc(FILE *fp, const gchar *keyname, GimpLastvalDescType *last
     gint   l_indent;
     gint   l_col;
     struct      tm *l_t;
-    long        l_ti;
+    time_t      l_ti;
 
     l_indent = 0;
-    l_ti = time(0L);          /* Get UNIX time */
+    l_ti = time(NULL);          /* Get UNIX time */
     l_t  = localtime(&l_ti);  /* konvert time to tm struct */
     
     fprintf(fp, "\"%s\" ", keyname);
@@ -627,7 +627,10 @@ p_fwrite_lines_until_keyname(FILE *fp, const char *keyname, gchar *ptr)
         }
         
       }
-      fwrite(ptr, l_idx, 1, fp);
+      if (l_idx > 0)
+      {
+        fwrite(ptr, l_idx, 1, fp);
+      }
    }
    return l_idx;
 }       /* end p_fwrite_lines_until_keyname */
@@ -704,7 +707,7 @@ p_lastvals_register_persistent(const gchar *keyname, GimpLastvalDescType *lastva
   ptr = file_buff;
 
   /* rewrite file (replacing or adding  the structure description block for keyname) */
-  fp = g_fopen(fname, "w");
+  fp = g_fopen(fname, "wb");
   if(fp)
   {
     /* write all lines until 1.st description line matching keyname */
diff --git a/libgapbase/gap_base.c b/libgapbase/gap_base.c
index 47860ed..4557878 100644
--- a/libgapbase/gap_base.c
+++ b/libgapbase/gap_base.c
@@ -583,10 +583,10 @@ gap_base_is_pid_alive(gint32 pid)
  * --------------------------------
  * get curent system time in utc timecode
  */
-gint32
+time_t
 gap_base_get_current_time(void)
 {
-  return ((gint32)time(0));
+  return (time(NULL));
 }
 
 
diff --git a/libgapbase/gap_base.h b/libgapbase/gap_base.h
index d57680e..2d93a3f 100644
--- a/libgapbase/gap_base.h
+++ b/libgapbase/gap_base.h
@@ -31,6 +31,10 @@
 #ifndef _GAP_BASE_H
 #define _GAP_BASE_H
 
+#include <time.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 #include "libgimp/gimp.h"
 #include "gap_timm.h"
 
@@ -199,7 +203,7 @@ gap_base_is_pid_alive(gint32 pid);
  * --------------------------------
  * get curent system time in utc timecode
  */
-gint32
+time_t
 gap_base_get_current_time(void);
 
 
diff --git a/libgapbase/gap_file_util.c b/libgapbase/gap_file_util.c
index c8735af..40fb978 100644
--- a/libgapbase/gap_file_util.c
+++ b/libgapbase/gap_file_util.c
@@ -60,7 +60,7 @@ extern      int gap_debug; /* ==0  ... dont print debug infos */
 gint32
 gap_file_get_filesize(const char *fname)
 {
-  struct stat  stat_buf;
+  GStatBuf  stat_buf;
 
   if (0 != g_stat(fname, &stat_buf))
   {
@@ -326,10 +326,10 @@ gap_file_build_absolute_filename(const char * filename)
  * gap_file_get_mtime
  * --------------------------------
  */
-gint32
+time_t
 gap_file_get_mtime(const char *filename)
 {
-  struct stat  l_stat;
+  GStatBuf  l_stat;
 
   if(filename != NULL)
   {
@@ -341,3 +341,54 @@ gap_file_get_mtime(const char *filename)
   return(0);
   
 }  /* end gap_file_get_mtime */
+
+
+/* --------------------------------
+ * gap_file_printf
+ * --------------------------------
+ * printf to an optional logfile (specified via environment variable GAP_DEBUG_LOGFILE)
+ * or to stdout as default (when GAP_DEBUG_LOGFILE not set)
+ */
+void
+gap_file_printf(const char *fmt,
+                  ...)
+{
+  static const char *gapDebugLogFileName = NULL; //"gap_logfile.txt";
+  FILE *fp;
+
+  fp = NULL;
+  if(gapDebugLogFileName == NULL)
+  {
+    gapDebugLogFileName = g_getenv("GAP_DEBUG_LOGFILE");
+  }
+  
+  if(gapDebugLogFileName != NULL)
+  {
+    if(g_file_test(gapDebugLogFileName, G_FILE_TEST_EXISTS))
+    {
+      fp = g_fopen(gapDebugLogFileName, "ab");
+    }
+    else
+    {
+      fp = g_fopen(gapDebugLogFileName, "wb");
+    }
+  }
+
+  if(fp != NULL)
+  {
+    va_list argp;
+    va_start(argp, fmt);
+    vfprintf(fp, fmt, argp);
+    va_end(argp);
+    fclose(fp);
+  
+  }
+  else
+  {
+    va_list argp;
+    va_start(argp, fmt);
+    vprintf(fmt, argp);
+    va_end(argp);
+  }
+
+}  /* end gap_file_printf */
diff --git a/libgapbase/gap_file_util.h b/libgapbase/gap_file_util.h
index f908dee..3e8e612 100644
--- a/libgapbase/gap_file_util.h
+++ b/libgapbase/gap_file_util.h
@@ -30,6 +30,10 @@
 #define GAP_FILE_UTIL_H
 
 #include "libgimp/gimp.h"
+#include <time.h>
+#ifdef HAVE_SYS_TIMES_H
+#include <sys/times.h>
+#endif
 
 /* G_DIR_SEPARATOR (is defined in glib.h if you have glib-1.2.0 or later) */
 #ifdef G_OS_WIN32
@@ -82,7 +86,10 @@ char *      gap_file_make_abspath_filename(const char *filename
                   , const char *container_file);
 
 char *      gap_file_build_absolute_filename(const char * filename);
-gint32      gap_file_get_mtime(const char *filename);
+time_t      gap_file_get_mtime(const char *filename);
+
+void        gap_file_printf(const char *fmt, ...);
+
 
 
 #endif        /* GAP_FILE_UTIL_H */
diff --git a/libgapvidapi/gap_vid_api.h b/libgapvidapi/gap_vid_api.h
index 60ccf8e..1ef9975 100644
--- a/libgapvidapi/gap_vid_api.h
+++ b/libgapvidapi/gap_vid_api.h
@@ -232,7 +232,7 @@ typedef struct t_GVA_Videoindex  /* nick: vindex */
   gint32               tabsize_allocated;
   gint32               track;
   gint32               total_frames;
-  gint32               mtime;
+  time_t               mtime;
   t_GVA_IndexElem     *ofs_tab;
 } t_GVA_Videoindex;
 
@@ -248,7 +248,7 @@ typedef struct t_GVA_Handle  /* nickname: gvahand */
   gboolean emulate_seek;        /* emulate seek ops by dummy read ops (for slow and exact positioning) */
   gboolean create_vindex;       /* TRUE: allow the fptr_count_frames procedure to create a videoindex file */
   t_GVA_Videoindex *vindex;
-  gint32            mtime;
+  time_t            mtime;
 
   gboolean disable_mmx;
   gboolean do_gimp_progress;    /* WARNING: dont try to set this TRUE if you call the API from a thread !! */
diff --git a/libgapvidapi/gap_vid_api_util.c b/libgapvidapi/gap_vid_api_util.c
index f1eed6c..0b10bc5 100644
--- a/libgapvidapi/gap_vid_api_util.c
+++ b/libgapvidapi/gap_vid_api_util.c
@@ -24,7 +24,7 @@
 static gint32
 p_get_filesize(char *fname)
 {
-  struct stat  stat_buf;
+  GStatBuf  stat_buf;
 
   if (0 != g_stat(fname, &stat_buf))
   {
diff --git a/libgapvidapi/gap_vid_api_vidindex.c b/libgapvidapi/gap_vid_api_vidindex.c
index b474bd5..b6e5c7e 100644
--- a/libgapvidapi/gap_vid_api_vidindex.c
+++ b/libgapvidapi/gap_vid_api_vidindex.c
@@ -378,7 +378,7 @@ GVA_load_videoindex(const char *filename, gint32 track, const char *decoder_name
         gint32 rd_len;
         gint32 rd_size;
         gint   l_flen;
-        gint32 l_mtime;
+        time_t l_mtime;
 
         rd_len = fread(&vindex->hdr, 1, sizeof(vindex->hdr), fp);
         if(rd_len)
diff --git a/libgapvidutil/gap_gve_misc_util.c b/libgapvidutil/gap_gve_misc_util.c
index b7a81d0..e4c38ea 100644
--- a/libgapvidutil/gap_gve_misc_util.c
+++ b/libgapvidutil/gap_gve_misc_util.c
@@ -34,6 +34,7 @@
 #include <sys/stat.h>
 #include <errno.h>
 #include <string.h>
+#include <time.h>
 
 #include <glib/gstdio.h>
 
@@ -201,7 +202,7 @@ p_gap_delete_old_communication_files()
    l_dirp = g_dir_open( l_directory, 0, NULL );
    if(l_dirp)
    {
-     gint32  l_ref_mtime;
+     time_t  l_ref_mtime;
 
      l_ref_mtime = gap_base_get_current_time();
      
@@ -214,8 +215,8 @@ p_gap_delete_old_communication_files()
         if (strncmp(l_entry, "gap_master_videoencoder_", strlen("gap_master_videoencoder_")) == 0)
         {
            char *l_filename;
-           gint32  l_mtime;
-           gint32  l_diff_time;
+           time_t  l_mtime;
+           time_t  l_diff_time;
            gint32  l_pid;
            gint32  l_delete_flag;
            
diff --git a/libgapvidutil/gap_gve_xvid.c b/libgapvidutil/gap_gve_xvid.c
index 7de33bf..c241cea 100644
--- a/libgapvidutil/gap_gve_xvid.c
+++ b/libgapvidutil/gap_gve_xvid.c
@@ -78,7 +78,7 @@ p_xvid_debug_write_mp4u_file(guchar *buff, gint32 len)
 
   FILE *fp;
   gchar *fname;
-  struct stat  l_stat_buf;
+  GStatBuf  l_stat_buf;
   int bigendian;
   long totalsize;
 
diff --git a/vid_common/gap_cme_callbacks.c b/vid_common/gap_cme_callbacks.c
index 3776e4d..d98aa83 100644
--- a/vid_common/gap_cme_callbacks.c
+++ b/vid_common/gap_cme_callbacks.c
@@ -37,6 +37,8 @@
 #include <gtk/gtk.h>
 #include "gap-intl.h"
 
+#include "gap_libgapbase.h"
+
 #include "gap_cme_main.h"
 #include "gap_cme_gui.h"
 #include "gap_gve_sox.h"
@@ -78,7 +80,7 @@ on_encoder_status_poll_timer(gpointer   user_data)
 
   if(gap_debug)
   {
-    printf("\n on_encoder_status_poll_timer: START\n");
+    gap_file_printf("\n on_encoder_status_poll_timer: START\n");
   }
 
   gpp = (GapCmeGlobalParams *)user_data;
@@ -104,7 +106,7 @@ on_productive_encoder_start(gpointer   user_data)
 
   if(gap_debug)
   {
-    printf("\n on_productive_encoder_start: START\n");
+    gap_file_printf("\n on_productive_encoder_start: START\n");
   }
 
   gpp = (GapCmeGlobalParams *)user_data;
@@ -115,7 +117,7 @@ on_productive_encoder_start(gpointer   user_data)
     {
       if(gap_debug)
       {
-        printf("MAIN on_productive_encoder_start remove productive_encoder_timertag:%d\n", 
(int)gpp->productive_encoder_timertag);
+        gap_file_printf("MAIN on_productive_encoder_start remove productive_encoder_timertag:%d\n", 
(int)gpp->productive_encoder_timertag);
       }
       g_source_remove(gpp->productive_encoder_timertag);
       gpp->productive_encoder_timertag = -1;
@@ -123,7 +125,7 @@ on_productive_encoder_start(gpointer   user_data)
 
     if(gap_debug)
     {
-      printf("MAIN on_productive_encoder_start VIDEO ENCODER START ------------------\n");
+      gap_file_printf("MAIN on_productive_encoder_start VIDEO ENCODER START ------------------\n");
     }
 
     gap_cme_gui_start_video_encoder_as_thread(gpp);
@@ -131,7 +133,7 @@ on_productive_encoder_start(gpointer   user_data)
 
     if(gap_debug)
     {
-      printf("MAIN on_productive_encoder_start VIDEO ENCODER finished ------------------\n");
+      gap_file_printf("MAIN on_productive_encoder_start VIDEO ENCODER finished ------------------\n");
     }
     p_start_encoder_status_poll_timer(gpp);
   }
@@ -152,7 +154,7 @@ p_drop_chache_and_start_video_encoder(GapCmeGlobalParams *gpp)
   gap_gve_story_drop_image_cache();
   if(gap_debug)
   {
-    printf("MAIN after gap_gve_story_drop_image_cache ------------------\n");
+    gap_file_printf("MAIN after gap_gve_story_drop_image_cache ------------------\n");
   }
 
   /* start timer (encoder start after 800 millisecs) */
@@ -310,7 +312,7 @@ on_cme__combo_enocder  (GtkWidget     *widget,
   gint       value;
   GapGveEncList *l_ecp;
 
-  if(gap_debug) printf("CB: on_cme__combo_encoder\n");
+  if(gap_debug) gap_file_printf("CB: on_cme__combo_encoder\n");
 
   if(gpp == NULL) return;
 
@@ -330,7 +332,7 @@ on_cme__combo_enocder  (GtkWidget     *widget,
   {
      if(gap_debug)
      {
-        printf("CB: on_cme__combo_encoder index: %d, %s, plugin: %s\n"
+        gap_file_printf("CB: on_cme__combo_encoder index: %d, %s, plugin: %s\n"
                , (int)l_ecp->menu_nr
                , l_ecp->menu_name
                , l_ecp->vid_enc_plugin);
@@ -359,7 +361,7 @@ on_cme__combo_scale  (GtkWidget     *widget,
   static gint  tab_width[GAP_CME_STANDARD_SIZE_MAX_ELEMENTS] =  { 0, 320, 320, 640, 720, 720, 1280, 1920, 
1920 };
   static gint  tab_height[GAP_CME_STANDARD_SIZE_MAX_ELEMENTS] = { 0, 240, 288, 480, 480, 576,  720, 1080, 
1088 };
 
-  if(gap_debug) printf("CB: on_cme__combo_scale\n");
+  if(gap_debug) gap_file_printf("CB: on_cme__combo_scale\n");
 
   if(gpp == NULL) return;
 
@@ -367,7 +369,7 @@ on_cme__combo_scale  (GtkWidget     *widget,
   l_idx = value;
   if(gap_debug) 
   {
-    printf("CB: on_cme__combo_scale index: %d\n", (int)l_idx);
+    gap_file_printf("CB: on_cme__combo_scale index: %d\n", (int)l_idx);
   }
   
   if(l_idx == GAP_CME_STANDARD_SIZE_KEEP)
@@ -413,7 +415,7 @@ on_cme__combo_framerate  (GtkWidget     *widget,
   static gdouble  tab_framerate[GAP_CME_STANDARD_FRAMERATE_MAX_ELEMENTS]
                   =  { 0, 23.98, 24, 25, 29.97, 30, 50, 59.94, 60, 1, 5, 10, 12, 15 };
 
-  if(gap_debug) printf("CB: on_cme__combo_framerate\n");
+  if(gap_debug) gap_file_printf("CB: on_cme__combo_framerate\n");
 
   if(gpp == NULL) return;
 
@@ -425,7 +427,7 @@ on_cme__combo_framerate  (GtkWidget     *widget,
     return;
   }
 
-  if(gap_debug) printf("CB: on_cme__combo_framerate index: %d\n", (int)l_idx);
+  if(gap_debug) gap_file_printf("CB: on_cme__combo_framerate index: %d\n", (int)l_idx);
   if((l_idx >= GAP_CME_STANDARD_FRAMERATE_MAX_ELEMENTS) || (l_idx < 1))
   {
      l_idx = 0;
@@ -450,7 +452,7 @@ on_cme__combo_outsamplerate  (GtkWidget     *widget,
 {
   gint       value;
 
-  if(gap_debug) printf("CB: on_cme__combo_outsamplerate\n");
+  if(gap_debug) gap_file_printf("CB: on_cme__combo_outsamplerate\n");
 
   if(gpp == NULL) return;
 
@@ -458,7 +460,7 @@ on_cme__combo_outsamplerate  (GtkWidget     *widget,
 
   if(gap_debug)
   {
-    printf("CB: on_cme__combo_outsamplerate value: %d\n", (int)value);
+    gap_file_printf("CB: on_cme__combo_outsamplerate value: %d\n", (int)value);
   }
 
 
@@ -481,13 +483,13 @@ on_cme__combo_vid_norm  (GtkWidget     *widget,
 {
   gint       value;
 
-  if(gap_debug) printf("CB: on_cme__combo_vid_norm\n");
+  if(gap_debug) gap_file_printf("CB: on_cme__combo_vid_norm\n");
 
   if(gpp == NULL) return;
 
   gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), &value);
 
-  if(gap_debug) printf("CB: on_cme__combo_vid_norm : %d\n", (int)value);
+  if(gap_debug) gap_file_printf("CB: on_cme__combo_vid_norm : %d\n", (int)value);
 
   gpp->val.vid_format = value;
   
@@ -503,7 +505,7 @@ void
 on_fsv__fileselection_destroy          (GtkObject       *object,
                                         GapCmeGlobalParams *gpp)
 {
- if(gap_debug) printf("CB: on_fsv__fileselection_destroy\n");
+ if(gap_debug) gap_file_printf("CB: on_fsv__fileselection_destroy\n");
  if(gpp == NULL) return;
 
  gpp->fsv__fileselection = NULL;
@@ -517,7 +519,7 @@ on_fsv__button_OK_clicked              (GtkButton       *button,
   const gchar *filename;
   GtkEntry *entry;
 
- if(gap_debug) printf("CB: on_fsv__button_OK_clicked\n");
+ if(gap_debug) gap_file_printf("CB: on_fsv__button_OK_clicked\n");
  if(gpp == NULL) return;
 
 
@@ -540,7 +542,7 @@ void
 on_fsv__button_cancel_clicked          (GtkButton       *button,
                                         GapCmeGlobalParams *gpp)
 {
- if(gap_debug) printf("CB: on_fsv__button_cancel_clicked\n");
+ if(gap_debug) gap_file_printf("CB: on_fsv__button_cancel_clicked\n");
  if(gpp == NULL) return;
 
  if(gpp->fsv__fileselection)
@@ -560,7 +562,7 @@ void
 on_fsb__fileselection_destroy          (GtkObject       *object,
                                         GapCmeGlobalParams *gpp)
 {
- if(gap_debug) printf("CB: on_fsb__fileselection_destroy\n");
+ if(gap_debug) gap_file_printf("CB: on_fsb__fileselection_destroy\n");
  if(gpp == NULL) return;
 
  gpp->fsb__fileselection = NULL;
@@ -574,7 +576,7 @@ on_fsb__button_OK_clicked              (GtkButton       *button,
   const gchar *filename;
   GtkEntry *entry;
 
- if(gap_debug) printf("CB: on_fsb__button_OK_clicked\n");
+ if(gap_debug) gap_file_printf("CB: on_fsb__button_OK_clicked\n");
  if(gpp == NULL) return;
 
  if(gpp->fsb__fileselection)
@@ -596,7 +598,7 @@ void
 on_fsb__button_cancel_clicked          (GtkButton       *button,
                                         GapCmeGlobalParams *gpp)
 {
- if(gap_debug) printf("CB: on_fsb__button_cancel_clicked\n");
+ if(gap_debug) gap_file_printf("CB: on_fsb__button_cancel_clicked\n");
  if(gpp == NULL) return;
 
  if(gpp->fsb__fileselection)
@@ -616,7 +618,7 @@ void
 on_fss__fileselection_destroy          (GtkObject       *object,
                                         GapCmeGlobalParams *gpp)
 {
- if(gap_debug) printf("CB: on_fss__fileselection_destroy\n");
+ if(gap_debug) gap_file_printf("CB: on_fss__fileselection_destroy\n");
  if(gpp == NULL) return;
 
  gpp->fss__fileselection = NULL;
@@ -630,7 +632,7 @@ on_fss__button_OK_clicked              (GtkButton       *button,
   const gchar *filename;
   GtkEntry *entry;
 
- if(gap_debug) printf("CB: on_fss__button_OK_clicked\n");
+ if(gap_debug) gap_file_printf("CB: on_fss__button_OK_clicked\n");
  if(gpp == NULL) return;
 
  if(gpp->fss__fileselection)
@@ -652,7 +654,7 @@ void
 on_fss__button_cancel_clicked          (GtkButton       *button,
                                         GapCmeGlobalParams *gpp)
 {
- if(gap_debug) printf("CB: on_fss__button_cancel_clicked\n");
+ if(gap_debug) gap_file_printf("CB: on_fss__button_cancel_clicked\n");
  if(gpp == NULL) return;
 
  if(gpp->fss__fileselection)
@@ -674,7 +676,7 @@ void
 on_fsa__fileselection_destroy          (GtkObject       *object,
                                         GapCmeGlobalParams *gpp)
 {
- if(gap_debug) printf("CB: on_fsa__fileselection_destroy\n");
+ if(gap_debug) gap_file_printf("CB: on_fsa__fileselection_destroy\n");
  if(gpp == NULL) return;
 
  gpp->fsa__fileselection = NULL;
@@ -688,7 +690,7 @@ on_fsa__button_OK_clicked              (GtkButton       *button,
   const gchar *filename;
   GtkEntry *entry;
 
- if(gap_debug) printf("CB: on_fsa__button_OK_clicked\n");
+ if(gap_debug) gap_file_printf("CB: on_fsa__button_OK_clicked\n");
  if(gpp == NULL) return;
 
  if(gpp->fsa__fileselection)
@@ -710,7 +712,7 @@ void
 on_fsa__button_cancel_clicked          (GtkButton       *button,
                                         GapCmeGlobalParams *gpp)
 {
- if(gap_debug) printf("CB: on_fsa__button_cancel_clicked\n");
+ if(gap_debug) gap_file_printf("CB: on_fsa__button_cancel_clicked\n");
  if(gpp == NULL) return;
 
  if(gpp->fsa__fileselection)
@@ -730,7 +732,7 @@ void
 on_ow__dialog_destroy                  (GtkObject       *object,
                                         GapCmeGlobalParams *gpp)
 {
- if(gap_debug) printf("CB: on_ow__dialog_destroy\n");
+ if(gap_debug) gap_file_printf("CB: on_ow__dialog_destroy\n");
 
  if(gpp)
  {
@@ -745,7 +747,7 @@ void
 on_ow__button_one_clicked              (GtkButton       *button,
                                         GapCmeGlobalParams *gpp)
 {
- if(gap_debug) printf("CB: on_ow__button_one_clicked\n");
+ if(gap_debug) gap_file_printf("CB: on_ow__button_one_clicked\n");
 
  if(gpp)
  {
@@ -761,7 +763,7 @@ void
 on_ow__button_cancel_clicked           (GtkButton       *button,
                                         GapCmeGlobalParams *gpp)
 {
- if(gap_debug) printf("CB: on_ow__button_cancel_clicked\n");
+ if(gap_debug) gap_file_printf("CB: on_ow__button_cancel_clicked\n");
 
  if(gpp)
  {
@@ -781,7 +783,7 @@ void
 on_cme__button_params_clicked           (GtkButton       *button,
                                         GapCmeGlobalParams *gpp)
 {
- if(gap_debug) printf("CB: on_cme__button_params_clicked\n");
+ if(gap_debug) gap_file_printf("CB: on_cme__button_params_clicked\n");
 
  if(gpp)
  {
@@ -797,14 +799,14 @@ on_cme__spinbutton_width_changed       (GtkEditable     *editable,
 {
   GtkAdjustment *adj;
 
- if(gap_debug) printf("CB: on_cme__spinbutton_width_changed\n");
+ if(gap_debug) gap_file_printf("CB: on_cme__spinbutton_width_changed\n");
 
  if(gpp == NULL) return;
 
  adj = GTK_ADJUSTMENT(gpp->cme__spinbutton_width_adj);
  if(adj)
  {
-   if(gap_debug) printf("vid_width spin value: %f\n", (float)adj->value );
+   if(gap_debug) gap_file_printf("vid_width spin value: %f\n", (float)adj->value );
 
    if((gint)adj->value != gpp->val.vid_width)
    {
@@ -826,14 +828,14 @@ on_cme__spinbutton_height_changed      (GtkEditable     *editable,
 {
   GtkAdjustment *adj;
 
- if(gap_debug) printf("CB: on_cme__spinbutton_height_changed\n");
+ if(gap_debug) gap_file_printf("CB: on_cme__spinbutton_height_changed\n");
 
  if(gpp == NULL) return;
 
  adj = GTK_ADJUSTMENT(gpp->cme__spinbutton_height_adj);
  if(adj)
  {
-   if(gap_debug) printf("vid_height spin value: %f\n", (float)adj->value );
+   if(gap_debug) gap_file_printf("vid_height spin value: %f\n", (float)adj->value );
 
    if((gint)adj->value != gpp->val.vid_height)
    {
@@ -854,14 +856,14 @@ on_cme__spinbutton_from_changed        (GtkEditable     *editable,
 {
   GtkAdjustment *adj;
 
- if(gap_debug) printf("CB: on_cme__spinbutton_from_changed\n");
+ if(gap_debug) gap_file_printf("CB: on_cme__spinbutton_from_changed\n");
 
  if(gpp == NULL) return;
 
  adj = GTK_ADJUSTMENT(gpp->cme__spinbutton_from_adj);
  if(adj)
  {
-   if(gap_debug) printf("range_from spin value: %f\n", (float)adj->value );
+   if(gap_debug) gap_file_printf("range_from spin value: %f\n", (float)adj->value );
 
    if((gint)adj->value != gpp->val.range_from)
    {
@@ -878,14 +880,14 @@ on_cme__spinbutton_to_changed          (GtkEditable     *editable,
 {
   GtkAdjustment *adj;
 
- if(gap_debug) printf("CB: on_cme__spinbutton_to_changed\n");
+ if(gap_debug) gap_file_printf("CB: on_cme__spinbutton_to_changed\n");
 
  if(gpp == NULL) return;
 
  adj = GTK_ADJUSTMENT(gpp->cme__spinbutton_to_adj);
  if(adj)
  {
-   if(gap_debug) printf("range_to spin value: %f\n", (float)adj->value );
+   if(gap_debug) gap_file_printf("range_to spin value: %f\n", (float)adj->value );
 
    if((gint)adj->value != gpp->val.range_to)
    {
@@ -902,7 +904,7 @@ on_cme__spinbutton_framerate_changed   (GtkEditable     *editable,
 {
   GtkAdjustment *adj;
 
- if(gap_debug) printf("CB: on_cme__spinbutton_framerate_changed\n");
+ if(gap_debug) gap_file_printf("CB: on_cme__spinbutton_framerate_changed\n");
 
 
  if(gpp == NULL) return;
@@ -910,7 +912,7 @@ on_cme__spinbutton_framerate_changed   (GtkEditable     *editable,
  adj = GTK_ADJUSTMENT(gpp->cme__spinbutton_framerate_adj);
  if(adj)
  {
-   if(gap_debug) printf("framerate spin value: %f\n", (float)adj->value );
+   if(gap_debug) gap_file_printf("framerate spin value: %f\n", (float)adj->value );
 
    if((gint)adj->value != gpp->val.framerate)
    {
@@ -936,7 +938,7 @@ on_cme__entry_audio1_changed           (GtkEditable     *editable,
 
  if(gap_debug) 
  {
-   printf("CB: on_cme__entry_audio1_changed\n");
+   gap_file_printf("CB: on_cme__entry_audio1_changed\n");
  }
  if(gpp == NULL) return;
 
@@ -972,7 +974,7 @@ void
 on_cme__button_audio1_clicked          (GtkButton       *button,
                                         GapCmeGlobalParams *gpp)
 {
- if(gap_debug) printf("CB: on_cme__button_audio1_clicked\n");
+ if(gap_debug) gap_file_printf("CB: on_cme__button_audio1_clicked\n");
  if(gpp == NULL) return;
 
  if(gpp->fsa__fileselection == NULL)
@@ -993,7 +995,7 @@ on_cme__spinbutton_samplerate_changed  (GtkEditable     *editable,
 {
   GtkAdjustment *adj;
 
- if(gap_debug) printf("CB: on_cme__spinbutton_samplerate_changed\n");
+ if(gap_debug) gap_file_printf("CB: on_cme__spinbutton_samplerate_changed\n");
 
  if(gpp == NULL) return;
 
@@ -1004,7 +1006,7 @@ on_cme__spinbutton_samplerate_changed  (GtkEditable     *editable,
    
    if(gap_debug)
    {
-     printf("samplerate spin value: %f\n", (float)adj->value );
+     gap_file_printf("samplerate spin value: %f\n", (float)adj->value );
    }
    gintValue = (gint)adj->value;
    
@@ -1029,7 +1031,7 @@ on_cme__spinbutton_samplerate_changed  (GtkEditable     *editable,
        {
          if(gap_debug)
          {
-           printf("detected a commonly used samplerate value: %d\n", (int)gintValue );
+           gap_file_printf("detected a commonly used samplerate value: %d\n", (int)gintValue );
          }
          gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (gpp->cme__combo_outsamplerate)
              , gintValue);
@@ -1051,7 +1053,7 @@ on_cme__entry_video_changed             (GtkEditable     *editable,
 {
   GtkEntry *entry;
 
- if(gap_debug) printf("CB: on_cme__entry_video_changed\n");
+ if(gap_debug) gap_file_printf("CB: on_cme__entry_video_changed\n");
  if(gpp == NULL) return;
 
  entry = GTK_ENTRY(gpp->cme__entry_video);
@@ -1067,7 +1069,7 @@ void
 on_cme__button_video_clicked           (GtkButton       *button,
                                         GapCmeGlobalParams *gpp)
 {
- if(gap_debug) printf("CB: on_cme__button_video_clicked\n");
+ if(gap_debug) gap_file_printf("CB: on_cme__button_video_clicked\n");
  if(gpp == NULL) return;
 
  if(gpp->fsv__fileselection == NULL)
@@ -1085,7 +1087,7 @@ void
 on_cme__button_sox_save_clicked        (GtkButton       *button,
                                         GapCmeGlobalParams *gpp)
 {
- if(gap_debug) printf("CB: \n");
+ if(gap_debug) gap_file_printf("CB: \n");
 
   if(gpp)
   {
@@ -1099,7 +1101,7 @@ void
 on_cme__button_sox_load_clicked        (GtkButton       *button,
                                         GapCmeGlobalParams *gpp)
 {
- if(gap_debug) printf("CB: \n");
+ if(gap_debug) gap_file_printf("CB: \n");
 
   if(gpp)
   {
@@ -1114,7 +1116,7 @@ void
 on_cme__button_sox_default_clicked     (GtkButton       *button,
                                         GapCmeGlobalParams *gpp)
 {
- if(gap_debug) printf("CB: on_cme__button_sox_default_clicked\n");
+ if(gap_debug) gap_file_printf("CB: on_cme__button_sox_default_clicked\n");
 
   if(gpp)
   {
@@ -1128,7 +1130,7 @@ void
 on_cme__entry_sox_changed              (GtkEditable     *editable,
                                         GapCmeGlobalParams *gpp)
 {
- if(gap_debug) printf("CB: on_cme__entry_sox_changed\n");
+ if(gap_debug) gap_file_printf("CB: on_cme__entry_sox_changed\n");
 
  if(gpp)
  {
@@ -1142,7 +1144,7 @@ void
 on_cme__entry_sox_options_changed      (GtkEditable     *editable,
                                         GapCmeGlobalParams *gpp)
 {
- if(gap_debug) printf("CB: on_cme__entry_sox_options_changed\n");
+ if(gap_debug) gap_file_printf("CB: on_cme__entry_sox_options_changed\n");
 
  if(gpp)
  {
@@ -1157,7 +1159,7 @@ void
 on_cme__button_gen_tmp_audfile_clicked (GtkButton       *button,
                                         GapCmeGlobalParams *gpp)
 {
- if(gap_debug) printf("CB: on_cme__button_gen_tmp_audfile_clicked\n");
+ if(gap_debug) gap_file_printf("CB: on_cme__button_gen_tmp_audfile_clicked\n");
 
  if(gpp)
  {
@@ -1173,7 +1175,7 @@ on_cme__entry_mac_changed              (GtkEditable     *editable,
 {
   GtkEntry *entry;
 
- if(gap_debug) printf("CB: on_cme__entry_mac_changed\n");
+ if(gap_debug) gap_file_printf("CB: on_cme__entry_mac_changed\n");
  if(gpp == NULL) return;
 
  entry = GTK_ENTRY(gpp->cme__entry_mac);
@@ -1189,7 +1191,7 @@ void
 on_cme__button_mac_clicked             (GtkButton       *button,
                                         GapCmeGlobalParams *gpp)
 {
- if(gap_debug) printf("CB: on_cme__button_mac_clicked\n");
+ if(gap_debug) gap_file_printf("CB: on_cme__button_mac_clicked\n");
  if(gpp == NULL) return;
 
  if(gpp->fsb__fileselection == NULL)
@@ -1210,7 +1212,7 @@ on_cme__entry_stb_changed              (GtkEditable     *editable,
 {
   GtkEntry *entry;
 
- if(gap_debug) printf("CB: on_cme__entry_stb_changed\n");
+ if(gap_debug) gap_file_printf("CB: on_cme__entry_stb_changed\n");
  if(gpp == NULL) return;
 
  entry = GTK_ENTRY(gpp->cme__entry_stb);
@@ -1230,7 +1232,7 @@ void
 on_cme__button_stb_clicked             (GtkButton       *button,
                                         GapCmeGlobalParams *gpp)
 {
- if(gap_debug) printf("CB: on_cme__button_stb_clicked\n");
+ if(gap_debug) gap_file_printf("CB: on_cme__button_stb_clicked\n");
  if(gpp == NULL) return;
 
  if(gpp->fss__fileselection == NULL)
@@ -1250,7 +1252,7 @@ void
 on_cme__button_stb_audio_clicked     (GtkButton       *button,
                                       GapCmeGlobalParams *gpp)
 {
- if(gap_debug) printf("CB: on_cme__button_stb_audio_clicked\n");
+ if(gap_debug) gap_file_printf("CB: on_cme__button_stb_audio_clicked\n");
 
   if(gpp)
   {
@@ -1273,7 +1275,7 @@ on_cme__entry_debug_multi_changed      (GtkEditable     *editable,
 {
   GtkEntry *entry;
 
- if(gap_debug) printf("CB: on_cme__entry_debug_multi_changed\n");
+ if(gap_debug) gap_file_printf("CB: on_cme__entry_debug_multi_changed\n");
  if(gpp == NULL) return;
 
  entry = GTK_ENTRY(gpp->cme__entry_debug_multi);
@@ -1283,7 +1285,7 @@ on_cme__entry_debug_multi_changed      (GtkEditable     *editable,
 
     l_write_to = g_strdup(gtk_entry_get_text(entry));
 
-    if(gap_debug) printf("on_cme__entry_debug_multi_changed:l_write_to:%s:\n", l_write_to);
+    if(gap_debug) gap_file_printf("on_cme__entry_debug_multi_changed:l_write_to:%s:\n", l_write_to);
     gimp_set_data( GAP_VID_ENC_SAVE_MULTILAYER, l_write_to, strlen(l_write_to) +1);
     g_free(l_write_to);
  }
@@ -1297,7 +1299,7 @@ on_cme__entry_debug_flat_changed       (GtkEditable     *editable,
 {
   GtkEntry *entry;
 
- if(gap_debug) printf("CB: on_cme__entry_debug_flat_changed\n");
+ if(gap_debug) gap_file_printf("CB: on_cme__entry_debug_flat_changed\n");
  if(gpp == NULL) return;
 
  entry = GTK_ENTRY(gpp->cme__entry_debug_flat);
@@ -1307,7 +1309,7 @@ on_cme__entry_debug_flat_changed       (GtkEditable     *editable,
 
     l_write_to = g_strdup(gtk_entry_get_text(entry));
 
-    if(gap_debug) printf("on_cme__entry_debug_multi_changed:l_write_to:%s:\n", l_write_to);
+    if(gap_debug) gap_file_printf("on_cme__entry_debug_multi_changed:l_write_to:%s:\n", l_write_to);
     gimp_set_data( GAP_VID_ENC_SAVE_FLAT, l_write_to, strlen(l_write_to) +1);
     g_free(l_write_to);
  }
@@ -1320,7 +1322,7 @@ on_cme__checkbutton_enc_monitor_toggled
                                         (GtkCheckButton *checkbutton,
                                         GapCmeGlobalParams *gpp)
 {
- if(gap_debug) printf("CB: on_cme__checkbutton_enc_monitor_toggled\n");
+ if(gap_debug) gap_file_printf("CB: on_cme__checkbutton_enc_monitor_toggled\n");
 
  if(gpp)
  {
diff --git a/vid_common/gap_cme_gui.c b/vid_common/gap_cme_gui.c
index 8a16a50..e6864f9 100644
--- a/vid_common/gap_cme_gui.c
+++ b/vid_common/gap_cme_gui.c
@@ -165,7 +165,10 @@ p_gap_message(const char *msg)
   {
     if(*msg)
     {
-       if(gap_debug) printf("%s\n", msg);
+       if(gap_debug)
+       {
+         gap_file_printf("%s\n", msg);
+       }
        gap_arr_buttons_dialog  (_("GAP Message"), msg, l_argc, l_argv, -1);
     }
   }
@@ -185,7 +188,10 @@ gap_cme_gui_check_gui_thread_is_active(GapCmeGlobalParams *gpp)
      /* only one of the threads (Master or GUI thread) can use the PDB Interface (or call gimp_xxx 
procedures)
       * If 2 threads are talking to the gimp main app parallel it comes to crash.
       */
-     if(gap_debug) printf("MASTER: GUI thread %d is already active\n", (int)gpp->val.gui_proc_thread);
+     if(gap_debug)
+     {
+       gap_file_printf("MASTER: GUI thread %d is already active\n", (int)gpp->val.gui_proc_thread);
+     }
      if(l_gap_message_open == FALSE)
      {
        l_gap_message_open = TRUE;
@@ -216,7 +222,10 @@ gap_cme_gui_pdb_call_encoder_gui_plugin(GapCmeGlobalParams *gpp)
 
   /* start a thread for asynchron PDB call of the gui_ procedure
    */
-  if(gap_debug) printf("MASTER: Before g_thread_create\n");
+  if(gap_debug)
+  {
+    gap_file_printf("MASTER: Before g_thread_create\n");
+  }
 
   joinable = TRUE;
   gpp->val.gui_proc_thread =
@@ -226,8 +235,15 @@ gap_cme_gui_pdb_call_encoder_gui_plugin(GapCmeGlobalParams *gpp)
                      , NULL  /* GError **error (NULL dont report errors) */
                      );
 
-  if(gap_debug) printf("MASTER: After g_thread_create\n");
+  if(gap_debug)
+  {
+    gap_file_printf("MASTER: After g_thread_create\n");
+  }
 #else
+  if(gap_debug)
+  {
+    gap_file_printf("MASTER: gap_cme_gui_pdb_call_encoder_gui_plugin (without threads)\n");
+  }
   /* if threads are not used simply call the procedure
    * (the common GUI window is not refreshed until the called gui_proc ends)
    */
@@ -266,7 +282,17 @@ gap_cme_gui_thread_async_pdb_call(gpointer data)
 
   gpp = gap_cme_main_get_global_params();
 
-  if(gap_debug) printf("THREAD: gap_cme_gui_thread_async_pdb_call &gpp: %d\n", (int)gpp);
+#ifdef GAP_USE_GTHREAD
+  if(gap_debug) 
+  {
+    gap_file_printf("THREAD: gap_cme_gui_thread_async_pdb_call &gpp: %d\n", (int)gpp);
+  }
+#else
+  if(gap_debug) 
+  {
+    gap_file_printf("non-thread call gap_cme_gui_thread_async_pdb_call &gpp: %d\n", (int)gpp);
+  }
+#endif
 
   plugin_name = gpp->val.ecp_sel.gui_proc;
 
@@ -283,9 +309,12 @@ gap_cme_gui_thread_async_pdb_call(gpointer data)
                                      &l_params,
                                      &l_return_vals))
   {
-    printf("ERROR: Plugin not available, Name was %s\n", plugin_name);
+    gap_file_printf("ERROR: Plugin not available, Name was %s\n", plugin_name);
 
-    if(gap_debug) printf("THREAD gui_proc err TERMINATING: %d\n", (int)gpp->val.gui_proc_thread);
+    if(gap_debug)
+    {
+      gap_file_printf("THREAD gui_proc err TERMINATING: %d\n", (int)gpp->val.gui_proc_thread);
+    }
 
     gpp->val.gui_proc_thread = NULL;
     return (NULL);
@@ -340,8 +369,8 @@ gap_cme_gui_thread_async_pdb_call(gpointer data)
 
   if(gap_debug)
   {
-      printf("THREAD Common GUI key: %s\n", l_argv[1].data.d_string);
-      printf("THREAD Common GUI rate: %f  w:%d h:%d\n", (float)gpp->val.framerate, (int)gpp->val.vid_width, 
(int)gpp->val.vid_height);
+      gap_file_printf("THREAD Common GUI key: %s\n", l_argv[1].data.d_string);
+      gap_file_printf("THREAD Common GUI rate: %f  w:%d h:%d\n", (float)gpp->val.framerate, 
(int)gpp->val.vid_width, (int)gpp->val.vid_height);
   }
 
 
@@ -365,11 +394,14 @@ gap_cme_gui_thread_async_pdb_call(gpointer data)
 
   if (l_ret_params[0].data.d_status != GIMP_PDB_SUCCESS)
   {
-    printf("THREAD ERROR: p_call_plugin %s failed.\n", plugin_name);
+    gap_file_printf("THREAD ERROR: p_call_plugin %s failed.\n", plugin_name);
   }
   else
   {
-    if(gap_debug) printf("THREAD DEBUG: p_call_plugin: %s successful.\n", plugin_name);
+    if(gap_debug)
+    {
+      gap_file_printf("THREAD DEBUG: p_call_plugin: %s successful.\n", plugin_name);
+    }
   }
 
   /* the GUI of the encoder plugin might have changed the current video filename extension
@@ -377,7 +409,10 @@ gap_cme_gui_thread_async_pdb_call(gpointer data)
    */
   gap_cme_gui_requery_vid_extension(gpp);
 
-  if(gap_debug) printf("THREAD gui_proc TERMINATING: %d\n", (int)gpp->val.gui_proc_thread);
+  if(gap_debug)
+  {
+    gap_file_printf("THREAD gui_proc TERMINATING: %d\n", (int)gpp->val.gui_proc_thread);
+  }
 
   gpp->val.gui_proc_thread = NULL;
 
@@ -413,7 +448,7 @@ pdb_find_video_encoders(void)
 
   if(gap_debug)
   {
-    printf("pdb_find_video_encoders: START\n");
+    gap_file_printf("pdb_find_video_encoders: START\n");
   }
 
   list_ecp = NULL;
@@ -423,7 +458,7 @@ pdb_find_video_encoders(void)
                            &num_procs, &proc_list);
   if(gap_debug)
   {
-    printf("pdb_find_video_encoders: num_procs:%d (matching the wildcard:%s)\n"
+    gap_file_printf("pdb_find_video_encoders: num_procs:%d (matching the wildcard:%s)\n"
       ,(int)num_procs
       , GAP_WILDCARD_VIDEO_ENCODERS
       );
@@ -449,7 +484,7 @@ pdb_find_video_encoders(void)
 
      if(gap_debug)
      {
-       printf("pdb_find_video_encoders: check proc:%s  has_proc_info:%d\n"
+       gap_file_printf("pdb_find_video_encoders: check proc:%s  has_proc_info:%d\n"
          , proc_list[i]
          , (int)l_has_proc_info
          );
@@ -463,7 +498,7 @@ pdb_find_video_encoders(void)
         {
            if(gap_debug)
            {
-             printf("pdb_find_video_encoders: procedure %s is skipped (nparams %d != %d)\n"
+             gap_file_printf("pdb_find_video_encoders: procedure %s is skipped (nparams %d != %d)\n"
                                , proc_list[i], (int)l_nparams, (int)GAP_VENC_NUM_STANDARD_PARAM );
            }
            continue;
@@ -493,7 +528,7 @@ pdb_find_video_encoders(void)
         {
            if(gap_debug)
            {
-             printf("pdb_find_video_encoders: run procedure %s nparams:%d nretrun_vals:%d\n"
+             gap_file_printf("pdb_find_video_encoders: run procedure %s nparams:%d nretrun_vals:%d\n"
                      , ecp_infoproc, (int)l_nparams, (int)l_nreturn_vals);
            }
 
@@ -514,7 +549,7 @@ pdb_find_video_encoders(void)
                 {
                   if(gap_debug)
                   {
-                    printf("[1].d_string %s\n", l_params[1].data.d_string);
+                    gap_file_printf("[1].d_string %s\n", l_params[1].data.d_string);
                   }
                   g_snprintf(l_ecp->menu_name, sizeof(l_ecp->menu_name), "%s", l_params[1].data.d_string);
                 }
@@ -533,7 +568,7 @@ pdb_find_video_encoders(void)
                 {
                   if(gap_debug)
                   {
-                    printf("[1].d_string %s\n", l_params[1].data.d_string);
+                    gap_file_printf("[1].d_string %s\n", l_params[1].data.d_string);
                   }
                   g_snprintf(l_ecp->video_extension, sizeof(l_ecp->video_extension), "%s",  
l_params[1].data.d_string);
                 }
@@ -552,7 +587,7 @@ pdb_find_video_encoders(void)
                 {
                   if(gap_debug)
                   {
-                    printf("[1].d_string %s\n", l_params[1].data.d_string);
+                    gap_file_printf("[1].d_string %s\n", l_params[1].data.d_string);
                   }
                   g_snprintf(l_ecp->short_description, sizeof(l_ecp->short_description), "%s",  
l_params[1].data.d_string);
                 }
@@ -572,7 +607,7 @@ pdb_find_video_encoders(void)
                 {
                   if(gap_debug)
                   {
-                    printf("[1].d_string %s\n", l_params[1].data.d_string);
+                    gap_file_printf("[1].d_string %s\n", l_params[1].data.d_string);
                   }
                   g_snprintf(l_ecp->gui_proc, sizeof(l_ecp->gui_proc), "%s",  l_params[1].data.d_string);
                 }
@@ -614,7 +649,10 @@ gap_cme_gui_requery_vid_extension(GapCmeGlobalParams *gpp)
 {
   GapGveEncList *l_ecp;
 
-  if(gap_debug) printf("gap_cme_gui_requery_vid_extension START\n");
+  if(gap_debug)
+  {
+    gap_file_printf("gap_cme_gui_requery_vid_extension START\n");
+  }
 
   for(l_ecp = gpp->ecp; l_ecp != NULL; l_ecp = (GapGveEncList *)l_ecp->next)
   {
@@ -638,7 +676,11 @@ gap_cme_gui_requery_vid_extension(GapCmeGlobalParams *gpp)
         {
           if((l_params[1].data.d_string) && (l_params[1].type == GIMP_PDB_STRING))
           {
-            if(gap_debug) printf("gap_cme_gui_requery_vid_extension: [1].d_string %s\n", 
l_params[1].data.d_string);
+            if(gap_debug)
+            {
+              gap_file_printf("gap_cme_gui_requery_vid_extension: [1].d_string %s\n"
+                     , l_params[1].data.d_string);
+            }
             g_snprintf(l_ecp->video_extension, sizeof(l_ecp->video_extension), "%s",  
l_params[1].data.d_string);
             g_snprintf(gpp->val.ecp_sel.video_extension, sizeof(gpp->val.ecp_sel.video_extension), "%s",  
l_params[1].data.d_string);
           }
@@ -666,7 +708,10 @@ p_replace_combo_encodername(GapCmeGlobalParams *gpp)
   gint  l_active_menu_nr;
   gint  l_idx;
 
-  if(gap_debug) printf("p_replace_combo_encodername: START\n");
+  if(gap_debug)
+  {
+    gap_file_printf("p_replace_combo_encodername: START\n");
+  }
 
   combo = gpp->cme__combo_encodername;
   if(combo == NULL)
@@ -681,7 +726,7 @@ p_replace_combo_encodername(GapCmeGlobalParams *gpp)
   {
      if(gap_debug)
      {
-        printf("p_replace_combo_encodername: %d, %s %s\n"
+        gap_file_printf("p_replace_combo_encodername: %d, %s %s\n"
               , (int)l_ecp->menu_nr
               , l_ecp->menu_name
               , l_ecp->vid_enc_plugin);
@@ -882,7 +927,7 @@ p_update_aud_info (GapCmeGlobalParams *gpp
 
   if(gap_debug)
   {
-    printf("p_update_aud_info: START lbl_info:%d lbl_time:%d lbl_time0:%d\n"
+    gap_file_printf("p_update_aud_info: START lbl_info:%d lbl_time:%d lbl_time0:%d\n"
        ,(int)lbl_info
        ,(int)lbl_time
        ,(int)lbl_time0
@@ -908,7 +953,7 @@ p_update_aud_info (GapCmeGlobalParams *gpp
   {
      if(gap_debug)
      {
-       printf("p_update_aud_info: audioname is null or empty\n");
+       gap_file_printf("p_update_aud_info: audioname is null or empty\n");
      }
 
      p_print_time_label(lbl_time, 0);
@@ -928,7 +973,7 @@ p_update_aud_info (GapCmeGlobalParams *gpp
 
   if(gap_debug)
   {
-    printf("p_update_aud_info: audioname %s\n", audioname);
+    gap_file_printf("p_update_aud_info: audioname %s\n", audioname);
   }
 
 
@@ -950,7 +995,7 @@ p_update_aud_info (GapCmeGlobalParams *gpp
 
      if(gap_debug)
      {
-       printf("p_update_aud_info: l_rc:%d all_playlist_references:%d\n"
+       gap_file_printf("p_update_aud_info: l_rc:%d all_playlist_references:%d\n"
          ,(int)l_rc
          ,(int)all_playlist_references
          );
@@ -1208,7 +1253,10 @@ gap_cme_gui_util_sox_widgets (GapCmeGlobalParams *gpp)
 {
   GtkEntry *entry;
 
-  if(gap_debug) printf("gap_cme_gui_util_sox_widgets\n");
+  if(gap_debug)
+  {
+    gap_file_printf("gap_cme_gui_util_sox_widgets\n");
+  }
 
   entry = GTK_ENTRY(gpp->cme__entry_sox);
   if(entry != NULL)
@@ -1240,7 +1288,7 @@ p_range_widgets_set_limits(GapCmeGlobalParams *gpp
 
   if(gap_debug)
   {
-    printf("(++)p_range_widgets_set_limits lower_limit:%d upper_limit:%d input_mode:%d\n"
+    gap_file_printf("(++)p_range_widgets_set_limits lower_limit:%d upper_limit:%d input_mode:%d\n"
        , (int)lower_limit
        , (int)upper_limit
        , (int)range_type
@@ -1323,7 +1371,10 @@ p_range_widgets_set_limits(GapCmeGlobalParams *gpp
 static void
 p_init_shell_window_widgets (GapCmeGlobalParams *gpp)
 {
- if(gap_debug) printf("p_init_shell_window_widgets: Start INIT\n");
+ if(gap_debug)
+ {
+   gap_file_printf("p_init_shell_window_widgets: Start INIT\n");
+ }
 
  /* put initial values to the widgets */
 
@@ -1400,7 +1451,10 @@ p_status_progress(GapCmeGlobalParams *gpp, t_global_stb *gstb)
     gtk_progress_bar_set_text(GTK_PROGRESS_BAR(pbar), gstb->status_msg);
   }
 
-  if(gap_debug) printf("progress: %f\n", (float)gstb->progress );
+  if(gap_debug)
+  {
+    gap_file_printf("progress: %f\n", (float)gstb->progress );
+  }
 }  /* end p_status_progress */
 
 
@@ -1432,7 +1486,7 @@ p_storybord_job_finished(GapCmeGlobalParams *gpp, t_global_stb *gstb)
 
   if(gap_debug)
   {
-    printf("p_storybord_job_finished: START\n");
+    gap_file_printf("p_storybord_job_finished: START\n");
   }
 
   gstb->progress = 1.0;
@@ -1446,14 +1500,14 @@ p_storybord_job_finished(GapCmeGlobalParams *gpp, t_global_stb *gstb)
       /* wait until thread exits */
       if(gap_debug)
       {
-        printf("p_storybord_job_finished: before g_thread_join\n");
+        gap_file_printf("p_storybord_job_finished: before g_thread_join\n");
       }
 
       g_thread_join(gpp->val.gui_proc_thread);
 
       if(gap_debug)
       {
-        printf("p_storybord_job_finished: after g_thread_join\n");
+        gap_file_printf("p_storybord_job_finished: after g_thread_join\n");
       }
       gpp->val.gui_proc_thread = NULL;
    }
@@ -1607,8 +1661,8 @@ p_storybord_job_finished(GapCmeGlobalParams *gpp, t_global_stb *gstb)
 
   if(gap_debug)
   {
-    printf("p_storybord_job_finished:\nMSG: %s\n", l_msg);
-    printf("(##) first:%d last:%d input_mode:%d\n"
+    gap_file_printf("p_storybord_job_finished:\nMSG: %s\n", l_msg);
+    gap_file_printf("(##) first:%d last:%d input_mode:%d\n"
        , (int)gstb->first_frame_limit
        , (int)gstb->last_frame_nr
        , (int)gpp->val.input_mode
@@ -1658,7 +1712,10 @@ on_timer_poll(gpointer   user_data)
   t_global_stb *gstb;
   GapCmeGlobalParams *gpp;
 
-  if(gap_debug) printf("\non_timer_poll: START\n");
+  if(gap_debug)
+  {
+    gap_file_printf("\non_timer_poll: START\n");
+  }
 
   gstb = (t_global_stb *)user_data;
   gpp = gap_cme_main_get_global_params();
@@ -1717,7 +1774,7 @@ p_thread_storyboard_file(gpointer data)
 
   if(gap_debug)
   {
-    printf("THREAD: p_thread_storyboard_file &gpp: %d\n", (int)gpp);
+    gap_file_printf("THREAD: p_thread_storyboard_file &gpp: %d\n", (int)gpp);
   }
 
   gstb = &global_stb;
@@ -1773,7 +1830,10 @@ p_thread_storyboard_file(gpointer data)
     {
       char *l_composite_audio;
 
-      if(gap_debug) gap_gve_story_debug_print_audiorange_list(vidhand->aud_list, -1);
+      if(gap_debug)
+      {
+        gap_gve_story_debug_print_audiorange_list(vidhand->aud_list, -1);
+      }
 
       /* name for the composite audio that should be created */
       l_composite_audio = g_strdup_printf("%s_composite_audio.wav", gpp->val.storyboard_file);
@@ -1790,7 +1850,10 @@ p_thread_storyboard_file(gpointer data)
                       ,l_composite_audio
                       );
 
-            if(gap_debug) gap_gve_story_debug_print_audiorange_list(vidhand->aud_list, -1);
+            if(gap_debug)
+            {
+              gap_gve_story_debug_print_audiorange_list(vidhand->aud_list, -1);
+            }
             gap_gve_story_drop_audio_cache();
          }
          g_free(l_composite_audio);
@@ -1837,7 +1900,7 @@ p_thread_storyboard_file(gpointer data)
 
   if(gap_debug)
   {
-    printf("THREAD storyboard TERMINATING: tid:%d first:%d last:%d input_mode:%d\n"
+    gap_file_printf("THREAD storyboard TERMINATING: tid:%d first:%d last:%d input_mode:%d\n"
        , (int)gpp->val.gui_proc_thread
        , (int)gstb->first_frame_limit
        , (int)gstb->last_frame_nr
@@ -1915,7 +1978,10 @@ gap_cme_gui_check_storyboard_file(GapCmeGlobalParams *gpp)
 
   /* start a thread for asynchron PDB call of the gui_ procedure
    */
-  if(gap_debug) printf("MASTER: Before storyborad g_thread_create\n");
+  if(gap_debug)
+  {
+    gap_file_printf("MASTER: Before storyborad g_thread_create\n");
+  }
 
   joinable = TRUE;
   gpp->val.gui_proc_thread =
@@ -1925,7 +1991,10 @@ gap_cme_gui_check_storyboard_file(GapCmeGlobalParams *gpp)
                      , NULL  /* GError **error (NULL dont report errors) */
                      );
 
-  if(gap_debug) printf("MASTER: After storyborad g_thread_create\n");
+  if(gap_debug)
+  {
+    gap_file_printf("MASTER: After storyborad g_thread_create\n");
+  }
 
   /* start poll timer to update progress and notify when storyboard job finished */
   gstb->poll_timertag =
@@ -2004,7 +2073,10 @@ gap_cme_gui_check_encode_OK (GapCmeGlobalParams *gpp)
   bits = 16;
   bits2 = 16;
 
-  if(gap_debug) printf("gap_cme_gui_check_encode_OK: Start\n");
+  if(gap_debug)
+  {
+    gap_file_printf("gap_cme_gui_check_encode_OK: Start\n");
+  }
 
   if(gpp->val.gui_proc_thread)
   {
@@ -2152,7 +2224,10 @@ gap_cme_gui_check_encode_OK (GapCmeGlobalParams *gpp)
      return (FALSE);
   }
 
-  if(gap_debug) printf("gap_cme_gui_check_encode_OK: End OK\n");
+  if(gap_debug)
+  {
+    gap_file_printf("gap_cme_gui_check_encode_OK: End OK\n");
+  }
   return (TRUE); /* OK */
 }  /* end gap_cme_gui_check_encode_OK */
 
@@ -2559,7 +2634,7 @@ p_create_shell_window (GapCmeGlobalParams *gpp)
   gpp->cme__spinbutton_framerate_adj = NULL;
   gpp->cme__spinbutton_samplerate_adj = NULL;
 
-  shell_window = gimp_dialog_new (_("Master Videoencoder"),
+  shell_window = gap_dialog_new (_("Master Videoencoder"),
                          GAP_CME_PLUGIN_NAME_VID_ENCODE_MASTER,
                          NULL, 0,
                          gimp_standard_help_func, GAP_CME_PLUGIN_HELP_ID_VID_ENCODE_MASTER,
@@ -3888,7 +3963,7 @@ p_call_encoder_procedure(GapCmeGlobalParams *gpp)
 
   if(gpp->val.ecp_sel.vid_enc_plugin[0] == '\0')
   {
-     printf("p_call_encoder_procedure: No encoder available (exit)\n");
+     gap_file_printf("p_call_encoder_procedure: No encoder available (exit)\n");
      return -1;
   }
 
@@ -3899,24 +3974,24 @@ p_call_encoder_procedure(GapCmeGlobalParams *gpp)
 
   if(gap_debug)
   {
-     printf("p_call_encoder_procedure %s: START\n", gpp->val.ecp_sel.vid_enc_plugin);
-     printf("  videoname: %s\n", gpp->val.videoname);
-     printf("  audioname1: %s\n", gpp->val.audioname1);
-     printf("  basename: %s\n", gpp->ainfo.basename);
-     printf("  extension: %s\n", gpp->ainfo.extension);
-     printf("  range_from: %d\n", (int)gpp->val.range_from);
-     printf("  range_to: %d\n", (int)gpp->val.range_to);
-     printf("  framerate: %f\n", (float)gpp->val.framerate);
-     printf("  samplerate: %d\n", (int)gpp->val.samplerate);
-     printf("  wav_samplerate: %d\n", (int)gpp->val.wav_samplerate1);
-     printf("  vid_width: %d\n", (int)gpp->val.vid_width);
-     printf("  vid_height: %d\n", (int)gpp->val.vid_height);
-     printf("  vid_format: %d\n", (int)gpp->val.vid_format);
-     printf("  image_ID: %d\n", (int)gpp->val.image_ID);
-     printf("  l_use_encoderspecific_params: %d\n", (int)l_use_encoderspecific_params);
-     printf("  filtermacro_file: %s\n", gpp->val.filtermacro_file);
-     printf("  storyboard_file: %s\n", gpp->val.storyboard_file);
-     printf("  input_mode: %d\n", gpp->val.input_mode);
+     gap_file_printf("p_call_encoder_procedure %s: START\n", gpp->val.ecp_sel.vid_enc_plugin);
+     gap_file_printf("  videoname: %s\n", gpp->val.videoname);
+     gap_file_printf("  audioname1: %s\n", gpp->val.audioname1);
+     gap_file_printf("  basename: %s\n", gpp->ainfo.basename);
+     gap_file_printf("  extension: %s\n", gpp->ainfo.extension);
+     gap_file_printf("  range_from: %d\n", (int)gpp->val.range_from);
+     gap_file_printf("  range_to: %d\n", (int)gpp->val.range_to);
+     gap_file_printf("  framerate: %f\n", (float)gpp->val.framerate);
+     gap_file_printf("  samplerate: %d\n", (int)gpp->val.samplerate);
+     gap_file_printf("  wav_samplerate: %d\n", (int)gpp->val.wav_samplerate1);
+     gap_file_printf("  vid_width: %d\n", (int)gpp->val.vid_width);
+     gap_file_printf("  vid_height: %d\n", (int)gpp->val.vid_height);
+     gap_file_printf("  vid_format: %d\n", (int)gpp->val.vid_format);
+     gap_file_printf("  image_ID: %d\n", (int)gpp->val.image_ID);
+     gap_file_printf("  l_use_encoderspecific_params: %d\n", (int)l_use_encoderspecific_params);
+     gap_file_printf("  filtermacro_file: %s\n", gpp->val.filtermacro_file);
+     gap_file_printf("  storyboard_file: %s\n", gpp->val.storyboard_file);
+     gap_file_printf("  input_mode: %d\n", gpp->val.input_mode);
   }
 
   if(FALSE == gimp_procedural_db_proc_info (gpp->val.ecp_sel.vid_enc_plugin,
@@ -3977,7 +4052,7 @@ p_call_encoder_procedure(GapCmeGlobalParams *gpp)
   
   if(gap_debug)
   {
-     printf("p_call_encoder_procedure %s: DONE\n", gpp->val.ecp_sel.vid_enc_plugin);
+     gap_file_printf("p_call_encoder_procedure %s: DONE\n", gpp->val.ecp_sel.vid_enc_plugin);
   }
   
   
@@ -4031,7 +4106,7 @@ gap_cme_gui_update_encoder_status(GapCmeGlobalParams *gpp)
 {
   if(gap_debug)
   {
-    printf("  gap_cme_gui_update_encoder_status -- frames_processed:%d\n"
+    gap_file_printf("  gap_cme_gui_update_encoder_status -- frames_processed:%d\n"
       , gpp->encStatus.frames_processed
       );
   }
@@ -4147,7 +4222,7 @@ gap_cme_gui_update_encoder_status(GapCmeGlobalParams *gpp)
 //      {
 //        if(gap_debug)
 //        {
-//          printf("  gap_cme_gui_update_encoder_status -- detected encoder FINISHED via progress\n"
+//          gap_file_printf("  gap_cme_gui_update_encoder_status -- detected encoder FINISHED via progress\n"
 //            , gpp->encStatus.frames_processed
 //            );
 //        }
@@ -4256,14 +4331,14 @@ gap_cme_encoder_worker_thread(gpointer data)
 
   if(gap_debug)
   {
-    printf("THREAD: gap_cme_encoder_worker_thread &gpp: %d\n", (int)gpp);
+    gap_file_printf("THREAD: gap_cme_encoder_worker_thread &gpp: %d\n", (int)gpp);
   }
 
   gap_cme_gui_start_video_encoder(gpp);
 
   if(gap_debug)
   {
-    printf("THREAD gap_cme_encoder_worker_thread TERMINATING: %d\n", (int)gpp->val.gui_proc_thread);
+    gap_file_printf("THREAD gap_cme_encoder_worker_thread TERMINATING: %d\n", (int)gpp->val.gui_proc_thread);
   }
 
   gpp->productive_encoder_thread = NULL;
@@ -4296,7 +4371,7 @@ gap_cme_gui_start_video_encoder_as_thread(GapCmeGlobalParams *gpp)
    */
   if(gap_debug)
   {
-    printf("MASTER: Before g_thread_create encode video worker\n");
+    gap_file_printf("MASTER: Before g_thread_create encode video worker\n");
   }
 
   joinable = TRUE;
@@ -4309,7 +4384,7 @@ gap_cme_gui_start_video_encoder_as_thread(GapCmeGlobalParams *gpp)
 
   if(gap_debug)
   {
-    printf("MASTER: After g_thread_create encode video worker\n");
+    gap_file_printf("MASTER: After g_thread_create encode video worker\n");
   }
 #else
   /* if threads are not used simply call the procedure
@@ -4341,7 +4416,10 @@ gap_cme_gui_master_encoder_dialog(GapCmeGlobalParams *gpp)
   t_global_stb    *gstb;
   GapLibTypeInputRange l_rangetype;
 
-  if(gap_debug) printf("gap_cme_gui_master_encoder_dialog: Start\n");
+  if(gap_debug)
+  {
+    gap_file_printf("gap_cme_gui_master_encoder_dialog: Start\n");
+  }
 
 #ifdef GAP_USE_GTHREAD
   /* check and init thread system */
@@ -4385,11 +4463,17 @@ gap_cme_gui_master_encoder_dialog(GapCmeGlobalParams *gpp)
   gpp->ow__dialog_window = NULL;
   gpp->ecp = pdb_find_video_encoders();
 
-  if(gap_debug) printf("gap_cme_gui_master_encoder_dialog: Before p_create_shell_window\n");
+  if(gap_debug)
+  {
+    gap_file_printf("gap_cme_gui_master_encoder_dialog: Before p_create_shell_window\n");
+  }
 
   gpp->shell_window = p_create_shell_window (gpp);
 
-  if(gap_debug) printf("gap_cme_gui_master_encoder_dialog: After p_create_shell_window\n");
+  if(gap_debug)
+  {
+    gap_file_printf("gap_cme_gui_master_encoder_dialog: After p_create_shell_window\n");
+  }
 
   p_init_shell_window_widgets(gpp);
   gtk_widget_show (gpp->shell_window);
@@ -4409,7 +4493,10 @@ gap_cme_gui_master_encoder_dialog(GapCmeGlobalParams *gpp)
   gdk_threads_leave ();
 #endif
 
-  if(gap_debug) printf("A F T E R gtk_main run:%d\n", (int)gpp->val.run);
+  if(gap_debug)
+  {
+    gap_file_printf("A F T E R gtk_main run:%d\n", (int)gpp->val.run);
+  }
 
   gpp->shell_window = NULL;
 
diff --git a/vid_common/gap_cme_main.c b/vid_common/gap_cme_main.c
index 9687800..fad48b1 100644
--- a/vid_common/gap_cme_main.c
+++ b/vid_common/gap_cme_main.c
@@ -214,7 +214,10 @@ run (const gchar *name,          /* name of plugin */
     if((*l_env != 'n') && (*l_env != 'N')) gap_debug = 1;
   }
 
-  if(gap_debug) fprintf(stderr, "\n\ngap_qt_main: debug name = %s\n", name);
+  if(gap_debug)
+  {
+    gap_file_printf("\n\ngap_qt_main: debug name = %s\n", name);
+  }
 
   gpp->val.gui_proc_thread = NULL;
   gpp->val.run_mode = param[0].data.d_int32;
@@ -333,7 +336,7 @@ run (const gchar *name,          /* name of plugin */
          {
             if(gap_debug)
             {
-               printf("MAIN before gap_cme_gui_master_encoder_dialog ------------------\n");
+               gap_file_printf("MAIN before gap_cme_gui_master_encoder_dialog ------------------\n");
             }
             
             /* note that the dialog alrady performs the encoding (as worker thread) */
@@ -342,7 +345,7 @@ run (const gchar *name,          /* name of plugin */
             
             if(gap_debug)
             {
-              printf("MAIN after gap_cme_gui_master_encoder_dialog ------------------\n");
+              gap_file_printf("MAIN after gap_cme_gui_master_encoder_dialog ------------------\n");
             }
             if(l_rc < 0)
             {
@@ -377,7 +380,7 @@ run (const gchar *name,          /* name of plugin */
 
       if(gap_debug)
       {
-        printf("MAIN cleanup ------------------\n");
+        gap_file_printf("MAIN cleanup ------------------\n");
       }
 
       /* clean up removes the communication file and the cancel request file (if there is any)
diff --git a/vid_enc_ffmpeg/Makefile.am b/vid_enc_ffmpeg/Makefile.am
index 3af3c05..3dfc9c4 100644
--- a/vid_enc_ffmpeg/Makefile.am
+++ b/vid_enc_ffmpeg/Makefile.am
@@ -13,6 +13,7 @@ presetdata_DATA =  \
         ff_mpeg2_dvd.preset \
         ff_mpeg2_svcd.preset \
         ff_real_standard.preset \
+        ff_x264_aac_hq.preset \
         ff_x264_hq.preset
 
 
diff --git a/vid_enc_ffmpeg/ff_x264_aac_hq.preset b/vid_enc_ffmpeg/ff_x264_aac_hq.preset
new file mode 100755
index 0000000..12c3f8a
--- /dev/null
+++ b/vid_enc_ffmpeg/ff_x264_aac_hq.preset
@@ -0,0 +1,204 @@
+# GIMP / GAP FFMPEG videoencoder parameter file
+(preset_name  "x264 HD AAC HighQuality") 
+(format_name  "mp4") 
+(vcodec_name  "libx264") 
+(acodec_name  "aac") 
+(title  "") 
+(author  "") 
+(copyright  "") 
+(comment  "") 
+(passlogfile  "ffmpeg2pass") 
+(pass 1) # 1: one pass encoding, 2: for two-pass encoding
+(ntsc_width 1920) # recommanded width NTSC, 0: not available
+(ntsc_height 1080) # recommanded height NTSC, 0: not available
+(pal_width 1920) # recommanded width PAL, 0: not available
+(pal_height 1080) # recommanded height PAL, 0: not available
+(audio_bitrate 128) # audio bitrate in kBit/sec
+(video_bitrate 200) # video bitrate in kBit/sec
+(gop_size 250) # group of picture size
+(qscale 0) # use fixed video quantiser scale (VBR). 0=const bitrate
+(qmin 10) # min video quantiser scale (VBR)
+(qmax 51) # max video quantiser scale (VBR)
+(qdiff 4) # max difference between the quantiser scale (VBR)
+(qblur 0.5) # video quantiser scale blur (VBR)
+(qcomp 0.60000002384185791) # video quantiser scale compression (VBR)
+(rc_init_cplx 0) # initial complexity for 1-pass encoding
+(b_qfactor 1.25) # qp factor between p and b frames
+(i_qfactor 0.70999997854232788) # qp factor between p and i frames
+(b_qoffset 1.25) # qp offset between p and b frames
+(i_qoffset 0) # qp offset between p and i frames
+(bitrate_tol 4000) # set video bitrate tolerance (in kbit/s)
+(maxrate_tol 0) # set max video bitrate tolerance (in kbit/s)
+(minrate_tol 0) # set min video bitrate tolerance (in kbit/s)
+(bufsize 0) # set ratecontrol buffere size (in kbit)
+(motion_estimation 8) # algorithm for motion estimation (1-6)
+(dct_algo 0) # algorithm for DCT (0-6)
+(idct_algo 0) # algorithm for IDCT (0-11)
+(strict 0) # how strictly to follow the standards
+(mb_qmin 0) # OBSOLETE min macroblock quantiser scale (VBR)
+(mb_qmax 0) # OBSOLETE max macroblock quantiser scale (VBR)
+(mb_decision 0) # algorithm for macroblock decision (0-2)
+(b_frames 3) # max number of B-frames in sequence
+(packet_size 0) 
+(intra no) # use only intra frames
+(set_aspect_ratio yes) # store aspectratio information (width/height) in the output video
+(factor_aspect_ratio 1.7777777779999999) # the aspect ratio (width/height). 0.0 = auto ratio assuming sqaure 
pixels
+(dont_recode_flag no) # bypass the video encoder where frames can be copied 1:1
+(thread_count 0) 
+(mb_cmp 0) # macroblock compare function (0-13,255)
+(ildct_cmp 8) # ildct compare function (0-13,255)
+(sub_cmp 0) # subpel compare function (0-13,255)
+(cmp 256) # fullpel compare function (0-13,255)
+(pre_cmp 0) # pre motion estimation compare function (0-13,255)
+(pre_me 0) # pre motion estimation
+(lumi_mask 0) # luminance masking
+(dark_mask 0) # darkness masking
+(scplx_mask 0) # spatial complexity masking
+(tcplx_mask 0) # temporary complexity masking
+(p_mask 0) # p block masking
+(qns 0) # quantization noise shaping
+(video_lmin 236) # min video lagrange factor (VBR) 0-3658
+(video_lmax 3658) # max video lagrange factor (VBR) 0-3658
+(video_lelim 0) # luma elimination threshold
+(video_celim 0) # chroma elimination threshold
+(video_intra_quant_bias 999999) # intra quant bias
+(video_inter_quant_bias 999999) # inter quant bias
+(me_threshold 0) # motion estimaton threshold
+(mb_threshold 0) # macroblock threshold
+(intra_dc_precision 8) # precision of the intra dc coefficient - 8
+(error_rate 0) # simulates errors in the bitstream to test error concealment
+(noise_reduction 0) # noise reduction strength
+(sc_threshold 40) # scene change detection threshold
+(me_range 16) # limit motion vectors range (1023 for DivX player, 0 = no limit)
+(coder 1) # coder type 0=VLC 1=AC
+(context 0) # context model
+(predictor 0) # prediction method (0 LEFT, 1 PLANE, 2 MEDIAN
+(nsse_weight 8) # noise vs. sse weight for the nsse comparsion function.
+(subpel_quality 8) # subpel ME quality
+(strict_gop 0) # strictly enforce GOP size
+(no_output 0) # skip bitstream encoding
+(video_mb_lmin 236) # min macroblock quantiser scale (VBR) 0-3658
+(video_mb_lmax 3658) # max macroblock quantiser scale (VBR) 0-3658
+(video_profile -99) 
+(video_level -99) 
+(frame_skip_threshold 0) # frame skip threshold
+(frame_skip_factor 0) # frame skip factor
+(frame_skip_exp 0) # frame skip exponent
+(frame_skip_cmp 13) # frame skip comparission function
+(mux_rate 0) 
+(mux_packet_size 0) 
+(mux_preload 0.5) # set the initial demux-decode delay (secs)
+(mux_max_delay 0.69999998807907104) # set the maximum demux-decode delay (secs)
+(b_frame_strategy 2) # strategy to choose between I/P/B-frames
+(workaround_bugs 1) # 1:FF_BUG_AUTODETECT, 2:FF_BUG_OLD_MSMPEG4 4:FF_BUG_XVID_ILACE 8:FF_BUG_UMP4 1
+(error_recognition 1) # 1:FF_ER_CAREFUL  2:FF_ER_COMPLIANT 3:FF_ER_AGGRESSIVE 4:FF_ER_VERY_AGGRESSIVE
+(mpeg_quant 0) # 0-> h263 quant 1-> mpeg quant
+(rc_qsquish 0) # how to keep quantizer between qmin and qmax (0 = clip, 1 = use differentiable
+(rc_qmod_amp 0) # experimental quantizer modulation
+(rc_qmod_freq 0) # experimental quantizer modulation
+(rc_eq[60]  "") # rate control equation (tex^qComp)
+(rc_buffer_aggressivity 1) # currently useless
+(dia_size 0) # ME diamond size & shape
+(last_predictor_count 0) # amount of previous MV predictors (2a+1 x 2a+1 square)
+(pre_dia_size 0) # ME prepass diamond size & shape
+(inter_threshold 0) 
+(border_masking 0) # increases the quantizer for macroblocks close to borders
+(me_penalty_compensation 256) # motion estimation bitrate penalty compensation (1.0 = 256)
+(bidir_refine 1) # refine the two motion vectors used in bidirectional macroblocks
+(brd_scale 0) # downscales frames for dynamic B-frame decision
+(crf 22) # constant rate factor - quality-based VBR - values ~correspond to qps
+(cqp -1) # constant quantization parameter rate control method
+(keyint_min 25) # minimum GOP size
+(refs 5) # number of reference frames
+(chromaoffset 0) # chroma qp offset from luma
+(bframebias 0) # Influences how often B-frames are used
+(trellis 1) # trellis RD quantization
+(complexityblur 20) # Reduce fluctuations in qp (before curve compression)
+(deblockalpha 0) # in-loop deblocking filter alphac0 parameter. alpha is in the range -6...6
+(deblockbeta 0) # in-loop deblocking filter beta parameter. beta is in the range -6...6
+(partitions 275) # macroblock subpartition sizes to consider - p8x8, p4x4, b8x8, i8x8, i4x4
+(directpred 3) # direct MV prediction mode - 0 (none), 1 (spatial), 2 (temporal), 3 (auto)
+(cutoff 0) # Audio cutoff bandwidth (0 means automatic)
+(scenechange_factor 6) #  Multiplied by qscale for each frame and added to scene_change_score.
+(mv0_threshold 256) # Value depends upon the compare function used for fullpel ME
+(b_sensitivity 40) # Adjusts sensitivity of b_frame_strategy 1
+(compression_level -1) 
+(use_lpc -1) # Sets whether to use LPC mode - used by FLAC encoder
+(lpc_coeff_precision 0) # LPC coefficient precision - used by FLAC encoder
+(min_prediction_order -1) 
+(max_prediction_order -1) 
+(prediction_order_method -1) # search method for selecting prediction order
+(min_partition_order -1) 
+(timecode_frame_start 0) # GOP timecode frame start number, in non drop frame format
+(bits_per_raw_sample 0) # This field is applicable only when sample_fmt is SAMPLE_FMT_S32
+(channel_layout 0) # Audio channel layout
+(rc_max_available_vbv_use 0.33333333333333331) # Ratecontrol attempt to use, at maximum, <value> of what can 
be used without a
+(rc_min_vbv_overflow_use 3) # Ratecontrol attempt to use, at least, <value> times the amount needed to prev
+(color_primaries 2) # Chromaticity coordinates of the source primaries.
+(color_trc 2) # Color Transfer Characteristic.
+(colorspace 2) # YUV colorspace type.
+(color_range 0) # MPEG vs JPEG YUV range.
+(chroma_sample_location 1) # This defines the location of chroma samples.
+(weighted_p_pred 2) # explicit P-frame weighted prediction analysis method 0:off, 1: fast blind wei
+(aq_mode 1) # AQ mode
+(aq_strength 1) # AQ strength, Reduces blocking and blurring in flat and textured areas.
+(psy_rd 1) # PSY RD Strength of psychovisual optimization 
+(psy_trellis 0) # PSY trellis Strength of psychovisual optimization
+(rc_lookahead 50) # Number of frames for frametype and ratecontrol lookahead
+(crf_max 0) # Constant rate factor maximum
+(log_level_offset 0) #
+(slices 0) # Indicates number of picture subdivisions
+(thread_type 3) # Which multithreading methods to use (FF_THREAD_FRAME 1, FF_THREAD_SLICE 2) 
+(active_thread_type 0) # Which multithreading methods are in use by the codec.
+(thread_safe_callbacks 0) # Set by the client if its custom get_buffer() callback can be called from anot
+(vbv_delay 0) # VBV delay coded in the last frame (in periods of a 27 MHz clock)
+(audio_service_type 0) # Type of service that the audio stream conveys.
+(bitexact no) # CODEC_FLAG_BITEXACT (for testing, unused in productive version)
+(use_ss no) # CODEC_FLAG_H263P_SLICE_STRUCT enable Slice Structured mode (h263+)
+(use_aiv no) # CODEC_FLAG_H263P_AIV  enable Alternative inter vlc (h263+)
+(use_obmc no) # CODEC_FLAG_OBMC use overlapped block motion compensation (h263+)
+(use_loop yes) # CODEC_FLAG_LOOP_FILTER use loop filter (h263+)
+(use_alt_scan no) # CODEC_FLAG_ALT_SCAN enable alternate scantable (MPEG2/MPEG4)
+(use_mv0 no) # CODEC_FLAG_MV0 try to encode each MB with MV=<0,0> and choose the better one 
+(do_normalize_aqp no) # CODEC_FLAG_NORMALIZE_AQP normalize adaptive quantization
+(use_scan_offset no) # CODEC_FLAG_SVCD_SCAN_OFFSET enable SVCD Scan Offset placeholder
+(closed_gop no) # CODEC_FLAG_CLOSED_GOP closed gop
+(use_qpel no) # CODEC_FLAG_QPEL enable 1/4-pel
+(use_qprd no) # CODEC_FLAG_QP_RD use rate distortion optimization for qp selection
+(use_cbprd no) # CODEC_FLAG_CBP_RD use rate distortion optimization for cbp
+(do_interlace_dct no) # CODEC_FLAG_INTERLACED_DCT use interlaced dct
+(do_interlace_me no) # CODEC_FLAG_INTERLACED_ME interlaced motion estimation
+(aic no) # CODEC_FLAG_AC_PRED activate intra frame coding (only h263+ CODEC) 
+(umv no) # CODEC_FLAG_H263P_UMV enable unlimited motion vector (only h263+ CODEC)
+(mv4 no) # CODEC_FLAG_4MV use four motion vector by macroblock (only MPEG-4 CODEC)
+(partitioning no) # CODEC_FLAG_PART use data partitioning (only MPEG-4 CODEC)
+(use_gmc no) # CODEC_FLAG_GMC                  Use GMC
+(input_preserved no) # CODEC_FLAG_INPUT_PRESERVED      
+(use_gray no) # CODEC_FLAG_GRAY                 Only encode grayscale
+(use_emu_edge no) # CODEC_FLAG_EMU_EDGE             Dont draw edges
+(use_truncated no) # CODEC_FLAG_TRUNCATED            Input bitstream might be truncated at a rando
+(use_fast no) # CODEC_FLAG2_FAST                Allow non spec compliant speedup tricks
+(use_local_header no) # CODEC_FLAG2_LOCAL_HEADER        Place global headers at every keyframe instea
+(use_bpyramid yes) # CODEC_FLAG2_BPYRAMID            H.264 allow B-frames to be used as references
+(use_wpred yes) # CODEC_FLAG2_WPRED               H.264 weighted biprediction for B-frames
+(use_mixed_refs yes) # CODEC_FLAG2_MIXED_REFS          H.264 one reference per partition, as opposed
+(use_dct8x8 yes) # CODEC_FLAG2_8X8DCT              H.264 high profile 8x8 transform
+(use_fastpskip yes) # CODEC_FLAG2_FASTPSKIP           H.264 fast pskip
+(use_aud no) # CODEC_FLAG2_AUD                 H.264 access unit delimiters
+(use_brdo no) # CODEC_FLAG2_BRDO                B-frame rate-distortion optimization
+(use_ivlc no) # CODEC_FLAG2_INTRA_VLC           Use MPEG-2 intra VLC table.
+(use_memc_only no) # CODEC_FLAG2_MEMC_ONLY           Only do ME/MC (I frames -> ref, P frame -> ME
+(use_drop_frame_timecode no) # CODEC_FLAG2_DROP_FRAME_TIMECODE timecode is in drop frame format
+(use_skip_rd no) # CODEC_FLAG2_SKIP_RD             RD optimal MB level residual skipping
+(use_chunks no) # CODEC_FLAG2_CHUNKS              Input bitstream might be truncated at a packe
+(use_non_linear_quant no) # CODEC_FLAG2_NON_LINEAR_QUANT    Use MPEG-2 nonlinear quantizer
+(use_bit_reservoir no) # CODEC_FLAG2_BIT_RESERVOIR       Use a bit reservoir when encoding if possible
+(use_bit_mbtree no) # CODEC_FLAG2_MBTREE              Use macroblock tree ratecontrol (x264 only)
+(use_bit_psy no) # CODEC_FLAG2_PSY                 Use psycho visual optimizations.
+(use_bit_ssim no) # CODEC_FLAG2_SSIM                Compute SSIM during encoding, error[] values 
+(parti4x4 yes) # X264_PART_I4X4  Analyze i4x4
+(parti8x8 yes) # X264_PART_I8X8  Analyze i8x8 (requires 8x8 transform)
+(partp4x4 yes) # X264_PART_P8X8  Analyze p16x8, p8x16 and p8x8
+(partp8x8 no) # X264_PART_P4X4  Analyze p8x4, p4x8, p4x4
+(partb8x8 yes) # X264_PART_B8X8  Analyze b16x8, b8x16 and b8x8
+(use_bit_intra_refresh no) # CODEC_FLAG2_INTRA_REFRESH       Use periodic insertion of intra blocks instea


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