Do not try to open unsupported file versions.
This commit is contained in:
4 files changed
+15
-1
No files matched your search
@@ -276,12 +276,14 @@
|
|||||||
{
|
{
|
||||||
self = [super initWithCoder:decoder];
|
self = [super initWithCoder:decoder];
|
||||||
|
|
||||||
|
if (self) {
|
||||||
_volume = [decoder decodeFloatForKey:@"volume"];
|
_volume = [decoder decodeFloatForKey:@"volume"];
|
||||||
|
|
||||||
_channels = [decoder decodeInt64ForKey:@"channels"];
|
_channels = [decoder decodeInt64ForKey:@"channels"];
|
||||||
_channelLayoutTag = [decoder decodeInt64ForKey:@"channelLayoutTag"];
|
_channelLayoutTag = [decoder decodeInt64ForKey:@"channelLayoutTag"];
|
||||||
|
|
||||||
_fallbackTrackId = [decoder decodeInt64ForKey:@"fallbackTrackId"];
|
_fallbackTrackId = [decoder decodeInt64ForKey:@"fallbackTrackId"];
|
||||||
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-1
@@ -1246,13 +1246,15 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) {
|
|||||||
|
|
||||||
#pragma mark - NSSecureCoding
|
#pragma mark - NSSecureCoding
|
||||||
|
|
||||||
|
#define MP42FILE_VERSION 5
|
||||||
|
|
||||||
+ (BOOL)supportsSecureCoding
|
+ (BOOL)supportsSecureCoding
|
||||||
{
|
{
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)encodeWithCoder:(NSCoder *)coder {
|
- (void)encodeWithCoder:(NSCoder *)coder {
|
||||||
[coder encodeInt:4 forKey:@"MP42FileVersion"];
|
[coder encodeInt:MP42FILE_VERSION forKey:@"MP42FileVersion"];
|
||||||
|
|
||||||
#ifdef SB_SANDBOX
|
#ifdef SB_SANDBOX
|
||||||
if ([fileURL respondsToSelector:@selector(startAccessingSecurityScopedResource)]) {
|
if ([fileURL respondsToSelector:@selector(startAccessingSecurityScopedResource)]) {
|
||||||
@@ -1289,6 +1291,12 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) {
|
|||||||
- (id)initWithCoder:(NSCoder *)decoder {
|
- (id)initWithCoder:(NSCoder *)decoder {
|
||||||
self = [self init];
|
self = [self init];
|
||||||
|
|
||||||
|
NSInteger version = [decoder decodeIntForKey:@"MP42FileVersion"];
|
||||||
|
|
||||||
|
if (version < MP42FILE_VERSION) {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
NSData *bookmarkData = [decoder decodeObjectOfClass:[NSData class] forKey:@"bookmark"];
|
NSData *bookmarkData = [decoder decodeObjectOfClass:[NSData class] forKey:@"bookmark"];
|
||||||
if (bookmarkData) {
|
if (bookmarkData) {
|
||||||
BOOL bookmarkDataIsStale;
|
BOOL bookmarkDataIsStale;
|
||||||
|
|||||||
@@ -412,11 +412,13 @@ static void insertTagsFromStyleRecord(style_record record, NSMutableString *samp
|
|||||||
{
|
{
|
||||||
self = [super initWithCoder:decoder];
|
self = [super initWithCoder:decoder];
|
||||||
|
|
||||||
|
if (self) {
|
||||||
_verticalPlacement = [decoder decodeBoolForKey:@"verticalPlacement"];
|
_verticalPlacement = [decoder decodeBoolForKey:@"verticalPlacement"];
|
||||||
_someSamplesAreForced = [decoder decodeBoolForKey:@"someSamplesAreForced"];
|
_someSamplesAreForced = [decoder decodeBoolForKey:@"someSamplesAreForced"];
|
||||||
_allSamplesAreForced = [decoder decodeBoolForKey:@"allSamplesAreForced"];
|
_allSamplesAreForced = [decoder decodeBoolForKey:@"allSamplesAreForced"];
|
||||||
|
|
||||||
_forcedTrackId = [decoder decodeInt64ForKey:@"forcedTrackId"];
|
_forcedTrackId = [decoder decodeInt64ForKey:@"forcedTrackId"];
|
||||||
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -366,6 +366,7 @@
|
|||||||
{
|
{
|
||||||
self = [super initWithCoder:decoder];
|
self = [super initWithCoder:decoder];
|
||||||
|
|
||||||
|
if (self) {
|
||||||
_width = [decoder decodeInt64ForKey:@"width"];
|
_width = [decoder decodeInt64ForKey:@"width"];
|
||||||
_height = [decoder decodeInt64ForKey:@"height"];
|
_height = [decoder decodeInt64ForKey:@"height"];
|
||||||
|
|
||||||
@@ -391,6 +392,7 @@
|
|||||||
|
|
||||||
_newProfile = [decoder decodeIntForKey:@"newProfile"];
|
_newProfile = [decoder decodeIntForKey:@"newProfile"];
|
||||||
_newLevel = [decoder decodeIntForKey:@"newLevel"];
|
_newLevel = [decoder decodeIntForKey:@"newLevel"];
|
||||||
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user