[gimp-gap] fixed endless loop in video index creation



commit 95890c48aa6b132ec13c70bfc801481aa7cb58ff
Author: Wolfgang Hofer <wolfgangh svn gnome org>
Date:   Thu Feb 27 18:18:06 2014 +0100

    fixed endless loop in video index creation

 ChangeLog                         |   17 +++++++++++++++++
 gap/gap_player_dialog.c           |    8 ++++++++
 gap/gap_video_index_creator.c     |   14 +++++++++++++-
 libgapvidapi/gap_vid_api_ffmpeg.c |   21 ++++++++++++++++++---
 4 files changed, 56 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index fa40097..c823fed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2014-02-27 Wolfgang Hofer <hof gimp org>
+
+- fixed bug in the GAP video API that caused endless loop in
+  ffmpeg based video index creation.
+  (p_wrapper_ffmpeg_get_next_frame retcode was not returned to the caller !)
+
+- video index creator and player dialog:
+    video index creation now shows the current frame count in the progress bar.
+    This is done because the total number of frames to process is just a guess
+    and the percentage is kept at constant level if there are (much) more frames to process
+    (than assumed in the initial guess.)
+
+  * libgapvidapi/gap_vid_api_ffmpeg.c
+  * gap/gap_player_dialog.c
+  * gap/gap_video_index_creator.c
+
+
 2014-02-22 Wolfgang Hofer <hof gimp org>
 
 
diff --git a/gap/gap_player_dialog.c b/gap/gap_player_dialog.c
index e20325a..7d849fc 100644
--- a/gap/gap_player_dialog.c
+++ b/gap/gap_player_dialog.c
@@ -2686,6 +2686,14 @@ p_vid_progress_callback(gdouble progress
   }
 
   gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(gpp->progress_bar), progress);
+  if((gpp->vindex_creation_is_running)
+  && (gpp->gvahand != NULL))
+  {
+     gchar *progressMsg;
+     progressMsg = g_strdup_printf(_("Creating Index %d"), (int)gpp->gvahand->frame_counter);
+     gtk_progress_bar_set_text(GTK_PROGRESS_BAR(gpp->progress_bar), progressMsg);
+     g_free(progressMsg);
+  }
 
   /* g_main_context_iteration makes sure that
    *  gtk does refresh widgets,  and react on events while the videoapi
diff --git a/gap/gap_video_index_creator.c b/gap/gap_video_index_creator.c
index e997315..efe4c6c 100644
--- a/gap/gap_video_index_creator.c
+++ b/gap/gap_video_index_creator.c
@@ -1588,7 +1588,19 @@ p_vid_progress_callback(gdouble progress
                                 );
         break;
       case FULLSCAN_MODE:
-        message = g_strdup_printf(_("Creating video index %0.3f %%"), progress * 100.0);
+        if (vipp->gvahand == NULL)
+        {
+          message = g_strdup_printf(_("Creating video index %0.3f %%")
+                                     , progress * 100.0
+                                     );
+        }
+        else
+        {
+          message = g_strdup_printf(_("Creating video index %0.3f %% (%d)")
+                                   , progress * 100.0
+                                   , (int)vipp->gvahand->frame_counter
+                                   );
+        }
         break;
       default:
         message = g_strdup_printf("%0.3f %%", progress * 100.0);
diff --git a/libgapvidapi/gap_vid_api_ffmpeg.c b/libgapvidapi/gap_vid_api_ffmpeg.c
index 28d6f20..d7c05d2 100644
--- a/libgapvidapi/gap_vid_api_ffmpeg.c
+++ b/libgapvidapi/gap_vid_api_ffmpeg.c
@@ -847,7 +847,7 @@ p_wrapper_ffmpeg_get_video_chunk(t_GVA_Handle  *gvahand
 static t_GVA_RetCode
 p_wrapper_ffmpeg_get_next_frame(t_GVA_Handle *gvahand)
 {
-  p_private_ffmpeg_get_next_frame(gvahand, FALSE);
+  return (p_private_ffmpeg_get_next_frame(gvahand, FALSE));
 }  /* end  p_wrapper_ffmpeg_get_next_frame*/
 
 
@@ -1496,8 +1496,19 @@ p_private_ffmpeg_get_next_frame(t_GVA_Handle *gvahand, gboolean do_copy_raw_chun
 
   GAP_TIMM_STOP_FUNCTION(funcId);
 
-  if(l_rc == 1)  { return(GVA_RET_EOF); }
+  if(l_rc == 1)
+  {
+    if(gap_debug)
+    {
+      printf("p_private_ffmpeg_get_next_frame: returning %d GVA_RET_EOF\n", (int)GVA_RET_EOF);
+    } 
+    return(GVA_RET_EOF);
+  }
 
+  if(gap_debug)
+  {
+    printf("p_private_ffmpeg_get_next_frame: returning %d GVA_RET_ERROR\n", (int)GVA_RET_ERROR);
+  } 
   return(GVA_RET_ERROR);
 }  /* end p_private_ffmpeg_get_next_frame */
 
@@ -3454,9 +3465,13 @@ p_wrapper_ffmpeg_count_frames(t_GVA_Handle *gvahand)
     {
        /* READ FRAME */
        l_rc = p_wrapper_ffmpeg_get_next_frame(copy_gvahand);
+       if(gap_debug)
+       {
+         printf("p_wrapper_ffmpeg_count_frames: get_next l_rc:%d\n", (int)l_rc);
+       }
        if(l_rc != GVA_RET_OK)
        {
-          break;  /* eof, or fetch error */
+         break;  /* eof, or fetch error */
        }
        gvahand->frame_counter++;
        l_total_frames = MAX(l_total_frames, gvahand->frame_counter);


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