gimp-gap r807 - in trunk: . gap libgapvidutil vid_common
- From: wolfgangh svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp-gap r807 - in trunk: . gap libgapvidutil vid_common
- Date: Sun, 25 Jan 2009 12:24:13 +0000 (UTC)
Author: wolfgangh
Date: Sun Jan 25 12:24:13 2009
New Revision: 807
URL: http://svn.gnome.org/viewvc/gimp-gap?rev=807&view=rev
Log:
fixes in storyboard dialog and master videoencoder prgress relevant for port to GIMP-2.6
Modified:
trunk/ChangeLog
trunk/gap/gap_story_dialog.c
trunk/gap/gap_story_file.c
trunk/gap/gap_story_properties.c
trunk/libgapvidutil/gap_gve_misc_util.c
trunk/libgapvidutil/gap_gve_misc_util.h
trunk/vid_common/gap_cme_callbacks.c
trunk/vid_common/gap_cme_gui.c
trunk/vid_common/gap_cme_main.c
trunk/vid_common/gap_cme_main.h
Modified: trunk/gap/gap_story_dialog.c
==============================================================================
--- trunk/gap/gap_story_dialog.c (original)
+++ trunk/gap/gap_story_dialog.c Sun Jan 25 12:24:13 2009
@@ -118,6 +118,7 @@
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 void p_get_begin_and_end_for_single_clip_playback(gint32 *begin_frame, gint32 *end_frame, GapStoryElem *stb_elem);
static void on_stb_elem_drag_begin (GtkWidget *widget,
@@ -519,6 +520,32 @@
+/* ---------------------------------------------
+ * p_get_begin_and_end_for_single_clip_playback
+ * ---------------------------------------------
+ */
+static void
+p_get_begin_and_end_for_single_clip_playback(gint32 *begin_frame, gint32 *end_frame, GapStoryElem *stb_elem)
+{
+ *begin_frame = stb_elem->from_frame;
+ *end_frame = stb_elem->to_frame;
+
+ if(stb_elem->record_type == GAP_STBREC_VID_IMAGE)
+ {
+ char *l_basename;
+ long l_number;
+
+ l_basename = gap_lib_alloc_basename(stb_elem->orig_filename, &l_number);
+ g_free(l_basename);
+ *begin_frame = l_number;
+ *end_frame = l_number;
+
+ }
+} /* end p_get_begin_and_end_for_single_clip_playback */
+
+
+
+
/* -----------------------------
* p_thumbsize_to_index
* -----------------------------
@@ -1308,13 +1335,30 @@
{
gint32 l_image_id;
- l_image_id = gap_lib_load_image(fw->frame_filename);
+ l_image_id = -1;
+
+ /* skip attempt to render thubnail from full image in case cliptype is a movie
+ * (attempts to load movie filetyes unsupported by the gimp core do result in annoying
+ * GIMP error messages since GIMP-2.6.x, and do not make sense anyway.)
+ */
+ if((fw->stb_elem_refptr->record_type != GAP_STBREC_VID_MOVIE)
+ && (fw->stb_elem_refptr->record_type != GAP_STBREC_VID_SECTION))
+ {
+ if(gap_debug)
+ {
+ printf("p_frame_widget_render: call gap_lib_load_image to get THUMBNAIL for:%s\n", fw->frame_filename);
+ }
+ l_image_id = gap_lib_load_image(fw->frame_filename);
+ }
if (l_image_id < 0)
{
/* could not read the image
*/
- if(gap_debug) printf("p_frame_widget_render: fetch failed, using DEFAULT_ICON\n");
+ if(gap_debug)
+ {
+ printf("p_frame_widget_render: fetch failed, using DEFAULT_ICON\n");
+ }
gap_story_dlg_render_default_icon(fw->stb_elem_refptr, fw->pv_ptr);
}
else
@@ -1617,7 +1661,7 @@
player_stb_in_track = -1; /* force composite playback in the player */
}
- //if(gap_debug)
+ if(gap_debug)
{
printf("\n\n\n\n\n\n\n\n\np_story_call_player:"
" play_all:%d stb_composite:%d stb_in_track:%d begin:%d end:%d\n"
@@ -1676,7 +1720,7 @@
stb->active_section
, MAX(1, stb_in_track));
- //if(gap_debug)
+ if(gap_debug)
{
gap_story_debug_print_mapping(stb_dup->mapping);
fflush(stdout);
@@ -2442,7 +2486,7 @@
GapStbMainGlobalParams *sgpp)
{
- //if(gap_debug)
+ if(gap_debug)
{
if(w != NULL)
{
@@ -3205,7 +3249,10 @@
{
GapStbMainGlobalParams *sgpp;
- if(gap_debug) printf("CB: p_cliptarget_togglebutton_toggled_cb: %d\n", (int)togglebutton);
+ if(gap_debug)
+ {
+ printf("CB: p_cliptarget_togglebutton_toggled_cb: %d\n", (int)togglebutton);
+ }
if(clip_target_ptr)
{
@@ -3242,10 +3289,17 @@
tabw = (GapStbTabWidgets *)pw->tabw;
sgpp = pw->sgpp;
+ if(gap_debug)
+ {
+ printf("CALLING Player from clip properties\n");
+ }
+
if((tabw) && (sgpp))
{
gint32 imagewidth;
gint32 imageheight;
+ gint32 l_begin_frame;
+ gint32 l_end_frame;
imagewidth = tabw->thumb_width;
imageheight = tabw->thumb_height;
@@ -3259,6 +3313,7 @@
}
+ 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
,NULL /* No storyboard pointer */
@@ -3267,8 +3322,8 @@
,imageheight
,aspect_ratio
,-1 /* image_id (unused in imagename based playback mode) */
- ,pw->stb_elem_refptr->from_frame /* play from */
- ,pw->stb_elem_refptr->to_frame /* play until */
+ ,l_begin_frame /* play from */
+ ,l_end_frame /* play until */
,TRUE /* play all */
,pw->stb_elem_refptr->seltrack
,pw->stb_elem_refptr->delace
@@ -3432,6 +3487,7 @@
tabw = (GapStbTabWidgets *)fw->tabw;
sgpp = fw->sgpp;
+
if((tabw) && (sgpp))
{
if(fw->stb_elem_refptr)
@@ -3442,6 +3498,10 @@
gint32 imageheight;
gdouble aspect_ratio;
+ if(gap_debug)
+ {
+ printf("CALLING Player from single clip\n");
+ }
imagewidth = tabw->thumb_width;
imageheight = tabw->thumb_height;
@@ -3487,7 +3547,24 @@
}
else
{
+ gint32 l_begin_frame;
+ gint32 l_end_frame;
+
+ p_get_begin_and_end_for_single_clip_playback(&l_begin_frame, &l_end_frame, fw->stb_elem_refptr);
imagename = gap_story_get_filename_from_elem(fw->stb_elem_refptr);
+
+ if(gap_debug)
+ {
+ printf("CALLING Player from single clip imagename:%s\n from:%d (%d) to:%d (%d) type:%d\n orig_filename:%s\n\n"
+ , imagename
+ ,(int)fw->stb_elem_refptr->from_frame
+ ,(int)l_begin_frame
+ ,(int)fw->stb_elem_refptr->to_frame
+ ,(int)l_end_frame
+ ,(int)fw->stb_elem_refptr->record_type
+ , fw->stb_elem_refptr->orig_filename
+ );
+ }
p_story_call_player(fw->sgpp
,NULL /* No storyboard pointer */
,imagename
@@ -3495,8 +3572,8 @@
,imageheight
,aspect_ratio
,-1 /* image_id (unused in imagename based playback mode) */
- ,fw->stb_elem_refptr->from_frame /* play from */
- ,fw->stb_elem_refptr->to_frame /* play until */
+ ,l_begin_frame /* play from */
+ ,l_end_frame /* play until */
,TRUE /* play all */
,fw->stb_elem_refptr->seltrack
,fw->stb_elem_refptr->delace
@@ -6518,7 +6595,7 @@
return;
}
- //if(gap_debug)
+ if(gap_debug)
{
printf("p_prefetch_vthumbs : stb: %d\n"
,(int)stb
@@ -6554,7 +6631,7 @@
_("videothumbnail cancelled"));
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(sgpp->progress_bar_master), 0);
}
- //if(gap_debug)
+ if(gap_debug)
{
printf("p_prefetch_vthumbs : (1) videothumbnail cancelled: cancel_video_api: %d auto_vthumb_refresh_canceled:%d auto_vthumb:%d\n"
,(int)sgpp->cancel_video_api
@@ -6593,7 +6670,7 @@
*/
if (sgpp->vthumb_prefetch_in_progress != GAP_VTHUMB_PREFETCH_IN_PROGRESS)
{
- //if(gap_debug)
+ if(gap_debug)
{
printf("p_prefetch_vthumbs: prefetch PROGRESS interrupt occured\n");
}
@@ -6610,7 +6687,7 @@
}
}
- //if(gap_debug)
+ if(gap_debug)
{
printf("p_prefetch_vthumbs : Loop done\n");
}
@@ -6674,7 +6751,7 @@
static gboolean refreshRequired = FALSE;
- //if(gap_debug)
+ if(gap_debug)
{
printf("p_optimized_prefetch_vthumbs\n");
}
@@ -6707,7 +6784,7 @@
option_restart = TRUE;
- //if(gap_debug)
+ if(gap_debug)
{
printf("p_optimized_prefetch_vthumbs vthumb_prefetch_in_progress"
" (0 NOTACTIVE, 1 PROGRESS, 2 RESTART, 3 CANCEL) value:%d\n"
Modified: trunk/gap/gap_story_file.c
==============================================================================
--- trunk/gap/gap_story_file.c (original)
+++ trunk/gap/gap_story_file.c Sun Jan 25 12:24:13 2009
@@ -1133,10 +1133,14 @@
gap_story_filename_is_videofile_by_ext(const char *filename)
{
char *l_ext;
-
- l_ext = gap_lib_alloc_extension(filename);
- if(l_ext)
+ char *l_extension;
+ gboolean l_isKnownMovie;
+
+ l_isKnownMovie = FALSE;
+ l_extension = gap_lib_alloc_extension(filename);
+ if(l_extension)
{
+ l_ext = l_extension;
if(*l_ext == '.')
{
l_ext++;
@@ -1163,10 +1167,11 @@
|| (strcmp(l_ext, "ASF") == 0)
)
{
- return (TRUE);
+ l_isKnownMovie = TRUE;
}
+ g_free(l_extension);
}
- return(FALSE);
+ return(l_isKnownMovie);
} /* end gap_story_filename_is_videofile_by_ext */
/* --------------------------------
Modified: trunk/gap/gap_story_properties.c
==============================================================================
--- trunk/gap/gap_story_properties.c (original)
+++ trunk/gap/gap_story_properties.c Sun Jan 25 12:24:13 2009
@@ -1178,8 +1178,15 @@
else
{
gint32 l_image_id;
+
+ l_image_id = -1;
+
+ if((stb_elem_refptr->record_type != GAP_STBREC_VID_MOVIE)
+ && (stb_elem_refptr->record_type != GAP_STBREC_VID_SECTION))
+ {
+ l_image_id = gap_lib_load_image(l_frame_filename);
+ }
- l_image_id = gap_lib_load_image(l_frame_filename);
if (l_image_id < 0)
{
Modified: trunk/libgapvidutil/gap_gve_misc_util.c
==============================================================================
--- trunk/libgapvidutil/gap_gve_misc_util.c (original)
+++ trunk/libgapvidutil/gap_gve_misc_util.c Sun Jan 25 12:24:13 2009
@@ -43,6 +43,7 @@
#include "gap_gve_misc_util.h"
+
/*************************************************************
* TOOL FUNCTIONS *
*************************************************************/
@@ -98,32 +99,89 @@
/* ---------------------------------
- * p_snprintf_master_encoder_progress_keyname
+ * p_gap_build_enc_status_filename
* ---------------------------------
- *
+ * build the filename that is used for communication
+ * the encoder status between the GIMP-GAP master videoencoder and the
+ * video encoder plug-in (that typically runs in a separate process)
*/
-static void
-p_snprintf_master_encoder_progress_keyname(char *key, gint32 key_max_size, gint32 master_encoder_id)
+static char *
+p_gap_build_enc_status_filename(gint32 master_encoder_id)
{
- g_snprintf(key, key_max_size, "GAP_MASTER_ENCODER_PROGRESS_%d", (int)master_encoder_id);
-}
+ char *filename;
+ char *buf;
+
+ buf = g_strdup_printf("gap_master_videoencoder_progress_%d", master_encoder_id);
+
+ filename = g_build_filename(gimp_directory(), buf, NULL);
+
+ g_free(buf);
+ return (filename);
+} /* end p_gap_build_enc_status_filename */
+
+
+/* ---------------------------------------
+ * p_gap_build_enc_cancel_request_filename
+ * ---------------------------------------
+ * build the filename that is used to indicate cancel a running video encoder process.
+ * (if this file exists cancel request is TRUE)
+ */
+static char *
+p_gap_build_enc_cancel_request_filename(gint32 master_encoder_id)
+{
+ char *filename;
+ char *buf;
+
+ buf = g_strdup_printf("gap_master_videoencoder_cancel_%d", master_encoder_id);
+
+ filename = g_build_filename(gimp_directory(), buf, NULL);
+
+ g_free(buf);
+ return (filename);
+} /* end p_gap_build_enc_cancel_request_filename */
-static void
-p_snprintf_master_encoder_cancel_keyname(char *key, gint32 key_max_size, gint32 master_encoder_id)
+
+
+/* ---------------------------------------
+ * gap_gve_misc_cleanup_GapGveMasterEncoder
+ * ---------------------------------------
+ * cleanup (remove communication files)
+ * typically called by the master videoencoder when encoding has finished.
+ */
+void
+gap_gve_misc_cleanup_GapGveMasterEncoder(gint32 master_encoder_id)
{
- g_snprintf(key, key_max_size, "GAP_MASTER_ENCODER_CANCEL_%d", (int)master_encoder_id);
-}
+ char *filename;
+
+ filename = p_gap_build_enc_cancel_request_filename(master_encoder_id);
+
+ if(g_file_test(filename, G_FILE_TEST_EXISTS))
+ {
+ g_remove(filename);
+ }
+ g_free(filename);
+
+ filename = p_gap_build_enc_status_filename(master_encoder_id);
+ if(g_file_test(filename, G_FILE_TEST_EXISTS))
+ {
+ g_remove(filename);
+ }
+ g_free(filename);
+
+} /* end gap_gve_misc_cleanup_GapGveMasterEncoder */
/* ------------------------------------------
* gap_gve_misc_initGapGveMasterEncoderStatus
- * ---------................-----------------
+ * ------------------------------------------
* This pocedure is typically called at start of video encoding
*/
void
gap_gve_misc_initGapGveMasterEncoderStatus(GapGveMasterEncoderStatus *encStatus
, gint32 master_encoder_id, gint32 total_frames)
{
+ gap_gve_misc_cleanup_GapGveMasterEncoder(master_encoder_id);
+
encStatus->master_encoder_id = master_encoder_id;
encStatus->total_frames = total_frames;
encStatus->frames_processed = 0;
@@ -134,6 +192,100 @@
gap_gve_misc_do_master_encoder_progress(encStatus);
}
+
+/* ------------------------------------------
+ * p_write_encoder_status
+ * ------------------------------------------
+ * write current encoder status to binary file
+ * (the file is used for communication between the encoder process
+ * and the master videoencoder GUI process)
+ */
+static void
+p_write_encoder_status(GapGveMasterEncoderStatus *encStatus)
+{
+ FILE *fp;
+ char *filename;
+
+ filename = p_gap_build_enc_status_filename(encStatus->master_encoder_id);
+
+ if(gap_debug)
+ {
+ printf("p_write_encoder_status: frames_processed:%d, PID:%d filename:%s\n"
+ , (int) encStatus->frames_processed
+ , (int) getpid()
+ , filename
+ );
+ }
+
+
+ fp = fopen(filename, "wb");
+ if(fp)
+ {
+ fwrite(encStatus, sizeof(GapGveMasterEncoderStatus), 1, fp);
+ fclose(fp);
+ }
+ g_free(filename);
+}
+
+/* ------------------------------------------
+ * p_read_encoder_status
+ * ------------------------------------------
+ * read current encoder status from binary file
+ * (the file is used for communication between the encoder process
+ * and the master videoencoder GUI process)
+ */
+static void
+p_read_encoder_status(GapGveMasterEncoderStatus *encStatus)
+{
+ FILE *fp;
+ char *filename;
+ gint32 master_encoder_id;
+
+ master_encoder_id = encStatus->master_encoder_id;
+ filename = p_gap_build_enc_status_filename(master_encoder_id);
+
+ fp = fopen(filename, "rb");
+ if(fp)
+ {
+ GapGveMasterEncoderStatus encBuffer;
+
+ fread(&encBuffer, sizeof(GapGveMasterEncoderStatus), 1, fp);
+ fclose(fp);
+
+ if(master_encoder_id == encBuffer.master_encoder_id)
+ {
+ memcpy(encStatus, &encBuffer, sizeof(GapGveMasterEncoderStatus));
+ }
+ else
+ {
+ printf("p_read_encoder_status: ERROR unexpected contetent in communication filename:%s\n PID:%d id expected: %d but found: %d\n"
+ , filename
+ , (int) getpid()
+ , (int) master_encoder_id
+ , (int) encBuffer.master_encoder_id
+ );
+ }
+
+ if(gap_debug)
+ {
+ printf("p_read_encoder_status: frames_processed:%d, PID:%d filename:%s\n"
+ , (int) encStatus->frames_processed
+ , (int) getpid()
+ , filename
+ );
+ }
+ }
+ else
+ {
+ printf("p_read_encoder_status: ERROR cold not open communication filename:%s PID:%d\n"
+ , filename
+ , (int) getpid()
+ );
+ }
+
+ g_free(filename);
+}
+
/* ----------------------------------------
* gap_gve_misc_do_master_encoder_progress
* ----------------------------------------
@@ -144,10 +296,7 @@
void
gap_gve_misc_do_master_encoder_progress(GapGveMasterEncoderStatus *encStatus)
{
- char key[50];
-
- p_snprintf_master_encoder_progress_keyname(&key[0], sizeof(key), encStatus->master_encoder_id);
- gimp_set_data(key, encStatus, sizeof(GapGveMasterEncoderStatus));
+ p_write_encoder_status(encStatus);
}
@@ -160,15 +309,18 @@
gboolean
gap_gve_misc_is_master_encoder_cancel_request(GapGveMasterEncoderStatus *encStatus)
{
- char key[50];
gboolean cancelRequest;
-
+ char *filename;
+
cancelRequest = FALSE;
- p_snprintf_master_encoder_cancel_keyname(&key[0], sizeof(key), encStatus->master_encoder_id);
- if(gimp_get_data_size(key) == sizeof(gboolean))
+ filename = p_gap_build_enc_cancel_request_filename(encStatus->master_encoder_id);
+
+ if(g_file_test(filename, G_FILE_TEST_EXISTS))
{
- gimp_get_data(key, &cancelRequest);
+ cancelRequest = TRUE;
}
+
+ g_free(filename);
return (cancelRequest);
}
@@ -182,28 +334,8 @@
void
gap_gve_misc_get_master_encoder_progress(GapGveMasterEncoderStatus *encStatus)
{
- char key[50];
-
- p_snprintf_master_encoder_progress_keyname(&key[0], sizeof(key), encStatus->master_encoder_id);
-
- if(gimp_get_data_size(key) == sizeof(GapGveMasterEncoderStatus))
- {
- if(gap_debug)
- {
- printf("p_gimp_get_data: key:%s\n", key);
- }
- gimp_get_data(key, encStatus);
- }
- else
- {
- if(gap_debug)
- {
- printf("ERROR: gimp_get_data key:%s failed\n", key);
- printf("ERROR: gimp_get_data_size:%d expected size:%d\n"
- , (int)gimp_get_data_size(key)
- , (int)sizeof(GapGveMasterEncoderStatus));
- }
- }
+ p_read_encoder_status(encStatus);
+ return;
}
@@ -212,13 +344,23 @@
* ----------------------------------------------
* This pocedure is typically called in the master video encoder
* to request the already started video encoder plug-in to terminate.
+ * (the request is indicated by creating a file with a special name,
+ * its content is just comment and not relevant)
*/
void
gap_gve_misc_set_master_encoder_cancel_request(GapGveMasterEncoderStatus *encStatus, gboolean cancelRequest)
{
- char key[50];
+ FILE *fp;
+ char *filename;
+
+ filename = p_gap_build_enc_cancel_request_filename(encStatus->master_encoder_id);
- p_snprintf_master_encoder_cancel_keyname(&key[0], sizeof(key), encStatus->master_encoder_id);
- gimp_set_data(key, &cancelRequest, sizeof(gboolean));
+ fp = fopen(filename, "w");
+ if(fp)
+ {
+ fprintf(fp, "GAP videoencoder CANCEL requested\n");
+ fclose(fp);
+ }
+ g_free(filename);
}
Modified: trunk/libgapvidutil/gap_gve_misc_util.h
==============================================================================
--- trunk/libgapvidutil/gap_gve_misc_util.h (original)
+++ trunk/libgapvidutil/gap_gve_misc_util.h Sun Jan 25 12:24:13 2009
@@ -72,7 +72,7 @@
void gap_gve_misc_get_master_encoder_progress(GapGveMasterEncoderStatus *encStatus);
void gap_gve_misc_set_master_encoder_cancel_request(GapGveMasterEncoderStatus *encStatus, gboolean cancelRequest);
-
+void gap_gve_misc_cleanup_GapGveMasterEncoder(gint32 master_encoder_id);
extern int gap_debug;
Modified: trunk/vid_common/gap_cme_callbacks.c
==============================================================================
--- trunk/vid_common/gap_cme_callbacks.c (original)
+++ trunk/vid_common/gap_cme_callbacks.c Sun Jan 25 12:24:13 2009
@@ -30,6 +30,8 @@
#include <config.h>
+#include <time.h>
+
#include <glib/gstdio.h>
#include <gtk/gtk.h>
@@ -185,16 +187,20 @@
notebook = gpp->cme__notebook;
gtk_widget_show(frame);
- npages = gtk_notebook_get_n_pages(notebook);
+ npages = gtk_notebook_get_n_pages(GTK_NOTEBOOK (notebook));
for (idx = 0; idx < npages -1; idx++)
{
- gtk_widget_set_sensitive(gtk_notebook_get_nth_page(notebook, idx), FALSE);
+ gtk_widget_set_sensitive(gtk_notebook_get_nth_page(GTK_NOTEBOOK (notebook), idx), FALSE);
}
+ /* store encoder start time */
+ gpp->encoder_started_on_utc_seconds = time(NULL);
+
/* show last tab (-1) of the notbook */
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), -1);
gpp->video_encoder_run_state = GAP_CME_ENC_RUN_STATE_RUNNING;
+
} /* end p_switch_gui_to_running_encoder_state */
@@ -277,8 +283,14 @@
gpp->shell_window = NULL;
gtk_widget_destroy (dialog);
}
+
+ gtk_main_quit ();
+
+ }
+ else
+ {
+ gtk_main_quit ();
}
- gtk_main_quit ();
break;
}
Modified: trunk/vid_common/gap_cme_gui.c
==============================================================================
--- trunk/vid_common/gap_cme_gui.c (original)
+++ trunk/vid_common/gap_cme_gui.c Sun Jan 25 12:24:13 2009
@@ -2793,6 +2793,25 @@
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
+ row++;
+
+
+ label = gtk_label_new (_("Encoding Time Elapsed:"));
+ gtk_widget_show (label);
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row+1,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+
+
+ label = gtk_label_new ("######");
+ gpp->cme__label_enc_time_elapsed = label;
+ gtk_widget_show (label);
+ gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
+ gtk_table_attach (GTK_TABLE (table), label, 1, 2, row, row+1,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+
return(frame);
} /* end p_create_encoder_status_frame */
@@ -3851,7 +3870,13 @@
l_rc = 0;
}
g_free(l_params);
-
+
+ if(gap_debug)
+ {
+ printf("p_call_encoder_procedure %s: DONE\n", gpp->val.ecp_sel.vid_enc_plugin);
+ }
+
+
if(l_rc < 0)
{
l_msg = g_strdup_printf(_("Call of Required Plugin %s failed"), gpp->val.ecp_sel.vid_enc_plugin);
@@ -3891,7 +3916,11 @@
/* ----------------------------------------
* gap_cme_gui_update_encoder_status
* ----------------------------------------
- *
+ * called via polling timer while the encoder plug-in
+ * is running (as separete process).
+ * The displyed information is sent by the running encoder process
+ * and received here (in the master videoencoder GUI process)
+ * via procedure gap_gve_misc_get_master_encoder_progress
*/
void
gap_cme_gui_update_encoder_status(GapCmeGlobalParams *gpp)
@@ -3906,6 +3935,8 @@
if (gpp)
{
GtkWidget *pbar;
+ GtkWidget *label;
+
gap_gve_misc_get_master_encoder_progress(&gpp->encStatus);
gtk_widget_show(gpp->cme__encoder_status_frame);
@@ -3914,6 +3945,28 @@
p_set_label_to_numeric_value(gpp->cme__label_enc_stat_frames_done, gpp->encStatus.frames_processed);
p_set_label_to_numeric_value(gpp->cme__label_enc_stat_frames_encoded, gpp->encStatus.frames_encoded);
p_set_label_to_numeric_value(gpp->cme__label_enc_stat_frames_copied_lossless, gpp->encStatus.frames_copied_lossless);
+
+
+ label = gpp->cme__label_enc_time_elapsed;
+ if((label != NULL)
+ && (gpp->video_encoder_run_state == GAP_CME_ENC_RUN_STATE_RUNNING))
+ {
+ time_t l_currentUtcTimeInSecs;
+ gint32 l_secsElapsed;
+ char *buffer;
+
+ l_currentUtcTimeInSecs = time(NULL);
+ l_secsElapsed = l_currentUtcTimeInSecs - gpp->encoder_started_on_utc_seconds;
+
+ buffer = g_strdup_printf("%d:%02d:%02d"
+ , (int)l_secsElapsed / 3600
+ , (int)(l_secsElapsed / 60) % 60
+ , (int)l_secsElapsed % 60
+ );
+ gtk_label_set_text(GTK_LABEL(label), buffer);
+ g_free(buffer);
+ }
+
pbar = gpp->cme__progressbar_status;
if(pbar)
@@ -3933,8 +3986,22 @@
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(pbar), l_msg);
g_free(l_msg);
}
+// if (gpp->video_encoder_run_state == GAP_CME_ENC_RUN_STATE_RUNNING)
+// {
+// /* detect if encoder has finished (required for asynchron calls since GIMP-2.6) */
+// if(gpp->encStatus.frames_processed >= gpp->encStatus.total_frames)
+// {
+// if(gap_debug)
+// {
+// printf(" gap_cme_gui_update_encoder_status -- detected encoder FINISHED via progress\n"
+// , gpp->encStatus.frames_processed
+// );
+// }
+// gpp->video_encoder_run_state = GAP_CME_ENC_RUN_STATE_FINISHED;
+// }
+// }
}
-}
+} /* end gap_cme_gui_update_encoder_status */
/* ----------------------------------------
@@ -3952,6 +4019,9 @@
l_tmpname = NULL;
l_tmp_image_id = -1;
+ /* cheks for encoding a multilayer image as video
+ * (this may require save of a temporary imge before we can start the encoder plugin)
+ */
if((gpp->ainfo.last_frame_nr - gpp->ainfo.first_frame_nr == 0)
&& (gpp->val.storyboard_file[0] == '\0'))
{
@@ -3994,8 +4064,13 @@
, abs(gpp->val.range_to - gpp->val.range_from) + 1 /* total_frames */
);
- /* ------------------------------------------- HERE WE GO, start Video Encoder ---- */
+ /* ------------------------------------------- HERE WE GO, start the selected Video Encoder ----
+ * the encoder will run as separate process, started by the GIMP core.
+ * note that any further calls of GIMP core procedures .. from another thread ...
+ * will be blocked by the GIMP core while the encoder process is running.
+ */
l_rc = p_call_encoder_procedure(gpp);
+
gpp->video_encoder_run_state = GAP_CME_ENC_RUN_STATE_FINISHED;
if(l_tmp_image_id >= 0)
@@ -4003,6 +4078,8 @@
gap_image_delete_immediate(l_tmp_image_id);
g_remove(l_tmpname);
}
+
+
if(l_tmpname)
{
g_free(l_tmpname);
Modified: trunk/vid_common/gap_cme_main.c
==============================================================================
--- trunk/vid_common/gap_cme_main.c (original)
+++ trunk/vid_common/gap_cme_main.c Sun Jan 25 12:24:13 2009
@@ -332,19 +332,25 @@
{
if(gpp->val.run_mode == GIMP_RUN_INTERACTIVE)
{
- if(gap_debug) printf("MAIN before gap_cme_gui_master_encoder_dialog ------------------\n");
+ if(gap_debug)
+ {
+ printf("MAIN before gap_cme_gui_master_encoder_dialog ------------------\n");
+ }
/* note that the dialog alrady performs the encoding (as worker thread)
- */
+ */
l_rc = gap_cme_gui_master_encoder_dialog (gpp);
- if(gap_debug) printf("MAIN after gap_cme_gui_master_encoder_dialog ------------------\n");
+ if(gap_debug)
+ {
+ printf("MAIN after gap_cme_gui_master_encoder_dialog ------------------\n");
+ }
if(l_rc < 0)
{
values[0].data.d_status = GIMP_PDB_CANCEL;
}
-
+
}
else
{
@@ -365,6 +371,24 @@
}
}
+
+ /* wait 8 seconds to give the encoder process a chance to exit
+ * (and/or accept a possible cancel request)
+ */
+ sleep(8);
+
+ if(gap_debug)
+ {
+ printf("MAIN cleanup ------------------\n");
+ }
+
+ /* clean up removes the communication file and the cancel request file (if there is any)
+ * note that this shall happen after the encoder process has exited.
+ * (otherwise the files used for communication may be created again after the
+ * following cleanup
+ */
+ gap_gve_misc_cleanup_GapGveMasterEncoder(gpp->encStatus.master_encoder_id);
+
}
else
{
Modified: trunk/vid_common/gap_cme_main.h
==============================================================================
--- trunk/vid_common/gap_cme_main.h (original)
+++ trunk/vid_common/gap_cme_main.h Sun Jan 25 12:24:13 2009
@@ -35,6 +35,7 @@
#include <sys/types.h>
#include <unistd.h>
+#include <time.h>
#define GAP_CME_PLUGIN_NAME_VID_ENCODE_MASTER "plug-in-gap-vid-encode-master"
#define GAP_CME_PLUGIN_HELP_ID_VID_ENCODE_MASTER "plug-in-gap-vid-encode-master"
@@ -164,12 +165,14 @@
GtkWidget *cme__label_enc_stat_frames_encoded;
GtkWidget *cme__label_enc_stat_frames_copied_lossless;
GtkWidget *cme__label_active_encoder_name;
+ GtkWidget *cme__label_enc_time_elapsed;
GapCmeEncoderRunState video_encoder_run_state;
gint32 productive_encoder_timertag;
gint32 encoder_status_poll_timertag;
GThread *productive_encoder_thread;
GapGveMasterEncoderStatus encStatus;
+ time_t encoder_started_on_utc_seconds;
} GapCmeGlobalParams;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]