MacGui: implemented the NSSecureCoding protocol in HBJob. Added a compatibility class...
authorritsuka <damiog@gmail.com>
Wed, 22 Apr 2015 16:49:30 +0000 (16:49 +0000)
committerritsuka <damiog@gmail.com>
Wed, 22 Apr 2015 16:49:30 +0000 (16:49 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7112 b64f7644-9d1e-0410-96f1-a4d463321fa5

27 files changed:
macosx/HBAudio.h
macosx/HBAudio.m
macosx/HBAudioDefaults.h
macosx/HBAudioDefaults.m
macosx/HBAudioTrack.h
macosx/HBAudioTrack.m
macosx/HBAudioTrackPreset.h
macosx/HBAudioTrackPreset.m
macosx/HBCodingUtilities.h [new file with mode: 0644]
macosx/HBCodingUtilities.m [new file with mode: 0644]
macosx/HBFilters.h
macosx/HBFilters.m
macosx/HBJob.h
macosx/HBJob.m
macosx/HBPicture.h
macosx/HBPicture.m
macosx/HBRange.h
macosx/HBRange.m
macosx/HBSubtitles.h
macosx/HBSubtitles.m
macosx/HBSubtitlesDefaults.h
macosx/HBSubtitlesDefaults.m
macosx/HBVideo.h
macosx/HBVideo.m
macosx/HandBrake.xcodeproj/project.pbxproj
macosx/HandBrake.xcodeproj/xcshareddata/xcschemes/HandBrake [DEBUG].xcscheme
macosx/NSCodingMacro.h [deleted file]

index 0c38f05c14d889b09734f760371810028430e1e0..609f0fd2a7366388048caf0a0bf7d0d7744dd2ee 100644 (file)
@@ -13,7 +13,7 @@
 
 extern NSString *HBAudioChangedNotification;
 
-@interface HBAudio : NSObject <NSCoding, NSCopying, HBPresetCoding>
+@interface HBAudio : NSObject <NSSecureCoding, NSCopying, HBPresetCoding>
 
 - (instancetype)initWithTitle:(HBTitle *)title;
 
index e45e3cf5377b84320b568f595dc572a6d089b6ba..cb3a6ff996c8ce66c2dbe27afd0397f50ad3e89b 100644 (file)
@@ -11,7 +11,7 @@
 #import "HBAudioTrackPreset.h"
 #import "HBAudioDefaults.h"
 
-#import "NSCodingMacro.h"
+#import "HBCodingUtilities.h"
 
 #include "hb.h"
 
@@ -374,6 +374,11 @@ NSString *HBAudioChangedNotification = @"HBAudioChangedNotification";
 
 #pragma mark - NSCoding
 
++ (BOOL)supportsSecureCoding
+{
+    return YES;
+}
+
 - (void)encodeWithCoder:(NSCoder *)coder
 {
     [coder encodeInt:1 forKey:@"HBAudioVersion"];
@@ -393,9 +398,9 @@ NSString *HBAudioChangedNotification = @"HBAudioChangedNotification";
 
     decodeInt(_container);
 
-    decodeObject(_noneTrack);
-    decodeObject(_masterTrackArray);
-    decodeObject(_tracks);
+    decodeObject(_noneTrack, NSDictionary);
+    decodeObject(_masterTrackArray, NSArray);
+    decodeObject(_tracks, NSMutableArray);
 
     for (HBAudioTrack *track in _tracks)
     {
@@ -403,7 +408,7 @@ NSString *HBAudioChangedNotification = @"HBAudioChangedNotification";
         track.delegate = self;
     }
 
-    decodeObject(_defaults);
+    decodeObject(_defaults, HBAudioDefaults);
 
     return self;
 }
index d3d30307d6acac98c9cc8832c43ad532efb256d4..114fee701dc59c7734e3347ff7eacf7809a2ff2b 100644 (file)
@@ -17,7 +17,7 @@ typedef NS_ENUM(NSUInteger, HBAudioTrackSelectionBehavior) {
  *  HBAudioSettings
  *  Stores the audio defaults settings.
  */
-@interface HBAudioDefaults : NSObject <NSCoding, NSCopying, HBPresetCoding>
+@interface HBAudioDefaults : NSObject <NSSecureCoding, NSCopying, HBPresetCoding>
 
 @property (nonatomic, readwrite) HBAudioTrackSelectionBehavior trackSelectionBehavior;
 @property (nonatomic, readwrite, strong) NSMutableArray *trackSelectionLanguages;
index 641520e256d404917c3cdac8a822bbf97eef757b..a5c6f100a0095ad5152828c9654a4d38de16d480 100644 (file)
@@ -6,7 +6,7 @@
 
 #import "HBAudioDefaults.h"
 #import "HBAudioTrackPreset.h"
-#import "NSCodingMacro.h"
+#import "HBCodingUtilities.h"
 #import "hb.h"
 #import "lang.h"
 
 
         copy->_allowAACPassthru = _allowAACPassthru;
         copy->_allowAC3Passthru = _allowAC3Passthru;
+        copy->_allowEAC3Passthru = _allowEAC3Passthru;
         copy->_allowDTSHDPassthru = _allowDTSHDPassthru;
         copy->_allowDTSPassthru = _allowDTSPassthru;
         copy->_allowMP3Passthru = _allowMP3Passthru;
+        copy->_allowTrueHDPassthru = _allowTrueHDPassthru;
+        copy->_allowFLACPassthru = _allowFLACPassthru;
 
         copy->_encoderFallback = _encoderFallback;
         copy->_secondaryEncoderMode = _secondaryEncoderMode;
 
 #pragma mark - NSCoding
 
++ (BOOL)supportsSecureCoding
+{
+    return YES;
+}
+
 - (void)encodeWithCoder:(NSCoder *)coder
 {
     [coder encodeInt:1 forKey:@"HBAudioDefaultsVersion"];
 
     encodeBool(_allowAACPassthru);
     encodeBool(_allowAC3Passthru);
+    encodeBool(_allowEAC3Passthru);
     encodeBool(_allowDTSHDPassthru);
     encodeBool(_allowDTSPassthru);
     encodeBool(_allowMP3Passthru);
+    encodeBool(_allowTrueHDPassthru);
+    encodeBool(_allowFLACPassthru);
 
     encodeInt(_encoderFallback);
     encodeBool(_secondaryEncoderMode);
     self = [super init];
 
     decodeInteger(_trackSelectionBehavior);
-    decodeObject(_trackSelectionLanguages);
+    decodeObject(_trackSelectionLanguages, NSMutableArray);
 
-    decodeObject(_tracksArray);
+    decodeObject(_tracksArray, NSMutableArray);
 
     decodeBool(_allowAACPassthru);
     decodeBool(_allowAC3Passthru);
+    decodeBool(_allowEAC3Passthru);
     decodeBool(_allowDTSHDPassthru);
     decodeBool(_allowDTSPassthru);
     decodeBool(_allowMP3Passthru);
+    decodeBool(_allowTrueHDPassthru);
+    decodeBool(_allowFLACPassthru);
 
     decodeInt(_encoderFallback);
     decodeBool(_secondaryEncoderMode);
index 2bad1bd054285b5bb9331fb92ca498d43f0d3dbe..76590973fe14588e75877f2dcadc68fcc43d2f04 100644 (file)
@@ -31,7 +31,7 @@ extern NSString *keyAudioMixdown;
 extern NSString *keyAudioSamplerate;
 extern NSString *keyAudioBitrate;
 
-@interface HBAudioTrack : NSObject <NSCoding, NSCopying>
+@interface HBAudioTrack : NSObject <NSSecureCoding, NSCopying>
 
 @property (nonatomic, strong) NSDictionary *track;
 @property (nonatomic, strong) NSDictionary *codec;
index d29661158281480a436e2637c8c7ef03e5e0d3fe..05f9789de60401a18f71129f60c3ca9024e2e104 100644 (file)
@@ -7,7 +7,7 @@
 #import "HBAudioTrack.h"
 #import "HBAudioController.h"
 #import "HBJob.h"
-#import "NSCodingMacro.h"
+#import "HBCodingUtilities.h"
 #import "hb.h"
 
 NSString *keyAudioTrackIndex = @"keyAudioTrackIndex";
@@ -589,6 +589,11 @@ static NSMutableArray *masterBitRateArray = nil;
 
 #pragma mark - NSCoding
 
++ (BOOL)supportsSecureCoding
+{
+    return YES;
+}
+
 - (void)encodeWithCoder:(NSCoder *)coder
 {
     [coder encodeInt:1 forKey:@"HBAudioTrackVersion"];
@@ -611,18 +616,18 @@ static NSMutableArray *masterBitRateArray = nil;
 {
     self = [super init];
 
-    decodeObject(_track);
-    decodeObject(_codec);
-    decodeObject(_mixdown);
-    decodeObject(_sampleRate);
-    decodeObject(_bitRate);
-    decodeObject(_drc);
-    decodeObject(_gain);
-    decodeObject(_videoContainerTag);
-
-    decodeObject(_codecs);
-    decodeObject(_mixdowns);
-    decodeObject(_bitRates);
+    decodeObject(_track, NSDictionary);
+    decodeObject(_codec, NSDictionary);
+    decodeObject(_mixdown, NSDictionary);
+    decodeObject(_sampleRate, NSDictionary);
+    decodeObject(_bitRate, NSDictionary);
+    decodeObject(_drc, NSNumber);
+    decodeObject(_gain, NSNumber);
+    decodeObject(_videoContainerTag, NSNumber);
+
+    decodeObject(_codecs, NSMutableArray);
+    decodeObject(_mixdowns, NSMutableArray);
+    decodeObject(_bitRates, NSArray);
 
     return self;
 }
index 61b7390797546d161803151c1bc3555d89131167..3ca97d97e4dc949da324e5effc667a9d9b245043 100644 (file)
@@ -11,7 +11,7 @@
  *  a KVO enabled class used in the Audio Defaults panels,
  *  automatically validates the values.
  */
-@interface HBAudioTrackPreset : NSObject <NSCoding, NSCopying>
+@interface HBAudioTrackPreset : NSObject <NSSecureCoding, NSCopying>
 
 - (instancetype)initWithContainer:(int)container;
 - (void)containerChanged:(int)container;
index f7f7f94bf872008d2a39fdae2aef9473f67c3e8b..2e479f4fc211f652a78c252e24f9a06981130919 100644 (file)
@@ -5,7 +5,7 @@
  It may be used under the terms of the GNU General Public License. */
 
 #import "HBAudioTrackPreset.h"
-#import "NSCodingMacro.h"
+#import "HBCodingUtilities.h"
 #include "hb.h"
 
 #define DEFAULT_SAMPLERATE 48000
@@ -262,6 +262,11 @@ static void *HBAudioEncoderContex = &HBAudioEncoderContex;
 
 #pragma mark - NSCoding
 
++ (BOOL)supportsSecureCoding
+{
+    return YES;
+}
+
 - (void)encodeWithCoder:(NSCoder *)coder
 {
     [coder encodeInt:1 forKey:@"HBAudioTrackPresetVersion"];
diff --git a/macosx/HBCodingUtilities.h b/macosx/HBCodingUtilities.h
new file mode 100644 (file)
index 0000000..fd82597
--- /dev/null
@@ -0,0 +1,42 @@
+/*  HBCodingUtilities.h $
+
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr/>.
+ It may be used under the terms of the GNU General Public License. */
+
+#import <Foundation/Foundation.h>
+
+#define OBJC_STRINGIFY(x) @#x
+#define encodeInt(x) [coder encodeInt:x forKey:OBJC_STRINGIFY(x)]
+#define encodeInteger(x) [coder encodeInteger:x forKey:OBJC_STRINGIFY(x)]
+#define encodeBool(x) [coder encodeBool:x forKey:OBJC_STRINGIFY(x)]
+#define encodeDouble(x) [coder encodeDouble:x forKey:OBJC_STRINGIFY(x)]
+#define encodeObject(x) [coder encodeObject:x forKey:OBJC_STRINGIFY(x)]
+
+#define decodeInt(x) x = [decoder decodeIntForKey:OBJC_STRINGIFY(x)]
+#define decodeInteger(x) x = [decoder decodeIntegerForKey:OBJC_STRINGIFY(x)]
+#define decodeBool(x) x = [decoder decodeBoolForKey:OBJC_STRINGIFY(x)]
+#define decodeDouble(x) x = [decoder decodeDoubleForKey:OBJC_STRINGIFY(x)]
+#define decodeObject(x, cl) x = [HBCodingUtilities decodeObjectOfClass:[cl class] forKey:OBJC_STRINGIFY(x) decoder:decoder];
+
+#define decodeObjectOrFail(x, class) x = [HBCodingUtilities decodeObjectOfClass:class forKey:OBJC_STRINGIFY(x) decoder:decoder]; if (x == nil) {NSLog(@"Failed to decode: %@", OBJC_STRINGIFY(x)); goto fail;}
+
+@interface HBCodingUtilities : NSObject
+
+/**
+ *  Specify what the expected class of the allocated object is. If the coder responds YES to -requiresSecureCoding,
+ *  then an exception will be thrown if the class to be decoded does not implement NSSecureCoding or is not isKindOfClass: of the argument.
+ *  If the coder responds NO to -requiresSecureCoding, then the class argument is ignored
+ *  and no check of the class of the decoded object is performed, exactly as if decodeObjectForKey: had been called.
+ *
+ *  if NSSecureCoding is not available on the system it check the class after loading the object.
+ *
+ *  @param aClass  The expect class type.
+ *  @param key     The coder key.
+ *  @param decoder The NSCoder.
+ *
+ *  @return the decoder object.
+ */
++ (id)decodeObjectOfClass:(Class)aClass forKey:(NSString *)key decoder:(NSCoder *)decoder;
+
+@end
diff --git a/macosx/HBCodingUtilities.m b/macosx/HBCodingUtilities.m
new file mode 100644 (file)
index 0000000..8cf7e02
--- /dev/null
@@ -0,0 +1,43 @@
+//
+//  HBCodingUtilities.m
+//  HandBrake
+//
+//  Created by Damiano Galassi on 22/04/15.
+//
+//
+
+#import "HBCodingUtilities.h"
+
+static BOOL useSecureCoding;
+
+@implementation HBCodingUtilities
+
++ (void)initialize
+{
+    static BOOL initialized = NO;
+    if(!initialized && self == [HBCodingUtilities class]) {
+        useSecureCoding = NSProtocolFromString(@"NSSecureCoding") ? YES : NO;
+    }
+}
+
++ (id)decodeObjectOfClass:(Class)aClass forKey:(NSString *)key decoder:(NSCoder *)decoder
+{
+    if (useSecureCoding)
+    {
+        return [decoder decodeObjectOfClass:aClass forKey:key];
+    }
+    else
+    {
+        id obj = [decoder decodeObjectForKey:key];
+        if (![obj isKindOfClass:aClass])
+        {
+            return nil;
+        }
+        else
+        {
+            return obj;
+        }
+    }
+}
+
+@end
index e64808a78623fd42c01e4ee4134e39deea82da5f..90876877d9ecb8204ad4b5bc13e6d8e88ff631a1 100644 (file)
@@ -12,7 +12,7 @@ extern NSString * const HBFiltersChangedNotification;
 /**
  *  Filters settings.
  */
-@interface HBFilters : NSObject <NSCoding, NSCopying, HBPresetCoding>
+@interface HBFilters : NSObject <NSSecureCoding, NSCopying, HBPresetCoding>
 
 @property (nonatomic, readwrite) NSInteger detelecine;
 @property (nonatomic, readwrite, copy) NSString *detelecineCustomString;
index c473995241979e4ea7e7cebe0bde7508c84430e2..77d11defcba1cb07378e62b3563689a2742df1dd 100644 (file)
@@ -5,7 +5,7 @@
  It may be used under the terms of the GNU General Public License. */
 
 #import "HBFilters.h"
-#import "NSCodingMacro.h"
+#import "HBCodingUtilities.h"
 #include "hb.h"
 
 NSString * const HBFiltersChangedNotification = @"HBFiltersChangedNotification";
@@ -229,6 +229,11 @@ NSString * const HBFiltersChangedNotification = @"HBFiltersChangedNotification";
 
 #pragma mark - NSCoding
 
++ (BOOL)supportsSecureCoding
+{
+    return YES;
+}
+
 - (void)encodeWithCoder:(NSCoder *)coder
 {
     [coder encodeInt:1 forKey:@"HBFiltersVersion"];
@@ -258,18 +263,18 @@ NSString * const HBFiltersChangedNotification = @"HBFiltersChangedNotification";
     self = [super init];
 
     decodeInteger(_detelecine);
-    decodeObject(_detelecineCustomString);
+    decodeObject(_detelecineCustomString, NSString);
 
     decodeInteger(_deinterlace);
-    decodeObject(_deinterlaceCustomString);
+    decodeObject(_deinterlaceCustomString, NSString);
 
     decodeInteger(_decomb);
-    decodeObject(_decombCustomString);
+    decodeObject(_decombCustomString, NSString);
 
-    decodeObject(_denoise);
-    decodeObject(_denoisePreset);
-    decodeObject(_denoiseTune);
-    decodeObject(_denoiseCustomString);
+    decodeObject(_denoise, NSString);
+    decodeObject(_denoisePreset, NSString);
+    decodeObject(_denoiseTune, NSString);
+    decodeObject(_denoiseCustomString, NSString);
 
     decodeInteger(_deblock);
     decodeBool(_grayscale);
index 673592ee1e84282d259a72762753c0fa7fafa8b6..43b60e553933002689f930f551237a272ef857c4 100644 (file)
@@ -35,7 +35,7 @@ typedef NS_ENUM(NSUInteger, HBJobState){
 /**
  * HBJob
  */
-@interface HBJob : NSObject <NSCoding, NSCopying, HBUniqueObject>
+@interface HBJob : NSObject <NSSecureCoding, NSCopying, HBUniqueObject>
 
 - (instancetype)initWithTitle:(HBTitle *)title andPreset:(HBPreset *)preset;
 
index 1607cca8edfa4b9f85a4f56beb4b6e9b59e64c5f..25ee5c130bc318d1d260625f916b00fb05e0256a 100644 (file)
@@ -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
index 6bd281eaafd6e2240c9158a2273f49a5f12e5537..9cace8fd9def6a3f3fc3ad66d48ba22e33fd5386 100644 (file)
@@ -14,7 +14,7 @@ extern NSString * const HBPictureChangedNotification;
 /**
  * HBPicture
  */
-@interface HBPicture : NSObject <NSCoding, NSCopying, HBPresetCoding>
+@interface HBPicture : NSObject <NSSecureCoding, NSCopying, HBPresetCoding>
 
 - (instancetype)initWithTitle:(HBTitle *)title;
 
index cf3ebfb50d84d6dbd9a7240e35aa01ae27549593..8c83d91fc108d46355219495fbd33a5c78406ec7 100644 (file)
@@ -7,7 +7,7 @@
 #import "HBPicture.h"
 #import "HBTitle.h"
 
-#import "NSCodingMacro.h"
+#import "HBCodingUtilities.h"
 
 #include "hb.h"
 
@@ -481,6 +481,11 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification";
 
 #pragma mark - NSCoding
 
++ (BOOL)supportsSecureCoding
+{
+    return YES;
+}
+
 - (void)encodeWithCoder:(NSCoder *)coder
 {
     [coder encodeInt:1 forKey:@"HBPictureVersion"];
index ac09856616768a897680798513b8d2810fc5ea4b..203b6b24c6a2617a308cc95397129d1f67514f45 100644 (file)
@@ -17,7 +17,7 @@ typedef NS_ENUM(NSUInteger, HBRangeType) {
     HBRangePreviewIndex,
 };
 
-@interface HBRange : NSObject <NSCoding, NSCopying>
+@interface HBRange : NSObject <NSSecureCoding, NSCopying>
 
 - (instancetype)initWithTitle:(HBTitle *)title;
 
index 44f5f36cd2afa4880a0262cb3f681237f07da687..b49d5b44758a867b0fcc2d1c1125e7b53beb946b 100644 (file)
@@ -6,7 +6,7 @@
 
 #import "HBRange.h"
 #import "HBTitle.h"
-#import "NSCodingMacro.h"
+#import "HBCodingUtilities.h"
 
 NSString *HBRangeChangedNotification = @"HBRangeChangedNotification";
 
@@ -143,6 +143,11 @@ NSString *HBRangeChangedNotification = @"HBRangeChangedNotification";
 
 #pragma mark - NSCoding
 
++ (BOOL)supportsSecureCoding
+{
+    return YES;
+}
+
 - (void)encodeWithCoder:(NSCoder *)coder
 {
     [coder encodeInt:1 forKey:@"HBRangeVersion"];
index 9b8c8431351a35c5d5587322046ed17907e00235..3e8819e2be99ddb0d3d729132318678c276a31ab 100644 (file)
@@ -27,7 +27,7 @@ extern NSString *keySubTrackLanguageIndex;
 @class HBTitle;
 @class HBSubtitlesDefaults;
 
-@interface HBSubtitles : NSObject <NSCoding, NSCopying, HBPresetCoding>
+@interface HBSubtitles : NSObject <NSSecureCoding, NSCopying, HBPresetCoding>
 
 - (instancetype)initWithTitle:(HBTitle *)title;
 
index 740e16bcb39939cc1db38edfe501f29ffbb93dcf..e03292620cb13514296069ebb28fca6b171584fa 100644 (file)
@@ -10,7 +10,7 @@
 #import "HBSubtitlesDefaults.h"
 
 #import "HBTitle.h"
-#import "NSCodingMacro.h"
+#import "HBCodingUtilities.h"
 #include "lang.h"
 
 NSString *keySubTrackSelectionIndex = @"keySubTrackSelectionIndex";
@@ -484,6 +484,11 @@ NSString *keySubTrackLanguageIndex = @"keySubTrackLanguageIndex";
 
 #pragma mark - NSCoding
 
++ (BOOL)supportsSecureCoding
+{
+    return YES;
+}
+
 - (void)encodeWithCoder:(NSCoder *)coder
 {
     [coder encodeInt:1 forKey:@"HBAudioVersion"];
@@ -503,11 +508,11 @@ NSString *keySubTrackLanguageIndex = @"keySubTrackLanguageIndex";
 
     decodeInt(_container);
 
-    decodeObject(_masterTrackArray);
-    decodeObject(_foreignAudioSearchTrackName);
-    decodeObject(_tracks);
+    decodeObject(_masterTrackArray, NSMutableArray);
+    decodeObject(_foreignAudioSearchTrackName, NSString);
+    decodeObject(_tracks, NSMutableArray);
 
-    decodeObject(_defaults);
+    decodeObject(_defaults, HBSubtitlesDefaults);
 
     return self;
 }
index 60127b437ae5093c4d3e7366c3cdaeeb5a8aa55c..273086d6eb86e7afb871f7d7a1e54b2e02155f17 100644 (file)
@@ -20,7 +20,7 @@ typedef NS_ENUM(NSUInteger, HBSubtitleTrackBurnInBehavior) {
     HBSubtitleTrackBurnInBehaviorForeignAudioThenFirst,
 };
 
-@interface HBSubtitlesDefaults : NSObject <NSCoding, NSCopying, HBPresetCoding>
+@interface HBSubtitlesDefaults : NSObject <NSSecureCoding, NSCopying, HBPresetCoding>
 
 @property (nonatomic, readwrite) HBSubtitleTrackSelectionBehavior trackSelectionBehavior;
 @property (nonatomic, readwrite, strong) NSMutableArray *trackSelectionLanguages;
index 8344175721ad931f9256a690c276cd4e999dc95a..be607e95aeb57b6694748379c22eef11eb94f5d1 100644 (file)
@@ -5,7 +5,7 @@
  It may be used under the terms of the GNU General Public License. */
 
 #import "HBSubtitlesDefaults.h"
-#import "NSCodingMacro.h"
+#import "HBCodingUtilities.h"
 
 @implementation HBSubtitlesDefaults
 
 
 #pragma mark - NSCoding
 
++ (BOOL)supportsSecureCoding
+{
+    return YES;
+}
+
 - (void)encodeWithCoder:(NSCoder *)coder
 {
     [coder encodeInt:1 forKey:@"HBSubtitlesDefaultsVersion"];
     self = [super init];
 
     decodeInteger(_trackSelectionBehavior);
-    decodeObject(_trackSelectionLanguages);
+    decodeObject(_trackSelectionLanguages, NSMutableArray);
 
     decodeBool(_addForeignAudioSearch);
     decodeBool(_addForeignAudioSubtitle);
index 04aa1aa3684113bcf306fa536890df6b92e6f4e8..2b564d9bea0e1e46876f70828196549619d9f372 100644 (file)
@@ -14,7 +14,7 @@ extern NSString * const HBVideoChangedNotification;
 /**
  *  HBVideo
  */
-@interface HBVideo : NSObject <NSCoding, NSCopying, HBPresetCoding>
+@interface HBVideo : NSObject <NSSecureCoding, NSCopying, HBPresetCoding>
 
 - (instancetype)initWithJob:(HBJob *)job;
 
index e7e9b9798dbb01679a5d83ca0e23ebeffc5a74ad..48cd9f4a310460c07aa0a43eb4671b20bd4380ef 100644 (file)
@@ -6,7 +6,7 @@
 
 #import "HBVideo.h"
 #import "HBJob.h"
-#import "NSCodingMacro.h"
+#import "HBCodingUtilities.h"
 #include "hb.h"
 
 NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification";
@@ -391,6 +391,11 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification";
 
 #pragma mark - NSCoding
 
++ (BOOL)supportsSecureCoding
+{
+    return YES;
+}
+
 - (void)encodeWithCoder:(NSCoder *)coder
 {
     [coder encodeInt:1 forKey:@"HBVideoVersion"];
@@ -441,12 +446,12 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification";
     decodeBool(_turboTwoPass);
 
     decodeBool(_advancedOptions);
-    decodeObject(_preset);
-    decodeObject(_tune);
-    decodeObject(_profile);
-    decodeObject(_level);
+    decodeObject(_preset, NSString);
+    decodeObject(_tune, NSString);
+    decodeObject(_profile, NSString);
+    decodeObject(_level, NSString);
 
-    decodeObject(_videoOptionExtra);
+    decodeObject(_videoOptionExtra, NSString);
 
     decodeBool(_fastDecode);
 
index f5e289e2f102f95fd58879c645772f07cc200496..93782a5c33b864208eae51626eeff729268dce7c 100644 (file)
                6F0D69A91AD0683100A39DCA /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 273F204014ADBC210021BE6D /* Foundation.framework */; };
                A90A0CAF1988D57200DA65CE /* HBAudioTrackPreset.m in Sources */ = {isa = PBXBuildFile; fileRef = A90A0CAE1988D57200DA65CE /* HBAudioTrackPreset.m */; };
                A91017B41A64440A00039BFB /* HBSubtitles.m in Sources */ = {isa = PBXBuildFile; fileRef = A91017B31A64440A00039BFB /* HBSubtitles.m */; };
+               A9160A351AE7A165009A7818 /* HBCodingUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = A9160A341AE7A165009A7818 /* HBCodingUtilities.m */; };
                A91726E7197291BC00D1AFEF /* HBChapterTitlesController.m in Sources */ = {isa = PBXBuildFile; fileRef = A91726E6197291BC00D1AFEF /* HBChapterTitlesController.m */; };
                A91806711A4807B000FC9BED /* HBRange.m in Sources */ = {isa = PBXBuildFile; fileRef = A91806701A4807B000FC9BED /* HBRange.m */; };
                A91AFD0C1A948827009BECED /* HBOutputFileWriter.m in Sources */ = {isa = PBXBuildFile; fileRef = A91AFD0B1A948827009BECED /* HBOutputFileWriter.m */; };
                A90A0CAE1988D57200DA65CE /* HBAudioTrackPreset.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBAudioTrackPreset.m; sourceTree = "<group>"; };
                A91017B21A64440A00039BFB /* HBSubtitles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBSubtitles.h; sourceTree = "<group>"; };
                A91017B31A64440A00039BFB /* HBSubtitles.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBSubtitles.m; sourceTree = "<group>"; };
+               A9160A331AE7A165009A7818 /* HBCodingUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBCodingUtilities.h; sourceTree = "<group>"; };
+               A9160A341AE7A165009A7818 /* HBCodingUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBCodingUtilities.m; sourceTree = "<group>"; };
                A91726E5197291BC00D1AFEF /* HBChapterTitlesController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBChapterTitlesController.h; sourceTree = "<group>"; };
                A91726E6197291BC00D1AFEF /* HBChapterTitlesController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBChapterTitlesController.m; sourceTree = "<group>"; };
                A918066F1A4807B000FC9BED /* HBRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBRange.h; sourceTree = "<group>"; };
                A990D9061A64562200139032 /* HBJob+HBJobConversion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "HBJob+HBJobConversion.m"; sourceTree = "<group>"; };
                A9935212196F38A70069C6B7 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = ChaptersTitles.xib; sourceTree = "<group>"; };
                A997D8EB1A4ABB0900E19B6F /* HBPresetCoding.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HBPresetCoding.h; sourceTree = "<group>"; };
-               A9A2A77F1A4737DD006C219C /* NSCodingMacro.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSCodingMacro.h; sourceTree = "<group>"; };
                A9AA44781970664A00D7DEFC /* HBUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBUtilities.h; sourceTree = "<group>"; };
                A9AA44791970664A00D7DEFC /* HBUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBUtilities.m; sourceTree = "<group>"; };
                A9AA447B1970724D00D7DEFC /* HBAdvancedController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HBAdvancedController.h; sourceTree = "<group>"; };
                                A9537BED1A48A7F900141102 /* UI Bindings Additions */,
                                273F209714ADBE670021BE6D /* HBDVDDetector.h */,
                                273F209814ADBE670021BE6D /* HBDVDDetector.m */,
-                               A9A2A77F1A4737DD006C219C /* NSCodingMacro.h */,
+                               A9160A331AE7A165009A7818 /* HBCodingUtilities.h */,
+                               A9160A341AE7A165009A7818 /* HBCodingUtilities.m */,
                                A997D8EB1A4ABB0900E19B6F /* HBPresetCoding.h */,
                        );
                        name = Core;
                        files = (
                                A9F7102619A475EC00F61301 /* HBDockTile.m in Sources */,
                                A98C29C41977B10600AF5DED /* HBLanguagesSelection.m in Sources */,
+                               A9160A351AE7A165009A7818 /* HBCodingUtilities.m in Sources */,
                                A9BB0F2719A0ECE40079F1C1 /* HBHUDButtonCell.m in Sources */,
                                A932E273198834130047D13E /* HBAudioDefaults.m in Sources */,
                                A9706CB71AC1437800BAEAA8 /* HBExceptionAlertController.m in Sources */,
index 04c6afb70ca1b8166a45dd8e9bb518be12453c2a..01e1b2cb736459c41c38aa3e5612f5ff5152f922 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
    LastUpgradeVersion = "0630"
-   version = "1.8">
+   version = "1.3">
    <BuildAction
       parallelizeBuildables = "YES"
       buildImplicitDependencies = "YES">
       ignoresPersistentStateOnLaunch = "NO"
       debugDocumentVersioning = "YES"
       allowLocationSimulation = "YES">
-      <BuildableProductRunnable>
+      <BuildableProductRunnable
+         runnableDebuggingMode = "0">
          <BuildableReference
             BuildableIdentifier = "primary"
-            BlueprintIdentifier = "273F1FFE14ADAE950021BE6D"
-            BuildableName = "HandBrakeCLI"
-            BlueprintName = "HandBrakeCLI"
+            BlueprintIdentifier = "273F203814ADBC200021BE6D"
+            BuildableName = "HandBrake.app"
+            BlueprintName = "HandBrake"
             ReferencedContainer = "container:HandBrake.xcodeproj">
          </BuildableReference>
       </BuildableProductRunnable>
diff --git a/macosx/NSCodingMacro.h b/macosx/NSCodingMacro.h
deleted file mode 100644 (file)
index 7cfbfc7..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*  NSCodingMacro.h $
-
- This file is part of the HandBrake source code.
- Homepage: <http://handbrake.fr/>.
- It may be used under the terms of the GNU General Public License. */
-
-#ifndef HandBrake_NSCodingMacro_h
-#define HandBrake_NSCodingMacro_h
-
-#define OBJC_STRINGIFY(x) @#x
-#define encodeInt(x) [coder encodeInt:x forKey:OBJC_STRINGIFY(x)]
-#define encodeInteger(x) [coder encodeInteger:x forKey:OBJC_STRINGIFY(x)]
-#define encodeBool(x) [coder encodeBool:x forKey:OBJC_STRINGIFY(x)]
-#define encodeDouble(x) [coder encodeDouble:x forKey:OBJC_STRINGIFY(x)]
-#define encodeObject(x) [coder encodeObject:x forKey:OBJC_STRINGIFY(x)]
-
-#define decodeInt(x) x = [decoder decodeIntForKey:OBJC_STRINGIFY(x)]
-#define decodeInteger(x) x = [decoder decodeIntegerForKey:OBJC_STRINGIFY(x)]
-#define decodeBool(x) x = [decoder decodeBoolForKey:OBJC_STRINGIFY(x)]
-#define decodeDouble(x) x = [decoder decodeDoubleForKey:OBJC_STRINGIFY(x)]
-#define decodeObject(x) x = [decoder decodeObjectForKey:OBJC_STRINGIFY(x)]
-
-#endif