summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
Diffstat (limited to 'macosx')
-rw-r--r--macosx/HBAudio.m5
-rw-r--r--macosx/HBAudioDefaults.m5
-rw-r--r--macosx/HBChapter.m7
-rw-r--r--macosx/HBCodingUtilities.h2
-rw-r--r--macosx/HBFilters.m25
-rw-r--r--macosx/HBJob.m19
-rw-r--r--macosx/HBSubtitles.m5
-rw-r--r--macosx/HBSubtitlesDefaults.m5
-rw-r--r--macosx/HBVideo.m13
9 files changed, 53 insertions, 33 deletions
diff --git a/macosx/HBAudio.m b/macosx/HBAudio.m
index f7116d8a3..cb0c5a294 100644
--- a/macosx/HBAudio.m
+++ b/macosx/HBAudio.m
@@ -286,9 +286,12 @@ NSString *HBAudioChangedNotification = @"HBAudioChangedNotification";
track.delegate = self;
}
- decodeObject(_defaults, HBAudioDefaults);
+ decodeObjectOrFail(_defaults, HBAudioDefaults);
return self;
+
+fail:
+ return nil;
}
#pragma mark - Presets
diff --git a/macosx/HBAudioDefaults.m b/macosx/HBAudioDefaults.m
index 204d13967..0c714460c 100644
--- a/macosx/HBAudioDefaults.m
+++ b/macosx/HBAudioDefaults.m
@@ -469,7 +469,7 @@
self = [super init];
decodeInteger(_trackSelectionBehavior);
- decodeObject(_trackSelectionLanguages, NSMutableArray);
+ decodeObjectOrFail(_trackSelectionLanguages, NSMutableArray);
decodeCollectionOfObjects(_tracksArray, NSMutableArray, HBAudioTrackPreset);
@@ -487,6 +487,9 @@
decodeBool(_secondaryEncoderMode);
return self;
+
+fail:
+ return nil;
}
#pragma mark KVC
diff --git a/macosx/HBChapter.m b/macosx/HBChapter.m
index b3badef0c..d33ec9427 100644
--- a/macosx/HBChapter.m
+++ b/macosx/HBChapter.m
@@ -84,13 +84,14 @@
if (version == 1 && (self = [self init]))
{
- decodeObject(_title, NSString);
- decodeObject(_duration, NSString);
+ decodeObjectOrFail(_title, NSString);
+ decodeObjectOrFail(_duration, NSString);
decodeInteger(_index);
return self;
}
-
+
+fail:
return nil;
}
diff --git a/macosx/HBCodingUtilities.h b/macosx/HBCodingUtilities.h
index cc92f9b6e..c880e08aa 100644
--- a/macosx/HBCodingUtilities.h
+++ b/macosx/HBCodingUtilities.h
@@ -26,7 +26,7 @@
#define decodeCollectionOfObjects3(x, cl, objectcl, objectcl2, objectcl3) x = [HBCodingUtilities decodeObjectOfClasses:[NSSet setWithObjects:[cl class], [objectcl class], [objectcl2 class], [objectcl3 class], nil] 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;}
+#define decodeObjectOrFail(x, cl) x = [HBCodingUtilities decodeObjectOfClass:[cl class] forKey:OBJC_STRINGIFY(x) decoder:decoder]; if (x == nil) {NSLog(@"Failed to decode: %@", OBJC_STRINGIFY(x)); goto fail;}
NS_ASSUME_NONNULL_BEGIN
diff --git a/macosx/HBFilters.m b/macosx/HBFilters.m
index 981b75310..12a943953 100644
--- a/macosx/HBFilters.m
+++ b/macosx/HBFilters.m
@@ -426,20 +426,20 @@ NSString * const HBFiltersChangedNotification = @"HBFiltersChangedNotification";
{
self = [super init];
- decodeObject(_detelecine, NSString);
- decodeObject(_detelecineCustomString, NSString);
+ decodeObjectOrFail(_detelecine, NSString);
+ decodeObjectOrFail(_detelecineCustomString, NSString);
- decodeObject(_combDetection, NSString);
- decodeObject(_combDetectionCustomString, NSString);
+ decodeObjectOrFail(_combDetection, NSString);
+ decodeObjectOrFail(_combDetectionCustomString, NSString);
- decodeObject(_deinterlace, NSString);
- decodeObject(_deinterlacePreset, NSString)
- decodeObject(_deinterlaceCustomString, NSString);
+ decodeObjectOrFail(_deinterlace, NSString);
+ decodeObjectOrFail(_deinterlacePreset, NSString)
+ decodeObjectOrFail(_deinterlaceCustomString, NSString);
- decodeObject(_denoise, NSString);
- decodeObject(_denoisePreset, NSString);
- decodeObject(_denoiseTune, NSString);
- decodeObject(_denoiseCustomString, NSString);
+ decodeObjectOrFail(_denoise, NSString);
+ decodeObjectOrFail(_denoisePreset, NSString);
+ decodeObjectOrFail(_denoiseTune, NSString);
+ decodeObjectOrFail(_denoiseCustomString, NSString);
decodeInt(_deblock);
decodeBool(_grayscale);
@@ -449,6 +449,9 @@ NSString * const HBFiltersChangedNotification = @"HBFiltersChangedNotification";
_notificationsEnabled = YES;
return self;
+
+fail:
+ return nil;
}
#pragma mark - Presets and queue
diff --git a/macosx/HBJob.m b/macosx/HBJob.m
index 15f77ede2..5d01987b6 100644
--- a/macosx/HBJob.m
+++ b/macosx/HBJob.m
@@ -377,10 +377,10 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification";
if (version == 3 && (self = [super init]))
{
decodeInt(_state);
- decodeObject(_name, NSString);
- decodeObject(_presetName, NSString);
+ decodeObjectOrFail(_name, NSString);
+ decodeObjectOrFail(_presetName, NSString);
decodeInt(_titleIdx);
- decodeObject(_uuid, NSString);
+ decodeObjectOrFail(_uuid, NSString);
#ifdef __SANDBOX_ENABLED__
_fileURLBookmark = [HBCodingUtilities decodeObjectOfClass:[NSData class] forKey:@"_fileURLBookmark" decoder:decoder];
@@ -417,15 +417,15 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification";
decodeBool(_mp4HttpOptimize);
decodeBool(_mp4iPodCompatible);
- decodeObject(_range, HBRange);
- decodeObject(_video, HBVideo);
- decodeObject(_picture, HBPicture);
- decodeObject(_filters, HBFilters);
+ decodeObjectOrFail(_range, HBRange);
+ decodeObjectOrFail(_video, HBVideo);
+ decodeObjectOrFail(_picture, HBPicture);
+ decodeObjectOrFail(_filters, HBFilters);
_video.job = self;
- decodeObject(_audio, HBAudio);
- decodeObject(_subtitles, HBSubtitles);
+ decodeObjectOrFail(_audio, HBAudio);
+ decodeObjectOrFail(_subtitles, HBSubtitles);
_audio.job = self;
_video.job = self;
@@ -436,6 +436,7 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification";
return self;
}
+fail:
return nil;
}
diff --git a/macosx/HBSubtitles.m b/macosx/HBSubtitles.m
index f0d224078..235ceec1e 100644
--- a/macosx/HBSubtitles.m
+++ b/macosx/HBSubtitles.m
@@ -513,9 +513,12 @@ extern NSString *keySubTrackSrtFileURLBookmark;
track.delegate = self;
}
- decodeObject(_defaults, HBSubtitlesDefaults);
+ decodeObjectOrFail(_defaults, HBSubtitlesDefaults);
return self;
+
+fail:
+ return nil;
}
#pragma mark - Presets
diff --git a/macosx/HBSubtitlesDefaults.m b/macosx/HBSubtitlesDefaults.m
index fa1044a69..c6e8179d7 100644
--- a/macosx/HBSubtitlesDefaults.m
+++ b/macosx/HBSubtitlesDefaults.m
@@ -226,7 +226,7 @@
self = [super init];
decodeInteger(_trackSelectionBehavior);
- decodeObject(_trackSelectionLanguages, NSMutableArray);
+ decodeObjectOrFail(_trackSelectionLanguages, NSMutableArray);
decodeBool(_addForeignAudioSearch);
decodeBool(_addForeignAudioSubtitle);
@@ -237,6 +237,9 @@
decodeBool(_burnInBluraySubtitles);
return self;
+
+fail:
+ return nil;
}
diff --git a/macosx/HBVideo.m b/macosx/HBVideo.m
index 5cb7d642d..21716b0bf 100644
--- a/macosx/HBVideo.m
+++ b/macosx/HBVideo.m
@@ -516,18 +516,21 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification";
decodeBool(_turboTwoPass);
decodeBool(_advancedOptions);
- decodeObject(_preset, NSString);
- decodeObject(_tune, NSString);
- decodeObject(_profile, NSString);
- decodeObject(_level, NSString);
+ decodeObjectOrFail(_preset, NSString);
+ decodeObjectOrFail(_tune, NSString);
+ decodeObjectOrFail(_profile, NSString);
+ decodeObjectOrFail(_level, NSString);
- decodeObject(_videoOptionExtra, NSString);
+ decodeObjectOrFail(_videoOptionExtra, NSString);
decodeBool(_fastDecode);
_notificationsEnabled = YES;
return self;
+
+fail:
+ return nil;
}
#pragma mark - Various conversion methods from dict/preset/queue/etc