]> granicus.if.org Git - handbrake/commitdiff
MacGui: harmonize audio configuration code in prepareJob and prepareAudioForJob.
authorRodeo <tdskywalker@gmail.com>
Sun, 28 Apr 2013 21:05:55 +0000 (21:05 +0000)
committerRodeo <tdskywalker@gmail.com>
Sun, 28 Apr 2013 21:05:55 +0000 (21:05 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5422 b64f7644-9d1e-0410-96f1-a4d463321fa5

macosx/Controller.m
macosx/HBAudioController.m

index a7184ed36308ef1a137ab356ce0c19e6c1830ec1..a94a2e1773e2324f177185d78beba53d466e9504 100644 (file)
@@ -4155,27 +4155,31 @@ bool one_burned = FALSE;
     
     /* Audio tracks and mixdowns */
     /* Now lets add our new tracks to the audio list here */
-       for (unsigned int counter = 0; counter < maximumNumberOfAllowedAudioTracks; counter++) {
-               NSString *prefix = [NSString stringWithFormat: @"Audio%d", counter + 1];
-               if ([[queueToApply objectForKey: [prefix stringByAppendingString: @"Track"]] intValue] > 0) {
-                       audio = (hb_audio_config_t *) calloc(1, sizeof(*audio));
-                       hb_audio_config_init(audio);
-                       audio->in.track = [[queueToApply objectForKey: [prefix stringByAppendingString: @"Track"]] intValue] - 1;
-                       /* We go ahead and assign values to our audio->out.<properties> */
-                       audio->out.track = audio->in.track;
-                       audio->out.dynamic_range_compression = [[queueToApply objectForKey: [prefix stringByAppendingString: @"TrackDRCSlider"]] floatValue];
-            audio->out.gain = [[queueToApply objectForKey: [prefix stringByAppendingString: @"TrackGainSlider"]] floatValue];
-                       prefix = [NSString stringWithFormat: @"JobAudio%d", counter + 1];
-                       audio->out.codec = [[queueToApply objectForKey: [prefix stringByAppendingString: @"Encoder"]] intValue];
-                       audio->out.compression_level = hb_get_default_audio_compression(audio->out.codec);
-                       audio->out.mixdown = [[queueToApply objectForKey: [prefix stringByAppendingString: @"Mixdown"]] intValue];
-                       audio->out.bitrate = [[queueToApply objectForKey: [prefix stringByAppendingString: @"Bitrate"]] intValue];
-                       audio->out.samplerate = [[queueToApply objectForKey: [prefix stringByAppendingString: @"Samplerate"]] intValue];
-                       
-                       hb_audio_add( job, audio );
-                       free(audio);
-               }
-       }
+    for (unsigned int counter = 0; counter < maximumNumberOfAllowedAudioTracks; counter++)
+    {
+        NSString *prefix    = [NSString stringWithFormat:@"Audio%d",    counter + 1];
+        NSString *jobPrefix = [NSString stringWithFormat:@"JobAudio%d", counter + 1];
+        if ([[queueToApply objectForKey:[prefix stringByAppendingString:@"Track"]] intValue] > 0)
+        {
+            audio           = (hb_audio_config_t*)calloc(1, sizeof(*audio));
+            hb_audio_config_init(audio);
+            audio->in.track = [[queueToApply objectForKey:[prefix stringByAppendingString:@"Track"]] intValue] - 1;
+            /* We go ahead and assign values to our audio->out.<properties> */
+            audio->out.track                     = audio->in.track;
+            audio->out.codec                     = [[queueToApply objectForKey:[jobPrefix stringByAppendingString:@"Encoder"]]           intValue];
+            audio->out.compression_level         = hb_get_default_audio_compression(audio->out.codec);
+            audio->out.mixdown                   = [[queueToApply objectForKey:[jobPrefix stringByAppendingString:@"Mixdown"]]           intValue];
+            audio->out.normalize_mix_level       = 0;
+            audio->out.bitrate                   = [[queueToApply objectForKey:[jobPrefix stringByAppendingString:@"Bitrate"]]           intValue];
+            audio->out.samplerate                = [[queueToApply objectForKey:[jobPrefix stringByAppendingString:@"Samplerate"]]        intValue];
+            audio->out.dynamic_range_compression = [[queueToApply objectForKey:[prefix    stringByAppendingString:@"TrackDRCSlider"]]  floatValue];
+            audio->out.gain                      = [[queueToApply objectForKey:[prefix    stringByAppendingString:@"TrackGainSlider"]] floatValue];
+            audio->out.dither_method             = hb_audio_dither_get_default();
+            
+            hb_audio_add(job, audio);
+            free(audio);
+        }
+    }
     
     /* Now lets call the filters if applicable.
      * The order of the filters is critical
index 5e4a32508fc797dc9caaf90a6f97f2ae85ec88b4..353e24f162da8bde412cdbebad5bb3cbb42f2cab 100644 (file)
@@ -150,27 +150,27 @@ NSString *HBMixdownChangedNotification = @"HBMixdownChangedNotification";
     unsigned int audioArrayCount = [self countOfAudioArray];
     for (i = 0; i < audioArrayCount; i++)
     {
-        HBAudio *anAudio = [self objectInAudioArrayAtIndex: i];
+        HBAudio *anAudio = [self objectInAudioArrayAtIndex:i];
         if ([anAudio enabled])
         {
-            NSNumber *sampleRateToUse = (0 == [[[anAudio sampleRate] objectForKey: keyAudioSamplerate] intValue]) ?
-            [[anAudio track] objectForKey: keyAudioInputSampleRate] :
-            [[anAudio sampleRate] objectForKey: keyAudioSamplerate];
+            NSNumber *sampleRateToUse = ([[[anAudio sampleRate] objectForKey:keyAudioSamplerate] intValue] == 0 ?
+                                         [[anAudio track]       objectForKey:keyAudioInputSampleRate] :
+                                         [[anAudio sampleRate]  objectForKey:keyAudioSamplerate]);
 
-            hb_audio_config_t *audio = (hb_audio_config_t *) calloc(1, sizeof(*audio));
+            hb_audio_config_t *audio = (hb_audio_config_t*)calloc(1, sizeof(*audio));
             hb_audio_config_init(audio);
-            audio->in.track = [[[anAudio track] objectForKey: keyAudioTrackIndex] intValue] - 1;
+            audio->in.track          = [[[anAudio track] objectForKey:keyAudioTrackIndex] intValue] - 1;
             /* We go ahead and assign values to our audio->out.<properties> */
-            audio->out.track = audio->in.track;
-            audio->out.codec = [[[anAudio codec] objectForKey: keyAudioCodec] intValue];
-            audio->out.compression_level = hb_get_default_audio_compression(audio->out.codec);
-            audio->out.mixdown = [[[anAudio mixdown] objectForKey: keyAudioMixdown] intValue];
-            audio->out.normalize_mix_level = 0;
-            audio->out.bitrate = [[[anAudio bitRate] objectForKey: keyAudioBitrate] intValue];
-            audio->out.samplerate = [sampleRateToUse intValue];
-            audio->out.dynamic_range_compression = [[anAudio drc] floatValue];
-            audio->out.gain = [[anAudio gain] floatValue];
-            audio->out.dither_method = hb_audio_dither_get_default();
+            audio->out.track                     = audio->in.track;
+            audio->out.codec                     = [[[anAudio codec]   objectForKey:keyAudioCodec]   intValue];
+            audio->out.compression_level         = hb_get_default_audio_compression(audio->out.codec);
+            audio->out.mixdown                   = [[[anAudio mixdown] objectForKey:keyAudioMixdown] intValue];
+            audio->out.normalize_mix_level       = 0;
+            audio->out.bitrate                   = [[[anAudio bitRate] objectForKey:keyAudioBitrate] intValue];
+            audio->out.samplerate                = [sampleRateToUse  intValue];
+            audio->out.dynamic_range_compression = [[anAudio drc]  floatValue];
+            audio->out.gain                      = [[anAudio gain] floatValue];
+            audio->out.dither_method             = hb_audio_dither_get_default();
 
             hb_audio_add(aJob, audio);
             free(audio);