replace delegates with callback blocks on objective c api
This commit is contained in:
parent
a05fdf4e56
commit
06a736fda4
@ -38,11 +38,11 @@ extern int const AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit;
|
||||
* Creates a new abstract session.
|
||||
*
|
||||
* @param arguments command arguments
|
||||
* @param executeDelegate session specific execute delegate
|
||||
* @param logDelegate session specific log delegate
|
||||
* @param executeCallback session specific execute callback
|
||||
* @param logCallback session specific log callback
|
||||
* @param logRedirectionStrategy session specific log redirection strategy
|
||||
*/
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate withLogRedirectionStrategy:(LogRedirectionStrategy)logRedirectionStrategy;
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withLogRedirectionStrategy:(LogRedirectionStrategy)logRedirectionStrategy;
|
||||
|
||||
/**
|
||||
* Waits for all asynchronous messages to be transmitted until the given timeout.
|
||||
|
@ -19,10 +19,10 @@
|
||||
|
||||
#import "AbstractSession.h"
|
||||
#import "AtomicLong.h"
|
||||
#import "ExecuteDelegate.h"
|
||||
#import "ExecuteCallback.h"
|
||||
#import "FFmpegKit.h"
|
||||
#import "FFmpegKitConfig.h"
|
||||
#import "LogDelegate.h"
|
||||
#import "LogCallback.h"
|
||||
#import "ReturnCode.h"
|
||||
|
||||
int const AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit = 5000;
|
||||
@ -31,8 +31,8 @@ static AtomicLong *sessionIdGenerator = nil;
|
||||
|
||||
@implementation AbstractSession {
|
||||
long _sessionId;
|
||||
id<ExecuteDelegate> _executeDelegate;
|
||||
id<LogDelegate> _logDelegate;
|
||||
ExecuteCallback _executeCallback;
|
||||
LogCallback _logCallback;
|
||||
NSDate* _createTime;
|
||||
NSDate* _startTime;
|
||||
NSDate* _endTime;
|
||||
@ -49,12 +49,12 @@ static AtomicLong *sessionIdGenerator = nil;
|
||||
sessionIdGenerator = [[AtomicLong alloc] initWithValue:1];
|
||||
}
|
||||
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate withLogRedirectionStrategy:(LogRedirectionStrategy)logRedirectionStrategy {
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withLogRedirectionStrategy:(LogRedirectionStrategy)logRedirectionStrategy {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_sessionId = [sessionIdGenerator incrementAndGet];
|
||||
_executeDelegate = executeDelegate;
|
||||
_logDelegate = logDelegate;
|
||||
_executeCallback = executeCallback;
|
||||
_logCallback = logCallback;
|
||||
_createTime = [NSDate date];
|
||||
_startTime = nil;
|
||||
_endTime = nil;
|
||||
@ -70,12 +70,12 @@ static AtomicLong *sessionIdGenerator = nil;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id<ExecuteDelegate>)getExecuteDelegate {
|
||||
return _executeDelegate;
|
||||
- (ExecuteCallback)getExecuteCallback {
|
||||
return _executeCallback;
|
||||
}
|
||||
|
||||
- (id<LogDelegate>)getLogDelegate {
|
||||
return _logDelegate;
|
||||
- (LogCallback)getLogCallback {
|
||||
return _logCallback;
|
||||
}
|
||||
|
||||
- (long)getSessionId {
|
||||
|
@ -17,18 +17,15 @@
|
||||
* along with FFmpegKit. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef FFMPEG_KIT_EXECUTE_DELEGATE_H
|
||||
#define FFMPEG_KIT_EXECUTE_DELEGATE_H
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "Session.h"
|
||||
#ifndef FFMPEG_KIT_EXECUTE_CALLBACK_H
|
||||
#define FFMPEG_KIT_EXECUTE_CALLBACK_H
|
||||
|
||||
@protocol Session;
|
||||
|
||||
/**
|
||||
* <p>Delegate invoked when an asynchronous session ends running.
|
||||
* <p>Callback invoked when an asynchronous session ends running.
|
||||
* <p>Session has either SessionStateCompleted or SessionStateFailed state when
|
||||
* the delegate is invoked.
|
||||
* the callback is invoked.
|
||||
* <p>If it has SessionStateCompleted state, <code>ReturnCode</code> should be checked to
|
||||
* see the execution result.
|
||||
* <p>If <code>getState</code> returns SessionStateFailed then
|
||||
@ -43,17 +40,11 @@
|
||||
* break;
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
@protocol ExecuteDelegate<NSObject>
|
||||
@required
|
||||
|
||||
/**
|
||||
* Called when an execution is completed.
|
||||
*
|
||||
* @param session session of the completed execution
|
||||
*/
|
||||
- (void)executeCallback:(id<Session>)session;
|
||||
typedef void (^ExecuteCallback)(id<Session> session);
|
||||
|
||||
@end
|
||||
#import "Session.h"
|
||||
|
||||
#endif // FFMPEG_KIT_EXECUTE_DELEGATE_H
|
||||
#endif // FFMPEG_KIT_EXECUTE_CALLBACK_H
|
@ -23,10 +23,10 @@
|
||||
#import <string.h>
|
||||
#import <stdlib.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "ExecuteDelegate.h"
|
||||
#import "LogDelegate.h"
|
||||
#import "ExecuteCallback.h"
|
||||
#import "LogCallback.h"
|
||||
#import "FFmpegSession.h"
|
||||
#import "StatisticsDelegate.h"
|
||||
#import "StatisticsCallback.h"
|
||||
|
||||
/**
|
||||
* <p>Main class to run <code>FFmpeg</code> commands. Supports executing commands both
|
||||
@ -34,11 +34,11 @@
|
||||
* <pre>
|
||||
* FFmpegSession *session = [FFmpegKit execute:@"-i file1.mp4 -c:v libxvid file1.avi"];
|
||||
*
|
||||
* FFmpegSession *asyncSession = [FFmpegKit executeAsync:@"-i file1.mp4 -c:v libxvid file1.avi" withExecuteDelegate:executeDelegate];
|
||||
* FFmpegSession *asyncSession = [FFmpegKit executeAsync:@"-i file1.mp4 -c:v libxvid file1.avi" withExecuteCallback:executeCallback];
|
||||
* </pre>
|
||||
* <p>Provides overloaded <code>execute</code> methods to define session specific delegates.
|
||||
* <p>Provides overloaded <code>execute</code> methods to define session specific callbacks.
|
||||
* <pre>
|
||||
* FFmpegSession *asyncSession = [FFmpegKit executeAsync:@"-i file1.mp4 -c:v libxvid file1.avi" withExecuteDelegate:executeDelegate withLogDelegate:logDelegate withStatisticsDelegate:statisticsDelegate];
|
||||
* FFmpegSession *asyncSession = [FFmpegKit executeAsync:@"-i file1.mp4 -c:v libxvid file1.avi" withExecuteCallback:executeCallback withLogCallback:logCallback withStatisticsCallback:statisticsCallback];
|
||||
* </pre>
|
||||
*/
|
||||
@interface FFmpegKit : NSObject
|
||||
@ -55,43 +55,43 @@
|
||||
* <p>Asynchronously executes FFmpeg with arguments provided.
|
||||
*
|
||||
* @param arguments FFmpeg command options/arguments as string array
|
||||
* @param executeDelegate delegate that will be called when the execution is completed
|
||||
* @param executeCallback callback that will be called when the execution is completed
|
||||
* @return FFmpeg session created for this execution
|
||||
*/
|
||||
+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate;
|
||||
+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback;
|
||||
|
||||
/**
|
||||
* <p>Asynchronously executes FFmpeg with arguments provided.
|
||||
*
|
||||
* @param arguments FFmpeg command options/arguments as string array
|
||||
* @param executeDelegate delegate that will be called when the execution is completed
|
||||
* @param logDelegate delegate that will receive logs
|
||||
* @param statisticsDelegate delegate that will receive statistics
|
||||
* @param executeCallback callback that will be called when the execution is completed
|
||||
* @param logCallback callback that will receive logs
|
||||
* @param statisticsCallback callback that will receive statistics
|
||||
* @return FFmpeg session created for this execution
|
||||
*/
|
||||
+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate withStatisticsDelegate:(id<StatisticsDelegate>)statisticsDelegate;
|
||||
+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback;
|
||||
|
||||
/**
|
||||
* <p>Asynchronously executes FFmpeg with arguments provided.
|
||||
*
|
||||
* @param arguments FFmpeg command options/arguments as string array
|
||||
* @param executeDelegate delegate that will be called when the execution is completed
|
||||
* @param executeCallback callback that will be called when the execution is completed
|
||||
* @param queue dispatch queue that will be used to run this asynchronous operation
|
||||
* @return FFmpeg session created for this execution
|
||||
*/
|
||||
+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate onDispatchQueue:(dispatch_queue_t)queue;
|
||||
+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback onDispatchQueue:(dispatch_queue_t)queue;
|
||||
|
||||
/**
|
||||
* <p>Asynchronously executes FFmpeg with arguments provided.
|
||||
*
|
||||
* @param arguments FFmpeg command options/arguments as string array
|
||||
* @param executeDelegate delegate that will be called when the execution is completed
|
||||
* @param logDelegate delegate that will receive logs
|
||||
* @param statisticsDelegate delegate that will receive statistics
|
||||
* @param executeCallback callback that will be called when the execution is completed
|
||||
* @param logCallback callback that will receive logs
|
||||
* @param statisticsCallback callback that will receive statistics
|
||||
* @param queue dispatch queue that will be used to run this asynchronous operation
|
||||
* @return FFmpeg session created for this execution
|
||||
*/
|
||||
+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate withStatisticsDelegate:(id<StatisticsDelegate>)statisticsDelegate onDispatchQueue:(dispatch_queue_t)queue;
|
||||
+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback onDispatchQueue:(dispatch_queue_t)queue;
|
||||
|
||||
/**
|
||||
* <p>Synchronously executes FFmpeg command provided. Space character is used to split command
|
||||
@ -109,10 +109,10 @@
|
||||
* your command.
|
||||
*
|
||||
* @param command FFmpeg command
|
||||
* @param executeDelegate delegate that will be called when the execution is completed
|
||||
* @param executeCallback callback that will be called when the execution is completed
|
||||
* @return FFmpeg session created for this execution
|
||||
*/
|
||||
+ (FFmpegSession*)executeAsync:(NSString*)command withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate;
|
||||
+ (FFmpegSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback;
|
||||
|
||||
/**
|
||||
* <p>Asynchronously executes FFmpeg command provided. Space character is used to split command
|
||||
@ -120,12 +120,12 @@
|
||||
* your command.
|
||||
*
|
||||
* @param command FFmpeg command
|
||||
* @param executeDelegate delegate that will be called when the execution is completed
|
||||
* @param logDelegate delegate that will receive logs
|
||||
* @param statisticsDelegate delegate that will receive statistics
|
||||
* @param executeCallback callback that will be called when the execution is completed
|
||||
* @param logCallback callback that will receive logs
|
||||
* @param statisticsCallback callback that will receive statistics
|
||||
* @return FFmpeg session created for this execution
|
||||
*/
|
||||
+ (FFmpegSession*)executeAsync:(NSString*)command withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate withStatisticsDelegate:(id<StatisticsDelegate>)statisticsDelegate;
|
||||
+ (FFmpegSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback;
|
||||
|
||||
/**
|
||||
* <p>Asynchronously executes FFmpeg command provided. Space character is used to split command
|
||||
@ -133,11 +133,11 @@
|
||||
* your command.
|
||||
*
|
||||
* @param command FFmpeg command
|
||||
* @param executeDelegate delegate that will be called when the execution is completed
|
||||
* @param executeCallback callback that will be called when the execution is completed
|
||||
* @param queue dispatch queue that will be used to run this asynchronous operation
|
||||
* @return FFmpeg session created for this execution
|
||||
*/
|
||||
+ (FFmpegSession*)executeAsync:(NSString*)command withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate onDispatchQueue:(dispatch_queue_t)queue;
|
||||
+ (FFmpegSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback onDispatchQueue:(dispatch_queue_t)queue;
|
||||
|
||||
/**
|
||||
* <p>Asynchronously executes FFmpeg command provided. Space character is used to split command
|
||||
@ -145,13 +145,13 @@
|
||||
* your command.
|
||||
*
|
||||
* @param command FFmpeg command
|
||||
* @param executeDelegate delegate that will be called when the execution is completed
|
||||
* @param logDelegate delegate that will receive logs
|
||||
* @param statisticsDelegate delegate that will receive statistics
|
||||
* @param executeCallback callback that will be called when the execution is completed
|
||||
* @param logCallback callback that will receive logs
|
||||
* @param statisticsCallback callback that will receive statistics
|
||||
* @param queue dispatch queue that will be used to run this asynchronous operation
|
||||
* @return FFmpeg session created for this execution
|
||||
*/
|
||||
+ (FFmpegSession*)executeAsync:(NSString*)command withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate withStatisticsDelegate:(id<StatisticsDelegate>)statisticsDelegate onDispatchQueue:(dispatch_queue_t)queue;
|
||||
+ (FFmpegSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback onDispatchQueue:(dispatch_queue_t)queue;
|
||||
|
||||
/**
|
||||
* <p>Cancels all running sessions.
|
||||
|
@ -38,26 +38,26 @@
|
||||
return session;
|
||||
}
|
||||
|
||||
+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate {
|
||||
FFmpegSession* session = [[FFmpegSession alloc] init:arguments withExecuteDelegate:executeDelegate];
|
||||
+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback {
|
||||
FFmpegSession* session = [[FFmpegSession alloc] init:arguments withExecuteCallback:executeCallback];
|
||||
[FFmpegKitConfig asyncFFmpegExecute:session];
|
||||
return session;
|
||||
}
|
||||
|
||||
+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate withStatisticsDelegate:(id<StatisticsDelegate>)statisticsDelegate {
|
||||
FFmpegSession* session = [[FFmpegSession alloc] init:arguments withExecuteDelegate:executeDelegate withLogDelegate:logDelegate withStatisticsDelegate:statisticsDelegate];
|
||||
+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback {
|
||||
FFmpegSession* session = [[FFmpegSession alloc] init:arguments withExecuteCallback:executeCallback withLogCallback:logCallback withStatisticsCallback:statisticsCallback];
|
||||
[FFmpegKitConfig asyncFFmpegExecute:session];
|
||||
return session;
|
||||
}
|
||||
|
||||
+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate onDispatchQueue:(dispatch_queue_t)queue {
|
||||
FFmpegSession* session = [[FFmpegSession alloc] init:arguments withExecuteDelegate:executeDelegate];
|
||||
+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback onDispatchQueue:(dispatch_queue_t)queue {
|
||||
FFmpegSession* session = [[FFmpegSession alloc] init:arguments withExecuteCallback:executeCallback];
|
||||
[FFmpegKitConfig asyncFFmpegExecute:session onDispatchQueue:queue];
|
||||
return session;
|
||||
}
|
||||
|
||||
+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate withStatisticsDelegate:(id<StatisticsDelegate>)statisticsDelegate onDispatchQueue:(dispatch_queue_t)queue {
|
||||
FFmpegSession* session = [[FFmpegSession alloc] init:arguments withExecuteDelegate:executeDelegate withLogDelegate:logDelegate withStatisticsDelegate:statisticsDelegate];
|
||||
+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback onDispatchQueue:(dispatch_queue_t)queue {
|
||||
FFmpegSession* session = [[FFmpegSession alloc] init:arguments withExecuteCallback:executeCallback withLogCallback:logCallback withStatisticsCallback:statisticsCallback];
|
||||
[FFmpegKitConfig asyncFFmpegExecute:session onDispatchQueue:queue];
|
||||
return session;
|
||||
}
|
||||
@ -68,26 +68,26 @@
|
||||
return session;
|
||||
}
|
||||
|
||||
+ (FFmpegSession*)executeAsync:(NSString*)command withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate {
|
||||
FFmpegSession* session = [[FFmpegSession alloc] init:[FFmpegKit parseArguments:command] withExecuteDelegate:executeDelegate];
|
||||
+ (FFmpegSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback {
|
||||
FFmpegSession* session = [[FFmpegSession alloc] init:[FFmpegKit parseArguments:command] withExecuteCallback:executeCallback];
|
||||
[FFmpegKitConfig asyncFFmpegExecute:session];
|
||||
return session;
|
||||
}
|
||||
|
||||
+ (FFmpegSession*)executeAsync:(NSString*)command withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate withStatisticsDelegate:(id<StatisticsDelegate>)statisticsDelegate {
|
||||
FFmpegSession* session = [[FFmpegSession alloc] init:[FFmpegKit parseArguments:command] withExecuteDelegate:executeDelegate withLogDelegate:logDelegate withStatisticsDelegate:statisticsDelegate];
|
||||
+ (FFmpegSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback {
|
||||
FFmpegSession* session = [[FFmpegSession alloc] init:[FFmpegKit parseArguments:command] withExecuteCallback:executeCallback withLogCallback:logCallback withStatisticsCallback:statisticsCallback];
|
||||
[FFmpegKitConfig asyncFFmpegExecute:session];
|
||||
return session;
|
||||
}
|
||||
|
||||
+ (FFmpegSession*)executeAsync:(NSString*)command withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate onDispatchQueue:(dispatch_queue_t)queue {
|
||||
FFmpegSession* session = [[FFmpegSession alloc] init:[FFmpegKit parseArguments:command] withExecuteDelegate:executeDelegate];
|
||||
+ (FFmpegSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback onDispatchQueue:(dispatch_queue_t)queue {
|
||||
FFmpegSession* session = [[FFmpegSession alloc] init:[FFmpegKit parseArguments:command] withExecuteCallback:executeCallback];
|
||||
[FFmpegKitConfig asyncFFmpegExecute:session onDispatchQueue:queue];
|
||||
return session;
|
||||
}
|
||||
|
||||
+ (FFmpegSession*)executeAsync:(NSString*)command withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate withStatisticsDelegate:(id<StatisticsDelegate>)statisticsDelegate onDispatchQueue:(dispatch_queue_t)queue {
|
||||
FFmpegSession* session = [[FFmpegSession alloc] init:[FFmpegKit parseArguments:command] withExecuteDelegate:executeDelegate withLogDelegate:logDelegate withStatisticsDelegate:statisticsDelegate];
|
||||
+ (FFmpegSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback onDispatchQueue:(dispatch_queue_t)queue {
|
||||
FFmpegSession* session = [[FFmpegSession alloc] init:[FFmpegKit parseArguments:command] withExecuteCallback:executeCallback withLogCallback:logCallback withStatisticsCallback:statisticsCallback];
|
||||
[FFmpegKitConfig asyncFFmpegExecute:session onDispatchQueue:queue];
|
||||
return session;
|
||||
}
|
||||
|
@ -24,12 +24,12 @@
|
||||
#import <pthread.h>
|
||||
#import <unistd.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "ExecuteDelegate.h"
|
||||
#import "ExecuteCallback.h"
|
||||
#import "FFmpegSession.h"
|
||||
#import "FFprobeSession.h"
|
||||
#import "LogDelegate.h"
|
||||
#import "LogCallback.h"
|
||||
#import "MediaInformationSession.h"
|
||||
#import "StatisticsDelegate.h"
|
||||
#import "StatisticsCallback.h"
|
||||
|
||||
/** Global library version */
|
||||
extern NSString* const FFmpegKitVersion;
|
||||
@ -53,7 +53,7 @@ typedef NS_ENUM(NSUInteger, Signal) {
|
||||
*
|
||||
* <p>When redirection is enabled FFmpeg/FFprobe logs are redirected to NSLog and sessions
|
||||
* collect log and statistics entries for the executions. It is possible to define global or
|
||||
* session specific log/statistics delegates as well.
|
||||
* session specific log/statistics callbacks as well.
|
||||
*
|
||||
* <p>Note that redirection is enabled by default. If you do not want to use its functionality
|
||||
* please use disableRedirection method to disable it.
|
||||
@ -64,7 +64,7 @@ typedef NS_ENUM(NSUInteger, Signal) {
|
||||
* <p>Disables log and statistics redirection.
|
||||
*
|
||||
* <p>When redirection is disabled logs are printed to stderr, all logs and statistics
|
||||
* delegates are disabled and <code>FFprobe</code>'s <code>getMediaInformation</code> methods
|
||||
* callbacks are disabled and <code>FFprobe</code>'s <code>getMediaInformation</code> methods
|
||||
* do not work.
|
||||
*/
|
||||
+ (void)disableRedirection;
|
||||
@ -236,32 +236,32 @@ typedef NS_ENUM(NSUInteger, Signal) {
|
||||
+ (void)asyncGetMediaInformationExecute:(MediaInformationSession*)mediaInformationSession onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout;
|
||||
|
||||
/**
|
||||
* <p>Sets a global log delegate to redirect FFmpeg/FFprobe logs.
|
||||
* <p>Sets a global log callback to redirect FFmpeg/FFprobe logs.
|
||||
*
|
||||
* @param logDelegate log delegate or nil to disable a previously defined log delegate
|
||||
* @param logCallback log callback or nil to disable a previously defined log callback
|
||||
*/
|
||||
+ (void)enableLogDelegate:(id<LogDelegate>)logDelegate;
|
||||
+ (void)enableLogCallback:(LogCallback)logCallback;
|
||||
|
||||
/**
|
||||
* <p>Sets a global statistics delegate to redirect FFmpeg statistics.
|
||||
* <p>Sets a global statistics callback to redirect FFmpeg statistics.
|
||||
*
|
||||
* @param statisticsDelegate statistics delegate or nil to disable a previously defined statistics delegate
|
||||
* @param statisticsCallback statistics callback or nil to disable a previously defined statistics callback
|
||||
*/
|
||||
+ (void)enableStatisticsDelegate:(id<StatisticsDelegate>)statisticsDelegate;
|
||||
+ (void)enableStatisticsCallback:(StatisticsCallback)statisticsCallback;
|
||||
|
||||
/**
|
||||
* <p>Sets a global execute delegate to receive execution results.
|
||||
* <p>Sets a global execute callback to receive execution results.
|
||||
*
|
||||
* @param executeDelegate execute delegate or nil to disable a previously execute delegate
|
||||
* @param executeCallback execute callback or nil to disable a previously execute callback
|
||||
*/
|
||||
+ (void)enableExecuteDelegate:(id<ExecuteDelegate>)executeDelegate;
|
||||
+ (void)enableExecuteCallback:(ExecuteCallback)executeCallback;
|
||||
|
||||
/**
|
||||
* <p>Returns the global execute delegate.
|
||||
* <p>Returns the global execute callback.
|
||||
*
|
||||
* @return global execute delegate
|
||||
* @return global execute callback
|
||||
*/
|
||||
+ (id<ExecuteDelegate>)getExecuteDelegate;
|
||||
+ (ExecuteCallback)getExecuteCallback;
|
||||
|
||||
/**
|
||||
* Returns the current log level.
|
||||
@ -365,11 +365,11 @@ typedef NS_ENUM(NSUInteger, Signal) {
|
||||
+ (void)setLogRedirectionStrategy:(LogRedirectionStrategy)logRedirectionStrategy;
|
||||
|
||||
/**
|
||||
* <p>Returns the number of async messages that are not transmitted to the delegates for
|
||||
* <p>Returns the number of async messages that are not transmitted to the callbacks for
|
||||
* this session.
|
||||
*
|
||||
* @param sessionId id of the session
|
||||
* @return number of async messages that are not transmitted to the delegates for this session
|
||||
* @return number of async messages that are not transmitted to the callbacks for this session
|
||||
*/
|
||||
+ (int)messagesInTransmit:(long)sessionId;
|
||||
|
||||
|
@ -60,14 +60,14 @@ static atomic_int sessionInTransitMessageCountMap[SESSION_MAP_SIZE];
|
||||
|
||||
static dispatch_queue_t asyncDispatchQueue;
|
||||
|
||||
/** Holds delegate defined to redirect logs */
|
||||
static id<LogDelegate> logDelegate;
|
||||
/** Holds callback defined to redirect logs */
|
||||
static LogCallback logCallback;
|
||||
|
||||
/** Holds delegate defined to redirect statistics */
|
||||
static id<StatisticsDelegate> statisticsDelegate;
|
||||
/** Holds callback defined to redirect statistics */
|
||||
static StatisticsCallback statisticsCallback;
|
||||
|
||||
/** Holds delegate defined to redirect asynchronous execution results */
|
||||
static id<ExecuteDelegate> executeDelegate;
|
||||
/** Holds callback defined to redirect asynchronous execution results */
|
||||
static ExecuteCallback executeCallback;
|
||||
|
||||
static LogRedirectionStrategy globalLogRedirectionStrategy;
|
||||
|
||||
@ -364,8 +364,8 @@ void ffmpegkit_statistics_callback_function(int frameNumber, float fps, float qu
|
||||
void process_log(long sessionId, int levelValue, NSString* logMessage) {
|
||||
int activeLogLevel = av_log_get_level();
|
||||
Log* log = [[Log alloc] init:sessionId:levelValue:logMessage];
|
||||
BOOL globalDelegateDefined = false;
|
||||
BOOL sessionDelegateDefined = false;
|
||||
BOOL globalCallbackDefined = false;
|
||||
BOOL sessionCallbackDefined = false;
|
||||
LogRedirectionStrategy activeLogRedirectionStrategy = globalLogRedirectionStrategy;
|
||||
|
||||
// LevelAVLogStdErr logs are always redirected
|
||||
@ -379,29 +379,30 @@ void process_log(long sessionId, int levelValue, NSString* logMessage) {
|
||||
activeLogRedirectionStrategy = [session getLogRedirectionStrategy];
|
||||
[session addLog:log];
|
||||
|
||||
if ([session getLogDelegate] != nil) {
|
||||
sessionDelegateDefined = TRUE;
|
||||
LogCallback sessionLogCallback = [session getLogCallback];
|
||||
if (sessionLogCallback != nil) {
|
||||
sessionCallbackDefined = TRUE;
|
||||
|
||||
@try {
|
||||
// NOTIFY SESSION DELEGATE DEFINED
|
||||
[[session getLogDelegate] logCallback:log];
|
||||
// NOTIFY SESSION CALLBACK DEFINED
|
||||
sessionLogCallback(log);
|
||||
}
|
||||
@catch(NSException* exception) {
|
||||
NSLog(@"Exception thrown inside session LogDelegate block. %@", [exception callStackSymbols]);
|
||||
NSLog(@"Exception thrown inside session LogCallback block. %@", [exception callStackSymbols]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
id<LogDelegate> activeLogDelegate = logDelegate;
|
||||
if (activeLogDelegate != nil) {
|
||||
globalDelegateDefined = TRUE;
|
||||
LogCallback globalLogCallback = logCallback;
|
||||
if (globalLogCallback != nil) {
|
||||
globalCallbackDefined = TRUE;
|
||||
|
||||
@try {
|
||||
// NOTIFY GLOBAL DELEGATE DEFINED
|
||||
[activeLogDelegate logCallback:log];
|
||||
// NOTIFY GLOBAL CALLBACK DEFINED
|
||||
globalLogCallback(log);
|
||||
}
|
||||
@catch(NSException* exception) {
|
||||
NSLog(@"Exception thrown inside global LogDelegate block. %@", [exception callStackSymbols]);
|
||||
NSLog(@"Exception thrown inside global LogCallback block. %@", [exception callStackSymbols]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -410,19 +411,19 @@ void process_log(long sessionId, int levelValue, NSString* logMessage) {
|
||||
case LogRedirectionStrategyNeverPrintLogs: {
|
||||
return;
|
||||
}
|
||||
case LogRedirectionStrategyPrintLogsWhenGlobalDelegateNotDefined: {
|
||||
if (globalDelegateDefined) {
|
||||
case LogRedirectionStrategyPrintLogsWhenGlobalCallbackNotDefined: {
|
||||
if (globalCallbackDefined) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LogRedirectionStrategyPrintLogsWhenSessionDelegateNotDefined: {
|
||||
if (sessionDelegateDefined) {
|
||||
case LogRedirectionStrategyPrintLogsWhenSessionCallbackNotDefined: {
|
||||
if (sessionCallbackDefined) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
case LogRedirectionStrategyPrintLogsWhenNoDelegatesDefined: {
|
||||
if (globalDelegateDefined || sessionDelegateDefined) {
|
||||
case LogRedirectionStrategyPrintLogsWhenNoCallbacksDefined: {
|
||||
if (globalCallbackDefined || sessionCallbackDefined) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -451,29 +452,30 @@ void process_statistics(long sessionId, int videoFrameNumber, float videoFps, fl
|
||||
FFmpegSession *ffmpegSession = (FFmpegSession*)session;
|
||||
[ffmpegSession addStatistics:statistics];
|
||||
|
||||
if ([ffmpegSession getStatisticsDelegate] != nil) {
|
||||
StatisticsCallback sessionStatisticsCallback = [ffmpegSession getStatisticsCallback];
|
||||
if (sessionStatisticsCallback != nil) {
|
||||
@try {
|
||||
[[ffmpegSession getStatisticsDelegate] statisticsCallback:statistics];
|
||||
sessionStatisticsCallback(statistics);
|
||||
}
|
||||
@catch(NSException* exception) {
|
||||
NSLog(@"Exception thrown inside session StatisticsDelegate block. %@", [exception callStackSymbols]);
|
||||
NSLog(@"Exception thrown inside session StatisticsCallback block. %@", [exception callStackSymbols]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
id<StatisticsDelegate> activeStatisticsDelegate = statisticsDelegate;
|
||||
if (activeStatisticsDelegate != nil) {
|
||||
StatisticsCallback globalStatisticsCallback = statisticsCallback;
|
||||
if (globalStatisticsCallback != nil) {
|
||||
@try {
|
||||
[activeStatisticsDelegate statisticsCallback:statistics];
|
||||
globalStatisticsCallback(statistics);
|
||||
}
|
||||
@catch(NSException* exception) {
|
||||
NSLog(@"Exception thrown inside global StatisticsDelegate block. %@", [exception callStackSymbols]);
|
||||
NSLog(@"Exception thrown inside global StatisticsCallback block. %@", [exception callStackSymbols]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Forwards asynchronous messages to Delegates.
|
||||
* Forwards asynchronous messages to Callbacks.
|
||||
*/
|
||||
void callbackBlockFunction() {
|
||||
int activeLogLevel = av_log_get_level();
|
||||
@ -624,11 +626,11 @@ int executeFFprobe(long sessionId, NSArray* arguments) {
|
||||
|
||||
asyncDispatchQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
|
||||
|
||||
logDelegate = nil;
|
||||
statisticsDelegate = nil;
|
||||
executeDelegate = nil;
|
||||
logCallback = nil;
|
||||
statisticsCallback = nil;
|
||||
executeCallback = nil;
|
||||
|
||||
globalLogRedirectionStrategy = LogRedirectionStrategyPrintLogsWhenNoDelegatesDefined;
|
||||
globalLogRedirectionStrategy = LogRedirectionStrategyPrintLogsWhenNoCallbacksDefined;
|
||||
|
||||
redirectionEnabled = 0;
|
||||
lock = [[NSRecursiveLock alloc] init];
|
||||
@ -885,14 +887,14 @@ int executeFFprobe(long sessionId, NSArray* arguments) {
|
||||
+ (void)asyncFFmpegExecute:(FFmpegSession*)ffmpegSession onDispatchQueue:(dispatch_queue_t)queue {
|
||||
dispatch_async(queue, ^{
|
||||
[FFmpegKitConfig ffmpegExecute:ffmpegSession];
|
||||
id<ExecuteDelegate> globalExecuteDelegate = [FFmpegKitConfig getExecuteDelegate];
|
||||
if (globalExecuteDelegate != nil) {
|
||||
[globalExecuteDelegate executeCallback:ffmpegSession];
|
||||
ExecuteCallback globalExecuteCallback = [FFmpegKitConfig getExecuteCallback];
|
||||
if (globalExecuteCallback != nil) {
|
||||
globalExecuteCallback(ffmpegSession);
|
||||
}
|
||||
|
||||
id<ExecuteDelegate> executeDelegate = [ffmpegSession getExecuteDelegate];
|
||||
if (executeDelegate != nil) {
|
||||
[executeDelegate executeCallback:ffmpegSession];
|
||||
ExecuteCallback sessionExecuteCallback = [ffmpegSession getExecuteCallback];
|
||||
if (sessionExecuteCallback != nil) {
|
||||
sessionExecuteCallback(ffmpegSession);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -904,14 +906,14 @@ int executeFFprobe(long sessionId, NSArray* arguments) {
|
||||
+ (void)asyncFFprobeExecute:(FFprobeSession*)ffprobeSession onDispatchQueue:(dispatch_queue_t)queue {
|
||||
dispatch_async(queue, ^{
|
||||
[FFmpegKitConfig ffprobeExecute:ffprobeSession];
|
||||
id<ExecuteDelegate> globalExecuteDelegate = [FFmpegKitConfig getExecuteDelegate];
|
||||
if (globalExecuteDelegate != nil) {
|
||||
[globalExecuteDelegate executeCallback:ffprobeSession];
|
||||
ExecuteCallback globalExecuteCallback = [FFmpegKitConfig getExecuteCallback];
|
||||
if (globalExecuteCallback != nil) {
|
||||
globalExecuteCallback(ffprobeSession);
|
||||
}
|
||||
|
||||
id<ExecuteDelegate> executeDelegate = [ffprobeSession getExecuteDelegate];
|
||||
if (executeDelegate != nil) {
|
||||
[executeDelegate executeCallback:ffprobeSession];
|
||||
ExecuteCallback sessionExecuteCallback = [ffprobeSession getExecuteCallback];
|
||||
if (sessionExecuteCallback != nil) {
|
||||
sessionExecuteCallback(ffprobeSession);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -923,32 +925,32 @@ int executeFFprobe(long sessionId, NSArray* arguments) {
|
||||
+ (void)asyncGetMediaInformationExecute:(MediaInformationSession*)mediaInformationSession onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout {
|
||||
dispatch_async(queue, ^{
|
||||
[FFmpegKitConfig getMediaInformationExecute:mediaInformationSession withTimeout:waitTimeout];
|
||||
id<ExecuteDelegate> globalExecuteDelegate = [FFmpegKitConfig getExecuteDelegate];
|
||||
if (globalExecuteDelegate != nil) {
|
||||
[globalExecuteDelegate executeCallback:mediaInformationSession];
|
||||
ExecuteCallback globalExecuteCallback = [FFmpegKitConfig getExecuteCallback];
|
||||
if (globalExecuteCallback != nil) {
|
||||
globalExecuteCallback(mediaInformationSession);
|
||||
}
|
||||
|
||||
id<ExecuteDelegate> executeDelegate = [mediaInformationSession getExecuteDelegate];
|
||||
if (executeDelegate != nil) {
|
||||
[executeDelegate executeCallback:mediaInformationSession];
|
||||
ExecuteCallback sessionExecuteCallback = [mediaInformationSession getExecuteCallback];
|
||||
if (sessionExecuteCallback != nil) {
|
||||
sessionExecuteCallback(mediaInformationSession);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+ (void)enableLogDelegate:(id<LogDelegate>)delegate {
|
||||
logDelegate = delegate;
|
||||
+ (void)enableLogCallback:(LogCallback)callback {
|
||||
logCallback = callback;
|
||||
}
|
||||
|
||||
+ (void)enableStatisticsDelegate:(id<StatisticsDelegate>)delegate {
|
||||
statisticsDelegate = delegate;
|
||||
+ (void)enableStatisticsCallback:(StatisticsCallback)callback {
|
||||
statisticsCallback = callback;
|
||||
}
|
||||
|
||||
+ (void)enableExecuteDelegate:(id<ExecuteDelegate>)delegate {
|
||||
executeDelegate = delegate;
|
||||
+ (void)enableExecuteCallback:(ExecuteCallback)callback {
|
||||
executeCallback = callback;
|
||||
}
|
||||
|
||||
+ (id<ExecuteDelegate>)getExecuteDelegate {
|
||||
return executeDelegate;
|
||||
+ (ExecuteCallback)getExecuteCallback {
|
||||
return executeCallback;
|
||||
}
|
||||
|
||||
+ (int)getLogLevel {
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "AbstractSession.h"
|
||||
#import "StatisticsDelegate.h"
|
||||
#import "StatisticsCallback.h"
|
||||
|
||||
/**
|
||||
* <p>An FFmpeg session.
|
||||
@ -40,37 +40,37 @@
|
||||
* Builds a new FFmpeg session.
|
||||
*
|
||||
* @param arguments command arguments
|
||||
* @param executeDelegate session specific execute delegate
|
||||
* @param executeCallback session specific execute callback
|
||||
*/
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate;
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback;
|
||||
|
||||
/**
|
||||
* Builds a new FFmpeg session.
|
||||
*
|
||||
* @param arguments command arguments
|
||||
* @param executeDelegate session specific execute delegate
|
||||
* @param logDelegate session specific log delegate
|
||||
* @param statisticsDelegate session specific statistics delegate
|
||||
* @param executeCallback session specific execute callback
|
||||
* @param logCallback session specific log callback
|
||||
* @param statisticsCallback session specific statistics callback
|
||||
*/
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate withStatisticsDelegate:(id<StatisticsDelegate>)statisticsDelegate;
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback;
|
||||
|
||||
/**
|
||||
* Builds a new FFmpeg session.
|
||||
*
|
||||
* @param arguments command arguments
|
||||
* @param executeDelegate session specific execute delegate
|
||||
* @param logDelegate session specific log delegate
|
||||
* @param statisticsDelegate session specific statistics delegate
|
||||
* @param executeCallback session specific execute callback
|
||||
* @param logCallback session specific log callback
|
||||
* @param statisticsCallback session specific statistics callback
|
||||
* @param logRedirectionStrategy session specific log redirection strategy
|
||||
*/
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate withStatisticsDelegate:(id<StatisticsDelegate>)statisticsDelegate withLogRedirectionStrategy:(LogRedirectionStrategy)logRedirectionStrategy;
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback withLogRedirectionStrategy:(LogRedirectionStrategy)logRedirectionStrategy;
|
||||
|
||||
/**
|
||||
* Returns the session specific statistics delegate.
|
||||
* Returns the session specific statistics callback.
|
||||
*
|
||||
* @return session specific statistics delegate
|
||||
* @return session specific statistics callback
|
||||
*/
|
||||
- (id<StatisticsDelegate>)getStatisticsDelegate;
|
||||
- (StatisticsCallback)getStatisticsCallback;
|
||||
|
||||
/**
|
||||
* Returns all statistics entries generated for this session. If there are asynchronous
|
||||
|
@ -17,24 +17,24 @@
|
||||
* along with FFmpegKit. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#import "ExecuteDelegate.h"
|
||||
#import "ExecuteCallback.h"
|
||||
#import "FFmpegSession.h"
|
||||
#import "FFmpegKitConfig.h"
|
||||
#import "LogDelegate.h"
|
||||
#import "StatisticsDelegate.h"
|
||||
#import "LogCallback.h"
|
||||
#import "StatisticsCallback.h"
|
||||
|
||||
@implementation FFmpegSession {
|
||||
id<StatisticsDelegate> _statisticsDelegate;
|
||||
StatisticsCallback _statisticsCallback;
|
||||
NSMutableArray* _statistics;
|
||||
NSRecursiveLock* _statisticsLock;
|
||||
}
|
||||
|
||||
- (instancetype)init:(NSArray*)arguments {
|
||||
|
||||
self = [super init:arguments withExecuteDelegate:nil withLogDelegate:nil withLogRedirectionStrategy:[FFmpegKitConfig getLogRedirectionStrategy]];
|
||||
self = [super init:arguments withExecuteCallback:nil withLogCallback:nil withLogRedirectionStrategy:[FFmpegKitConfig getLogRedirectionStrategy]];
|
||||
|
||||
if (self) {
|
||||
_statisticsDelegate = nil;
|
||||
_statisticsCallback = nil;
|
||||
_statistics = [[NSMutableArray alloc] init];
|
||||
_statisticsLock = [[NSRecursiveLock alloc] init];
|
||||
}
|
||||
@ -42,12 +42,12 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate {
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback {
|
||||
|
||||
self = [super init:arguments withExecuteDelegate:executeDelegate withLogDelegate:nil withLogRedirectionStrategy:[FFmpegKitConfig getLogRedirectionStrategy]];
|
||||
self = [super init:arguments withExecuteCallback:executeCallback withLogCallback:nil withLogRedirectionStrategy:[FFmpegKitConfig getLogRedirectionStrategy]];
|
||||
|
||||
if (self) {
|
||||
_statisticsDelegate = nil;
|
||||
_statisticsCallback = nil;
|
||||
_statistics = [[NSMutableArray alloc] init];
|
||||
_statisticsLock = [[NSRecursiveLock alloc] init];
|
||||
}
|
||||
@ -55,12 +55,12 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate withStatisticsDelegate:(id<StatisticsDelegate>)statisticsDelegate {
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback {
|
||||
|
||||
self = [super init:arguments withExecuteDelegate:executeDelegate withLogDelegate:logDelegate withLogRedirectionStrategy:[FFmpegKitConfig getLogRedirectionStrategy]];
|
||||
self = [super init:arguments withExecuteCallback:executeCallback withLogCallback:logCallback withLogRedirectionStrategy:[FFmpegKitConfig getLogRedirectionStrategy]];
|
||||
|
||||
if (self) {
|
||||
_statisticsDelegate = statisticsDelegate;
|
||||
_statisticsCallback = statisticsCallback;
|
||||
_statistics = [[NSMutableArray alloc] init];
|
||||
_statisticsLock = [[NSRecursiveLock alloc] init];
|
||||
}
|
||||
@ -68,12 +68,12 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate withStatisticsDelegate:(id<StatisticsDelegate>)statisticsDelegate withLogRedirectionStrategy:(LogRedirectionStrategy)logRedirectionStrategy {
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback withLogRedirectionStrategy:(LogRedirectionStrategy)logRedirectionStrategy {
|
||||
|
||||
self = [super init:arguments withExecuteDelegate:executeDelegate withLogDelegate:logDelegate withLogRedirectionStrategy:logRedirectionStrategy];
|
||||
self = [super init:arguments withExecuteCallback:executeCallback withLogCallback:logCallback withLogRedirectionStrategy:logRedirectionStrategy];
|
||||
|
||||
if (self) {
|
||||
_statisticsDelegate = statisticsDelegate;
|
||||
_statisticsCallback = statisticsCallback;
|
||||
_statistics = [[NSMutableArray alloc] init];
|
||||
_statisticsLock = [[NSRecursiveLock alloc] init];
|
||||
}
|
||||
@ -81,8 +81,8 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id<StatisticsDelegate>)getStatisticsDelegate {
|
||||
return _statisticsDelegate;
|
||||
- (StatisticsCallback)getStatisticsCallback {
|
||||
return _statisticsCallback;
|
||||
}
|
||||
|
||||
- (NSArray*)getAllStatisticsWithTimeout:(int)waitTimeout {
|
||||
|
@ -32,11 +32,11 @@
|
||||
* <pre>
|
||||
* FFprobeSession *session = [FFprobeKit execute:@"-hide_banner -v error -show_entries format=size -of default=noprint_wrappers=1 file1.mp4"];
|
||||
*
|
||||
* FFprobeSession *asyncSession = [FFprobeKit executeAsync:@"-hide_banner -v error -show_entries format=size -of default=noprint_wrappers=1 file1.mp4" withExecuteDelegate:executeDelegate];
|
||||
* FFprobeSession *asyncSession = [FFprobeKit executeAsync:@"-hide_banner -v error -show_entries format=size -of default=noprint_wrappers=1 file1.mp4" withExecuteCallback:executeCallback];
|
||||
* </pre>
|
||||
* <p>Provides overloaded <code>execute</code> methods to define session specific delegates.
|
||||
* <p>Provides overloaded <code>execute</code> methods to define session specific callbacks.
|
||||
* <pre>
|
||||
* FFprobeSession *session = [FFprobeKit executeAsync:@"-hide_banner -v error -show_entries format=size -of default=noprint_wrappers=1 file1.mp4" withExecuteDelegate:executeDelegate withLogDelegate:logDelegate];
|
||||
* FFprobeSession *session = [FFprobeKit executeAsync:@"-hide_banner -v error -show_entries format=size -of default=noprint_wrappers=1 file1.mp4" withExecuteCallback:executeCallback withLogCallback:logCallback];
|
||||
* </pre>
|
||||
* <p>It can extract media information for a file or a url, using getMediaInformation method.
|
||||
* <pre>
|
||||
@ -57,41 +57,41 @@
|
||||
* <p>Asynchronously executes FFprobe with arguments provided.
|
||||
*
|
||||
* @param arguments FFprobe command options/arguments as string array
|
||||
* @param executeDelegate delegate that will be called when the execution is completed
|
||||
* @param executeCallback callback that will be called when the execution is completed
|
||||
* @return FFprobe session created for this execution
|
||||
*/
|
||||
+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate;
|
||||
+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback;
|
||||
|
||||
/**
|
||||
* <p>Asynchronously executes FFprobe with arguments provided.
|
||||
*
|
||||
* @param arguments FFprobe command options/arguments as string array
|
||||
* @param executeDelegate delegate that will be notified when execution is completed
|
||||
* @param logDelegate delegate that will receive logs
|
||||
* @param executeCallback callback that will be notified when execution is completed
|
||||
* @param logCallback callback that will receive logs
|
||||
* @return FFprobe session created for this execution
|
||||
*/
|
||||
+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate;
|
||||
+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback;
|
||||
|
||||
/**
|
||||
* <p>Asynchronously executes FFprobe with arguments provided.
|
||||
*
|
||||
* @param arguments FFprobe command options/arguments as string array
|
||||
* @param executeDelegate delegate that will be called when the execution is completed
|
||||
* @param executeCallback callback that will be called when the execution is completed
|
||||
* @param queue dispatch queue that will be used to run this asynchronous operation
|
||||
* @return FFprobe session created for this execution
|
||||
*/
|
||||
+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate onDispatchQueue:(dispatch_queue_t)queue;
|
||||
+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback onDispatchQueue:(dispatch_queue_t)queue;
|
||||
|
||||
/**
|
||||
* <p>Asynchronously executes FFprobe with arguments provided.
|
||||
*
|
||||
* @param arguments FFprobe command options/arguments as string array
|
||||
* @param executeDelegate delegate that will be notified when execution is completed
|
||||
* @param logDelegate delegate that will receive logs
|
||||
* @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
|
||||
* @return FFprobe session created for this execution
|
||||
*/
|
||||
+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate onDispatchQueue:(dispatch_queue_t)queue;
|
||||
+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue;
|
||||
|
||||
/**
|
||||
* <p>Synchronously executes FFprobe command provided. Space character is used to split command
|
||||
@ -109,10 +109,10 @@
|
||||
* your command.
|
||||
*
|
||||
* @param command FFprobe command
|
||||
* @param executeDelegate delegate that will be called when the execution is completed
|
||||
* @param executeCallback callback that will be called when the execution is completed
|
||||
* @return FFprobe session created for this execution
|
||||
*/
|
||||
+ (FFprobeSession*)executeAsync:(NSString*)command withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate;
|
||||
+ (FFprobeSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback;
|
||||
|
||||
/**
|
||||
* <p>Asynchronously executes FFprobe command provided. Space character is used to split command
|
||||
@ -120,11 +120,11 @@
|
||||
* your command.
|
||||
*
|
||||
* @param command FFprobe command
|
||||
* @param executeDelegate delegate that will be notified when execution is completed
|
||||
* @param logDelegate delegate that will receive logs
|
||||
* @param executeCallback callback that will be notified when execution is completed
|
||||
* @param logCallback callback that will receive logs
|
||||
* @return FFprobe session created for this execution
|
||||
*/
|
||||
+ (FFprobeSession*)executeAsync:(NSString*)command withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate;
|
||||
+ (FFprobeSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback;
|
||||
|
||||
/**
|
||||
* <p>Asynchronously executes FFprobe command provided. Space character is used to split command
|
||||
@ -132,11 +132,11 @@
|
||||
* your command.
|
||||
*
|
||||
* @param command FFprobe command
|
||||
* @param executeDelegate delegate that will be called when the execution is completed
|
||||
* @param executeCallback callback that will be called when the execution is completed
|
||||
* @param queue dispatch queue that will be used to run this asynchronous operation
|
||||
* @return FFprobe session created for this execution
|
||||
*/
|
||||
+ (FFprobeSession*)executeAsync:(NSString*)command withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate onDispatchQueue:(dispatch_queue_t)queue;
|
||||
+ (FFprobeSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback onDispatchQueue:(dispatch_queue_t)queue;
|
||||
|
||||
/**
|
||||
* <p>Asynchronously executes FFprobe command provided. Space character is used to split command
|
||||
@ -144,12 +144,12 @@
|
||||
* your command.
|
||||
*
|
||||
* @param command FFprobe command
|
||||
* @param executeDelegate delegate that will be called when the execution is completed
|
||||
* @param logDelegate delegate that will receive logs
|
||||
* @param executeCallback callback that will be called when the execution is completed
|
||||
* @param logCallback callback that will receive logs
|
||||
* @param queue dispatch queue that will be used to run this asynchronous operation
|
||||
* @return FFprobe session created for this execution
|
||||
*/
|
||||
+ (FFprobeSession*)executeAsync:(NSString*)command withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate onDispatchQueue:(dispatch_queue_t)queue;
|
||||
+ (FFprobeSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue;
|
||||
|
||||
/**
|
||||
* <p>Extracts media information for the file specified with path.
|
||||
@ -172,43 +172,43 @@
|
||||
* <p>Extracts media information for the file specified with path asynchronously.
|
||||
*
|
||||
* @param path path or uri of a media file
|
||||
* @param executeDelegate delegate that will be called when the execution is completed
|
||||
* @param executeCallback callback that will be called when the execution is completed
|
||||
* @return media information session created for this execution
|
||||
*/
|
||||
+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate;
|
||||
+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withExecuteCallback:(ExecuteCallback)executeCallback;
|
||||
|
||||
/**
|
||||
* <p>Extracts media information for the file specified with path asynchronously.
|
||||
*
|
||||
* @param path path or uri of a media file
|
||||
* @param executeDelegate delegate that will be notified when execution is completed
|
||||
* @param logDelegate delegate that will receive logs
|
||||
* @param executeCallback callback that will be notified when execution is completed
|
||||
* @param logCallback callback that will receive logs
|
||||
* @param waitTimeout max time to wait until media information is transmitted
|
||||
* @return media information session created for this execution
|
||||
*/
|
||||
+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate withTimeout:(int)waitTimeout;
|
||||
+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withTimeout:(int)waitTimeout;
|
||||
|
||||
/**
|
||||
* <p>Extracts media information for the file specified with path asynchronously.
|
||||
*
|
||||
* @param path path or uri of a media file
|
||||
* @param executeDelegate delegate that will be called when the execution is completed
|
||||
* @param executeCallback callback that will be called when the execution is completed
|
||||
* @param queue dispatch queue that will be used to run this asynchronous operation
|
||||
* @return media information session created for this execution
|
||||
*/
|
||||
+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate onDispatchQueue:(dispatch_queue_t)queue;
|
||||
+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withExecuteCallback:(ExecuteCallback)executeCallback onDispatchQueue:(dispatch_queue_t)queue;
|
||||
|
||||
/**
|
||||
* <p>Extracts media information for the file specified with path asynchronously.
|
||||
*
|
||||
* @param path path or uri of a media file
|
||||
* @param executeDelegate delegate that will be notified when execution is completed
|
||||
* @param logDelegate delegate that will receive logs
|
||||
* @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*)getMediaInformationAsync:(NSString*)path withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout;
|
||||
+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout;
|
||||
|
||||
/**
|
||||
* <p>Extracts media information using the command provided asynchronously.
|
||||
@ -222,12 +222,12 @@
|
||||
* <p>Extracts media information using the command provided asynchronously.
|
||||
*
|
||||
* @param command FFprobe command that prints media information for a file in JSON format
|
||||
* @param executeDelegate delegate that will be notified when execution is completed
|
||||
* @param logDelegate delegate that will receive logs
|
||||
* @param executeCallback callback that will be notified when execution is completed
|
||||
* @param logCallback callback that will receive logs
|
||||
* @param waitTimeout max time to wait until media information is transmitted
|
||||
* @return media information session created for this execution
|
||||
*/
|
||||
+ (MediaInformationSession*)getMediaInformationFromCommandAsync:(NSString*)command withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate 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;
|
||||
|
||||
/**
|
||||
* <p>Lists all FFprobe sessions in the session history.
|
||||
|
@ -34,26 +34,26 @@
|
||||
return session;
|
||||
}
|
||||
|
||||
+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate {
|
||||
FFprobeSession* session = [[FFprobeSession alloc] init:arguments withExecuteDelegate:executeDelegate];
|
||||
+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback {
|
||||
FFprobeSession* session = [[FFprobeSession alloc] init:arguments withExecuteCallback:executeCallback];
|
||||
[FFmpegKitConfig asyncFFprobeExecute:session];
|
||||
return session;
|
||||
}
|
||||
|
||||
+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate {
|
||||
FFprobeSession* session = [[FFprobeSession alloc] init:arguments withExecuteDelegate:executeDelegate withLogDelegate:logDelegate];
|
||||
+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback {
|
||||
FFprobeSession* session = [[FFprobeSession alloc] init:arguments withExecuteCallback:executeCallback withLogCallback:logCallback];
|
||||
[FFmpegKitConfig asyncFFprobeExecute:session];
|
||||
return session;
|
||||
}
|
||||
|
||||
+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate onDispatchQueue:(dispatch_queue_t)queue {
|
||||
FFprobeSession* session = [[FFprobeSession alloc] init:arguments withExecuteDelegate:executeDelegate];
|
||||
+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback onDispatchQueue:(dispatch_queue_t)queue {
|
||||
FFprobeSession* session = [[FFprobeSession alloc] init:arguments withExecuteCallback:executeCallback];
|
||||
[FFmpegKitConfig asyncFFprobeExecute:session onDispatchQueue:queue];
|
||||
return session;
|
||||
}
|
||||
|
||||
+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate onDispatchQueue:(dispatch_queue_t)queue {
|
||||
FFprobeSession* session = [[FFprobeSession alloc] init:arguments withExecuteDelegate:executeDelegate withLogDelegate:logDelegate];
|
||||
+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue {
|
||||
FFprobeSession* session = [[FFprobeSession alloc] init:arguments withExecuteCallback:executeCallback withLogCallback:logCallback];
|
||||
[FFmpegKitConfig asyncFFprobeExecute:session onDispatchQueue:queue];
|
||||
return session;
|
||||
}
|
||||
@ -64,26 +64,26 @@
|
||||
return session;
|
||||
}
|
||||
|
||||
+ (FFprobeSession*)executeAsync:(NSString*)command withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate {
|
||||
FFprobeSession* session = [[FFprobeSession alloc] init:[FFmpegKit parseArguments:command] withExecuteDelegate:executeDelegate];
|
||||
+ (FFprobeSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback {
|
||||
FFprobeSession* session = [[FFprobeSession alloc] init:[FFmpegKit parseArguments:command] withExecuteCallback:executeCallback];
|
||||
[FFmpegKitConfig asyncFFprobeExecute:session];
|
||||
return session;
|
||||
}
|
||||
|
||||
+ (FFprobeSession*)executeAsync:(NSString*)command withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate {
|
||||
FFprobeSession* session = [[FFprobeSession alloc] init:[FFmpegKit parseArguments:command] withExecuteDelegate:executeDelegate withLogDelegate:logDelegate];
|
||||
+ (FFprobeSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback {
|
||||
FFprobeSession* session = [[FFprobeSession alloc] init:[FFmpegKit parseArguments:command] withExecuteCallback:executeCallback withLogCallback:logCallback];
|
||||
[FFmpegKitConfig asyncFFprobeExecute:session];
|
||||
return session;
|
||||
}
|
||||
|
||||
+ (FFprobeSession*)executeAsync:(NSString*)command withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate onDispatchQueue:(dispatch_queue_t)queue {
|
||||
FFprobeSession* session = [[FFprobeSession alloc] init:[FFmpegKit parseArguments:command] withExecuteDelegate:executeDelegate];
|
||||
+ (FFprobeSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback onDispatchQueue:(dispatch_queue_t)queue {
|
||||
FFprobeSession* session = [[FFprobeSession alloc] init:[FFmpegKit parseArguments:command] withExecuteCallback:executeCallback];
|
||||
[FFmpegKitConfig asyncFFprobeExecute:session onDispatchQueue:queue];
|
||||
return session;
|
||||
}
|
||||
|
||||
+ (FFprobeSession*)executeAsync:(NSString*)command withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate onDispatchQueue:(dispatch_queue_t)queue {
|
||||
FFprobeSession* session = [[FFprobeSession alloc] init:[FFmpegKit parseArguments:command] withExecuteDelegate:executeDelegate withLogDelegate:logDelegate];
|
||||
+ (FFprobeSession*)executeAsync:(NSString*)command withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue {
|
||||
FFprobeSession* session = [[FFprobeSession alloc] init:[FFmpegKit parseArguments:command] withExecuteCallback:executeCallback withLogCallback:logCallback];
|
||||
[FFmpegKitConfig asyncFFprobeExecute:session onDispatchQueue:queue];
|
||||
return session;
|
||||
}
|
||||
@ -102,30 +102,30 @@
|
||||
return session;
|
||||
}
|
||||
|
||||
+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate {
|
||||
+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withExecuteCallback:(ExecuteCallback)executeCallback {
|
||||
NSArray* arguments = [[NSArray alloc] initWithObjects:@"-v", @"error", @"-hide_banner", @"-print_format", @"json", @"-show_format", @"-show_streams", @"-i", path, nil];
|
||||
MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withExecuteDelegate:executeDelegate];
|
||||
MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withExecuteCallback:executeCallback];
|
||||
[FFmpegKitConfig asyncGetMediaInformationExecute:session withTimeout:AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit];
|
||||
return session;
|
||||
}
|
||||
|
||||
+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate withTimeout:(int)waitTimeout {
|
||||
+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withTimeout:(int)waitTimeout {
|
||||
NSArray* arguments = [[NSArray alloc] initWithObjects:@"-v", @"error", @"-hide_banner", @"-print_format", @"json", @"-show_format", @"-show_streams", @"-i", path, nil];
|
||||
MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withExecuteDelegate:executeDelegate withLogDelegate:logDelegate];
|
||||
MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withExecuteCallback:executeCallback withLogCallback:logCallback];
|
||||
[FFmpegKitConfig asyncGetMediaInformationExecute:session withTimeout:waitTimeout];
|
||||
return session;
|
||||
}
|
||||
|
||||
+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate onDispatchQueue:(dispatch_queue_t)queue {
|
||||
+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withExecuteCallback:(ExecuteCallback)executeCallback onDispatchQueue:(dispatch_queue_t)queue {
|
||||
NSArray* arguments = [[NSArray alloc] initWithObjects:@"-v", @"error", @"-hide_banner", @"-print_format", @"json", @"-show_format", @"-show_streams", @"-i", path, nil];
|
||||
MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withExecuteDelegate:executeDelegate];
|
||||
MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withExecuteCallback:executeCallback];
|
||||
[FFmpegKitConfig asyncGetMediaInformationExecute:session onDispatchQueue:queue withTimeout:AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit];
|
||||
return session;
|
||||
}
|
||||
|
||||
+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout {
|
||||
+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout {
|
||||
NSArray* arguments = [[NSArray alloc] initWithObjects:@"-v", @"error", @"-hide_banner", @"-print_format", @"json", @"-show_format", @"-show_streams", @"-i", path, nil];
|
||||
MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withExecuteDelegate:executeDelegate];
|
||||
MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withExecuteCallback:executeCallback];
|
||||
[FFmpegKitConfig asyncGetMediaInformationExecute:session onDispatchQueue:queue withTimeout:waitTimeout];
|
||||
return session;
|
||||
}
|
||||
@ -136,8 +136,8 @@
|
||||
return session;
|
||||
}
|
||||
|
||||
+ (MediaInformationSession*)getMediaInformationFromCommandAsync:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout {
|
||||
MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withExecuteDelegate:executeDelegate withLogDelegate:logDelegate];
|
||||
+ (MediaInformationSession*)getMediaInformationFromCommandAsync:(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;
|
||||
}
|
||||
|
@ -39,28 +39,28 @@
|
||||
* Builds a new FFprobe session.
|
||||
*
|
||||
* @param arguments command arguments
|
||||
* @param executeDelegate session specific execute delegate
|
||||
* @param executeCallback session specific execute callback
|
||||
*/
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate;
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback;
|
||||
|
||||
/**
|
||||
* Builds a new FFprobe session.
|
||||
*
|
||||
* @param arguments command arguments
|
||||
* @param executeDelegate session specific execute delegate
|
||||
* @param logDelegate session specific log delegate
|
||||
* @param executeCallback session specific execute callback
|
||||
* @param logCallback session specific log callback
|
||||
*/
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate;
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback;
|
||||
|
||||
/**
|
||||
* Builds a new FFprobe session.
|
||||
*
|
||||
* @param arguments command arguments
|
||||
* @param executeDelegate session specific execute delegate
|
||||
* @param logDelegate session specific log delegate
|
||||
* @param executeCallback session specific execute callback
|
||||
* @param logCallback session specific log callback
|
||||
* @param logRedirectionStrategy session specific log redirection strategy
|
||||
*/
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate withLogRedirectionStrategy:(LogRedirectionStrategy)logRedirectionStrategy;
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withLogRedirectionStrategy:(LogRedirectionStrategy)logRedirectionStrategy;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -17,37 +17,37 @@
|
||||
* along with FFmpegKit. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#import "ExecuteDelegate.h"
|
||||
#import "ExecuteCallback.h"
|
||||
#import "FFprobeSession.h"
|
||||
#import "FFmpegKitConfig.h"
|
||||
#import "LogDelegate.h"
|
||||
#import "LogCallback.h"
|
||||
|
||||
@implementation FFprobeSession
|
||||
|
||||
- (instancetype)init:(NSArray*)arguments {
|
||||
|
||||
self = [super init:arguments withExecuteDelegate:nil withLogDelegate:nil withLogRedirectionStrategy:[FFmpegKitConfig getLogRedirectionStrategy]];
|
||||
self = [super init:arguments withExecuteCallback:nil withLogCallback:nil withLogRedirectionStrategy:[FFmpegKitConfig getLogRedirectionStrategy]];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate {
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback {
|
||||
|
||||
self = [super init:arguments withExecuteDelegate:executeDelegate withLogDelegate:nil withLogRedirectionStrategy:[FFmpegKitConfig getLogRedirectionStrategy]];
|
||||
self = [super init:arguments withExecuteCallback:executeCallback withLogCallback:nil withLogRedirectionStrategy:[FFmpegKitConfig getLogRedirectionStrategy]];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate {
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback {
|
||||
|
||||
self = [super init:arguments withExecuteDelegate:executeDelegate withLogDelegate:logDelegate withLogRedirectionStrategy:[FFmpegKitConfig getLogRedirectionStrategy]];
|
||||
self = [super init:arguments withExecuteCallback:executeCallback withLogCallback:logCallback withLogRedirectionStrategy:[FFmpegKitConfig getLogRedirectionStrategy]];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate withLogRedirectionStrategy:(LogRedirectionStrategy)logRedirectionStrategy {
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback withLogRedirectionStrategy:(LogRedirectionStrategy)logRedirectionStrategy {
|
||||
|
||||
self = [super init:arguments withExecuteDelegate:executeDelegate withLogDelegate:logDelegate withLogRedirectionStrategy:logRedirectionStrategy];
|
||||
self = [super init:arguments withExecuteCallback:executeCallback withLogCallback:logCallback withLogRedirectionStrategy:logRedirectionStrategy];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -17,25 +17,17 @@
|
||||
* along with FFmpegKit. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef FFMPEG_KIT_LOG_DELEGATE_H
|
||||
#define FFMPEG_KIT_LOG_DELEGATE_H
|
||||
#ifndef FFMPEG_KIT_LOG_CALLBACK_H
|
||||
#define FFMPEG_KIT_LOG_CALLBACK_H
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "Log.h"
|
||||
|
||||
/**
|
||||
* <p>Delegate that receives logs generated for <code>FFmpegKit</code> sessions.
|
||||
*/
|
||||
@protocol LogDelegate<NSObject>
|
||||
@required
|
||||
|
||||
/**
|
||||
* <p>Called when a log entry is received.
|
||||
* <p>Callback that receives logs generated for <code>FFmpegKit</code> sessions.
|
||||
*
|
||||
* @param log log entry
|
||||
*/
|
||||
- (void)logCallback:(Log*)log;
|
||||
typedef void (^LogCallback)(Log* log);
|
||||
|
||||
@end
|
||||
|
||||
#endif // FFMPEG_KIT_LOG_DELEGATE_H
|
||||
#endif // FFMPEG_KIT_LOG_CALLBACK_H
|
@ -22,9 +22,9 @@
|
||||
|
||||
typedef NS_ENUM(NSUInteger, LogRedirectionStrategy) {
|
||||
LogRedirectionStrategyAlwaysPrintLogs,
|
||||
LogRedirectionStrategyPrintLogsWhenNoDelegatesDefined,
|
||||
LogRedirectionStrategyPrintLogsWhenGlobalDelegateNotDefined,
|
||||
LogRedirectionStrategyPrintLogsWhenSessionDelegateNotDefined,
|
||||
LogRedirectionStrategyPrintLogsWhenNoCallbacksDefined,
|
||||
LogRedirectionStrategyPrintLogsWhenGlobalCallbackNotDefined,
|
||||
LogRedirectionStrategyPrintLogsWhenSessionCallbackNotDefined,
|
||||
LogRedirectionStrategyNeverPrintLogs
|
||||
};
|
||||
|
||||
|
@ -35,7 +35,7 @@ include_HEADERS = \
|
||||
AbstractSession.h \
|
||||
ArchDetect.h \
|
||||
AtomicLong.h \
|
||||
ExecuteDelegate.h \
|
||||
ExecuteCallback.h \
|
||||
FFmpegKit.h \
|
||||
FFmpegKitConfig.h \
|
||||
FFmpegSession.h \
|
||||
@ -43,7 +43,7 @@ include_HEADERS = \
|
||||
FFprobeSession.h \
|
||||
Level.h \
|
||||
Log.h \
|
||||
LogDelegate.h \
|
||||
LogCallback.h \
|
||||
LogRedirectionStrategy.h \
|
||||
MediaInformation.h \
|
||||
MediaInformationJsonParser.h \
|
||||
@ -53,7 +53,7 @@ include_HEADERS = \
|
||||
Session.h \
|
||||
SessionState.h \
|
||||
Statistics.h \
|
||||
StatisticsDelegate.h \
|
||||
StatisticsCallback.h \
|
||||
StreamInformation.h \
|
||||
ffmpegkit_exception.h \
|
||||
fftools_cmdutils.h \
|
||||
|
@ -411,7 +411,7 @@ include_HEADERS = \
|
||||
AbstractSession.h \
|
||||
ArchDetect.h \
|
||||
AtomicLong.h \
|
||||
ExecuteDelegate.h \
|
||||
ExecuteCallback.h \
|
||||
FFmpegKit.h \
|
||||
FFmpegKitConfig.h \
|
||||
FFmpegSession.h \
|
||||
@ -419,7 +419,7 @@ include_HEADERS = \
|
||||
FFprobeSession.h \
|
||||
Level.h \
|
||||
Log.h \
|
||||
LogDelegate.h \
|
||||
LogCallback.h \
|
||||
LogRedirectionStrategy.h \
|
||||
MediaInformation.h \
|
||||
MediaInformationJsonParser.h \
|
||||
@ -429,7 +429,7 @@ include_HEADERS = \
|
||||
Session.h \
|
||||
SessionState.h \
|
||||
Statistics.h \
|
||||
StatisticsDelegate.h \
|
||||
StatisticsCallback.h \
|
||||
StreamInformation.h \
|
||||
ffmpegkit_exception.h \
|
||||
fftools_cmdutils.h \
|
||||
|
@ -41,18 +41,18 @@
|
||||
* Creates a new media information session.
|
||||
*
|
||||
* @param arguments command arguments
|
||||
* @param executeDelegate session specific execute delegate
|
||||
* @param executeCallback session specific execute callback
|
||||
*/
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate;
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback;
|
||||
|
||||
/**
|
||||
* Creates a new media information session.
|
||||
*
|
||||
* @param arguments command arguments
|
||||
* @param executeDelegate session specific execute delegate
|
||||
* @param logDelegate session specific log delegate
|
||||
* @param executeCallback session specific execute callback
|
||||
* @param logCallback session specific log callback
|
||||
*/
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate;
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback;
|
||||
|
||||
/**
|
||||
* Returns the media information extracted in this session.
|
||||
|
@ -17,8 +17,8 @@
|
||||
* along with FFmpegKit. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#import "ExecuteDelegate.h"
|
||||
#import "LogDelegate.h"
|
||||
#import "ExecuteCallback.h"
|
||||
#import "LogCallback.h"
|
||||
#import "MediaInformation.h"
|
||||
#import "MediaInformationSession.h"
|
||||
|
||||
@ -28,21 +28,21 @@
|
||||
|
||||
- (instancetype)init:(NSArray*)arguments {
|
||||
|
||||
self = [super init:arguments withExecuteDelegate:nil withLogDelegate:nil withLogRedirectionStrategy:LogRedirectionStrategyNeverPrintLogs];
|
||||
self = [super init:arguments withExecuteCallback:nil withLogCallback:nil withLogRedirectionStrategy:LogRedirectionStrategyNeverPrintLogs];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate {
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback {
|
||||
|
||||
self = [super init:arguments withExecuteDelegate:executeDelegate withLogDelegate:nil withLogRedirectionStrategy:LogRedirectionStrategyNeverPrintLogs];
|
||||
self = [super init:arguments withExecuteCallback:executeCallback withLogCallback:nil withLogRedirectionStrategy:LogRedirectionStrategyNeverPrintLogs];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteDelegate:(id<ExecuteDelegate>)executeDelegate withLogDelegate:(id<LogDelegate>)logDelegate {
|
||||
- (instancetype)init:(NSArray*)arguments withExecuteCallback:(ExecuteCallback)executeCallback withLogCallback:(LogCallback)logCallback {
|
||||
|
||||
self = [super init:arguments withExecuteDelegate:executeDelegate withLogDelegate:logDelegate withLogRedirectionStrategy:LogRedirectionStrategyNeverPrintLogs];
|
||||
self = [super init:arguments withExecuteCallback:executeCallback withLogCallback:logCallback withLogRedirectionStrategy:LogRedirectionStrategyNeverPrintLogs];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -21,15 +21,13 @@
|
||||
#define FFMPEG_KIT_SESSION_H
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "ExecuteDelegate.h"
|
||||
#import "ExecuteCallback.h"
|
||||
#import "Log.h"
|
||||
#import "LogDelegate.h"
|
||||
#import "LogCallback.h"
|
||||
#import "LogRedirectionStrategy.h"
|
||||
#import "ReturnCode.h"
|
||||
#import "SessionState.h"
|
||||
|
||||
@protocol ExecuteDelegate;
|
||||
|
||||
/**
|
||||
* <p>Common interface for all <code>FFmpegKit</code> sessions.
|
||||
*/
|
||||
@ -38,18 +36,18 @@
|
||||
@required
|
||||
|
||||
/**
|
||||
* Returns the session specific execute delegate.
|
||||
* Returns the session specific execute callback.
|
||||
*
|
||||
* @return session specific execute delegate
|
||||
* @return session specific execute callback
|
||||
*/
|
||||
- (id<ExecuteDelegate>)getExecuteDelegate;
|
||||
- (ExecuteCallback)getExecuteCallback;
|
||||
|
||||
/**
|
||||
* Returns the session specific log delegate.
|
||||
* Returns the session specific log callback.
|
||||
*
|
||||
* @return session specific log delegate
|
||||
* @return session specific log callback
|
||||
*/
|
||||
- (id<LogDelegate>)getLogDelegate;
|
||||
- (LogCallback)getLogCallback;
|
||||
|
||||
/**
|
||||
* Returns the session identifier.
|
||||
|
@ -17,25 +17,17 @@
|
||||
* along with FFmpegKit. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef FFMPEG_KIT_STATISTICS_DELEGATE_H
|
||||
#define FFMPEG_KIT_STATISTICS_DELEGATE_H
|
||||
#ifndef FFMPEG_KIT_STATISTICS_CALLBACK_H
|
||||
#define FFMPEG_KIT_STATISTICS_CALLBACK_H
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "Statistics.h"
|
||||
|
||||
/**
|
||||
* <p>Delegate that receives statistics generated for <code>FFmpegKit</code> sessions.
|
||||
*/
|
||||
@protocol StatisticsDelegate<NSObject>
|
||||
@required
|
||||
|
||||
/**
|
||||
* <p>Called when a statistics entry is received.
|
||||
* <p>Callback that receives statistics generated for <code>FFmpegKit</code> sessions.
|
||||
*
|
||||
* @param statistics statistics entry
|
||||
*/
|
||||
- (void)statisticsCallback:(Statistics*)statistics;
|
||||
typedef void (^StatisticsCallback)(Statistics* statistics);
|
||||
|
||||
@end
|
||||
|
||||
#endif // FFMPEG_KIT_STATISTICS_DELEGATE_H
|
||||
#endif // FFMPEG_KIT_STATISTICS_CALLBACK_H
|
@ -1008,18 +1008,28 @@ build_modulemap() {
|
||||
cat >"${FILE_PATH}" <<EOF
|
||||
framework module ffmpegkit {
|
||||
|
||||
header "AbstractSession.h"
|
||||
header "ArchDetect.h"
|
||||
header "AtomicLong.h"
|
||||
header "ExecuteDelegate.h"
|
||||
header "FFmpegExecution.h"
|
||||
header "LogDelegate.h"
|
||||
header "MediaInformation.h"
|
||||
header "MediaInformationParser.h"
|
||||
header "ExecuteCallback.h"
|
||||
header "FFmpegKit.h"
|
||||
header "FFmpegKitConfig.h"
|
||||
header "FFmpegSession.h"
|
||||
header "FFprobeKit.h"
|
||||
header "FFprobeSession.h"
|
||||
header "Level.h"
|
||||
header "Log.h"
|
||||
header "LogCallback.h"
|
||||
header "LogRedirectionStrategy.h"
|
||||
header "MediaInformation.h"
|
||||
header "MediaInformationJsonParser.h"
|
||||
header "MediaInformationSession.h"
|
||||
header "Packages.h"
|
||||
header "ReturnCode.h"
|
||||
header "Session.h"
|
||||
header "SessionState.h"
|
||||
header "Statistics.h"
|
||||
header "StatisticsDelegate.h"
|
||||
header "StatisticsCallback.h"
|
||||
header "StreamInformation.h"
|
||||
header "ffmpegkit_exception.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user