diff options
author | jstebbins <[email protected]> | 2009-05-22 22:46:59 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2009-05-22 22:46:59 +0000 |
commit | 8690c484f325fab8335f8a87a10406726994961d (patch) | |
tree | 56402128900795487bb5f8f81ccf1269befb0679 /gtk | |
parent | f9244003bdb97772ac713c1676b24ee2cf4a125a (diff) |
LinGui: fix a couple bugs in subtitle handling
- validation of subtitiles wasn't looking at the 'enabled' flag so it
gave an incorrect warning message for subtitles that were not enabled
- subtitles were being erroneously enabled when there was no subtitle
list in the preset
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2440 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/src/hb-backend.c | 29 | ||||
-rw-r--r-- | gtk/src/internal_defaults.xml | 4 | ||||
-rw-r--r-- | gtk/src/subtitlehandler.c | 10 |
3 files changed, 15 insertions, 28 deletions
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index 5fa554917..c1ce23e07 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -1710,8 +1710,8 @@ ghb_subtitle_track_model(signal_user_data_t *ud, gint titleindex) } else { - subtitle_opts.count = LANG_TABLE_SIZE+2; - subtitle_opts.map = g_malloc((LANG_TABLE_SIZE+2)*sizeof(options_map_t)); + subtitle_opts.count = LANG_TABLE_SIZE+1; + subtitle_opts.map = g_malloc((LANG_TABLE_SIZE+1)*sizeof(options_map_t)); } if (ud->subtitle_track_model == NULL) { @@ -1766,25 +1766,13 @@ ghb_subtitle_track_model(signal_user_data_t *ud, gint titleindex) } else { - gtk_list_store_append(store, &iter); - gtk_list_store_set(store, &iter, - 0, "Closed Captions", - 1, TRUE, - 2, "-2", - 3, -2.0, - 4, "und", - -1); - subtitle_opts.map[1].option = "Closed Captions"; - subtitle_opts.map[1].shortOpt = "-2"; - subtitle_opts.map[1].ivalue = -2; - subtitle_opts.map[1].svalue = "und"; index_str_init(LANG_TABLE_SIZE-1); for (ii = 0; ii < LANG_TABLE_SIZE; ii++) { - subtitle_opts.map[ii+2].option = ghb_language_table[ii].eng_name; - subtitle_opts.map[ii+2].shortOpt = index_str[ii]; - subtitle_opts.map[ii+2].ivalue = ii; - subtitle_opts.map[ii+2].svalue = ghb_language_table[ii].iso639_2; + 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; gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, 0, ghb_language_table[ii].eng_name, @@ -3416,7 +3404,7 @@ ghb_validate_subtitles(signal_user_data_t *ud) const GValue *slist, *settings; gint count, ii, track, source; - gboolean burned; + gboolean burned, enabled; slist = ghb_settings_get_value(ud->settings, "subtitle_list"); count = ghb_array_len(slist); @@ -3424,9 +3412,10 @@ ghb_validate_subtitles(signal_user_data_t *ud) { settings = ghb_array_get_nth(slist, ii); track = ghb_settings_combo_int(settings, "SubtitleTrack"); + enabled = ghb_settings_get_boolean(settings, "SubtitleEnabled"); burned = ghb_settings_get_boolean(settings, "SubtitleBurned"); source = ghb_subtitle_track_source(ud, track); - if (!burned && mux == HB_MUX_MP4 && source == VOBSUB) + if (enabled && !burned && mux == HB_MUX_MP4 && source == VOBSUB) { // MP4 can only handle burned vobsubs. make sure there isn't // already something burned in the list diff --git a/gtk/src/internal_defaults.xml b/gtk/src/internal_defaults.xml index be58588e0..2c5bb2043 100644 --- a/gtk/src/internal_defaults.xml +++ b/gtk/src/internal_defaults.xml @@ -267,10 +267,12 @@ <key>SubtitleList</key> <array> <dict> + <key>SubtitleEnabled</key> + <false /> <key>SubtitleLanguage</key> <string>und</string> <key>SubtitleForced</key> - <false /> + <true /> <key>SubtitleBurned</key> <true /> </dict> diff --git a/gtk/src/subtitlehandler.c b/gtk/src/subtitlehandler.c index 6dcded511..255da4744 100644 --- a/gtk/src/subtitlehandler.c +++ b/gtk/src/subtitlehandler.c @@ -68,14 +68,13 @@ add_all_pref_subtitles(signal_user_data_t *ud) for (ii = 0; ii < count; ii++) { subtitle = ghb_value_dup(ghb_array_get_nth(pref_subtitle, ii)); - ghb_settings_set_boolean(subtitle, "SubtitleEnabled", TRUE); lang = ghb_settings_get_string(subtitle, "SubtitleLanguage"); // If there are multiple subtitles using the same language, then // select sequential tracks for each. The hash keeps track // of the tracks used for each language. track = ghb_find_pref_subtitle_track(lang); g_free(lang); - if (track >= 0) + if (track >= -1) { // Add to subtitle list ghb_settings_set_int(subtitle, "SubtitleTrack", track); @@ -88,7 +87,6 @@ void ghb_set_pref_subtitle(gint titleindex, signal_user_data_t *ud) { gint track; - GtkWidget *button; GHashTable *track_indices; char *lang; @@ -107,9 +105,8 @@ ghb_set_pref_subtitle(gint titleindex, signal_user_data_t *ud) return; } ghb_add_all_subtitles(ud, titleindex); - // Find "best" subtitle based on subtitle preferences - button = GHB_WIDGET (ud->builder, "subtitle_add"); + // Find "best" subtitle based on subtitle preferences pref_subtitle = ghb_settings_get_value(ud->settings, "SubtitleList"); count = ghb_array_len(pref_subtitle); @@ -122,9 +119,8 @@ ghb_set_pref_subtitle(gint titleindex, signal_user_data_t *ud) // of the tracks used for each language. track = ghb_find_subtitle_track(titleindex, lang, track_indices); g_free(lang); - if (track >= 0) + if (track >= -1) { - ghb_settings_set_boolean(subtitle, "SubtitleEnabled", TRUE); ghb_set_subtitle(ud, track, subtitle); } } |