summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gtk/src/ghb.ui4
-rw-r--r--gtk/src/hb-backend.c69
-rw-r--r--gtk/src/hb-backend.h1
-rw-r--r--gtk/src/main.c14
-rw-r--r--gtk/src/queuehandler.c5
-rw-r--r--gtk/src/subtitlehandler.c149
6 files changed, 211 insertions, 31 deletions
diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui
index ba9113a2c..54e99eeda 100644
--- a/gtk/src/ghb.ui
+++ b/gtk/src/ghb.ui
@@ -3225,7 +3225,7 @@ no-dct-decimate=0:cabac=1</property>
</child>
<child>
<object class="GtkProgressBar" id="progressbar">
- <property name="height_request">16</property>
+ <property name="height_request">20</property>
<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="text" translatable="yes"/>
@@ -5321,7 +5321,7 @@ the required multiple.</property>
</child>
<child>
<object class="GtkProgressBar" id="live_encode_progress">
- <property name="height_request">16</property>
+ <property name="height_request">20</property>
<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>
</object>
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index f5e96d7cd..b4635d2a6 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -3335,6 +3335,60 @@ ghb_validate_video(signal_user_data_t *ud)
}
gboolean
+ghb_validate_subtitles(signal_user_data_t *ud)
+{
+ hb_list_t * list;
+ hb_title_t * title;
+ gchar *message;
+
+ if (h_scan == NULL) return FALSE;
+ list = hb_get_titles( h_scan );
+ if( !hb_list_count( list ) )
+ {
+ /* No valid title, stop right there */
+ g_message("No title found.\n");
+ return FALSE;
+ }
+
+ gint titleindex;
+
+ titleindex = ghb_settings_combo_int(ud->settings, "title");
+ title = hb_list_item( list, titleindex );
+ if (title == NULL) return FALSE;
+ gint mux = ghb_settings_combo_int(ud->settings, "FileFormat");
+
+ const GValue *slist, *settings;
+ gint count, ii, track, source;
+ gboolean burned;
+
+ slist = ghb_settings_get_value(ud->settings, "subtitle_list");
+ count = ghb_array_len(slist);
+ for (ii = 0; ii < count; ii++)
+ {
+ settings = ghb_array_get_nth(slist, ii);
+ track = ghb_settings_combo_int(settings, "SubtitleTrack");
+ burned = ghb_settings_get_boolean(settings, "SubtitleBurned");
+ source = ghb_subtitle_track_source(ud, track);
+ if (!burned && mux == HB_MUX_MP4 && source == VOBSUB)
+ {
+ // MP4 can only handle burned vobsubs. make sure there isn't
+ // already something burned in the list
+ message = g_strdup_printf(
+ "Your chosen container does not support soft bitmap subtitles.\n\n"
+ "You should change your subtitle selections.\n"
+ "If you continue, some subtitles will be lost.");
+ if (!ghb_message_dialog(GTK_MESSAGE_WARNING, message, "Cancel", "Continue"))
+ {
+ g_free(message);
+ return FALSE;
+ }
+ g_free(message);
+ }
+ }
+ return TRUE;
+}
+
+gboolean
ghb_validate_audio(signal_user_data_t *ud)
{
hb_list_t * list;
@@ -3949,7 +4003,7 @@ add_job(hb_handle_t *h, GValue *js, gint unique_id, gint titleindex)
for (ii = 0; ii < count; ii++)
{
GValue *ssettings;
- gboolean burned;
+ gboolean burned, one_burned = FALSE;
ssettings = ghb_array_get_nth(subtitle_list, ii);
@@ -3971,6 +4025,19 @@ add_job(hb_handle_t *h, GValue *js, gint unique_id, gint titleindex)
{
subt->dest = PASSTHRUSUB;
}
+ else if (!burned && job->mux == HB_MUX_MP4 &&
+ subt->format == PICTURESUB)
+ {
+ // Skip any non-burned vobsubs when output is mp4
+ continue;
+ }
+ else if (subt->format == PICTURESUB)
+ {
+ // Only allow one subtitle to be burned into the video
+ if (one_burned)
+ continue;
+ one_burned = TRUE;
+ }
subt->force = ghb_settings_get_boolean(ssettings, "SubtitleForced");
hb_list_add(job->list_subtitle, subt);
}
diff --git a/gtk/src/hb-backend.h b/gtk/src/hb-backend.h
index 4517f44f0..43ad920d1 100644
--- a/gtk/src/hb-backend.h
+++ b/gtk/src/hb-backend.h
@@ -155,6 +155,7 @@ const char* ghb_subtitle_track_source_name(signal_user_data_t *ud, gint track);
gboolean ghb_validate_vquality(GValue *settings);
gboolean ghb_validate_audio(signal_user_data_t *ud);
+gboolean ghb_validate_subtitles(signal_user_data_t *ud);
gboolean ghb_validate_video(signal_user_data_t *ud);
gboolean ghb_validate_filters(signal_user_data_t *ud);
gboolean ghb_validate_filter_string(const gchar *str, gint max_fields);
diff --git a/gtk/src/main.c b/gtk/src/main.c
index d7a15c1b1..a9c07fab2 100644
--- a/gtk/src/main.c
+++ b/gtk/src/main.c
@@ -395,17 +395,19 @@ bind_subtitle_tree_model (signal_user_data_t *ud)
g_debug("bind_subtitle_tree_model ()\n");
treeview = GTK_TREE_VIEW(GHB_WIDGET (ud->builder, "subtitle_list"));
selection = gtk_tree_view_get_selection (treeview);
- // 5 columns in model. 4 are visible, the other 1 is for storing
+ // 6 columns in model. 4 are visible, the other 2 is for storing
// values that I need
- treestore = gtk_list_store_new(5,
+ treestore = gtk_list_store_new(8,
G_TYPE_STRING,
G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
- G_TYPE_STRING, G_TYPE_STRING);
+ G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_INT,
+ G_TYPE_INT);
gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(treestore));
cell = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes(
- _("Track"), cell, "text", 0, NULL);
+ column = gtk_tree_view_column_new_with_attributes( _("Track"), cell,
+ "text", 0, "foreground", 5, "weight", 6, "style", 7, NULL);
gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
cell = gtk_cell_renderer_toggle_new();
@@ -418,7 +420,7 @@ bind_subtitle_tree_model (signal_user_data_t *ud)
cell = gtk_cell_renderer_toggle_new();
gtk_cell_renderer_toggle_set_radio(GTK_CELL_RENDERER_TOGGLE(cell), TRUE);
column = gtk_tree_view_column_new_with_attributes(
- _("Burned In"), cell, "active", 2, NULL);
+ _("Burned In"), cell, "active", 2, "cell-background", 5, NULL);
gtk_tree_view_column_set_max_width (column, 50);
gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
g_signal_connect(cell, "toggled", subtitle_burned_toggled_cb, ud);
diff --git a/gtk/src/queuehandler.c b/gtk/src/queuehandler.c
index 1ac36ca89..41a207f12 100644
--- a/gtk/src/queuehandler.c
+++ b/gtk/src/queuehandler.c
@@ -625,6 +625,11 @@ validate_settings(signal_user_data_t *ud)
{
return FALSE;
}
+ // Validate audio settings
+ if (!ghb_validate_subtitles(ud))
+ {
+ return FALSE;
+ }
// Validate video settings
if (!ghb_validate_video(ud))
{
diff --git a/gtk/src/subtitlehandler.c b/gtk/src/subtitlehandler.c
index a910e2a99..70f1a6075 100644
--- a/gtk/src/subtitlehandler.c
+++ b/gtk/src/subtitlehandler.c
@@ -130,6 +130,27 @@ ghb_selected_subtitle_row(signal_user_data_t *ud)
return row;
}
+static gboolean
+mustBurn(signal_user_data_t *ud, gint track)
+{
+ gint mux;
+
+ mux = ghb_settings_combo_int(ud->settings, "FileFormat");
+ if (mux == HB_MUX_MP4)
+ {
+ gint source;
+
+ // MP4 can only handle burned vobsubs. make sure there isn't
+ // already something burned in the list
+ source = ghb_subtitle_track_source(ud, track);
+ if (source == VOBSUB)
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
GValue*
ghb_selected_subtitle_settings(signal_user_data_t *ud)
{
@@ -181,10 +202,10 @@ subtitle_list_refresh_selected(signal_user_data_t *ud)
selection = gtk_tree_view_get_selection (treeview);
if (gtk_tree_selection_get_selected(selection, &store, &iter))
{
- const gchar *track, *source;
+ const gchar *track, *source, *color;
gboolean forced, burned;
gchar *s_track;
- gint i_track;
+ gint i_track, weight, style;
// Get the row number
treepath = gtk_tree_model_get_path (store, &iter);
@@ -206,6 +227,19 @@ subtitle_list_refresh_selected(signal_user_data_t *ud)
i_track = ghb_settings_get_int(settings, "SubtitleTrack");
source = ghb_subtitle_track_source_name(ud, i_track);
+ if (!burned && mustBurn(ud, i_track))
+ {
+ weight = 800;
+ style = 2;
+ color = "red";
+ }
+ else
+ {
+ weight = 400;
+ style = 0;
+ color = NULL;
+ }
+
gtk_list_store_set(GTK_LIST_STORE(store), &iter,
// These are displayed in list
0, track,
@@ -214,6 +248,9 @@ subtitle_list_refresh_selected(signal_user_data_t *ud)
3, source,
// These are used to set combo values when a list item is selected
4, s_track,
+ 5, color,
+ 6, weight,
+ 7, style,
-1);
g_free(s_track);
}
@@ -264,25 +301,48 @@ subtitle_forced_toggled_cb(
}
}
-static gboolean
-mustBurn(signal_user_data_t *ud, gint track)
+void
+ghb_subtitle_exclusive_burn(signal_user_data_t *ud, gint track)
{
- gint mux;
+ GValue *subtitle_list;
+ GValue *settings;
+ gint ii, count, tt;
+ GtkTreeView *tv;
+ GtkTreeModel *tm;
+ GtkTreeIter ti;
+ gboolean burned;
- mux = ghb_settings_combo_int(ud->settings, "FileFormat");
- if (mux == HB_MUX_MP4)
+ g_debug("ghb_subtitle_exclusive_burn");
+ subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
+ count = ghb_array_len(subtitle_list);
+ for (ii = 0; ii < count; ii++)
{
- gint source;
+ settings = ghb_array_get_nth(subtitle_list, ii);
+ tt = ghb_settings_combo_int(settings, "SubtitleTrack");
+ burned = ghb_settings_get_boolean(settings, "SubtitleBurned");
- // MP4 can only handle burned vobsubs. make sure there isn't
- // already something burned in the list
- source = ghb_subtitle_track_source(ud, track);
- if (source == VOBSUB)
+ tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
+ g_return_if_fail(tv != NULL);
+ tm = gtk_tree_view_get_model(tv);
+ gtk_tree_model_iter_nth_child(tm, &ti, NULL, ii);
+ if (burned && tt != track)
{
- return TRUE;
+
+ ghb_settings_set_boolean(settings, "SubtitleBurned", FALSE);
+ burned = FALSE;
+ gtk_list_store_set(GTK_LIST_STORE(tm), &ti, 2, FALSE, -1);
+ }
+ if (!burned && mustBurn(ud, tt))
+ {
+ gtk_list_store_set(GTK_LIST_STORE(tm), &ti,
+ 5, "red", 6, 800, 7, 2, -1);
+ }
+ else
+ {
+ gtk_list_store_set(GTK_LIST_STORE(tm), &ti,
+ 5, NULL, 6, 400, 7, 0, -1);
}
}
- return FALSE;
}
G_MODULE_EXPORT void
@@ -328,7 +388,10 @@ subtitle_burned_toggled_cb(
return;
ghb_settings_set_boolean(settings, "SubtitleBurned", active);
+
gtk_list_store_set(GTK_LIST_STORE(tm), &ti, 2, active, -1);
+ // Unburn the rest
+ ghb_subtitle_exclusive_burn(ud, track);
}
static gboolean
@@ -398,6 +461,8 @@ ghb_subtitle_adjust_burn(signal_user_data_t *ud)
GtkTreeView *tv;
GtkTreeModel *tm;
GtkTreeIter ti;
+ gboolean burned;
+ gint burned_count = 0;
g_debug("ghb_subtitle_adjust_burn");
subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
@@ -408,13 +473,36 @@ ghb_subtitle_adjust_burn(signal_user_data_t *ud)
track = ghb_settings_combo_int(settings, "SubtitleTrack");
if (mustBurn(ud, track))
{
- tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
- g_return_if_fail(tv != NULL);
- tm = gtk_tree_view_get_model(tv);
- gtk_tree_model_iter_nth_child(tm, &ti, NULL, ii);
+ burned_count++;
+ }
+ }
+ for (ii = 0; ii < count; ii++)
+ {
+ settings = ghb_array_get_nth(subtitle_list, ii);
+ track = ghb_settings_combo_int(settings, "SubtitleTrack");
+ burned = ghb_settings_get_boolean(settings, "SubtitleBurned");
- ghb_settings_set_boolean(settings, "SubtitleBurned", TRUE);
- gtk_list_store_set(GTK_LIST_STORE(tm), &ti, 2, TRUE, -1);
+ tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
+ g_return_if_fail(tv != NULL);
+ tm = gtk_tree_view_get_model(tv);
+ gtk_tree_model_iter_nth_child(tm, &ti, NULL, ii);
+ if (!burned && mustBurn(ud, track))
+ {
+ if (burned_count > 1)
+ {
+ gtk_list_store_set(GTK_LIST_STORE(tm), &ti,
+ 5, "red", 6, 800, 7, 2, -1);
+ }
+ else
+ {
+ ghb_settings_set_boolean(settings, "SubtitleBurned", TRUE);
+ gtk_list_store_set(GTK_LIST_STORE(tm), &ti, 2, TRUE, -1);
+ }
+ }
+ else
+ {
+ gtk_list_store_set(GTK_LIST_STORE(tm), &ti,
+ 5, NULL, 6, 400, 7, 0, -1);
}
}
}
@@ -447,10 +535,10 @@ add_to_subtitle_list(signal_user_data_t *ud, GValue *settings)
GtkTreeIter iter;
GtkListStore *store;
GtkTreeSelection *selection;
- const gchar *track, *source;
+ const gchar *track, *source, *color;
gboolean forced, burned;
gchar *s_track;
- gint i_track;
+ gint i_track, weight, style;
g_debug("add_to_subtitle_list ()");
treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
@@ -465,6 +553,19 @@ add_to_subtitle_list(signal_user_data_t *ud, GValue *settings)
i_track = ghb_settings_get_int(settings, "SubtitleTrack");
source = ghb_subtitle_track_source_name(ud, i_track);
+ if (!burned && mustBurn(ud, i_track))
+ {
+ weight = 800;
+ style = 2;
+ color = "red";
+ }
+ else
+ {
+ weight = 400;
+ style = 0;
+ color = NULL;
+ }
+
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
// These are displayed in list
@@ -474,9 +575,13 @@ add_to_subtitle_list(signal_user_data_t *ud, GValue *settings)
3, source,
// These are used to set combo box values when a list item is selected
4, s_track,
+ 5, color,
+ 6, weight,
+ 7, style,
-1);
gtk_tree_selection_select_iter(selection, &iter);
g_free(s_track);
+ ghb_subtitle_exclusive_burn(ud, i_track);
}
G_MODULE_EXPORT void