summaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2009-06-04 21:14:41 +0000
committerjstebbins <[email protected]>2009-06-04 21:14:41 +0000
commit65cb895b41176c6c06558a5fd52a6f2657c65ad2 (patch)
tree249a1902ccb0741bcb4a3dc903fd3af4d97ab104 /gtk
parentf1a347e745c0570ffaaac9bd270f4d8578d3d1b3 (diff)
LinGui: make "Foreign Audio Search" a separate widget instead of adding it
like a to the subtitle track list as if it were a regular subtitle track. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2485 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk')
-rw-r--r--gtk/src/ghb.ui75
-rw-r--r--gtk/src/hb-backend.c83
-rw-r--r--gtk/src/internal_defaults.xml8
-rw-r--r--gtk/src/subtitlehandler.c48
-rw-r--r--gtk/src/widgetdeps.c2
5 files changed, 160 insertions, 56 deletions
diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui
index 109f0ac68..473cac057 100644
--- a/gtk/src/ghb.ui
+++ b/gtk/src/ghb.ui
@@ -2280,6 +2280,79 @@
</packing>
</child>
<child>
+ <object class="GtkHBox" id="hbox79">
+ <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">15</property>
+ <child>
+ <object class="GtkCheckButton" id="SubtitleForeignSearch">
+ <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">Search subtitle tracks for one that may contain subtitles for foreign language segments of the audio track.</property>
+ <property name="label" translatable="yes">Foreign Audio Search</property>
+ <property name="active">False</property>
+ <property name="draw_indicator">True</property>
+ <signal handler="subtitle_foreign_changed_cb" name="toggled"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="SubtitleForeignForced">
+ <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">Only used the forced subtitles found.</property>
+ <property name="label" translatable="yes">Forced</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="setting_widget_changed_cb"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="SubtitleForeignBurned">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip-text" translatable="yes">Burn subtitle into the video track.</property>
+ <property name="label" translatable="yes">Burned</property>
+ <property name="active">False</property>
+ <property name="draw_indicator">True</property>
+ <signal handler="subtitle_foreign_changed_cb" name="toggled"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="SubtitleForeignDefaultTrack">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip-text" translatable="yes">Mark as the default subtitle track. Most players will display this track automatically.</property>
+ <property name="label" translatable="yes">Default</property>
+ <property name="active">False</property>
+ <property name="draw_indicator">True</property>
+ <signal handler="subtitle_foreign_changed_cb" name="toggled"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ <property name="expand">False</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkScrolledWindow" id="scrolledwindow4">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -2296,7 +2369,7 @@
</child>
</object>
<packing>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index 4b2e607c2..22ea2efbc 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -1707,26 +1707,14 @@ subtitle_track_opts_set(GtkBuilder *builder, const gchar *name, gint titleindex)
if (subtitle_opts.map) g_free(subtitle_opts.map);
if (count > 0)
{
- subtitle_opts.count = count+1;
- subtitle_opts.map = g_malloc((count+1)*sizeof(options_map_t));
+ subtitle_opts.count = count;
+ subtitle_opts.map = g_malloc((count)*sizeof(options_map_t));
}
else
{
- subtitle_opts.count = LANG_TABLE_SIZE+1;
- subtitle_opts.map = g_malloc((LANG_TABLE_SIZE+1)*sizeof(options_map_t));
+ subtitle_opts.count = LANG_TABLE_SIZE;
+ subtitle_opts.map = g_malloc((LANG_TABLE_SIZE)*sizeof(options_map_t));
}
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, "Foreign Audio Search",
- 1, TRUE,
- 2, "-1",
- 3, -1.0,
- 4, "auto",
- -1);
- subtitle_opts.map[0].option = "Foreign Audio Search";
- subtitle_opts.map[0].shortOpt = "-1";
- subtitle_opts.map[0].ivalue = -1;
- subtitle_opts.map[0].svalue = "auto";
if (count > 0)
{
if (options != NULL)
@@ -1739,10 +1727,10 @@ subtitle_track_opts_set(GtkBuilder *builder, const gchar *name, gint titleindex)
// Skip subtitles that must be burned if there is already
// a burned subtitle in the list
options[ii] = g_strdup_printf("%d - %s", ii+1, subtitle->lang);
- subtitle_opts.map[ii+1].option = options[ii];
- subtitle_opts.map[ii+1].shortOpt = index_str[ii];
- subtitle_opts.map[ii+1].ivalue = ii;
- subtitle_opts.map[ii+1].svalue = subtitle->iso639_2;
+ subtitle_opts.map[ii].option = options[ii];
+ subtitle_opts.map[ii].shortOpt = index_str[ii];
+ subtitle_opts.map[ii].ivalue = ii;
+ subtitle_opts.map[ii].svalue = subtitle->iso639_2;
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
0, options[ii],
@@ -1759,10 +1747,10 @@ subtitle_track_opts_set(GtkBuilder *builder, const gchar *name, gint titleindex)
index_str_init(LANG_TABLE_SIZE-1);
for (ii = 0; ii < LANG_TABLE_SIZE; ii++)
{
- subtitle_opts.map[ii+1].option = ghb_language_table[ii].eng_name;
- subtitle_opts.map[ii+1].shortOpt = index_str[ii];
- subtitle_opts.map[ii+1].ivalue = ii;
- subtitle_opts.map[ii+1].svalue = ghb_language_table[ii].iso639_2;
+ subtitle_opts.map[ii].option = ghb_language_table[ii].eng_name;
+ subtitle_opts.map[ii].shortOpt = index_str[ii];
+ subtitle_opts.map[ii].ivalue = ii;
+ subtitle_opts.map[ii].svalue = ghb_language_table[ii].iso639_2;
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
0, ghb_language_table[ii].eng_name,
@@ -3976,47 +3964,44 @@ add_job(hb_handle_t *h, GValue *js, gint unique_id, gint titleindex)
const GValue *subtitle_list;
gint subtitle;
+ gboolean force, burned, def, one_burned = FALSE;
job->select_subtitle = NULL;
- subtitle_list = ghb_settings_get_value(js, "subtitle_list");
- count = ghb_array_len(subtitle_list);
- for (ii = 0; ii < count; ii++)
+ if (ghb_settings_get_boolean(js, "SubtitleForeignSearch"))
{
- GValue *ssettings;
- gboolean force, burned, def, one_burned = FALSE;
-
- ssettings = ghb_array_get_nth(subtitle_list, ii);
+ force = ghb_settings_get_boolean(js, "SubtitleForeignForced");
+ burned = ghb_settings_get_boolean(js, "SubtitleForeignBurned");
+ def = ghb_settings_get_boolean(js, "SubtitleForeignDefaultTrack");
- subtitle = ghb_settings_get_int(ssettings, "SubtitleTrack");
- force = ghb_settings_get_boolean(ssettings, "SubtitleForced");
- burned = ghb_settings_get_boolean(ssettings, "SubtitleBurned");
- def = ghb_settings_get_boolean(ssettings, "SubtitleDefaultTrack");
-
- if (subtitle == -1)
+ if (burned || job->mux != HB_MUX_MP4)
{
if (!burned && job->mux == HB_MUX_MKV)
{
job->select_subtitle_config.dest = PASSTHRUSUB;
}
- else if (!burned && job->mux == HB_MUX_MP4)
- {
- // Skip any non-burned vobsubs when output is mp4
- continue;
- }
- else
- {
- // Only allow one subtitle to be burned into the video
- if (one_burned)
- continue;
+ if (burned)
one_burned = TRUE;
- }
job->select_subtitle_config.force = force;
job->select_subtitle_config.default_track = def;
job->indepth_scan = 1;
job->select_subtitle = malloc(sizeof(hb_subtitle_t*));
*job->select_subtitle = NULL;
}
- else if (subtitle >= 0)
+ }
+ subtitle_list = ghb_settings_get_value(js, "subtitle_list");
+ count = ghb_array_len(subtitle_list);
+ for (ii = 0; ii < count; ii++)
+ {
+ GValue *ssettings;
+
+ ssettings = ghb_array_get_nth(subtitle_list, ii);
+
+ subtitle = ghb_settings_get_int(ssettings, "SubtitleTrack");
+ force = ghb_settings_get_boolean(ssettings, "SubtitleForced");
+ burned = ghb_settings_get_boolean(ssettings, "SubtitleBurned");
+ def = ghb_settings_get_boolean(ssettings, "SubtitleDefaultTrack");
+
+ if (subtitle >= 0)
{
hb_subtitle_t * subt;
hb_subtitle_config_t sub_config;
diff --git a/gtk/src/internal_defaults.xml b/gtk/src/internal_defaults.xml
index 64de850b8..ac8bfa088 100644
--- a/gtk/src/internal_defaults.xml
+++ b/gtk/src/internal_defaults.xml
@@ -266,6 +266,14 @@
<integer>1</integer>
<key>SourceAudioLang</key>
<string>und</string>
+ <key>SubtitleForeignSearch</key>
+ <false />
+ <key>SubtitleForeignForced</key>
+ <true />
+ <key>SubtitleForeignBurned</key>
+ <false />
+ <key>SubtitleForeignDefaultTrack</key>
+ <false />
<key>SubtitleList</key>
<array>
<dict>
diff --git a/gtk/src/subtitlehandler.c b/gtk/src/subtitlehandler.c
index 70d96224c..1a54fecf3 100644
--- a/gtk/src/subtitlehandler.c
+++ b/gtk/src/subtitlehandler.c
@@ -18,6 +18,7 @@
#include "values.h"
#include "callbacks.h"
#include "preview.h"
+#include "presets.h"
#include "subtitlehandler.h"
static void add_to_subtitle_list(signal_user_data_t *ud, GValue *settings);
@@ -70,6 +71,12 @@ ghb_subtitle_exclusive_burn(signal_user_data_t *ud, gint index)
g_debug("ghb_subtitle_exclusive_burn");
subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
count = ghb_array_len(subtitle_list);
+ if (index != -1)
+ {
+ burned = ghb_settings_get_boolean(ud->settings, "SubtitleForeignBurned");
+ if (burned && !mustBurn(ud, -1))
+ ghb_ui_update(ud, "SubtitleForeignBurned", ghb_boolean_value(FALSE));
+ }
for (ii = 0; ii < count; ii++)
{
settings = ghb_array_get_nth(subtitle_list, ii);
@@ -83,18 +90,17 @@ ghb_subtitle_exclusive_burn(signal_user_data_t *ud, gint index)
if (burned && ii != index && !mustBurn(ud, tt))
{
ghb_settings_set_boolean(settings, "SubtitleBurned", FALSE);
- burned = FALSE;
gtk_list_store_set(GTK_LIST_STORE(tm), &ti, 2, FALSE, -1);
}
}
}
void
-ghb_subtitle_exclusive_default(signal_user_data_t *ud, gint track)
+ghb_subtitle_exclusive_default(signal_user_data_t *ud, gint index)
{
GValue *subtitle_list;
GValue *settings;
- gint ii, count, tt;
+ gint ii, count;
GtkTreeView *tv;
GtkTreeModel *tm;
GtkTreeIter ti;
@@ -103,17 +109,22 @@ ghb_subtitle_exclusive_default(signal_user_data_t *ud, gint track)
g_debug("ghb_subtitle_exclusive_default");
subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
count = ghb_array_len(subtitle_list);
+ if (index != -1)
+ {
+ def = ghb_settings_get_boolean(ud->settings, "SubtitleForeignDefaultTrack");
+ if (def)
+ ghb_ui_update(ud, "SubtitleForeignDefaultTrack", ghb_boolean_value(FALSE));
+ }
for (ii = 0; ii < count; ii++)
{
settings = ghb_array_get_nth(subtitle_list, ii);
- tt = ghb_settings_combo_int(settings, "SubtitleTrack");
def = ghb_settings_get_boolean(settings, "SubtitleDefaultTrack");
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 (def && tt != track)
+ if (def && ii != index)
{
ghb_settings_set_boolean(settings, "SubtitleDefaultTrack", FALSE);
@@ -429,7 +440,7 @@ subtitle_default_toggled_cb(
gtk_list_store_set(GTK_LIST_STORE(tm), &ti, 3, active, -1);
// allow only one default
- ghb_subtitle_exclusive_default(ud, track);
+ ghb_subtitle_exclusive_default(ud, row);
}
static void
@@ -743,6 +754,13 @@ ghb_subtitle_prune(signal_user_data_t *ud)
{
ghb_subtitle_exclusive_burn(ud, first_track);
}
+ int mux;
+ mux = ghb_settings_combo_int(ud->settings, "FileFormat");
+ if (mux == HB_MUX_MP4)
+ {
+ ghb_ui_update(ud, "SubtitleForeignBurned", ghb_boolean_value(TRUE));
+ ghb_ui_update(ud, "SubtitleForeignDefaultTrack", ghb_boolean_value(FALSE));
+ }
}
void
@@ -768,3 +786,21 @@ ghb_reset_subtitles(signal_user_data_t *ud, GValue *settings)
}
}
+G_MODULE_EXPORT void
+subtitle_foreign_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
+{
+ ghb_widget_to_setting(ud->settings, widget);
+ ghb_check_dependency(ud, widget);
+ ghb_clear_presets_selection(ud);
+ ghb_live_reset(ud);
+
+ if (ghb_settings_get_boolean(ud->settings, "SubtitleForeignBurned"))
+ {
+ ghb_subtitle_exclusive_burn(ud, -1);
+ }
+ if (ghb_settings_get_boolean(ud->settings, "SubtitleForeignDefaultTrack"))
+ {
+ ghb_subtitle_exclusive_default(ud, -1);
+ }
+}
+
diff --git a/gtk/src/widgetdeps.c b/gtk/src/widgetdeps.c
index af8049f58..90e80756b 100644
--- a/gtk/src/widgetdeps.c
+++ b/gtk/src/widgetdeps.c
@@ -40,6 +40,8 @@ static dependency_t dep_map[] =
{"FileFormat", "Mp4LargeFile", "mp4|m4v", FALSE, TRUE},
{"FileFormat", "Mp4HttpOptimize", "mp4|m4v", FALSE, TRUE},
{"FileFormat", "Mp4iPodCompatible", "mp4|m4v", FALSE, TRUE},
+ {"FileFormat", "SubtitleForeignBurned", "mp4|m4v", TRUE, FALSE},
+ {"FileFormat", "SubtitleForeignDefaultTrack", "mp4|m4v", TRUE, FALSE},
{"PictureDecomb", "PictureDeinterlace", "none", FALSE, FALSE},
{"PictureDecomb", "PictureDeinterlaceCustom", "none", FALSE, TRUE},
{"PictureDeinterlace", "PictureDeinterlaceCustom", "custom", FALSE, TRUE},