diff options
author | jstebbins <[email protected]> | 2010-10-04 23:16:57 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2010-10-04 23:16:57 +0000 |
commit | afffc15c0fec6680f6a612c729d184d92fbc809c (patch) | |
tree | 84266ecb82c48e371039feac8527f06573e57dc4 /gtk/src | |
parent | e10652943a245468659a3ed0dfed452ccd12ae0c (diff) |
Add ac3 encoding
Uses ffmpeg's ac3 encoder.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3570 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src')
-rw-r--r-- | gtk/src/audiohandler.c | 114 | ||||
-rw-r--r-- | gtk/src/hb-backend.c | 152 | ||||
-rw-r--r-- | gtk/src/hb-backend.h | 5 | ||||
-rw-r--r-- | gtk/src/internal_defaults.xml | 2 | ||||
-rw-r--r-- | gtk/src/makedeps.py | 10 | ||||
-rw-r--r-- | gtk/src/presets.c | 3 | ||||
-rw-r--r-- | gtk/src/queuehandler.c | 2 |
7 files changed, 179 insertions, 109 deletions
diff --git a/gtk/src/audiohandler.c b/gtk/src/audiohandler.c index 4ecc509c3..6e0748f13 100644 --- a/gtk/src/audiohandler.c +++ b/gtk/src/audiohandler.c @@ -25,12 +25,14 @@ static void ghb_add_audio(signal_user_data_t *ud, GValue *settings); void ghb_adjust_audio_rate_combos(signal_user_data_t *ud) { - gint titleindex, track, acodec, mix; + gint titleindex, track, acodec, select_acodec, mix; ghb_audio_info_t ainfo; GtkWidget *widget; GValue *gval; + int mux; g_debug("ghb_adjust_audio_rate_combos ()"); + mux = ghb_settings_combo_int(ud->settings, "FileFormat"); titleindex = ghb_settings_combo_int(ud->settings, "title"); widget = GHB_WIDGET(ud->builder, "AudioTrack"); @@ -47,34 +49,48 @@ ghb_adjust_audio_rate_combos(signal_user_data_t *ud) mix = ghb_lookup_combo_int("AudioMixdown", gval); ghb_value_free(gval); - if (ghb_audio_is_passthru (acodec)) + select_acodec = acodec; + if (mux == HB_MUX_MP4) + { + select_acodec &= ~HB_ACODEC_DCA; + } + if ((select_acodec & HB_ACODEC_MASK) == 0) + { + // Unsuported codec in this container. + select_acodec |= HB_ACODEC_AC3; + acodec = select_acodec; + } + + if (ghb_audio_is_passthru (select_acodec)) { ghb_set_default_bitrate_opts (ud->builder, 0, -1); if (ghb_get_audio_info (&ainfo, titleindex, track)) { gint br = ainfo.bitrate / 1000; + // Set the values for bitrate and samplerate to the input rates - if (br < 8) - br = 160; - if (ghb_audio_is_passthru (ainfo.codec)) + if (ainfo.codec & select_acodec & HB_ACODEC_PASS_MASK) { ghb_set_passthru_bitrate_opts (ud->builder, br); ghb_ui_update(ud, "AudioMixdown", ghb_int64_value(0)); - acodec &= ainfo.codec; + select_acodec &= ainfo.codec | HB_ACODEC_PASS_FLAG; } else { - if (acodec != HB_ACODEC_MASK) - { - acodec = ghb_select_audio_codec(ud, track); - ghb_ui_update(ud, "AudioEncoder", ghb_int64_value(acodec)); - } - else + select_acodec = ghb_select_audio_codec(ud->settings, acodec, track); + if (acodec != HB_ACODEC_ANY) { - acodec = ghb_select_audio_codec(ud, track); + ghb_ui_update(ud, "AudioEncoder", ghb_int64_value(select_acodec)); } - br = ghb_find_closest_audio_bitrate(acodec, br); - mix = ghb_get_best_mix( titleindex, track, acodec, 0); + + int channels, min_rate; + mix = ghb_get_best_mix( titleindex, track, select_acodec, mix); + channels = HB_AMIXDOWN_GET_DISCRETE_CHANNEL_COUNT(mix); + br = ainfo.bitrate / 1000; + min_rate = channels * 32; + if (br < min_rate) + br = min_rate; + br = ghb_find_closest_audio_bitrate(select_acodec, br); ghb_ui_update(ud, "AudioMixdown", ghb_int64_value(mix)); } ghb_ui_update(ud, "AudioBitrate", ghb_int64_value(br)); @@ -85,11 +101,11 @@ ghb_adjust_audio_rate_combos(signal_user_data_t *ud) ghb_ui_update(ud, "AudioBitrate", ghb_int64_value(384)); ghb_ui_update(ud, "AudioSamplerate", ghb_int64_value(0)); ghb_ui_update(ud, "AudioMixdown", ghb_int64_value(0)); - acodec = HB_ACODEC_AC3; + select_acodec = HB_ACODEC_AC3; } ghb_ui_update(ud, "AudioTrackDRCSlider", ghb_double_value(0)); } - else if (acodec == HB_ACODEC_FAAC) + if (select_acodec == HB_ACODEC_FAAC) { gint br, last = 320, first = 0; @@ -109,12 +125,16 @@ ghb_adjust_audio_rate_combos(signal_user_data_t *ud) ghb_ui_update(ud, "AudioBitrate", ghb_int64_value(first)); ghb_set_default_bitrate_opts (ud->builder, first, last); } + else if (select_acodec == HB_ACODEC_AC3) + { + ghb_set_default_bitrate_opts (ud->builder, 0, 640); + } else { ghb_set_default_bitrate_opts (ud->builder, 0, -1); } ghb_settings_take_value(ud->settings, "AudioEncoderActual", - ghb_lookup_acodec_value(acodec)); + ghb_lookup_acodec_value(select_acodec)); ghb_check_dependency(ud, NULL, "AudioEncoderActual"); } @@ -151,16 +171,20 @@ ghb_set_pref_audio(gint titleindex, signal_user_data_t *ud) const GValue *pref_audio; const GValue *audio, *drc; - gint acodec, bitrate, mix; + gint mix_acodec, acodec, bitrate, mix; gdouble rate; gint count, ii, list_count; g_debug("set_pref_audio"); mux = ghb_settings_combo_int(ud->settings, "FileFormat"); if (mux == HB_MUX_MP4) + { fallback_acodec = HB_ACODEC_FAAC; + } else + { fallback_acodec = HB_ACODEC_LAME; + } track_indices = g_hash_table_new_full(g_int_hash, g_int_equal, free_audio_hash_key_value, free_audio_hash_key_value); // Clear the audio list @@ -180,8 +204,25 @@ ghb_set_pref_audio(gint titleindex, signal_user_data_t *ud) count = ghb_array_len(pref_audio); for (ii = 0; ii < count; ii++) { + int select_acodec; + audio = ghb_array_get_nth(pref_audio, ii); - acodec = ghb_settings_combo_int(audio, "AudioEncoder"); + select_acodec = acodec = ghb_settings_combo_int(audio, "AudioEncoder"); + if (mux == HB_MUX_MP4) + { + select_acodec &= ~HB_ACODEC_DCA; + } + if ((select_acodec & HB_ACODEC_MASK) == 0) + { + // Unsuported codec in this container. + select_acodec |= HB_ACODEC_AC3; + acodec = select_acodec; + } + if ( ghb_audio_can_passthru( select_acodec ) ) + { + fallback_acodec = HB_ACODEC_AC3; + } + mix_acodec = acodec; bitrate = ghb_settings_combo_int(audio, "AudioBitrate"); rate = ghb_settings_combo_double(audio, "AudioSamplerate"); mix = ghb_settings_combo_int(audio, "AudioMixdown"); @@ -190,7 +231,7 @@ ghb_set_pref_audio(gint titleindex, signal_user_data_t *ud) // select sequential tracks for each. The hash keeps track // of the tracks used for each codec. track = ghb_find_audio_track(titleindex, source_lang, - acodec, fallback_acodec, track_indices); + select_acodec, fallback_acodec, track_indices); // Check to see if: // 1. pref codec is passthru // 2. source codec is not passthru @@ -199,24 +240,33 @@ ghb_set_pref_audio(gint titleindex, signal_user_data_t *ud) ghb_audio_is_passthru (acodec)) { // HB_ACODEC_* are bit fields. Treat acodec as mask - if (!(ainfo.codec & acodec & (HB_ACODEC_AC3 | HB_ACODEC_DCA))) + if (!(ainfo.codec & select_acodec & HB_ACODEC_PASS_MASK)) { - if (acodec != HB_ACODEC_MASK) + if (acodec != HB_ACODEC_ANY) acodec = fallback_acodec; + mix_acodec = fallback_acodec; + // If we can't substitute the passthru with a suitable + // encoder and // If there's more audio to process, or we've already // placed one in the list, then we can skip this one - if ((ii + 1 < count) || (list_count != 0)) + if (!(select_acodec & fallback_acodec) && + ((ii + 1 < count) || (list_count != 0))) { // Skip this audio acodec = 0; } else { + int channels, min_rate; + mix = ghb_get_best_mix( titleindex, track, mix_acodec, mix); + channels = HB_AMIXDOWN_GET_DISCRETE_CHANNEL_COUNT(mix); bitrate = ainfo.bitrate / 1000; - if (bitrate < 8) - bitrate = 160; + min_rate = channels * 32; + if (bitrate < min_rate) + bitrate = min_rate; + if (bitrate > 640) + bitrate = 640; rate = 0; - mix = HB_AMIXDOWN_DOLBYPLII; } } } @@ -235,7 +285,7 @@ ghb_set_pref_audio(gint titleindex, signal_user_data_t *ud) ghb_lookup_combo_string("AudioBitrate", ghb_int_value(bitrate))); ghb_settings_set_string(settings, "AudioSamplerate", ghb_lookup_combo_string("AudioSamplerate", ghb_int_value(rate))); - mix = ghb_get_best_mix( titleindex, track, acodec, mix); + mix = ghb_get_best_mix( titleindex, track, mix_acodec, mix); ghb_settings_set_string(settings, "AudioMixdown", ghb_lookup_combo_string("AudioMixdown", ghb_int_value(mix))); ghb_settings_set_value(settings, "AudioTrackDRCSlider", drc); @@ -328,8 +378,8 @@ ghb_audio_list_refresh_selected(signal_user_data_t *ud) else s_drc = g_strdup_printf("%.1f", drc); - if (icodec == HB_ACODEC_MASK) - codec = ghb_select_audio_codec_str(ud, itrack); + if (icodec == HB_ACODEC_ANY) + codec = ghb_select_audio_codec_str(ud->settings, icodec, itrack); gtk_list_store_set(GTK_LIST_STORE(store), &iter, // These are displayed in list @@ -537,9 +587,9 @@ add_to_audio_list(signal_user_data_t *ud, GValue *settings) else s_drc = g_strdup_printf("%.1f", drc); - if (icodec == HB_ACODEC_MASK) + if (icodec == HB_ACODEC_ANY) { - codec = ghb_select_audio_codec_str(ud, itrack); + codec = ghb_select_audio_codec_str(ud->settings, icodec, itrack); } gtk_list_store_append(store, &iter); diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index d23d3c746..8614b0a99 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -249,12 +249,13 @@ combo_opts_t vcodec_opts = static options_map_t d_acodec_opts[] = { - {"AAC (faac)", "faac", HB_ACODEC_FAAC, "faac"}, - {"MP3 (lame)", "lame", HB_ACODEC_LAME, "lame"}, - {"Vorbis", "vorbis", HB_ACODEC_VORBIS, "vorbis"}, - {"AC3 (pass-thru)", "ac3", HB_ACODEC_AC3, "ac3"}, - {"DTS (pass-thru)", "dts", HB_ACODEC_DCA, "dts"}, - {"Choose For Me", "auto", HB_ACODEC_MASK, "auto"}, + {"AAC (faac)", "faac", HB_ACODEC_FAAC, "faac"}, + {"MP3 (lame)", "lame", HB_ACODEC_LAME, "lame"}, + {"Vorbis", "vorbis", HB_ACODEC_VORBIS, "vorbis"}, + {"AC3 (ffmpeg)", "ac3", HB_ACODEC_AC3, "ac3"}, + {"AC3 (pass-thru)", "ac3pass", HB_ACODEC_AC3_PASS, "ac3pass"}, + {"DTS (pass-thru)", "dtspass", HB_ACODEC_DCA_PASS, "dtspass"}, + {"Choose For Me", "auto", HB_ACODEC_ANY, "auto"}, }; combo_opts_t acodec_opts = { @@ -1104,6 +1105,8 @@ ghb_find_closest_audio_bitrate(gint codec, gint rate) if (codec == HB_ACODEC_FAAC) high = 320; + else if (codec == HB_ACODEC_AC3) + high = 640; result = high; for (ii = 0; ii < hb_audio_bitrates_count; ii++) @@ -1581,19 +1584,19 @@ ghb_grey_combo_options(GtkBuilder *builder) gboolean allow_dca = TRUE; allow_dca = (container != HB_MUX_MP4); - grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_AC3, FALSE); + grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_AC3_PASS, FALSE); if (allow_dca) - grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_DCA, FALSE); + grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_DCA_PASS, FALSE); else - grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_DCA, TRUE); + grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_DCA_PASS, TRUE); if (audio && audio->in.codec != HB_ACODEC_AC3) { - grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_AC3, TRUE); + grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_AC3_PASS, TRUE); } if (audio && audio->in.codec != HB_ACODEC_DCA) { - grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_DCA, TRUE); + grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_DCA_PASS, TRUE); } grey_combo_box_item(builder, "VideoEncoder", HB_VCODEC_THEORA, FALSE); @@ -1601,10 +1604,7 @@ ghb_grey_combo_options(GtkBuilder *builder) gval = ghb_widget_value(widget); acodec = ghb_lookup_combo_int("AudioEncoder", gval); ghb_value_free(gval); - if (acodec != HB_ACODEC_AC3) - { - grey_combo_box_item(builder, "AudioMixdown", 0, TRUE); - } + grey_combo_box_item(builder, "AudioMixdown", 0, TRUE); if (container == HB_MUX_MP4) { grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_VORBIS, TRUE); @@ -1666,7 +1666,7 @@ ghb_get_best_mix(gint titleindex, gint track, gint acodec, gint mix) gboolean allow_dpl2 = TRUE; gboolean allow_6ch = TRUE; - if (acodec & (HB_ACODEC_AC3 | HB_ACODEC_DCA)) + if (acodec & HB_ACODEC_PASS_FLAG) { // Audio codec pass-thru. No mixdown return 0; @@ -2047,7 +2047,7 @@ find_combo_item_by_int(GtkTreeModel *store, gint value, GtkTreeIter *iter) do { gtk_tree_model_get(store, iter, 3, &ivalue, -1); - if (value == (int)ivalue) + if (value == (gint)ivalue) { foundit = TRUE; break; @@ -2340,14 +2340,14 @@ ghb_find_audio_track( // Try to find an item that matches the preferred language and // the passthru codec type max_chan = 0; - passthru = (acodec & (HB_ACODEC_AC3 | HB_ACODEC_DCA)) != 0; + passthru = (acodec & HB_ACODEC_PASS_FLAG) != 0; if (passthru) { for (ii = 0; ii < count; ii++) { audio = (hb_audio_config_t*)hb_list_audio_config_item( title->list_audio, ii ); - passthru_acodec = (HB_ACODEC_AC3 | HB_ACODEC_DCA) & audio->in.codec; + passthru_acodec = acodec & audio->in.codec; // Is the source track use a passthru capable codec? if (passthru_acodec == 0) continue; @@ -2392,7 +2392,7 @@ ghb_find_audio_track( continue; audio = (hb_audio_config_t*)hb_list_audio_config_item( title->list_audio, ii ); - passthru_acodec = (HB_ACODEC_AC3 | HB_ACODEC_DCA) & audio->in.codec; + passthru_acodec = HB_ACODEC_PASS_MASK & audio->in.codec; if (passthru_acodec && passthru) { passthru_used = get_track_used(passthru_acodec, track_indices, count); @@ -2428,7 +2428,7 @@ ghb_find_audio_track( { audio = (hb_audio_config_t*)hb_list_audio_config_item( title->list_audio, ii ); - passthru_acodec = (HB_ACODEC_AC3 | HB_ACODEC_DCA) & audio->in.codec; + passthru_acodec = HB_ACODEC_PASS_MASK & audio->in.codec; // Is the source track use a passthru capable codec? if (passthru_acodec == 0) continue; @@ -2471,7 +2471,7 @@ ghb_find_audio_track( continue; audio = (hb_audio_config_t*)hb_list_audio_config_item( title->list_audio, ii ); - passthru_acodec = (HB_ACODEC_AC3 | HB_ACODEC_DCA) & audio->in.codec; + passthru_acodec = HB_ACODEC_PASS_MASK & audio->in.codec; channels = HB_INPUT_CH_LAYOUT_GET_DISCRETE_COUNT( audio->in.channel_layout); if (passthru_acodec && passthru) @@ -2501,7 +2501,7 @@ ghb_find_audio_track( { audio = (hb_audio_config_t*)hb_list_audio_config_item( title->list_audio, ii ); - passthru_acodec = (HB_ACODEC_AC3 | HB_ACODEC_DCA) & audio->in.codec; + passthru_acodec = HB_ACODEC_PASS_MASK & audio->in.codec; if (passthru_acodec && passthru) { passthru_used = get_track_used(passthru_acodec, track_indices, count); @@ -3502,7 +3502,14 @@ gboolean ghb_audio_is_passthru(gint acodec) { g_debug("ghb_audio_is_passthru () \n"); - return (acodec & (HB_ACODEC_AC3 | HB_ACODEC_DCA)); + return (acodec & HB_ACODEC_PASS_FLAG) != 0; +} + +gboolean +ghb_audio_can_passthru(gint acodec) +{ + g_debug("ghb_audio_can_passthru () \n"); + return (acodec & HB_ACODEC_PASS_MASK) != 0; } gint @@ -4166,7 +4173,7 @@ ghb_validate_subtitles(signal_user_data_t *ud) } gint -ghb_select_audio_codec(signal_user_data_t *ud, gint track) +ghb_select_audio_codec(GValue *settings, gint acodec, gint track) { hb_list_t * list; hb_title_t * title; @@ -4181,39 +4188,68 @@ ghb_select_audio_codec(signal_user_data_t *ud, gint track) gint titleindex; - titleindex = ghb_settings_combo_int(ud->settings, "title"); + titleindex = ghb_settings_combo_int(settings, "title"); title = hb_list_item( list, titleindex ); if (title == NULL) return -1; - gint mux = ghb_settings_combo_int(ud->settings, "FileFormat"); + gint mux = ghb_settings_combo_int(settings, "FileFormat"); if (track < 0 || track >= hb_list_count(title->list_audio)) return -1; audio = (hb_audio_config_t *) hb_list_audio_config_item( title->list_audio, track ); + if (mux == HB_MUX_MP4) { - if (audio->in.codec == HB_ACODEC_AC3) - return audio->in.codec; + if ((acodec & audio->in.codec & HB_ACODEC_AC3)) + { + return acodec & (audio->in.codec | HB_ACODEC_PASS_FLAG); + } + else if (acodec & HB_ACODEC_AC3) + { + return HB_ACODEC_AC3; + } + else if (acodec & HB_ACODEC_FAAC) + { + return HB_ACODEC_FAAC; + } else + { return HB_ACODEC_FAAC; + } } else { - if (audio->in.codec == HB_ACODEC_AC3 || audio->in.codec == HB_ACODEC_DCA) - return audio->in.codec; + if ((acodec & audio->in.codec & HB_ACODEC_PASS_MASK)) + { + return acodec & (audio->in.codec | HB_ACODEC_PASS_FLAG); + } + else if (acodec & HB_ACODEC_AC3) + { + return HB_ACODEC_AC3; + } + else if (acodec & HB_ACODEC_VORBIS) + { + return HB_ACODEC_VORBIS; + } + else if (acodec & HB_ACODEC_LAME) + { + return HB_ACODEC_LAME; + } else + { return HB_ACODEC_LAME; + } } } const gchar* -ghb_select_audio_codec_str(signal_user_data_t *ud, gint track) +ghb_select_audio_codec_str(GValue *settings, gint icodec, gint track) { gint acodec, ii; - acodec = ghb_select_audio_codec(ud, track); + acodec = ghb_select_audio_codec(settings, icodec, track); for (ii = 0; ii < acodec_opts.count; ii++) { if (acodec_opts.map[ii].ivalue == acodec) @@ -4259,13 +4295,14 @@ ghb_validate_audio(signal_user_data_t *ud) asettings = ghb_array_get_nth(audio_list, ii); gint track = ghb_settings_combo_int(asettings, "AudioTrack"); gint codec = ghb_settings_combo_int(asettings, "AudioEncoder"); - if (codec == HB_ACODEC_MASK) + if (codec == HB_ACODEC_ANY) continue; taudio = (hb_audio_config_t *) hb_list_audio_config_item( title->list_audio, track ); - if (!(taudio->in.codec & codec) && - (codec & (HB_ACODEC_AC3 | HB_ACODEC_DCA))) + if ( ghb_audio_is_passthru(codec) && + !(ghb_audio_can_passthru(taudio->in.codec) && + (taudio->in.codec & codec))) { // Not supported. AC3 is passthrough only, so input must be AC3 message = g_strdup_printf( @@ -4278,7 +4315,12 @@ ghb_validate_audio(signal_user_data_t *ud) return FALSE; } g_free(message); - if (mux == HB_MUX_MKV) + if ((codec & HB_ACODEC_AC3) || + taudio->in.codec == HB_ACODEC_DCA) + { + codec = HB_ACODEC_AC3; + } + else if (mux == HB_MUX_MKV) { codec = HB_ACODEC_LAME; } @@ -4303,7 +4345,7 @@ ghb_validate_audio(signal_user_data_t *ud) if (codec == HB_ACODEC_DCA) { a_unsup = "DTS"; - codec = HB_ACODEC_FAAC; + codec = HB_ACODEC_AC3; } } if (a_unsup) @@ -4715,48 +4757,24 @@ add_job(hb_handle_t *h, GValue *js, gint unique_id, gint titleindex) GValue *asettings; hb_audio_config_t audio; hb_audio_config_t *taudio; + gint acodec; hb_audio_config_init(&audio); asettings = ghb_array_get_nth(audio_list, ii); audio.in.track = ghb_settings_get_int(asettings, "AudioTrack"); audio.out.track = tcount; - audio.out.codec = ghb_settings_combo_int(asettings, "AudioEncoder"); + acodec = ghb_settings_combo_int(asettings, "AudioEncoder"); + audio.out.codec = ghb_select_audio_codec(js, acodec, audio.in.track); + taudio = (hb_audio_config_t *) hb_list_audio_config_item( title->list_audio, audio.in.track ); - if (audio.out.codec & (HB_ACODEC_AC3 | HB_ACODEC_DCA)) - { - if (!(taudio->in.codec & (HB_ACODEC_AC3 | HB_ACODEC_DCA))) - { - // Not supported. - // AC3/DTS is passthrough only, so input must be AC3/DTS - if (job->mux == HB_MUX_MKV) - { - audio.out.codec = HB_ACODEC_LAME; - } - else - { - audio.out.codec = HB_ACODEC_FAAC; - } - } - else - { - audio.out.codec &= taudio->in.codec; - } - } - if ((job->mux == HB_MUX_MP4) && - ((audio.out.codec & HB_ACODEC_DCA) || - (audio.out.codec & HB_ACODEC_VORBIS))) - { - // mp4/mp3|dts|vorbis combination is not supported. - audio.out.codec = HB_ACODEC_FAAC; - } audio.out.dynamic_range_compression = ghb_settings_get_double(asettings, "AudioTrackDRCSlider"); if (audio.out.dynamic_range_compression < 1.0) audio.out.dynamic_range_compression = 0.0; // It would be better if this were done in libhb for us, but its not yet. - if (audio.out.codec & (HB_ACODEC_AC3 | HB_ACODEC_DCA)) + if (ghb_audio_is_passthru(audio.out.codec)) { audio.out.mixdown = 0; } diff --git a/gtk/src/hb-backend.h b/gtk/src/hb-backend.h index ff31e90a3..cd6198c25 100644 --- a/gtk/src/hb-backend.h +++ b/gtk/src/hb-backend.h @@ -137,6 +137,7 @@ void ghb_part_duration(gint tt, gint sc, gint ec, gint *hh, gint *mm, gint *ss); gint ghb_get_best_mix(gint titleindex, gint track, gint acodec, gint mix); gboolean ghb_ac3_in_audio_list(const GValue *audio_list); gboolean ghb_audio_is_passthru(gint acodec); +gboolean ghb_audio_can_passthru(gint acodec); gint ghb_get_default_acodec(void); gboolean ghb_get_audio_info( ghb_audio_info_t *ainfo, gint titleindex, gint audioindex); @@ -182,8 +183,8 @@ gdouble ghb_lookup_combo_double(const gchar *name, const GValue *gval); const gchar* ghb_lookup_combo_option(const gchar *name, const GValue *gval); const gchar* ghb_lookup_combo_string(const gchar *name, const GValue *gval); gchar* ghb_get_tmp_dir(); -gint ghb_select_audio_codec(signal_user_data_t *ud, gint track); -const gchar* ghb_select_audio_codec_str(signal_user_data_t *ud, gint track); +gint ghb_select_audio_codec(GValue *settings, gint acodec, gint track); +const gchar* ghb_select_audio_codec_str(GValue *settings, gint acodec, gint track); gint ghb_find_closest_audio_bitrate(gint codec, gint rate); gint ghb_find_closest_audio_rate(gint rate); GValue* ghb_lookup_acodec_value(gint val); diff --git a/gtk/src/internal_defaults.xml b/gtk/src/internal_defaults.xml index 0e41912f1..568da2fa9 100644 --- a/gtk/src/internal_defaults.xml +++ b/gtk/src/internal_defaults.xml @@ -291,7 +291,7 @@ <key>AudioBitrate</key> <string>192</string> <key>AudioEncoder</key> - <string>ac3</string> + <string>ac3pass</string> <key>AudioTrack</key> <integer>1</integer> <key>AudioTrackDescription</key> diff --git a/gtk/src/makedeps.py b/gtk/src/makedeps.py index 986cf5b52..121c5654a 100644 --- a/gtk/src/makedeps.py +++ b/gtk/src/makedeps.py @@ -49,11 +49,11 @@ dep_map = ( DepEntry("VideoEncoder", "x264_tab", "x264", False, False), DepEntry("VideoEncoder", "x264_tab_label", "x264", False, False), DepEntry("VideoEncoder", "Mp4iPodCompatible", "x264", False, False), - DepEntry("AudioEncoderActual", "AudioBitrate", "ac3|dts", True, False), - DepEntry("AudioEncoderActual", "AudioSamplerate", "ac3|dts", True, False), - DepEntry("AudioEncoderActual", "AudioMixdown", "ac3|dts", True, False), - DepEntry("AudioEncoderActual", "AudioTrackDRCSlider", "ac3|dts", True, False), - DepEntry("AudioEncoderActual", "drc_label", "ac3|dts", True, False), + DepEntry("AudioEncoderActual", "AudioBitrate", "ac3pass|dtspass", True, False), + DepEntry("AudioEncoderActual", "AudioSamplerate", "ac3pass|dtspass", True, False), + DepEntry("AudioEncoderActual", "AudioMixdown", "ac3pass|dtspass", True, False), + DepEntry("AudioEncoderActual", "AudioTrackDRCSlider", "ac3pass|dtspass", True, False), + DepEntry("AudioEncoderActual", "drc_label", "ac3pass|dtspass", True, False), DepEntry("x264_bframes", "x264_bpyramid", "<2", True, False), DepEntry("x264_bframes", "x264_direct", "0", True, False), DepEntry("x264_bframes", "x264_b_adapt", "0", True, False), diff --git a/gtk/src/presets.c b/gtk/src/presets.c index 1946f0ba8..e50ca054c 100644 --- a/gtk/src/presets.c +++ b/gtk/src/presets.c @@ -1999,7 +1999,8 @@ static value_map_t acodec_xlat[] = { {"AAC (faac)", "faac"}, {"AAC (CoreAudio)", "faac"}, - {"AC3 Passthru", "ac3"}, + {"AC3 Passthru", "ac3pass"}, + {"DTS Passthru", "dtspass"}, {"MP3 (lame)", "lame"}, {"Vorbis (vorbis)", "vorbis"}, {NULL,NULL} diff --git a/gtk/src/queuehandler.c b/gtk/src/queuehandler.c index 0680a88fc..6d3261638 100644 --- a/gtk/src/queuehandler.c +++ b/gtk/src/queuehandler.c @@ -550,7 +550,7 @@ audio_list_refresh(signal_user_data_t *ud) s_drc = g_strdup_printf("%.1f", drc); if (icodec == HB_ACODEC_MASK) - codec = ghb_select_audio_codec_str(ud, itrack); + codec = ghb_select_audio_codec_str(ud->settings, icodec, itrack); gtk_list_store_set(GTK_LIST_STORE(store), &iter, // These are displayed in list |