LinGui: Use real sample rate when creating job
authorjstebbins <jstebbins.hb@gmail.com>
Sat, 18 Apr 2015 17:32:11 +0000 (17:32 +0000)
committerjstebbins <jstebbins.hb@gmail.com>
Sat, 18 Apr 2015 17:32:11 +0000 (17:32 +0000)
The computation of the "best" bitrate was wrong because it requires
the real samplerate and not 0 - "same as source"

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

gtk/src/hb-backend.c

index 791f3b6782c1344a75a98b778732a8fd81d0e19f..68c43a816da635bda44676bd0aa2b0f6dda4fd26 100644 (file)
@@ -4015,11 +4015,10 @@ ghb_validate_audio(GhbValue *settings, GtkWindow *parent)
         if (codec == HB_ACODEC_AUTO_PASS)
             continue;
 
-        aconfig = (hb_audio_config_t *) hb_list_audio_config_item(
-                                            title->list_audio, track );
-        if ( ghb_audio_is_passthru(codec) &&
+        aconfig = hb_list_audio_config_item(title->list_audio, track);
+        if (ghb_audio_is_passthru(codec) &&
             !(ghb_audio_can_passthru(aconfig->in.codec) &&
-             (aconfig->in.codec & codec)))
+              (aconfig->in.codec & codec)))
         {
             // Not supported.  AC3 is passthrough only, so input must be AC3
             message = g_strdup_printf(
@@ -4103,6 +4102,14 @@ ghb_validate_audio(GhbValue *settings, GtkWindow *parent)
             ghb_dict_set_string(asettings, "AudioMixdown",
                                     hb_mixdown_get_short_name(amixdown));
         }
+        int samplerate = ghb_settings_audio_samplerate_rate(asettings,
+                                                            "AudioSamplerate");
+        if (samplerate == 0)
+        {
+            samplerate = aconfig->in.samplerate;
+            ghb_dict_set_string(asettings, "AudioSamplerate",
+                            ghb_audio_samplerate_get_short_name(samplerate));
+        }
     }
     return TRUE;
 }