[gimp-gap] fixed broken storyboard creation via video extract dialog.



commit 4991eced5e21a9691911342b31b30fbc213d7ff1
Author: Wolfgang Hofer <wolfgangh svn gnome org>
Date:   Tue Feb 19 20:43:50 2013 +0100

    fixed broken storyboard creation via video extract dialog.

 ChangeLog              |   29 ++++++++
 gap/gap_story_dialog.c |  140 ++++++++++++++++++++++++++++++++-----
 gap/gap_story_file.c   |  182 +++++++++++++++++++++++++-----------------------
 gap/gap_story_file.h   |    2 +
 gap/gap_story_undo.c   |   32 ++++----
 gap/gap_story_undo.h   |    4 +-
 gap/gap_story_vthumb.c |   36 +++++-----
 gap/gap_story_vthumb.h |    2 +-
 gap/gap_vex_dialog.c   |   25 ++++++-
 gap/gap_vex_exec.c     |    8 ++-
 10 files changed, 317 insertions(+), 143 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index abd20d7..05212e7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+2013-02-19 Wolfgang Hofer <hof gimp org>
+
+- storyboard debug features now support logging to file.
+  This can be optionally configured in the file "GAP_DEBUG_STORYBOARD"  (located in gimpdir)
+  by adding a line like this:
+    logfile=/tmp/GAP_STORYBOARD_DEBUG.log  
+
+  or like that (on Windows):
+    logfile=S:\SsdShare\GAP_STORYBOARD_DEBUG.log
+  
+  Note that logging to stdout is default, in case no logfile is specified.
+  (the filename must start immediate after the = character,
+   blanks in the logfilename/path are not supported !)
+
+  This feature was added for analyse of Storyboard bugs in Windows environment.
+
+- bugfix creation of storyboard from video extract plug-in.
+  A broken storyboard was created (with section list NULL)
+  
+
+
+  * gap/gap_story_dialog.c
+  * gap/gap_story_file.c [.h]
+  * gap/gap_story_undo.c [.h]
+  * gap/gap_story_vthumb.c [.h]
+  
+  * gap/gap_vex_dialog.c
+  * gap/gap_vex_exec.c
+
 2013-02-10 Wolfgang Hofer <hof gimp org>
 
 - added audio support for other Operating Systems than Linux.
diff --git a/gap/gap_story_dialog.c b/gap/gap_story_dialog.c
index b4a821e..7e04a90 100644
--- a/gap/gap_story_dialog.c
+++ b/gap/gap_story_dialog.c
@@ -125,11 +125,12 @@ extern int gap_debug;  /* 1 == print debug infos , 0 dont print debug infos */
 
 
 /* the file GAP_DEBUG_STORYBOARD_CONFIG_FILE
- * is a debug configuration intended for development an test
+ * is a debug configuration intended for development and test
  * if this file exists at start of the storyboard plug-in
  * it has an additional menu item that triggers debug output of internal
- * memory structures to stdout.
+ * memory structures to stdout. (or logifile)
  * the content of this file selects what to print by symbolic names
+ * and optionally specifies the name of a logfile (default print goes to stdout)
  * (see procedure p_is_debug_feature_item_enabled for details)
  */
 #define GAP_DEBUG_STORYBOARD_CONFIG_FILE "GAP_DEBUG_STORYBOARD"
@@ -139,6 +140,7 @@ typedef void (*GapStbMenuCallbackFptr)(GtkWidget *widget, GapStbMainGlobalParams
 static char *   p_get_gapdebug_storyboard_config_file();
 static gboolean p_is_debug_menu_enabled(void);
 static gboolean p_is_debug_feature_item_enabled(const char *debug_item);
+static FILE *   p_debug_feature_open_optional_logfile();
 static void     p_get_begin_and_end_for_single_clip_playback(gint32 *begin_frame, gint32 *end_frame, 
GapStoryElem *stb_elem);
 
 
@@ -552,6 +554,63 @@ p_is_debug_feature_item_enabled(const char *debug_item)
 }  /* end p_is_debug_feature_item_enabled */
 
 
+/* ---------------------------------------
+ * p_debug_feature_open_optional_logfile
+ * ---------------------------------------
+ * check for presence of a "logfile=" item int the debug configuration file.
+ * if present, then open the logfilename (starts immediate after the "=" character)
+ * for write append (or create if not yet exist) and return the file handle pointer.
+ * ELSE return NULL.
+ */
+static FILE *
+p_debug_feature_open_optional_logfile()
+{
+  FILE *loggingFp;
+  char *filename;
+
+  loggingFp = NULL;
+  filename = p_get_gapdebug_storyboard_config_file();
+  if(filename)
+  {
+    if(g_file_test(filename, G_FILE_TEST_EXISTS))
+    {
+      FILE *l_fp;
+      char         l_buf[400];
+
+      l_fp = g_fopen(filename, "r");
+      if(l_fp)
+      {
+        while (NULL != fgets (l_buf, sizeof(l_buf)-1, l_fp))
+        {
+          l_buf[sizeof(l_buf)-1] = '\0';
+          gap_file_chop_trailingspace_and_nl(&l_buf[0]);
+
+          if(gap_debug)
+          {
+            printf("  CFG:'%s'\n", l_buf);
+          }
+
+          if (strncmp(l_buf, "logfile=", strlen("logfile=")) ==0)
+          {
+            char *logfileName;
+
+            logfileName = &l_buf[strlen("logfile=")];
+            loggingFp = g_fopen(logfileName, "a");
+            break;
+          }
+        }
+
+        fclose(l_fp);
+      }
+
+    }
+    g_free(filename);
+  }
+
+
+  return(loggingFp);
+
+}  /* end p_debug_feature_open_optional_logfile */
 
 
 /* ---------------------------------------------
@@ -5369,7 +5428,10 @@ p_menu_win_vthumbs_toggle_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
 /* ---------------------------------
  * p_menu_win_debug_log_to_stdout_cb
  * ---------------------------------
- * check
+ * callback to handle logging of the configured debug output.
+ * per default logging goes to stdout
+ * (unless the logfilename is configured in the GAP_DEBUG_STORYBOARD_CONFIG_FILE
+ *  via item "logfile=")
  */
 static void
 p_menu_win_debug_log_to_stdout_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
@@ -5377,50 +5439,69 @@ p_menu_win_debug_log_to_stdout_cb (GtkWidget *widget, GapStbMainGlobalParams *sg
   if(sgpp)
   {
     gboolean selection_found;
+    FILE *loggingFp;
+    FILE *fpLog;
 
     selection_found = FALSE;
-    printf("\n\nDEBUG LOG_MENU START\n");
+
+    loggingFp = p_debug_feature_open_optional_logfile();
+    if (loggingFp != NULL)
+    {
+      fpLog = loggingFp;
+    }
+    else
+    {
+      fpLog = stdout;
+    }
+
+
+    fprintf(fpLog, "\n\nDEBUG LOG_MENU START\n");
     if(TRUE == p_is_debug_feature_item_enabled("dump_vthumb_list"))
     {
       selection_found = TRUE;
-      printf("\ndump_vthumb_list enabled\n");
-      gap_story_vthumb_debug_print_videolist(sgpp->video_list, sgpp->vthumb_list);
+      fprintf(fpLog, "\ndump_vthumb_list enabled\n");
+      gap_story_vthumb_debug_fprint_videolist(fpLog, sgpp->video_list, sgpp->vthumb_list);
     }
     if(TRUE == p_is_debug_feature_item_enabled("dump_cliplist"))
     {
       selection_found = TRUE;
-      printf("\ndump_cliplist enabled\n");
-      gap_story_debug_print_list(sgpp->cll);
+      fprintf(fpLog, "\ndump_cliplist enabled\n");
+      gap_story_debug_fprint_list(fpLog, sgpp->cll);
     }
     if(TRUE == p_is_debug_feature_item_enabled("dump_undostack_cliplist"))
     {
       selection_found = TRUE;
-      printf("\ndump_undostack_cliplist enabled\n");
-      gap_stb_undo_debug_print_stack(sgpp->cll_widgets);
+      fprintf(fpLog, "\ndump_undostack_cliplist enabled\n");
+      gap_stb_undo_debug_fprint_stack(fpLog, sgpp->cll_widgets);
     }
     if(TRUE == p_is_debug_feature_item_enabled("dump_stroryboard"))
     {
       selection_found = TRUE;
-      printf("\ndump_stroryboard enabled\n");
-      gap_story_debug_print_list(sgpp->stb);
+      fprintf(fpLog, "\ndump_stroryboard enabled\n");
+      gap_story_debug_fprint_list(fpLog, sgpp->stb);
     }
     if(TRUE == p_is_debug_feature_item_enabled("dump_undostack_stroryboard"))
     {
       selection_found = TRUE;
-      printf("\ndump_undostack_stroryboard enabled\n");
-      gap_stb_undo_debug_print_stack(sgpp->stb_widgets);
+      fprintf(fpLog, "\ndump_undostack_stroryboard enabled\n");
+      gap_stb_undo_debug_fprint_stack(fpLog, sgpp->stb_widgets);
     }
 
     if (selection_found != TRUE)
     {
-       printf("INFO p_menu_win_debug_log_to_stdout_cb:"
+       fprintf(fpLog, "INFO p_menu_win_debug_log_to_stdout_cb:"
               " The file: %s does not exist or does not contain"
               " any valid selction what to print for debug purpose.\n"
               , GAP_DEBUG_STORYBOARD_CONFIG_FILE);
     }
 
-    printf("\n\nDEBUG LOG_MENU END\n");
-    fflush(stdout);
+    fprintf(fpLog, "\n\nDEBUG LOG_MENU END\n");
+    fflush(fpLog);
+    if (loggingFp != NULL)
+    {
+      fclose(loggingFp);
+      loggingFp = NULL;
+    }
   }
 }  /* end p_menu_win_debug_log_to_stdout_cb */
 
@@ -8466,13 +8547,36 @@ p_storyboard_init_from_creation_params(
     stb->master_aspect_width = scrp->aspect_width;
     stb->master_aspect_height = scrp->aspect_height;
 
-    stb->stb_section = NULL;
+
+    if(gap_debug)
+    {
+      printf("p_storyboard_init_from_creation_params: storyboard_filename:%s\n"
+        ,scrp->storyboard_filename
+        );
+    }
+    
     stb->storyboardfile = NULL;
     if(scrp->storyboard_filename[0] != '\0')
     {
       stb->storyboardfile = g_strdup(scrp->storyboard_filename);
+      if(tabw->filename_refptr)
+      {
+        g_snprintf(tabw->filename_refptr
+              , tabw->filename_maxlen
+              , "%s"
+              , scrp->storyboard_filename
+              );
+      }
+      /* replace the internal copy of the name in the GapStoryBoard struct */
+      if(sgpp->cll->storyboardfile)
+      {
+        g_free(sgpp->cll->storyboardfile);
+      }
     }
 
+
+
+
     if (scrp->preferred_decoder[0] != '\0')
     {
       stb->preferred_decoder = g_strdup(scrp->preferred_decoder);
diff --git a/gap/gap_story_file.c b/gap/gap_story_file.c
index f8f6dea..d72f89e 100644
--- a/gap/gap_story_file.c
+++ b/gap/gap_story_file.c
@@ -143,119 +143,125 @@ p_null_strcmp(const char *str1, const char *str2)
 }  /* end p_null_strcmp */
 
 /* ----------------------------------------------------
- * gap_story_debug_print_elem
+ * gap_story_debug_(f)print_elem
  * ----------------------------------------------------
  */
 void
 gap_story_debug_print_elem(GapStoryElem *stb_elem)
 {
+  gap_story_debug_fprint_elem(stdout, stb_elem);
+}
+
+void
+gap_story_debug_fprint_elem(FILE *fp, GapStoryElem *stb_elem)
+{
   if(stb_elem == NULL)
   {
-    printf("\n  gap_story_debug_print_elem:  stb_elem is NULL\n");
+    fprintf(fp, "\n  gap_story_debug_print_elem:  stb_elem is NULL\n");
   }
   else
   {
-    printf("\n  gap_story_debug_print_elem:  stb_elem: %d\n", (int)stb_elem);
+    fprintf(fp, "\n  gap_story_debug_print_elem:  stb_elem: %d\n", (int)stb_elem);
 
-    printf("  gap_story_debug_print_elem: START\n");
-    printf("  record_type: %d  %s\n", (int)stb_elem->record_type
+    fprintf(fp, "  gap_story_debug_print_elem: START\n");
+    fprintf(fp, "  record_type: %d  %s\n", (int)stb_elem->record_type
                                   , p_record_type_to_string(stb_elem->record_type)
                                   );
-    printf("  story_id: %d\n", (int)stb_elem->story_id);
-    printf("  story_orig_id: %d\n", (int)stb_elem->story_orig_id);
-    printf("  selected: %d\n", (int)stb_elem->selected);
-    printf("  playmode: %d\n", (int)stb_elem->playmode);
-    printf("  track: %d", (int)stb_elem->track);
+    fprintf(fp, "  story_id: %d\n", (int)stb_elem->story_id);
+    fprintf(fp, "  story_orig_id: %d\n", (int)stb_elem->story_orig_id);
+    fprintf(fp, "  selected: %d\n", (int)stb_elem->selected);
+    fprintf(fp, "  playmode: %d\n", (int)stb_elem->playmode);
+    fprintf(fp, "  track: %d", (int)stb_elem->track);
 
     if(stb_elem->track == GAP_STB_MASK_TRACK_NUMBER)
     {
-      printf(" (MASK-DEFINITION track)");
+      fprintf(fp, " (MASK-DEFINITION track)");
     }
-    printf("\n");
+    fprintf(fp, "\n");
 
-    printf("  from_frame: %d\n", (int)stb_elem->from_frame);
-    printf("  to_frame: %d\n", (int)stb_elem->to_frame);
-    printf("  nloop: %d\n", (int)stb_elem->nloop);
-    printf("  seltrack: %d\n", (int)stb_elem->seltrack);
-    printf("  exact_seek: %d\n", (int)stb_elem->exact_seek);
-    printf("  delace: %f\n", (float)stb_elem->delace);
-    printf("  nframes: %d\n", (int)stb_elem->nframes);
-    printf("  step_density: %f\n", (float)stb_elem->step_density);
-    printf("  aud_play_from_sec: %f\n", (float)stb_elem->aud_play_from_sec);
-    printf("  aud_play_to_sec: %f\n", (float)stb_elem->aud_play_to_sec);
-    printf("  aud_min_play_sec: %f\n", (float)stb_elem->aud_min_play_sec);
-    printf("  aud_max_play_sec: %f\n", (float)stb_elem->aud_max_play_sec);
-    printf("  aud_volume: %f\n", (float)stb_elem->aud_volume);
-    printf("  aud_volume_start: %f\n", (float)stb_elem->aud_volume_start);
-    printf("  aud_fade_in_sec: %f\n", (float)stb_elem->aud_fade_in_sec);
-    printf("  aud_volume_end: %f\n", (float)stb_elem->aud_volume_end);
-    printf("  aud_fade_out_sec: %f\n", (float)stb_elem->aud_fade_out_sec);
-    printf("  file_line_nr: %d\n", (int)stb_elem->file_line_nr);
+    fprintf(fp, "  from_frame: %d\n", (int)stb_elem->from_frame);
+    fprintf(fp, "  to_frame: %d\n", (int)stb_elem->to_frame);
+    fprintf(fp, "  nloop: %d\n", (int)stb_elem->nloop);
+    fprintf(fp, "  seltrack: %d\n", (int)stb_elem->seltrack);
+    fprintf(fp, "  exact_seek: %d\n", (int)stb_elem->exact_seek);
+    fprintf(fp, "  delace: %f\n", (float)stb_elem->delace);
+    fprintf(fp, "  nframes: %d\n", (int)stb_elem->nframes);
+    fprintf(fp, "  step_density: %f\n", (float)stb_elem->step_density);
+    fprintf(fp, "  aud_play_from_sec: %f\n", (float)stb_elem->aud_play_from_sec);
+    fprintf(fp, "  aud_play_to_sec: %f\n", (float)stb_elem->aud_play_to_sec);
+    fprintf(fp, "  aud_min_play_sec: %f\n", (float)stb_elem->aud_min_play_sec);
+    fprintf(fp, "  aud_max_play_sec: %f\n", (float)stb_elem->aud_max_play_sec);
+    fprintf(fp, "  aud_volume: %f\n", (float)stb_elem->aud_volume);
+    fprintf(fp, "  aud_volume_start: %f\n", (float)stb_elem->aud_volume_start);
+    fprintf(fp, "  aud_fade_in_sec: %f\n", (float)stb_elem->aud_fade_in_sec);
+    fprintf(fp, "  aud_volume_end: %f\n", (float)stb_elem->aud_volume_end);
+    fprintf(fp, "  aud_fade_out_sec: %f\n", (float)stb_elem->aud_fade_out_sec);
+    fprintf(fp, "  file_line_nr: %d\n", (int)stb_elem->file_line_nr);
     if(stb_elem->orig_filename)
     {
-      printf("  orig_filename :%s:\n", stb_elem->orig_filename);
+      fprintf(fp, "  orig_filename :%s:\n", stb_elem->orig_filename);
     }
     else
     {
-      printf("  orig_filename: (NULL)\n");
+      fprintf(fp, "  orig_filename: (NULL)\n");
     }
 
     if(stb_elem->orig_src_line)
     {
-      printf("  orig_src_line :%s:\n", stb_elem->orig_src_line);
+      fprintf(fp, "  orig_src_line :%s:\n", stb_elem->orig_src_line);
     }
     else
     {
-      printf("  orig_src_line: (NULL)\n");
+      fprintf(fp, "  orig_src_line: (NULL)\n");
     }
 
 
     if(stb_elem->basename)
     {
-      printf("  basename :%s:\n", stb_elem->basename);
+      fprintf(fp, "  basename :%s:\n", stb_elem->basename);
     }
     else
     {
-      printf("  basename: (NULL)\n");
+      fprintf(fp, "  basename: (NULL)\n");
     }
 
     if(stb_elem->ext)
     {
-      printf("  ext :%s:\n", stb_elem->ext);
+      fprintf(fp, "  ext :%s:\n", stb_elem->ext);
     }
     else
     {
-      printf("  ext: (NULL)\n");
+      fprintf(fp, "  ext: (NULL)\n");
     }
 
 
     if(stb_elem->filtermacro_file)
     {
-      printf("  filtermacro_file :%s:\n", stb_elem->filtermacro_file);
+      fprintf(fp, "  filtermacro_file :%s:\n", stb_elem->filtermacro_file);
     }
     else
     {
-      printf("  filtermacro_file: (NULL)\n");
+      fprintf(fp, "  filtermacro_file: (NULL)\n");
     }
 
     if(stb_elem->colormask_file)
     {
-      printf("  colormask_file :%s:\n", stb_elem->colormask_file);
+      fprintf(fp, "  colormask_file :%s:\n", stb_elem->colormask_file);
     }
     else
     {
-      printf("  colormask_file: (NULL)\n");
+      fprintf(fp, "  colormask_file: (NULL)\n");
     }
-    printf("  fmac_total_steps: %d\n", (int)stb_elem->fmac_total_steps);
-    printf("  fmac_accel:       %d\n", (int)stb_elem->fmac_accel);
+    fprintf(fp, "  fmac_total_steps: %d\n", (int)stb_elem->fmac_total_steps);
+    fprintf(fp, "  fmac_accel:       %d\n", (int)stb_elem->fmac_accel);
 
     if(stb_elem->preferred_decoder)
     {
-      printf("  preferred_decoder :%s:\n", stb_elem->preferred_decoder);
+      fprintf(fp, "  preferred_decoder :%s:\n", stb_elem->preferred_decoder);
     }
     else
     {
-      printf("  preferred_decoder: (NULL)\n");
+      fprintf(fp, "  preferred_decoder: (NULL)\n");
     }
 
     if(stb_elem->record_type == GAP_STBREC_ATT_TRANSITION)
@@ -265,7 +271,7 @@ gap_story_debug_print_elem(GapStoryElem *stb_elem)
       {
         if(stb_elem->att_arr_enable[ii])
         {
-          printf("  [%d] %s  from: %f  to: %f   dur: %d  accel: %d\n"
+          fprintf(fp, "  [%d] %s  from: %f  to: %f   dur: %d  accel: %d\n"
             , (int)ii
             , gtab_att_transition_key_words[ii]
             , (float)stb_elem->att_arr_value_from[ii]
@@ -277,74 +283,78 @@ gap_story_debug_print_elem(GapStoryElem *stb_elem)
       }
       if(stb_elem->att_movepath_file_xml != NULL)
       {
-        printf("   att_movepath_file_xml: %s\n", stb_elem->att_movepath_file_xml);
+        fprintf(fp, "   att_movepath_file_xml: %s\n", stb_elem->att_movepath_file_xml);
       }
-      printf("   overlap: %d\n", (int)stb_elem->att_overlap);
+      fprintf(fp, "   overlap: %d\n", (int)stb_elem->att_overlap);
     }
 
-    printf("   flip_request: %d\n", (int)stb_elem->flip_request);
+    fprintf(fp, "   flip_request: %d\n", (int)stb_elem->flip_request);
     if(stb_elem->mask_name)
     {
-      printf("  mask_name :%s:\n", stb_elem->mask_name);
+      fprintf(fp, "  mask_name :%s:\n", stb_elem->mask_name);
     }
     else
     {
-      printf("  mask_name: (NULL)\n");
+      fprintf(fp, "  mask_name: (NULL)\n");
     }
-    printf("  mask_anchor:   %d\n", (int)stb_elem->mask_anchor);
-    printf("  mask_stepsize: %f\n", (float)stb_elem->mask_stepsize);
-    printf("  mask_disable:  %d\n", (int)stb_elem->mask_disable);
+    fprintf(fp, "  mask_anchor:   %d\n", (int)stb_elem->mask_anchor);
+    fprintf(fp, "  mask_stepsize: %f\n", (float)stb_elem->mask_stepsize);
+    fprintf(fp, "  mask_disable:  %d\n", (int)stb_elem->mask_disable);
 
-    printf("  comment ptr:%d\n", (int)stb_elem->comment);
-    printf("  next    ptr:%d\n", (int)stb_elem->next);
+    fprintf(fp, "  comment ptr:%d\n", (int)stb_elem->comment);
+    fprintf(fp, "  next    ptr:%d\n", (int)stb_elem->next);
   }
-  fflush(stdout);
-}  /* end gap_story_debug_print_elem */
-
+  fflush(fp);
+}  /* end gap_story_debug_fprint_elem */
 
 /* -----------------------------
- * gap_story_debug_print_list
+ * gap_story_debug_(f)print_list
  * -----------------------------
  */
 void
 gap_story_debug_print_list(GapStoryBoard *stb)
 {
+  gap_story_debug_fprint_list(stdout, stb);
+}
+void
+gap_story_debug_fprint_list(FILE *fp, GapStoryBoard *stb)
+{
   GapStoryElem *stb_elem;
   gint ii;
 
-  printf("\n\ngap_story_debug_print_list:  START stb: %d\n", (int)stb);
+  fprintf(fp, "\n\ngap_story_debug_print_list:  START stb: %d\n", (int)stb);
 
   if(stb == NULL)
   {
-    printf("NULL POINTER\n");
-    fflush(stdout);
+    fprintf(fp, "NULL POINTER\n");
+    fflush(fp);
     return;
   }
 
-  printf("master_type               : %d\n", (int)stb->master_type );
-  printf("master_width              : %d\n", (int)stb->master_width );
-  printf("master_height             : %d\n", (int)stb->master_height );
-  printf("master_framerate          : %f\n", (float)stb->master_framerate );
-  printf("master_aspect_ratio       : %f (%d : %d)\n"
+  fprintf(fp, "master_type               : %d\n", (int)stb->master_type );
+  fprintf(fp, "master_width              : %d\n", (int)stb->master_width );
+  fprintf(fp, "master_height             : %d\n", (int)stb->master_height );
+  fprintf(fp, "master_framerate          : %f\n", (float)stb->master_framerate );
+  fprintf(fp, "master_aspect_ratio       : %f (%d : %d)\n"
             , (float)stb->master_aspect_ratio
             , (int)stb->master_aspect_width
             , (int)stb->master_aspect_height
             );
-  printf("master_1is_toplayer       : %d\n", (int)stb->master_vtrack1_is_toplayer );
+  fprintf(fp, "master_1is_toplayer       : %d\n", (int)stb->master_vtrack1_is_toplayer );
   if (stb->master_insert_alpha_format)
   {
-    printf("master_insert_alpha_format :%s", stb->master_insert_alpha_format);
+    fprintf(fp, "master_insert_alpha_format :%s", stb->master_insert_alpha_format);
   }
   if (stb->master_insert_area_format)
   {
-    printf("master_insert_area_format :%s", stb->master_insert_area_format);
+    fprintf(fp, "master_insert_area_format :%s", stb->master_insert_area_format);
   }
-  printf("layout_cols               : %d\n", (int)stb->layout_cols );
-  printf("layout_rows               : %d\n", (int)stb->layout_rows );
-  printf("layout_thumbsize          : %d\n", (int)stb->layout_thumbsize );
+  fprintf(fp, "layout_cols               : %d\n", (int)stb->layout_cols );
+  fprintf(fp, "layout_rows               : %d\n", (int)stb->layout_rows );
+  fprintf(fp, "layout_thumbsize          : %d\n", (int)stb->layout_thumbsize );
 
-  printf("stb_parttype              : %d\n", (int)stb->stb_parttype );
-  printf("stb_unique_id             : %d\n", (int)stb->stb_unique_id );
+  fprintf(fp, "stb_parttype              : %d\n", (int)stb->stb_parttype );
+  fprintf(fp, "stb_unique_id             : %d\n", (int)stb->stb_unique_id );
 
   GapStorySection *active_section;
 
@@ -352,11 +362,11 @@ gap_story_debug_print_list(GapStoryBoard *stb)
   {
     if(active_section->section_name == NULL)
     {
-      printf("\nSECTION_NAME is NULL (refers to MAIN section)\n");
+      fprintf(fp, "\nSECTION_NAME is NULL (refers to MAIN section)\n");
     }
     else
     {
-      printf("\nSECTION_NAME %s\n", active_section->section_name);
+      fprintf(fp, "\nSECTION_NAME %s\n", active_section->section_name);
     }
 
     ii = 0;
@@ -365,21 +375,21 @@ gap_story_debug_print_list(GapStoryBoard *stb)
       ii++;
       if(stb_elem->track == GAP_STB_MASK_TRACK_NUMBER)
       {
-        printf("\nMask-Element # (%03d)\n", (int)ii);
+        fprintf(fp, "\nMask-Element # (%03d)\n", (int)ii);
       }
       else
       {
-        printf("\nElement # (%03d)\n", (int)ii);
+        fprintf(fp, "\nElement # (%03d)\n", (int)ii);
       }
 
-      gap_story_debug_print_elem(stb_elem);
+      gap_story_debug_fprint_elem(fp, stb_elem);
     }
 
   }
 
-  printf("\ngap_story_debug_print_list:  END stb: %d\n", (int)stb);
-  fflush(stdout);
-}  /* end gap_story_debug_print_list */
+  fprintf(fp, "\ngap_story_debug_print_list:  END stb: %d\n", (int)stb);
+  fflush(fp);
+}  /* end gap_story_debug_fprint_list */
 
 
 /* -----------------------------
diff --git a/gap/gap_story_file.h b/gap/gap_story_file.h
index 467f1eb..901e480 100644
--- a/gap/gap_story_file.h
+++ b/gap/gap_story_file.h
@@ -330,6 +330,8 @@
   } GapStoryVideoFileRef;
 
 
+void                gap_story_debug_fprint_list(FILE *fp, GapStoryBoard *stb);
+void                gap_story_debug_fprint_elem(FILE *fp, GapStoryElem *stb_elem);
 void                gap_story_debug_print_list(GapStoryBoard *stb);
 void                gap_story_debug_print_elem(GapStoryElem *stb_elem);
 
diff --git a/gap/gap_story_undo.c b/gap/gap_story_undo.c
old mode 100755
new mode 100644
index fbadd42..ae50bed
--- a/gap/gap_story_undo.c
+++ b/gap/gap_story_undo.c
@@ -52,44 +52,44 @@ static void             p_free_undo_elem(GapStoryUndoElem    *undo_elem);
 static void             p_delete_redo_stack_area(GapStbTabWidgets *tabw);
 
 /* ----------------------------------------------------
- * gap_stb_undo_debug_print_stack
+ * gap_stb_undo_debug_fprint_stack
  * ----------------------------------------------------
  */
 void
-gap_stb_undo_debug_print_stack(GapStbTabWidgets *tabw)
+gap_stb_undo_debug_fprint_stack(FILE *fp, GapStbTabWidgets *tabw)
 {
   GapStoryUndoElem    *undo_elem;
 
   if(tabw == NULL)
   {
-    printf("\nStack NOT present (NULL POINTER)\n");
-    fflush(stdout);
+    fprintf(fp, "\nStack NOT present (NULL POINTER)\n");
+    fflush(fp);
     return;
   }
-  printf("\n-------------------------------- Top of STACK ---\n\n");
-  printf("gap_stb_undo_debug_print_stack: tabw:%d stack_list:%d stack_ptr:%d group_counter:%.2f\n"
+  fprintf(fp, "\n-------------------------------- Top of STACK ---\n\n");
+  fprintf(fp, "gap_stb_undo_debug_fprint_stack: tabw:%d stack_list:%d stack_ptr:%d group_counter:%.2f\n"
     , (int)tabw
     , (int)tabw->undo_stack_list
     , (int)tabw->undo_stack_ptr
     , (float)tabw->undo_stack_group_counter
     );
-  fflush(stdout);
+  fflush(fp);
 
   for(undo_elem = tabw->undo_stack_list; undo_elem != NULL; undo_elem = undo_elem->next)
   {
-    printf("  addr:%d fPtr:%d %s"
+    fprintf(fp, "  addr:%d fPtr:%d %s"
           , (int)undo_elem
           , (int)undo_elem->filenamePtr
           , gap_stb_undo_feature_to_string(undo_elem->feature_id)
           );
     if(undo_elem == tabw->undo_stack_ptr)
     {
-      printf(" <-- stack_ptr");
+      fprintf(fp, " <-- stack_ptr");
     }
     
     if(undo_elem->fileSnapshotBefore != NULL)
     {
-      printf(" (BEFORE: fname:%s size:%d mtime:%d)"
+      fprintf(fp, " (BEFORE: fname:%s size:%d mtime:%d)"
             ,undo_elem->fileSnapshotBefore->filename
             ,(int)undo_elem->fileSnapshotBefore->filesize
             ,(int)undo_elem->fileSnapshotBefore->mtimefile
@@ -97,21 +97,21 @@ gap_stb_undo_debug_print_stack(GapStbTabWidgets *tabw)
     }
     if(undo_elem->fileSnapshotAfter != NULL)
     {
-      printf(" (AFTER: fname:%s size:%d mtime:%d)"
+      fprintf(fp, " (AFTER: fname:%s size:%d mtime:%d)"
             ,undo_elem->fileSnapshotAfter->filename
             ,(int)undo_elem->fileSnapshotAfter->filesize
             ,(int)undo_elem->fileSnapshotAfter->mtimefile
             );
     }
     
-    printf("\n");
-    fflush(stdout);
+    fprintf(fp, "\n");
+    fflush(fp);
   }
 
-  printf("\n-------------------------------- End of STACK ---\n\n");
-  fflush(stdout);
+  fprintf(fp, "\n-------------------------------- End of STACK ---\n\n");
+  fflush(fp);
 
-}  /* end gap_stb_undo_debug_print_stack */
+}  /* end gap_stb_undo_debug_fprint_stack */
 
 
 /* ----------------------------------------------------
diff --git a/gap/gap_story_undo.h b/gap/gap_story_undo.h
old mode 100755
new mode 100644
index af76851..da136ed
--- a/gap/gap_story_undo.h
+++ b/gap/gap_story_undo.h
@@ -36,7 +36,7 @@
 #include "gap_story_file.h"
 #include "gap_story_undo_types.h"
 
-void                    gap_stb_undo_debug_print_stack(GapStbTabWidgets *tabw);
+void                    gap_stb_undo_debug_fprint_stack(FILE *fp, GapStbTabWidgets *tabw);
 const char *            gap_stb_undo_feature_to_string(GapStoryFeatureEnum feature_id);
 GapStoryBoard *         gap_stb_undo_pop(GapStbTabWidgets *tabw);
 GapStoryBoard *         gap_stb_undo_redo(GapStbTabWidgets *tabw);
@@ -57,4 +57,4 @@ const char *            gap_stb_undo_get_undo_feature(GapStbTabWidgets *tabw);
 const char *            gap_stb_undo_get_redo_feature(GapStbTabWidgets *tabw);
 void                    gap_stb_undo_stack_set_unsaved_changes(GapStbTabWidgets *tabw);
 
-#endif 
+#endif
diff --git a/gap/gap_story_vthumb.c b/gap/gap_story_vthumb.c
index 3a70f30..2984653 100644
--- a/gap/gap_story_vthumb.c
+++ b/gap/gap_story_vthumb.c
@@ -63,7 +63,8 @@ static gint32 global_stb_video_id = 0;
 
 
 static void                    p_debug_print_vthumbs_refering_video_id(
-                                  GapVThumbElem *vthumb_list
+                                  FILE *fp
+                                  , GapVThumbElem *vthumb_list
                                   , gint32 video_id
                                   );
 static gboolean               p_vid_progress_callback(gdouble progress
@@ -85,56 +86,57 @@ static GapVThumbElem *         p_new_vthumb(gint32 video_id
  * to stdout (typical used for logging and debug purpose)
  */
 static void
-p_debug_print_vthumbs_refering_video_id(GapVThumbElem *vthumb_list, gint32 video_id)
+p_debug_print_vthumbs_refering_video_id(FILE *fp, GapVThumbElem *vthumb_list, gint32 video_id)
 {
   GapVThumbElem *vthumb_elem;
 
-  printf("        vthumbs: [");  
+  fprintf(fp, "        vthumbs: [");  
   for(vthumb_elem = vthumb_list; vthumb_elem != NULL; vthumb_elem = vthumb_elem->next)
   {
     if(vthumb_elem->video_id == video_id)
     {
-      printf(" %06d", (int)vthumb_elem->framenr);
+      fprintf(fp, " %06d", (int)vthumb_elem->framenr);
     }
   }
-  printf("]\n");  
+  fprintf(fp, "]\n");  
   
 }  /* end p_debug_print_vthumbs_refering_video_id */
 
+
 /* --------------------------------------
- * gap_story_vthumb_debug_print_videolist
+ * gap_story_vthumb_debug_fprint_videolist
  * --------------------------------------
  * print the list of video elements
  * to stdout (typical used for logging and debug purpose)
  */
 void
-gap_story_vthumb_debug_print_videolist(GapStoryVTResurceElem *video_list, GapVThumbElem *vthumb_list)
+gap_story_vthumb_debug_fprint_videolist(FILE *fp, GapStoryVTResurceElem *video_list, GapVThumbElem 
*vthumb_list)
 {
   GapStoryVTResurceElem *velem;
   gint ii;
   
-  printf("gap_story_vthumb_debug_print_videolist: START\n");
+  fprintf(fp, "gap_story_vthumb_debug_fprint_videolist: START\n");
   ii = 0;
   for(velem=video_list; velem != NULL; velem = velem->next)
   {
     const char *filename;
     
-    printf(" [%03d] ", (int)ii);
+    fprintf(fp, " [%03d] ", (int)ii);
     switch(velem->vt_type)
     {
       case GAP_STB_VLIST_MOVIE:
-        printf("GAP_STB_VLIST_MOVIE:");
+        fprintf(fp, "GAP_STB_VLIST_MOVIE:");
         break;
       case GAP_STB_VLIST_SECTION:
-        printf("GAP_STB_VLIST_SECTION: section_id:%d"
+        fprintf(fp, "GAP_STB_VLIST_SECTION: section_id:%d"
              , (int)velem->section_id
              );
         break;
       case GAP_STB_VLIST_ANIM_IMAGE:
-        printf("GAP_STB_VLIST_ANIM_IMAGE:");
+        fprintf(fp, "GAP_STB_VLIST_ANIM_IMAGE:");
         break;
       default:
-        printf("** Type Unknown **:");
+        fprintf(fp, "** Type Unknown **:");
         break;
     }
     
@@ -147,7 +149,7 @@ gap_story_vthumb_debug_print_videolist(GapStoryVTResurceElem *video_list, GapVTh
       filename = "(null)";
     }
     
-    printf(" total_frames:%d version:%d video_id:%d name:%s\n"
+    fprintf(fp, " total_frames:%d version:%d video_id:%d name:%s\n"
       , (int)velem->total_frames
       , (int)velem->version
       , (int)velem->video_id
@@ -155,13 +157,13 @@ gap_story_vthumb_debug_print_videolist(GapStoryVTResurceElem *video_list, GapVTh
       );
     if (vthumb_list != NULL)
     {
-      p_debug_print_vthumbs_refering_video_id(vthumb_list, velem->video_id);
+      p_debug_print_vthumbs_refering_video_id(fp, vthumb_list, velem->video_id);
     }
     ii++;
   }
-  printf("gap_story_vthumb_debug_print_videolist: END\n");
+  fprintf(fp, "gap_story_vthumb_debug_fprint_videolist: END\n");
   
-}  /* end gap_story_vthumb_debug_print_videolist */
+}  /* end gap_story_vthumb_debug_fprint_videolist */
 
 
 /* --------------------------------
diff --git a/gap/gap_story_vthumb.h b/gap/gap_story_vthumb.h
index b9ccb3a..9018823 100644
--- a/gap/gap_story_vthumb.h
+++ b/gap/gap_story_vthumb.h
@@ -34,7 +34,7 @@
 #include "gap_story_main.h"
 
 
-void     gap_story_vthumb_debug_print_videolist(GapStoryVTResurceElem *video_list, GapVThumbElem 
*vthumb_list);
+void     gap_story_vthumb_debug_fprint_videolist(FILE *fp, GapStoryVTResurceElem *video_list, GapVThumbElem 
*vthumb_list);
 void     gap_story_vthumb_close_videofile(GapStbMainGlobalParams *sgpp);
 void     gap_story_vthumb_open_videofile(GapStbMainGlobalParams *sgpp
                      , const char *filename
diff --git a/gap/gap_vex_dialog.c b/gap/gap_vex_dialog.c
index e5eb972..8fcdc4c 100644
--- a/gap/gap_vex_dialog.c
+++ b/gap/gap_vex_dialog.c
@@ -164,7 +164,8 @@ static GtkWidget* create_fsa__fileselection (GapVexMainGlobalParams *gpp);
 
 
 
-
+#define DEFAULT_BASENAME "frame_"
+#define DEFAULT_STORYBASENAME "STORYBOARD.txt"
 
 /* ------------------------
  * gap_vex_dlg_init_gpp
@@ -178,7 +179,7 @@ gap_vex_dlg_init_gpp (GapVexMainGlobalParams *gpp)
  /* set initial values in val */
 
  g_snprintf(gpp->val.videoname, sizeof(gpp->val.videoname), "TEST.MPG");
- g_snprintf(gpp->val.basename, sizeof(gpp->val.basename), "frame_");
+ g_snprintf(gpp->val.basename, sizeof(gpp->val.basename), DEFAULT_BASENAME);
  g_snprintf(gpp->val.extension, sizeof(gpp->val.extension), ".xcf");
  g_snprintf(gpp->val.audiofile, sizeof(gpp->val.audiofile), "frame.wav");
  gpp->val.basenum = 0;
@@ -405,6 +406,12 @@ p_update_wgt_sensitivity(GapVexMainGlobalParams *gpp)
   if((gpp->val.multilayer == 0) && (sensitive_vid))
   {
       sensitive = TRUE;  /* we want to extract to frame files on disc */
+
+      if((gpp->mw__entry_basename)
+      && (strcmp(gpp->val.basename, DEFAULT_STORYBASENAME) == 0))
+      {
+        gtk_entry_set_text(GTK_ENTRY(gpp->mw__entry_basename), DEFAULT_BASENAME);
+      }
   }
   else
   {
@@ -415,6 +422,20 @@ p_update_wgt_sensitivity(GapVexMainGlobalParams *gpp)
   gtk_widget_set_sensitive(gpp->mw__spinbutton_fn_digits, sensitive);
   gtk_widget_set_sensitive(gpp->mw__entry_extension, sensitive);
 
+  if((gpp->val.multilayer == 2) && (sensitive_vid))
+  {
+    sensitive = TRUE;  /* we want to extract to frame files on disc */
+    gtk_widget_set_sensitive(gpp->mw__entry_basename, sensitive);
+    gtk_widget_set_sensitive(gpp->mw__button_basename, sensitive);
+    
+    if((gpp->mw__entry_basename)
+    && (strcmp(gpp->val.basename, DEFAULT_BASENAME) == 0))
+    {
+      gtk_entry_set_text(GTK_ENTRY(gpp->mw__entry_basename), DEFAULT_STORYBASENAME);
+    }
+  }
+
+
 
   if((gpp->val.audiotrack > 0)
   && (gpp->val.chk_atracks > 0)
diff --git a/gap/gap_vex_exec.c b/gap/gap_vex_exec.c
index b5ebee6..4bf4886 100644
--- a/gap/gap_vex_exec.c
+++ b/gap/gap_vex_exec.c
@@ -282,10 +282,16 @@ p_vex_exe_create_storyboard_from_videorange(GapVexMainGlobalParams *gpp)
   l_record_type_int = 0;     /* 0: video, 1:image, 2:frame images, 3:anim image */
   l_nloop = 1;
 
-  l_storyboard_filename = g_strdup_printf("STORY_%s.txt", gpp->val.basename);
+  l_storyboard_filename = g_strdup_printf("%s", gpp->val.basename);
   l_from_frame = gpp->val.begin_frame;
   l_to_frame = gpp->val.end_frame;
 
+
+  if(gap_debug)
+  {
+    printf("VEX: l_storyboard_filename:%s\n", l_storyboard_filename); 
+  }
+
   /* call the stroryboard plug-in */
   l_params = gimp_run_procedure (GAP_STORY_PLUG_IN_PROC_CREATION,
                                  &l_retvals,


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