| 4686 | } |
| 4687 | |
| 4688 | gboolean |
| 4689 | ghb_validate_audio(GhbValue *settings, GtkWindow *parent) |
| 4690 | { |
| 4691 | gint title_id, titleindex; |
| 4692 | const hb_title_t * title; |
| 4693 | |
| 4694 | title_id = ghb_dict_get_int(settings, "title"); |
| 4695 | title = ghb_lookup_title(title_id, &titleindex); |
| 4696 | if (title == NULL) |
| 4697 | { |
| 4698 | /* No valid title, stop right there */ |
| 4699 | g_message(_("No title found.\n")); |
| 4700 | return FALSE; |
| 4701 | } |
| 4702 | |
| 4703 | const char *mux_id; |
| 4704 | const hb_container_t *mux; |
| 4705 | |
| 4706 | mux_id = ghb_dict_get_string(settings, "FileFormat"); |
| 4707 | mux = ghb_lookup_container_by_name(mux_id); |
| 4708 | |
| 4709 | const GhbValue *audio_list; |
| 4710 | gint count, ii; |
| 4711 | |
| 4712 | audio_list = ghb_get_job_audio_list(settings); |
| 4713 | count = ghb_array_len(audio_list); |
| 4714 | for (ii = 0; ii < count; ii++) |
| 4715 | { |
| 4716 | GhbValue *asettings; |
| 4717 | hb_audio_config_t *aconfig; |
| 4718 | int track, codec; |
| 4719 | |
| 4720 | asettings = ghb_array_get(audio_list, ii); |
| 4721 | track = ghb_dict_get_int(asettings, "Track"); |
| 4722 | codec = ghb_settings_audio_encoder_codec(asettings, "Encoder"); |
| 4723 | |
| 4724 | aconfig = hb_list_audio_config_item(title->list_audio, track); |
| 4725 | if (ghb_audio_is_passthru(codec) && |
| 4726 | !(ghb_audio_can_passthru(aconfig->in.codec) && |
| 4727 | (aconfig->in.codec & codec))) |
| 4728 | { |
| 4729 | // Not supported. AC3 is passthru only, so input must be AC3 |
| 4730 | if (!ghb_question_dialog_run(parent, GHB_ACTION_NORMAL, |
| 4731 | _("Continue"), _("Cancel"), _("Invalid Audio Selection"), |
| 4732 | _("The source does not support Pass-Thru.\n\n" |
| 4733 | "You should choose a different audio codec.\n" |
| 4734 | "If you continue, one will be chosen for you."))) |
| 4735 | { |
| 4736 | return FALSE; |
| 4737 | } |
| 4738 | if ((codec & HB_ACODEC_AC3) || |
| 4739 | (aconfig->in.codec & HB_ACODEC_MASK) == HB_ACODEC_DCA) |
| 4740 | { |
| 4741 | codec = HB_ACODEC_AC3; |
| 4742 | } |
| 4743 | else if (mux->format & HB_MUX_MASK_MKV) |
| 4744 | { |
| 4745 | codec = HB_ACODEC_LAME; |
no test coverage detected