diff options
author | Damiano Galassi <[email protected]> | 2016-10-29 13:24:01 +0200 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2016-10-29 14:08:19 +0200 |
commit | 185a922d275ef95db2fa73ee31e07bcafbdecaae (patch) | |
tree | 8ae73547d8acaf987091d5ab29bf3a3db279bf4a /macosx/HBJob.m | |
parent | 2e48a329ffa5123439cf82b5163176713eb64432 (diff) |
MacGui: use hb_preset_job_init instead of custom logic for audio, subtitles and picture job settings.
Diffstat (limited to 'macosx/HBJob.m')
-rw-r--r-- | macosx/HBJob.m | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/macosx/HBJob.m b/macosx/HBJob.m index 7fa3b58f5..483735d33 100644 --- a/macosx/HBJob.m +++ b/macosx/HBJob.m @@ -5,7 +5,8 @@ It may be used under the terms of the GNU General Public License. */ #import "HBJob.h" -#import "HBTitle.h" +#import "HBJob+Private.h" +#import "HBTitle+Private.h" #import "HBAudioDefaults.h" #import "HBSubtitlesDefaults.h" @@ -13,6 +14,7 @@ #import "HBCodingUtilities.h" #import "HBMutablePreset.h" + #include "hb.h" NSString *HBContainerChangedNotification = @"HBContainerChangedNotification"; @@ -47,8 +49,8 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification"; _picture = [[HBPicture alloc] initWithTitle:title]; _filters = [[HBFilters alloc] init]; - _audio = [[HBAudio alloc] initWithTitle:title]; - _subtitles = [[HBSubtitles alloc] initWithTitle:title]; + _audio = [[HBAudio alloc] initWithJob:self]; + _subtitles = [[HBSubtitles alloc] initWithJob:self]; _chapterTitles = [title.chapters copy]; @@ -64,7 +66,10 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification"; - (void)applyPreset:(HBPreset *)preset { + NSAssert(self.title, @"HBJob: calling applyPreset: without a valid title loaded"); + self.presetName = preset.name; + NSDictionary *jobSettings = [self.title jobSettingsWithPreset:preset]; self.container = hb_container_get_from_name([preset[@"FileFormat"] UTF8String]); @@ -75,8 +80,11 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification"; // Chapter Markers self.chaptersEnabled = [preset[@"ChapterMarkers"] boolValue]; - [@[self.audio, self.subtitles, self.filters, self.picture, self.video] makeObjectsPerformSelector:@selector(applyPreset:) - withObject:preset]; + [self.picture applyPreset:preset jobSettings:jobSettings]; + [self.filters applyPreset:preset jobSettings:jobSettings]; + [self.audio applyPreset:preset jobSettings:jobSettings]; + [self.subtitles applyPreset:preset jobSettings:jobSettings]; + [self.video applyPreset:preset jobSettings:jobSettings]; } - (void)writeToPreset:(HBMutablePreset *)preset @@ -290,6 +298,9 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification"; decodeObject(_audio, HBAudio); decodeObject(_subtitles, HBSubtitles); + _audio.job = self; + _video.job = self; + decodeBool(_chaptersEnabled); decodeObject(_chapterTitles, NSArray); |