# FFmpegKit iOS / macOS / tvOS API: FFprobeKit.m Source File

Loading...
Searching...
No Matches
FFprobeKit.m
Go to the documentation of this file.
/*
* Copyright (c) 2020-2022 Taner Sener
*
* This file is part of FFmpegKit.
*
* FFmpegKit is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FFmpegKit is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with FFmpegKit. If not, see <http://www.gnu.org/licenses/>.
*/
#import "fftools_ffmpeg.h"
#import "FFmpegKit.h"
#import "FFmpegKitConfig.h"
#import "FFprobeKit.h"
@implementation FFprobeKit
+ (void)initialize {
[FFmpegKitConfig class];
}
+ (NSArray*)defaultGetMediaInformationCommandArguments:(NSString*)path {
return [[NSArray alloc] initWithObjects:@"-v", @"error", @"-hide_banner", @"-print_format", @"json", @"-show_format", @"-show_streams", @"-show_chapters", @"-i", path, nil];
}
+ (FFprobeSession*)executeWithArguments:(NSArray*)arguments {
FFprobeSession* session = [FFprobeSession create:arguments];
[FFmpegKitConfig ffprobeExecute:session];
return session;
}
+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback {
FFprobeSession* session = [FFprobeSession create:arguments withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncFFprobeExecute:session];
return session;
}
+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback {
FFprobeSession* session = [FFprobeSession create:arguments withCompleteCallback:completeCallback withLogCallback:logCallback];
[FFmpegKitConfig asyncFFprobeExecute:session];
return session;
}
+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback onDispatchQueue:(dispatch_queue_t)queue {
FFprobeSession* session = [FFprobeSession create:arguments withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncFFprobeExecute:session onDispatchQueue:queue];
return session;
}
+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue {
FFprobeSession* session = [FFprobeSession create:arguments withCompleteCallback:completeCallback withLogCallback:logCallback];
[FFmpegKitConfig asyncFFprobeExecute:session onDispatchQueue:queue];
return session;
}
+ (FFprobeSession*)execute:(NSString*)command {
FFprobeSession* session = [FFprobeSession create:[FFmpegKitConfig parseArguments:command]];
[FFmpegKitConfig ffprobeExecute:session];
return session;
}
+ (FFprobeSession*)executeAsync:(NSString*)command withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback {
FFprobeSession* session = [FFprobeSession create:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncFFprobeExecute:session];
return session;
}
+ (FFprobeSession*)executeAsync:(NSString*)command withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback {
FFprobeSession* session = [FFprobeSession create:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback withLogCallback:logCallback];
[FFmpegKitConfig asyncFFprobeExecute:session];
return session;
}
+ (FFprobeSession*)executeAsync:(NSString*)command withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback onDispatchQueue:(dispatch_queue_t)queue {
FFprobeSession* session = [FFprobeSession create:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncFFprobeExecute:session onDispatchQueue:queue];
return session;
}
+ (FFprobeSession*)executeAsync:(NSString*)command withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue {
FFprobeSession* session = [FFprobeSession create:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback withLogCallback:logCallback];
[FFmpegKitConfig asyncFFprobeExecute:session onDispatchQueue:queue];
return session;
}
+ (MediaInformationSession*)getMediaInformation:(NSString*)path {
NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path];
MediaInformationSession* session = [MediaInformationSession create:arguments];
[FFmpegKitConfig getMediaInformationExecute:session withTimeout:AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit];
return session;
}
+ (MediaInformationSession*)getMediaInformation:(NSString*)path withTimeout:(int)waitTimeout {
NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path];
MediaInformationSession* session = [MediaInformationSession create:arguments];
[FFmpegKitConfig getMediaInformationExecute:session withTimeout:waitTimeout];
return session;
}
+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback {
NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path];
MediaInformationSession* session = [MediaInformationSession create:arguments withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncGetMediaInformationExecute:session withTimeout:AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit];
return session;
}
+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withTimeout:(int)waitTimeout {
NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path];
MediaInformationSession* session = [MediaInformationSession create:arguments withCompleteCallback:completeCallback withLogCallback:logCallback];
[FFmpegKitConfig asyncGetMediaInformationExecute:session withTimeout:waitTimeout];
return session;
}
+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback onDispatchQueue:(dispatch_queue_t)queue {
NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path];
MediaInformationSession* session = [MediaInformationSession create:arguments withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncGetMediaInformationExecute:session onDispatchQueue:queue withTimeout:AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit];
return session;
}
+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout {
NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path];
MediaInformationSession* session = [MediaInformationSession create:arguments withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncGetMediaInformationExecute:session onDispatchQueue:queue withTimeout:waitTimeout];
return session;
}
+ (MediaInformationSession*)getMediaInformationFromCommand:(NSString*)command {
MediaInformationSession* session = [MediaInformationSession create:[FFmpegKitConfig parseArguments:command]];
[FFmpegKitConfig getMediaInformationExecute:session withTimeout:AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit];
return session;
}
+ (MediaInformationSession*)getMediaInformationFromCommandAsync:(NSString*)command withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout {
MediaInformationSession* session = [MediaInformationSession create:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback withLogCallback:logCallback];
[FFmpegKitConfig asyncGetMediaInformationExecute:session onDispatchQueue:queue withTimeout:waitTimeout];
return session;
}
+ (MediaInformationSession*)getMediaInformationFromCommandArgumentsAsync:(NSArray*)arguments withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout {
MediaInformationSession* session = [MediaInformationSession create:arguments withCompleteCallback:completeCallback withLogCallback:logCallback];
[FFmpegKitConfig asyncGetMediaInformationExecute:session onDispatchQueue:queue withTimeout:waitTimeout];
return session;
}
+ (NSArray*)listFFprobeSessions {
return [FFmpegKitConfig getFFprobeSessions];
}
+ (NSArray*)listMediaInformationSessions {
return [FFmpegKitConfig getMediaInformationSessions];
}
@end
FFmpegKit.h
FFmpegKitConfig.h
FFprobeKit.h
FFprobeSessionCompleteCallback
void(^ FFprobeSessionCompleteCallback)(FFprobeSession *session)
Definition FFprobeSessionCompleteCallback.h:46
LogCallback
void(^ LogCallback)(Log *log)
Definition LogCallback.h:31
MediaInformationSessionCompleteCallback
void(^ MediaInformationSessionCompleteCallback)(MediaInformationSession *session)
Definition MediaInformationSessionCompleteCallback.h:47
fftools_ffmpeg.h
FFmpegKitConfig
Definition FFmpegKitConfig.h:49
+[FFmpegKitConfig asyncGetMediaInformationExecute:withTimeout:]
void asyncGetMediaInformationExecute:withTimeout:(MediaInformationSession *mediaInformationSession,[withTimeout] int waitTimeout)
Definition FFmpegKitConfig.m:1087
+[FFmpegKitConfig getMediaInformationExecute:withTimeout:]
void getMediaInformationExecute:withTimeout:(MediaInformationSession *mediaInformationSession,[withTimeout] int waitTimeout)
Definition FFmpegKitConfig.m:998
+[FFmpegKitConfig ffprobeExecute:]
void ffprobeExecute:(FFprobeSession *ffprobeSession)
Definition FFmpegKitConfig.m:986
+[FFmpegKitConfig asyncFFprobeExecute:]
void asyncFFprobeExecute:(FFprobeSession *ffprobeSession)
Definition FFmpegKitConfig.m:1055
+[FFmpegKitConfig getFFprobeSessions]
NSArray * getFFprobeSessions()
Definition FFmpegKitConfig.m:1266
+[FFmpegKitConfig getMediaInformationSessions]
NSArray * getMediaInformationSessions()
Definition FFmpegKitConfig.m:1283
+[FFmpegKitConfig asyncFFprobeExecute:onDispatchQueue:]
void asyncFFprobeExecute:onDispatchQueue:(FFprobeSession *ffprobeSession,[onDispatchQueue] dispatch_queue_t queue)
Definition FFmpegKitConfig.m:1059
+[FFmpegKitConfig asyncGetMediaInformationExecute:onDispatchQueue:withTimeout:]
void asyncGetMediaInformationExecute:onDispatchQueue:withTimeout:(MediaInformationSession *mediaInformationSession,[onDispatchQueue] dispatch_queue_t queue,[withTimeout] int waitTimeout)
Definition FFmpegKitConfig.m:1091
+[FFmpegKitConfig parseArguments:]
NSArray * parseArguments:(NSString *command)
Definition FFmpegKitConfig.m:1339
FFprobeKit
Definition FFprobeKit.h:47
+[FFprobeKit initialize]
void initialize()
Definition FFprobeKit.m:27
+[FFprobeKit defaultGetMediaInformationCommandArguments:]
NSArray * defaultGetMediaInformationCommandArguments:(NSString *path)
Definition FFprobeKit.m:31
+[FFprobeKit listMediaInformationSessions]
NSArray * listMediaInformationSessions()
Definition FFprobeKit.m:159
+[FFprobeKit listFFprobeSessions]
NSArray * listFFprobeSessions()
Definition FFprobeKit.m:155
FFprobeSession
Definition FFprobeSession.h:31
+[FFprobeSession create:]
instancetype create:(NSArray *arguments)
Definition FFprobeSession.m:32
+[FFprobeSession create:withCompleteCallback:]
instancetype create:withCompleteCallback:(NSArray *arguments,[withCompleteCallback] FFprobeSessionCompleteCallback completeCallback)
Definition FFprobeSession.m:36
+[FFprobeSession create:withCompleteCallback:withLogCallback:]
instancetype create:withCompleteCallback:withLogCallback:(NSArray *arguments,[withCompleteCallback] FFprobeSessionCompleteCallback completeCallback,[withLogCallback] LogCallback logCallback)
Definition FFprobeSession.m:40
MediaInformationSession
Definition MediaInformationSession.h:33
+[MediaInformationSession create:withCompleteCallback:withLogCallback:]
instancetype create:withCompleteCallback:withLogCallback:(NSArray *arguments,[withCompleteCallback] MediaInformationSessionCompleteCallback completeCallback,[withLogCallback] LogCallback logCallback)
Definition MediaInformationSession.m:41
+[MediaInformationSession create:withCompleteCallback:]
instancetype create:withCompleteCallback:(NSArray *arguments,[withCompleteCallback] MediaInformationSessionCompleteCallback completeCallback)
Definition MediaInformationSession.m:37
+[MediaInformationSession create:]
instancetype create:(NSArray *arguments)
Definition MediaInformationSession.m:33