]> granicus.if.org Git - handbrake/commitdiff
preset: fix sanitizing audio settings when samplerate != Auto
authorJohn Stebbins <jstebbins.hb@gmail.com>
Wed, 12 Apr 2017 19:22:24 +0000 (13:22 -0600)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Wed, 12 Apr 2017 19:22:24 +0000 (13:22 -0600)
The samplerate was incorrectly copied to the job as a string instead of
an int which caused invalid sanitizing of audio settings.

libhb/preset.c

index 0b7f37734e52bf3df4d5d9072a8d4cfd197456a6..05efa6a65c825786b542f0ef45e6ddb80fec3696 100644 (file)
@@ -694,8 +694,13 @@ static void add_audio_for_lang(hb_value_array_t *list, const hb_dict_t *preset,
                 }
                 if (hb_dict_get(encoder_dict, "AudioSamplerate") != NULL)
                 {
-                    hb_dict_set(audio_dict, "Samplerate", hb_value_dup(
-                        hb_dict_get(encoder_dict, "AudioSamplerate")));
+                    const char * sr_name;
+                    int          sr;
+
+                    sr_name = hb_dict_get_string(encoder_dict,
+                                                 "AudioSamplerate");
+                    sr      = hb_audio_samplerate_get_from_name(sr_name);
+                    hb_dict_set(audio_dict, "Samplerate", hb_value_int(sr));
                 }
                 if (hb_dict_get(encoder_dict, "AudioCompressionLevel") != NULL)
                 {