diff --git a/apple/src/FFprobeKit.h b/apple/src/FFprobeKit.h index 132e6440..27efb99d 100644 --- a/apple/src/FFprobeKit.h +++ b/apple/src/FFprobeKit.h @@ -266,6 +266,23 @@ */ + (MediaInformationSession*)getMediaInformationFromCommandAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout; +/** + *

Starts an asynchronous FFprobe execution to extract media information using command arguments. The command + * passed to this method must generate the output in JSON format in order to successfully extract media information + * from it. + * + *

Note that this method returns immediately and does not wait the execution to complete. You must use an + * ExecuteCallback if you want to be notified about the result. + * + * @param command FFprobe command that prints media information for a file in JSON format + * @param executeCallback callback that will be notified when execution is completed + * @param logCallback callback that will receive logs + * @param queue dispatch queue that will be used to run this asynchronous operation + * @param waitTimeout max time to wait until media information is transmitted + * @return media information session created for this execution + */ ++ (MediaInformationSession*)getMediaInformationFromCommandArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout; + /** *

Lists all FFprobe sessions in the session history. * diff --git a/apple/src/FFprobeKit.m b/apple/src/FFprobeKit.m index 71b66284..6611b0ef 100644 --- a/apple/src/FFprobeKit.m +++ b/apple/src/FFprobeKit.m @@ -136,7 +136,13 @@ + (MediaInformationSession*)getMediaInformationFromCommand:(NSString*)command { return session; } -+ (MediaInformationSession*)getMediaInformationFromCommandAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout { ++ (MediaInformationSession*)getMediaInformationFromCommandAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout { + MediaInformationSession* session = [[MediaInformationSession alloc] init:[FFmpegKitConfig parseArguments:command] withExecuteCallback:executeCallback withLogCallback:logCallback]; + [FFmpegKitConfig asyncGetMediaInformationExecute:session onDispatchQueue:queue withTimeout:waitTimeout]; + return session; +} + ++ (MediaInformationSession*)getMediaInformationFromCommandArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout { MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withExecuteCallback:executeCallback withLogCallback:logCallback]; [FFmpegKitConfig asyncGetMediaInformationExecute:session onDispatchQueue:queue withTimeout:waitTimeout]; return session;