61
61
// EVENTS
62
62
static NSString *const EVENT_LOG_CALLBACK_EVENT = @" FFmpegKitLogCallbackEvent" ;
63
63
static NSString *const EVENT_STATISTICS_CALLBACK_EVENT = @" FFmpegKitStatisticsCallbackEvent" ;
64
- static NSString *const EVENT_EXECUTE_CALLBACK_EVENT = @" FFmpegKitExecuteCallbackEvent " ;
64
+ static NSString *const EVENT_COMPLETE_CALLBACK_EVENT = @" FFmpegKitCompleteCallbackEvent " ;
65
65
66
66
extern int const AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit;
67
67
@@ -91,15 +91,25 @@ - (instancetype)init {
91
91
92
92
[array addObject: EVENT_LOG_CALLBACK_EVENT];
93
93
[array addObject: EVENT_STATISTICS_CALLBACK_EVENT];
94
- [array addObject: EVENT_EXECUTE_CALLBACK_EVENT ];
94
+ [array addObject: EVENT_COMPLETE_CALLBACK_EVENT ];
95
95
96
96
return array;
97
97
}
98
98
99
99
- (void )registerGlobalCallbacks {
100
- [FFmpegKitConfig enableExecuteCallback : ^(id <Session> session){
100
+ [FFmpegKitConfig enableFFmpegSessionCompleteCallback : ^(FFmpegSession* session){
101
101
NSDictionary *dictionary = [FFmpegKitReactNativeModule toSessionDictionary: session];
102
- [self sendEventWithName: EVENT_EXECUTE_CALLBACK_EVENT body: dictionary];
102
+ [self sendEventWithName: EVENT_COMPLETE_CALLBACK_EVENT body: dictionary];
103
+ }];
104
+
105
+ [FFmpegKitConfig enableFFprobeSessionCompleteCallback: ^(FFprobeSession* session){
106
+ NSDictionary *dictionary = [FFmpegKitReactNativeModule toSessionDictionary: session];
107
+ [self sendEventWithName: EVENT_COMPLETE_CALLBACK_EVENT body: dictionary];
108
+ }];
109
+
110
+ [FFmpegKitConfig enableMediaInformationSessionCompleteCallback: ^(MediaInformationSession* session){
111
+ NSDictionary *dictionary = [FFmpegKitReactNativeModule toSessionDictionary: session];
112
+ [self sendEventWithName: EVENT_COMPLETE_CALLBACK_EVENT body: dictionary];
103
113
}];
104
114
105
115
[FFmpegKitConfig enableLogCallback: ^(Log* log ){
@@ -234,7 +244,7 @@ - (void)registerGlobalCallbacks {
234
244
// FFmpegSession
235
245
236
246
RCT_EXPORT_METHOD (ffmpegSession:(NSArray *)arguments resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
237
- FFmpegSession* session = [[FFmpegSession alloc ] init: arguments withExecuteCallback :nil withLogCallback: nil withStatisticsCallback: nil withLogRedirectionStrategy: LogRedirectionStrategyNeverPrintLogs];
247
+ FFmpegSession* session = [[FFmpegSession alloc ] init: arguments withCompleteCallback :nil withLogCallback: nil withStatisticsCallback: nil withLogRedirectionStrategy: LogRedirectionStrategyNeverPrintLogs];
238
248
resolve ([FFmpegKitReactNativeModule toSessionDictionary: session]);
239
249
}
240
250
@@ -243,7 +253,7 @@ - (void)registerGlobalCallbacks {
243
253
if (session == nil ) {
244
254
reject (@" SESSION_NOT_FOUND" , @" Session not found." , nil );
245
255
} else {
246
- if ([session isMemberOfClass: [FFmpegSession class ] ]) {
256
+ if ([session isFFmpeg ]) {
247
257
int timeout;
248
258
if ([FFmpegKitReactNativeModule isValidPositiveNumber: waitTimeout]) {
249
259
timeout = waitTimeout;
@@ -263,7 +273,7 @@ - (void)registerGlobalCallbacks {
263
273
if (session == nil ) {
264
274
reject (@" SESSION_NOT_FOUND" , @" Session not found." , nil );
265
275
} else {
266
- if ([session isMemberOfClass: [FFmpegSession class ] ]) {
276
+ if ([session isFFmpeg ]) {
267
277
NSArray * statistics = [(FFmpegSession*)session getStatistics ];
268
278
resolve ([FFmpegKitReactNativeModule toStatisticsArray: statistics]);
269
279
} else {
@@ -275,14 +285,14 @@ - (void)registerGlobalCallbacks {
275
285
// FFprobeSession
276
286
277
287
RCT_EXPORT_METHOD (ffprobeSession:(NSArray *)arguments resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
278
- FFprobeSession* session = [[FFprobeSession alloc ] init: arguments withExecuteCallback :nil withLogCallback: nil withLogRedirectionStrategy: LogRedirectionStrategyNeverPrintLogs];
288
+ FFprobeSession* session = [[FFprobeSession alloc ] init: arguments withCompleteCallback :nil withLogCallback: nil withLogRedirectionStrategy: LogRedirectionStrategyNeverPrintLogs];
279
289
resolve ([FFmpegKitReactNativeModule toSessionDictionary: session]);
280
290
}
281
291
282
292
// MediaInformationSession
283
293
284
294
RCT_EXPORT_METHOD (mediaInformationSession:(NSArray *)arguments resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
285
- MediaInformationSession* session = [[MediaInformationSession alloc ] init: arguments withExecuteCallback :nil withLogCallback: nil ];
295
+ MediaInformationSession* session = [[MediaInformationSession alloc ] init: arguments withCompleteCallback :nil withLogCallback: nil ];
286
296
resolve ([FFmpegKitReactNativeModule toSessionDictionary: session]);
287
297
}
288
298
@@ -409,7 +419,7 @@ - (void)registerGlobalCallbacks {
409
419
if (session == nil ) {
410
420
reject (@" SESSION_NOT_FOUND" , @" Session not found." , nil );
411
421
} else {
412
- if ([session isMemberOfClass: [FFmpegSession class ] ]) {
422
+ if ([session isFFmpeg ]) {
413
423
dispatch_async (asyncDispatchQueue, ^{
414
424
[FFmpegKitConfig ffmpegExecute: (FFmpegSession*)session];
415
425
resolve (nil );
@@ -425,7 +435,7 @@ - (void)registerGlobalCallbacks {
425
435
if (session == nil ) {
426
436
reject (@" SESSION_NOT_FOUND" , @" Session not found." , nil );
427
437
} else {
428
- if ([session isMemberOfClass: [FFprobeSession class ] ]) {
438
+ if ([session isFFprobe ]) {
429
439
dispatch_async (asyncDispatchQueue, ^{
430
440
[FFmpegKitConfig ffprobeExecute: (FFprobeSession*)session];
431
441
resolve (nil );
@@ -441,7 +451,7 @@ - (void)registerGlobalCallbacks {
441
451
if (session == nil ) {
442
452
reject (@" SESSION_NOT_FOUND" , @" Session not found." , nil );
443
453
} else {
444
- if ([session isMemberOfClass: [MediaInformationSession class ] ]) {
454
+ if ([session isMediaInformation ]) {
445
455
int timeout;
446
456
if ([FFmpegKitReactNativeModule isValidPositiveNumber: waitTimeout]) {
447
457
timeout = waitTimeout;
@@ -462,7 +472,7 @@ - (void)registerGlobalCallbacks {
462
472
if (session == nil ) {
463
473
reject (@" SESSION_NOT_FOUND" , @" Session not found." , nil );
464
474
} else {
465
- if ([session isMemberOfClass: [FFmpegSession class ] ]) {
475
+ if ([session isFFmpeg ]) {
466
476
[FFmpegKitConfig asyncFFmpegExecute: (FFmpegSession*)session];
467
477
resolve (nil );
468
478
} else {
@@ -476,7 +486,7 @@ - (void)registerGlobalCallbacks {
476
486
if (session == nil ) {
477
487
reject (@" SESSION_NOT_FOUND" , @" Session not found." , nil );
478
488
} else {
479
- if ([session isMemberOfClass: [FFprobeSession class ] ]) {
489
+ if ([session isFFprobe ]) {
480
490
[FFmpegKitConfig asyncFFprobeExecute: (FFprobeSession*)session];
481
491
resolve (nil );
482
492
} else {
@@ -490,7 +500,7 @@ - (void)registerGlobalCallbacks {
490
500
if (session == nil ) {
491
501
reject (@" SESSION_NOT_FOUND" , @" Session not found." , nil );
492
502
} else {
493
- if ([session isMemberOfClass: [MediaInformationSession class ] ]) {
503
+ if ([session isMediaInformation ]) {
494
504
int timeout;
495
505
if ([FFmpegKitReactNativeModule isValidPositiveNumber: waitTimeout]) {
496
506
timeout = waitTimeout;
@@ -652,7 +662,11 @@ - (void)registerGlobalCallbacks {
652
662
// FFprobeKit
653
663
654
664
RCT_EXPORT_METHOD (getFFprobeSessions:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
655
- resolve ([FFmpegKitReactNativeModule toSessionArray: [FFprobeKit listSessions ]]);
665
+ resolve ([FFmpegKitReactNativeModule toSessionArray: [FFprobeKit listFFprobeSessions ]]);
666
+ }
667
+
668
+ RCT_EXPORT_METHOD (getMediaInformationSessions:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
669
+ resolve ([FFmpegKitReactNativeModule toSessionArray: [FFprobeKit listMediaInformationSessions ]]);
656
670
}
657
671
658
672
// Packages
@@ -695,7 +709,7 @@ + (NSDictionary*)toSessionDictionary:(id<Session>) session {
695
709
dictionary[KEY_SESSION_COMMAND] = [session getCommand ];
696
710
697
711
if ([session isFFprobe ]) {
698
- if ([(AbstractSession*) session isMemberOfClass: [MediaInformationSession class ] ]) {
712
+ if ([session isMediaInformation ]) {
699
713
MediaInformationSession *mediaInformationSession = (MediaInformationSession*)session;
700
714
dictionary[KEY_SESSION_MEDIA_INFORMATION] = [FFmpegKitReactNativeModule toMediaInformationDictionary: [mediaInformationSession getMediaInformation ]];
701
715
dictionary[KEY_SESSION_TYPE] = [NSNumber numberWithInt: SESSION_TYPE_MEDIA_INFORMATION];
0 commit comments