diff options
-rw-r--r-- | macosx/HBAudio.h | 2 | ||||
-rw-r--r-- | macosx/HBAudio.m | 15 | ||||
-rw-r--r-- | macosx/HBAudioDefaults.h | 2 | ||||
-rw-r--r-- | macosx/HBAudioDefaults.m | 20 | ||||
-rw-r--r-- | macosx/HBAudioTrack.h | 2 | ||||
-rw-r--r-- | macosx/HBAudioTrack.m | 31 | ||||
-rw-r--r-- | macosx/HBAudioTrackPreset.h | 2 | ||||
-rw-r--r-- | macosx/HBAudioTrackPreset.m | 7 | ||||
-rw-r--r-- | macosx/HBCodingUtilities.h | 42 | ||||
-rw-r--r-- | macosx/HBCodingUtilities.m | 43 | ||||
-rw-r--r-- | macosx/HBFilters.h | 2 | ||||
-rw-r--r-- | macosx/HBFilters.m | 21 | ||||
-rw-r--r-- | macosx/HBJob.h | 2 | ||||
-rw-r--r-- | macosx/HBJob.m | 56 | ||||
-rw-r--r-- | macosx/HBPicture.h | 2 | ||||
-rw-r--r-- | macosx/HBPicture.m | 7 | ||||
-rw-r--r-- | macosx/HBRange.h | 2 | ||||
-rw-r--r-- | macosx/HBRange.m | 7 | ||||
-rw-r--r-- | macosx/HBSubtitles.h | 2 | ||||
-rw-r--r-- | macosx/HBSubtitles.m | 15 | ||||
-rw-r--r-- | macosx/HBSubtitlesDefaults.h | 2 | ||||
-rw-r--r-- | macosx/HBSubtitlesDefaults.m | 9 | ||||
-rw-r--r-- | macosx/HBVideo.h | 2 | ||||
-rw-r--r-- | macosx/HBVideo.m | 17 | ||||
-rw-r--r-- | macosx/HandBrake.xcodeproj/project.pbxproj | 8 | ||||
-rw-r--r-- | macosx/HandBrake.xcodeproj/xcshareddata/xcschemes/HandBrake [DEBUG].xcscheme | 11 | ||||
-rw-r--r-- | macosx/NSCodingMacro.h | 23 |
27 files changed, 245 insertions, 109 deletions
diff --git a/macosx/HBAudio.h b/macosx/HBAudio.h index 0c38f05c1..609f0fd2a 100644 --- a/macosx/HBAudio.h +++ b/macosx/HBAudio.h @@ -13,7 +13,7 @@ extern NSString *HBAudioChangedNotification; -@interface HBAudio : NSObject <NSCoding, NSCopying, HBPresetCoding> +@interface HBAudio : NSObject <NSSecureCoding, NSCopying, HBPresetCoding> - (instancetype)initWithTitle:(HBTitle *)title; diff --git a/macosx/HBAudio.m b/macosx/HBAudio.m index e45e3cf53..cb3a6ff99 100644 --- a/macosx/HBAudio.m +++ b/macosx/HBAudio.m @@ -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; } diff --git a/macosx/HBAudioDefaults.h b/macosx/HBAudioDefaults.h index d3d30307d..114fee701 100644 --- a/macosx/HBAudioDefaults.h +++ b/macosx/HBAudioDefaults.h @@ -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; diff --git a/macosx/HBAudioDefaults.m b/macosx/HBAudioDefaults.m index 641520e25..a5c6f100a 100644 --- a/macosx/HBAudioDefaults.m +++ b/macosx/HBAudioDefaults.m @@ -6,7 +6,7 @@ #import "HBAudioDefaults.h" #import "HBAudioTrackPreset.h" -#import "NSCodingMacro.h" +#import "HBCodingUtilities.h" #import "hb.h" #import "lang.h" @@ -259,9 +259,12 @@ 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; @@ -272,6 +275,11 @@ #pragma mark - NSCoding ++ (BOOL)supportsSecureCoding +{ + return YES; +} + - (void)encodeWithCoder:(NSCoder *)coder { [coder encodeInt:1 forKey:@"HBAudioDefaultsVersion"]; @@ -283,9 +291,12 @@ encodeBool(_allowAACPassthru); encodeBool(_allowAC3Passthru); + encodeBool(_allowEAC3Passthru); encodeBool(_allowDTSHDPassthru); encodeBool(_allowDTSPassthru); encodeBool(_allowMP3Passthru); + encodeBool(_allowTrueHDPassthru); + encodeBool(_allowFLACPassthru); encodeInt(_encoderFallback); encodeBool(_secondaryEncoderMode); @@ -296,15 +307,18 @@ 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); diff --git a/macosx/HBAudioTrack.h b/macosx/HBAudioTrack.h index 2bad1bd05..76590973f 100644 --- a/macosx/HBAudioTrack.h +++ b/macosx/HBAudioTrack.h @@ -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; diff --git a/macosx/HBAudioTrack.m b/macosx/HBAudioTrack.m index d29661158..05f9789de 100644 --- a/macosx/HBAudioTrack.m +++ b/macosx/HBAudioTrack.m @@ -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; } diff --git a/macosx/HBAudioTrackPreset.h b/macosx/HBAudioTrackPreset.h index 61b739079..3ca97d97e 100644 --- a/macosx/HBAudioTrackPreset.h +++ b/macosx/HBAudioTrackPreset.h @@ -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; diff --git a/macosx/HBAudioTrackPreset.m b/macosx/HBAudioTrackPreset.m index f7f7f94bf..2e479f4fc 100644 --- a/macosx/HBAudioTrackPreset.m +++ b/macosx/HBAudioTrackPreset.m @@ -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 index 000000000..fd825971d --- /dev/null +++ b/macosx/HBCodingUtilities.h @@ -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 index 000000000..8cf7e02bd --- /dev/null +++ b/macosx/HBCodingUtilities.m @@ -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 diff --git a/macosx/HBFilters.h b/macosx/HBFilters.h index e64808a78..90876877d 100644 --- a/macosx/HBFilters.h +++ b/macosx/HBFilters.h @@ -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; diff --git a/macosx/HBFilters.m b/macosx/HBFilters.m index c47399524..77d11defc 100644 --- a/macosx/HBFilters.m +++ b/macosx/HBFilters.m @@ -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); diff --git a/macosx/HBJob.h b/macosx/HBJob.h index 673592ee1..43b60e553 100644 --- a/macosx/HBJob.h +++ b/macosx/HBJob.h @@ -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; 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 diff --git a/macosx/HBPicture.h b/macosx/HBPicture.h index 6bd281eaa..9cace8fd9 100644 --- a/macosx/HBPicture.h +++ b/macosx/HBPicture.h @@ -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; diff --git a/macosx/HBPicture.m b/macosx/HBPicture.m index cf3ebfb50..8c83d91fc 100644 --- a/macosx/HBPicture.m +++ b/macosx/HBPicture.m @@ -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"]; diff --git a/macosx/HBRange.h b/macosx/HBRange.h index ac0985661..203b6b24c 100644 --- a/macosx/HBRange.h +++ b/macosx/HBRange.h @@ -17,7 +17,7 @@ typedef NS_ENUM(NSUInteger, HBRangeType) { HBRangePreviewIndex, }; -@interface HBRange : NSObject <NSCoding, NSCopying> +@interface HBRange : NSObject <NSSecureCoding, NSCopying> - (instancetype)initWithTitle:(HBTitle *)title; diff --git a/macosx/HBRange.m b/macosx/HBRange.m index 44f5f36cd..b49d5b447 100644 --- a/macosx/HBRange.m +++ b/macosx/HBRange.m @@ -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"]; diff --git a/macosx/HBSubtitles.h b/macosx/HBSubtitles.h index 9b8c84313..3e8819e2b 100644 --- a/macosx/HBSubtitles.h +++ b/macosx/HBSubtitles.h @@ -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; diff --git a/macosx/HBSubtitles.m b/macosx/HBSubtitles.m index 740e16bcb..e03292620 100644 --- a/macosx/HBSubtitles.m +++ b/macosx/HBSubtitles.m @@ -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; } diff --git a/macosx/HBSubtitlesDefaults.h b/macosx/HBSubtitlesDefaults.h index 60127b437..273086d6e 100644 --- a/macosx/HBSubtitlesDefaults.h +++ b/macosx/HBSubtitlesDefaults.h @@ -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; diff --git a/macosx/HBSubtitlesDefaults.m b/macosx/HBSubtitlesDefaults.m index 834417572..be607e95a 100644 --- a/macosx/HBSubtitlesDefaults.m +++ b/macosx/HBSubtitlesDefaults.m @@ -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 @@ -127,6 +127,11 @@ #pragma mark - NSCoding ++ (BOOL)supportsSecureCoding +{ + return YES; +} + - (void)encodeWithCoder:(NSCoder *)coder { [coder encodeInt:1 forKey:@"HBSubtitlesDefaultsVersion"]; @@ -148,7 +153,7 @@ self = [super init]; decodeInteger(_trackSelectionBehavior); - decodeObject(_trackSelectionLanguages); + decodeObject(_trackSelectionLanguages, NSMutableArray); decodeBool(_addForeignAudioSearch); decodeBool(_addForeignAudioSubtitle); diff --git a/macosx/HBVideo.h b/macosx/HBVideo.h index 04aa1aa36..2b564d9be 100644 --- a/macosx/HBVideo.h +++ b/macosx/HBVideo.h @@ -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; diff --git a/macosx/HBVideo.m b/macosx/HBVideo.m index e7e9b9798..48cd9f4a3 100644 --- a/macosx/HBVideo.m +++ b/macosx/HBVideo.m @@ -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); diff --git a/macosx/HandBrake.xcodeproj/project.pbxproj b/macosx/HandBrake.xcodeproj/project.pbxproj index f5e289e2f..93782a5c3 100644 --- a/macosx/HandBrake.xcodeproj/project.pbxproj +++ b/macosx/HandBrake.xcodeproj/project.pbxproj @@ -113,6 +113,7 @@ 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 */; }; @@ -369,6 +370,8 @@ 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>"; }; @@ -436,7 +439,6 @@ 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>"; }; @@ -967,7 +969,8 @@ A9537BED1A48A7F900141102 /* UI Bindings Additions */, 273F209714ADBE670021BE6D /* HBDVDDetector.h */, 273F209814ADBE670021BE6D /* HBDVDDetector.m */, - A9A2A77F1A4737DD006C219C /* NSCodingMacro.h */, + A9160A331AE7A165009A7818 /* HBCodingUtilities.h */, + A9160A341AE7A165009A7818 /* HBCodingUtilities.m */, A997D8EB1A4ABB0900E19B6F /* HBPresetCoding.h */, ); name = Core; @@ -1277,6 +1280,7 @@ 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 */, diff --git a/macosx/HandBrake.xcodeproj/xcshareddata/xcschemes/HandBrake [DEBUG].xcscheme b/macosx/HandBrake.xcodeproj/xcshareddata/xcschemes/HandBrake [DEBUG].xcscheme index 04c6afb70..01e1b2cb7 100644 --- a/macosx/HandBrake.xcodeproj/xcshareddata/xcschemes/HandBrake [DEBUG].xcscheme +++ b/macosx/HandBrake.xcodeproj/xcshareddata/xcschemes/HandBrake [DEBUG].xcscheme @@ -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"> @@ -62,12 +62,13 @@ 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 index 7cfbfc755..000000000 --- a/macosx/NSCodingMacro.h +++ /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 |