diff options
author | jstebbins <[email protected]> | 2009-12-23 00:05:05 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2009-12-23 00:05:05 +0000 |
commit | 93416da6f241eba72979685ab98f89e33ae6f2e0 (patch) | |
tree | 91f936c05910572257bdcaaddb01ea0ca27159ef /gtk | |
parent | 2e7008572201e59568805cb38c1dd1dc8ad4ae42 (diff) |
LinGui: add point-to-point
the user can now select between chapter, seconds, or frame start and end
points for encoding.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3041 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/src/callbacks.c | 346 | ||||
-rw-r--r-- | gtk/src/ghb.ui | 293 | ||||
-rw-r--r-- | gtk/src/hb-backend.c | 75 | ||||
-rw-r--r-- | gtk/src/internal_defaults.xml | 8 | ||||
-rw-r--r-- | gtk/src/presets.c | 24 | ||||
-rw-r--r-- | gtk/src/queuehandler.c | 23 | ||||
-rw-r--r-- | gtk/src/settings.h | 1 | ||||
-rw-r--r-- | gtk/src/widgetdeps.c | 7 |
8 files changed, 554 insertions, 223 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index 087185dcf..246f56b92 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -296,7 +296,7 @@ on_quit1_activate(GtkMenuItem *quit, signal_user_data_t *ud) { gint state = ghb_get_queue_state(); g_debug("on_quit1_activate ()"); - if (state & GHB_STATE_WORKING) + if (state & (GHB_STATE_WORKING|GHB_STATE_SEARCHING)) { if (ghb_cancel_encode2(ud, "Closing HandBrake will terminate encoding.\n")) { @@ -580,7 +580,8 @@ set_destination(signal_user_data_t *ud) title = ghb_settings_combo_int(ud->settings, "title"); g_string_append_printf(str, " - %d", title+1); } - if (ghb_settings_get_boolean( + if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0 && + ghb_settings_get_boolean( ud->settings, "chapters_in_destination")) { gint start, end; @@ -590,8 +591,8 @@ set_destination(signal_user_data_t *ud) { g_string_append_printf(str, " -"); } - start = ghb_settings_get_int(ud->settings, "start_chapter"); - end = ghb_settings_get_int(ud->settings, "end_chapter"); + start = ghb_settings_get_int(ud->settings, "start_point"); + end = ghb_settings_get_int(ud->settings, "end_point"); if (start == end) g_string_append_printf(str, " Ch %d", start); else @@ -1259,7 +1260,7 @@ window_delete_event_cb(GtkWidget *widget, GdkEvent *event, signal_user_data_t *u { gint state = ghb_get_queue_state(); g_debug("window_delete_event_cb ()"); - if (state & GHB_STATE_WORKING) + if (state & (GHB_STATE_WORKING|GHB_STATE_SEARCHING)) { if (ghb_cancel_encode2(ud, "Closing HandBrake will terminate encoding.\n")) { @@ -1334,9 +1335,45 @@ update_title_duration(signal_user_data_t *ud) ti = ghb_settings_combo_int(ud->settings, "title"); widget = GHB_WIDGET (ud->builder, "title_duration"); - start = ghb_settings_get_int(ud->settings, "start_chapter"); - end = ghb_settings_get_int(ud->settings, "end_chapter"); - ghb_part_duration(ti, start, end, &hh, &mm, &ss); + if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0) + { + start = ghb_settings_get_int(ud->settings, "start_point"); + end = ghb_settings_get_int(ud->settings, "end_point"); + ghb_part_duration(ti, start, end, &hh, &mm, &ss); + } + else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 1) + { + gint duration; + + start = ghb_settings_get_int(ud->settings, "start_point"); + end = ghb_settings_get_int(ud->settings, "end_point"); + duration = end - start; + hh = duration / (60*60); + mm = (duration / 60) % 60; + ss = duration % 60; + } + else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 2) + { + ghb_title_info_t tinfo; + + if (ghb_get_title_info (&tinfo, ti)) + { + gint64 frames; + gint duration; + + start = ghb_settings_get_int(ud->settings, "start_point"); + end = ghb_settings_get_int(ud->settings, "end_point"); + frames = end - start + 1; + duration = frames * tinfo.rate_base / tinfo.rate; + hh = duration / (60*60); + mm = (duration / 60) % 60; + ss = duration % 60; + } + else + { + hh = mm = ss = 0; + } + } text = g_strdup_printf("%02d:%02d:%02d", hh, mm, ss); gtk_label_set_text (GTK_LABEL(widget), text); g_free(text); @@ -1429,17 +1466,46 @@ show_title_info(signal_user_data_t *ud, ghb_title_info_t *tinfo) gtk_label_set_text (GTK_LABEL(widget), text); g_free(text); - g_debug("setting max end chapter %d", tinfo->num_chapters); - widget = GHB_WIDGET (ud->builder, "end_chapter"); - gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, tinfo->num_chapters); - gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), tinfo->num_chapters); - widget = GHB_WIDGET (ud->builder, "start_chapter"); - gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), 1); - gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, tinfo->num_chapters); + + gint duration = tinfo->duration / 90000; + + if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0) + { + widget = GHB_WIDGET (ud->builder, "start_point"); + gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, tinfo->num_chapters); + gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), 1); + + widget = GHB_WIDGET (ud->builder, "end_point"); + gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, tinfo->num_chapters); + gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), tinfo->num_chapters); + } + else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 1) + { + + widget = GHB_WIDGET (ud->builder, "start_point"); + gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, duration-1); + gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), 0); + + widget = GHB_WIDGET (ud->builder, "end_point"); + gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, duration); + gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), duration); + } + else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 2) + { + gdouble max_frames = (gdouble)duration * tinfo->rate / tinfo->rate_base; + widget = GHB_WIDGET (ud->builder, "start_point"); + gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, max_frames); + gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), 1); + + widget = GHB_WIDGET (ud->builder, "end_point"); + gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, max_frames); + gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), max_frames); + } widget = GHB_WIDGET (ud->builder, "angle"); gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), 1); gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, tinfo->angle_count); + ghb_settings_set_int(ud->settings, "angle_count", tinfo->angle_count); ud->dont_clear_presets = FALSE; } @@ -1453,7 +1519,6 @@ title_changed_cb(GtkWidget *widget, signal_user_data_t *ud) g_debug("title_changed_cb ()"); ghb_widget_to_setting(ud->settings, widget); - ghb_check_dependency(ud, widget, NULL); titleindex = ghb_settings_combo_int(ud->settings, "title"); ghb_update_ui_combo_box (ud, "AudioTrack", titleindex, FALSE); @@ -1463,6 +1528,7 @@ title_changed_cb(GtkWidget *widget, signal_user_data_t *ud) { show_title_info(ud, &tinfo); } + ghb_check_dependency(ud, widget, NULL); update_chapter_list (ud); ghb_adjust_audio_rate_combos(ud); ghb_set_pref_audio(titleindex, ud); @@ -1494,7 +1560,7 @@ title_changed_cb(GtkWidget *widget, signal_user_data_t *ud) gint end; widget = GHB_WIDGET (ud->builder, "ChapterMarkers"); gtk_widget_set_sensitive(widget, TRUE); - end = ghb_settings_get_int(ud->settings, "end_chapter"); + end = ghb_settings_get_int(ud->settings, "end_point"); if (1 == end) { ud->dont_clear_presets = TRUE; @@ -1505,6 +1571,54 @@ title_changed_cb(GtkWidget *widget, signal_user_data_t *ud) } G_MODULE_EXPORT void +ptop_widget_changed_cb(GtkWidget *widget, signal_user_data_t *ud) +{ + gint ti; + ghb_title_info_t tinfo; + + ghb_widget_to_setting(ud->settings, widget); + ghb_check_dependency(ud, widget, NULL); + ghb_live_reset(ud); + + ti = ghb_settings_combo_int(ud->settings, "title"); + if (!ghb_get_title_info (&tinfo, ti)) + return; + + gint duration = tinfo.duration / 90000; + if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0) + { + widget = GHB_WIDGET (ud->builder, "start_point"); + gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, tinfo.num_chapters); + gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), 1); + + widget = GHB_WIDGET (ud->builder, "end_point"); + gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, tinfo.num_chapters); + gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), tinfo.num_chapters); + } + else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 1) + { + widget = GHB_WIDGET (ud->builder, "start_point"); + gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 0, duration-1); + gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), 0); + + widget = GHB_WIDGET (ud->builder, "end_point"); + gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, duration); + gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), duration); + } + else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 2) + { + gdouble max_frames = (gdouble)duration * tinfo.rate / tinfo.rate_base; + widget = GHB_WIDGET (ud->builder, "start_point"); + gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, max_frames); + gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), 1); + + widget = GHB_WIDGET (ud->builder, "end_point"); + gtk_spin_button_set_range (GTK_SPIN_BUTTON(widget), 1, max_frames); + gtk_spin_button_set_value (GTK_SPIN_BUTTON(widget), max_frames); + } +} + +G_MODULE_EXPORT void setting_widget_changed_cb(GtkWidget *widget, signal_user_data_t *ud) { ghb_widget_to_setting(ud->settings, widget); @@ -1596,65 +1710,107 @@ target_size_changed_cb(GtkWidget *widget, signal_user_data_t *ud) } G_MODULE_EXPORT void -start_chapter_changed_cb(GtkWidget *widget, signal_user_data_t *ud) +start_point_changed_cb(GtkWidget *widget, signal_user_data_t *ud) { gint start, end; const gchar *name = gtk_widget_get_name(widget); - g_debug("start_chapter_changed_cb () %s", name); + g_debug("start_point_changed_cb () %s", name); ghb_widget_to_setting(ud->settings, widget); - start = ghb_settings_get_int(ud->settings, "start_chapter"); - end = ghb_settings_get_int(ud->settings, "end_chapter"); - if (start > end) - ghb_ui_update(ud, "end_chapter", ghb_int_value(start)); - ghb_check_dependency(ud, widget, NULL); - if (ghb_settings_get_boolean(ud->settings, "chapters_in_destination")) + if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0) + { + start = ghb_settings_get_int(ud->settings, "start_point"); + end = ghb_settings_get_int(ud->settings, "end_point"); + if (start > end) + ghb_ui_update(ud, "end_point", ghb_int_value(start)); + ghb_check_dependency(ud, widget, NULL); + if (ghb_settings_get_boolean(ud->settings, "chapters_in_destination")) + { + set_destination(ud); + } + widget = GHB_WIDGET (ud->builder, "ChapterMarkers"); + gtk_widget_set_sensitive(widget, TRUE); + // End may have been changed above, get it again + end = ghb_settings_get_int(ud->settings, "end_point"); + if (start == end) + { + ud->dont_clear_presets = TRUE; + ghb_ui_update(ud, "ChapterMarkers", ghb_boolean_value(FALSE)); + ud->dont_clear_presets = FALSE; + gtk_widget_set_sensitive(widget, FALSE); + } + update_title_duration(ud); + } + else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 1) { - set_destination(ud); + start = ghb_settings_get_int(ud->settings, "start_point"); + end = ghb_settings_get_int(ud->settings, "end_point"); + if (start >= end) + ghb_ui_update(ud, "end_point", ghb_int_value(start+1)); + ghb_check_dependency(ud, widget, NULL); + update_title_duration(ud); } - widget = GHB_WIDGET (ud->builder, "ChapterMarkers"); - gtk_widget_set_sensitive(widget, TRUE); - // End may have been changed above, get it again - end = ghb_settings_get_int(ud->settings, "end_chapter"); - if (start == end) + else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 2) { - ud->dont_clear_presets = TRUE; - ghb_ui_update(ud, "ChapterMarkers", ghb_boolean_value(FALSE)); - ud->dont_clear_presets = FALSE; - gtk_widget_set_sensitive(widget, FALSE); + start = ghb_settings_get_int(ud->settings, "start_point"); + end = ghb_settings_get_int(ud->settings, "end_point"); + if (start > end) + ghb_ui_update(ud, "end_point", ghb_int_value(start)); + ghb_check_dependency(ud, widget, NULL); + update_title_duration(ud); } - update_title_duration(ud); } G_MODULE_EXPORT void -end_chapter_changed_cb(GtkWidget *widget, signal_user_data_t *ud) +end_point_changed_cb(GtkWidget *widget, signal_user_data_t *ud) { gint start, end; const gchar *name = gtk_widget_get_name(widget); - g_debug("end_chapter_changed_cb () %s", name); + g_debug("end_point_changed_cb () %s", name); ghb_widget_to_setting(ud->settings, widget); - start = ghb_settings_get_int(ud->settings, "start_chapter"); - end = ghb_settings_get_int(ud->settings, "end_chapter"); - if (start > end) - ghb_ui_update(ud, "start_chapter", ghb_int_value(end)); - ghb_check_dependency(ud, widget, NULL); - if (ghb_settings_get_boolean(ud->settings, "chapters_in_destination")) + if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0) + { + start = ghb_settings_get_int(ud->settings, "start_point"); + end = ghb_settings_get_int(ud->settings, "end_point"); + if (start > end) + ghb_ui_update(ud, "start_point", ghb_int_value(end)); + ghb_check_dependency(ud, widget, NULL); + if (ghb_settings_get_boolean(ud->settings, "chapters_in_destination")) + { + set_destination(ud); + } + widget = GHB_WIDGET (ud->builder, "ChapterMarkers"); + gtk_widget_set_sensitive(widget, TRUE); + // Start may have been changed above, get it again + start = ghb_settings_get_int(ud->settings, "start_point"); + if (start == end) + { + ud->dont_clear_presets = TRUE; + ghb_ui_update(ud, "ChapterMarkers", ghb_boolean_value(FALSE)); + ud->dont_clear_presets = FALSE; + gtk_widget_set_sensitive(widget, FALSE); + } + update_title_duration(ud); + } + else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 1) { - set_destination(ud); + start = ghb_settings_get_int(ud->settings, "start_point"); + end = ghb_settings_get_int(ud->settings, "end_point"); + if (start >= end) + ghb_ui_update(ud, "start_point", ghb_int_value(end-1)); + ghb_check_dependency(ud, widget, NULL); + update_title_duration(ud); } - widget = GHB_WIDGET (ud->builder, "ChapterMarkers"); - gtk_widget_set_sensitive(widget, TRUE); - // Start may have been changed above, get it again - start = ghb_settings_get_int(ud->settings, "start_chapter"); - if (start == end) + else if (ghb_settings_combo_int(ud->settings, "PtoPType") == 2) { - ud->dont_clear_presets = TRUE; - ghb_ui_update(ud, "ChapterMarkers", ghb_boolean_value(FALSE)); - ud->dont_clear_presets = FALSE; - gtk_widget_set_sensitive(widget, FALSE); + start = ghb_settings_get_int(ud->settings, "start_point"); + end = ghb_settings_get_int(ud->settings, "end_point"); + if (start > end) + ghb_ui_update(ud, "start_point", ghb_int_value(end)); + ghb_check_dependency(ud, widget, NULL); + update_title_duration(ud); } - update_title_duration(ud); } G_MODULE_EXPORT void @@ -2388,6 +2544,46 @@ working_status_string(signal_user_data_t *ud, ghb_instance_status_t *status) return status_str; } +gchar* +searching_status_string(signal_user_data_t *ud, ghb_instance_status_t *status) +{ + gchar *task_str, *job_str, *status_str; + gint qcount; + gint index; + GValue *js; + + qcount = ghb_array_len(ud->queue); + index = find_queue_job(ud->queue, status->unique_id, &js); + if (qcount > 1) + { + job_str = g_strdup_printf("job %d of %d, ", index+1, qcount); + } + else + { + job_str = g_strdup(""); + } + task_str = g_strdup_printf("Searching for start time, "); + if(status->seconds > -1) + { + status_str= g_strdup_printf( + "Encoding: %s%s%.2f %%" + " (ETA %02dh%02dm%02ds)", + job_str, task_str, + 100.0 * status->progress, + status->hours, status->minutes, status->seconds ); + } + else + { + status_str= g_strdup_printf( + "Encoding: %s%s%.2f %%", + job_str, task_str, + 100.0 * status->progress ); + } + g_free(task_str); + g_free(job_str); + return status_str; +} + static void ghb_backend_events(signal_user_data_t *ud) { @@ -2526,6 +2722,44 @@ ghb_backend_events(signal_user_data_t *ud) { gtk_label_set_text (work_status, "Paused"); } + else if (status.queue.state & GHB_STATE_SEARCHING) + { + static gint working = 0; + + // This needs to be in scanning and working since scanning + // happens fast enough that it can be missed + index = find_queue_job(ud->queue, status.queue.unique_id, &js); + if (status.queue.unique_id != 0 && index >= 0) + { + gchar working_icon[] = "hb-working0"; + working_icon[10] = '0' + working; + working = (working+1) % 6; + treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "queue_list")); + store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview)); + gchar *path = g_strdup_printf ("%d", index); + if (gtk_tree_model_get_iter_from_string( + GTK_TREE_MODEL(store), &iter, path)) + { + gtk_tree_store_set(store, &iter, 0, working_icon, -1); + } + g_free(path); + } + GtkLabel *label; + gchar *status_str; + + status_str = searching_status_string(ud, &status.queue); + label = GTK_LABEL(GHB_WIDGET(ud->builder, "queue_status")); + gtk_label_set_text (label, status_str); +#if !GTK_CHECK_VERSION(2, 16, 0) + GtkStatusIcon *si; + + si = GTK_STATUS_ICON(GHB_OBJECT(ud->builder, "hb_status")); + gtk_status_icon_set_tooltip(si, status_str); +#endif + gtk_label_set_text (work_status, status_str); + gtk_progress_bar_set_fraction (progress, status.queue.progress); + g_free(status_str); + } else if (status.queue.state & GHB_STATE_WORKING) { static gint working = 0; @@ -2693,6 +2927,8 @@ status_icon_query_tooltip_cb( ghb_get_status(&status); if (status.queue.state & GHB_STATE_WORKING) status_str = working_status_string(ud, &status.queue); + else if (status.queue.state & GHB_STATE_SEARCHING) + status_str = searching_status_string(ud, &status.queue); else if (status.queue.state & GHB_STATE_WORKDONE) status_str = g_strdup("Encode Complete"); else diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui index 17490b7bc..102214c0f 100644 --- a/gtk/src/ghb.ui +++ b/gtk/src/ghb.ui @@ -249,6 +249,22 @@ <property name="page_size">0</property> <property name="value">0</property> </object> + <object class="GtkAdjustment" id="adjustment32"> + <property name="upper">99999</property> + <property name="lower">0</property> + <property name="page_increment">60</property> + <property name="step_increment">1</property> + <property name="page_size">0</property> + <property name="value">99999</property> + </object> + <object class="GtkAdjustment" id="adjustment33"> + <property name="upper">99999</property> + <property name="lower">1</property> + <property name="page_increment">60</property> + <property name="step_increment">1</property> + <property name="page_size">0</property> + <property name="value">0</property> + </object> <object class="GtkAdjustment" id="preview_progress_adj"> <property name="upper">100</property> <property name="lower">0</property> @@ -726,128 +742,62 @@ </packing> </child> <child> - <object class="GtkAlignment" id="alignment72"> + <object class="GtkTable" id="table7"> <property name="visible">True</property> - <property name="top_padding">6</property> - <property name="left_padding">6</property> + <property name="n_rows">2</property> + <property name="n_columns">2</property> + <property name="column-spacing">5</property> <child> - <object class="GtkHBox" id="hbox8"> + <object class="GtkAlignment" id="alignment72"> <property name="visible">True</property> - <property name="spacing">4</property> + <property name="top_padding">6</property> + <property name="left_padding">6</property> <child> <object class="GtkLabel" id="label20"> <property name="visible">True</property> - <property name="label" translatable="yes">Title</property> + <property name="xalign">0.1</property> + <property name="label" translatable="yes">Title:</property> </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - <child> - <object class="GtkComboBox" id="title"> - <property name="visible">True</property> - <property name="has_frame">False</property> - <property name="tooltip-text" translatable="yes">Set the title to encode. By default the longest title is chosen. This is often the feature title of a DVD.</property> - <signal handler="title_changed_cb" name="changed"/> - </object> - <packing> - <property name="expand">False</property> - <property name="position">1</property> - </packing> </child> </object> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">GTK_FILL</property> + </packing> </child> - </object> - <packing> - <property name="expand">False</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkAlignment" id="alignment65"> - <property name="visible">True</property> - <property name="left_padding">6</property> - <property name="bottom_padding">6</property> <child> - <object class="GtkHBox" id="hbox5"> + <object class="GtkHBox" id="hbox42"> <property name="visible">True</property> - <property name="spacing">4</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="spacing">5</property> + <child> - <object class="GtkAlignment" id="chapter_box"> + <object class="GtkAlignment" id="alignment75"> <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="xalign">0</property> <property name="xscale">0</property> - <property name="left_padding">0</property> - <child> - <object class="GtkHBox" id="hbox4"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <child> - <object class="GtkLabel" id="label4"> - <property name="visible">True</property> - <property name="label" translatable="yes">Chapters</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="start_chapter"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="tooltip-text" translatable="yes">Set the first chapter to encode.</property> - <property name="adjustment">adjustment1</property> - <signal handler="start_chapter_changed_cb" name="value_changed"/> - </object> - <packing> - <property name="expand">False</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label5"> - <property name="visible">True</property> - <property name="label" translatable="yes"> through </property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="end_chapter"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="tooltip-text" translatable="yes">Set the last chapter to encode.</property> - <property name="adjustment">adjustment2</property> - <signal handler="end_chapter_changed_cb" name="value_changed"/> - </object> - <packing> - <property name="expand">False</property> - <property name="position">3</property> - </packing> - </child> - </object> - </child> + <property name="yscale">0</property> + <child> + <object class="GtkComboBox" id="title"> + <property name="visible">True</property> + <property name="has_frame">False</property> + <property name="tooltip-text" translatable="yes">Set the title to encode. By default the longest title is chosen. This is often the feature title of a DVD.</property> + <signal handler="title_changed_cb" name="changed"/> + </object> + </child> + </object> - <packing> - <property name="expand">False</property> - <property name="position">2</property> - </packing> </child> + <child> - <object class="GtkAlignment" id="alignment47"> + <object class="GtkAlignment" id="alignment73"> <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="xalign">0</property> + <property name="xalign">1</property> <property name="xscale">0</property> - <property name="left_padding">8</property> + <property name="yscale">0</property> <child> <object class="GtkHBox" id="hbox44"> <property name="visible">True</property> @@ -861,7 +811,7 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="position">4</property> + <property name="position">0</property> </packing> </child> <child> @@ -875,54 +825,111 @@ </object> <packing> <property name="expand">False</property> - <property name="position">5</property> + <property name="position">1</property> </packing> </child> </object> </child> </object> - <packing> - <property name="expand">False</property> - <property name="position">3</property> - </packing> </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + </packing> + </child> + + <child> + <object class="GtkAlignment" id="alignment74"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="xscale">0</property> + <property name="yscale">0</property> <child> - <object class="GtkAlignment" id="alignment41"> + <object class="GtkHBox" id="hbox48"> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="xalign">0</property> - <property name="xscale">0</property> - <property name="left_padding">8</property> + <property name="spacing">5</property> + <child> - <object class="GtkHBox" id="hbox42"> + <object class="GtkComboBox" id="PtoPType"> <property name="visible">True</property> + <property name="tooltip-text" translatable="yes">Format to mux encoded tracks to.</property> + <signal handler="ptop_widget_changed_cb" name="changed"/> + </object> + <packing> + <property name="expand">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="start_point"> + <property name="visible">True</property> + <property name="can_focus">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="spacing">7</property> - <child> - <object class="GtkLabel" id="label6"> - <property name="visible">True</property> - <property name="xalign">0.10000000149011612</property> - <property name="label" translatable="yes">Duration:</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="title_duration"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">hh:mm:ss</property> - <property name="width_chars">8</property> - </object> - <packing> - <property name="expand">False</property> - <property name="position">1</property> - </packing> - </child> + <property name="tooltip-text" translatable="yes">Set the first chapter to encode.</property> + <property name="adjustment">adjustment1</property> + <signal handler="start_point_changed_cb" name="value_changed"/> + </object> + <packing> + <property name="expand">False</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label56"> + <property name="visible">True</property> + <property name="label" translatable="yes">through</property> + </object> + <packing> + <property name="expand">False</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="end_point"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="tooltip-text" translatable="yes">Set the last chapter to encode.</property> + <property name="adjustment">adjustment2</property> + <signal handler="end_point_changed_cb" name="value_changed"/> + </object> + <packing> + <property name="expand">False</property> + <property name="position">3</property> + </packing> + </child> + <child> + <object class="GtkHBox" id="hbox47"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="spacing">7</property> + <child> + <object class="GtkLabel" id="label6"> + <property name="visible">True</property> + <property name="xalign">0.1</property> + <property name="label" translatable="yes">Duration:</property> </object> + <packing> + <property name="expand">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="title_duration"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">hh:mm:ss</property> + <property name="width_chars">8</property> + </object> + <packing> + <property name="expand">False</property> + <property name="position">1</property> + </packing> </child> </object> <packing> @@ -930,12 +937,20 @@ <property name="position">4</property> </packing> </child> + </object> + </child> </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + </packing> </child> </object> <packing> <property name="expand">False</property> - <property name="position">2</property> + <property name="position">1</property> </packing> </child> </object> @@ -958,7 +973,7 @@ <property name="visible">True</property> <property name="spacing">12</property> <child> - <object class="GtkTable" id="table3"> + <object class="GtkTable" id="table4"> <property name="visible">True</property> <property name="n_rows">2</property> <property name="n_columns">2</property> diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index 2a60fecc3..b577a5b00 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -70,6 +70,18 @@ index_str_init(gint max_index) } } +static options_map_t d_point_to_point_opts[] = +{ + {"Chapters:", "chapter", 0, "0"}, + {"Seconds:", "time", 1, "1"}, + {"Frames:", "frame", 2, "2"}, +}; +combo_opts_t point_to_point_opts = +{ + sizeof(d_point_to_point_opts)/sizeof(options_map_t), + d_point_to_point_opts +}; + static options_map_t d_when_complete_opts[] = { {"Do Nothing", "nothing", 0, "0"}, @@ -359,6 +371,7 @@ typedef struct combo_name_map_t combo_name_map[] = { + {"PtoPType", &point_to_point_opts}, {"WhenComplete", &when_complete_opts}, {"PicturePAR", &par_opts}, {"PictureModulus", &alignment_opts}, @@ -2563,6 +2576,7 @@ ghb_update_ui_combo_box( audio_track_opts_set(ud->builder, "AudioTrack", user_data); subtitle_track_opts_set(ud->builder, "SubtitleTrack", user_data); generic_opts_set(ud->builder, "VideoQualityGranularity", &vqual_granularity_opts); + generic_opts_set(ud->builder, "PtoPType", &point_to_point_opts); generic_opts_set(ud->builder, "WhenComplete", &when_complete_opts); generic_opts_set(ud->builder, "PicturePAR", &par_opts); generic_opts_set(ud->builder, "PictureModulus", &alignment_opts); @@ -3078,6 +3092,22 @@ ghb_track_status() case HB_STATE_WORKING: hb_status.queue.state |= GHB_STATE_WORKING; hb_status.queue.state &= ~GHB_STATE_PAUSED; + hb_status.queue.state &= ~GHB_STATE_SEARCHING; + hb_status.queue.job_cur = p.job_cur; + hb_status.queue.job_count = p.job_count; + hb_status.queue.progress = p.progress; + hb_status.queue.rate_cur = p.rate_cur; + hb_status.queue.rate_avg = p.rate_avg; + hb_status.queue.hours = p.hours; + hb_status.queue.minutes = p.minutes; + hb_status.queue.seconds = p.seconds; + hb_status.queue.unique_id = p.sequence_id & 0xFFFFFF; + break; + + case HB_STATE_SEARCHING: + hb_status.queue.state |= GHB_STATE_SEARCHING; + hb_status.queue.state &= ~GHB_STATE_WORKING; + hb_status.queue.state &= ~GHB_STATE_PAUSED; hb_status.queue.job_cur = p.job_cur; hb_status.queue.job_count = p.job_count; hb_status.queue.progress = p.progress; @@ -4212,13 +4242,42 @@ add_job(hb_handle_t *h, GValue *js, gint unique_id, gint titleindex) } if (!job->start_at_preview) { - gint chapter_start, chapter_end; - chapter_start = ghb_settings_get_int(js, "start_chapter"); - chapter_end = ghb_settings_get_int(js, "end_chapter"); + gint start, end; gint num_chapters = hb_list_count(title->list_chapter); - job->chapter_start = MIN( num_chapters, chapter_start ); - job->chapter_end = MAX( job->chapter_start, chapter_end ); + gint duration = title->duration / 90000; + job->chapter_start = 1; + job->chapter_end = num_chapters; + if (ghb_settings_combo_int(js, "PtoPType") == 0) + { + start = ghb_settings_get_int(js, "start_point"); + end = ghb_settings_get_int(js, "end_point"); + job->chapter_start = MIN( num_chapters, start ); + job->chapter_end = MAX( job->chapter_start, end ); + + } + if (ghb_settings_combo_int(js, "PtoPType") == 1) + { + job->chapter_start = 1; + job->chapter_end = num_chapters; + start = ghb_settings_get_int(js, "start_point"); + end = ghb_settings_get_int(js, "end_point"); + job->pts_to_start = (int64_t)MIN(duration-1, start) * 90000; + job->pts_to_stop = (int64_t)MAX(start+1, end) * 90000 - + job->pts_to_start; + } + if (ghb_settings_combo_int(js, "PtoPType") == 2) + { + job->chapter_start = 1; + job->chapter_end = num_chapters; + start = ghb_settings_get_int(js, "start_point"); + end = ghb_settings_get_int(js, "end_point"); + gint64 max_frames; + max_frames = (gint64)duration * title->rate / title->rate_base; + job->frame_to_start = (int64_t)MIN(max_frames-1, start-1); + job->frame_to_stop = (int64_t)MAX(start, end-1) - + job->frame_to_start; + } job->chapter_markers = ghb_settings_get_boolean(js, "ChapterMarkers"); if (job->chapter_start == job->chapter_end) job->chapter_markers = 0; @@ -4228,14 +4287,14 @@ add_job(hb_handle_t *h, GValue *js, gint unique_id, gint titleindex) GValue *chapter; gint chap; gint count; - + chapters = ghb_settings_get_value(js, "chapter_list"); count = ghb_array_len(chapters); - for(chap = chapter_start; chap <= chapter_end; chap++) + for(chap = start; chap <= end; chap++) { hb_chapter_t * chapter_s; gchar *name; - + name = NULL; if (chap-1 < count) { diff --git a/gtk/src/internal_defaults.xml b/gtk/src/internal_defaults.xml index ec6802413..3a67e42f3 100644 --- a/gtk/src/internal_defaults.xml +++ b/gtk/src/internal_defaults.xml @@ -4,6 +4,8 @@ <dict> <key>Initialization</key> <dict> + <key>angle_count</key> + <integer>1</integer> <key>angle</key> <integer>1</integer> <key>anamorphic</key> @@ -14,7 +16,7 @@ <string></string> <key>dest_file</key> <string>new_video.mp4</string> - <key>end_chapter</key> + <key>end_point</key> <integer>100</integer> <key>folder</key> <string></string> @@ -30,6 +32,8 @@ <integer>720</integer> <key>PictureDisplayHeight</key> <integer>480</integer> + <key>PtoPType</key> + <string>chapter</string> <key>scale_height</key> <integer>0</integer> <key>scale_width</key> @@ -42,7 +46,7 @@ <false /> <key>single_title</key> <integer>1</integer> - <key>start_chapter</key> + <key>start_point</key> <integer>1</integer> <key>start_frame</key> <integer>-1</integer> diff --git a/gtk/src/presets.c b/gtk/src/presets.c index fca8c9304..b59efca79 100644 --- a/gtk/src/presets.c +++ b/gtk/src/presets.c @@ -4087,16 +4087,20 @@ presets_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_ g_debug("No selection??? Perhaps unselected."); gtk_widget_set_sensitive(widget, FALSE); } - gint start = ghb_settings_get_int(ud->settings, "start_chapter"); - gint end = ghb_settings_get_int(ud->settings, "end_chapter"); - widget = GHB_WIDGET (ud->builder, "ChapterMarkers"); - gtk_widget_set_sensitive(widget, TRUE); - if (start == end) - { - ud->dont_clear_presets = TRUE; - ghb_ui_update(ud, "ChapterMarkers", ghb_boolean_value(FALSE)); - ud->dont_clear_presets = FALSE; - gtk_widget_set_sensitive(widget, FALSE); + if (ghb_settings_combo_int(ud->settings, "PtoPType") == 0) + { + gint start, end; + start = ghb_settings_get_int(ud->settings, "start_point"); + end = ghb_settings_get_int(ud->settings, "end_point"); + widget = GHB_WIDGET (ud->builder, "ChapterMarkers"); + gtk_widget_set_sensitive(widget, TRUE); + if (start == end) + { + ud->dont_clear_presets = TRUE; + ghb_ui_update(ud, "ChapterMarkers", ghb_boolean_value(FALSE)); + ud->dont_clear_presets = FALSE; + gtk_widget_set_sensitive(widget, FALSE); + } } } diff --git a/gtk/src/queuehandler.c b/gtk/src/queuehandler.c index 4ba095710..24eded5d6 100644 --- a/gtk/src/queuehandler.c +++ b/gtk/src/queuehandler.c @@ -70,7 +70,7 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) gchar *dest, *preset, *vol_name, *basename; const gchar *vcodec, *container; gchar *fps, *vcodec_abbr; - gint title, start_chapter, end_chapter, width, height; + gint title, start_point, end_point, width, height; gint source_width, source_height; gboolean pass2 = FALSE, keep_aspect, vqtype, turbo; gint pic_par; @@ -84,8 +84,8 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) tweaks = ghb_settings_get_boolean(settings, "allow_tweaks"); title = ghb_settings_get_int(settings, "titlenum"); - start_chapter = ghb_settings_get_int(settings, "start_chapter"); - end_chapter = ghb_settings_get_int(settings, "end_chapter"); + start_point = ghb_settings_get_int(settings, "start_point"); + end_point = ghb_settings_get_int(settings, "end_point"); vol_name = ghb_settings_get_string(settings, "volume_label"); dest = ghb_settings_get_string(settings, "destination"); basename = g_path_get_basename(dest); @@ -94,12 +94,19 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) vqtype = ghb_settings_get_boolean(settings, "vquality_type_constant"); if (!vqtype) pass2 = ghb_settings_get_boolean(settings, "VideoTwoPass"); + const gchar *points; + if (ghb_settings_combo_int(settings, "PtoPType") == 0) + points = "Chapters"; + else if (ghb_settings_combo_int(settings, "PtoPType") == 1) + points = "Seconds"; + else if (ghb_settings_combo_int(settings, "PtoPType") == 2) + points = "Frames"; info = g_strdup_printf ( "<big><b>%s</b></big> " - "<small>(Title %d, Chapters %d through %d, %d Video %s)" + "<small>(Title %d, %s %d through %d, %d Video %s)" " --> %s</small>", - vol_name, title, start_chapter, end_chapter, + vol_name, title, points, start_point, end_point, pass2 ? 2:1, pass2 ? "Passes":"Pass", escape ); g_free(basename); @@ -1044,7 +1051,8 @@ ghb_queue_buttons_grey(signal_user_data_t *ud) scan_state = ghb_get_scan_state(); show_stop = queue_state & - (GHB_STATE_WORKING | GHB_STATE_SCANNING | GHB_STATE_MUXING); + (GHB_STATE_WORKING | GHB_STATE_SEARCHING | + GHB_STATE_SCANNING | GHB_STATE_MUXING); show_start = !(scan_state & GHB_STATE_SCANNING) && (titleindex >= 0 || queue_count > 0); @@ -1205,7 +1213,8 @@ queue_start_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) gint state; state = ghb_get_queue_state(); - if (state & (GHB_STATE_WORKING | GHB_STATE_SCANNING | GHB_STATE_MUXING)) + if (state & (GHB_STATE_WORKING | GHB_STATE_SEARCHING | + GHB_STATE_SCANNING | GHB_STATE_MUXING)) { ghb_cancel_encode(ud, "You are currently encoding. " "What would you like to do?"); diff --git a/gtk/src/settings.h b/gtk/src/settings.h index c499da53e..43fbdbfa9 100644 --- a/gtk/src/settings.h +++ b/gtk/src/settings.h @@ -34,6 +34,7 @@ enum GHB_STATE_WORKDONE = 0x10, GHB_STATE_PAUSED = 0x20, GHB_STATE_MUXING = 0x40, + GHB_STATE_SEARCHING = 0x80, }; enum diff --git a/gtk/src/widgetdeps.c b/gtk/src/widgetdeps.c index 4e161fa51..71a544719 100644 --- a/gtk/src/widgetdeps.c +++ b/gtk/src/widgetdeps.c @@ -23,11 +23,14 @@ static dependency_t dep_map[] = {"title", "picture_tab", "none", TRUE, FALSE}, {"title", "chapters_label", "none", TRUE, FALSE}, {"title", "chapters_tab", "none", TRUE, FALSE}, - {"title", "start_chapter", "none", TRUE, FALSE}, - {"title", "end_chapter", "none", TRUE, FALSE}, + {"title", "start_point", "none", TRUE, FALSE}, + {"title", "end_point", "none", TRUE, FALSE}, {"title", "angle", "none", TRUE, FALSE}, + {"title", "angle_label", "1", TRUE, FALSE}, {"use_dvdnav", "angle", "FALSE", TRUE, TRUE}, {"use_dvdnav", "angle_label", "FALSE", TRUE, TRUE}, + {"angle_count", "angle", "1", TRUE, TRUE}, + {"angle_count", "angle_label", "1", TRUE, TRUE}, {"vquality_type_bitrate", "VideoAvgBitrate", "TRUE", FALSE, FALSE}, {"vquality_type_target", "VideoTargetSize", "TRUE", FALSE, FALSE}, {"vquality_type_constant", "VideoQualitySlider", "TRUE", FALSE, FALSE}, |