Update to Flutter 3.29 and use LTS version

Min macos 11.0
Min ios 14
Min android 24
pull/1127/head
Roman Laptev 3 months ago
parent 35b99c02f8
commit 6ea164be49
  1. 65
      flutter/flutter/analysis_options.yaml
  2. 4
      flutter/flutter/android/.gitignore
  3. 52
      flutter/flutter/android/build.gradle
  4. 3
      flutter/flutter/android/gradle.properties
  5. 20
      flutter/flutter/android/src/main/java/com/arthenica/ffmpegkit/flutter/FFmpegKitFlutterPlugin.java
  6. 0
      flutter/flutter/ios/Assets/.gitkeep
  7. 34
      flutter/flutter/ios/ffmpeg_kit_flutter.podspec
  8. 133
      flutter/flutter/lib/abstract_session.dart
  9. 37
      flutter/flutter/lib/ffmpeg_kit.dart
  10. 146
      flutter/flutter/lib/ffmpeg_kit_config.dart
  11. 44
      flutter/flutter/lib/ffmpeg_session.dart
  12. 107
      flutter/flutter/lib/ffprobe_kit.dart
  13. 14
      flutter/flutter/lib/ffprobe_session.dart
  14. 2
      flutter/flutter/lib/log_redirection_strategy.dart
  15. 33
      flutter/flutter/lib/media_information.dart
  16. 7
      flutter/flutter/lib/media_information_json_parser.dart
  17. 17
      flutter/flutter/lib/media_information_session.dart
  18. 3
      flutter/flutter/lib/media_information_session_complete_callback.dart
  19. 9
      flutter/flutter/lib/return_code.dart
  20. 89
      flutter/flutter/lib/src/ffmpeg_kit_factory.dart
  21. 46
      flutter/flutter/lib/src/ffmpeg_kit_flutter_initializer.dart
  22. 12
      flutter/flutter/lib/statistics.dart
  23. 39
      flutter/flutter/lib/stream_information.dart
  24. 34
      flutter/flutter/macos/ffmpeg_kit_flutter.podspec
  25. 13
      flutter/flutter/pubspec.yaml
  26. 1
      flutter/flutter_platform_interface/.gitignore
  27. 71
      flutter/flutter_platform_interface/analysis_options.yaml
  28. 267
      flutter/flutter_platform_interface/lib/ffmpeg_kit_flutter_platform_interface.dart
  29. 259
      flutter/flutter_platform_interface/lib/method_channel_ffmpeg_kit_flutter.dart
  30. 9
      flutter/flutter_platform_interface/pubspec.yaml

@ -1,62 +1,3 @@
analyzer: include: package:carapacik_lints/core.yaml
errors: formatter:
missing_required_param: warning page_width: 120
missing_return: warning
linter:
rules:
- avoid_catching_errors
- avoid_function_literals_in_foreach_calls
- avoid_private_typedef_functions
- avoid_renaming_method_parameters
- avoid_returning_null_for_void
- avoid_unused_constructor_parameters
- avoid_void_async
- await_only_futures
- camel_case_types
- cancel_subscriptions
- comment_references
- constant_identifier_names
- control_flow_in_finally
- directives_ordering
- empty_statements
- file_names
- hash_and_equals
- implementation_imports
- join_return_with_assignment
- collection_methods_unrelated_type
- missing_whitespace_between_adjacent_strings
- no_runtimeType_toString
- non_constant_identifier_names
- only_throw_errors
- overridden_fields
- package_api_docs
- package_names
- package_prefixed_library_names
- prefer_asserts_in_initializer_lists
- prefer_const_constructors
- prefer_const_declarations
- prefer_expression_function_bodies
- prefer_final_locals
- prefer_function_declarations_over_variables
- prefer_initializing_formals
- prefer_inlined_adds
- prefer_interpolation_to_compose_strings
- prefer_is_not_operator
- prefer_null_aware_operators
- prefer_relative_imports
- prefer_typing_uninitialized_variables
- prefer_void_to_null
- provide_deprecation_message
- sort_pub_dependencies
- test_types_in_equals
- throw_in_finally
- unnecessary_brace_in_string_interps
- unnecessary_lambdas
- unnecessary_null_aware_assignments
- unnecessary_overrides
- unnecessary_parenthesis
- unnecessary_statements
- unnecessary_string_interpolations
- use_string_buffers
- void_checks

@ -1,9 +1,9 @@
*.iml *.iml
.gradle .gradle
local.properties /local.properties
/.idea/workspace.xml /.idea/workspace.xml
/.idea/libraries /.idea/libraries
.DS_Store .DS_Store
/build /build
/captures /captures
gradle .cxx

@ -1,36 +1,41 @@
group = "com.arthenica.ffmpegkit.flutter"
version = "1.0-SNAPSHOT"
buildscript { buildscript {
ext.kotlin_version = "2.1.10"
repositories { repositories {
google() google()
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:8.1.0' classpath("com.android.tools.build:gradle:8.7.0")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
} }
} }
rootProject.allprojects { allprojects {
repositories { repositories {
google() google()
mavenCentral() mavenCentral()
} }
} }
apply plugin: 'com.android.library' apply plugin: "com.android.library"
apply plugin: "kotlin-android"
android { android {
// Conditional for compatibility with AGP <4.2. namespace = "com.arthenica.ffmpegkit.flutter"
if (project.android.hasProperty("namespace")) {
namespace 'com.arthenica.ffmpegkit.flutter'
}
compileSdkVersion 33 compileSdk = 35
defaultConfig { compileOptions {
minSdkVersion 24 sourceCompatibility = JavaVersion.VERSION_17
targetSdkVersion 33 targetCompatibility = JavaVersion.VERSION_17
versionCode 603 }
versionName "6.0.3"
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17
} }
buildTypes { buildTypes {
@ -38,16 +43,19 @@ android {
minifyEnabled false minifyEnabled false
} }
} }
lintOptions {
disable 'GradleCompatible' sourceSets {
main.java.srcDirs += "src/main/kotlin"
} }
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 defaultConfig {
targetCompatibility JavaVersion.VERSION_1_8 minSdk = 24
versionCode 603
versionName "6.0.3"
} }
}
dependencies { dependencies {
implementation 'androidx.annotation:annotation:1.5.0' implementation("androidx.annotation:annotation:1.9.1")
implementation 'com.arthenica:ffmpeg-kit-https:6.0-2' implementation("com.arthenica:ffmpeg-kit-https:6.0-2.LTS")
}
} }

@ -1,3 +0,0 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true

@ -153,17 +153,6 @@ public class FFmpegKitFlutterPlugin implements FlutterPlugin, ActivityAware, Met
Log.d(LIBRARY_NAME, String.format("FFmpegKitFlutterPlugin created %s.", this)); Log.d(LIBRARY_NAME, String.format("FFmpegKitFlutterPlugin created %s.", this));
} }
@SuppressWarnings("deprecation")
public static void registerWith(final io.flutter.plugin.common.PluginRegistry.Registrar registrar) {
final Context context = (registrar.activity() != null) ? registrar.activity() : registrar.context();
if (context == null) {
Log.w(LIBRARY_NAME, "FFmpegKitFlutterPlugin can not be registered without a context.");
return;
}
FFmpegKitFlutterPlugin plugin = new FFmpegKitFlutterPlugin();
plugin.init(registrar.messenger(), context, registrar.activity(), registrar, null);
}
protected void registerGlobalCallbacks() { protected void registerGlobalCallbacks() {
FFmpegKitConfig.enableFFmpegSessionCompleteCallback(this::emitSession); FFmpegKitConfig.enableFFmpegSessionCompleteCallback(this::emitSession);
FFmpegKitConfig.enableFFprobeSessionCompleteCallback(this::emitSession); FFmpegKitConfig.enableFFprobeSessionCompleteCallback(this::emitSession);
@ -195,7 +184,7 @@ public class FFmpegKitFlutterPlugin implements FlutterPlugin, ActivityAware, Met
@Override @Override
public void onAttachedToActivity(@NonNull ActivityPluginBinding activityPluginBinding) { public void onAttachedToActivity(@NonNull ActivityPluginBinding activityPluginBinding) {
Log.d(LIBRARY_NAME, String.format("FFmpegKitFlutterPlugin %s attached to activity %s.", this, activityPluginBinding.getActivity())); Log.d(LIBRARY_NAME, String.format("FFmpegKitFlutterPlugin %s attached to activity %s.", this, activityPluginBinding.getActivity()));
init(flutterPluginBinding.getBinaryMessenger(), flutterPluginBinding.getApplicationContext(), activityPluginBinding.getActivity(), null, activityPluginBinding); init(flutterPluginBinding.getBinaryMessenger(), flutterPluginBinding.getApplicationContext(), activityPluginBinding.getActivity(), activityPluginBinding);
} }
@Override @Override
@ -648,7 +637,7 @@ public class FFmpegKitFlutterPlugin implements FlutterPlugin, ActivityAware, Met
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
protected void init(final BinaryMessenger messenger, final Context context, final Activity activity, final io.flutter.plugin.common.PluginRegistry.Registrar registrar, final ActivityPluginBinding activityBinding) { protected void init(final BinaryMessenger messenger, final Context context, final Activity activity, final ActivityPluginBinding activityBinding) {
registerGlobalCallbacks(); registerGlobalCallbacks();
if (methodChannel == null) { if (methodChannel == null) {
@ -668,13 +657,8 @@ public class FFmpegKitFlutterPlugin implements FlutterPlugin, ActivityAware, Met
this.context = context; this.context = context;
this.activity = activity; this.activity = activity;
if (registrar != null) {
// V1 embedding setup for activity listeners.
registrar.addActivityResultListener(this);
} else {
// V2 embedding setup for activity listeners. // V2 embedding setup for activity listeners.
activityBinding.addActivityResultListener(this); activityBinding.addActivityResultListener(this);
}
Log.d(LIBRARY_NAME, String.format("FFmpegKitFlutterPlugin %s initialised with context %s and activity %s.", this, context, activity)); Log.d(LIBRARY_NAME, String.format("FFmpegKitFlutterPlugin %s initialised with context %s and activity %s.", this, context, activity));
} }

@ -15,7 +15,7 @@ Pod::Spec.new do |s|
s.source_files = 'Classes/**/*' s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h' s.public_header_files = 'Classes/**/*.h'
s.default_subspec = 'https' s.default_subspec = 'https-lts'
s.dependency 'Flutter' s.dependency 'Flutter'
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
@ -24,112 +24,112 @@ Pod::Spec.new do |s|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-ios-min', "6.0" ss.dependency 'ffmpeg-kit-ios-min', "6.0"
ss.ios.deployment_target = '12.1' ss.ios.deployment_target = '14.0'
end end
s.subspec 'min-lts' do |ss| s.subspec 'min-lts' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-ios-min', "6.0.LTS" ss.dependency 'ffmpeg-kit-ios-min', "6.0.LTS"
ss.ios.deployment_target = '10' ss.ios.deployment_target = '14.0'
end end
s.subspec 'min-gpl' do |ss| s.subspec 'min-gpl' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-ios-min-gpl', "6.0" ss.dependency 'ffmpeg-kit-ios-min-gpl', "6.0"
ss.ios.deployment_target = '12.1' ss.ios.deployment_target = '14.0'
end end
s.subspec 'min-gpl-lts' do |ss| s.subspec 'min-gpl-lts' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-ios-min-gpl', "6.0.LTS" ss.dependency 'ffmpeg-kit-ios-min-gpl', "6.0.LTS"
ss.ios.deployment_target = '10' ss.ios.deployment_target = '14.0'
end end
s.subspec 'https' do |ss| s.subspec 'https' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-ios-https', "6.0" ss.dependency 'ffmpeg-kit-ios-https', "6.0"
ss.ios.deployment_target = '12.1' ss.ios.deployment_target = '14.0'
end end
s.subspec 'https-lts' do |ss| s.subspec 'https-lts' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-ios-https', "6.0.LTS" ss.dependency 'ffmpeg-kit-ios-https', "6.0.LTS"
ss.ios.deployment_target = '10' ss.ios.deployment_target = '14.0'
end end
s.subspec 'https-gpl' do |ss| s.subspec 'https-gpl' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-ios-https-gpl', "6.0" ss.dependency 'ffmpeg-kit-ios-https-gpl', "6.0"
ss.ios.deployment_target = '12.1' ss.ios.deployment_target = '14.0'
end end
s.subspec 'https-gpl-lts' do |ss| s.subspec 'https-gpl-lts' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-ios-https-gpl', "6.0.LTS" ss.dependency 'ffmpeg-kit-ios-https-gpl', "6.0.LTS"
ss.ios.deployment_target = '10' ss.ios.deployment_target = '14.0'
end end
s.subspec 'audio' do |ss| s.subspec 'audio' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-ios-audio', "6.0" ss.dependency 'ffmpeg-kit-ios-audio', "6.0"
ss.ios.deployment_target = '12.1' ss.ios.deployment_target = '14.0'
end end
s.subspec 'audio-lts' do |ss| s.subspec 'audio-lts' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-ios-audio', "6.0.LTS" ss.dependency 'ffmpeg-kit-ios-audio', "6.0.LTS"
ss.ios.deployment_target = '10' ss.ios.deployment_target = '14.0'
end end
s.subspec 'video' do |ss| s.subspec 'video' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-ios-video', "6.0" ss.dependency 'ffmpeg-kit-ios-video', "6.0"
ss.ios.deployment_target = '12.1' ss.ios.deployment_target = '14.0'
end end
s.subspec 'video-lts' do |ss| s.subspec 'video-lts' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-ios-video', "6.0.LTS" ss.dependency 'ffmpeg-kit-ios-video', "6.0.LTS"
ss.ios.deployment_target = '10' ss.ios.deployment_target = '14.0'
end end
s.subspec 'full' do |ss| s.subspec 'full' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-ios-full', "6.0" ss.dependency 'ffmpeg-kit-ios-full', "6.0"
ss.ios.deployment_target = '12.1' ss.ios.deployment_target = '14.0'
end end
s.subspec 'full-lts' do |ss| s.subspec 'full-lts' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-ios-full', "6.0.LTS" ss.dependency 'ffmpeg-kit-ios-full', "6.0.LTS"
ss.ios.deployment_target = '10' ss.ios.deployment_target = '14.0'
end end
s.subspec 'full-gpl' do |ss| s.subspec 'full-gpl' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-ios-full-gpl', "6.0" ss.dependency 'ffmpeg-kit-ios-full-gpl', "6.0"
ss.ios.deployment_target = '12.1' ss.ios.deployment_target = '14.0'
end end
s.subspec 'full-gpl-lts' do |ss| s.subspec 'full-gpl-lts' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-ios-full-gpl', "6.0.LTS" ss.dependency 'ffmpeg-kit-ios-full-gpl', "6.0.LTS"
ss.ios.deployment_target = '10' ss.ios.deployment_target = '14.0'
end end
end end

@ -63,27 +63,24 @@ abstract class AbstractSession extends Session {
/// [logRedirectionStrategy]. /// [logRedirectionStrategy].
/// ///
/// Returns FFmpeg session created. /// Returns FFmpeg session created.
static Future<FFmpegSession> createFFmpegSession(List<String> argumentsArray, static Future<FFmpegSession> createFFmpegSession(
[LogRedirectionStrategy? logRedirectionStrategy]) async { List<String> argumentsArray, [
LogRedirectionStrategy? logRedirectionStrategy,
]) async {
try { try {
await FFmpegKitConfig.init(); await FFmpegKitConfig.init();
final Map<dynamic, dynamic>? nativeSession = final Map<dynamic, dynamic>? nativeSession = await _platform.abstractSessionCreateFFmpegSession(argumentsArray);
await _platform.abstractSessionCreateFFmpegSession(argumentsArray);
final session = new FFmpegSession(); final session = new FFmpegSession();
session._sessionId = nativeSession?["sessionId"]; session._sessionId = nativeSession?["sessionId"];
session._createTime = session._createTime = FFmpegKitFactory.validDate(nativeSession?["createTime"]);
FFmpegKitFactory.validDate(nativeSession?["createTime"]); session._startTime = FFmpegKitFactory.validDate(nativeSession?["startTime"]);
session._startTime =
FFmpegKitFactory.validDate(nativeSession?["startTime"]);
session._command = nativeSession?["command"]; session._command = nativeSession?["command"];
session._argumentsArray = argumentsArray; session._argumentsArray = argumentsArray;
session._logRedirectionStrategy = session._logRedirectionStrategy = logRedirectionStrategy ?? FFmpegKitConfig.getLogRedirectionStrategy();
logRedirectionStrategy ?? FFmpegKitConfig.getLogRedirectionStrategy();
FFmpegKitFactory.setLogRedirectionStrategy( FFmpegKitFactory.setLogRedirectionStrategy(session._sessionId, logRedirectionStrategy);
session._sessionId, logRedirectionStrategy);
return session; return session;
} on PlatformException catch (e, stack) { } on PlatformException catch (e, stack) {
@ -96,18 +93,15 @@ abstract class AbstractSession extends Session {
/// fields as map keys. /// fields as map keys.
/// ///
/// Returns FFmpeg session created. /// Returns FFmpeg session created.
static FFmpegSession createFFmpegSessionFromMap( static FFmpegSession createFFmpegSessionFromMap(Map<dynamic, dynamic> sessionMap) {
Map<dynamic, dynamic> sessionMap) {
final session = new FFmpegSession(); final session = new FFmpegSession();
session._sessionId = sessionMap["sessionId"]; session._sessionId = sessionMap["sessionId"];
session._createTime = FFmpegKitFactory.validDate(sessionMap["createTime"]); session._createTime = FFmpegKitFactory.validDate(sessionMap["createTime"]);
session._startTime = FFmpegKitFactory.validDate(sessionMap["startTime"]); session._startTime = FFmpegKitFactory.validDate(sessionMap["startTime"]);
session._command = sessionMap["command"]; session._command = sessionMap["command"];
session._argumentsArray = session._argumentsArray = FFmpegKitConfig.parseArguments(sessionMap["command"]);
FFmpegKitConfig.parseArguments(sessionMap["command"]); session._logRedirectionStrategy = FFmpegKitFactory.getLogRedirectionStrategy(session._sessionId);
session._logRedirectionStrategy =
FFmpegKitFactory.getLogRedirectionStrategy(session._sessionId);
return session; return session;
} }
@ -117,27 +111,23 @@ abstract class AbstractSession extends Session {
/// ///
/// Returns FFprobe session created. /// Returns FFprobe session created.
static Future<FFprobeSession> createFFprobeSession( static Future<FFprobeSession> createFFprobeSession(
List<String> argumentsArray, List<String> argumentsArray, [
[LogRedirectionStrategy? logRedirectionStrategy]) async { LogRedirectionStrategy? logRedirectionStrategy,
]) async {
try { try {
await FFmpegKitConfig.init(); await FFmpegKitConfig.init();
final Map<dynamic, dynamic>? nativeSession = final Map<dynamic, dynamic>? nativeSession = await _platform.abstractSessionCreateFFprobeSession(argumentsArray);
await _platform.abstractSessionCreateFFprobeSession(argumentsArray);
final session = new FFprobeSession(); final session = new FFprobeSession();
session._sessionId = nativeSession?["sessionId"]; session._sessionId = nativeSession?["sessionId"];
session._createTime = session._createTime = FFmpegKitFactory.validDate(nativeSession?["createTime"]);
FFmpegKitFactory.validDate(nativeSession?["createTime"]); session._startTime = FFmpegKitFactory.validDate(nativeSession?["startTime"]);
session._startTime =
FFmpegKitFactory.validDate(nativeSession?["startTime"]);
session._command = nativeSession?["command"]; session._command = nativeSession?["command"];
session._argumentsArray = argumentsArray; session._argumentsArray = argumentsArray;
session._logRedirectionStrategy = session._logRedirectionStrategy = logRedirectionStrategy ?? FFmpegKitConfig.getLogRedirectionStrategy();
logRedirectionStrategy ?? FFmpegKitConfig.getLogRedirectionStrategy();
FFmpegKitFactory.setLogRedirectionStrategy( FFmpegKitFactory.setLogRedirectionStrategy(session._sessionId, logRedirectionStrategy);
session._sessionId, logRedirectionStrategy);
return session; return session;
} on PlatformException catch (e, stack) { } on PlatformException catch (e, stack) {
@ -150,18 +140,15 @@ abstract class AbstractSession extends Session {
/// fields as map keys. /// fields as map keys.
/// ///
/// Returns FFprobe session created. /// Returns FFprobe session created.
static FFprobeSession createFFprobeSessionFromMap( static FFprobeSession createFFprobeSessionFromMap(Map<dynamic, dynamic> sessionMap) {
Map<dynamic, dynamic> sessionMap) {
final session = new FFprobeSession(); final session = new FFprobeSession();
session._sessionId = sessionMap["sessionId"]; session._sessionId = sessionMap["sessionId"];
session._createTime = FFmpegKitFactory.validDate(sessionMap["createTime"]); session._createTime = FFmpegKitFactory.validDate(sessionMap["createTime"]);
session._startTime = FFmpegKitFactory.validDate(sessionMap["startTime"]); session._startTime = FFmpegKitFactory.validDate(sessionMap["startTime"]);
session._command = sessionMap["command"]; session._command = sessionMap["command"];
session._argumentsArray = session._argumentsArray = FFmpegKitConfig.parseArguments(sessionMap["command"]);
FFmpegKitConfig.parseArguments(sessionMap["command"]); session._logRedirectionStrategy = FFmpegKitFactory.getLogRedirectionStrategy(session._sessionId);
session._logRedirectionStrategy =
FFmpegKitFactory.getLogRedirectionStrategy(session._sessionId);
return session; return session;
} }
@ -169,25 +156,22 @@ abstract class AbstractSession extends Session {
/// Creates a new MediaInformation session using [argumentsArray]. /// Creates a new MediaInformation session using [argumentsArray].
/// ///
/// Returns MediaInformation session created. /// Returns MediaInformation session created.
static Future<MediaInformationSession> createMediaInformationSession( static Future<MediaInformationSession> createMediaInformationSession(List<String> argumentsArray) async {
List<String> argumentsArray) async {
try { try {
await FFmpegKitConfig.init(); await FFmpegKitConfig.init();
final Map<dynamic, dynamic>? nativeSession = await _platform final Map<dynamic, dynamic>? nativeSession = await _platform.abstractSessionCreateMediaInformationSession(
.abstractSessionCreateMediaInformationSession(argumentsArray); argumentsArray,
);
final session = new MediaInformationSession(); final session = new MediaInformationSession();
session._sessionId = nativeSession?["sessionId"]; session._sessionId = nativeSession?["sessionId"];
session._createTime = session._createTime = FFmpegKitFactory.validDate(nativeSession?["createTime"]);
FFmpegKitFactory.validDate(nativeSession?["createTime"]); session._startTime = FFmpegKitFactory.validDate(nativeSession?["startTime"]);
session._startTime =
FFmpegKitFactory.validDate(nativeSession?["startTime"]);
session._command = nativeSession?["command"]; session._command = nativeSession?["command"];
session._argumentsArray = argumentsArray; session._argumentsArray = argumentsArray;
session._logRedirectionStrategy = LogRedirectionStrategy.neverPrintLogs; session._logRedirectionStrategy = LogRedirectionStrategy.neverPrintLogs;
FFmpegKitFactory.setLogRedirectionStrategy( FFmpegKitFactory.setLogRedirectionStrategy(session._sessionId, LogRedirectionStrategy.neverPrintLogs);
session._sessionId, LogRedirectionStrategy.neverPrintLogs);
return session; return session;
} on PlatformException catch (e, stack) { } on PlatformException catch (e, stack) {
@ -200,29 +184,25 @@ abstract class AbstractSession extends Session {
/// session fields as map keys. /// session fields as map keys.
/// ///
/// Returns MediaInformation session created. /// Returns MediaInformation session created.
static MediaInformationSession createMediaInformationSessionFromMap( static MediaInformationSession createMediaInformationSessionFromMap(Map<dynamic, dynamic> sessionMap) {
Map<dynamic, dynamic> sessionMap) {
final session = new MediaInformationSession(); final session = new MediaInformationSession();
session._sessionId = sessionMap["sessionId"]; session._sessionId = sessionMap["sessionId"];
session._createTime = FFmpegKitFactory.validDate(sessionMap["createTime"]); session._createTime = FFmpegKitFactory.validDate(sessionMap["createTime"]);
session._startTime = FFmpegKitFactory.validDate(sessionMap["startTime"]); session._startTime = FFmpegKitFactory.validDate(sessionMap["startTime"]);
session._command = sessionMap["command"]; session._command = sessionMap["command"];
session._argumentsArray = session._argumentsArray = FFmpegKitConfig.parseArguments(sessionMap["command"]);
FFmpegKitConfig.parseArguments(sessionMap["command"]);
session._logRedirectionStrategy = LogRedirectionStrategy.neverPrintLogs; session._logRedirectionStrategy = LogRedirectionStrategy.neverPrintLogs;
if (sessionMap.containsKey("mediaInformation")) { if (sessionMap.containsKey("mediaInformation")) {
session.setMediaInformation( session.setMediaInformation(new MediaInformation(sessionMap["mediaInformation"]));
new MediaInformation(sessionMap["mediaInformation"]));
} }
return session; return session;
} }
/// Returns the session specific log callback. /// Returns the session specific log callback.
LogCallback? getLogCallback() => LogCallback? getLogCallback() => FFmpegKitFactory.getLogCallback(this.getSessionId());
FFmpegKitFactory.getLogCallback(this.getSessionId());
/// Returns the session identifier. /// Returns the session identifier.
int? getSessionId() => this._sessionId; int? getSessionId() => this._sessionId;
@ -236,9 +216,7 @@ abstract class AbstractSession extends Session {
/// Returns session end time. /// Returns session end time.
Future<DateTime?> getEndTime() async { Future<DateTime?> getEndTime() async {
try { try {
return _platform return _platform.abstractSessionGetEndTime(this.getSessionId()).then(FFmpegKitFactory.validDate);
.abstractSessionGetEndTime(this.getSessionId())
.then(FFmpegKitFactory.validDate);
} on PlatformException catch (e, stack) { } on PlatformException catch (e, stack) {
print("Plugin getEndTime error: ${e.message}"); print("Plugin getEndTime error: ${e.message}");
return Future.error("getEndTime failed.", stack); return Future.error("getEndTime failed.", stack);
@ -249,9 +227,7 @@ abstract class AbstractSession extends Session {
/// if the session is not over yet. /// if the session is not over yet.
Future<int> getDuration() async { Future<int> getDuration() async {
try { try {
return _platform return _platform.abstractSessionGetDuration(this.getSessionId()).then((duration) => duration ?? 0);
.abstractSessionGetDuration(this.getSessionId())
.then((duration) => duration ?? 0);
} on PlatformException catch (e, stack) { } on PlatformException catch (e, stack) {
print("Plugin getDuration error: ${e.message}"); print("Plugin getDuration error: ${e.message}");
return Future.error("getDuration failed.", stack); return Future.error("getDuration failed.", stack);
@ -269,15 +245,12 @@ abstract class AbstractSession extends Session {
/// them until [waitTimeout]. /// them until [waitTimeout].
Future<List<Log>> getAllLogs([int? waitTimeout = null]) async { Future<List<Log>> getAllLogs([int? waitTimeout = null]) async {
try { try {
return _platform return _platform.abstractSessionGetAllLogs(this.getSessionId(), waitTimeout).then((allLogs) {
.abstractSessionGetAllLogs(this.getSessionId(), waitTimeout)
.then((allLogs) {
if (allLogs == null) { if (allLogs == null) {
return List.empty(); return List.empty();
} else { } else {
return allLogs return allLogs
.map((dynamic logObject) => .map((dynamic logObject) => FFmpegKitFactory.mapToLog(logObject as Map<dynamic, dynamic>))
FFmpegKitFactory.mapToLog(logObject as Map<dynamic, dynamic>))
.toList(); .toList();
} }
}); });
@ -292,15 +265,12 @@ abstract class AbstractSession extends Session {
/// will not wait for them and will return immediately. /// will not wait for them and will return immediately.
Future<List<Log>> getLogs() async { Future<List<Log>> getLogs() async {
try { try {
return _platform return _platform.abstractSessionGetLogs(this.getSessionId()).then((allLogs) {
.abstractSessionGetLogs(this.getSessionId())
.then((allLogs) {
if (allLogs == null) { if (allLogs == null) {
return List.empty(); return List.empty();
} else { } else {
return allLogs return allLogs
.map((dynamic logObject) => .map((dynamic logObject) => FFmpegKitFactory.mapToLog(logObject as Map<dynamic, dynamic>))
FFmpegKitFactory.mapToLog(logObject as Map<dynamic, dynamic>))
.toList(); .toList();
} }
}); });
@ -315,8 +285,7 @@ abstract class AbstractSession extends Session {
/// this method waits for them until [waitTimeout]. /// this method waits for them until [waitTimeout].
Future<String?> getAllLogsAsString([int? waitTimeout = null]) async { Future<String?> getAllLogsAsString([int? waitTimeout = null]) async {
try { try {
return _platform.abstractSessionGetAllLogsAsString( return _platform.abstractSessionGetAllLogsAsString(this.getSessionId(), waitTimeout);
this.getSessionId(), waitTimeout);
} on PlatformException catch (e, stack) { } on PlatformException catch (e, stack) {
print("Plugin getAllLogsAsString error: ${e.message}"); print("Plugin getAllLogsAsString error: ${e.message}");
return Future.error("getAllLogsAsString failed.", stack); return Future.error("getAllLogsAsString failed.", stack);
@ -345,9 +314,7 @@ abstract class AbstractSession extends Session {
/// Returns the state of the session. /// Returns the state of the session.
Future<SessionState> getState() async { Future<SessionState> getState() async {
try { try {
return _platform return _platform.abstractSessionGetState(this.getSessionId()).then((state) {
.abstractSessionGetState(this.getSessionId())
.then((state) {
switch (state) { switch (state) {
case 0: case 0:
return SessionState.created; return SessionState.created;
@ -371,9 +338,7 @@ abstract class AbstractSession extends Session {
/// started, still running or failed then this method returns null. /// started, still running or failed then this method returns null.
Future<ReturnCode?> getReturnCode() async { Future<ReturnCode?> getReturnCode() async {
try { try {
return _platform return _platform.abstractSessionGetReturnCode(this.getSessionId()).then((returnCode) {
.abstractSessionGetReturnCode(this.getSessionId())
.then((returnCode) {
if (returnCode == null) { if (returnCode == null) {
return null; return null;
} else { } else {
@ -401,20 +366,16 @@ abstract class AbstractSession extends Session {
} }
/// Returns session specific log redirection strategy. /// Returns session specific log redirection strategy.
LogRedirectionStrategy? getLogRedirectionStrategy() => LogRedirectionStrategy? getLogRedirectionStrategy() => this._logRedirectionStrategy;
this._logRedirectionStrategy;
/// Returns whether there are still asynchronous messages being transmitted /// Returns whether there are still asynchronous messages being transmitted
/// for this session or not. /// for this session or not.
Future<bool> thereAreAsynchronousMessagesInTransmit() async { Future<bool> thereAreAsynchronousMessagesInTransmit() async {
try { try {
return _platform.abstractSessionThereAreAsynchronousMessagesInTransmit( return _platform.abstractSessionThereAreAsynchronousMessagesInTransmit(this.getSessionId());
this.getSessionId());
} on PlatformException catch (e, stack) { } on PlatformException catch (e, stack) {
print( print("Plugin thereAreAsynchronousMessagesInTransmit error: ${e.message}");
"Plugin thereAreAsynchronousMessagesInTransmit error: ${e.message}"); return Future.error("thereAreAsynchronousMessagesInTransmit failed.", stack);
return Future.error(
"thereAreAsynchronousMessagesInTransmit failed.", stack);
} }
} }

@ -38,10 +38,8 @@ class FFmpegKit {
FFmpegKit.executeWithArguments(FFmpegKitConfig.parseArguments(command)); FFmpegKit.executeWithArguments(FFmpegKitConfig.parseArguments(command));
/// Synchronously executes FFmpeg with arguments provided. /// Synchronously executes FFmpeg with arguments provided.
static Future<FFmpegSession> executeWithArguments( static Future<FFmpegSession> executeWithArguments(List<String> commandArguments) async {
List<String> commandArguments) async { final session = await FFmpegSession.create(commandArguments, null, null, null, null);
final session =
await FFmpegSession.create(commandArguments, null, null, null, null);
await FFmpegKitConfig.ffmpegExecute(session); await FFmpegKitConfig.ffmpegExecute(session);
@ -53,27 +51,35 @@ class FFmpegKit {
/// ///
/// Note that this method returns immediately and does not wait the execution to complete. You must use an /// Note that this method returns immediately and does not wait the execution to complete. You must use an
/// [FFmpegSessionCompleteCallback] if you want to be notified about the result. /// [FFmpegSessionCompleteCallback] if you want to be notified about the result.
static Future<FFmpegSession> executeAsync(String command, static Future<FFmpegSession> executeAsync(
[FFmpegSessionCompleteCallback? completeCallback = null, String command, [
FFmpegSessionCompleteCallback? completeCallback = null,
LogCallback? logCallback = null, LogCallback? logCallback = null,
StatisticsCallback? statisticsCallback = null]) async => StatisticsCallback? statisticsCallback = null,
FFmpegKit.executeWithArgumentsAsync( ]) async => FFmpegKit.executeWithArgumentsAsync(
FFmpegKitConfig.parseArguments(command), FFmpegKitConfig.parseArguments(command),
completeCallback, completeCallback,
logCallback, logCallback,
statisticsCallback); statisticsCallback,
);
/// Starts an asynchronous FFmpeg execution with arguments provided. /// Starts an asynchronous FFmpeg execution with arguments provided.
/// ///
/// Note that this method returns immediately and does not wait the execution to complete. You must use an /// Note that this method returns immediately and does not wait the execution to complete. You must use an
/// [FFmpegSessionCompleteCallback] if you want to be notified about the result. /// [FFmpegSessionCompleteCallback] if you want to be notified about the result.
static Future<FFmpegSession> executeWithArgumentsAsync( static Future<FFmpegSession> executeWithArgumentsAsync(
List<String> commandArguments, List<String> commandArguments, [
[FFmpegSessionCompleteCallback? completeCallback = null, FFmpegSessionCompleteCallback? completeCallback = null,
LogCallback? logCallback = null, LogCallback? logCallback = null,
StatisticsCallback? statisticsCallback = null]) async { StatisticsCallback? statisticsCallback = null,
final session = await FFmpegSession.create(commandArguments, ]) async {
completeCallback, logCallback, statisticsCallback, null); final session = await FFmpegSession.create(
commandArguments,
completeCallback,
logCallback,
statisticsCallback,
null,
);
await FFmpegKitConfig.asyncFFmpegExecute(session); await FFmpegKitConfig.asyncFFmpegExecute(session);
@ -104,8 +110,7 @@ class FFmpegKit {
return List.empty(); return List.empty();
} else { } else {
return sessions return sessions
.map((dynamic sessionObject) => FFmpegKitFactory.mapToSession( .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession(sessionObject as Map<dynamic, dynamic>))
sessionObject as Map<dynamic, dynamic>))
.map((session) => session as FFmpegSession) .map((session) => session as FFmpegSession)
.toList(); .toList();
} }

@ -40,8 +40,7 @@ import 'statistics_callback.dart';
class FFmpegKitConfig { class FFmpegKitConfig {
static FFmpegKitPlatform _platform = FFmpegKitPlatform.instance; static FFmpegKitPlatform _platform = FFmpegKitPlatform.instance;
static LogRedirectionStrategy _globalLogRedirectionStrategy = static LogRedirectionStrategy _globalLogRedirectionStrategy = LogRedirectionStrategy.printLogsWhenNoCallbacksDefined;
LogRedirectionStrategy.printLogsWhenNoCallbacksDefined;
static int _activeLogLevel = Level.avLogTrace; static int _activeLogLevel = Level.avLogTrace;
@ -100,8 +99,7 @@ class FFmpegKitConfig {
/// ///
/// Note that you need to use a package with "fontconfig" inside to be able /// Note that you need to use a package with "fontconfig" inside to be able
/// to use fonts in "FFmpeg". /// to use fonts in "FFmpeg".
static Future<void> setFontDirectory(String path, static Future<void> setFontDirectory(String path, [Map<String, String>? mapping = null]) async {
[Map<String, String>? mapping = null]) async {
try { try {
await init(); await init();
return _platform.ffmpegKitConfigSetFontDirectory(path, mapping); return _platform.ffmpegKitConfigSetFontDirectory(path, mapping);
@ -116,12 +114,13 @@ class FFmpegKitConfig {
/// ///
/// Note that you need to use a package with "fontconfig" inside to be able /// Note that you need to use a package with "fontconfig" inside to be able
/// to use fonts in "FFmpeg". /// to use fonts in "FFmpeg".
static Future<void> setFontDirectoryList(List<String> fontDirectoryList, static Future<void> setFontDirectoryList(
[Map<String, String>? mapping = null]) async { List<String> fontDirectoryList, [
Map<String, String>? mapping = null,
]) async {
try { try {
await init(); await init();
return _platform.ffmpegKitConfigSetFontDirectoryList( return _platform.ffmpegKitConfigSetFontDirectoryList(fontDirectoryList, mapping);
fontDirectoryList, mapping);
} on PlatformException catch (e, stack) { } on PlatformException catch (e, stack) {
print("Plugin setFontDirectoryList error: ${e.message}"); print("Plugin setFontDirectoryList error: ${e.message}");
return Future.error("setFontDirectoryList failed.", stack); return Future.error("setFontDirectoryList failed.", stack);
@ -221,8 +220,7 @@ class FFmpegKitConfig {
static Future<void> ffmpegExecute(FFmpegSession ffmpegSession) async { static Future<void> ffmpegExecute(FFmpegSession ffmpegSession) async {
try { try {
await init(); await init();
return _platform return _platform.ffmpegKitConfigFFmpegExecute(ffmpegSession.getSessionId());
.ffmpegKitConfigFFmpegExecute(ffmpegSession.getSessionId());
} on PlatformException catch (e, stack) { } on PlatformException catch (e, stack) {
print("Plugin ffmpegExecute error: ${e.message}"); print("Plugin ffmpegExecute error: ${e.message}");
return Future.error("ffmpegExecute failed.", stack); return Future.error("ffmpegExecute failed.", stack);
@ -233,8 +231,7 @@ class FFmpegKitConfig {
static Future<void> ffprobeExecute(FFprobeSession ffprobeSession) async { static Future<void> ffprobeExecute(FFprobeSession ffprobeSession) async {
try { try {
await init(); await init();
return _platform return _platform.ffmpegKitConfigFFprobeExecute(ffprobeSession.getSessionId());
.ffmpegKitConfigFFprobeExecute(ffprobeSession.getSessionId());
} on PlatformException catch (e, stack) { } on PlatformException catch (e, stack) {
print("Plugin ffprobeExecute error: ${e.message}"); print("Plugin ffprobeExecute error: ${e.message}");
return Future.error("ffprobeExecute failed.", stack); return Future.error("ffprobeExecute failed.", stack);
@ -243,12 +240,12 @@ class FFmpegKitConfig {
/// Synchronously executes the media information session provided. /// Synchronously executes the media information session provided.
static Future<void> getMediaInformationExecute( static Future<void> getMediaInformationExecute(
MediaInformationSession mediaInformationSession, MediaInformationSession mediaInformationSession, [
[int? waitTimeout = null]) async { int? waitTimeout = null,
]) async {
try { try {
await init(); await init();
return _platform.ffmpegKitConfigGetMediaInformationExecute( return _platform.ffmpegKitConfigGetMediaInformationExecute(mediaInformationSession.getSessionId(), waitTimeout);
mediaInformationSession.getSessionId(), waitTimeout);
} on PlatformException catch (e, stack) { } on PlatformException catch (e, stack) {
print("Plugin getMediaInformationExecute error: ${e.message}"); print("Plugin getMediaInformationExecute error: ${e.message}");
return Future.error("getMediaInformationExecute failed.", stack); return Future.error("getMediaInformationExecute failed.", stack);
@ -262,8 +259,7 @@ class FFmpegKitConfig {
static Future<void> asyncFFmpegExecute(FFmpegSession ffmpegSession) async { static Future<void> asyncFFmpegExecute(FFmpegSession ffmpegSession) async {
try { try {
await init(); await init();
return _platform return _platform.ffmpegKitConfigAsyncFFmpegExecute(ffmpegSession.getSessionId());
.ffmpegKitConfigAsyncFFmpegExecute(ffmpegSession.getSessionId());
} on PlatformException catch (e, stack) { } on PlatformException catch (e, stack) {
print("Plugin asyncFFmpegExecute error: ${e.message}"); print("Plugin asyncFFmpegExecute error: ${e.message}");
return Future.error("asyncFFmpegExecute failed.", stack); return Future.error("asyncFFmpegExecute failed.", stack);
@ -277,8 +273,7 @@ class FFmpegKitConfig {
static Future<void> asyncFFprobeExecute(FFprobeSession ffprobeSession) async { static Future<void> asyncFFprobeExecute(FFprobeSession ffprobeSession) async {
try { try {
await init(); await init();
return _platform return _platform.ffmpegKitConfigAsyncFFprobeExecute(ffprobeSession.getSessionId());
.ffmpegKitConfigAsyncFFprobeExecute(ffprobeSession.getSessionId());
} on PlatformException catch (e, stack) { } on PlatformException catch (e, stack) {
print("Plugin asyncFFprobeExecute error: ${e.message}"); print("Plugin asyncFFprobeExecute error: ${e.message}");
return Future.error("asyncFFprobeExecute failed.", stack); return Future.error("asyncFFprobeExecute failed.", stack);
@ -290,12 +285,15 @@ class FFmpegKitConfig {
/// Note that this method returns immediately and does not wait the execution to complete. You must use an /// Note that this method returns immediately and does not wait the execution to complete. You must use an
/// [MediaInformationSessionCompleteCallback] if you want to be notified about the result. /// [MediaInformationSessionCompleteCallback] if you want to be notified about the result.
static Future<void> asyncGetMediaInformationExecute( static Future<void> asyncGetMediaInformationExecute(
MediaInformationSession mediaInformationSession, MediaInformationSession mediaInformationSession, [
[int? waitTimeout = null]) async { int? waitTimeout = null,
]) async {
try { try {
await init(); await init();
return _platform.ffmpegKitConfigAsyncGetMediaInformationExecute( return _platform.ffmpegKitConfigAsyncGetMediaInformationExecute(
mediaInformationSession.getSessionId(), waitTimeout); mediaInformationSession.getSessionId(),
waitTimeout,
);
} on PlatformException catch (e, stack) { } on PlatformException catch (e, stack) {
print("Plugin asyncGetMediaInformationExecute error: ${e.message}"); print("Plugin asyncGetMediaInformationExecute error: ${e.message}");
return Future.error("asyncGetMediaInformationExecute failed.", stack); return Future.error("asyncGetMediaInformationExecute failed.", stack);
@ -308,17 +306,16 @@ class FFmpegKitConfig {
} }
/// Sets a global callback to redirect FFmpeg statistics. /// Sets a global callback to redirect FFmpeg statistics.
static void enableStatisticsCallback( static void enableStatisticsCallback([StatisticsCallback? statisticsCallback = null]) {
[StatisticsCallback? statisticsCallback = null]) {
FFmpegKitFactory.setGlobalStatisticsCallback(statisticsCallback); FFmpegKitFactory.setGlobalStatisticsCallback(statisticsCallback);
} }
/// Sets a global FFmpegSessionCompleteCallback to receive execution results /// Sets a global FFmpegSessionCompleteCallback to receive execution results
/// for FFmpeg sessions. /// for FFmpeg sessions.
static void enableFFmpegSessionCompleteCallback( static void enableFFmpegSessionCompleteCallback([
[FFmpegSessionCompleteCallback? ffmpegSessionCompleteCallback = null]) { FFmpegSessionCompleteCallback? ffmpegSessionCompleteCallback = null,
FFmpegKitFactory.setGlobalFFmpegSessionCompleteCallback( ]) {
ffmpegSessionCompleteCallback); FFmpegKitFactory.setGlobalFFmpegSessionCompleteCallback(ffmpegSessionCompleteCallback);
} }
/// Returns the global FFmpegSessionCompleteCallback set. /// Returns the global FFmpegSessionCompleteCallback set.
@ -327,10 +324,10 @@ class FFmpegKitConfig {
/// Sets a global FFprobeSessionCompleteCallback to receive execution results /// Sets a global FFprobeSessionCompleteCallback to receive execution results
/// for FFprobe sessions. /// for FFprobe sessions.
static void enableFFprobeSessionCompleteCallback( static void enableFFprobeSessionCompleteCallback([
[FFprobeSessionCompleteCallback? ffprobeSessionCompleteCallback = null]) { FFprobeSessionCompleteCallback? ffprobeSessionCompleteCallback = null,
FFmpegKitFactory.setGlobalFFprobeSessionCompleteCallback( ]) {
ffprobeSessionCompleteCallback); FFmpegKitFactory.setGlobalFFprobeSessionCompleteCallback(ffprobeSessionCompleteCallback);
} }
/// Returns the global FFprobeSessionCompleteCallback set. /// Returns the global FFprobeSessionCompleteCallback set.
@ -339,16 +336,14 @@ class FFmpegKitConfig {
/// Sets a global MediaInformationSessionCompleteCallback to receive /// Sets a global MediaInformationSessionCompleteCallback to receive
/// execution results for MediaInformation sessions. /// execution results for MediaInformation sessions.
static void enableMediaInformationSessionCompleteCallback( static void enableMediaInformationSessionCompleteCallback([
[MediaInformationSessionCompleteCallback? MediaInformationSessionCompleteCallback? mediaInformationSessionCompleteCallback = null,
mediaInformationSessionCompleteCallback = null]) { ]) {
FFmpegKitFactory.setGlobalMediaInformationSessionCompleteCallback( FFmpegKitFactory.setGlobalMediaInformationSessionCompleteCallback(mediaInformationSessionCompleteCallback);
mediaInformationSessionCompleteCallback);
} }
/// Returns the global MediaInformationSessionCompleteCallback set. /// Returns the global MediaInformationSessionCompleteCallback set.
static MediaInformationSessionCompleteCallback? static MediaInformationSessionCompleteCallback? getMediaInformationSessionCompleteCallback() =>
getMediaInformationSessionCompleteCallback() =>
FFmpegKitFactory.getGlobalMediaInformationSessionCompleteCallback(); FFmpegKitFactory.getGlobalMediaInformationSessionCompleteCallback();
/// Returns the current log level. /// Returns the current log level.
@ -404,8 +399,7 @@ class FFmpegKitConfig {
/// Note that this method is Android only. It will fail if called on other /// Note that this method is Android only. It will fail if called on other
/// platforms. It also requires API Level &ge; 19. On older API levels it /// platforms. It also requires API Level &ge; 19. On older API levels it
/// returns an empty url. /// returns an empty url.
static Future<String?> getSafParameter( static Future<String?> getSafParameter(String uriString, String openMode) async {
String uriString, String openMode) async {
try { try {
await init(); await init();
return _platform.ffmpegKitConfigGetSafParameter(uriString, openMode); return _platform.ffmpegKitConfigGetSafParameter(uriString, openMode);
@ -441,9 +435,7 @@ class FFmpegKitConfig {
static Future<Session?> getSession(int sessionId) async { static Future<Session?> getSession(int sessionId) async {
try { try {
await init(); await init();
return _platform return _platform.ffmpegKitConfigGetSession(sessionId).then(FFmpegKitFactory.mapToNullableSession);
.ffmpegKitConfigGetSession(sessionId)
.then(FFmpegKitFactory.mapToNullableSession);
} on PlatformException catch (e, stack) { } on PlatformException catch (e, stack) {
print("Plugin getSession error: ${e.message}"); print("Plugin getSession error: ${e.message}");
return Future.error("getSession failed.", stack); return Future.error("getSession failed.", stack);
@ -454,9 +446,7 @@ class FFmpegKitConfig {
static Future<Session?> getLastSession() async { static Future<Session?> getLastSession() async {
try { try {
await init(); await init();
return _platform return _platform.ffmpegKitConfigGetLastSession().then(FFmpegKitFactory.mapToNullableSession);
.ffmpegKitConfigGetLastSession()
.then(FFmpegKitFactory.mapToNullableSession);
} on PlatformException catch (e, stack) { } on PlatformException catch (e, stack) {
print("Plugin getLastSession error: ${e.message}"); print("Plugin getLastSession error: ${e.message}");
return Future.error("getLastSession failed.", stack); return Future.error("getLastSession failed.", stack);
@ -467,9 +457,7 @@ class FFmpegKitConfig {
static Future<Session?> getLastCompletedSession() async { static Future<Session?> getLastCompletedSession() async {
try { try {
await init(); await init();
return _platform return _platform.ffmpegKitConfigGetLastCompletedSession().then(FFmpegKitFactory.mapToNullableSession);
.ffmpegKitConfigGetLastCompletedSession()
.then(FFmpegKitFactory.mapToNullableSession);
} on PlatformException catch (e, stack) { } on PlatformException catch (e, stack) {
print("Plugin getLastCompletedSession error: ${e.message}"); print("Plugin getLastCompletedSession error: ${e.message}");
return Future.error("getLastCompletedSession failed.", stack); return Future.error("getLastCompletedSession failed.", stack);
@ -485,8 +473,7 @@ class FFmpegKitConfig {
return List.empty(); return List.empty();
} else { } else {
return sessions return sessions
.map((dynamic sessionObject) => FFmpegKitFactory.mapToSession( .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession(sessionObject as Map<dynamic, dynamic>))
sessionObject as Map<dynamic, dynamic>))
.toList(); .toList();
} }
}); });
@ -517,8 +504,7 @@ class FFmpegKitConfig {
return List.empty(); return List.empty();
} else { } else {
return sessions return sessions
.map((dynamic sessionObject) => FFmpegKitFactory.mapToSession( .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession(sessionObject as Map<dynamic, dynamic>))
sessionObject as Map<dynamic, dynamic>))
.map((session) => session as FFmpegSession) .map((session) => session as FFmpegSession)
.toList(); .toList();
} }
@ -538,8 +524,7 @@ class FFmpegKitConfig {
return List.empty(); return List.empty();
} else { } else {
return sessions return sessions
.map((dynamic sessionObject) => FFmpegKitFactory.mapToSession( .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession(sessionObject as Map<dynamic, dynamic>))
sessionObject as Map<dynamic, dynamic>))
.map((session) => session as FFprobeSession) .map((session) => session as FFprobeSession)
.toList(); .toList();
} }
@ -551,19 +536,15 @@ class FFmpegKitConfig {
} }
/// Returns all MediaInformation sessions in the session history. /// Returns all MediaInformation sessions in the session history.
static Future<List<MediaInformationSession>> static Future<List<MediaInformationSession>> getMediaInformationSessions() async {
getMediaInformationSessions() async {
try { try {
await FFmpegKitConfig.init(); await FFmpegKitConfig.init();
return _platform return _platform.ffprobeKitListMediaInformationSessions().then((sessions) {
.ffprobeKitListMediaInformationSessions()
.then((sessions) {
if (sessions == null) { if (sessions == null) {
return List.empty(); return List.empty();
} else { } else {
return sessions return sessions
.map((dynamic sessionObject) => FFmpegKitFactory.mapToSession( .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession(sessionObject as Map<dynamic, dynamic>))
sessionObject as Map<dynamic, dynamic>))
.map((session) => session as MediaInformationSession) .map((session) => session as MediaInformationSession)
.toList(); .toList();
} }
@ -575,19 +556,15 @@ class FFmpegKitConfig {
} }
/// Returns sessions that have [sessionState]. /// Returns sessions that have [sessionState].
static Future<List<Session>> getSessionsByState( static Future<List<Session>> getSessionsByState(SessionState sessionState) async {
SessionState sessionState) async {
try { try {
await init(); await init();
return _platform return _platform.ffmpegKitConfigGetSessionsByState(sessionState.index).then((sessions) {
.ffmpegKitConfigGetSessionsByState(sessionState.index)
.then((sessions) {
if (sessions == null) { if (sessions == null) {
return List.empty(); return List.empty();
} else { } else {
return sessions return sessions
.map((dynamic sessionObject) => FFmpegKitFactory.mapToSession( .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession(sessionObject as Map<dynamic, dynamic>))
sessionObject as Map<dynamic, dynamic>))
.toList(); .toList();
} }
}); });
@ -598,12 +575,10 @@ class FFmpegKitConfig {
} }
/// Returns the active log redirection strategy. /// Returns the active log redirection strategy.
static LogRedirectionStrategy getLogRedirectionStrategy() => static LogRedirectionStrategy getLogRedirectionStrategy() => _globalLogRedirectionStrategy;
_globalLogRedirectionStrategy;
/// Sets the log redirection strategy. /// Sets the log redirection strategy.
static void setLogRedirectionStrategy( static void setLogRedirectionStrategy(LogRedirectionStrategy logRedirectionStrategy) {
LogRedirectionStrategy logRedirectionStrategy) {
_globalLogRedirectionStrategy = logRedirectionStrategy; _globalLogRedirectionStrategy = logRedirectionStrategy;
} }
@ -630,8 +605,6 @@ class FFmpegKitConfig {
return "FAILED"; return "FAILED";
case SessionState.completed: case SessionState.completed:
return "COMPLETED"; return "COMPLETED";
default:
return "";
} }
} }
@ -660,8 +633,7 @@ class FFmpegKitConfig {
argumentList.add(currentArgument.toString()); argumentList.add(currentArgument.toString());
currentArgument = new StringBuffer(); currentArgument = new StringBuffer();
} }
} else if (currentChar == '\''.codeUnitAt(0) && } else if (currentChar == '\''.codeUnitAt(0) && (previousChar == null || previousChar != '\\'.codeUnitAt(0))) {
(previousChar == null || previousChar != '\\'.codeUnitAt(0))) {
if (singleQuoteStarted) { if (singleQuoteStarted) {
singleQuoteStarted = false; singleQuoteStarted = false;
} else if (doubleQuoteStarted) { } else if (doubleQuoteStarted) {
@ -669,8 +641,7 @@ class FFmpegKitConfig {
} else { } else {
singleQuoteStarted = true; singleQuoteStarted = true;
} }
} else if (currentChar == '\"'.codeUnitAt(0) && } else if (currentChar == '\"'.codeUnitAt(0) && (previousChar == null || previousChar != '\\'.codeUnitAt(0))) {
(previousChar == null || previousChar != '\\'.codeUnitAt(0))) {
if (doubleQuoteStarted) { if (doubleQuoteStarted) {
doubleQuoteStarted = false; doubleQuoteStarted = false;
} else if (singleQuoteStarted) { } else if (singleQuoteStarted) {
@ -782,8 +753,7 @@ class FFmpegKitConfig {
/// ///
/// Note that this method is Android only. It will fail if called on other /// Note that this method is Android only. It will fail if called on other
/// platforms. /// platforms.
static Future<String?> selectDocumentForRead( static Future<String?> selectDocumentForRead([String? type = null, List<String>? extraTypes = null]) async {
[String? type = null, List<String>? extraTypes = null]) async {
try { try {
await init(); await init();
return _platform.ffmpegKitConfigSelectDocumentForRead(type, extraTypes); return _platform.ffmpegKitConfigSelectDocumentForRead(type, extraTypes);
@ -799,14 +769,14 @@ class FFmpegKitConfig {
/// ///
/// Note that this method is Android only. It will fail if called on other /// Note that this method is Android only. It will fail if called on other
/// platforms. /// platforms.
static Future<String?> selectDocumentForWrite( static Future<String?> selectDocumentForWrite([
[String? title = null, String? title = null,
String? type = null, String? type = null,
List<String>? extraTypes = null]) async { List<String>? extraTypes = null,
]) async {
try { try {
await init(); await init();
return _platform.ffmpegKitConfigSelectDocumentForWrite( return _platform.ffmpegKitConfigSelectDocumentForWrite(title, type, extraTypes);
title, type, extraTypes);
} on PlatformException catch (e, stack) { } on PlatformException catch (e, stack) {
print("Plugin selectDocumentForWrite error: ${e.message}"); print("Plugin selectDocumentForWrite error: ${e.message}");
return Future.error("selectDocumentForWrite failed.", stack); return Future.error("selectDocumentForWrite failed.", stack);

@ -32,17 +32,17 @@ import 'statistics_callback.dart';
/// An FFmpeg session. /// An FFmpeg session.
class FFmpegSession extends AbstractSession { class FFmpegSession extends AbstractSession {
/// Creates a new FFmpeg session with [argumentsArray]. /// Creates a new FFmpeg session with [argumentsArray].
static Future<FFmpegSession> create(List<String> argumentsArray, static Future<FFmpegSession> create(
[FFmpegSessionCompleteCallback? completeCallback = null, List<String> argumentsArray, [
FFmpegSessionCompleteCallback? completeCallback = null,
LogCallback? logCallback = null, LogCallback? logCallback = null,
StatisticsCallback? statisticsCallback = null, StatisticsCallback? statisticsCallback = null,
LogRedirectionStrategy? logRedirectionStrategy = null]) async { LogRedirectionStrategy? logRedirectionStrategy = null,
final session = await AbstractSession.createFFmpegSession( ]) async {
argumentsArray, logRedirectionStrategy); final session = await AbstractSession.createFFmpegSession(argumentsArray, logRedirectionStrategy);
final sessionId = session.getSessionId(); final sessionId = session.getSessionId();
FFmpegKitFactory.setFFmpegSessionCompleteCallback( FFmpegKitFactory.setFFmpegSessionCompleteCallback(sessionId, completeCallback);
sessionId, completeCallback);
FFmpegKitFactory.setLogCallback(sessionId, logCallback); FFmpegKitFactory.setLogCallback(sessionId, logCallback);
FFmpegKitFactory.setStatisticsCallback(sessionId, statisticsCallback); FFmpegKitFactory.setStatisticsCallback(sessionId, statisticsCallback);
@ -50,8 +50,7 @@ class FFmpegSession extends AbstractSession {
} }
/// Returns the session specific statistics callback. /// Returns the session specific statistics callback.
StatisticsCallback? getStatisticsCallback() => StatisticsCallback? getStatisticsCallback() => FFmpegKitFactory.getStatisticsCallback(this.getSessionId());
FFmpegKitFactory.getStatisticsCallback(this.getSessionId());
/// Returns the session specific complete callback. /// Returns the session specific complete callback.
FFmpegSessionCompleteCallback? getCompleteCallback() => FFmpegSessionCompleteCallback? getCompleteCallback() =>
@ -63,16 +62,17 @@ class FFmpegSession extends AbstractSession {
Future<List<Statistics>> getAllStatistics([int? waitTimeout]) async { Future<List<Statistics>> getAllStatistics([int? waitTimeout]) async {
try { try {
await FFmpegKitConfig.init(); await FFmpegKitConfig.init();
return FFmpegKitPlatform.instance return FFmpegKitPlatform.instance.ffmpegSessionGetAllStatistics(this.getSessionId(), waitTimeout).then((
.ffmpegSessionGetAllStatistics(this.getSessionId(), waitTimeout) allStatistics,
.then((allStatistics) { ) {
if (allStatistics == null) { if (allStatistics == null) {
return List.empty(); return List.empty();
} else { } else {
return allStatistics return allStatistics
.map((dynamic statisticsObject) => .map(
FFmpegKitFactory.mapToStatistics( (dynamic statisticsObject) =>
statisticsObject as Map<dynamic, dynamic>)) FFmpegKitFactory.mapToStatistics(statisticsObject as Map<dynamic, dynamic>),
)
.toList(); .toList();
} }
}); });
@ -88,16 +88,15 @@ class FFmpegSession extends AbstractSession {
Future<List<Statistics>> getStatistics() async { Future<List<Statistics>> getStatistics() async {
try { try {
await FFmpegKitConfig.init(); await FFmpegKitConfig.init();
return FFmpegKitPlatform.instance return FFmpegKitPlatform.instance.ffmpegSessionGetStatistics(this.getSessionId()).then((statistics) {
.ffmpegSessionGetStatistics(this.getSessionId())
.then((statistics) {
if (statistics == null) { if (statistics == null) {
return List.empty(); return List.empty();
} else { } else {
return statistics return statistics
.map((dynamic statisticsObject) => .map(
FFmpegKitFactory.mapToStatistics( (dynamic statisticsObject) =>
statisticsObject as Map<dynamic, dynamic>)) FFmpegKitFactory.mapToStatistics(statisticsObject as Map<dynamic, dynamic>),
)
.toList(); .toList();
} }
}); });
@ -108,8 +107,7 @@ class FFmpegSession extends AbstractSession {
} }
/// Returns the last received statistics entry. /// Returns the last received statistics entry.
Future<Statistics?> getLastReceivedStatistics() async => Future<Statistics?> getLastReceivedStatistics() async => this.getStatistics().then((statistics) {
this.getStatistics().then((statistics) {
if (statistics.length > 0) { if (statistics.length > 0) {
return statistics[statistics.length - 1]; return statistics[statistics.length - 1];
} else { } else {

@ -39,10 +39,8 @@ class FFprobeKit {
FFprobeKit.executeWithArguments(FFmpegKitConfig.parseArguments(command)); FFprobeKit.executeWithArguments(FFmpegKitConfig.parseArguments(command));
/// Synchronously executes FFprobe with arguments provided. /// Synchronously executes FFprobe with arguments provided.
static Future<FFprobeSession> executeWithArguments( static Future<FFprobeSession> executeWithArguments(List<String> commandArguments) async {
List<String> commandArguments) async { final session = await FFprobeSession.create(commandArguments, null, null, null);
final session =
await FFprobeSession.create(commandArguments, null, null, null);
await FFmpegKitConfig.ffprobeExecute(session); await FFmpegKitConfig.ffprobeExecute(session);
@ -54,24 +52,23 @@ class FFprobeKit {
/// ///
/// Note that this method returns immediately and does not wait the execution to complete. You must use an /// Note that this method returns immediately and does not wait the execution to complete. You must use an
/// [FFprobeSessionCompleteCallback] if you want to be notified about the result. /// [FFprobeSessionCompleteCallback] if you want to be notified about the result.
static Future<FFprobeSession> executeAsync(String command, static Future<FFprobeSession> executeAsync(
[FFprobeSessionCompleteCallback? completeCallback = null, String command, [
LogCallback? logCallback = null]) async => FFprobeSessionCompleteCallback? completeCallback = null,
FFprobeKit.executeWithArgumentsAsync( LogCallback? logCallback = null,
FFmpegKitConfig.parseArguments(command), ]) async =>
completeCallback, FFprobeKit.executeWithArgumentsAsync(FFmpegKitConfig.parseArguments(command), completeCallback, logCallback);
logCallback);
/// Starts an asynchronous FFprobe execution with arguments provided. /// Starts an asynchronous FFprobe execution with arguments provided.
/// ///
/// Note that this method returns immediately and does not wait the execution to complete. You must use an /// Note that this method returns immediately and does not wait the execution to complete. You must use an
/// [FFprobeSessionCompleteCallback] if you want to be notified about the result. /// [FFprobeSessionCompleteCallback] if you want to be notified about the result.
static Future<FFprobeSession> executeWithArgumentsAsync( static Future<FFprobeSession> executeWithArgumentsAsync(
List<String> commandArguments, List<String> commandArguments, [
[FFprobeSessionCompleteCallback? completeCallback = null, FFprobeSessionCompleteCallback? completeCallback = null,
LogCallback? logCallback = null]) async { LogCallback? logCallback = null,
final session = await FFprobeSession.create( ]) async {
commandArguments, completeCallback, logCallback, null); final session = await FFprobeSession.create(commandArguments, completeCallback, logCallback, null);
await FFmpegKitConfig.asyncFFprobeExecute(session); await FFmpegKitConfig.asyncFFprobeExecute(session);
@ -79,8 +76,7 @@ class FFprobeKit {
} }
/// Extracts media information for the file specified with path. /// Extracts media information for the file specified with path.
static Future<MediaInformationSession> getMediaInformation(String path, static Future<MediaInformationSession> getMediaInformation(String path, [int? waitTimeout = null]) async {
[int? waitTimeout = null]) async {
final commandArguments = [ final commandArguments = [
"-v", "-v",
"error", "error",
@ -91,29 +87,27 @@ class FFprobeKit {
"-show_streams", "-show_streams",
"-show_chapters", "-show_chapters",
"-i", "-i",
path path,
]; ];
return FFprobeKit.getMediaInformationFromCommandArguments( return FFprobeKit.getMediaInformationFromCommandArguments(commandArguments, waitTimeout);
commandArguments, waitTimeout);
} }
/// Extracts media information using the command provided. The command /// Extracts media information using the command provided. The command
/// passed to this method must generate the output in JSON format in order to /// passed to this method must generate the output in JSON format in order to
/// successfully extract media information from it. /// successfully extract media information from it.
static Future<MediaInformationSession> getMediaInformationFromCommand( static Future<MediaInformationSession> getMediaInformationFromCommand(
String command, String command, [
[int? waitTimeout = null]) async => int? waitTimeout = null,
FFprobeKit.getMediaInformationFromCommandArguments( ]) async => FFprobeKit.getMediaInformationFromCommandArguments(FFmpegKitConfig.parseArguments(command), waitTimeout);
FFmpegKitConfig.parseArguments(command), waitTimeout);
/// Extracts media information using the command arguments provided. The /// Extracts media information using the command arguments provided. The
/// command passed to this method must generate the output in JSON format in /// command passed to this method must generate the output in JSON format in
/// order to successfully extract media information from it. /// order to successfully extract media information from it.
static Future<MediaInformationSession> static Future<MediaInformationSession> getMediaInformationFromCommandArguments(
getMediaInformationFromCommandArguments(List<String> commandArguments, List<String> commandArguments, [
[int? waitTimeout = null]) async { int? waitTimeout = null,
final session = ]) async {
await MediaInformationSession.create(commandArguments, null, null); final session = await MediaInformationSession.create(commandArguments, null, null);
await FFmpegKitConfig.getMediaInformationExecute(session, waitTimeout); await FFmpegKitConfig.getMediaInformationExecute(session, waitTimeout);
@ -131,10 +125,12 @@ class FFprobeKit {
/// ///
/// Note that this method returns immediately and does not wait the execution to complete. You must use an /// Note that this method returns immediately and does not wait the execution to complete. You must use an
/// [MediaInformationSessionCompleteCallback] if you want to be notified about the result. /// [MediaInformationSessionCompleteCallback] if you want to be notified about the result.
static Future<MediaInformationSession> getMediaInformationAsync(String path, static Future<MediaInformationSession> getMediaInformationAsync(
[MediaInformationSessionCompleteCallback? completeCallback = null, String path, [
MediaInformationSessionCompleteCallback? completeCallback = null,
LogCallback? logCallback = null, LogCallback? logCallback = null,
int? waitTimeout = null]) async { int? waitTimeout = null,
]) async {
final commandArguments = [ final commandArguments = [
"-v", "-v",
"error", "error",
@ -145,10 +141,14 @@ class FFprobeKit {
"-show_streams", "-show_streams",
"-show_chapters", "-show_chapters",
"-i", "-i",
path path,
]; ];
return FFprobeKit.getMediaInformationFromCommandArgumentsAsync( return FFprobeKit.getMediaInformationFromCommandArgumentsAsync(
commandArguments, completeCallback, logCallback, waitTimeout); commandArguments,
completeCallback,
logCallback,
waitTimeout,
);
} }
/// Starts an asynchronous FFprobe execution to extract media information using a command. The command passed to /// Starts an asynchronous FFprobe execution to extract media information using a command. The command passed to
@ -157,15 +157,16 @@ class FFprobeKit {
/// Note that this method returns immediately and does not wait the execution to complete. You must use an /// Note that this method returns immediately and does not wait the execution to complete. You must use an
/// [MediaInformationSessionCompleteCallback] if you want to be notified about the result. /// [MediaInformationSessionCompleteCallback] if you want to be notified about the result.
static Future<MediaInformationSession> getMediaInformationFromCommandAsync( static Future<MediaInformationSession> getMediaInformationFromCommandAsync(
String command, String command, [
[MediaInformationSessionCompleteCallback? completeCallback = null, MediaInformationSessionCompleteCallback? completeCallback = null,
LogCallback? logCallback = null, LogCallback? logCallback = null,
int? waitTimeout = null]) async => int? waitTimeout = null,
FFprobeKit.getMediaInformationFromCommandArgumentsAsync( ]) async => FFprobeKit.getMediaInformationFromCommandArgumentsAsync(
FFmpegKitConfig.parseArguments(command), FFmpegKitConfig.parseArguments(command),
completeCallback, completeCallback,
logCallback, logCallback,
waitTimeout); waitTimeout,
);
/// Starts an asynchronous FFprobe execution to extract media information /// Starts an asynchronous FFprobe execution to extract media information
/// using command arguments. The command passed to this method must generate /// using command arguments. The command passed to this method must generate
@ -175,14 +176,13 @@ class FFprobeKit {
/// Note that this method returns immediately and does not wait the execution /// Note that this method returns immediately and does not wait the execution
/// to complete. You must use an [MediaInformationSessionCompleteCallback] if you want to be /// to complete. You must use an [MediaInformationSessionCompleteCallback] if you want to be
/// notified about the result. /// notified about the result.
static Future<MediaInformationSession> static Future<MediaInformationSession> getMediaInformationFromCommandArgumentsAsync(
getMediaInformationFromCommandArgumentsAsync( List<String> commandArguments, [
List<String> commandArguments, MediaInformationSessionCompleteCallback? completeCallback = null,
[MediaInformationSessionCompleteCallback? completeCallback = null,
LogCallback? logCallback = null, LogCallback? logCallback = null,
int? waitTimeout = null]) async { int? waitTimeout = null,
final session = await MediaInformationSession.create( ]) async {
commandArguments, completeCallback, logCallback); final session = await MediaInformationSession.create(commandArguments, completeCallback, logCallback);
await FFmpegKitConfig.asyncGetMediaInformationExecute(session, waitTimeout); await FFmpegKitConfig.asyncGetMediaInformationExecute(session, waitTimeout);
@ -205,8 +205,7 @@ class FFprobeKit {
return List.empty(); return List.empty();
} else { } else {
return sessions return sessions
.map((dynamic sessionObject) => FFmpegKitFactory.mapToSession( .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession(sessionObject as Map<dynamic, dynamic>))
sessionObject as Map<dynamic, dynamic>))
.map((session) => session as FFprobeSession) .map((session) => session as FFprobeSession)
.toList(); .toList();
} }
@ -218,19 +217,15 @@ class FFprobeKit {
} }
/// Lists all MediaInformation sessions in the session history. /// Lists all MediaInformation sessions in the session history.
static Future<List<MediaInformationSession>> static Future<List<MediaInformationSession>> listMediaInformationSessions() async {
listMediaInformationSessions() async {
try { try {
await FFmpegKitConfig.init(); await FFmpegKitConfig.init();
return _platform return _platform.ffprobeKitListMediaInformationSessions().then((sessions) {
.ffprobeKitListMediaInformationSessions()
.then((sessions) {
if (sessions == null) { if (sessions == null) {
return List.empty(); return List.empty();
} else { } else {
return sessions return sessions
.map((dynamic sessionObject) => FFmpegKitFactory.mapToSession( .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession(sessionObject as Map<dynamic, dynamic>))
sessionObject as Map<dynamic, dynamic>))
.map((session) => session as MediaInformationSession) .map((session) => session as MediaInformationSession)
.toList(); .toList();
} }

@ -26,16 +26,16 @@ import 'src/ffmpeg_kit_factory.dart';
/// An FFprobe session. /// An FFprobe session.
class FFprobeSession extends AbstractSession { class FFprobeSession extends AbstractSession {
/// Creates a new FFprobe session with [argumentsArray]. /// Creates a new FFprobe session with [argumentsArray].
static Future<FFprobeSession> create(List<String> argumentsArray, static Future<FFprobeSession> create(
[FFprobeSessionCompleteCallback? completeCallback = null, List<String> argumentsArray, [
FFprobeSessionCompleteCallback? completeCallback = null,
LogCallback? logCallback = null, LogCallback? logCallback = null,
LogRedirectionStrategy? logRedirectionStrategy = null]) async { LogRedirectionStrategy? logRedirectionStrategy = null,
final session = await AbstractSession.createFFprobeSession( ]) async {
argumentsArray, logRedirectionStrategy); final session = await AbstractSession.createFFprobeSession(argumentsArray, logRedirectionStrategy);
final sessionId = session.getSessionId(); final sessionId = session.getSessionId();
FFmpegKitFactory.setFFprobeSessionCompleteCallback( FFmpegKitFactory.setFFprobeSessionCompleteCallback(sessionId, completeCallback);
sessionId, completeCallback);
FFmpegKitFactory.setLogCallback(sessionId, logCallback); FFmpegKitFactory.setLogCallback(sessionId, logCallback);
return session; return session;

@ -22,5 +22,5 @@ enum LogRedirectionStrategy {
printLogsWhenNoCallbacksDefined, printLogsWhenNoCallbacksDefined,
printLogsWhenGlobalCallbackNotDefined, printLogsWhenGlobalCallbackNotDefined,
printLogsWhenSessionCallbackNotDefined, printLogsWhenSessionCallbackNotDefined,
neverPrintLogs neverPrintLogs,
} }

@ -38,35 +38,28 @@ class MediaInformation {
MediaInformation(this._allProperties); MediaInformation(this._allProperties);
/// Returns file name. /// Returns file name.
String? getFilename() => String? getFilename() => this.getStringFormatProperty(MediaInformation.keyFilename);
this.getStringFormatProperty(MediaInformation.keyFilename);
/// Returns format. /// Returns format.
String? getFormat() => String? getFormat() => this.getStringFormatProperty(MediaInformation.keyFormat);
this.getStringFormatProperty(MediaInformation.keyFormat);
/// Returns long format. /// Returns long format.
String? getLongFormat() => String? getLongFormat() => this.getStringFormatProperty(MediaInformation.keyFormatLong);
this.getStringFormatProperty(MediaInformation.keyFormatLong);
/// Returns duration. /// Returns duration.
String? getDuration() => String? getDuration() => this.getStringFormatProperty(MediaInformation.keyDuration);
this.getStringFormatProperty(MediaInformation.keyDuration);
/// Returns start time. /// Returns start time.
String? getStartTime() => String? getStartTime() => this.getStringFormatProperty(MediaInformation.keyStartTime);
this.getStringFormatProperty(MediaInformation.keyStartTime);
/// Returns size. /// Returns size.
String? getSize() => this.getStringFormatProperty(MediaInformation.keySize); String? getSize() => this.getStringFormatProperty(MediaInformation.keySize);
/// Returns bitrate. /// Returns bitrate.
String? getBitrate() => String? getBitrate() => this.getStringFormatProperty(MediaInformation.keyBitRate);
this.getStringFormatProperty(MediaInformation.keyBitRate);
/// Returns all tags. /// Returns all tags.
Map<dynamic, dynamic>? getTags() => Map<dynamic, dynamic>? getTags() => this.getFormatProperty(StreamInformation.keyTags);
this.getFormatProperty(StreamInformation.keyTags);
/// Returns the property associated with the key. /// Returns the property associated with the key.
String? getStringProperty(String key) => this.getAllProperties()?[key]; String? getStringProperty(String key) => this.getAllProperties()?[key];
@ -78,8 +71,7 @@ class MediaInformation {
dynamic getProperty(String key) => this.getAllProperties()?[key]; dynamic getProperty(String key) => this.getAllProperties()?[key];
/// Returns the format property associated with the key. /// Returns the format property associated with the key.
String? getStringFormatProperty(String key) => String? getStringFormatProperty(String key) => this.getFormatProperties()?[key];
this.getFormatProperties()?[key];
/// Returns the format property associated with the key. /// Returns the format property associated with the key.
num? getNumberFormatProperty(String key) => this.getFormatProperties()?[key]; num? getNumberFormatProperty(String key) => this.getFormatProperties()?[key];
@ -89,8 +81,7 @@ class MediaInformation {
/// Returns all streams found as a list. /// Returns all streams found as a list.
List<StreamInformation> getStreams() { List<StreamInformation> getStreams() {
final List<StreamInformation> list = final List<StreamInformation> list = List<StreamInformation>.empty(growable: true);
List<StreamInformation>.empty(growable: true);
dynamic createStreamInformation(Map<dynamic, dynamic> streamProperties) => dynamic createStreamInformation(Map<dynamic, dynamic> streamProperties) =>
list.add(new StreamInformation(streamProperties)); list.add(new StreamInformation(streamProperties));
@ -106,8 +97,7 @@ class MediaInformation {
List<Chapter> getChapters() { List<Chapter> getChapters() {
final List<Chapter> list = List<Chapter>.empty(growable: true); final List<Chapter> list = List<Chapter>.empty(growable: true);
dynamic createChapter(Map<dynamic, dynamic> chapterProperties) => dynamic createChapter(Map<dynamic, dynamic> chapterProperties) => list.add(new Chapter(chapterProperties));
list.add(new Chapter(chapterProperties));
this._allProperties?["chapters"]?.forEach((Object? chapter) { this._allProperties?["chapters"]?.forEach((Object? chapter) {
createChapter(chapter as Map<dynamic, dynamic>); createChapter(chapter as Map<dynamic, dynamic>);
@ -117,8 +107,7 @@ class MediaInformation {
} }
/// Returns all format properties found. /// Returns all format properties found.
Map<dynamic, dynamic>? getFormatProperties() => Map<dynamic, dynamic>? getFormatProperties() => this._allProperties?[keyFormatProperties];
this._allProperties?[keyFormatProperties];
/// Returns all properties found, including stream properties. /// Returns all properties found, including stream properties.
Map<dynamic, dynamic>? getAllProperties() => this._allProperties; Map<dynamic, dynamic>? getAllProperties() => this._allProperties;

@ -33,9 +33,7 @@ class MediaInformationJsonParser {
static Future<MediaInformation?> from(String ffprobeJsonOutput) async { static Future<MediaInformation?> from(String ffprobeJsonOutput) async {
try { try {
await FFmpegKitConfig.init(); await FFmpegKitConfig.init();
return _platform return _platform.mediaInformationJsonParserFrom(ffprobeJsonOutput).then((properties) {
.mediaInformationJsonParserFrom(ffprobeJsonOutput)
.then((properties) {
if (properties == null || properties.length == 0) { if (properties == null || properties.length == 0) {
return null; return null;
} else { } else {
@ -49,8 +47,7 @@ class MediaInformationJsonParser {
} }
/// Extracts MediaInformation from the given FFprobe json output. /// Extracts MediaInformation from the given FFprobe json output.
static Future<MediaInformation> fromWithError( static Future<MediaInformation> fromWithError(String ffprobeJsonOutput) async {
String ffprobeJsonOutput) async {
try { try {
await FFmpegKitConfig.init(); await FFmpegKitConfig.init();
return _platform return _platform

@ -29,15 +29,15 @@ class MediaInformationSession extends AbstractSession {
MediaInformation? _mediaInformation; MediaInformation? _mediaInformation;
/// Creates a new MediaInformation session with [argumentsArray]. /// Creates a new MediaInformation session with [argumentsArray].
static Future<MediaInformationSession> create(List<String> argumentsArray, static Future<MediaInformationSession> create(
[MediaInformationSessionCompleteCallback? completeCallback = null, List<String> argumentsArray, [
LogCallback? logCallback = null]) async { MediaInformationSessionCompleteCallback? completeCallback = null,
final session = LogCallback? logCallback = null,
await AbstractSession.createMediaInformationSession(argumentsArray); ]) async {
final session = await AbstractSession.createMediaInformationSession(argumentsArray);
final sessionId = session.getSessionId(); final sessionId = session.getSessionId();
FFmpegKitFactory.setMediaInformationSessionCompleteCallback( FFmpegKitFactory.setMediaInformationSessionCompleteCallback(sessionId, completeCallback);
sessionId, completeCallback);
FFmpegKitFactory.setLogCallback(sessionId, logCallback); FFmpegKitFactory.setLogCallback(sessionId, logCallback);
return session; return session;
@ -53,8 +53,7 @@ class MediaInformationSession extends AbstractSession {
/// Returns the session specific complete callback. /// Returns the session specific complete callback.
MediaInformationSessionCompleteCallback? getCompleteCallback() => MediaInformationSessionCompleteCallback? getCompleteCallback() =>
FFmpegKitFactory.getMediaInformationSessionCompleteCallback( FFmpegKitFactory.getMediaInformationSessionCompleteCallback(this.getSessionId());
this.getSessionId());
bool isFFmpeg() => false; bool isFFmpeg() => false;

@ -26,5 +26,4 @@ import 'media_information_session.dart';
/// see the execution result. /// see the execution result.
/// If "getState" returns SessionState.failed then "getFailStackTrace" should /// If "getState" returns SessionState.failed then "getFailStackTrace" should
/// be used to get the failure reason. /// be used to get the failure reason.
typedef MediaInformationSessionCompleteCallback = void Function( typedef MediaInformationSessionCompleteCallback = void Function(MediaInformationSession session);
MediaInformationSession session);

@ -25,18 +25,15 @@ class ReturnCode {
ReturnCode(this._value); ReturnCode(this._value);
static bool isSuccess(ReturnCode? returnCode) => static bool isSuccess(ReturnCode? returnCode) => returnCode?.getValue() == ReturnCode.success;
returnCode?.getValue() == ReturnCode.success;
static bool isCancel(ReturnCode? returnCode) => static bool isCancel(ReturnCode? returnCode) => returnCode?.getValue() == ReturnCode.cancel;
returnCode?.getValue() == ReturnCode.cancel;
int getValue() => this._value; int getValue() => this._value;
bool isValueSuccess() => this._value == ReturnCode.success; bool isValueSuccess() => this._value == ReturnCode.success;
bool isValueError() => bool isValueError() => (this._value != ReturnCode.success) && (this._value != ReturnCode.cancel);
(this._value != ReturnCode.success) && (this._value != ReturnCode.cancel);
bool isValueCancel() => this._value == ReturnCode.cancel; bool isValueCancel() => this._value == ReturnCode.cancel;

@ -29,12 +29,9 @@ import '../session.dart';
import '../statistics.dart'; import '../statistics.dart';
import '../statistics_callback.dart'; import '../statistics_callback.dart';
final ffmpegSessionCompleteCallbackMap = final ffmpegSessionCompleteCallbackMap = new Map<int, FFmpegSessionCompleteCallback>();
new Map<int, FFmpegSessionCompleteCallback>(); final ffprobeSessionCompleteCallbackMap = new Map<int, FFprobeSessionCompleteCallback>();
final ffprobeSessionCompleteCallbackMap = final mediaInformationSessionCompleteCallbackMap = new Map<int, MediaInformationSessionCompleteCallback>();
new Map<int, FFprobeSessionCompleteCallback>();
final mediaInformationSessionCompleteCallbackMap =
new Map<int, MediaInformationSessionCompleteCallback>();
final logCallbackMap = new Map<int, LogCallback>(); final logCallbackMap = new Map<int, LogCallback>();
final statisticsCallbackMap = new Map<int, StatisticsCallback>(); final statisticsCallbackMap = new Map<int, StatisticsCallback>();
final logRedirectionStrategyMap = new Map<int, LogRedirectionStrategy>(); final logRedirectionStrategyMap = new Map<int, LogRedirectionStrategy>();
@ -44,11 +41,9 @@ class FFmpegKitFactory {
static StatisticsCallback? _statisticsCallback; static StatisticsCallback? _statisticsCallback;
static FFmpegSessionCompleteCallback? _ffmpegSessionCompleteCallback; static FFmpegSessionCompleteCallback? _ffmpegSessionCompleteCallback;
static FFprobeSessionCompleteCallback? _ffprobeSessionCompleteCallback; static FFprobeSessionCompleteCallback? _ffprobeSessionCompleteCallback;
static MediaInformationSessionCompleteCallback? static MediaInformationSessionCompleteCallback? _mediaInformationSessionCompleteCallback;
_mediaInformationSessionCompleteCallback;
static Statistics mapToStatistics(Map<dynamic, dynamic> statisticsMap) => static Statistics mapToStatistics(Map<dynamic, dynamic> statisticsMap) => new Statistics(
new Statistics(
statisticsMap["sessionId"], statisticsMap["sessionId"],
statisticsMap["videoFrameNumber"], statisticsMap["videoFrameNumber"],
statisticsMap["videoFps"], statisticsMap["videoFps"],
@ -56,10 +51,10 @@ class FFmpegKitFactory {
statisticsMap["size"], statisticsMap["size"],
statisticsMap["time"], statisticsMap["time"],
statisticsMap["bitrate"], statisticsMap["bitrate"],
statisticsMap["speed"]); statisticsMap["speed"],
);
static Log mapToLog(Map<dynamic, dynamic> logMap) => static Log mapToLog(Map<dynamic, dynamic> logMap) => new Log(logMap["sessionId"], logMap["level"], logMap["message"]);
new Log(logMap["sessionId"], logMap["level"], logMap["message"]);
static Session mapToSession(Map<dynamic, dynamic> sessionMap) { static Session mapToSession(Map<dynamic, dynamic> sessionMap) {
switch (sessionMap["type"]) { switch (sessionMap["type"]) {
@ -79,8 +74,7 @@ class FFmpegKitFactory {
case 2: case 2:
return AbstractSession.createFFprobeSessionFromMap(sessionMap); return AbstractSession.createFFprobeSessionFromMap(sessionMap);
case 3: case 3:
return AbstractSession.createMediaInformationSessionFromMap( return AbstractSession.createMediaInformationSessionFromMap(sessionMap);
sessionMap);
case 1: case 1:
default: default:
return AbstractSession.createFFmpegSessionFromMap(sessionMap); return AbstractSession.createFFmpegSessionFromMap(sessionMap);
@ -90,8 +84,7 @@ class FFmpegKitFactory {
} }
} }
static MediaInformation? mapToNullableMediaInformation( static MediaInformation? mapToNullableMediaInformation(Map<dynamic, dynamic>? mediaInformationMap) {
Map<dynamic, dynamic>? mediaInformationMap) {
if (mediaInformationMap != null) { if (mediaInformationMap != null) {
return new MediaInformation(mediaInformationMap); return new MediaInformation(mediaInformationMap);
} else { } else {
@ -101,18 +94,15 @@ class FFmpegKitFactory {
static String getVersion() => "6.0.3"; static String getVersion() => "6.0.3";
static LogRedirectionStrategy? getLogRedirectionStrategy(int? sessionId) => static LogRedirectionStrategy? getLogRedirectionStrategy(int? sessionId) => logRedirectionStrategyMap[sessionId];
logRedirectionStrategyMap[sessionId];
static void setLogRedirectionStrategy( static void setLogRedirectionStrategy(int? sessionId, LogRedirectionStrategy? logRedirectionStrategy) {
int? sessionId, LogRedirectionStrategy? logRedirectionStrategy) {
if (sessionId != null && logRedirectionStrategy != null) { if (sessionId != null && logRedirectionStrategy != null) {
logRedirectionStrategyMap[sessionId] = logRedirectionStrategy; logRedirectionStrategyMap[sessionId] = logRedirectionStrategy;
} }
} }
static LogCallback? getLogCallback(int? sessionId) => static LogCallback? getLogCallback(int? sessionId) => logCallbackMap[sessionId];
logCallbackMap[sessionId];
static void setLogCallback(int? sessionId, LogCallback? logCallback) { static void setLogCallback(int? sessionId, LogCallback? logCallback) {
if (sessionId != null && logCallback != null) { if (sessionId != null && logCallback != null) {
@ -126,81 +116,68 @@ class FFmpegKitFactory {
_logCallback = logCallback; _logCallback = logCallback;
} }
static StatisticsCallback? getStatisticsCallback(int? sessionId) => static StatisticsCallback? getStatisticsCallback(int? sessionId) => statisticsCallbackMap[sessionId];
statisticsCallbackMap[sessionId];
static void setStatisticsCallback( static void setStatisticsCallback(int? sessionId, StatisticsCallback? statisticsCallback) {
int? sessionId, StatisticsCallback? statisticsCallback) {
if (sessionId != null && statisticsCallback != null) { if (sessionId != null && statisticsCallback != null) {
statisticsCallbackMap[sessionId] = statisticsCallback; statisticsCallbackMap[sessionId] = statisticsCallback;
} }
} }
static StatisticsCallback? getGlobalStatisticsCallback() => static StatisticsCallback? getGlobalStatisticsCallback() => _statisticsCallback;
_statisticsCallback;
static void setGlobalStatisticsCallback( static void setGlobalStatisticsCallback(StatisticsCallback? statisticsCallback) {
StatisticsCallback? statisticsCallback) {
_statisticsCallback = statisticsCallback; _statisticsCallback = statisticsCallback;
} }
static FFmpegSessionCompleteCallback? getFFmpegSessionCompleteCallback( static FFmpegSessionCompleteCallback? getFFmpegSessionCompleteCallback(int? sessionId) =>
int? sessionId) =>
ffmpegSessionCompleteCallbackMap[sessionId]; ffmpegSessionCompleteCallbackMap[sessionId];
static void setFFmpegSessionCompleteCallback( static void setFFmpegSessionCompleteCallback(int? sessionId, FFmpegSessionCompleteCallback? completeCallback) {
int? sessionId, FFmpegSessionCompleteCallback? completeCallback) {
if (sessionId != null && completeCallback != null) { if (sessionId != null && completeCallback != null) {
ffmpegSessionCompleteCallbackMap[sessionId] = completeCallback; ffmpegSessionCompleteCallbackMap[sessionId] = completeCallback;
} }
} }
static FFmpegSessionCompleteCallback? static FFmpegSessionCompleteCallback? getGlobalFFmpegSessionCompleteCallback() => _ffmpegSessionCompleteCallback;
getGlobalFFmpegSessionCompleteCallback() =>
_ffmpegSessionCompleteCallback;
static void setGlobalFFmpegSessionCompleteCallback( static void setGlobalFFmpegSessionCompleteCallback(FFmpegSessionCompleteCallback? completeCallback) {
FFmpegSessionCompleteCallback? completeCallback) {
_ffmpegSessionCompleteCallback = completeCallback; _ffmpegSessionCompleteCallback = completeCallback;
} }
static FFprobeSessionCompleteCallback? getFFprobeSessionCompleteCallback( static FFprobeSessionCompleteCallback? getFFprobeSessionCompleteCallback(int? sessionId) =>
int? sessionId) =>
ffprobeSessionCompleteCallbackMap[sessionId]; ffprobeSessionCompleteCallbackMap[sessionId];
static void setFFprobeSessionCompleteCallback( static void setFFprobeSessionCompleteCallback(int? sessionId, FFprobeSessionCompleteCallback? completeCallback) {
int? sessionId, FFprobeSessionCompleteCallback? completeCallback) {
if (sessionId != null && completeCallback != null) { if (sessionId != null && completeCallback != null) {
ffprobeSessionCompleteCallbackMap[sessionId] = completeCallback; ffprobeSessionCompleteCallbackMap[sessionId] = completeCallback;
} }
} }
static FFprobeSessionCompleteCallback? static FFprobeSessionCompleteCallback? getGlobalFFprobeSessionCompleteCallback() => _ffprobeSessionCompleteCallback;
getGlobalFFprobeSessionCompleteCallback() =>
_ffprobeSessionCompleteCallback;
static void setGlobalFFprobeSessionCompleteCallback( static void setGlobalFFprobeSessionCompleteCallback(FFprobeSessionCompleteCallback? completeCallback) {
FFprobeSessionCompleteCallback? completeCallback) {
_ffprobeSessionCompleteCallback = completeCallback; _ffprobeSessionCompleteCallback = completeCallback;
} }
static MediaInformationSessionCompleteCallback? static MediaInformationSessionCompleteCallback? getMediaInformationSessionCompleteCallback(int? sessionId) =>
getMediaInformationSessionCompleteCallback(int? sessionId) =>
mediaInformationSessionCompleteCallbackMap[sessionId]; mediaInformationSessionCompleteCallbackMap[sessionId];
static void setMediaInformationSessionCompleteCallback(int? sessionId, static void setMediaInformationSessionCompleteCallback(
MediaInformationSessionCompleteCallback? completeCallback) { int? sessionId,
MediaInformationSessionCompleteCallback? completeCallback,
) {
if (sessionId != null && completeCallback != null) { if (sessionId != null && completeCallback != null) {
mediaInformationSessionCompleteCallbackMap[sessionId] = completeCallback; mediaInformationSessionCompleteCallbackMap[sessionId] = completeCallback;
} }
} }
static MediaInformationSessionCompleteCallback? static MediaInformationSessionCompleteCallback? getGlobalMediaInformationSessionCompleteCallback() =>
getGlobalMediaInformationSessionCompleteCallback() =>
_mediaInformationSessionCompleteCallback; _mediaInformationSessionCompleteCallback;
static void setGlobalMediaInformationSessionCompleteCallback( static void setGlobalMediaInformationSessionCompleteCallback(
MediaInformationSessionCompleteCallback? completeCallback) { MediaInformationSessionCompleteCallback? completeCallback,
) {
_mediaInformationSessionCompleteCallback = completeCallback; _mediaInformationSessionCompleteCallback = completeCallback;
} }

@ -41,8 +41,7 @@ import 'ffmpeg_kit_factory.dart';
class FFmpegKitInitializer { class FFmpegKitInitializer {
static FFmpegKitPlatform _platform = FFmpegKitPlatform.instance; static FFmpegKitPlatform _platform = FFmpegKitPlatform.instance;
static const EventChannel _eventChannel = static const EventChannel _eventChannel = const EventChannel('flutter.arthenica.com/ffmpeg_kit_event');
const EventChannel('flutter.arthenica.com/ffmpeg_kit_event');
static FFmpegKitInitializer _instance = new FFmpegKitInitializer(); static FFmpegKitInitializer _instance = new FFmpegKitInitializer();
@ -59,12 +58,9 @@ class FFmpegKitInitializer {
void _onEvent(dynamic event) { void _onEvent(dynamic event) {
if (event is Map<dynamic, dynamic>) { if (event is Map<dynamic, dynamic>) {
final Map<String, dynamic> eventMap = event.cast<String, dynamic>(); final Map<String, dynamic> eventMap = event.cast<String, dynamic>();
final Map<dynamic, dynamic>? logEvent = final Map<dynamic, dynamic>? logEvent = eventMap['FFmpegKitLogCallbackEvent'];
eventMap['FFmpegKitLogCallbackEvent']; final Map<dynamic, dynamic>? statisticsEvent = eventMap['FFmpegKitStatisticsCallbackEvent'];
final Map<dynamic, dynamic>? statisticsEvent = final Map<dynamic, dynamic>? completeEvent = eventMap['FFmpegKitCompleteCallbackEvent'];
eventMap['FFmpegKitStatisticsCallbackEvent'];
final Map<dynamic, dynamic>? completeEvent =
eventMap['FFmpegKitCompleteCallbackEvent'];
if (logEvent != null) { if (logEvent != null) {
_processLogCallbackEvent(logEvent); _processLogCallbackEvent(logEvent);
@ -92,19 +88,16 @@ class FFmpegKitInitializer {
final int activeLogLevel = FFmpegKitConfig.getLogLevel(); final int activeLogLevel = FFmpegKitConfig.getLogLevel();
var globalCallbackDefined = false; var globalCallbackDefined = false;
var sessionCallbackDefined = false; var sessionCallbackDefined = false;
LogRedirectionStrategy activeLogRedirectionStrategy = LogRedirectionStrategy activeLogRedirectionStrategy = FFmpegKitConfig.getLogRedirectionStrategy();
FFmpegKitConfig.getLogRedirectionStrategy();
// avLogStderr logs are always redirected // avLogStderr logs are always redirected
if ((activeLogLevel == Level.avLogQuiet && level != Level.avLogStderr) || if ((activeLogLevel == Level.avLogQuiet && level != Level.avLogStderr) || level > activeLogLevel) {
level > activeLogLevel) {
// LOG NEITHER PRINTED NOR FORWARDED // LOG NEITHER PRINTED NOR FORWARDED
return; return;
} }
activeLogRedirectionStrategy = activeLogRedirectionStrategy =
FFmpegKitFactory.getLogRedirectionStrategy(sessionId) ?? FFmpegKitFactory.getLogRedirectionStrategy(sessionId) ?? activeLogRedirectionStrategy;
activeLogRedirectionStrategy;
final LogCallback? logCallback = FFmpegKitFactory.getLogCallback(sessionId); final LogCallback? logCallback = FFmpegKitFactory.getLogCallback(sessionId);
if (logCallback != null) { if (logCallback != null) {
@ -182,8 +175,7 @@ class FFmpegKitInitializer {
final Statistics statistics = FFmpegKitFactory.mapToStatistics(event); final Statistics statistics = FFmpegKitFactory.mapToStatistics(event);
final int sessionId = event["sessionId"]; final int sessionId = event["sessionId"];
final StatisticsCallback? statisticsCallback = final StatisticsCallback? statisticsCallback = FFmpegKitFactory.getStatisticsCallback(sessionId);
FFmpegKitFactory.getStatisticsCallback(sessionId);
if (statisticsCallback != null) { if (statisticsCallback != null) {
try { try {
// NOTIFY SESSION CALLBACK DEFINED // NOTIFY SESSION CALLBACK DEFINED
@ -194,8 +186,7 @@ class FFmpegKitInitializer {
} }
} }
final globalStatisticsCallbackFunction = final globalStatisticsCallbackFunction = FFmpegKitFactory.getGlobalStatisticsCallback();
FFmpegKitFactory.getGlobalStatisticsCallback();
if (globalStatisticsCallbackFunction != null) { if (globalStatisticsCallbackFunction != null) {
try { try {
// NOTIFY GLOBAL CALLBACK DEFINED // NOTIFY GLOBAL CALLBACK DEFINED
@ -214,8 +205,7 @@ class FFmpegKitInitializer {
if (session != null) { if (session != null) {
if (session.isFFmpeg()) { if (session.isFFmpeg()) {
final ffmpegSession = session as FFmpegSession; final ffmpegSession = session as FFmpegSession;
final FFmpegSessionCompleteCallback? completeCallback = final FFmpegSessionCompleteCallback? completeCallback = ffmpegSession.getCompleteCallback();
ffmpegSession.getCompleteCallback();
if (completeCallback != null) { if (completeCallback != null) {
try { try {
@ -227,8 +217,7 @@ class FFmpegKitInitializer {
} }
} }
final globalFFmpegSessionCompleteCallback = final globalFFmpegSessionCompleteCallback = FFmpegKitFactory.getGlobalFFmpegSessionCompleteCallback();
FFmpegKitFactory.getGlobalFFmpegSessionCompleteCallback();
if (globalFFmpegSessionCompleteCallback != null) { if (globalFFmpegSessionCompleteCallback != null) {
try { try {
// NOTIFY GLOBAL CALLBACK DEFINED // NOTIFY GLOBAL CALLBACK DEFINED
@ -240,8 +229,7 @@ class FFmpegKitInitializer {
} }
} else if (session.isFFprobe()) { } else if (session.isFFprobe()) {
final ffprobeSession = session as FFprobeSession; final ffprobeSession = session as FFprobeSession;
final FFprobeSessionCompleteCallback? completeCallback = final FFprobeSessionCompleteCallback? completeCallback = ffprobeSession.getCompleteCallback();
ffprobeSession.getCompleteCallback();
if (completeCallback != null) { if (completeCallback != null) {
try { try {
@ -253,8 +241,7 @@ class FFmpegKitInitializer {
} }
} }
final globalFFprobeSessionCompleteCallback = final globalFFprobeSessionCompleteCallback = FFmpegKitFactory.getGlobalFFprobeSessionCompleteCallback();
FFmpegKitFactory.getGlobalFFprobeSessionCompleteCallback();
if (globalFFprobeSessionCompleteCallback != null) { if (globalFFprobeSessionCompleteCallback != null) {
try { try {
// NOTIFY GLOBAL CALLBACK DEFINED // NOTIFY GLOBAL CALLBACK DEFINED
@ -279,13 +266,12 @@ class FFmpegKitInitializer {
} }
} }
final globalMediaInformationSessionCompleteCallback = FFmpegKitFactory final globalMediaInformationSessionCompleteCallback =
.getGlobalMediaInformationSessionCompleteCallback(); FFmpegKitFactory.getGlobalMediaInformationSessionCompleteCallback();
if (globalMediaInformationSessionCompleteCallback != null) { if (globalMediaInformationSessionCompleteCallback != null) {
try { try {
// NOTIFY GLOBAL CALLBACK DEFINED // NOTIFY GLOBAL CALLBACK DEFINED
globalMediaInformationSessionCompleteCallback( globalMediaInformationSessionCompleteCallback(mediaInformationSession);
mediaInformationSession);
} on Exception catch (e, stack) { } on Exception catch (e, stack) {
print("Exception thrown inside global complete callback. $e"); print("Exception thrown inside global complete callback. $e");
print(stack); print(stack);

@ -28,8 +28,16 @@ class Statistics {
double _bitrate; double _bitrate;
double _speed; double _speed;
Statistics(this._sessionId, this._videoFrameNumber, this._videoFps, Statistics(
this._videoQuality, this._size, this._time, this._bitrate, this._speed); this._sessionId,
this._videoFrameNumber,
this._videoFps,
this._videoQuality,
this._size,
this._time,
this._bitrate,
this._speed,
);
int getSessionId() => this._sessionId; int getSessionId() => this._sessionId;

@ -53,62 +53,49 @@ class StreamInformation {
String? getCodec() => this.getStringProperty(StreamInformation.keyCodec); String? getCodec() => this.getStringProperty(StreamInformation.keyCodec);
/// Returns stream codec in long format. /// Returns stream codec in long format.
String? getCodecLong() => String? getCodecLong() => this.getStringProperty(StreamInformation.keyCodecLong);
this.getStringProperty(StreamInformation.keyCodecLong);
/// Returns stream format. /// Returns stream format.
String? getFormat() => this.getStringProperty(StreamInformation.keyFormat); String? getFormat() => this.getStringProperty(StreamInformation.keyFormat);
/// Returns width. /// Returns width.
int? getWidth() => int? getWidth() => this.getNumberProperty(StreamInformation.keyWidth)?.toInt();
this.getNumberProperty(StreamInformation.keyWidth)?.toInt();
/// Returns height. /// Returns height.
int? getHeight() => int? getHeight() => this.getNumberProperty(StreamInformation.keyHeight)?.toInt();
this.getNumberProperty(StreamInformation.keyHeight)?.toInt();
/// Returns bitrate. /// Returns bitrate.
String? getBitrate() => this.getStringProperty(StreamInformation.keyBitRate); String? getBitrate() => this.getStringProperty(StreamInformation.keyBitRate);
/// Returns sample rate. /// Returns sample rate.
String? getSampleRate() => String? getSampleRate() => this.getStringProperty(StreamInformation.keySampleRate);
this.getStringProperty(StreamInformation.keySampleRate);
/// Returns sample format. /// Returns sample format.
String? getSampleFormat() => String? getSampleFormat() => this.getStringProperty(StreamInformation.keySampleFormat);
this.getStringProperty(StreamInformation.keySampleFormat);
/// Returns channel layout. /// Returns channel layout.
String? getChannelLayout() => String? getChannelLayout() => this.getStringProperty(StreamInformation.keyChannelLayout);
this.getStringProperty(StreamInformation.keyChannelLayout);
/// Returns sample aspect ratio. /// Returns sample aspect ratio.
String? getSampleAspectRatio() => String? getSampleAspectRatio() => this.getStringProperty(StreamInformation.keySampleAspectRatio);
this.getStringProperty(StreamInformation.keySampleAspectRatio);
/// Returns display aspect ratio. /// Returns display aspect ratio.
String? getDisplayAspectRatio() => String? getDisplayAspectRatio() => this.getStringProperty(StreamInformation.keyDisplayAspectRatio);
this.getStringProperty(StreamInformation.keyDisplayAspectRatio);
/// Returns average frame rate. /// Returns average frame rate.
String? getAverageFrameRate() => String? getAverageFrameRate() => this.getStringProperty(StreamInformation.keyAverageFrameRate);
this.getStringProperty(StreamInformation.keyAverageFrameRate);
/// Returns real frame rate. /// Returns real frame rate.
String? getRealFrameRate() => String? getRealFrameRate() => this.getStringProperty(StreamInformation.keyRealFrameRate);
this.getStringProperty(StreamInformation.keyRealFrameRate);
/// Returns time base. /// Returns time base.
String? getTimeBase() => String? getTimeBase() => this.getStringProperty(StreamInformation.keyTimeBase);
this.getStringProperty(StreamInformation.keyTimeBase);
/// Returns codec time base. /// Returns codec time base.
String? getCodecTimeBase() => String? getCodecTimeBase() => this.getStringProperty(StreamInformation.keyCodecTimeBase);
this.getStringProperty(StreamInformation.keyCodecTimeBase);
/// Returns all tags. /// Returns all tags.
Map<dynamic, dynamic>? getTags() => Map<dynamic, dynamic>? getTags() => this.getProperty(StreamInformation.keyTags);
this.getProperty(StreamInformation.keyTags);
/// Returns the stream property associated with the key. /// Returns the stream property associated with the key.
String? getStringProperty(String key) => this._allProperties?[key]; String? getStringProperty(String key) => this._allProperties?[key];

@ -15,7 +15,7 @@ Pod::Spec.new do |s|
s.source_files = 'Classes/**/*' s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h' s.public_header_files = 'Classes/**/*.h'
s.default_subspec = 'https' s.default_subspec = 'https-lts'
s.dependency 'FlutterMacOS' s.dependency 'FlutterMacOS'
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
@ -24,112 +24,112 @@ Pod::Spec.new do |s|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-macos-min', "6.0" ss.dependency 'ffmpeg-kit-macos-min', "6.0"
ss.osx.deployment_target = '10.15' ss.osx.deployment_target = '11.0'
end end
s.subspec 'min-lts' do |ss| s.subspec 'min-lts' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-macos-min', "6.0.LTS" ss.dependency 'ffmpeg-kit-macos-min', "6.0.LTS"
ss.osx.deployment_target = '10.12' ss.osx.deployment_target = '11.0'
end end
s.subspec 'min-gpl' do |ss| s.subspec 'min-gpl' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-macos-min-gpl', "6.0" ss.dependency 'ffmpeg-kit-macos-min-gpl', "6.0"
ss.osx.deployment_target = '10.15' ss.osx.deployment_target = '11.0'
end end
s.subspec 'min-gpl-lts' do |ss| s.subspec 'min-gpl-lts' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-macos-min-gpl', "6.0.LTS" ss.dependency 'ffmpeg-kit-macos-min-gpl', "6.0.LTS"
ss.osx.deployment_target = '10.12' ss.osx.deployment_target = '11.0'
end end
s.subspec 'https' do |ss| s.subspec 'https' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-macos-https', "6.0" ss.dependency 'ffmpeg-kit-macos-https', "6.0"
ss.osx.deployment_target = '10.15' ss.osx.deployment_target = '11.0'
end end
s.subspec 'https-lts' do |ss| s.subspec 'https-lts' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-macos-https', "6.0.LTS" ss.dependency 'ffmpeg-kit-macos-https', "6.0.LTS"
ss.osx.deployment_target = '10.12' ss.osx.deployment_target = '11.0'
end end
s.subspec 'https-gpl' do |ss| s.subspec 'https-gpl' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-macos-https-gpl', "6.0" ss.dependency 'ffmpeg-kit-macos-https-gpl', "6.0"
ss.osx.deployment_target = '10.15' ss.osx.deployment_target = '11.0'
end end
s.subspec 'https-gpl-lts' do |ss| s.subspec 'https-gpl-lts' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-macos-https-gpl', "6.0.LTS" ss.dependency 'ffmpeg-kit-macos-https-gpl', "6.0.LTS"
ss.osx.deployment_target = '10.12' ss.osx.deployment_target = '11.0'
end end
s.subspec 'audio' do |ss| s.subspec 'audio' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-macos-audio', "6.0" ss.dependency 'ffmpeg-kit-macos-audio', "6.0"
ss.osx.deployment_target = '10.15' ss.osx.deployment_target = '11.0'
end end
s.subspec 'audio-lts' do |ss| s.subspec 'audio-lts' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-macos-audio', "6.0.LTS" ss.dependency 'ffmpeg-kit-macos-audio', "6.0.LTS"
ss.osx.deployment_target = '10.12' ss.osx.deployment_target = '11.0'
end end
s.subspec 'video' do |ss| s.subspec 'video' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-macos-video', "6.0" ss.dependency 'ffmpeg-kit-macos-video', "6.0"
ss.osx.deployment_target = '10.15' ss.osx.deployment_target = '11.0'
end end
s.subspec 'video-lts' do |ss| s.subspec 'video-lts' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-macos-video', "6.0.LTS" ss.dependency 'ffmpeg-kit-macos-video', "6.0.LTS"
ss.osx.deployment_target = '10.12' ss.osx.deployment_target = '11.0'
end end
s.subspec 'full' do |ss| s.subspec 'full' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-macos-full', "6.0" ss.dependency 'ffmpeg-kit-macos-full', "6.0"
ss.osx.deployment_target = '10.15' ss.osx.deployment_target = '11.0'
end end
s.subspec 'full-lts' do |ss| s.subspec 'full-lts' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-macos-full', "6.0.LTS" ss.dependency 'ffmpeg-kit-macos-full', "6.0.LTS"
ss.osx.deployment_target = '10.12' ss.osx.deployment_target = '11.0'
end end
s.subspec 'full-gpl' do |ss| s.subspec 'full-gpl' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-macos-full-gpl', "6.0" ss.dependency 'ffmpeg-kit-macos-full-gpl', "6.0"
ss.osx.deployment_target = '10.15' ss.osx.deployment_target = '11.0'
end end
s.subspec 'full-gpl-lts' do |ss| s.subspec 'full-gpl-lts' do |ss|
ss.source_files = 'Classes/**/*' ss.source_files = 'Classes/**/*'
ss.public_header_files = 'Classes/**/*.h' ss.public_header_files = 'Classes/**/*.h'
ss.dependency 'ffmpeg-kit-macos-full-gpl', "6.0.LTS" ss.dependency 'ffmpeg-kit-macos-full-gpl', "6.0.LTS"
ss.osx.deployment_target = '10.12' ss.osx.deployment_target = '11.0'
end end
end end

@ -6,8 +6,8 @@ homepage: https://github.com/arthenica/ffmpeg-kit
version: 6.0.3 version: 6.0.3
environment: environment:
sdk: ">=2.12.0 <4.0.0" sdk: ">=3.7.0 <4.0.0"
flutter: ">=2.0.0" flutter: ">=3.29.0"
flutter: flutter:
plugin: plugin:
@ -21,11 +21,12 @@ flutter:
pluginClass: FFmpegKitFlutterPlugin pluginClass: FFmpegKitFlutterPlugin
dependencies: dependencies:
ffmpeg_kit_flutter_platform_interface: ^0.2.1 ffmpeg_kit_flutter_platform_interface:
git:
url: https://github.com/Carapacik/ffmpeg-kit
path: flutter/flutter_platform_interface
flutter: flutter:
sdk: flutter sdk: flutter
dev_dependencies: dev_dependencies:
flutter_test: carapacik_lints: ^1.11.1
sdk: flutter
plugin_platform_interface: ^2.1.5

@ -3,3 +3,4 @@
.packages .packages
.pub/ .pub/
build/ build/
pubspec.lock

@ -1,68 +1,3 @@
analyzer: include: package:carapacik_lints/core.yaml
enable-experiment: formatter:
- non-nullable page_width: 120
strong-mode:
implicit-dynamic: false
errors:
missing_required_param: warning
missing_return: warning
linter:
rules:
- avoid_catching_errors
- avoid_function_literals_in_foreach_calls
- avoid_private_typedef_functions
- avoid_renaming_method_parameters
- avoid_returning_null_for_void
- avoid_unused_constructor_parameters
- avoid_void_async
- await_only_futures
- camel_case_types
- cancel_subscriptions
- comment_references
- constant_identifier_names
- control_flow_in_finally
- directives_ordering
- empty_statements
- file_names
- hash_and_equals
- implementation_imports
- iterable_contains_unrelated_type
- join_return_with_assignment
- lines_longer_than_80_chars
- list_remove_unrelated_type
- missing_whitespace_between_adjacent_strings
- no_runtimeType_toString
- non_constant_identifier_names
- only_throw_errors
- overridden_fields
- package_api_docs
- package_names
- package_prefixed_library_names
- prefer_asserts_in_initializer_lists
- prefer_const_constructors
- prefer_const_declarations
- prefer_expression_function_bodies
- prefer_final_locals
- prefer_function_declarations_over_variables
- prefer_initializing_formals
- prefer_inlined_adds
- prefer_interpolation_to_compose_strings
- prefer_is_not_operator
- prefer_null_aware_operators
- prefer_relative_imports
- prefer_typing_uninitialized_variables
- prefer_void_to_null
- provide_deprecation_message
- sort_pub_dependencies
- test_types_in_equals
- throw_in_finally
- unnecessary_brace_in_string_interps
- unnecessary_lambdas
- unnecessary_null_aware_assignments
- unnecessary_overrides
- unnecessary_parenthesis
- unnecessary_statements
- unnecessary_string_interpolations
- use_string_buffers
- void_checks

@ -20,10 +20,9 @@
* SOFTWARE. * SOFTWARE.
*/ */
import 'package:ffmpeg_kit_flutter_platform_interface/method_channel_ffmpeg_kit_flutter.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart'; import 'package:plugin_platform_interface/plugin_platform_interface.dart';
import 'method_channel_ffmpeg_kit_flutter.dart';
abstract class FFmpegKitPlatform extends PlatformInterface { abstract class FFmpegKitPlatform extends PlatformInterface {
/// Constructs a FFmpegKitPlatform. /// Constructs a FFmpegKitPlatform.
FFmpegKitPlatform() : super(token: _token); FFmpegKitPlatform() : super(token: _token);
@ -47,71 +46,58 @@ abstract class FFmpegKitPlatform extends PlatformInterface {
// AbstractSession // AbstractSession
Future<Map<dynamic, dynamic>?> abstractSessionCreateFFmpegSession( Future<Map<dynamic, dynamic>?> abstractSessionCreateFFmpegSession(List<String> argumentsArray) async {
List<String> argumentsArray) async { throw UnimplementedError('abstractSessionCreateFFmpegSession() has not been implemented!');
throw UnimplementedError(
'abstractSessionCreateFFmpegSession() has not been implemented!');
} }
Future<Map<dynamic, dynamic>?> abstractSessionCreateFFprobeSession( Future<Map<dynamic, dynamic>?> abstractSessionCreateFFprobeSession(List<String> argumentsArray) async {
List<String> argumentsArray) async { throw UnimplementedError('abstractSessionCreateFFprobeSession() has not been implemented!');
throw UnimplementedError(
'abstractSessionCreateFFprobeSession() has not been implemented!');
} }
Future<Map<dynamic, dynamic>?> abstractSessionCreateMediaInformationSession( Future<Map<dynamic, dynamic>?> abstractSessionCreateMediaInformationSession(List<String> argumentsArray) async {
List<String> argumentsArray) async { throw UnimplementedError(
throw UnimplementedError('abstractSessionCreateMediaInformationSession()' 'abstractSessionCreateMediaInformationSession()'
' has not been implemented!'); ' has not been implemented!',
);
} }
Future<int?> abstractSessionGetEndTime(int? sessionId) async { Future<int?> abstractSessionGetEndTime(int? sessionId) async {
throw UnimplementedError( throw UnimplementedError('abstractSessionGetEndTime() has not been implemented!');
'abstractSessionGetEndTime() has not been implemented!');
} }
Future<int?> abstractSessionGetDuration(int? sessionId) async { Future<int?> abstractSessionGetDuration(int? sessionId) async {
throw UnimplementedError( throw UnimplementedError('abstractSessionGetDuration() has not been implemented!');
'abstractSessionGetDuration() has not been implemented!');
} }
Future<List<dynamic>?> abstractSessionGetAllLogs( Future<List<dynamic>?> abstractSessionGetAllLogs(int? sessionId, int? waitTimeout) async {
int? sessionId, int? waitTimeout) async { throw UnimplementedError('abstractSessionGetAllLogs() has not been implemented!');
throw UnimplementedError(
'abstractSessionGetAllLogs() has not been implemented!');
} }
Future<List<dynamic>?> abstractSessionGetLogs(int? sessionId) async { Future<List<dynamic>?> abstractSessionGetLogs(int? sessionId) async {
throw UnimplementedError( throw UnimplementedError('abstractSessionGetLogs() has not been implemented!');
'abstractSessionGetLogs() has not been implemented!');
} }
Future<String?> abstractSessionGetAllLogsAsString( Future<String?> abstractSessionGetAllLogsAsString(int? sessionId, int? waitTimeout) async {
int? sessionId, int? waitTimeout) async { throw UnimplementedError('abstractSessionGetAllLogsAsString() has not been implemented!');
throw UnimplementedError(
'abstractSessionGetAllLogsAsString() has not been implemented!');
} }
Future<int?> abstractSessionGetState(int? sessionId) async { Future<int?> abstractSessionGetState(int? sessionId) async {
throw UnimplementedError( throw UnimplementedError('abstractSessionGetState() has not been implemented!');
'abstractSessionGetState() has not been implemented!');
} }
Future<int?> abstractSessionGetReturnCode(int? sessionId) async { Future<int?> abstractSessionGetReturnCode(int? sessionId) async {
throw UnimplementedError( throw UnimplementedError('abstractSessionGetReturnCode() has not been implemented!');
'abstractSessionGetReturnCode() has not been implemented!');
} }
Future<String?> abstractSessionGetFailStackTrace(int? sessionId) async { Future<String?> abstractSessionGetFailStackTrace(int? sessionId) async {
throw UnimplementedError( throw UnimplementedError('abstractSessionGetFailStackTrace() has not been implemented!');
'abstractSessionGetFailStackTrace() has not been implemented!');
} }
Future<bool> abstractSessionThereAreAsynchronousMessagesInTransmit( Future<bool> abstractSessionThereAreAsynchronousMessagesInTransmit(int? sessionId) async {
int? sessionId) async {
throw UnimplementedError( throw UnimplementedError(
'abstractSessionThereAreAsynchronousMessagesInTransmit()' 'abstractSessionThereAreAsynchronousMessagesInTransmit()'
' has not been implemented!'); ' has not been implemented!',
);
} }
// ArchDetect // ArchDetect
@ -127,265 +113,213 @@ abstract class FFmpegKitPlatform extends PlatformInterface {
} }
Future<void> ffmpegKitCancelSession(int sessionId) async { Future<void> ffmpegKitCancelSession(int sessionId) async {
throw UnimplementedError( throw UnimplementedError('ffmpegKitCancelSession() has not been implemented!');
'ffmpegKitCancelSession() has not been implemented!');
} }
Future<List<dynamic>?> ffmpegKitListSessions() async { Future<List<dynamic>?> ffmpegKitListSessions() async {
throw UnimplementedError( throw UnimplementedError('ffmpegKitListSessions() has not been implemented!');
'ffmpegKitListSessions() has not been implemented!');
} }
// FFmpegKitConfig // FFmpegKitConfig
Future<void> ffmpegKitConfigEnableRedirection() async { Future<void> ffmpegKitConfigEnableRedirection() async {
throw UnimplementedError( throw UnimplementedError('ffmpegKitConfigEnableRedirection() has not been implemented!');
'ffmpegKitConfigEnableRedirection() has not been implemented!');
} }
Future<void> ffmpegKitConfigDisableRedirection() async { Future<void> ffmpegKitConfigDisableRedirection() async {
throw UnimplementedError( throw UnimplementedError('ffmpegKitConfigDisableRedirection() has not been implemented!');
'ffmpegKitConfigDisableRedirection() has not been implemented!');
} }
Future<void> ffmpegKitConfigSetFontconfigConfigurationPath( Future<void> ffmpegKitConfigSetFontconfigConfigurationPath(String path) async {
String path) async { throw UnimplementedError(
throw UnimplementedError('ffmpegKitConfigSetFontconfigConfigurationPath()' 'ffmpegKitConfigSetFontconfigConfigurationPath()'
' has not been implemented!'); ' has not been implemented!',
);
} }
Future<void> ffmpegKitConfigSetFontDirectory( Future<void> ffmpegKitConfigSetFontDirectory(String path, Map<String, String>? mapping) async {
String path, Map<String, String>? mapping) async { throw UnimplementedError('ffmpegKitConfigSetFontDirectory() has not been implemented!');
throw UnimplementedError(
'ffmpegKitConfigSetFontDirectory() has not been implemented!');
} }
Future<void> ffmpegKitConfigSetFontDirectoryList( Future<void> ffmpegKitConfigSetFontDirectoryList(List<String> fontDirectoryList, Map<String, String>? mapping) async {
List<String> fontDirectoryList, Map<String, String>? mapping) async { throw UnimplementedError('ffmpegKitConfigSetFontDirectoryList() has not been implemented!');
throw UnimplementedError(
'ffmpegKitConfigSetFontDirectoryList() has not been implemented!');
} }
Future<String?> ffmpegKitConfigRegisterNewFFmpegPipe() async { Future<String?> ffmpegKitConfigRegisterNewFFmpegPipe() async {
throw UnimplementedError( throw UnimplementedError('ffmpegKitConfigRegisterNewFFmpegPipe() has not been implemented!');
'ffmpegKitConfigRegisterNewFFmpegPipe() has not been implemented!');
} }
Future<void> ffmpegKitConfigCloseFFmpegPipe(String ffmpegPipePath) async { Future<void> ffmpegKitConfigCloseFFmpegPipe(String ffmpegPipePath) async {
throw UnimplementedError( throw UnimplementedError('ffmpegKitConfigCloseFFmpegPipe() has not been implemented!');
'ffmpegKitConfigCloseFFmpegPipe() has not been implemented!');
} }
Future<String?> ffmpegKitConfigGetFFmpegVersion() async { Future<String?> ffmpegKitConfigGetFFmpegVersion() async {
throw UnimplementedError( throw UnimplementedError('ffmpegKitConfigGetFFmpegVersion() has not been implemented!');
'ffmpegKitConfigGetFFmpegVersion() has not been implemented!');
} }
Future<bool?> ffmpegKitConfigIsLTSBuild() async { Future<bool?> ffmpegKitConfigIsLTSBuild() async {
throw UnimplementedError( throw UnimplementedError('ffmpegKitConfigIsLTSBuild() has not been implemented!');
'ffmpegKitConfigIsLTSBuild() has not been implemented!');
} }
Future<String?> ffmpegKitConfigGetBuildDate() async { Future<String?> ffmpegKitConfigGetBuildDate() async {
throw UnimplementedError( throw UnimplementedError('ffmpegKitConfigGetBuildDate() has not been implemented!');
'ffmpegKitConfigGetBuildDate() has not been implemented!');
} }
Future<void> ffmpegKitConfigSetEnvironmentVariable( Future<void> ffmpegKitConfigSetEnvironmentVariable(String name, String value) async {
String name, String value) async { throw UnimplementedError('ffmpegKitConfigSetEnvironmentVariable() has not been implemented!');
throw UnimplementedError(
'ffmpegKitConfigSetEnvironmentVariable() has not been implemented!');
} }
Future<void> ffmpegKitConfigIgnoreSignal(int signal) async { Future<void> ffmpegKitConfigIgnoreSignal(int signal) async {
throw UnimplementedError( throw UnimplementedError('ffmpegKitConfigIgnoreSignal() has not been implemented!');
'ffmpegKitConfigIgnoreSignal() has not been implemented!');
} }
Future<void> ffmpegKitConfigAsyncFFmpegExecute(int? sessionId) async { Future<void> ffmpegKitConfigAsyncFFmpegExecute(int? sessionId) async {
throw UnimplementedError( throw UnimplementedError('ffmpegKitConfigAsyncFFmpegExecute() has not been implemented!');
'ffmpegKitConfigAsyncFFmpegExecute() has not been implemented!');
} }
Future<void> ffmpegKitConfigAsyncFFprobeExecute(int? sessionId) async { Future<void> ffmpegKitConfigAsyncFFprobeExecute(int? sessionId) async {
throw UnimplementedError( throw UnimplementedError('ffmpegKitConfigAsyncFFprobeExecute() has not been implemented!');
'ffmpegKitConfigAsyncFFprobeExecute() has not been implemented!');
} }
Future<void> ffmpegKitConfigAsyncGetMediaInformationExecute( Future<void> ffmpegKitConfigAsyncGetMediaInformationExecute(int? sessionId, int? waitTimeout) async {
int? sessionId, int? waitTimeout) async { throw UnimplementedError(
throw UnimplementedError('ffmpegKitConfigAsyncGetMediaInformationExecute()' 'ffmpegKitConfigAsyncGetMediaInformationExecute()'
' has not been implemented!'); ' has not been implemented!',
);
} }
Future<void> ffmpegKitConfigFFmpegExecute(int? sessionId) async { Future<void> ffmpegKitConfigFFmpegExecute(int? sessionId) async {
throw UnimplementedError( throw UnimplementedError('ffmpegKitConfigFFmpegExecute() has not been implemented!');
'ffmpegKitConfigFFmpegExecute() has not been implemented!');
} }
Future<void> ffmpegKitConfigFFprobeExecute(int? sessionId) async { Future<void> ffmpegKitConfigFFprobeExecute(int? sessionId) async {
throw UnimplementedError( throw UnimplementedError('ffmpegKitConfigFFprobeExecute() has not been implemented!');
'ffmpegKitConfigFFprobeExecute() has not been implemented!');
} }
Future<void> ffmpegKitConfigGetMediaInformationExecute( Future<void> ffmpegKitConfigGetMediaInformationExecute(int? sessionId, int? waitTimeout) async {
int? sessionId, int? waitTimeout) async { throw UnimplementedError(
throw UnimplementedError('ffmpegKitConfigGetMediaInformationExecute()' 'ffmpegKitConfigGetMediaInformationExecute()'
' has not been implemented!'); ' has not been implemented!',
);
} }
Future<void> ffmpegKitConfigSetLogLevel(int logLevel) async { Future<void> ffmpegKitConfigSetLogLevel(int logLevel) async {
throw UnimplementedError( throw UnimplementedError('ffmpegKitConfigSetLogLevel() has not been implemented!');
'ffmpegKitConfigSetLogLevel() has not been implemented!');
} }
Future<int?> ffmpegKitConfigGetSessionHistorySize() async { Future<int?> ffmpegKitConfigGetSessionHistorySize() async {
throw UnimplementedError( throw UnimplementedError('ffmpegKitConfigGetSessionHistorySize() has not been implemented!');
'ffmpegKitConfigGetSessionHistorySize() has not been implemented!');
} }
Future<void> ffmpegKitConfigSetSessionHistorySize( Future<void> ffmpegKitConfigSetSessionHistorySize(int sessionHistorySize) async {
int sessionHistorySize) async { throw UnimplementedError('ffmpegKitConfigSetSessionHistorySize() has not been implemented!');
throw UnimplementedError(
'ffmpegKitConfigSetSessionHistorySize() has not been implemented!');
} }
Future<Map<dynamic, dynamic>?> ffmpegKitConfigGetSession( Future<Map<dynamic, dynamic>?> ffmpegKitConfigGetSession(int sessionId) async {
int sessionId) async { throw UnimplementedError('ffmpegKitConfigGetSession() has not been implemented!');
throw UnimplementedError(
'ffmpegKitConfigGetSession() has not been implemented!');
} }
Future<Map<dynamic, dynamic>?> ffmpegKitConfigGetLastSession() async { Future<Map<dynamic, dynamic>?> ffmpegKitConfigGetLastSession() async {
throw UnimplementedError( throw UnimplementedError('ffmpegKitConfigGetLastSession() has not been implemented!');
'ffmpegKitConfigGetLastSession() has not been implemented!');
} }
Future<Map<dynamic, dynamic>?> Future<Map<dynamic, dynamic>?> ffmpegKitConfigGetLastCompletedSession() async {
ffmpegKitConfigGetLastCompletedSession() async { throw UnimplementedError('ffmpegKitConfigGetLastCompletedSession() has not been implemented!');
throw UnimplementedError(
'ffmpegKitConfigGetLastCompletedSession() has not been implemented!');
} }
Future<List<dynamic>?> ffmpegKitConfigGetSessions() async { Future<List<dynamic>?> ffmpegKitConfigGetSessions() async {
throw UnimplementedError( throw UnimplementedError('ffmpegKitConfigGetSessions() has not been implemented!');
'ffmpegKitConfigGetSessions() has not been implemented!');
} }
Future<void> clearSessions() async { Future<void> clearSessions() async {
throw UnimplementedError('clearSessions() has not been implemented!'); throw UnimplementedError('clearSessions() has not been implemented!');
} }
Future<List<dynamic>?> ffmpegKitConfigGetSessionsByState( Future<List<dynamic>?> ffmpegKitConfigGetSessionsByState(int sessionState) async {
int sessionState) async { throw UnimplementedError('ffmpegKitConfigGetSessionsByState() has not been implemented!');
throw UnimplementedError(
'ffmpegKitConfigGetSessionsByState() has not been implemented!');
} }
Future<int?> ffmpegKitConfigMessagesInTransmit(int sessionId) async { Future<int?> ffmpegKitConfigMessagesInTransmit(int sessionId) async {
throw UnimplementedError( throw UnimplementedError('ffmpegKitConfigMessagesInTransmit() has not been implemented!');
'ffmpegKitConfigMessagesInTransmit() has not been implemented!');
} }
Future<void> ffmpegKitConfigEnableLogs() async { Future<void> ffmpegKitConfigEnableLogs() async {
throw UnimplementedError( throw UnimplementedError('ffmpegKitConfigEnableLogs() has not been implemented!');
'ffmpegKitConfigEnableLogs() has not been implemented!');
} }
Future<void> ffmpegKitConfigDisableLogs() async { Future<void> ffmpegKitConfigDisableLogs() async {
throw UnimplementedError( throw UnimplementedError('ffmpegKitConfigDisableLogs() has not been implemented!');
'ffmpegKitConfigDisableLogs() has not been implemented!');
} }
Future<void> ffmpegKitConfigEnableStatistics() async { Future<void> ffmpegKitConfigEnableStatistics() async {
throw UnimplementedError( throw UnimplementedError('ffmpegKitConfigEnableStatistics() has not been implemented!');
'ffmpegKitConfigEnableStatistics() has not been implemented!');
} }
Future<void> ffmpegKitConfigDisableStatistics() async { Future<void> ffmpegKitConfigDisableStatistics() async {
throw UnimplementedError( throw UnimplementedError('ffmpegKitConfigDisableStatistics() has not been implemented!');
'ffmpegKitConfigDisableStatistics() has not been implemented!');
} }
Future<String?> ffmpegKitConfigGetPlatform() async { Future<String?> ffmpegKitConfigGetPlatform() async {
throw UnimplementedError( throw UnimplementedError('ffmpegKitConfigGetPlatform() has not been implemented!');
'ffmpegKitConfigGetPlatform() has not been implemented!');
} }
Future<int?> ffmpegKitConfigWriteToPipe( Future<int?> ffmpegKitConfigWriteToPipe(String inputPath, String pipePath) async {
String inputPath, String pipePath) async { throw UnimplementedError('ffmpegKitConfigWriteToPipe() has not been implemented!');
throw UnimplementedError(
'ffmpegKitConfigWriteToPipe() has not been implemented!');
} }
Future<String?> ffmpegKitConfigSelectDocumentForRead( Future<String?> ffmpegKitConfigSelectDocumentForRead(String? type, List<String>? extraTypes) async {
String? type, List<String>? extraTypes) async { throw UnimplementedError('ffmpegKitConfigSelectDocumentForRead() has not been implemented!');
throw UnimplementedError(
'ffmpegKitConfigSelectDocumentForRead() has not been implemented!');
} }
Future<String?> ffmpegKitConfigSelectDocumentForWrite( Future<String?> ffmpegKitConfigSelectDocumentForWrite(String? title, String? type, List<String>? extraTypes) async {
String? title, String? type, List<String>? extraTypes) async { throw UnimplementedError('ffmpegKitConfigSelectDocumentForWrite() has not been implemented!');
throw UnimplementedError(
'ffmpegKitConfigSelectDocumentForWrite() has not been implemented!');
} }
Future<String?> ffmpegKitConfigGetSafParameter( Future<String?> ffmpegKitConfigGetSafParameter(String uriString, String openMode) async {
String uriString, String openMode) async { throw UnimplementedError('ffmpegKitConfigGetSafParameter() has not been implemented!');
throw UnimplementedError(
'ffmpegKitConfigGetSafParameter() has not been implemented!');
} }
// FFmpegKitFlutterInitializer // FFmpegKitFlutterInitializer
Future<int?> ffmpegKitFlutterInitializerGetLogLevel() async { Future<int?> ffmpegKitFlutterInitializerGetLogLevel() async {
throw UnimplementedError( throw UnimplementedError('ffmpegKitFlutterInitializerGetLogLevel() has not been implemented!');
'ffmpegKitFlutterInitializerGetLogLevel() has not been implemented!');
} }
// FFmpegSession // FFmpegSession
Future<List<dynamic>?> ffmpegSessionGetAllStatistics( Future<List<dynamic>?> ffmpegSessionGetAllStatistics(int? sessionId, int? waitTimeout) async {
int? sessionId, int? waitTimeout) async { throw UnimplementedError('ffmpegSessionGetAllStatistics() has not been implemented!');
throw UnimplementedError(
'ffmpegSessionGetAllStatistics() has not been implemented!');
} }
Future<List<dynamic>?> ffmpegSessionGetStatistics(int? sessionId) async { Future<List<dynamic>?> ffmpegSessionGetStatistics(int? sessionId) async {
throw UnimplementedError( throw UnimplementedError('ffmpegSessionGetStatistics() has not been implemented!');
'ffmpegSessionGetStatistics() has not been implemented!');
} }
// FFprobeKit // FFprobeKit
Future<List<dynamic>?> ffprobeKitListFFprobeSessions() async { Future<List<dynamic>?> ffprobeKitListFFprobeSessions() async {
throw UnimplementedError( throw UnimplementedError('ffprobeKitListFFprobeSessions() has not been implemented!');
'ffprobeKitListFFprobeSessions() has not been implemented!');
} }
Future<List<dynamic>?> ffprobeKitListMediaInformationSessions() async { Future<List<dynamic>?> ffprobeKitListMediaInformationSessions() async {
throw UnimplementedError( throw UnimplementedError('ffprobeKitListMediaInformationSessions() has not been implemented!');
'ffprobeKitListMediaInformationSessions() has not been implemented!');
} }
// MediaInformationJsonParser // MediaInformationJsonParser
Future<Map<dynamic, dynamic>?> mediaInformationJsonParserFrom( Future<Map<dynamic, dynamic>?> mediaInformationJsonParserFrom(String ffprobeJsonOutput) async {
String ffprobeJsonOutput) async { throw UnimplementedError('mediaInformationJsonParserFrom() has not been implemented!');
throw UnimplementedError(
'mediaInformationJsonParserFrom() has not been implemented!');
} }
Future<Map<dynamic, dynamic>?> mediaInformationJsonParserFromWithError( Future<Map<dynamic, dynamic>?> mediaInformationJsonParserFromWithError(String ffprobeJsonOutput) async {
String ffprobeJsonOutput) async { throw UnimplementedError('mediaInformationJsonParserFromWithError() has not been implemented!');
throw UnimplementedError(
'mediaInformationJsonParserFromWithError() has not been implemented!');
} }
Future<Map<dynamic, dynamic>?> mediaInformationSessionGetMediaInformation( Future<Map<dynamic, dynamic>?> mediaInformationSessionGetMediaInformation(int? sessionId) async {
int? sessionId) async { throw UnimplementedError(
throw UnimplementedError('mediaInformationSessionGetMediaInformation() ' 'mediaInformationSessionGetMediaInformation() '
'has not been implemented!'); 'has not been implemented!',
);
} }
Future<String?> getPackageName() async { Future<String?> getPackageName() async {
@ -393,7 +327,6 @@ abstract class FFmpegKitPlatform extends PlatformInterface {
} }
Future<List<dynamic>?> getExternalLibraries() async { Future<List<dynamic>?> getExternalLibraries() async {
throw UnimplementedError( throw UnimplementedError('getExternalLibraries() has not been implemented!');
'getExternalLibraries() has not been implemented!');
} }
} }

@ -20,13 +20,11 @@
* SOFTWARE. * SOFTWARE.
*/ */
import 'package:ffmpeg_kit_flutter_platform_interface/ffmpeg_kit_flutter_platform_interface.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'ffmpeg_kit_flutter_platform_interface.dart'; const MethodChannel _channel = MethodChannel('flutter.arthenica.com/ffmpeg_kit');
const MethodChannel _channel =
const MethodChannel('flutter.arthenica.com/ffmpeg_kit');
/// An implementation of [FFmpegKitPlatform] that uses method channels. /// An implementation of [FFmpegKitPlatform] that uses method channels.
class MethodChannelFFmpegKit extends FFmpegKitPlatform { class MethodChannelFFmpegKit extends FFmpegKitPlatform {
@ -37,76 +35,58 @@ class MethodChannelFFmpegKit extends FFmpegKitPlatform {
// AbstractSession // AbstractSession
@override @override
Future<Map<dynamic, dynamic>?> abstractSessionCreateFFmpegSession( Future<Map<dynamic, dynamic>?> abstractSessionCreateFFmpegSession(List<String> argumentsArray) async =>
List<String> argumentsArray) async => _channel.invokeMethod<Map<dynamic, dynamic>>('ffmpegSession', {'arguments': argumentsArray});
_channel.invokeMethod<Map<dynamic, dynamic>>(
'ffmpegSession', {'arguments': argumentsArray});
@override @override
Future<Map<dynamic, dynamic>?> abstractSessionCreateFFprobeSession( Future<Map<dynamic, dynamic>?> abstractSessionCreateFFprobeSession(List<String> argumentsArray) async =>
List<String> argumentsArray) async => _channel.invokeMethod<Map<dynamic, dynamic>>('ffprobeSession', {'arguments': argumentsArray});
_channel.invokeMethod<Map<dynamic, dynamic>>(
'ffprobeSession', {'arguments': argumentsArray});
@override @override
Future<Map<dynamic, dynamic>?> abstractSessionCreateMediaInformationSession( Future<Map<dynamic, dynamic>?> abstractSessionCreateMediaInformationSession(List<String> argumentsArray) async =>
List<String> argumentsArray) async => _channel.invokeMethod<Map<dynamic, dynamic>>('mediaInformationSession', {'arguments': argumentsArray});
_channel.invokeMethod<Map<dynamic, dynamic>>(
'mediaInformationSession', {'arguments': argumentsArray});
@override @override
Future<int?> abstractSessionGetEndTime(int? sessionId) async => _channel Future<int?> abstractSessionGetEndTime(int? sessionId) async =>
.invokeMethod<int>('abstractSessionGetEndTime', {'sessionId': sessionId}); _channel.invokeMethod<int>('abstractSessionGetEndTime', {'sessionId': sessionId});
@override @override
Future<int?> abstractSessionGetDuration(int? sessionId) async => Future<int?> abstractSessionGetDuration(int? sessionId) async =>
_channel.invokeMethod<int>( _channel.invokeMethod<int>('abstractSessionGetDuration', {'sessionId': sessionId});
'abstractSessionGetDuration', {'sessionId': sessionId});
@override @override
Future<List<dynamic>?> abstractSessionGetAllLogs( Future<List<dynamic>?> abstractSessionGetAllLogs(int? sessionId, int? waitTimeout) async => _channel
int? sessionId, int? waitTimeout) async => .invokeMethod<List<dynamic>>('abstractSessionGetAllLogs', {'sessionId': sessionId, 'waitTimeout': waitTimeout});
_channel.invokeMethod<List<dynamic>>('abstractSessionGetAllLogs',
{'sessionId': sessionId, 'waitTimeout': waitTimeout});
@override @override
Future<List<dynamic>?> abstractSessionGetLogs(int? sessionId) async => Future<List<dynamic>?> abstractSessionGetLogs(int? sessionId) async =>
_channel.invokeMethod<List<dynamic>>( _channel.invokeMethod<List<dynamic>>('abstractSessionGetLogs', {'sessionId': sessionId});
'abstractSessionGetLogs', {'sessionId': sessionId});
@override @override
Future<String?> abstractSessionGetAllLogsAsString( Future<String?> abstractSessionGetAllLogsAsString(int? sessionId, int? waitTimeout) async => _channel
int? sessionId, int? waitTimeout) async => .invokeMethod<String>('abstractSessionGetAllLogsAsString', {'sessionId': sessionId, 'waitTimeout': waitTimeout});
_channel.invokeMethod<String>('abstractSessionGetAllLogsAsString',
{'sessionId': sessionId, 'waitTimeout': waitTimeout});
@override @override
Future<int?> abstractSessionGetState(int? sessionId) async => _channel Future<int?> abstractSessionGetState(int? sessionId) async =>
.invokeMethod<int>('abstractSessionGetState', {'sessionId': sessionId}); _channel.invokeMethod<int>('abstractSessionGetState', {'sessionId': sessionId});
@override @override
Future<int?> abstractSessionGetReturnCode(int? sessionId) async => Future<int?> abstractSessionGetReturnCode(int? sessionId) async =>
_channel.invokeMethod<int>( _channel.invokeMethod<int>('abstractSessionGetReturnCode', {'sessionId': sessionId});
'abstractSessionGetReturnCode', {'sessionId': sessionId});
@override @override
Future<String?> abstractSessionGetFailStackTrace(int? sessionId) async => Future<String?> abstractSessionGetFailStackTrace(int? sessionId) async =>
_channel.invokeMethod<String>( _channel.invokeMethod<String>('abstractSessionGetFailStackTrace', {'sessionId': sessionId});
'abstractSessionGetFailStackTrace', {'sessionId': sessionId});
@override @override
Future<bool> abstractSessionThereAreAsynchronousMessagesInTransmit( Future<bool> abstractSessionThereAreAsynchronousMessagesInTransmit(int? sessionId) async => _channel
int? sessionId) async => .invokeMethod<bool>('abstractSessionThereAreAsynchronousMessagesInTransmit', {'sessionId': sessionId})
_channel.invokeMethod<bool>( .then((value) => value ?? false);
'abstractSessionThereAreAsynchronousMessagesInTransmit',
{'sessionId': sessionId}).then((bool? value) => value ?? false);
// ArchDetect // ArchDetect
@override @override
Future<String> archDetectGetArch() async => _channel Future<String> archDetectGetArch() async => _channel.invokeMethod<String>('getArch').then((value) => value ?? '');
.invokeMethod<String>('getArch')
.then((String? value) => value ?? "");
// FFmpegKit // FFmpegKit
@ -118,36 +98,32 @@ class MethodChannelFFmpegKit extends FFmpegKitPlatform {
_channel.invokeMethod<void>('cancelSession', {'sessionId': sessionId}); _channel.invokeMethod<void>('cancelSession', {'sessionId': sessionId});
@override @override
Future<List<dynamic>?> ffmpegKitListSessions() async => Future<List<dynamic>?> ffmpegKitListSessions() async => _channel.invokeMethod<List<dynamic>>('getFFmpegSessions');
_channel.invokeMethod<List<dynamic>>('getFFmpegSessions');
// FFmpegKitConfig // FFmpegKitConfig
@override @override
Future<void> ffmpegKitConfigEnableRedirection() async => Future<void> ffmpegKitConfigEnableRedirection() async => _channel.invokeMethod<void>('enableRedirection');
_channel.invokeMethod<void>('enableRedirection');
@override @override
Future<void> ffmpegKitConfigDisableRedirection() async => Future<void> ffmpegKitConfigDisableRedirection() async => _channel.invokeMethod<void>('disableRedirection');
_channel.invokeMethod<void>('disableRedirection');
@override @override
Future<void> ffmpegKitConfigSetFontconfigConfigurationPath( Future<void> ffmpegKitConfigSetFontconfigConfigurationPath(String path) async =>
String path) async => _channel.invokeMethod<void>('setFontconfigConfigurationPath', {'path': path});
_channel
.invokeMethod<void>('setFontconfigConfigurationPath', {'path': path});
@override @override
Future<void> ffmpegKitConfigSetFontDirectory( Future<void> ffmpegKitConfigSetFontDirectory(String path, Map<String, String>? mapping) async =>
String path, Map<String, String>? mapping) async => _channel.invokeMethod<void>('setFontDirectory', {'fontDirectory': path, 'fontNameMap': mapping});
_channel.invokeMethod<void>(
'setFontDirectory', {'fontDirectory': path, 'fontNameMap': mapping});
@override @override
Future<void> ffmpegKitConfigSetFontDirectoryList( Future<void> ffmpegKitConfigSetFontDirectoryList(
List<String> fontDirectoryList, Map<String, String>? mapping) async => List<String> fontDirectoryList,
_channel.invokeMethod<void>('setFontDirectoryList', Map<String, String>? mapping,
{'fontDirectoryList': fontDirectoryList, 'fontNameMap': mapping}); ) async => _channel.invokeMethod<void>('setFontDirectoryList', {
'fontDirectoryList': fontDirectoryList,
'fontNameMap': mapping,
});
@override @override
Future<String?> ffmpegKitConfigRegisterNewFFmpegPipe() async => Future<String?> ffmpegKitConfigRegisterNewFFmpegPipe() async =>
@ -155,174 +131,139 @@ class MethodChannelFFmpegKit extends FFmpegKitPlatform {
@override @override
Future<void> ffmpegKitConfigCloseFFmpegPipe(String ffmpegPipePath) async => Future<void> ffmpegKitConfigCloseFFmpegPipe(String ffmpegPipePath) async =>
_channel.invokeMethod<void>( _channel.invokeMethod<void>('closeFFmpegPipe', {'ffmpegPipePath': ffmpegPipePath});
'closeFFmpegPipe', {'ffmpegPipePath': ffmpegPipePath});
@override @override
Future<String?> ffmpegKitConfigGetFFmpegVersion() async => Future<String?> ffmpegKitConfigGetFFmpegVersion() async => _channel.invokeMethod<String>('getFFmpegVersion');
_channel.invokeMethod<String>('getFFmpegVersion');
@override @override
Future<bool?> ffmpegKitConfigIsLTSBuild() async => Future<bool?> ffmpegKitConfigIsLTSBuild() async => _channel.invokeMethod<bool>('isLTSBuild');
_channel.invokeMethod<bool>('isLTSBuild');
@override @override
Future<String?> ffmpegKitConfigGetBuildDate() async => Future<String?> ffmpegKitConfigGetBuildDate() async => _channel.invokeMethod<String>('getBuildDate');
_channel.invokeMethod<String>('getBuildDate');
@override @override
Future<void> ffmpegKitConfigSetEnvironmentVariable( Future<void> ffmpegKitConfigSetEnvironmentVariable(String name, String value) async =>
String name, String value) async => _channel.invokeMethod<void>('setEnvironmentVariable', {'variableName': name, 'variableValue': value});
_channel.invokeMethod<void>('setEnvironmentVariable',
{'variableName': name, 'variableValue': value});
@override @override
Future<void> ffmpegKitConfigIgnoreSignal(int signal) async => Future<void> ffmpegKitConfigIgnoreSignal(int signal) async =>
_channel.invokeMethod<void>('ignoreSignal', {'signal': signal}); _channel.invokeMethod<void>('ignoreSignal', {'signal': signal});
@override @override
Future<void> ffmpegKitConfigFFmpegExecute(int? sessionId) async => _channel Future<void> ffmpegKitConfigFFmpegExecute(int? sessionId) async =>
.invokeMethod<void>('ffmpegSessionExecute', {'sessionId': sessionId}); _channel.invokeMethod<void>('ffmpegSessionExecute', {'sessionId': sessionId});
@override @override
Future<void> ffmpegKitConfigFFprobeExecute(int? sessionId) async => _channel Future<void> ffmpegKitConfigFFprobeExecute(int? sessionId) async =>
.invokeMethod<void>('ffprobeSessionExecute', {'sessionId': sessionId}); _channel.invokeMethod<void>('ffprobeSessionExecute', {'sessionId': sessionId});
@override @override
Future<void> ffmpegKitConfigGetMediaInformationExecute( Future<void> ffmpegKitConfigGetMediaInformationExecute(int? sessionId, int? waitTimeout) async => _channel
int? sessionId, int? waitTimeout) async => .invokeMethod<void>('mediaInformationSessionExecute', {'sessionId': sessionId, 'waitTimeout': waitTimeout});
_channel.invokeMethod<void>('mediaInformationSessionExecute',
{'sessionId': sessionId, 'waitTimeout': waitTimeout});
@override @override
Future<void> ffmpegKitConfigAsyncFFmpegExecute(int? sessionId) async => Future<void> ffmpegKitConfigAsyncFFmpegExecute(int? sessionId) async =>
_channel.invokeMethod<void>( _channel.invokeMethod<void>('asyncFFmpegSessionExecute', {'sessionId': sessionId});
'asyncFFmpegSessionExecute', {'sessionId': sessionId});
@override @override
Future<void> ffmpegKitConfigAsyncFFprobeExecute(int? sessionId) async => Future<void> ffmpegKitConfigAsyncFFprobeExecute(int? sessionId) async =>
_channel.invokeMethod<void>( _channel.invokeMethod<void>('asyncFFprobeSessionExecute', {'sessionId': sessionId});
'asyncFFprobeSessionExecute', {'sessionId': sessionId});
@override @override
Future<void> ffmpegKitConfigAsyncGetMediaInformationExecute( Future<void> ffmpegKitConfigAsyncGetMediaInformationExecute(int? sessionId, int? waitTimeout) async => _channel
int? sessionId, int? waitTimeout) async => .invokeMethod<void>('asyncMediaInformationSessionExecute', {'sessionId': sessionId, 'waitTimeout': waitTimeout});
_channel.invokeMethod<void>('asyncMediaInformationSessionExecute',
{'sessionId': sessionId, 'waitTimeout': waitTimeout});
@override @override
Future<void> ffmpegKitConfigSetLogLevel(int logLevel) async => Future<void> ffmpegKitConfigSetLogLevel(int logLevel) async =>
_channel.invokeMethod<void>('setLogLevel', {'level': logLevel}); _channel.invokeMethod<void>('setLogLevel', {'level': logLevel});
@override @override
Future<int?> ffmpegKitConfigGetSessionHistorySize() async => Future<int?> ffmpegKitConfigGetSessionHistorySize() async => _channel.invokeMethod<int>('getSessionHistorySize');
_channel.invokeMethod<int>('getSessionHistorySize');
@override @override
Future<void> ffmpegKitConfigSetSessionHistorySize( Future<void> ffmpegKitConfigSetSessionHistorySize(int sessionHistorySize) async =>
int sessionHistorySize) async => _channel.invokeMethod<void>('setSessionHistorySize', {'sessionHistorySize': sessionHistorySize});
_channel.invokeMethod<void>(
'setSessionHistorySize', {'sessionHistorySize': sessionHistorySize});
@override @override
Future<Map<dynamic, dynamic>?> ffmpegKitConfigGetSession( Future<Map<dynamic, dynamic>?> ffmpegKitConfigGetSession(int sessionId) async =>
int sessionId) async => _channel.invokeMethod<Map<dynamic, dynamic>>('getSession', {'sessionId': sessionId});
_channel.invokeMethod<Map<dynamic, dynamic>>(
'getSession', {'sessionId': sessionId});
@override @override
Future<Map<dynamic, dynamic>?> ffmpegKitConfigGetLastSession() async => Future<Map<dynamic, dynamic>?> ffmpegKitConfigGetLastSession() async =>
_channel.invokeMethod<Map<dynamic, dynamic>>('getLastSession'); _channel.invokeMethod<Map<dynamic, dynamic>>('getLastSession');
@override @override
Future<Map<dynamic, dynamic>?> Future<Map<dynamic, dynamic>?> ffmpegKitConfigGetLastCompletedSession() async =>
ffmpegKitConfigGetLastCompletedSession() async => _channel _channel.invokeMethod<Map<dynamic, dynamic>>('getLastCompletedSession');
.invokeMethod<Map<dynamic, dynamic>>('getLastCompletedSession');
@override @override
Future<List<dynamic>?> ffmpegKitConfigGetSessions() async => Future<List<dynamic>?> ffmpegKitConfigGetSessions() async => _channel.invokeMethod<List<dynamic>>('getSessions');
_channel.invokeMethod<List<dynamic>>('getSessions');
@override @override
Future<void> clearSessions() async => Future<void> clearSessions() async => _channel.invokeMethod<void>('clearSessions');
_channel.invokeMethod<void>('clearSessions');
@override @override
Future<List<dynamic>?> ffmpegKitConfigGetSessionsByState( Future<List<dynamic>?> ffmpegKitConfigGetSessionsByState(int sessionState) async =>
int sessionState) async => _channel.invokeMethod<List<dynamic>>('getSessionsByState', {'state': sessionState});
_channel.invokeMethod<List<dynamic>>(
'getSessionsByState', {'state': sessionState});
@override @override
Future<int?> ffmpegKitConfigMessagesInTransmit(int sessionId) async => Future<int?> ffmpegKitConfigMessagesInTransmit(int sessionId) async =>
_channel _channel.invokeMethod<int>('messagesInTransmit', {'sessionId': sessionId});
.invokeMethod<int>('messagesInTransmit', {'sessionId': sessionId});
@override @override
Future<void> ffmpegKitConfigEnableLogs() async => Future<void> ffmpegKitConfigEnableLogs() async => _channel.invokeMethod<void>('enableLogs');
_channel.invokeMethod<void>('enableLogs');
@override @override
Future<void> ffmpegKitConfigDisableLogs() async => Future<void> ffmpegKitConfigDisableLogs() async => _channel.invokeMethod<void>('disableLogs');
_channel.invokeMethod<void>('disableLogs');
@override @override
Future<void> ffmpegKitConfigEnableStatistics() async => Future<void> ffmpegKitConfigEnableStatistics() async => _channel.invokeMethod<void>('enableStatistics');
_channel.invokeMethod<void>('enableStatistics');
@override @override
Future<void> ffmpegKitConfigDisableStatistics() async => Future<void> ffmpegKitConfigDisableStatistics() async => _channel.invokeMethod<void>('disableStatistics');
_channel.invokeMethod<void>('disableStatistics');
@override @override
Future<String?> ffmpegKitConfigGetPlatform() async => Future<String?> ffmpegKitConfigGetPlatform() async => _channel.invokeMethod<String>('getPlatform');
_channel.invokeMethod<String>('getPlatform');
@override @override
Future<int?> ffmpegKitConfigWriteToPipe( Future<int?> ffmpegKitConfigWriteToPipe(String inputPath, String pipePath) async =>
String inputPath, String pipePath) async => _channel.invokeMethod<int>('writeToPipe', {'input': inputPath, 'pipe': pipePath});
_channel.invokeMethod<int>(
'writeToPipe', {'input': inputPath, 'pipe': pipePath});
@override @override
Future<String?> ffmpegKitConfigSelectDocumentForRead( Future<String?> ffmpegKitConfigSelectDocumentForRead(String? type, List<String>? extraTypes) async =>
String? type, List<String>? extraTypes) async => _channel.invokeMethod<String>('selectDocument', {'writable': false, 'type': type, 'extraTypes': extraTypes});
_channel.invokeMethod<String>('selectDocument',
{'writable': false, 'type': type, 'extraTypes': extraTypes});
@override @override
Future<String?> ffmpegKitConfigSelectDocumentForWrite( Future<String?> ffmpegKitConfigSelectDocumentForWrite(String? title, String? type, List<String>? extraTypes) async =>
String? title, String? type, List<String>? extraTypes) async =>
_channel.invokeMethod<String>('selectDocument', { _channel.invokeMethod<String>('selectDocument', {
'writable': true, 'writable': true,
'title': title, 'title': title,
'type': type, 'type': type,
'extraTypes': extraTypes 'extraTypes': extraTypes,
}); });
@override @override
Future<String?> ffmpegKitConfigGetSafParameter( Future<String?> ffmpegKitConfigGetSafParameter(String uriString, String openMode) async =>
String uriString, String openMode) async => _channel.invokeMethod<String>('getSafParameter', {'uri': uriString, 'openMode': openMode});
_channel.invokeMethod<String>(
'getSafParameter', {'uri': uriString, 'openMode': openMode});
// FFmpegKitFlutterInitializer // FFmpegKitFlutterInitializer
Future<int?> ffmpegKitFlutterInitializerGetLogLevel() async => @override
_channel.invokeMethod<int>('getLogLevel'); Future<int?> ffmpegKitFlutterInitializerGetLogLevel() async => _channel.invokeMethod<int>('getLogLevel');
// FFmpegSession // FFmpegSession
@override @override
Future<List<dynamic>?> ffmpegSessionGetAllStatistics( Future<List<dynamic>?> ffmpegSessionGetAllStatistics(int? sessionId, int? waitTimeout) async =>
int? sessionId, int? waitTimeout) async => _channel.invokeMethod<List<dynamic>>('ffmpegSessionGetAllStatistics', {
_channel.invokeMethod<List<dynamic>>('ffmpegSessionGetAllStatistics', 'sessionId': sessionId,
{'sessionId': sessionId, 'waitTimeout': waitTimeout}); 'waitTimeout': waitTimeout,
});
@override @override
Future<List<dynamic>?> ffmpegSessionGetStatistics(int? sessionId) async => Future<List<dynamic>?> ffmpegSessionGetStatistics(int? sessionId) async =>
_channel.invokeMethod<List<dynamic>>( _channel.invokeMethod<List<dynamic>>('ffmpegSessionGetStatistics', {'sessionId': sessionId});
'ffmpegSessionGetStatistics', {'sessionId': sessionId});
// FFprobeKit // FFprobeKit
@ -337,32 +278,24 @@ class MethodChannelFFmpegKit extends FFmpegKitPlatform {
// MediaInformationJsonParser // MediaInformationJsonParser
@override @override
Future<Map<dynamic, dynamic>?> mediaInformationJsonParserFrom( Future<Map<dynamic, dynamic>?> mediaInformationJsonParserFrom(String ffprobeJsonOutput) async => _channel
String ffprobeJsonOutput) async => .invokeMethod<Map<dynamic, dynamic>>('mediaInformationJsonParserFrom', {'ffprobeJsonOutput': ffprobeJsonOutput});
_channel.invokeMethod<Map<dynamic, dynamic>>(
'mediaInformationJsonParserFrom',
{'ffprobeJsonOutput': ffprobeJsonOutput});
@override @override
Future<Map<dynamic, dynamic>?> mediaInformationJsonParserFromWithError( Future<Map<dynamic, dynamic>?> mediaInformationJsonParserFromWithError(String ffprobeJsonOutput) async =>
String ffprobeJsonOutput) async => _channel.invokeMethod<Map<dynamic, dynamic>>('mediaInformationJsonParserFromWithError', {
_channel.invokeMethod<Map<dynamic, dynamic>>( 'ffprobeJsonOutput': ffprobeJsonOutput,
'mediaInformationJsonParserFromWithError', });
{'ffprobeJsonOutput': ffprobeJsonOutput});
// MediaInformationSession // MediaInformationSession
@override @override
Future<Map<dynamic, dynamic>?> mediaInformationSessionGetMediaInformation( Future<Map<dynamic, dynamic>?> mediaInformationSessionGetMediaInformation(int? sessionId) async =>
int? sessionId) async => _channel.invokeMethod<Map<dynamic, dynamic>>('getMediaInformation', {'sessionId': sessionId});
_channel.invokeMethod<Map<dynamic, dynamic>>(
'getMediaInformation', {'sessionId': sessionId});
@override @override
Future<String?> getPackageName() async => Future<String?> getPackageName() async => _channel.invokeMethod<String>('getPackageName');
_channel.invokeMethod<String>('getPackageName');
@override @override
Future<List<dynamic>?> getExternalLibraries() async => Future<List<dynamic>?> getExternalLibraries() async => _channel.invokeMethod<List<dynamic>>('getExternalLibraries');
_channel.invokeMethod<List<dynamic>>('getExternalLibraries');
} }

@ -8,14 +8,13 @@ homepage: https://github.com/arthenica/ffmpeg-kit
version: 0.2.1 version: 0.2.1
environment: environment:
sdk: ">=2.12.0 <3.0.0" sdk: ">=3.7.0 <4.0.0"
flutter: ">=2.0.0" flutter: ">=3.29.0"
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
plugin_platform_interface: ^2.0.2 plugin_platform_interface: ^2.1.8
dev_dependencies: dev_dependencies:
flutter_test: carapacik_lints: ^1.11.1
sdk: flutter

Loading…
Cancel
Save