]> granicus.if.org Git - handbrake/commitdiff
LinGui: fix a problem with mixdown options
authorjstebbins <jstebbins.hb@gmail.com>
Sun, 12 Jun 2011 00:40:27 +0000 (00:40 +0000)
committerjstebbins <jstebbins.hb@gmail.com>
Sun, 12 Jun 2011 00:40:27 +0000 (00:40 +0000)
incorrect mixdown options were disabled when the "Choose for me"
encoder option was selected.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4043 b64f7644-9d1e-0410-96f1-a4d463321fa5

gtk/src/audiohandler.c
gtk/src/hb-backend.c
gtk/src/hb-backend.h

index de56340e5162151b3e3af639d08ea9e388a684eb..330078647b97944fb7d1174c8652abc495ebebd3 100644 (file)
@@ -96,7 +96,8 @@ ghb_adjust_audio_rate_combos(signal_user_data_t *ud)
                        }
                        else
                        {
-                               select_acodec = ghb_select_audio_codec(ud->settings, aconfig, acodec);
+                               gint mux = ghb_settings_get_int(ud->settings, "FileFormat");
+                               select_acodec = ghb_select_audio_codec(mux, aconfig, acodec);
                                if (acodec != HB_ACODEC_ANY)
                                {
                                        ghb_ui_update(ud, "AudioEncoder", ghb_int64_value(select_acodec));
index df909c1b9b763e9f1d53108b9453f1a3da7c8f5a..5f706733b68006e69fdf90ed2696d6876c277ea7 100644 (file)
@@ -1537,7 +1537,7 @@ void
 ghb_grey_combo_options(GtkBuilder *builder)
 {
        GtkWidget *widget;
-       gint container, track, titleindex, acodec;
+       gint mux, track, titleindex, acodec;
     hb_audio_config_t *aconfig = NULL;
        GValue *gval;
        
@@ -1552,7 +1552,7 @@ ghb_grey_combo_options(GtkBuilder *builder)
        aconfig = get_hb_audio(h_scan, titleindex, track);
        widget = GHB_WIDGET (builder, "FileFormat");
        gval = ghb_widget_value(widget);
-       container = ghb_lookup_combo_int("FileFormat", gval);
+       mux = ghb_lookup_combo_int("FileFormat", gval);
        ghb_value_free(gval);
 
        grey_combo_box_item(builder, "x264_analyse", 4, TRUE);
@@ -1562,13 +1562,19 @@ ghb_grey_combo_options(GtkBuilder *builder)
        grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_VORBIS, FALSE);
 
        gboolean allow_dca = TRUE;
-       allow_dca = (container != HB_MUX_MP4);
+       allow_dca = (mux != HB_MUX_MP4);
 
        grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_AC3_PASS, FALSE);
        if (allow_dca)
+    {
                grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_DCA_PASS, FALSE);
+               grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_DCA_HD_PASS, FALSE);
+    }
        else
+    {
                grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_DCA_PASS, TRUE);
+               grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_DCA_HD_PASS, TRUE);
+    }
 
        if (aconfig && aconfig->in.codec != HB_ACODEC_AC3)
        {
@@ -1578,6 +1584,10 @@ ghb_grey_combo_options(GtkBuilder *builder)
        {
                grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_DCA_PASS, TRUE);
        }
+       if (aconfig && aconfig->in.codec != HB_ACODEC_DCA_HD)
+       {
+               grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_DCA_HD_PASS, TRUE);
+       }
        grey_combo_box_item(builder, "VideoEncoder", HB_VCODEC_THEORA, FALSE);
 
        widget = GHB_WIDGET (builder, "AudioEncoder");
@@ -1585,7 +1595,7 @@ ghb_grey_combo_options(GtkBuilder *builder)
        acodec = ghb_lookup_combo_int("AudioEncoder", gval);
        ghb_value_free(gval);
        grey_combo_box_item(builder, "AudioMixdown", 0, TRUE);
-       if (container == HB_MUX_MP4)
+       if (mux == HB_MUX_MP4)
        {
                grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_VORBIS, TRUE);
                grey_combo_box_item(builder, "VideoEncoder", HB_VCODEC_THEORA, TRUE);
@@ -1596,16 +1606,17 @@ ghb_grey_combo_options(GtkBuilder *builder)
        gboolean allow_dolby = TRUE;
        gboolean allow_dpl2 = TRUE;
        gboolean allow_6ch = TRUE;
-       allow_mono = TRUE;
        allow_6ch = acodec & ~HB_ACODEC_LAME;
        if (aconfig)
        {
+               acodec = ghb_select_audio_codec(mux, aconfig, acodec);
                gint best = hb_get_best_mixdown(acodec, aconfig->in.channel_layout, 0);
 
                allow_stereo = best >= HB_AMIXDOWN_STEREO;
                allow_dolby = best >= HB_AMIXDOWN_DOLBY;
                allow_dpl2 = best >= HB_AMIXDOWN_DOLBYPLII;
                allow_6ch = best >= HB_AMIXDOWN_6CH;
+               allow_mono = best >= HB_AMIXDOWN_MONO;
        }
        grey_combo_box_item(builder, "AudioMixdown", HB_AMIXDOWN_MONO, !allow_mono);
        grey_combo_box_item(builder, "AudioMixdown", HB_AMIXDOWN_STEREO, !allow_stereo);
@@ -4124,10 +4135,8 @@ ghb_validate_subtitles(signal_user_data_t *ud)
 }
 
 gint
-ghb_select_audio_codec(GValue *settings, hb_audio_config_t *aconfig, gint acodec)
+ghb_select_audio_codec(gint mux, hb_audio_config_t *aconfig, gint acodec)
 {
-       gint mux = ghb_settings_combo_int(settings, "FileFormat");
-
        guint32 in_codec = aconfig ? aconfig->in.codec : HB_ACODEC_MASK;
        if (mux == HB_MUX_MP4)
        {
@@ -4724,7 +4733,8 @@ add_job(hb_handle_t *h, GValue *js, gint unique_id, gint titleindex)
                                                                        title->list_audio, audio.in.track );
 
                acodec = ghb_settings_combo_int(asettings, "AudioEncoder");
-               audio.out.codec = ghb_select_audio_codec(js, aconfig, acodec);
+
+               audio.out.codec = ghb_select_audio_codec(job->mux, aconfig, acodec);
 
                audio.out.gain = 
                        ghb_settings_get_double(asettings, "AudioTrackGain");
index 3056422aade1b9db9ee1c302f8791a99822e62db..6733ad30690b94d991e205faa2b11cfeff55afb1 100644 (file)
@@ -175,7 +175,7 @@ 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(GValue *settings, hb_audio_config_t *aconfig, gint acodec);
+gint ghb_select_audio_codec(gint mux, hb_audio_config_t *aconfig, gint acodec);
 gint ghb_find_closest_audio_rate(gint rate);
 GValue* ghb_lookup_acodec_value(gint val);