// // SBQueueItem.h // Subler // // Created by Damiano Galassi on 16/08/11. // Copyright 2011 __MyCompanyName__. All rights reserved. // #import NS_ASSUME_NONNULL_BEGIN @class MP42File; @class SBQueueItem; typedef NS_ENUM(NSUInteger, SBQueueActionType) { SBQueueActionTypePre = 0, SBQueueActionTypePost }; /** * SBQueue actions protocol, actions can be run by * the queue's items. */ @protocol SBQueueActionProtocol - (BOOL)runAction:(SBQueueItem *)item; @property (nonatomic, readonly) NSString *localizedDescription; @property (nonatomic, readonly) SBQueueActionType type; @end typedef NS_ENUM(NSUInteger, SBQueueItemStatus) { SBQueueItemStatusUnknown = 0, SBQueueItemStatusReady, SBQueueItemStatusEditing, SBQueueItemStatusWorking, SBQueueItemStatusCompleted, SBQueueItemStatusFailed, SBQueueItemStatusCancelled, }; @interface SBQueueItem : NSObject @property (nonatomic, readwrite) SBQueueItemStatus status; @property (nonatomic, readonly, nullable) NSString *localizedWorkingDescription; @property (nonatomic, readonly, nullable) MP42File *mp4File; @property (nonatomic, readonly) NSURL *fileURL; @property (nonatomic, copy) NSURL *destURL; @property (nonatomic, readonly) NSArray> *actions; @property (nonatomic, readonly) NSDictionary *attributes; @property (nonatomic, weak, nullable) id delegate; + (instancetype)itemWithURL:(NSURL *)URL; + (instancetype)itemWithMP4:(MP42File *)MP4; + (instancetype)itemWithMP4:(MP42File *)MP4 destinationURL:(NSURL *)destURL attributes:(NSDictionary *)dict; + (instancetype)itemWithMP4:(MP42File *)MP4 destinationURL:(NSURL *)destURL attributes:(NSDictionary *)dict optimize:(BOOL)optimize; - (void)addAction:(id)action; - (void)removeAction:(id)action; - (BOOL)prepare:(NSError * __autoreleasing *)outError; - (BOOL)process:(NSError * __autoreleasing *)outError; - (void)cancel; @end NS_ASSUME_NONNULL_END