gimp-gap r821 - in trunk: . gap libgapvidapi libwavplayclient



Author: wolfgangh
Date: Thu Mar 12 20:00:34 2009
New Revision: 821
URL: http://svn.gnome.org/viewvc/gimp-gap?rev=821&view=rev

Log:
sox options, vidapi optimized near-frame seek and attempt to fix #558730)

Modified:
   trunk/ChangeLog
   trunk/gap/gap_story_render_audio.c
   trunk/gap/gap_story_sox.c
   trunk/gap/gap_story_sox.h
   trunk/gap/gap_wr_opacity.c
   trunk/gap/gap_wr_resynth.c
   trunk/libgapvidapi/gap_vid_api.c
   trunk/libwavplayclient/audioconvert_to_wav.sh

Modified: trunk/gap/gap_story_render_audio.c
==============================================================================
--- trunk/gap/gap_story_render_audio.c	(original)
+++ trunk/gap/gap_story_render_audio.c	Thu Mar 12 20:00:34 2009
@@ -634,6 +634,8 @@
   l_peak_posr = 0.0;
   l_peak_negl = 0.0;
   l_peak_negr = 0.0;
+  l_sample_left = 0.0;
+  l_sample_right = 0.0;
 
   l_master_scale = vidhand->master_volume;
 
@@ -1571,6 +1573,8 @@
 /* -------------------------------------------------
  * gap_story_render_audio_create_composite_audiofile
  * -------------------------------------------------
+ * create the composite audio as mix of all audio channels
+ * and write result to file in WAV format.
  */
 gboolean
 gap_story_render_audio_create_composite_audiofile(GapStoryRenderVidHandle *vidhand
@@ -1598,7 +1602,7 @@
 
   if(gap_debug)
   {
-    printf("gap_story_render_audio_create_composite_audiofile CHECKING AUDIO PEAKS\n"
+    printf("gap_story_render_audio_create_composite_audiofile CHECKING AUDIO PEAKS %s\n"
        , comp_audiofile);
   }
 
@@ -1606,7 +1610,7 @@
 
   if(gap_debug)
   {
-    printf("gap_story_render_audio_create_composite_audiofile WRITE COMPOSITE AUDIO FILE\n"
+    printf("gap_story_render_audio_create_composite_audiofile WRITE COMPOSITE AUDIO FILE %s\n"
        , comp_audiofile);
   }
 

Modified: trunk/gap/gap_story_sox.c
==============================================================================
--- trunk/gap/gap_story_sox.c	(original)
+++ trunk/gap/gap_story_sox.c	Thu Mar 12 20:00:34 2009
@@ -28,6 +28,8 @@
 #include "gap-intl.h"
 
 
+extern int gap_debug;  /* 1 == print debug infos , 0 dont print debug infos */
+
 /* --------------------------------
  * gap_story_sox_exec_resample
  * --------------------------------
@@ -62,6 +64,12 @@
            , util_sox
            , util_sox_options
 	   );
+
+  if(gap_debug)
+  {
+    printf("Execute resample CMD:%s\n", l_cmd);
+  }
+
   system(l_cmd);
   g_free(l_cmd);
 }  /* end gap_story_sox_exec_resample */

Modified: trunk/gap/gap_story_sox.h
==============================================================================
--- trunk/gap/gap_story_sox.h	(original)
+++ trunk/gap/gap_story_sox.h	Thu Mar 12 20:00:34 2009
@@ -30,7 +30,7 @@
 #include "libgimp/gimp.h"
 
 #define GAP_STORY_SOX_DEFAULT_UTIL_SOX           "sox"
-#define GAP_STORY_SOX_DEFAULT_UTIL_SOX_OPTIONS   " \"$IN\"  -w -r $RATE \"$OUT\" resample "
+#define GAP_STORY_SOX_DEFAULT_UTIL_SOX_OPTIONS   " \"$IN\"  -t wav  \"$OUT\" rate -h $RATE "
 
 void   gap_story_sox_exec_resample(char *in_audiofile
                       ,char *out_audiofile

Modified: trunk/gap/gap_wr_opacity.c
==============================================================================
--- trunk/gap/gap_wr_opacity.c	(original)
+++ trunk/gap/gap_wr_opacity.c	Thu Mar 12 20:00:34 2009
@@ -42,7 +42,7 @@
 #include "gap-intl.h"
 
 /* Defines */
-#define PLUG_IN_NAME        "plug_in_wr_set_opacity"
+#define PLUG_IN_NAME        "plug-in-wr-set-opacity"
 #define PLUG_IN_PRINT_NAME  "Name to Layer"
 #define PLUG_IN_IMAGE_TYPES "RGB*, INDEXED*, GRAY*"
 #define PLUG_IN_AUTHOR      "Wolfgang Hofer (hof gimp org)"
@@ -97,9 +97,12 @@
                   { GIMP_PDB_INT32,    "mode", "0..set opacity, 1..ADD opacity to old opacity value, 2..subtract opacity from old opacity value, 3..multiply"},
   };
 
+static GimpParamDef return_vals[] = {
+    { GIMP_PDB_DRAWABLE, "the_drawable", "the handled drawable" }
+};
 
 static gint global_number_in_args = G_N_ELEMENTS (in_args);
-static gint global_number_out_args = 0;
+static gint global_number_out_args = G_N_ELEMENTS (return_vals);
 
 
 /* Functions */
@@ -141,15 +144,15 @@
                           global_number_in_args,
                           global_number_out_args,
                           in_args,
-                          NULL);
+                          return_vals);
   {
     /* Menu names */
-    const char *menupath_image_video_layer = N_("<Image>/Video/Layer/");
+    const char *menupath_image_video_layer_attr = N_("<Image>/Video/Layer/Attributes/");
 
     //gimp_plugin_menu_branch_register("<Image>", "Video");
     //gimp_plugin_menu_branch_register("<Image>/Video", "Layer");
 
-    gimp_plugin_menu_register (PLUG_IN_NAME, menupath_image_video_layer);
+    gimp_plugin_menu_register (PLUG_IN_NAME, menupath_image_video_layer_attr);
   }
 
 }  /* end query */
@@ -190,7 +193,7 @@
   values[0].data.d_status = status;
   values[1].type = GIMP_PDB_DRAWABLE;
   values[1].data.d_drawable = -1;
-  *nreturn_vals = 1;
+  *nreturn_vals = 2;
   *return_vals = values;
 
 
@@ -331,6 +334,7 @@
   argv[ii].flt_min   = 0.0;
   argv[ii].flt_max   = 100.0;
   argv[ii].flt_ret   = (gint)glob_vals.opacity;
+  argv[ii].flt_step  =  1.0;
   argv[ii].entry_width = 80;
   argv[ii].has_default = TRUE;
   argv[ii].flt_default = 100.0;

Modified: trunk/gap/gap_wr_resynth.c
==============================================================================
--- trunk/gap/gap_wr_resynth.c	(original)
+++ trunk/gap/gap_wr_resynth.c	Thu Mar 12 20:00:34 2009
@@ -46,7 +46,7 @@
 #include "gap-intl.h"
 
 /***** Macro definitions  *****/
-#define PLUG_IN_PROC        "plug_in_wr_resynth"
+#define PLUG_IN_PROC        "plug-in-wr-resynth"
 #define PLUG_IN_VERSION     "0.16"
 #define PLUG_IN_AUTHOR      "Wolfgang Hofer (hof gimp org)"
 #define PLUG_IN_COPYRIGHT   "Wolfgang Hofer"
@@ -117,9 +117,12 @@
     { GIMP_PDB_INT32,    "seed",                 "seed for random numbers (use -1 to init with current time)"     }
   };
 
+static GimpParamDef return_vals[] = {
+    { GIMP_PDB_DRAWABLE, "the_drawable", "the handled drawable" }
+};
 
 static gint global_number_in_args = G_N_ELEMENTS (in_args);
-static gint global_number_out_args = 0;
+static gint global_number_out_args = G_N_ELEMENTS (return_vals);
 
 /* Global Variables */
 int gap_debug = 0;  /* 1 == print debug infos , 0 dont print debug infos */
@@ -173,7 +176,7 @@
                           "RGB*, GRAY*",
                           GIMP_PLUGIN,
                           global_number_in_args, global_number_out_args,
-                          in_args, NULL);
+                          in_args, return_vals);
 
   {
     /* Menu names */
@@ -222,7 +225,7 @@
   values[0].data.d_status = status;
   values[1].type = GIMP_PDB_DRAWABLE;
   values[1].data.d_drawable = -1;
-  *nreturn_vals = 1;
+  *nreturn_vals = 2;
   *return_vals = values;
 
 

Modified: trunk/libgapvidapi/gap_vid_api.c
==============================================================================
--- trunk/libgapvidapi/gap_vid_api.c	(original)
+++ trunk/libgapvidapi/gap_vid_api.c	Thu Mar 12 20:00:34 2009
@@ -2784,12 +2784,39 @@
 
   if(frame_data == NULL)
   {
-    if(framenumber != gvahand->current_frame_nr +1)
+    gint32 l_delta;
+    gint32 l_readsteps;
+    
+    l_readsteps = 1;
+    l_delta = framenumber - gvahand->current_frame_nr;
+    l_rc = GVA_RET_OK;
+
+    if((l_delta >= 1) && (l_delta <= 10))
+    {
+      /* target framenumber is very near to the current_frame_nr
+       * in this case positioning via sequential read is faster than seek
+       */
+      l_readsteps = l_delta;
+    }
+    else
     {
       l_rc = GVA_seek_frame(gvahand, framenumber, GVA_UPOS_FRAMES);
     }
 
-    l_rc = GVA_get_next_frame(gvahand);
+    while ((l_readsteps > 0) && (l_rc == GVA_RET_OK))
+    {
+      l_rc = GVA_get_next_frame(gvahand);
+      if(gap_debug)
+      {
+        printf("GVA_fetch_frame_to_buffer: l_readsteps:%d framenumber;%d curr:%d l_rc:%d\n"
+          , (int)l_readsteps
+          , (int)framenumber
+          , (int)gvahand->current_frame_nr
+          , (int)l_rc
+          );
+      }
+      l_readsteps--;
+    }
 
     if(l_rc == GVA_RET_OK)
     {

Modified: trunk/libwavplayclient/audioconvert_to_wav.sh
==============================================================================
--- trunk/libwavplayclient/audioconvert_to_wav.sh	(original)
+++ trunk/libwavplayclient/audioconvert_to_wav.sh	Thu Mar 12 20:00:34 2009
@@ -127,9 +127,9 @@
 
 if [ "x$RESAMPLE_RATE" = "x" ]
 then 
-  $SOX  "$IN_FILE"  -w  "$OUT_FILE"
+  $SOX  "$IN_FILE"  -t wav  "$OUT_FILE"
 else
-  $SOX  "$IN_FILE"  -w -r $RESAMPLE_RATE "$OUT_FILE" resample
+  $SOX  "$IN_FILE"  -t wav  "$OUT_FILE" rate -h $RESAMPLE_RATE
 fi
 
 if [ -s "$OUT_FILE" ]
@@ -145,7 +145,7 @@
 else
    TMP_WAV="${IN_FILE}.tmp_mp3_to.wav"
    $LAME  --decode "$IN_FILE" "$TMP_WAV"
-   $SOX  "$TMP_WAV"  -w -r $RESAMPLE_RATE "$OUT_FILE" resample
+   $SOX  "$TMP_WAV"  -t wav "$OUT_FILE" rate -h $RESAMPLE_RATE
    rm -f "$TMP_WAV"
 fi
 



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