diff options
author | jstebbins <[email protected]> | 2009-10-04 05:52:47 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2009-10-04 05:52:47 +0000 |
commit | 8e64e5d1821d1699bc019c8d362e9a0a76080b14 (patch) | |
tree | 9a0ac34277c33d6dcda07834b5eae8af2817d2eb | |
parent | 3f0772a709a839258eee5b4a8fcf3f5bb830b81a (diff) |
LinGui: set max bitrate for 6ch faac to 448kbps
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2864 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | gtk/src/audiohandler.c | 15 | ||||
-rw-r--r-- | gtk/src/hb-backend.c | 34 |
2 files changed, 34 insertions, 15 deletions
diff --git a/gtk/src/audiohandler.c b/gtk/src/audiohandler.c index ea13c9060..39d54c109 100644 --- a/gtk/src/audiohandler.c +++ b/gtk/src/audiohandler.c @@ -68,17 +68,22 @@ ghb_adjust_audio_rate_combos(signal_user_data_t *ud) } ghb_ui_update(ud, "AudioTrackDRCSlider", ghb_double_value(0)); } - else if (acodec == HB_ACODEC_FAAC && mix != HB_AMIXDOWN_6CH) + else if (acodec == HB_ACODEC_FAAC) { - gint br; + gint br, last; + + if (mix == HB_AMIXDOWN_6CH) + last = 448; + else + last = 160; widget = GHB_WIDGET(ud->builder, "AudioBitrate"); gval = ghb_widget_value(widget); br = ghb_lookup_combo_int("AudioBitrate", gval); ghb_value_free(gval); - if (br > 160) - ghb_ui_update(ud, "AudioBitrate", ghb_int64_value(160)); - ghb_set_default_bitrate_opts (ud->builder, 160); + if (br > last) + ghb_ui_update(ud, "AudioBitrate", ghb_int64_value(last)); + ghb_set_default_bitrate_opts (ud->builder, last); } else { diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index caa11e9b7..bf2ff7b94 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -1354,11 +1354,12 @@ ghb_grey_combo_options(GtkBuilder *builder) gboolean allow_dolby = TRUE; gboolean allow_dpl2 = TRUE; gboolean allow_6ch = TRUE; + allow_mono = acodec & ~HB_ACODEC_LAME; + allow_6ch = acodec & ~HB_ACODEC_LAME; if (audio) { - allow_mono = - (audio->in.codec & (HB_ACODEC_AC3|HB_ACODEC_DCA)) && - (acodec & ~HB_ACODEC_LAME); + allow_mono = allow_mono && + (audio->in.codec & (HB_ACODEC_AC3|HB_ACODEC_DCA)); gint layout = audio->in.channel_layout & HB_INPUT_CH_LAYOUT_DISCRETE_NO_LFE_MASK; allow_stereo = ((layout == HB_INPUT_CH_LAYOUT_MONO && !allow_mono) || layout >= HB_INPUT_CH_LAYOUT_STEREO); @@ -1367,9 +1368,8 @@ ghb_grey_combo_options(GtkBuilder *builder) (layout == HB_INPUT_CH_LAYOUT_3F2R) || (layout == HB_INPUT_CH_LAYOUT_DOLBY); allow_dpl2 = (layout == HB_INPUT_CH_LAYOUT_3F2R); - allow_6ch = + allow_6ch = allow_6ch && (audio->in.codec & (HB_ACODEC_AC3|HB_ACODEC_DCA)) && - (acodec & ~HB_ACODEC_LAME) && (layout == HB_INPUT_CH_LAYOUT_3F2R) && (audio->in.channel_layout & HB_INPUT_CH_LAYOUT_HAS_LFE); } @@ -1381,10 +1381,14 @@ ghb_grey_combo_options(GtkBuilder *builder) } gint -ghb_get_best_audio_bitrate(gint acodec, gint br) +ghb_get_best_audio_bitrate(gint acodec, gint br, gint channels) { - if ((acodec & HB_ACODEC_FAAC) && br > 160) - br = 160; + if (acodec & HB_ACODEC_FAAC) + { + int maxbr = channels * 80; + if (br > maxbr) + br = maxbr; + } return br; } @@ -4262,19 +4266,29 @@ add_job(hb_handle_t *h, GValue *js, gint unique_id, gint titleindex) } else { + int channels; + audio.out.mixdown = ghb_settings_combo_int(asettings, "AudioMixdown"); + if (audio.out.mixdown == HB_AMIXDOWN_MONO) + channels = 1; + else if (audio.out.mixdown == HB_AMIXDOWN_6CH) + channels = 6; + else + channels = 2; + // Make sure the mixdown is valid and pick a new one if not. audio.out.mixdown = ghb_get_best_mix(titleindex, audio.in.track, audio.out.codec, audio.out.mixdown); audio.out.bitrate = ghb_settings_combo_int(asettings, "AudioBitrate"); - audio.out.bitrate = ghb_get_best_audio_bitrate( - audio.out.codec, audio.out.bitrate); gint srate = ghb_settings_combo_int(asettings, "AudioSamplerate"); if (srate == 0) // 0 is same as source audio.out.samplerate = taudio->in.samplerate; else audio.out.samplerate = srate; + + audio.out.bitrate = ghb_get_best_audio_bitrate( + audio.out.codec, audio.out.bitrate, channels); } // Add it to the jobs audio list |