diff options
author | jstebbins <[email protected]> | 2009-05-20 16:00:52 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2009-05-20 16:00:52 +0000 |
commit | 998a6adf0e9f4697ea6cfa6fdff8cf8c0f3af1a1 (patch) | |
tree | cb8c9d48a86d0cfc5e74ffa80f5e051c1990335f /gtk/src/hb-backend.c | |
parent | 05b33621d3c1c742f003129e3ab2e90e9851905a (diff) |
LinGui: give feedback indicating problems with subtitle selections
- highlight subtitles that can not be encoded for some reason
example: user adds several subtitles, then changes container from mkv to mp4
- validate subtitle list when adding to queue and show warning popup when
there's a problem
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2432 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src/hb-backend.c')
-rw-r--r-- | gtk/src/hb-backend.c | 69 |
1 files changed, 68 insertions, 1 deletions
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); } |