refactor session create methods
This commit is contained in:
parent
fb8992a96c
commit
e0eab9ffa3
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2021 Taner Sener
|
* Copyright (c) 2018-2022 Taner Sener
|
||||||
*
|
*
|
||||||
* This file is part of FFmpegKit.
|
* This file is part of FFmpegKit.
|
||||||
*
|
*
|
||||||
|
@ -831,7 +831,7 @@ public class FFmpegKitFlutterPlugin implements FlutterPlugin, ActivityAware, Met
|
||||||
// FFmpegSession
|
// FFmpegSession
|
||||||
|
|
||||||
protected void ffmpegSession(@NonNull final List<String> arguments, @NonNull final Result result) {
|
protected void ffmpegSession(@NonNull final List<String> arguments, @NonNull final Result result) {
|
||||||
final FFmpegSession session = new FFmpegSession(arguments.toArray(new String[0]), null, null, null, LogRedirectionStrategy.NEVER_PRINT_LOGS);
|
final FFmpegSession session = FFmpegSession.create(arguments.toArray(new String[0]), null, null, null, LogRedirectionStrategy.NEVER_PRINT_LOGS);
|
||||||
resultHandler.successAsync(result, toMap(session));
|
resultHandler.successAsync(result, toMap(session));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -872,14 +872,14 @@ public class FFmpegKitFlutterPlugin implements FlutterPlugin, ActivityAware, Met
|
||||||
// FFprobeSession
|
// FFprobeSession
|
||||||
|
|
||||||
protected void ffprobeSession(@NonNull final List<String> arguments, @NonNull final Result result) {
|
protected void ffprobeSession(@NonNull final List<String> arguments, @NonNull final Result result) {
|
||||||
final FFprobeSession session = new FFprobeSession(arguments.toArray(new String[0]), null, null, LogRedirectionStrategy.NEVER_PRINT_LOGS);
|
final FFprobeSession session = FFprobeSession.create(arguments.toArray(new String[0]), null, null, LogRedirectionStrategy.NEVER_PRINT_LOGS);
|
||||||
resultHandler.successAsync(result, toMap(session));
|
resultHandler.successAsync(result, toMap(session));
|
||||||
}
|
}
|
||||||
|
|
||||||
// MediaInformationSession
|
// MediaInformationSession
|
||||||
|
|
||||||
protected void mediaInformationSession(@NonNull final List<String> arguments, @NonNull final Result result) {
|
protected void mediaInformationSession(@NonNull final List<String> arguments, @NonNull final Result result) {
|
||||||
final MediaInformationSession session = new MediaInformationSession(arguments.toArray(new String[0]), null, null);
|
final MediaInformationSession session = MediaInformationSession.create(arguments.toArray(new String[0]), null, null);
|
||||||
resultHandler.successAsync(result, toMap(session));
|
resultHandler.successAsync(result, toMap(session));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2021 Taner Sener
|
* Copyright (c) 2018-2022 Taner Sener
|
||||||
*
|
*
|
||||||
* This file is part of FFmpegKit.
|
* This file is part of FFmpegKit.
|
||||||
*
|
*
|
||||||
|
@ -573,7 +573,7 @@ extern int const AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit;
|
||||||
// FFmpegSession
|
// FFmpegSession
|
||||||
|
|
||||||
- (void)ffmpegSession:(NSArray*)arguments result:(FlutterResult)result {
|
- (void)ffmpegSession:(NSArray*)arguments result:(FlutterResult)result {
|
||||||
FFmpegSession* session = [[FFmpegSession alloc] init:arguments withCompleteCallback:nil withLogCallback:nil withStatisticsCallback:nil withLogRedirectionStrategy:LogRedirectionStrategyNeverPrintLogs];
|
FFmpegSession* session = [FFmpegSession create:arguments withCompleteCallback:nil withLogCallback:nil withStatisticsCallback:nil withLogRedirectionStrategy:LogRedirectionStrategyNeverPrintLogs];
|
||||||
result([FFmpegKitFlutterPlugin toSessionDictionary:session]);
|
result([FFmpegKitFlutterPlugin toSessionDictionary:session]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -614,14 +614,14 @@ extern int const AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit;
|
||||||
// FFprobeSession
|
// FFprobeSession
|
||||||
|
|
||||||
- (void)ffprobeSession:(NSArray*)arguments result:(FlutterResult)result {
|
- (void)ffprobeSession:(NSArray*)arguments result:(FlutterResult)result {
|
||||||
FFprobeSession* session = [[FFprobeSession alloc] init:arguments withCompleteCallback:nil withLogCallback:nil withLogRedirectionStrategy:LogRedirectionStrategyNeverPrintLogs];
|
FFprobeSession* session = [FFprobeSession create:arguments withCompleteCallback:nil withLogCallback:nil withLogRedirectionStrategy:LogRedirectionStrategyNeverPrintLogs];
|
||||||
result([FFmpegKitFlutterPlugin toSessionDictionary:session]);
|
result([FFmpegKitFlutterPlugin toSessionDictionary:session]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// MediaInformationSession
|
// MediaInformationSession
|
||||||
|
|
||||||
- (void)mediaInformationSession:(NSArray*)arguments result:(FlutterResult)result {
|
- (void)mediaInformationSession:(NSArray*)arguments result:(FlutterResult)result {
|
||||||
MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withCompleteCallback:nil withLogCallback:nil];
|
MediaInformationSession* session = [MediaInformationSession create:arguments withCompleteCallback:nil withLogCallback:nil];
|
||||||
result([FFmpegKitFlutterPlugin toSessionDictionary:session]);
|
result([FFmpegKitFlutterPlugin toSessionDictionary:session]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019-2021 Taner Sener
|
* Copyright (c) 2019-2022 Taner Sener
|
||||||
*
|
*
|
||||||
* This file is part of FFmpegKit.
|
* This file is part of FFmpegKit.
|
||||||
*
|
*
|
||||||
|
@ -35,7 +35,7 @@ import 'src/ffmpeg_kit_factory.dart';
|
||||||
|
|
||||||
/// Abstract session implementation which includes common features shared by
|
/// Abstract session implementation which includes common features shared by
|
||||||
/// "FFmpeg", "FFprobe" and "MediaInformation" sessions.
|
/// "FFmpeg", "FFprobe" and "MediaInformation" sessions.
|
||||||
class AbstractSession extends Session {
|
abstract class AbstractSession extends Session {
|
||||||
static FFmpegKitPlatform _platform = FFmpegKitPlatform.instance;
|
static FFmpegKitPlatform _platform = FFmpegKitPlatform.instance;
|
||||||
|
|
||||||
/// Defines how long default "getAll" methods wait, in milliseconds.
|
/// Defines how long default "getAll" methods wait, in milliseconds.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019-2021 Taner Sener
|
* Copyright (c) 2019-2022 Taner Sener
|
||||||
*
|
*
|
||||||
* This file is part of FFmpegKit.
|
* This file is part of FFmpegKit.
|
||||||
*
|
*
|
||||||
|
@ -49,11 +49,6 @@ class FFmpegSession extends AbstractSession {
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a new FFmpeg session from [sessionMap], which includes session
|
|
||||||
/// fields as map keys.
|
|
||||||
static FFmpegSession fromMap(Map<dynamic, dynamic> sessionMap) =>
|
|
||||||
AbstractSession.createFFmpegSessionFromMap(sessionMap);
|
|
||||||
|
|
||||||
/// Returns the session specific statistics callback.
|
/// Returns the session specific statistics callback.
|
||||||
StatisticsCallback? getStatisticsCallback() =>
|
StatisticsCallback? getStatisticsCallback() =>
|
||||||
FFmpegKitFactory.getStatisticsCallback(this.getSessionId());
|
FFmpegKitFactory.getStatisticsCallback(this.getSessionId());
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019-2021 Taner Sener
|
* Copyright (c) 2019-2022 Taner Sener
|
||||||
*
|
*
|
||||||
* This file is part of FFmpegKit.
|
* This file is part of FFmpegKit.
|
||||||
*
|
*
|
||||||
|
@ -41,11 +41,6 @@ class FFprobeSession extends AbstractSession {
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a new FFprobe session from [sessionMap], which includes session
|
|
||||||
/// fields as map keys.
|
|
||||||
static FFprobeSession fromMap(Map<dynamic, dynamic> sessionMap) =>
|
|
||||||
AbstractSession.createFFprobeSessionFromMap(sessionMap);
|
|
||||||
|
|
||||||
/// Returns the session specific complete callback.
|
/// Returns the session specific complete callback.
|
||||||
FFprobeSessionCompleteCallback? getCompleteCallback() =>
|
FFprobeSessionCompleteCallback? getCompleteCallback() =>
|
||||||
FFmpegKitFactory.getFFprobeSessionCompleteCallback(this.getSessionId());
|
FFmpegKitFactory.getFFprobeSessionCompleteCallback(this.getSessionId());
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019-2021 Taner Sener
|
* Copyright (c) 2019-2022 Taner Sener
|
||||||
*
|
*
|
||||||
* This file is part of FFmpegKit.
|
* This file is part of FFmpegKit.
|
||||||
*
|
*
|
||||||
|
@ -43,11 +43,6 @@ class MediaInformationSession extends AbstractSession {
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a new MediaInformation session from [sessionMap], which includes
|
|
||||||
/// session fields as map keys.
|
|
||||||
static MediaInformationSession fromMap(Map<dynamic, dynamic> sessionMap) =>
|
|
||||||
AbstractSession.createMediaInformationSessionFromMap(sessionMap);
|
|
||||||
|
|
||||||
/// Returns the media information extracted in this session.
|
/// Returns the media information extracted in this session.
|
||||||
MediaInformation? getMediaInformation() => this._mediaInformation;
|
MediaInformation? getMediaInformation() => this._mediaInformation;
|
||||||
|
|
||||||
|
|
|
@ -17,15 +17,13 @@
|
||||||
* along with FFmpegKit. If not, see <http://www.gnu.org/licenses/>.
|
* along with FFmpegKit. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import '../ffmpeg_session.dart';
|
import '../abstract_session.dart';
|
||||||
import '../ffmpeg_session_complete_callback.dart';
|
import '../ffmpeg_session_complete_callback.dart';
|
||||||
import '../ffprobe_session.dart';
|
|
||||||
import '../ffprobe_session_complete_callback.dart';
|
import '../ffprobe_session_complete_callback.dart';
|
||||||
import '../log.dart';
|
import '../log.dart';
|
||||||
import '../log_callback.dart';
|
import '../log_callback.dart';
|
||||||
import '../log_redirection_strategy.dart';
|
import '../log_redirection_strategy.dart';
|
||||||
import '../media_information.dart';
|
import '../media_information.dart';
|
||||||
import '../media_information_session.dart';
|
|
||||||
import '../media_information_session_complete_callback.dart';
|
import '../media_information_session_complete_callback.dart';
|
||||||
import '../session.dart';
|
import '../session.dart';
|
||||||
import '../statistics.dart';
|
import '../statistics.dart';
|
||||||
|
@ -66,12 +64,12 @@ class FFmpegKitFactory {
|
||||||
static Session mapToSession(Map<dynamic, dynamic> sessionMap) {
|
static Session mapToSession(Map<dynamic, dynamic> sessionMap) {
|
||||||
switch (sessionMap["type"]) {
|
switch (sessionMap["type"]) {
|
||||||
case 2:
|
case 2:
|
||||||
return FFprobeSession.fromMap(sessionMap);
|
return AbstractSession.createFFprobeSessionFromMap(sessionMap);
|
||||||
case 3:
|
case 3:
|
||||||
return MediaInformationSession.fromMap(sessionMap);
|
return AbstractSession.createMediaInformationSessionFromMap(sessionMap);
|
||||||
case 1:
|
case 1:
|
||||||
default:
|
default:
|
||||||
return FFmpegSession.fromMap(sessionMap);
|
return AbstractSession.createFFmpegSessionFromMap(sessionMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,12 +77,12 @@ class FFmpegKitFactory {
|
||||||
if (sessionMap != null) {
|
if (sessionMap != null) {
|
||||||
switch (sessionMap["type"]) {
|
switch (sessionMap["type"]) {
|
||||||
case 2:
|
case 2:
|
||||||
return FFprobeSession.fromMap(sessionMap);
|
return AbstractSession.createFFprobeSessionFromMap(sessionMap);
|
||||||
case 3:
|
case 3:
|
||||||
return MediaInformationSession.fromMap(sessionMap);
|
return AbstractSession.createMediaInformationSessionFromMap(sessionMap);
|
||||||
case 1:
|
case 1:
|
||||||
default:
|
default:
|
||||||
return FFmpegSession.fromMap(sessionMap);
|
return AbstractSession.createFFmpegSessionFromMap(sessionMap);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2021 Taner Sener
|
* Copyright (c) 2018-2022 Taner Sener
|
||||||
*
|
*
|
||||||
* This file is part of FFmpegKit.
|
* This file is part of FFmpegKit.
|
||||||
*
|
*
|
||||||
|
@ -573,7 +573,7 @@ extern int const AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit;
|
||||||
// FFmpegSession
|
// FFmpegSession
|
||||||
|
|
||||||
- (void)ffmpegSession:(NSArray*)arguments result:(FlutterResult)result {
|
- (void)ffmpegSession:(NSArray*)arguments result:(FlutterResult)result {
|
||||||
FFmpegSession* session = [[FFmpegSession alloc] init:arguments withCompleteCallback:nil withLogCallback:nil withStatisticsCallback:nil withLogRedirectionStrategy:LogRedirectionStrategyNeverPrintLogs];
|
FFmpegSession* session = [FFmpegSession create:arguments withCompleteCallback:nil withLogCallback:nil withStatisticsCallback:nil withLogRedirectionStrategy:LogRedirectionStrategyNeverPrintLogs];
|
||||||
result([FFmpegKitFlutterPlugin toSessionDictionary:session]);
|
result([FFmpegKitFlutterPlugin toSessionDictionary:session]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -614,14 +614,14 @@ extern int const AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit;
|
||||||
// FFprobeSession
|
// FFprobeSession
|
||||||
|
|
||||||
- (void)ffprobeSession:(NSArray*)arguments result:(FlutterResult)result {
|
- (void)ffprobeSession:(NSArray*)arguments result:(FlutterResult)result {
|
||||||
FFprobeSession* session = [[FFprobeSession alloc] init:arguments withCompleteCallback:nil withLogCallback:nil withLogRedirectionStrategy:LogRedirectionStrategyNeverPrintLogs];
|
FFprobeSession* session = [FFprobeSession create:arguments withCompleteCallback:nil withLogCallback:nil withLogRedirectionStrategy:LogRedirectionStrategyNeverPrintLogs];
|
||||||
result([FFmpegKitFlutterPlugin toSessionDictionary:session]);
|
result([FFmpegKitFlutterPlugin toSessionDictionary:session]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// MediaInformationSession
|
// MediaInformationSession
|
||||||
|
|
||||||
- (void)mediaInformationSession:(NSArray*)arguments result:(FlutterResult)result {
|
- (void)mediaInformationSession:(NSArray*)arguments result:(FlutterResult)result {
|
||||||
MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withCompleteCallback:nil withLogCallback:nil];
|
MediaInformationSession* session = [MediaInformationSession create:arguments withCompleteCallback:nil withLogCallback:nil];
|
||||||
result([FFmpegKitFlutterPlugin toSessionDictionary:session]);
|
result([FFmpegKitFlutterPlugin toSessionDictionary:session]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user