// // MP42FileImporter.h // Subler // // Created by Damiano Galassi on 31/01/10. // Copyright 2022 Damiano Galassi All rights reserved. // #import #import #import #import @class MP42SampleBuffer; @class MP42AudioTrack; @class MP42VideoTrack; @class MP42Metadata; @class MP42Track; NS_ASSUME_NONNULL_BEGIN @interface MP42FileImporter : NSObject + (NSArray *)supportedFileFormats; + (BOOL)canInitWithFileType:(NSString *)fileType; // YES for the extensions handled by the Matroska importer (mkv, mka, mks); // used by callers that want to open such files in tags-only mode instead of // converting them. + (BOOL)isMatroskaFileType:(NSString *)fileType; + (NSArray *)supportedContentTypes API_AVAILABLE(macos(11.0)); + (BOOL)canInitWithContentType:(UTType *)contentType API_AVAILABLE(macos(11.0)); - (nullable instancetype)initWithURL:(NSURL *)fileURL error:(NSError * __autoreleasing *)error; // tagsOnly is YES when the caller opens a Matroska file to edit it in place // (tags-only mode): the importer then mirrors the file's own track flags // (TrackFlagEnabled) instead of Subler's MP4-oriented "first track of each // type enabled" conversion heuristic. Non-Matroska importers ignore it. - (nullable instancetype)initWithURL:(NSURL *)fileURL tagsOnly:(BOOL)tagsOnly error:(NSError * __autoreleasing *)error; @property (nonatomic, readonly) NSURL *fileURL; @property (nonatomic, readonly) MP42Metadata *metadata; @property (nonatomic, readonly) NSArray *tracks; #pragma mark - Override - (nullable NSData *)magicCookieForTrack:(MP42Track *)track; - (AudioStreamBasicDescription)audioDescriptionForTrack:(MP42AudioTrack *)track; - (BOOL)audioTrackUsesExplicitEncoderDelay:(MP42Track *)track; - (BOOL)supportsPreciseTimestamps; - (void)setup; - (void)demux; - (void)cleanUp:(MP42Track *)track fileHandle:(MP42FileHandle)fileHandle; #pragma mark - Private - (void)enqueue:(MP42SampleBuffer * NS_RELEASES_ARGUMENT)sample MP42_OBJC_DIRECT; @property (nonatomic, readwrite MP42_DIRECT) double progress; @property (nonatomic, readonly, getter=isCancelled MP42_DIRECT) BOOL cancelled; @end NS_ASSUME_NONNULL_END