From: jstebbins Date: Sun, 15 Feb 2015 00:04:23 +0000 (+0000) Subject: LinGui: add Burn-In options to subtitle defaults X-Git-Tag: 1.0.0~1424 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c721fa4582108285a8399348ad098fc4e0a766ae;p=handbrake LinGui: add Burn-In options to subtitle defaults git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6903 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- diff --git a/gtk/src/ghb-3.12.ui b/gtk/src/ghb-3.12.ui index bd2b1e5ae..13bf790f3 100644 --- a/gtk/src/ghb-3.12.ui +++ b/gtk/src/ghb-3.12.ui @@ -4668,6 +4668,10 @@ This permits DTS-HD passthru to be selected when automatic passthru selection is True False + Create a list of languages you would like to select subtitles for. + +The first language in this list is your "preferred" language and will be used +for determining subtitle selection settings when there is foreign audio. @@ -4812,12 +4816,127 @@ This search pass finds short sequences of foreign audio and provides subtitles f True False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Closed captions are text subtitles that can be added to any container as a soft subtitle track (not burned) + Closed captions are text subtitles that can be added to any container as a soft subtitle track start True + + + horizontal + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 4 + + + True + False + end + Burn-In Behavior: + right + + + 0 + + + + + True + GTK_ALIGN_CENTER + False + Set the behavior of subtitle "Burn-In". + +Burned-In subtitles are part of the video and can not be disabled during playback. +Only one subtitle track can be burned! Since conflicts can occur, the first chosen wins. + + + + 1 + + + + + 4 + + + + + horizontal + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 4 + + + True + False + end + Burn-In for deficient players: + right + + + 0 + + + + + DVD Subtitles + True + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Burn the first selected DVD subtitle track. All other DVD subtitle tracks will be discarded. +Use this option if your player software or device does not support DVD subtitles. + +Only one subtitle track can be burned! Since conflicts can occur, the first chosen wins. + start + True + + + + 1 + + + + + Blu-ray Subtitles + True + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Burn the first selected Blu-ray subtitle track. All other Blu-ray subtitle tracks will be discarded. +Use this option if your player software or device does not support Blu-ray subtitles. + +Only one subtitle track can be burned! Since conflicts can occur, the first chosen wins. + start + True + + + + 2 + + + + + 5 + + + + + True + False + start + <small>* Only one of the above subtitle burn options will be applied, starting with the top.</small> + Only one subtitle track can be burned! Since conflicts can occur, the first chosen wins. + True + left + + + 6 + + 5 diff --git a/gtk/src/ghb-3.14.ui b/gtk/src/ghb-3.14.ui index 408230d54..084c22124 100644 --- a/gtk/src/ghb-3.14.ui +++ b/gtk/src/ghb-3.14.ui @@ -4669,6 +4669,10 @@ This permits DTS-HD passthru to be selected when automatic passthru selection is True False + Create a list of languages you would like to select subtitles for. + +The first language in this list is your "preferred" language and will be used +for determining subtitle selection settings when there is foreign audio. @@ -4813,11 +4817,129 @@ This search pass finds short sequences of foreign audio and provides subtitles f True False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Closed captions are text subtitles that can be added to any container as a soft subtitle track (not burned) + Closed captions are text subtitles that can be added to any container as a soft subtitle track start True + + 3 + + + + + horizontal + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 4 + + + True + False + end + Burn-In Behavior*: + right + + + 0 + + + + + True + GTK_ALIGN_CENTER + False + Set the behavior of subtitle "Burn-In". + +Burned-In subtitles are part of the video and can not be disabled during playback. +Only one subtitle track can be burned! Since conflicts can occur, the first chosen wins. + + + + 1 + + + + + 4 + + + + + horizontal + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 4 + + + True + False + end + Burn-In for deficient players*: + right + + + 0 + + + + + DVD Subtitles + True + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Burn the first selected DVD subtitle track. All other DVD subtitle tracks will be discarded. +Use this option if your player software or device does not support DVD subtitles. + +Only one subtitle track can be burned! Since conflicts can occur, the first chosen wins. + start + True + + + + 1 + + + + + Blu-ray Subtitles + True + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Burn the first selected Blu-ray subtitle track. All other Blu-ray subtitle tracks will be discarded. +Use this option if your player software or device does not support Blu-ray subtitles. + +Only one subtitle track can be burned! Since conflicts can occur, the first chosen wins. + start + True + + + + 2 + + + + + 5 + + + + + True + False + start + <small>* Only one of the above subtitle burn options will be applied, starting with the top.</small> + Only one subtitle track can be burned! Since conflicts can occur, the first chosen wins. + True + left + + + 6 + diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui index c91ccfc31..1a2abcc18 100644 --- a/gtk/src/ghb.ui +++ b/gtk/src/ghb.ui @@ -4668,6 +4668,10 @@ This permits DTS-HD passthru to be selected when automatic passthru selection is True False + Create a list of languages you would like to select subtitles for. + +The first language in this list is your "preferred" language and will be used +for determining subtitle selection settings when there is foreign audio. @@ -4812,12 +4816,127 @@ This search pass finds short sequences of foreign audio and provides subtitles f True False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Closed captions are text subtitles that can be added to any container as a soft subtitle track (not burned) + Closed captions are text subtitles that can be added to any container as a soft subtitle track start True + + + horizontal + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 4 + + + True + False + end + Burn-In Behavior: + right + + + 0 + + + + + True + GTK_ALIGN_CENTER + False + Set the behavior of subtitle "Burn-In". + +Burned-In subtitles are part of the video and can not be disabled during playback. +Only one subtitle track can be burned! Since conflicts can occur, the first chosen wins. + + + + 1 + + + + + 4 + + + + + horizontal + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 4 + + + True + False + end + Burn-In for deficient players: + right + + + 0 + + + + + DVD Subtitles + True + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Burn the first selected DVD subtitle track. All other DVD subtitle tracks will be discarded. +Use this option if your player software or device does not support DVD subtitles. + +Only one subtitle track can be burned! Since conflicts can occur, the first chosen wins. + start + True + + + + 1 + + + + + Blu-ray Subtitles + True + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Burn the first selected Blu-ray subtitle track. All other Blu-ray subtitle tracks will be discarded. +Use this option if your player software or device does not support Blu-ray subtitles. + +Only one subtitle track can be burned! Since conflicts can occur, the first chosen wins. + start + True + + + + 2 + + + + + 5 + + + + + True + False + start + <small>* Only one of the above subtitle burn options will be applied, starting with the top.</small> + Only one subtitle track can be burned! Since conflicts can occur, the first chosen wins. + True + left + + + 6 + + 5 diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index 5489ad0f7..2216df598 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -65,6 +65,19 @@ combo_opts_t subtitle_track_sel_opts = d_subtitle_track_sel_opts }; +static options_map_t d_subtitle_burn_opts[] = +{ + {N_("None"), "none", 0, "0"}, + {N_("Foreign Audio Subtitle Track"), "foreign", 1, "1"}, + {N_("First Selected Track"), "first", 2, "2"}, + {N_("Foreign Audio, then First Selected Track"), "foreign_first", 3, "3"}, +}; +combo_opts_t subtitle_burn_opts = +{ + sizeof(d_subtitle_burn_opts)/sizeof(options_map_t), + d_subtitle_burn_opts +}; + static options_map_t d_audio_track_sel_opts[] = { {N_("None"), "none", 0, "0"}, @@ -380,6 +393,7 @@ typedef struct combo_name_map_t combo_name_map[] = { {"SubtitleTrackSelectionBehavior", &subtitle_track_sel_opts}, + {"SubtitleBurnBehavior", &subtitle_burn_opts}, {"AudioTrackSelectionBehavior", &audio_track_sel_opts}, {"PtoPType", &point_to_point_opts}, {"WhenComplete", &when_complete_opts}, @@ -2569,6 +2583,7 @@ ghb_update_ui_combo_box( subtitle_track_opts_set(ud->builder, "SubtitleTrack", user_data); small_opts_set(ud->builder, "VideoQualityGranularity", &vqual_granularity_opts); small_opts_set(ud->builder, "SubtitleTrackSelectionBehavior", &subtitle_track_sel_opts); + small_opts_set(ud->builder, "SubtitleBurnBehavior", &subtitle_burn_opts); small_opts_set(ud->builder, "AudioTrackSelectionBehavior", &audio_track_sel_opts); small_opts_set(ud->builder, "PtoPType", &point_to_point_opts); small_opts_set(ud->builder, "WhenComplete", &when_complete_opts); diff --git a/gtk/src/internal_defaults.xml b/gtk/src/internal_defaults.xml index 3a71a1c01..a43f45841 100644 --- a/gtk/src/internal_defaults.xml +++ b/gtk/src/internal_defaults.xml @@ -337,6 +337,12 @@ SubtitleAddForeignAudioSubtitle + SubtitleBurnBehavior + none + SubtitleBurnDVDSub + + SubtitleBurnBDSub + VideoTurboTwoPass UsesPictureFilters diff --git a/gtk/src/subtitlehandler.c b/gtk/src/subtitlehandler.c index 960fdb0ff..d584474f8 100644 --- a/gtk/src/subtitlehandler.c +++ b/gtk/src/subtitlehandler.c @@ -164,13 +164,34 @@ ghb_subtitle_exclusive_burn_settings(GValue *settings, gint index) gint ii, count; subtitle_list = ghb_settings_get_value(settings, "subtitle_list"); + subsettings = ghb_array_get_nth(subtitle_list, index); + if (subsettings != NULL) + { + int track = ghb_settings_get_int(subsettings, "SubtitleTrack"); + if (track == -1) + { + // Allow 2 tracks to be marked burned when one is + // foreign audio search. Extra burned track will be + // sanitized away if foreign audio search actually finds + // something. + return; + } + } count = ghb_array_len(subtitle_list); for (ii = 0; ii < count; ii++) { if (ii != index) { subsettings = ghb_array_get_nth(subtitle_list, ii); - ghb_settings_set_boolean(subsettings, "SubtitleBurned", FALSE); + int track = ghb_settings_get_int(subsettings, "SubtitleTrack"); + if (track != -1) + { + // Allow 2 tracks to be marked burned when one is + // foreign audio search. Extra burned track will be + // sanitized away if foreign audio search actually finds + // something. + ghb_settings_set_boolean(subsettings, "SubtitleBurned", FALSE); + } } } } @@ -349,6 +370,7 @@ static GValue* subtitle_add_track( int mux, gboolean default_track, gboolean srt, + gboolean burn, gboolean *burned) { int source = 0; @@ -363,7 +385,9 @@ static GValue* subtitle_add_track( source = SRTSUB; } - if (*burned && !hb_subtitle_can_pass(source, mux)) + burn |= !hb_subtitle_can_pass(source, mux); + + if (*burned && burn) { // Can only burn one. Skip others that must be burned. return NULL; @@ -392,10 +416,17 @@ static GValue* subtitle_add_track( subtitle_set_track_description(settings, subsettings); - if (!hb_subtitle_can_pass(source, mux)) + if (burn) { ghb_settings_set_boolean(subsettings, "SubtitleBurned", TRUE); - *burned = TRUE; + if (track != -1) + { + // Allow 2 tracks to be marked burned when one is + // foreign audio search. Extra burned track will be + // sanitized away if foreign audio search actually finds + // something. + *burned = TRUE; + } } else { @@ -450,6 +481,7 @@ ghb_set_pref_subtitle_settings(signal_user_data_t *ud, const hb_title_t *title, gboolean *used; const gchar *audio_lang, *pref_lang = NULL; gboolean foreign_audio_search, foreign_audio_subs; + gboolean burn_foreign, burn_first, burn_dvd, burn_bd; gboolean one_burned = FALSE; const GValue *lang_list; @@ -506,6 +538,13 @@ ghb_set_pref_subtitle_settings(signal_user_data_t *ud, const hb_title_t *title, used = g_malloc0(sub_count * sizeof(gboolean)); + int burn_behavior; + burn_behavior = ghb_settings_combo_int(settings, "SubtitleBurnBehavior"); + burn_foreign = burn_behavior == 1 || burn_behavior == 3; + burn_first = burn_behavior == 2 || burn_behavior == 3; + burn_dvd = ghb_settings_get_boolean(settings, "SubtitleBurnDVDSub"); + burn_bd = ghb_settings_get_boolean(settings, "SubtitleBurnBDSub"); + if (foreign_audio_subs && (audio_lang == NULL || strncmp(audio_lang, pref_lang, 4))) { @@ -515,9 +554,16 @@ ghb_set_pref_subtitle_settings(signal_user_data_t *ud, const hb_title_t *title, track = ghb_find_subtitle_track(title, pref_lang, 0); if (track > 0) { + gboolean burn; + hb_subtitle_t *subtitle; + subtitle = hb_list_item(title->list_subtitle, track); + burn = (subtitle->source == VOBSUB && burn_dvd) || + (subtitle->source == PGSSUB && burn_bd) || + burn_foreign || burn_first; used[track] = TRUE; subtitle_add_track(ud, settings, title, track, mux->format, - TRUE, FALSE, &one_burned); + !burn, FALSE, burn, &one_burned); + burn_first &= !burn; } } @@ -525,8 +571,10 @@ ghb_set_pref_subtitle_settings(signal_user_data_t *ud, const hb_title_t *title, (audio_lang != NULL && !strncmp(audio_lang, pref_lang, 4))) { // Add search for foreign audio segments + gboolean burn = burn_foreign || burn_first; subtitle_add_track(ud, settings, title, -1, mux->format, - TRUE, FALSE, &one_burned); + !burn, FALSE, burn, &one_burned); + burn_first &= !burn; } if (behavior != 0) @@ -543,9 +591,16 @@ ghb_set_pref_subtitle_settings(signal_user_data_t *ud, const hb_title_t *title, { if (!used[track]) { + gboolean burn; + hb_subtitle_t *subtitle; + subtitle = hb_list_item(title->list_subtitle, track); + burn = (subtitle->source == VOBSUB && burn_dvd) || + (subtitle->source == PGSSUB && burn_bd) || + burn_first; used[track] = TRUE; subtitle_add_track(ud, settings, title, track, mux->format, - FALSE, FALSE, &one_burned); + FALSE, FALSE, burn, &one_burned); + burn_first &= !burn; } next_track = track + 1; if (behavior == 2) @@ -573,7 +628,7 @@ ghb_set_pref_subtitle_settings(signal_user_data_t *ud, const hb_title_t *title, { used[track] = TRUE; subtitle_add_track(ud, settings, title, track, mux->format, - FALSE, FALSE, &one_burned); + FALSE, FALSE, burn_first, &one_burned); } } g_free(used); @@ -1136,12 +1191,12 @@ subtitle_add_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) subsettings == NULL && track < count; track++) { subsettings = subtitle_add_track(ud, ud->settings, title, track, - mux->format, FALSE, FALSE, &one_burned); + mux->format, FALSE, FALSE, FALSE, &one_burned); } if (subsettings == NULL) { subsettings = subtitle_add_track(ud, ud->settings, title, 0, - mux->format, FALSE, TRUE, &one_burned); + mux->format, FALSE, TRUE, FALSE, &one_burned); } ghb_add_subtitle_to_ui(ud, subsettings); @@ -1198,7 +1253,7 @@ subtitle_add_all_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) for (track = 0; track < count; track++) { subtitle_add_track(ud, ud->settings, title, track, mux->format, - FALSE, FALSE, &one_burned); + FALSE, FALSE, FALSE, &one_burned); } subtitle_refresh_list_ui(ud); ghb_live_reset(ud);