| FFmpegKit iOS / macOS / tvOS API 6.0

Loading...
Searching...
No Matches
FFprobeKit.m
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020-2022 Taner Sener
3 *
4 * This file is part of FFmpegKit.
5 *
6 * FFmpegKit is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * FFmpegKit is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with FFmpegKit. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#import "fftools_ffmpeg.h"
21#import "FFmpegKit.h"
22#import "FFmpegKitConfig.h"
23#import "FFprobeKit.h"
24
25@implementation FFprobeKit
26
27+ (void)initialize {
28 [FFmpegKitConfig class];
29}
30
31+ (NSArray*)defaultGetMediaInformationCommandArguments:(NSString*)path {
32 return [[NSArray alloc] initWithObjects:@"-v", @"error", @"-hide_banner", @"-print_format", @"json", @"-show_format", @"-show_streams", @"-show_chapters", @"-i", path, nil];
33}
34
35+ (FFprobeSession*)executeWithArguments:(NSArray*)arguments {
36 FFprobeSession* session = [FFprobeSession create:arguments];
37 [FFmpegKitConfig ffprobeExecute:session];
38 return session;
39}
40
41+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback {
42 FFprobeSession* session = [FFprobeSession create:arguments withCompleteCallback:completeCallback];
43 [FFmpegKitConfig asyncFFprobeExecute:session];
44 return session;
45}
46
47+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback {
48 FFprobeSession* session = [FFprobeSession create:arguments withCompleteCallback:completeCallback withLogCallback:logCallback];
49 [FFmpegKitConfig asyncFFprobeExecute:session];
50 return session;
51}
52
53+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback onDispatchQueue:(dispatch_queue_t)queue {
54 FFprobeSession* session = [FFprobeSession create:arguments withCompleteCallback:completeCallback];
55 [FFmpegKitConfig asyncFFprobeExecute:session onDispatchQueue:queue];
56 return session;
57}
58
59+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue {
60 FFprobeSession* session = [FFprobeSession create:arguments withCompleteCallback:completeCallback withLogCallback:logCallback];
61 [FFmpegKitConfig asyncFFprobeExecute:session onDispatchQueue:queue];
62 return session;
63}
64
65+ (FFprobeSession*)execute:(NSString*)command {
66 FFprobeSession* session = [FFprobeSession create:[FFmpegKitConfig parseArguments:command]];
67 [FFmpegKitConfig ffprobeExecute:session];
68 return session;
69}
70
71+ (FFprobeSession*)executeAsync:(NSString*)command withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback {
72 FFprobeSession* session = [FFprobeSession create:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback];
73 [FFmpegKitConfig asyncFFprobeExecute:session];
74 return session;
75}
76
77+ (FFprobeSession*)executeAsync:(NSString*)command withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback {
78 FFprobeSession* session = [FFprobeSession create:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback withLogCallback:logCallback];
79 [FFmpegKitConfig asyncFFprobeExecute:session];
80 return session;
81}
82
83+ (FFprobeSession*)executeAsync:(NSString*)command withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback onDispatchQueue:(dispatch_queue_t)queue {
84 FFprobeSession* session = [FFprobeSession create:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback];
85 [FFmpegKitConfig asyncFFprobeExecute:session onDispatchQueue:queue];
86 return session;
87}
88
89+ (FFprobeSession*)executeAsync:(NSString*)command withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue {
90 FFprobeSession* session = [FFprobeSession create:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback withLogCallback:logCallback];
91 [FFmpegKitConfig asyncFFprobeExecute:session onDispatchQueue:queue];
92 return session;
93}
94
95+ (MediaInformationSession*)getMediaInformation:(NSString*)path {
96 NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path];
97 MediaInformationSession* session = [MediaInformationSession create:arguments];
98 [FFmpegKitConfig getMediaInformationExecute:session withTimeout:AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit];
99 return session;
100}
101
102+ (MediaInformationSession*)getMediaInformation:(NSString*)path withTimeout:(int)waitTimeout {
103 NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path];
104 MediaInformationSession* session = [MediaInformationSession create:arguments];
105 [FFmpegKitConfig getMediaInformationExecute:session withTimeout:waitTimeout];
106 return session;
107}
108
109+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback {
110 NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path];
111 MediaInformationSession* session = [MediaInformationSession create:arguments withCompleteCallback:completeCallback];
112 [FFmpegKitConfig asyncGetMediaInformationExecute:session withTimeout:AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit];
113 return session;
114}
115
116+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withTimeout:(int)waitTimeout {
117 NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path];
118 MediaInformationSession* session = [MediaInformationSession create:arguments withCompleteCallback:completeCallback withLogCallback:logCallback];
119 [FFmpegKitConfig asyncGetMediaInformationExecute:session withTimeout:waitTimeout];
120 return session;
121}
122
123+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback onDispatchQueue:(dispatch_queue_t)queue {
124 NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path];
125 MediaInformationSession* session = [MediaInformationSession create:arguments withCompleteCallback:completeCallback];
126 [FFmpegKitConfig asyncGetMediaInformationExecute:session onDispatchQueue:queue withTimeout:AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit];
127 return session;
128}
129
130+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout {
131 NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path];
132 MediaInformationSession* session = [MediaInformationSession create:arguments withCompleteCallback:completeCallback];
133 [FFmpegKitConfig asyncGetMediaInformationExecute:session onDispatchQueue:queue withTimeout:waitTimeout];
134 return session;
135}
136
137+ (MediaInformationSession*)getMediaInformationFromCommand:(NSString*)command {
138 MediaInformationSession* session = [MediaInformationSession create:[FFmpegKitConfig parseArguments:command]];
139 [FFmpegKitConfig getMediaInformationExecute:session withTimeout:AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit];
140 return session;
141}
142
143+ (MediaInformationSession*)getMediaInformationFromCommandAsync:(NSString*)command withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout {
144 MediaInformationSession* session = [MediaInformationSession create:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback withLogCallback:logCallback];
145 [FFmpegKitConfig asyncGetMediaInformationExecute:session onDispatchQueue:queue withTimeout:waitTimeout];
146 return session;
147}
148
149+ (MediaInformationSession*)getMediaInformationFromCommandArgumentsAsync:(NSArray*)arguments withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout {
150 MediaInformationSession* session = [MediaInformationSession create:arguments withCompleteCallback:completeCallback withLogCallback:logCallback];
151 [FFmpegKitConfig asyncGetMediaInformationExecute:session onDispatchQueue:queue withTimeout:waitTimeout];
152 return session;
153}
154
155+ (NSArray*)listFFprobeSessions {
156 return [FFmpegKitConfig getFFprobeSessions];
157}
158
159+ (NSArray*)listMediaInformationSessions {
160 return [FFmpegKitConfig getMediaInformationSessions];
161}
162
163@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