diff options
-rw-r--r-- | macosx/Controller.m | 57 | ||||
-rw-r--r-- | macosx/HBAudioDefaults.h | 2 | ||||
-rw-r--r-- | macosx/HBAudioDefaults.m | 4 | ||||
-rw-r--r-- | macosx/HBQueueController.mm | 13 | ||||
-rw-r--r-- | macosx/HBSubtitlesController.h | 5 | ||||
-rw-r--r-- | macosx/HBSubtitlesController.m | 5 | ||||
-rw-r--r-- | macosx/HBSubtitlesDefaults.h | 2 | ||||
-rw-r--r-- | macosx/HBSubtitlesDefaults.m | 2 |
8 files changed, 46 insertions, 44 deletions
diff --git a/macosx/Controller.m b/macosx/Controller.m index f75d50b86..c6236c43a 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -18,6 +18,7 @@ #import "HBPresetsViewController.h" #import "HBAudioDefaults.h" +#import "HBSubtitlesDefaults.h" NSString *HBContainerChangedNotification = @"HBContainerChangedNotification"; NSString *keyContainerTag = @"keyContainerTag"; @@ -2400,7 +2401,7 @@ fWorkingCount = 0; /* Source and Destination Information */ [queueFileJob setObject:[NSString stringWithUTF8String: title->path] forKey:@"SourcePath"]; - [queueFileJob setObject:[fSrcDVD2Field stringValue] forKey:@"SourceName"]; + [queueFileJob setObject:[[fSrcDVD2Field stringValue] lastPathComponent] forKey:@"SourceName"]; [queueFileJob setObject:[NSNumber numberWithInt:title->index] forKey:@"TitleNumber"]; [queueFileJob setObject:[NSNumber numberWithInteger:[fSrcAnglePopUp indexOfSelectedItem] + 1] forKey:@"TitleAngle"]; @@ -2513,22 +2514,21 @@ fWorkingCount = 0; queueFileJob[@"PictureDeblock"] = [NSString stringWithFormat:@"%ld",(long)filters.deblock]; queueFileJob[@"VideoGrayScale"] = [NSString stringWithFormat:@"%ld",(long)filters.grayscale]; - /* Auto Passthru */ - [queueFileJob setObject:@(fAudioController.settings.allowAACPassthru) forKey: @"AudioAllowAACPass"]; - [queueFileJob setObject:@(fAudioController.settings.allowAC3Passthru) forKey: @"AudioAllowAC3Pass"]; - [queueFileJob setObject:@(fAudioController.settings.allowDTSHDPassthru) forKey: @"AudioAllowDTSHDPass"]; - [queueFileJob setObject:@(fAudioController.settings.allowDTSPassthru) forKey: @"AudioAllowDTSPass"]; - [queueFileJob setObject:@(fAudioController.settings.allowMP3Passthru) forKey: @"AudioAllowMP3Pass"]; - // just in case we need it for display purposes - [queueFileJob setObject:@(hb_audio_encoder_get_name((int)fAudioController.settings.encoderFallback)) forKey: @"AudioEncoderFallback"]; - // actual fallback encoder - [queueFileJob setObject:@(fAudioController.settings.encoderFallback) forKey: @"JobAudioEncoderFallback"]; + /* Audio Defaults */ + NSMutableDictionary *audioDefaults = [NSMutableDictionary dictionary]; + [fAudioController.settings prepareAudioDefaultsForPreset:audioDefaults]; + queueFileJob[@"AudioDefaults"] = audioDefaults; /* Audio */ NSMutableArray *audioArray = [[NSMutableArray alloc] initWithArray:[fAudioController audioTracks] copyItems:YES]; [queueFileJob setObject:[NSArray arrayWithArray: audioArray] forKey:@"AudioList"]; [audioArray release]; + /* Subtitles Defaults */ + NSMutableDictionary *subtitlesDefaults = [NSMutableDictionary dictionary]; + [fSubtitlesViewController.settings prepareSubtitlesDefaultsForPreset:subtitlesDefaults]; + queueFileJob[@"SubtitlesDefaults"] = subtitlesDefaults; + /* Subtitles */ NSMutableArray *subtitlesArray = [[NSMutableArray alloc] initWithArray:[fSubtitlesViewController subtitles] copyItems:YES]; [queueFileJob setObject:[NSArray arrayWithArray: subtitlesArray] forKey:@"SubtitleList"]; @@ -2814,18 +2814,16 @@ fWorkingCount = 0; /* video encoder */ [fVideoController applyVideoSettingsFromQueue:queueToApply]; - /* Auto Passthru */ - fAudioController.settings.allowAACPassthru = [[queueToApply objectForKey:@"AudioAllowAACPass"] boolValue]; - fAudioController.settings.allowAC3Passthru = [[queueToApply objectForKey:@"AudioAllowAC3Pass"] boolValue]; - fAudioController.settings.allowDTSHDPassthru = [[queueToApply objectForKey:@"AudioAllowDTSHDPass"] boolValue]; - fAudioController.settings.allowDTSPassthru = [[queueToApply objectForKey:@"AudioAllowDTSPass"] boolValue]; - fAudioController.settings.allowMP3Passthru = [[queueToApply objectForKey:@"AudioAllowMP3Pass"] boolValue]; - fAudioController.settings.encoderFallback = [queueToApply objectForKey:@"AudioEncoderFallback"]; + /* Audio Defaults */ + [fAudioController.settings applySettingsFromPreset:queueToApply[@"AudioDefaults"]]; /* Audio */ /* Now lets add our new tracks to the audio list here */ [fAudioController addTracksFromQueue: queueToApply]; - + + /* Subtitles Defaults */ + [fSubtitlesViewController.settings applySettingsFromPreset:queueToApply[@"SubtitlesDefaults"]]; + /* Subtitles */ [fSubtitlesViewController addTracksFromQueue:[queueToApply objectForKey:@"SubtitleList"]]; @@ -3620,29 +3618,32 @@ fWorkingCount = 0; job->crop[2], job->crop[3]] UTF8String] ); } - /* Auto Passthru */ + /* Auto Defaults */ + NSDictionary *audioDefaults = queueToApply[@"AudioDefaults"]; + job->acodec_copy_mask = 0; - if( [[queueToApply objectForKey: @"AudioAllowAACPass"] intValue] == 1 ) + + if ([audioDefaults[@"AudioAllowAACPass"] boolValue]) { job->acodec_copy_mask |= HB_ACODEC_FFAAC; } - if( [[queueToApply objectForKey: @"AudioAllowAC3Pass"] intValue] == 1 ) + if ([audioDefaults[@"AudioAllowAC3Pass"] boolValue]) { job->acodec_copy_mask |= HB_ACODEC_AC3; } - if( [[queueToApply objectForKey: @"AudioAllowDTSHDPass"] intValue] == 1 ) + if ([audioDefaults[@"AudioAllowDTSHDPass"] boolValue]) { job->acodec_copy_mask |= HB_ACODEC_DCA_HD; } - if( [[queueToApply objectForKey: @"AudioAllowDTSPass"] intValue] == 1 ) + if ([audioDefaults[@"AudioAllowDTSPass"] boolValue]) { job->acodec_copy_mask |= HB_ACODEC_DCA; } - if( [[queueToApply objectForKey: @"AudioAllowMP3Pass"] intValue] == 1 ) + if ([audioDefaults[@"AudioAllowMP3Pass"] boolValue]) { job->acodec_copy_mask |= HB_ACODEC_MP3; } - job->acodec_fallback = [[queueToApply objectForKey: @"JobAudioEncoderFallback"] intValue]; + job->acodec_fallback = hb_audio_encoder_get_from_name([audioDefaults[@"AudioEncoderFallback"] UTF8String]); /* Audio tracks and mixdowns */ /* Now lets add our new tracks to the audio list here */ @@ -5032,10 +5033,10 @@ the user is using "Custom" settings by determining the sender*/ [fPictureController.filters prepareFiltersForPreset:preset]; /* Audio */ - [fAudioController.settings prepareAudioForPreset:preset]; + [fAudioController.settings prepareAudioDefaultsForPreset:preset]; /* Subtitles */ - [fSubtitlesViewController prepareSubtitlesForPreset:preset]; + [fSubtitlesViewController.settings prepareSubtitlesDefaultsForPreset:preset]; [preset autorelease]; return preset; diff --git a/macosx/HBAudioDefaults.h b/macosx/HBAudioDefaults.h index 5853a6e12..aeb271770 100644 --- a/macosx/HBAudioDefaults.h +++ b/macosx/HBAudioDefaults.h @@ -35,7 +35,7 @@ typedef NS_ENUM(NSUInteger, HBAudioTrackSelectionBehavior) { @property(nonatomic, readonly) NSArray *audioEncoderFallbacks; - (void)applySettingsFromPreset:(NSDictionary *)preset; -- (void)prepareAudioForPreset:(NSMutableDictionary *)preset; +- (void)prepareAudioDefaultsForPreset:(NSMutableDictionary *)preset; - (void)validateEncoderFallbackForVideoContainer:(int)container; diff --git a/macosx/HBAudioDefaults.m b/macosx/HBAudioDefaults.m index 304849d79..3c9cff573 100644 --- a/macosx/HBAudioDefaults.m +++ b/macosx/HBAudioDefaults.m @@ -132,6 +132,8 @@ self.encoderFallback = hb_audio_encoder_get_from_name(strValue); } + [self.tracksArray removeAllObjects]; + for (NSDictionary *track in preset[@"AudioList"]) { HBAudioTrackPreset *newTrack = [[HBAudioTrackPreset alloc] init]; @@ -162,7 +164,7 @@ } } -- (void)prepareAudioForPreset:(NSMutableDictionary *)preset +- (void)prepareAudioDefaultsForPreset:(NSMutableDictionary *)preset { // Track selection behavior if (self.trackSelectionBehavior == HBAudioTrackSelectionBehaviorFirst) diff --git a/macosx/HBQueueController.mm b/macosx/HBQueueController.mm index 42894a533..33510e524 100644 --- a/macosx/HBQueueController.mm +++ b/macosx/HBQueueController.mm @@ -1028,12 +1028,13 @@ if (autoPassthruPresent == YES) { NSString *autoPassthruFallback = @"", *autoPassthruCodecs = @""; - autoPassthruFallback = [autoPassthruFallback stringByAppendingString: item[@"AudioEncoderFallback"]]; - if (0 < [item[@"AudioAllowAACPass"] intValue]) + NSDictionary *audioDefaults = item[@"AudioDefaults"]; + autoPassthruFallback = [autoPassthruFallback stringByAppendingString: audioDefaults[@"AudioEncoderFallback"]]; + if (0 < [audioDefaults[@"AudioAllowAACPass"] intValue]) { autoPassthruCodecs = [autoPassthruCodecs stringByAppendingString: @"AAC"]; } - if (0 < [item[@"AudioAllowAC3Pass"] intValue]) + if (0 < [audioDefaults[@"AudioAllowAC3Pass"] intValue]) { if (0 < [autoPassthruCodecs length]) { @@ -1041,7 +1042,7 @@ } autoPassthruCodecs = [autoPassthruCodecs stringByAppendingString: @"AC3"]; } - if (0 < [item[@"AudioAllowDTSHDPass"] intValue]) + if (0 < [audioDefaults[@"AudioAllowDTSHDPass"] intValue]) { if (0 < [autoPassthruCodecs length]) { @@ -1049,7 +1050,7 @@ } autoPassthruCodecs = [autoPassthruCodecs stringByAppendingString: @"DTS-HD"]; } - if (0 < [item[@"AudioAllowDTSPass"] intValue]) + if (0 < [audioDefaults[@"AudioAllowDTSPass"] intValue]) { if (0 < [autoPassthruCodecs length]) { @@ -1057,7 +1058,7 @@ } autoPassthruCodecs = [autoPassthruCodecs stringByAppendingString: @"DTS"]; } - if (0 < [item[@"AudioAllowMP3Pass"] intValue]) + if (0 < [audioDefaults[@"AudioAllowMP3Pass"] intValue]) { if (0 < [autoPassthruCodecs length]) { diff --git a/macosx/HBSubtitlesController.h b/macosx/HBSubtitlesController.h index a117cee0f..013074cf0 100644 --- a/macosx/HBSubtitlesController.h +++ b/macosx/HBSubtitlesController.h @@ -21,6 +21,8 @@ extern NSString *keySubTrackSrtOffset; extern NSString *keySubTrackSrtFilePath; extern NSString *keySubTrackSrtCharCode; +@class HBSubtitlesDefaults; + /** * HBSubtitlesController * Responds to HBContainerChangedNotification and HBTitleChangedNotification notifications. @@ -30,9 +32,10 @@ extern NSString *keySubTrackSrtCharCode; - (void)addTracksFromQueue:(NSMutableArray *)newSubtitleArray; - (void)applySettingsFromPreset:(NSDictionary *)preset; -- (void)prepareSubtitlesForPreset:(NSMutableDictionary *)preset; // Get the list of subtitles tracks @property (readonly, nonatomic, copy) NSArray *subtitles; +@property (nonatomic, readonly) HBSubtitlesDefaults *settings; + @end diff --git a/macosx/HBSubtitlesController.m b/macosx/HBSubtitlesController.m index 92cc1d1db..187d96316 100644 --- a/macosx/HBSubtitlesController.m +++ b/macosx/HBSubtitlesController.m @@ -227,11 +227,6 @@ NSString *keySubTrackLanguageIndex = @"keySubTrackLanguageIndex"; [self addTracksFromDefaults:self]; } -- (void)prepareSubtitlesForPreset:(NSMutableDictionary *)preset -{ - [self.settings prepareSubtitlesForPreset:preset]; -} - #pragma mark - Actions - (BOOL)validateUserInterfaceItem:(id < NSValidatedUserInterfaceItem >)anItem diff --git a/macosx/HBSubtitlesDefaults.h b/macosx/HBSubtitlesDefaults.h index 21ebce5f2..f345e6c86 100644 --- a/macosx/HBSubtitlesDefaults.h +++ b/macosx/HBSubtitlesDefaults.h @@ -22,6 +22,6 @@ typedef NS_ENUM(NSUInteger, HBSubtitleTrackSelectionBehavior) { @property (nonatomic, readwrite) BOOL addCC; - (void)applySettingsFromPreset:(NSDictionary *)preset; -- (void)prepareSubtitlesForPreset:(NSMutableDictionary *)preset; +- (void)prepareSubtitlesDefaultsForPreset:(NSMutableDictionary *)preset; @end diff --git a/macosx/HBSubtitlesDefaults.m b/macosx/HBSubtitlesDefaults.m index 6cd5b6782..71046c060 100644 --- a/macosx/HBSubtitlesDefaults.m +++ b/macosx/HBSubtitlesDefaults.m @@ -38,7 +38,7 @@ self.addForeignAudioSubtitle = [preset[@"SubtitleAddForeignAudioSubtitle"] boolValue]; } -- (void)prepareSubtitlesForPreset:(NSMutableDictionary *)preset +- (void)prepareSubtitlesDefaultsForPreset:(NSMutableDictionary *)preset { if (self.trackSelectionBehavior == HBSubtitleTrackSelectionBehaviorFirst) { |