Fixed previews creation in the queue.
This commit is contained in:
1 parent
19d80fbca8
commit
212cb9e601
4 files changed
+17
-8
No files matched your search
+1
-1
@@ -195,7 +195,7 @@ NSString *SBQueueCancelledNotification = @"SBQueueCancelledNotification";
|
|||||||
self.currentItem.delegate = self;
|
self.currentItem.delegate = self;
|
||||||
|
|
||||||
[self handleSBStatusWorking:0 index:self.currentIndex];
|
[self handleSBStatusWorking:0 index:self.currentIndex];
|
||||||
noErr = [self.currentItem processItem:self.optimize error:&outError];
|
noErr = [self.currentItem processWithOptions:self.optimize error:&outError];
|
||||||
|
|
||||||
// Check results
|
// Check results
|
||||||
if (self.cancelled) {
|
if (self.cancelled) {
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
|
|
||||||
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
||||||
if (!item.mp4File)
|
if (!item.mp4File)
|
||||||
[item prepareItem:NULL];
|
[item prepare:NULL];
|
||||||
|
|
||||||
MP42File *mp4 = item.mp4File;
|
MP42File *mp4 = item.mp4File;
|
||||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ typedef enum SBQueueItemStatus : NSInteger {
|
|||||||
- (void)addAction:(id<SBQueueActionProtocol>)action;
|
- (void)addAction:(id<SBQueueActionProtocol>)action;
|
||||||
- (void)removeAction:(id<SBQueueActionProtocol>)action;
|
- (void)removeAction:(id<SBQueueActionProtocol>)action;
|
||||||
|
|
||||||
- (BOOL)prepareItem:(NSError **)outError;
|
- (BOOL)prepare:(NSError **)outError;
|
||||||
- (BOOL)processItem:(BOOL)optimize error:(NSError **)outError;
|
- (BOOL)processWithOptions:(BOOL)optimize error:(NSError **)outError;
|
||||||
- (void)cancel;
|
- (void)cancel;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
+13
-4
@@ -55,9 +55,18 @@
|
|||||||
|
|
||||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||||
unsigned long long originalFileSize = [[[fileManager attributesOfItemAtPath:[_fileURL path] error:nil] valueForKey:NSFileSize] unsignedLongLongValue];
|
unsigned long long originalFileSize = [[[fileManager attributesOfItemAtPath:[_fileURL path] error:nil] valueForKey:NSFileSize] unsignedLongLongValue];
|
||||||
|
|
||||||
|
NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
|
||||||
|
|
||||||
if (originalFileSize > ALMOST_4GiB) {
|
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;
|
return self;
|
||||||
@@ -145,7 +154,7 @@
|
|||||||
|
|
||||||
#pragma mark Item processing
|
#pragma mark Item processing
|
||||||
|
|
||||||
- (BOOL)prepareItem:(NSError **)outError {
|
- (BOOL)prepare:(NSError **)outError {
|
||||||
if (![[NSFileManager defaultManager] fileExistsAtPath:[self.URL path]]) {
|
if (![[NSFileManager defaultManager] fileExistsAtPath:[self.URL path]]) {
|
||||||
if (outError) {
|
if (outError) {
|
||||||
NSDictionary *errorDetail = @{ NSLocalizedDescriptionKey : @"File not found",
|
NSDictionary *errorDetail = @{ NSLocalizedDescriptionKey : @"File not found",
|
||||||
@@ -230,7 +239,7 @@
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)processItem:(BOOL)optimize error:(NSError **)outError {
|
- (BOOL)processWithOptions:(BOOL)optimize error:(NSError **)outError {
|
||||||
BOOL noErr = YES;
|
BOOL noErr = YES;
|
||||||
|
|
||||||
#ifdef SB_SANDBOX
|
#ifdef SB_SANDBOX
|
||||||
@@ -240,7 +249,7 @@
|
|||||||
|
|
||||||
// The file has been added directly to the queue
|
// The file has been added directly to the queue
|
||||||
if (!self.mp4File && self.URL) {
|
if (!self.mp4File && self.URL) {
|
||||||
noErr = [self prepareItem:outError];
|
noErr = [self prepare:outError];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!noErr) { goto bail; }
|
if (!noErr) { goto bail; }
|
||||||
|
|||||||
Reference in new issue
Block a user