diff options
author | jstebbins <[email protected]> | 2010-09-28 22:10:49 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2010-09-28 22:10:49 +0000 |
commit | 03b2ce0e91c4e4ed44445a075ef5f35bc052b5b8 (patch) | |
tree | 24a1def4ca91cba98676508c6a3b1482ba131cb5 /gtk/src | |
parent | f1997be4ed1dd373316ac842685f18a6f8ab05ba (diff) |
SSA subtitle burn in
Anime fans rejoice! This patch adds SSA subtitle burn-in support with libass.
Therefore SSA subtitles should now be rendered in full quality, with the
appropriate embedded fonts and positioning information.
Thanks to davidfstr
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3557 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src')
-rw-r--r-- | gtk/src/Makefile.am | 4 | ||||
-rw-r--r-- | gtk/src/hb-backend.c | 37 | ||||
-rw-r--r-- | gtk/src/subtitlehandler.c | 54 |
3 files changed, 59 insertions, 36 deletions
diff --git a/gtk/src/Makefile.am b/gtk/src/Makefile.am index aec38fcfe..b901baf80 100644 --- a/gtk/src/Makefile.am +++ b/gtk/src/Makefile.am @@ -5,13 +5,13 @@ HB_LIBS= \ -lhb -la52 -lmkv -lavformat -lavcodec -lavutil -lavcore -ldca -ldvdnav -ldvdread \ -lfaac -lmp3lame -lmpeg2 -lvorbis -lvorbisenc -logg -lsamplerate \ -lx264 -lmp4v2 -lswscale -ltheora -lfaad -lz \ - -lbz2 -liberty -lpthreadGC2 -lbluray + -lbz2 -liberty -lpthreadGC2 -lbluray -lass -lfontconfig -lfreetype else HB_LIBS= \ -lhb -la52 -lmkv -lavformat -lavcodec -lavutil -lavcore -ldca -ldvdnav -ldvdread \ -lfaac -lmp3lame -lmpeg2 -lvorbis -lvorbisenc -logg -lsamplerate \ -lx264 -lmp4v2 -lswscale -ltheora -lfaad -lz \ - -lbz2 -lpthread -lbluray + -lbz2 -lpthread -lbluray -lass -lfontconfig -lfreetype endif icons = \ diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index 8ebdd1d17..3683c23e5 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -2187,20 +2187,9 @@ subtitle_track_opts_set(GtkBuilder *builder, const gchar *name, gint titleindex) for (ii = 0; ii < count; ii++) { subtitle = (hb_subtitle_t *)hb_list_item(title->list_subtitle, ii); - // Skip subtitles that must be burned if there is already - // a burned subtitle in the list -#if 0 - if (subtitle->source == VOBSUB) - { - options[ii] = g_strdup_printf("%d - %s", ii+1, subtitle->lang); - } - else -#endif - { - options[ii] = g_strdup_printf("%d - %s (%s)", ii+1, - subtitle->lang, - ghb_subtitle_source_name(subtitle->source)); - } + options[ii] = g_strdup_printf("%d - %s (%s)", ii+1, + subtitle->lang, + ghb_subtitle_source_name(subtitle->source)); subtitle_opts.map[ii+1].option = options[ii]; subtitle_opts.map[ii+1].shortOpt = index_str[ii]; subtitle_opts.map[ii+1].ivalue = ii; @@ -2575,6 +2564,18 @@ ghb_find_cc_track(gint titleindex) return -2; } +static gboolean +canForce(int source) +{ + return (source == VOBSUB); +} + +static gboolean +canBurn(int source) +{ + return (source == VOBSUB || source == SSASUB); +} + gint ghb_find_subtitle_track( gint titleindex, @@ -2627,7 +2628,8 @@ ghb_find_subtitle_track( continue; subtitle = (hb_subtitle_t*)hb_list_item( title->list_subtitle, ii ); - if ((!(burn || force) || (subtitle->source == VOBSUB)) && + if (((!force || (force && canForce(subtitle->source))) && + (!burn || (burn && canBurn(subtitle->source)))) && ((strcmp(lang, subtitle->iso639_2) == 0) || (strcmp(lang, "und") == 0))) { @@ -4878,15 +4880,16 @@ add_job(hb_handle_t *h, GValue *js, gint unique_id, gint titleindex) if (subt != NULL) { sub_config = subt->config; - if (!burned && subt->format == PICTURESUB) + if (!burned) { sub_config.dest = PASSTHRUSUB; } - else if ( burned && subt->format == PICTURESUB ) + else if ( burned && canBurn(subt->source) ) { // Only allow one subtitle to be burned into the video if (one_burned) continue; + sub_config.dest = RENDERSUB; one_burned = TRUE; } sub_config.force = force; diff --git a/gtk/src/subtitlehandler.c b/gtk/src/subtitlehandler.c index a7f06712a..63b2f20b4 100644 --- a/gtk/src/subtitlehandler.c +++ b/gtk/src/subtitlehandler.c @@ -44,6 +44,18 @@ mustBurn(signal_user_data_t *ud, GValue *settings) return FALSE; } +static gboolean +canBurn(int source) +{ + return (source == VOBSUB || source == SSASUB); +} + +static gboolean +canForce(int source) +{ + return (source == VOBSUB); +} + gboolean ghb_soft_in_subtitle_list(GValue *subtitle_list) { @@ -519,7 +531,7 @@ subtitle_forced_toggled_cb( settings = ghb_array_get_nth(subtitle_list, row); source = ghb_settings_get_int(settings, "SubtitleSource"); - if (source != VOBSUB) + if (!canForce(source)) return; ghb_settings_set_boolean(settings, "SubtitleForced", active); @@ -567,7 +579,7 @@ subtitle_burned_toggled_cb( settings = ghb_array_get_nth(subtitle_list, row); source = ghb_settings_get_int(settings, "SubtitleSource"); - if (source != VOBSUB) + if (!canBurn(source)) return; if (!active && mustBurn(ud, settings)) return; @@ -654,7 +666,8 @@ subtitle_list_refresh_selected(signal_user_data_t *ud) gint row; GValue *settings = NULL; const GValue *subtitle_list; - gboolean allow_burn_force = FALSE; + gboolean allow_force = FALSE; + gboolean allow_burn = FALSE; g_debug("subtitle_list_refresh_selected ()"); treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list")); @@ -681,14 +694,17 @@ subtitle_list_refresh_selected(signal_user_data_t *ud) gint i_source; i_source = ghb_settings_get_int(settings, "SubtitleSource"); - if (i_source != VOBSUB) + if (!canBurn(i_source)) { - // Force and burn only apply to VOBSUBS - forced = FALSE; burned = FALSE; - ghb_settings_set_boolean(settings, "SubtitleForced", forced); ghb_settings_set_boolean(settings, "SubtitleBurned", burned); } + if (!canForce(i_source)) + { + // Force only apply to VOBSUBS + forced = FALSE; + ghb_settings_set_boolean(settings, "SubtitleForced", forced); + } if (i_source == SRTSUB) { @@ -730,9 +746,10 @@ subtitle_list_refresh_selected(signal_user_data_t *ud) burned = ghb_settings_get_boolean(settings, "SubtitleBurned"); } - if (i_source == VOBSUB) - allow_burn_force = TRUE; - + if (canBurn(i_source)) + allow_burn = TRUE; + if (canForce(i_source)) + allow_force = TRUE; gtk_list_store_set(GTK_LIST_STORE(store), &iter, // These are displayed in list @@ -744,8 +761,8 @@ subtitle_list_refresh_selected(signal_user_data_t *ud) // These are used to set combo box values when a list item is selected 5, s_track, 6, i_source, - 7, allow_burn_force, - 8, allow_burn_force, + 7, allow_force, + 8, allow_burn, -1); g_free(track); g_free(source); @@ -892,7 +909,8 @@ add_to_subtitle_list( gboolean forced, burned, def; gchar *s_track; gint i_source; - gboolean allow_burn_force = FALSE; + gboolean allow_force = FALSE; + gboolean allow_burn = FALSE; g_debug("add_to_subtitle_list ()"); treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list")); @@ -908,8 +926,10 @@ add_to_subtitle_list( i_source = ghb_settings_get_int(settings, "SubtitleSource"); source = ghb_subtitle_source_name(i_source); - if (i_source == VOBSUB) - allow_burn_force = TRUE; + if (canBurn(i_source)) + allow_burn = TRUE; + if (canForce(i_source)) + allow_force = TRUE; gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, @@ -921,8 +941,8 @@ add_to_subtitle_list( // These are used to set combo box values when a list item is selected 5, s_track, 6, i_source, - 7, allow_burn_force, - 8, allow_burn_force, + 7, allow_force, + 8, allow_burn, 9, FALSE, -1); gtk_tree_selection_select_iter(selection, &iter); |