Fixed previews creation in the queue.

This commit is contained in:
Damiano Galassi committed 2014-11-21 11:55:07 +01:00
1 parent 19d80fbca8
commit 212cb9e601
4 files changed
+17 -8

No files matched your search

+1 -1
View File
@@ -195,7 +195,7 @@ NSString *SBQueueCancelledNotification = @"SBQueueCancelledNotification";
self.currentItem.delegate = self;
[self handleSBStatusWorking:0 index:self.currentIndex];
noErr = [self.currentItem processItem:self.optimize error:&outError];
noErr = [self.currentItem processWithOptions:self.optimize error:&outError];
// Check results
if (self.cancelled) {
+1 -1
View File
@@ -210,7 +210,7 @@ static void *SBQueueContex = &SBQueueContex;
dispatch_async(dispatch_get_global_queue(0, 0), ^{
if (!item.mp4File)
[item prepareItem:NULL];
[item prepare:NULL];
MP42File *mp4 = item.mp4File;
dispatch_sync(dispatch_get_main_queue(), ^{
+2 -2
View File
@@ -56,8 +56,8 @@ typedef enum SBQueueItemStatus : NSInteger {
- (void)addAction:(id<SBQueueActionProtocol>)action;
- (void)removeAction:(id<SBQueueActionProtocol>)action;
- (BOOL)prepareItem:(NSError **)outError;
- (BOOL)processItem:(BOOL)optimize error:(NSError **)outError;
- (BOOL)prepare:(NSError **)outError;
- (BOOL)processWithOptions:(BOOL)optimize error:(NSError **)outError;
- (void)cancel;
@end
+13 -4
View File
@@ -55,9 +55,18 @@
NSFileManager *fileManager = [NSFileManager defaultManager];
unsigned long long originalFileSize = [[[fileManager attributesOfItemAtPath:[_fileURL path] error:nil] valueForKey:NSFileSize] unsignedLongLongValue];
NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
if (originalFileSize > ALMOST_4GiB) {
_attributes = [[NSDictionary alloc] initWithObjectsAndKeys:@YES, MP4264BitData, nil];
[attributes setObject:@YES forKey:MP4264BitData];
}
if ([[[NSUserDefaults standardUserDefaults] valueForKey:@"chaptersPreviewTrack"] boolValue]) {
[attributes setObject:@YES forKey:MP42GenerateChaptersPreviewTrack];
}
_attributes = [attributes copy];
}
return self;
@@ -145,7 +154,7 @@
#pragma mark Item processing
- (BOOL)prepareItem:(NSError **)outError {
- (BOOL)prepare:(NSError **)outError {
if (![[NSFileManager defaultManager] fileExistsAtPath:[self.URL path]]) {
if (outError) {
NSDictionary *errorDetail = @{ NSLocalizedDescriptionKey : @"File not found",
@@ -230,7 +239,7 @@
return YES;
}
- (BOOL)processItem:(BOOL)optimize error:(NSError **)outError {
- (BOOL)processWithOptions:(BOOL)optimize error:(NSError **)outError {
BOOL noErr = YES;
#ifdef SB_SANDBOX
@@ -240,7 +249,7 @@
// The file has been added directly to the queue
if (!self.mp4File && self.URL) {
noErr = [self prepareItem:outError];
noErr = [self prepare:outError];
}
if (!noErr) { goto bail; }