summaryrefslogtreecommitdiffstats
path: root/macosx/HBJob.m
diff options
context:
space:
mode:
authorritsuka <[email protected]>2015-04-22 16:49:30 +0000
committerritsuka <[email protected]>2015-04-22 16:49:30 +0000
commit1e990c1a5441c64ce2b985e019a814deecf74843 (patch)
tree7ed44d3ebff43d4a052bc9646fc5a06636e85347 /macosx/HBJob.m
parent992a1ab264904b96ab5b396e5fd505a272589196 (diff)
MacGui: implemented the NSSecureCoding protocol in HBJob. Added a compatibility class to fall back on NSCoding on 10.7 and earlier.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7112 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/HBJob.m')
-rw-r--r--macosx/HBJob.m56
1 files changed, 33 insertions, 23 deletions
diff --git a/macosx/HBJob.m b/macosx/HBJob.m
index 1607cca8e..25ee5c130 100644
--- a/macosx/HBJob.m
+++ b/macosx/HBJob.m
@@ -10,7 +10,7 @@
#import "HBAudioDefaults.h"
#import "HBSubtitlesDefaults.h"
-#import "NSCodingMacro.h"
+#import "HBCodingUtilities.h"
#include "hb.h"
@@ -184,6 +184,11 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification";
#pragma mark - NSCoding
++ (BOOL)supportsSecureCoding
+{
+ return YES;
+}
+
- (void)encodeWithCoder:(NSCoder *)coder
{
[coder encodeInt:1 forKey:@"HBVideoVersion"];
@@ -216,36 +221,41 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification";
- (instancetype)initWithCoder:(NSCoder *)decoder
{
- self = [super init];
+ int version = [decoder decodeIntForKey:@"HBVideoVersion"];
- decodeInt(_state);
- decodeObject(_name);
- decodeObject(_presetName);
- decodeInt(_titleIdx);
- decodeObject(_uuid);
+ if (version == 1 && (self = [super init]))
+ {
+ decodeInt(_state);
+ decodeObject(_name, NSString);
+ decodeObject(_presetName, NSString);
+ decodeInt(_titleIdx);
+ decodeObject(_uuid, NSString);
- decodeObject(_fileURL);
- decodeObject(_destURL);
+ decodeObject(_fileURL, NSURL);
+ decodeObject(_destURL, NSURL);
- decodeInt(_container);
- decodeInt(_angle);
- decodeBool(_mp4HttpOptimize);
- decodeBool(_mp4iPodCompatible);
+ decodeInt(_container);
+ decodeInt(_angle);
+ decodeBool(_mp4HttpOptimize);
+ decodeBool(_mp4iPodCompatible);
- decodeObject(_range);
- decodeObject(_video);
- decodeObject(_picture);
- decodeObject(_filters);
+ decodeObject(_range, HBRange);
+ decodeObject(_video, HBVideo);
+ decodeObject(_picture, HBPicture);
+ decodeObject(_filters, HBFilters);
- _video.job = self;
+ _video.job = self;
- decodeObject(_audio);
- decodeObject(_subtitles);
+ decodeObject(_audio, HBAudio);
+ decodeObject(_subtitles, HBSubtitles);
- decodeBool(_chaptersEnabled);
- decodeObject(_chapterTitles);
+ decodeBool(_chaptersEnabled);
+ decodeObject(_chapterTitles, NSMutableArray);
- return self;
+ return self;
+ }
+
+ return nil;
}
@end