summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodeo <[email protected]>2013-04-28 21:05:55 +0000
committerRodeo <[email protected]>2013-04-28 21:05:55 +0000
commit0b0ecc8e17212f2081f0b942c54dc7abdbb22dba (patch)
treeb23b25f949276e17d781d5fb487df0d2a1598c07
parenta9e2b0dfab1a54db3e8f5e0cc1c1f14fe41e98e2 (diff)
MacGui: harmonize audio configuration code in prepareJob and prepareAudioForJob.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5422 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--macosx/Controller.m46
-rw-r--r--macosx/HBAudioController.m32
2 files changed, 41 insertions, 37 deletions
diff --git a/macosx/Controller.m b/macosx/Controller.m
index a7184ed36..a94a2e177 100644
--- a/macosx/Controller.m
+++ b/macosx/Controller.m
@@ -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
diff --git a/macosx/HBAudioController.m b/macosx/HBAudioController.m
index 5e4a32508..353e24f16 100644
--- a/macosx/HBAudioController.m
+++ b/macosx/HBAudioController.m
@@ -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);