| 4600 | } |
| 4601 | |
| 4602 | gboolean |
| 4603 | ghb_validate_subtitles(GhbValue *settings, GtkWindow *parent) |
| 4604 | { |
| 4605 | gint title_id, titleindex; |
| 4606 | const hb_title_t * title; |
| 4607 | |
| 4608 | title_id = ghb_dict_get_int(settings, "title"); |
| 4609 | title = ghb_lookup_title(title_id, &titleindex); |
| 4610 | if (title == NULL) |
| 4611 | { |
| 4612 | /* No valid title, stop right there */ |
| 4613 | g_message(_("No title found.\n")); |
| 4614 | return FALSE; |
| 4615 | } |
| 4616 | |
| 4617 | const GhbValue *slist, *subtitle, *import; |
| 4618 | gint count, ii, track; |
| 4619 | gboolean burned, one_burned = FALSE; |
| 4620 | |
| 4621 | const char *mux_id; |
| 4622 | const hb_container_t *mux; |
| 4623 | |
| 4624 | mux_id = ghb_dict_get_string(settings, "FileFormat"); |
| 4625 | mux = ghb_lookup_container_by_name(mux_id); |
| 4626 | |
| 4627 | slist = ghb_get_job_subtitle_list(settings); |
| 4628 | count = ghb_array_len(slist); |
| 4629 | for (ii = 0; ii < count; ii++) |
| 4630 | { |
| 4631 | subtitle = ghb_array_get(slist, ii); |
| 4632 | track = ghb_dict_get_int(subtitle, "Track"); |
| 4633 | import = ghb_dict_get(subtitle, "Import"); |
| 4634 | burned = track != -1 && ghb_dict_get_bool(subtitle, "Burn"); |
| 4635 | if (burned && one_burned) |
| 4636 | { |
| 4637 | // MP4 can only handle burned vobsubs. make sure there isn't |
| 4638 | // already something burned in the list |
| 4639 | if (!ghb_question_dialog_run(parent, GHB_ACTION_DESTRUCTIVE, |
| 4640 | _("Continue"), _("Cancel"), _("Invalid Subtitle Selection"), |
| 4641 | _("Only one subtitle may be burned into the video.\n\n" |
| 4642 | "You should change your subtitle selections.\n" |
| 4643 | "If you continue, some subtitles will be lost."))) |
| 4644 | { |
| 4645 | return FALSE; |
| 4646 | } |
| 4647 | break; |
| 4648 | } |
| 4649 | else if (burned) |
| 4650 | { |
| 4651 | one_burned = TRUE; |
| 4652 | } |
| 4653 | else if (mux->format & HB_MUX_MASK_WEBM) |
| 4654 | { |
| 4655 | // WebM can only handle burned subs afaik. Their specs are ambiguous here |
| 4656 | if (!ghb_question_dialog_run(parent, GHB_ACTION_DESTRUCTIVE, |
| 4657 | _("Continue"), _("Cancel"), _("Invalid Subtitle Selection"), |
| 4658 | _("WebM in HandBrake only supports burned subtitles.\n\n" |
| 4659 | "You should change your subtitle selections.\n" |
no test coverage detected