summaryrefslogtreecommitdiffstats
path: root/macosx/HBAudioController.m
diff options
context:
space:
mode:
authorritsuka <[email protected]>2014-12-27 10:46:04 +0000
committerritsuka <[email protected]>2014-12-27 10:46:04 +0000
commitdf8b2ff3e109699e3dadd88404911f8dfc7b210a (patch)
tree8489fee4edaf57adf55f69d0c0d28f61a5757057 /macosx/HBAudioController.m
parent8df584534c0c39f5c2f298d8ba480cc906743bbf (diff)
MacGui: change the queue to work with serialized HBJob objects, remove the NSDictionary job representation and the duplicate prepareJob method. Implement NSCopying protocol in HBJob.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6655 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/HBAudioController.m')
-rw-r--r--macosx/HBAudioController.m94
1 files changed, 7 insertions, 87 deletions
diff --git a/macosx/HBAudioController.m b/macosx/HBAudioController.m
index bc2b6e45d..0c1c49293 100644
--- a/macosx/HBAudioController.m
+++ b/macosx/HBAudioController.m
@@ -114,96 +114,9 @@ NSString *HBMixdownChangedNotification = @"HBMixdownChangedNotification";
#pragma mark -
#pragma mark HBController Support
-- (NSArray *)audioTracks
-
-{
- NSMutableArray *tracksArray = [NSMutableArray array];
-
- NSUInteger audioArrayCount = [self countOfAudioArray];
- for (NSUInteger counter = 0; counter < audioArrayCount; counter++)
- {
- HBAudio *anAudio = [self objectInAudioArrayAtIndex: counter];
- if ([anAudio enabled])
- {
- NSMutableDictionary *dict = [NSMutableDictionary dictionary];
- NSNumber *sampleRateToUse = ([anAudio.sampleRate[keyAudioSamplerate] intValue] == 0 ?
- anAudio.track[keyAudioInputSampleRate] :
- anAudio.sampleRate[keyAudioSamplerate]);
-
- dict[@"Track"] = @([anAudio.track[keyAudioTrackIndex] intValue] -1);
- dict[@"TrackDescription"] = anAudio.track[keyAudioTrackName];
- dict[@"Encoder"] = anAudio.codec[keyAudioCodecName];
- dict[@"Mixdown"] = anAudio.mixdown[keyAudioMixdownName];
- dict[@"Samplerate"] = anAudio.sampleRate[keyAudioSampleRateName];
- dict[@"Bitrate"] = anAudio.bitRate[keyAudioBitrateName];
-
- // output is not passthru so apply gain
- if (!([[anAudio codec][keyAudioCodec] intValue] & HB_ACODEC_PASS_FLAG))
- {
- dict[@"TrackGainSlider"] = anAudio.gain;
- }
- else
- {
- // output is passthru - the Gain dial is disabled so don't apply its value
- dict[@"TrackGainSlider"] = @0;
- }
-
- if (hb_audio_can_apply_drc([anAudio.track[keyAudioInputCodec] intValue],
- [anAudio.track[keyAudioInputCodecParam] intValue],
- [anAudio.codec[keyAudioCodec] intValue]))
- {
- dict[@"TrackDRCSlider"] = anAudio.drc;
- }
- else
- {
- // source isn't AC3 or output is passthru - the DRC dial is disabled so don't apply its value
- dict[@"TrackDRCSlider"] = @0;
- }
-
- dict[@"JobEncoder"] = anAudio.codec[keyAudioCodec];
- dict[@"JobMixdown"] = anAudio.mixdown[keyAudioMixdown];
- dict[@"JobSamplerate"] = sampleRateToUse;
- dict[@"JobBitrate"] = anAudio.bitRate[keyAudioBitrate];
-
- [tracksArray addObject:dict];
- }
- }
-
- return tracksArray;
-}
-
-- (void) addTracksFromQueue: (NSArray *) queueArray
-
-{
- // Reinitialize the configured list of audio tracks
- [self _clearAudioArray];
-
- // The following is the pattern to follow, but with Audio%dTrack being the key to seek...
- // Can we assume that there will be no skip in the data?
- for (NSDictionary *audioDict in queueArray)
- {
- HBAudio *newAudio = [[HBAudio alloc] init];
- [newAudio setController: self];
- [self insertObject: newAudio inAudioArrayAtIndex: [self countOfAudioArray]];
- [newAudio setVideoContainerTag: [self videoContainerTag]];
- [newAudio setTrackFromIndex: [audioDict[@"Track"] intValue] + 1];
- [newAudio setCodecFromName: audioDict[@"Encoder"]];
- [newAudio setMixdownFromName: audioDict[@"Mixdown"]];
- [newAudio setSampleRateFromName: audioDict[@"Samplerate"]];
- [newAudio setBitRateFromName: audioDict[@"Bitrate"]];
- [newAudio setDrc: audioDict[@"TrackDRCSlider"]];
- [newAudio setGain: audioDict[@"TrackGainSlider"]];
- [newAudio release];
- }
-
- [self switchingTrackFromNone: nil]; // see if we need to add one to the list
-}
-
- (void)applySettingsFromPreset:(NSDictionary *)preset
{
- [self.settings applySettingsFromPreset:preset];
[self.settings validateEncoderFallbackForVideoContainer:[self.videoContainerTag intValue]];
-
[self addTracksFromDefaults:NO];
}
@@ -507,6 +420,13 @@ NSString *HBMixdownChangedNotification = @"HBMixdownChangedNotification";
[newTrackArray addObject: noneTrack];
[newTrackArray addObjectsFromArray:job.title.audioTracks];
self.masterTrackArray = newTrackArray;
+
+ // Readd the controller reference to the audio tracks.
+ for (HBAudio *audioTrack in audioArray)
+ {
+ audioTrack.controller = self;
+ }
+
[self switchingTrackFromNone: nil]; // this ensures there is a None track at the end of the list
}
else