diff --git a/flutter/flutter/analysis_options.yaml b/flutter/flutter/analysis_options.yaml index 228b0f6..5562025 100644 --- a/flutter/flutter/analysis_options.yaml +++ b/flutter/flutter/analysis_options.yaml @@ -1,62 +1,3 @@ -analyzer: - 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 - - 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 \ No newline at end of file +include: package:carapacik_lints/core.yaml +formatter: + page_width: 120 diff --git a/flutter/flutter/android/.gitignore b/flutter/flutter/android/.gitignore index b5ad5b7..161bdcd 100644 --- a/flutter/flutter/android/.gitignore +++ b/flutter/flutter/android/.gitignore @@ -1,9 +1,9 @@ *.iml .gradle -local.properties +/local.properties /.idea/workspace.xml /.idea/libraries .DS_Store /build /captures -gradle +.cxx diff --git a/flutter/flutter/android/build.gradle b/flutter/flutter/android/build.gradle index 6f049ba..10bd35f 100644 --- a/flutter/flutter/android/build.gradle +++ b/flutter/flutter/android/build.gradle @@ -1,36 +1,41 @@ +group = "com.arthenica.ffmpegkit.flutter" +version = "1.0-SNAPSHOT" + buildscript { + ext.kotlin_version = "2.1.10" repositories { google() mavenCentral() } 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 { google() mavenCentral() } } -apply plugin: 'com.android.library' +apply plugin: "com.android.library" +apply plugin: "kotlin-android" android { - // Conditional for compatibility with AGP <4.2. - if (project.android.hasProperty("namespace")) { - namespace 'com.arthenica.ffmpegkit.flutter' - } + namespace = "com.arthenica.ffmpegkit.flutter" - compileSdkVersion 33 + compileSdk = 35 - defaultConfig { - minSdkVersion 24 - targetSdkVersion 33 - versionCode 603 - versionName "6.0.3" + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17 } buildTypes { @@ -38,16 +43,19 @@ android { minifyEnabled false } } - lintOptions { - disable 'GradleCompatible' + + sourceSets { + main.java.srcDirs += "src/main/kotlin" } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + + defaultConfig { + minSdk = 24 + versionCode 603 + versionName "6.0.3" } -} -dependencies { - implementation 'androidx.annotation:annotation:1.5.0' - implementation 'com.arthenica:ffmpeg-kit-https:6.0-2' + dependencies { + implementation("androidx.annotation:annotation:1.9.1") + implementation("com.arthenica:ffmpeg-kit-https:6.0-2.LTS") + } } diff --git a/flutter/flutter/android/gradle.properties b/flutter/flutter/android/gradle.properties deleted file mode 100644 index 4d3226a..0000000 --- a/flutter/flutter/android/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -org.gradle.jvmargs=-Xmx1536M -android.useAndroidX=true -android.enableJetifier=true \ No newline at end of file diff --git a/flutter/flutter/android/src/main/java/com/arthenica/ffmpegkit/flutter/FFmpegKitFlutterPlugin.java b/flutter/flutter/android/src/main/java/com/arthenica/ffmpegkit/flutter/FFmpegKitFlutterPlugin.java index 479ce82..d394d67 100644 --- a/flutter/flutter/android/src/main/java/com/arthenica/ffmpegkit/flutter/FFmpegKitFlutterPlugin.java +++ b/flutter/flutter/android/src/main/java/com/arthenica/ffmpegkit/flutter/FFmpegKitFlutterPlugin.java @@ -153,17 +153,6 @@ public class FFmpegKitFlutterPlugin implements FlutterPlugin, ActivityAware, Met 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() { FFmpegKitConfig.enableFFmpegSessionCompleteCallback(this::emitSession); FFmpegKitConfig.enableFFprobeSessionCompleteCallback(this::emitSession); @@ -195,7 +184,7 @@ public class FFmpegKitFlutterPlugin implements FlutterPlugin, ActivityAware, Met @Override public void onAttachedToActivity(@NonNull ActivityPluginBinding activityPluginBinding) { 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 @@ -648,7 +637,7 @@ public class FFmpegKitFlutterPlugin implements FlutterPlugin, ActivityAware, Met } @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(); if (methodChannel == null) { @@ -667,14 +656,9 @@ public class FFmpegKitFlutterPlugin implements FlutterPlugin, ActivityAware, Met this.context = context; this.activity = activity; - - if (registrar != null) { - // V1 embedding setup for activity listeners. - registrar.addActivityResultListener(this); - } else { - // V2 embedding setup for activity listeners. - activityBinding.addActivityResultListener(this); - } + + // V2 embedding setup for activity listeners. + activityBinding.addActivityResultListener(this); Log.d(LIBRARY_NAME, String.format("FFmpegKitFlutterPlugin %s initialised with context %s and activity %s.", this, context, activity)); } diff --git a/flutter/flutter/ios/Assets/.gitkeep b/flutter/flutter/ios/Assets/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/flutter/flutter/ios/ffmpeg_kit_flutter.podspec b/flutter/flutter/ios/ffmpeg_kit_flutter.podspec index 04ba28d..5c60368 100644 --- a/flutter/flutter/ios/ffmpeg_kit_flutter.podspec +++ b/flutter/flutter/ios/ffmpeg_kit_flutter.podspec @@ -15,7 +15,7 @@ Pod::Spec.new do |s| s.source_files = 'Classes/**/*' s.public_header_files = 'Classes/**/*.h' - s.default_subspec = 'https' + s.default_subspec = 'https-lts' s.dependency 'Flutter' 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.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-ios-min', "6.0" - ss.ios.deployment_target = '12.1' + ss.ios.deployment_target = '14.0' end s.subspec 'min-lts' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-ios-min', "6.0.LTS" - ss.ios.deployment_target = '10' + ss.ios.deployment_target = '14.0' end s.subspec 'min-gpl' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-ios-min-gpl', "6.0" - ss.ios.deployment_target = '12.1' + ss.ios.deployment_target = '14.0' end s.subspec 'min-gpl-lts' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-ios-min-gpl', "6.0.LTS" - ss.ios.deployment_target = '10' + ss.ios.deployment_target = '14.0' end s.subspec 'https' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-ios-https', "6.0" - ss.ios.deployment_target = '12.1' + ss.ios.deployment_target = '14.0' end s.subspec 'https-lts' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-ios-https', "6.0.LTS" - ss.ios.deployment_target = '10' + ss.ios.deployment_target = '14.0' end s.subspec 'https-gpl' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-ios-https-gpl', "6.0" - ss.ios.deployment_target = '12.1' + ss.ios.deployment_target = '14.0' end s.subspec 'https-gpl-lts' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-ios-https-gpl', "6.0.LTS" - ss.ios.deployment_target = '10' + ss.ios.deployment_target = '14.0' end s.subspec 'audio' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-ios-audio', "6.0" - ss.ios.deployment_target = '12.1' + ss.ios.deployment_target = '14.0' end s.subspec 'audio-lts' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-ios-audio', "6.0.LTS" - ss.ios.deployment_target = '10' + ss.ios.deployment_target = '14.0' end s.subspec 'video' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-ios-video', "6.0" - ss.ios.deployment_target = '12.1' + ss.ios.deployment_target = '14.0' end s.subspec 'video-lts' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-ios-video', "6.0.LTS" - ss.ios.deployment_target = '10' + ss.ios.deployment_target = '14.0' end s.subspec 'full' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-ios-full', "6.0" - ss.ios.deployment_target = '12.1' + ss.ios.deployment_target = '14.0' end s.subspec 'full-lts' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-ios-full', "6.0.LTS" - ss.ios.deployment_target = '10' + ss.ios.deployment_target = '14.0' end s.subspec 'full-gpl' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-ios-full-gpl', "6.0" - ss.ios.deployment_target = '12.1' + ss.ios.deployment_target = '14.0' end s.subspec 'full-gpl-lts' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-ios-full-gpl', "6.0.LTS" - ss.ios.deployment_target = '10' + ss.ios.deployment_target = '14.0' end end diff --git a/flutter/flutter/lib/abstract_session.dart b/flutter/flutter/lib/abstract_session.dart index 02f15db..17e121b 100644 --- a/flutter/flutter/lib/abstract_session.dart +++ b/flutter/flutter/lib/abstract_session.dart @@ -63,27 +63,24 @@ abstract class AbstractSession extends Session { /// [logRedirectionStrategy]. /// /// Returns FFmpeg session created. - static Future createFFmpegSession(List argumentsArray, - [LogRedirectionStrategy? logRedirectionStrategy]) async { + static Future createFFmpegSession( + List argumentsArray, [ + LogRedirectionStrategy? logRedirectionStrategy, + ]) async { try { await FFmpegKitConfig.init(); - final Map? nativeSession = - await _platform.abstractSessionCreateFFmpegSession(argumentsArray); + final Map? nativeSession = await _platform.abstractSessionCreateFFmpegSession(argumentsArray); final session = new FFmpegSession(); session._sessionId = nativeSession?["sessionId"]; - session._createTime = - FFmpegKitFactory.validDate(nativeSession?["createTime"]); - session._startTime = - FFmpegKitFactory.validDate(nativeSession?["startTime"]); + session._createTime = FFmpegKitFactory.validDate(nativeSession?["createTime"]); + session._startTime = FFmpegKitFactory.validDate(nativeSession?["startTime"]); session._command = nativeSession?["command"]; session._argumentsArray = argumentsArray; - session._logRedirectionStrategy = - logRedirectionStrategy ?? FFmpegKitConfig.getLogRedirectionStrategy(); + session._logRedirectionStrategy = logRedirectionStrategy ?? FFmpegKitConfig.getLogRedirectionStrategy(); - FFmpegKitFactory.setLogRedirectionStrategy( - session._sessionId, logRedirectionStrategy); + FFmpegKitFactory.setLogRedirectionStrategy(session._sessionId, logRedirectionStrategy); return session; } on PlatformException catch (e, stack) { @@ -96,18 +93,15 @@ abstract class AbstractSession extends Session { /// fields as map keys. /// /// Returns FFmpeg session created. - static FFmpegSession createFFmpegSessionFromMap( - Map sessionMap) { + static FFmpegSession createFFmpegSessionFromMap(Map sessionMap) { final session = new FFmpegSession(); session._sessionId = sessionMap["sessionId"]; session._createTime = FFmpegKitFactory.validDate(sessionMap["createTime"]); session._startTime = FFmpegKitFactory.validDate(sessionMap["startTime"]); session._command = sessionMap["command"]; - session._argumentsArray = - FFmpegKitConfig.parseArguments(sessionMap["command"]); - session._logRedirectionStrategy = - FFmpegKitFactory.getLogRedirectionStrategy(session._sessionId); + session._argumentsArray = FFmpegKitConfig.parseArguments(sessionMap["command"]); + session._logRedirectionStrategy = FFmpegKitFactory.getLogRedirectionStrategy(session._sessionId); return session; } @@ -117,27 +111,23 @@ abstract class AbstractSession extends Session { /// /// Returns FFprobe session created. static Future createFFprobeSession( - List argumentsArray, - [LogRedirectionStrategy? logRedirectionStrategy]) async { + List argumentsArray, [ + LogRedirectionStrategy? logRedirectionStrategy, + ]) async { try { await FFmpegKitConfig.init(); - final Map? nativeSession = - await _platform.abstractSessionCreateFFprobeSession(argumentsArray); + final Map? nativeSession = await _platform.abstractSessionCreateFFprobeSession(argumentsArray); final session = new FFprobeSession(); session._sessionId = nativeSession?["sessionId"]; - session._createTime = - FFmpegKitFactory.validDate(nativeSession?["createTime"]); - session._startTime = - FFmpegKitFactory.validDate(nativeSession?["startTime"]); + session._createTime = FFmpegKitFactory.validDate(nativeSession?["createTime"]); + session._startTime = FFmpegKitFactory.validDate(nativeSession?["startTime"]); session._command = nativeSession?["command"]; session._argumentsArray = argumentsArray; - session._logRedirectionStrategy = - logRedirectionStrategy ?? FFmpegKitConfig.getLogRedirectionStrategy(); + session._logRedirectionStrategy = logRedirectionStrategy ?? FFmpegKitConfig.getLogRedirectionStrategy(); - FFmpegKitFactory.setLogRedirectionStrategy( - session._sessionId, logRedirectionStrategy); + FFmpegKitFactory.setLogRedirectionStrategy(session._sessionId, logRedirectionStrategy); return session; } on PlatformException catch (e, stack) { @@ -150,18 +140,15 @@ abstract class AbstractSession extends Session { /// fields as map keys. /// /// Returns FFprobe session created. - static FFprobeSession createFFprobeSessionFromMap( - Map sessionMap) { + static FFprobeSession createFFprobeSessionFromMap(Map sessionMap) { final session = new FFprobeSession(); session._sessionId = sessionMap["sessionId"]; session._createTime = FFmpegKitFactory.validDate(sessionMap["createTime"]); session._startTime = FFmpegKitFactory.validDate(sessionMap["startTime"]); session._command = sessionMap["command"]; - session._argumentsArray = - FFmpegKitConfig.parseArguments(sessionMap["command"]); - session._logRedirectionStrategy = - FFmpegKitFactory.getLogRedirectionStrategy(session._sessionId); + session._argumentsArray = FFmpegKitConfig.parseArguments(sessionMap["command"]); + session._logRedirectionStrategy = FFmpegKitFactory.getLogRedirectionStrategy(session._sessionId); return session; } @@ -169,25 +156,22 @@ abstract class AbstractSession extends Session { /// Creates a new MediaInformation session using [argumentsArray]. /// /// Returns MediaInformation session created. - static Future createMediaInformationSession( - List argumentsArray) async { + static Future createMediaInformationSession(List argumentsArray) async { try { await FFmpegKitConfig.init(); - final Map? nativeSession = await _platform - .abstractSessionCreateMediaInformationSession(argumentsArray); + final Map? nativeSession = await _platform.abstractSessionCreateMediaInformationSession( + argumentsArray, + ); final session = new MediaInformationSession(); session._sessionId = nativeSession?["sessionId"]; - session._createTime = - FFmpegKitFactory.validDate(nativeSession?["createTime"]); - session._startTime = - FFmpegKitFactory.validDate(nativeSession?["startTime"]); + session._createTime = FFmpegKitFactory.validDate(nativeSession?["createTime"]); + session._startTime = FFmpegKitFactory.validDate(nativeSession?["startTime"]); session._command = nativeSession?["command"]; session._argumentsArray = argumentsArray; session._logRedirectionStrategy = LogRedirectionStrategy.neverPrintLogs; - FFmpegKitFactory.setLogRedirectionStrategy( - session._sessionId, LogRedirectionStrategy.neverPrintLogs); + FFmpegKitFactory.setLogRedirectionStrategy(session._sessionId, LogRedirectionStrategy.neverPrintLogs); return session; } on PlatformException catch (e, stack) { @@ -200,29 +184,25 @@ abstract class AbstractSession extends Session { /// session fields as map keys. /// /// Returns MediaInformation session created. - static MediaInformationSession createMediaInformationSessionFromMap( - Map sessionMap) { + static MediaInformationSession createMediaInformationSessionFromMap(Map sessionMap) { final session = new MediaInformationSession(); session._sessionId = sessionMap["sessionId"]; session._createTime = FFmpegKitFactory.validDate(sessionMap["createTime"]); session._startTime = FFmpegKitFactory.validDate(sessionMap["startTime"]); session._command = sessionMap["command"]; - session._argumentsArray = - FFmpegKitConfig.parseArguments(sessionMap["command"]); + session._argumentsArray = FFmpegKitConfig.parseArguments(sessionMap["command"]); session._logRedirectionStrategy = LogRedirectionStrategy.neverPrintLogs; if (sessionMap.containsKey("mediaInformation")) { - session.setMediaInformation( - new MediaInformation(sessionMap["mediaInformation"])); + session.setMediaInformation(new MediaInformation(sessionMap["mediaInformation"])); } return session; } /// Returns the session specific log callback. - LogCallback? getLogCallback() => - FFmpegKitFactory.getLogCallback(this.getSessionId()); + LogCallback? getLogCallback() => FFmpegKitFactory.getLogCallback(this.getSessionId()); /// Returns the session identifier. int? getSessionId() => this._sessionId; @@ -236,9 +216,7 @@ abstract class AbstractSession extends Session { /// Returns session end time. Future getEndTime() async { try { - return _platform - .abstractSessionGetEndTime(this.getSessionId()) - .then(FFmpegKitFactory.validDate); + return _platform.abstractSessionGetEndTime(this.getSessionId()).then(FFmpegKitFactory.validDate); } on PlatformException catch (e, stack) { print("Plugin getEndTime error: ${e.message}"); return Future.error("getEndTime failed.", stack); @@ -249,9 +227,7 @@ abstract class AbstractSession extends Session { /// if the session is not over yet. Future getDuration() async { try { - return _platform - .abstractSessionGetDuration(this.getSessionId()) - .then((duration) => duration ?? 0); + return _platform.abstractSessionGetDuration(this.getSessionId()).then((duration) => duration ?? 0); } on PlatformException catch (e, stack) { print("Plugin getDuration error: ${e.message}"); return Future.error("getDuration failed.", stack); @@ -269,15 +245,12 @@ abstract class AbstractSession extends Session { /// them until [waitTimeout]. Future> getAllLogs([int? waitTimeout = null]) async { try { - return _platform - .abstractSessionGetAllLogs(this.getSessionId(), waitTimeout) - .then((allLogs) { + return _platform.abstractSessionGetAllLogs(this.getSessionId(), waitTimeout).then((allLogs) { if (allLogs == null) { return List.empty(); } else { return allLogs - .map((dynamic logObject) => - FFmpegKitFactory.mapToLog(logObject as Map)) + .map((dynamic logObject) => FFmpegKitFactory.mapToLog(logObject as Map)) .toList(); } }); @@ -292,15 +265,12 @@ abstract class AbstractSession extends Session { /// will not wait for them and will return immediately. Future> getLogs() async { try { - return _platform - .abstractSessionGetLogs(this.getSessionId()) - .then((allLogs) { + return _platform.abstractSessionGetLogs(this.getSessionId()).then((allLogs) { if (allLogs == null) { return List.empty(); } else { return allLogs - .map((dynamic logObject) => - FFmpegKitFactory.mapToLog(logObject as Map)) + .map((dynamic logObject) => FFmpegKitFactory.mapToLog(logObject as Map)) .toList(); } }); @@ -315,8 +285,7 @@ abstract class AbstractSession extends Session { /// this method waits for them until [waitTimeout]. Future getAllLogsAsString([int? waitTimeout = null]) async { try { - return _platform.abstractSessionGetAllLogsAsString( - this.getSessionId(), waitTimeout); + return _platform.abstractSessionGetAllLogsAsString(this.getSessionId(), waitTimeout); } on PlatformException catch (e, stack) { print("Plugin getAllLogsAsString error: ${e.message}"); return Future.error("getAllLogsAsString failed.", stack); @@ -345,9 +314,7 @@ abstract class AbstractSession extends Session { /// Returns the state of the session. Future getState() async { try { - return _platform - .abstractSessionGetState(this.getSessionId()) - .then((state) { + return _platform.abstractSessionGetState(this.getSessionId()).then((state) { switch (state) { case 0: return SessionState.created; @@ -371,9 +338,7 @@ abstract class AbstractSession extends Session { /// started, still running or failed then this method returns null. Future getReturnCode() async { try { - return _platform - .abstractSessionGetReturnCode(this.getSessionId()) - .then((returnCode) { + return _platform.abstractSessionGetReturnCode(this.getSessionId()).then((returnCode) { if (returnCode == null) { return null; } else { @@ -401,20 +366,16 @@ abstract class AbstractSession extends Session { } /// Returns session specific log redirection strategy. - LogRedirectionStrategy? getLogRedirectionStrategy() => - this._logRedirectionStrategy; + LogRedirectionStrategy? getLogRedirectionStrategy() => this._logRedirectionStrategy; /// Returns whether there are still asynchronous messages being transmitted /// for this session or not. Future thereAreAsynchronousMessagesInTransmit() async { try { - return _platform.abstractSessionThereAreAsynchronousMessagesInTransmit( - this.getSessionId()); + return _platform.abstractSessionThereAreAsynchronousMessagesInTransmit(this.getSessionId()); } on PlatformException catch (e, stack) { - print( - "Plugin thereAreAsynchronousMessagesInTransmit error: ${e.message}"); - return Future.error( - "thereAreAsynchronousMessagesInTransmit failed.", stack); + print("Plugin thereAreAsynchronousMessagesInTransmit error: ${e.message}"); + return Future.error("thereAreAsynchronousMessagesInTransmit failed.", stack); } } diff --git a/flutter/flutter/lib/ffmpeg_kit.dart b/flutter/flutter/lib/ffmpeg_kit.dart index 88d3d29..daa2d6e 100644 --- a/flutter/flutter/lib/ffmpeg_kit.dart +++ b/flutter/flutter/lib/ffmpeg_kit.dart @@ -38,10 +38,8 @@ class FFmpegKit { FFmpegKit.executeWithArguments(FFmpegKitConfig.parseArguments(command)); /// Synchronously executes FFmpeg with arguments provided. - static Future executeWithArguments( - List commandArguments) async { - final session = - await FFmpegSession.create(commandArguments, null, null, null, null); + static Future executeWithArguments(List commandArguments) async { + final session = await FFmpegSession.create(commandArguments, null, null, null, null); 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 /// [FFmpegSessionCompleteCallback] if you want to be notified about the result. - static Future executeAsync(String command, - [FFmpegSessionCompleteCallback? completeCallback = null, - LogCallback? logCallback = null, - StatisticsCallback? statisticsCallback = null]) async => - FFmpegKit.executeWithArgumentsAsync( - FFmpegKitConfig.parseArguments(command), - completeCallback, - logCallback, - statisticsCallback); + static Future executeAsync( + String command, [ + FFmpegSessionCompleteCallback? completeCallback = null, + LogCallback? logCallback = null, + StatisticsCallback? statisticsCallback = null, + ]) async => FFmpegKit.executeWithArgumentsAsync( + FFmpegKitConfig.parseArguments(command), + completeCallback, + logCallback, + statisticsCallback, + ); /// 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 /// [FFmpegSessionCompleteCallback] if you want to be notified about the result. static Future executeWithArgumentsAsync( - List commandArguments, - [FFmpegSessionCompleteCallback? completeCallback = null, - LogCallback? logCallback = null, - StatisticsCallback? statisticsCallback = null]) async { - final session = await FFmpegSession.create(commandArguments, - completeCallback, logCallback, statisticsCallback, null); + List commandArguments, [ + FFmpegSessionCompleteCallback? completeCallback = null, + LogCallback? logCallback = null, + StatisticsCallback? statisticsCallback = null, + ]) async { + final session = await FFmpegSession.create( + commandArguments, + completeCallback, + logCallback, + statisticsCallback, + null, + ); await FFmpegKitConfig.asyncFFmpegExecute(session); @@ -104,8 +110,7 @@ class FFmpegKit { return List.empty(); } else { return sessions - .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession( - sessionObject as Map)) + .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession(sessionObject as Map)) .map((session) => session as FFmpegSession) .toList(); } diff --git a/flutter/flutter/lib/ffmpeg_kit_config.dart b/flutter/flutter/lib/ffmpeg_kit_config.dart index bf57480..ec2f996 100644 --- a/flutter/flutter/lib/ffmpeg_kit_config.dart +++ b/flutter/flutter/lib/ffmpeg_kit_config.dart @@ -40,8 +40,7 @@ import 'statistics_callback.dart'; class FFmpegKitConfig { static FFmpegKitPlatform _platform = FFmpegKitPlatform.instance; - static LogRedirectionStrategy _globalLogRedirectionStrategy = - LogRedirectionStrategy.printLogsWhenNoCallbacksDefined; + static LogRedirectionStrategy _globalLogRedirectionStrategy = LogRedirectionStrategy.printLogsWhenNoCallbacksDefined; 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 /// to use fonts in "FFmpeg". - static Future setFontDirectory(String path, - [Map? mapping = null]) async { + static Future setFontDirectory(String path, [Map? mapping = null]) async { try { await init(); 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 /// to use fonts in "FFmpeg". - static Future setFontDirectoryList(List fontDirectoryList, - [Map? mapping = null]) async { + static Future setFontDirectoryList( + List fontDirectoryList, [ + Map? mapping = null, + ]) async { try { await init(); - return _platform.ffmpegKitConfigSetFontDirectoryList( - fontDirectoryList, mapping); + return _platform.ffmpegKitConfigSetFontDirectoryList(fontDirectoryList, mapping); } on PlatformException catch (e, stack) { print("Plugin setFontDirectoryList error: ${e.message}"); return Future.error("setFontDirectoryList failed.", stack); @@ -221,8 +220,7 @@ class FFmpegKitConfig { static Future ffmpegExecute(FFmpegSession ffmpegSession) async { try { await init(); - return _platform - .ffmpegKitConfigFFmpegExecute(ffmpegSession.getSessionId()); + return _platform.ffmpegKitConfigFFmpegExecute(ffmpegSession.getSessionId()); } on PlatformException catch (e, stack) { print("Plugin ffmpegExecute error: ${e.message}"); return Future.error("ffmpegExecute failed.", stack); @@ -233,8 +231,7 @@ class FFmpegKitConfig { static Future ffprobeExecute(FFprobeSession ffprobeSession) async { try { await init(); - return _platform - .ffmpegKitConfigFFprobeExecute(ffprobeSession.getSessionId()); + return _platform.ffmpegKitConfigFFprobeExecute(ffprobeSession.getSessionId()); } on PlatformException catch (e, stack) { print("Plugin ffprobeExecute error: ${e.message}"); return Future.error("ffprobeExecute failed.", stack); @@ -243,12 +240,12 @@ class FFmpegKitConfig { /// Synchronously executes the media information session provided. static Future getMediaInformationExecute( - MediaInformationSession mediaInformationSession, - [int? waitTimeout = null]) async { + MediaInformationSession mediaInformationSession, [ + int? waitTimeout = null, + ]) async { try { await init(); - return _platform.ffmpegKitConfigGetMediaInformationExecute( - mediaInformationSession.getSessionId(), waitTimeout); + return _platform.ffmpegKitConfigGetMediaInformationExecute(mediaInformationSession.getSessionId(), waitTimeout); } on PlatformException catch (e, stack) { print("Plugin getMediaInformationExecute error: ${e.message}"); return Future.error("getMediaInformationExecute failed.", stack); @@ -262,8 +259,7 @@ class FFmpegKitConfig { static Future asyncFFmpegExecute(FFmpegSession ffmpegSession) async { try { await init(); - return _platform - .ffmpegKitConfigAsyncFFmpegExecute(ffmpegSession.getSessionId()); + return _platform.ffmpegKitConfigAsyncFFmpegExecute(ffmpegSession.getSessionId()); } on PlatformException catch (e, stack) { print("Plugin asyncFFmpegExecute error: ${e.message}"); return Future.error("asyncFFmpegExecute failed.", stack); @@ -277,8 +273,7 @@ class FFmpegKitConfig { static Future asyncFFprobeExecute(FFprobeSession ffprobeSession) async { try { await init(); - return _platform - .ffmpegKitConfigAsyncFFprobeExecute(ffprobeSession.getSessionId()); + return _platform.ffmpegKitConfigAsyncFFprobeExecute(ffprobeSession.getSessionId()); } on PlatformException catch (e, stack) { print("Plugin asyncFFprobeExecute error: ${e.message}"); 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 /// [MediaInformationSessionCompleteCallback] if you want to be notified about the result. static Future asyncGetMediaInformationExecute( - MediaInformationSession mediaInformationSession, - [int? waitTimeout = null]) async { + MediaInformationSession mediaInformationSession, [ + int? waitTimeout = null, + ]) async { try { await init(); return _platform.ffmpegKitConfigAsyncGetMediaInformationExecute( - mediaInformationSession.getSessionId(), waitTimeout); + mediaInformationSession.getSessionId(), + waitTimeout, + ); } on PlatformException catch (e, stack) { print("Plugin asyncGetMediaInformationExecute error: ${e.message}"); return Future.error("asyncGetMediaInformationExecute failed.", stack); @@ -308,17 +306,16 @@ class FFmpegKitConfig { } /// Sets a global callback to redirect FFmpeg statistics. - static void enableStatisticsCallback( - [StatisticsCallback? statisticsCallback = null]) { + static void enableStatisticsCallback([StatisticsCallback? statisticsCallback = null]) { FFmpegKitFactory.setGlobalStatisticsCallback(statisticsCallback); } /// Sets a global FFmpegSessionCompleteCallback to receive execution results /// for FFmpeg sessions. - static void enableFFmpegSessionCompleteCallback( - [FFmpegSessionCompleteCallback? ffmpegSessionCompleteCallback = null]) { - FFmpegKitFactory.setGlobalFFmpegSessionCompleteCallback( - ffmpegSessionCompleteCallback); + static void enableFFmpegSessionCompleteCallback([ + FFmpegSessionCompleteCallback? ffmpegSessionCompleteCallback = null, + ]) { + FFmpegKitFactory.setGlobalFFmpegSessionCompleteCallback(ffmpegSessionCompleteCallback); } /// Returns the global FFmpegSessionCompleteCallback set. @@ -327,10 +324,10 @@ class FFmpegKitConfig { /// Sets a global FFprobeSessionCompleteCallback to receive execution results /// for FFprobe sessions. - static void enableFFprobeSessionCompleteCallback( - [FFprobeSessionCompleteCallback? ffprobeSessionCompleteCallback = null]) { - FFmpegKitFactory.setGlobalFFprobeSessionCompleteCallback( - ffprobeSessionCompleteCallback); + static void enableFFprobeSessionCompleteCallback([ + FFprobeSessionCompleteCallback? ffprobeSessionCompleteCallback = null, + ]) { + FFmpegKitFactory.setGlobalFFprobeSessionCompleteCallback(ffprobeSessionCompleteCallback); } /// Returns the global FFprobeSessionCompleteCallback set. @@ -339,17 +336,15 @@ class FFmpegKitConfig { /// Sets a global MediaInformationSessionCompleteCallback to receive /// execution results for MediaInformation sessions. - static void enableMediaInformationSessionCompleteCallback( - [MediaInformationSessionCompleteCallback? - mediaInformationSessionCompleteCallback = null]) { - FFmpegKitFactory.setGlobalMediaInformationSessionCompleteCallback( - mediaInformationSessionCompleteCallback); + static void enableMediaInformationSessionCompleteCallback([ + MediaInformationSessionCompleteCallback? mediaInformationSessionCompleteCallback = null, + ]) { + FFmpegKitFactory.setGlobalMediaInformationSessionCompleteCallback(mediaInformationSessionCompleteCallback); } /// Returns the global MediaInformationSessionCompleteCallback set. - static MediaInformationSessionCompleteCallback? - getMediaInformationSessionCompleteCallback() => - FFmpegKitFactory.getGlobalMediaInformationSessionCompleteCallback(); + static MediaInformationSessionCompleteCallback? getMediaInformationSessionCompleteCallback() => + FFmpegKitFactory.getGlobalMediaInformationSessionCompleteCallback(); /// Returns the current log level. static int getLogLevel() => _activeLogLevel; @@ -404,8 +399,7 @@ class FFmpegKitConfig { /// Note that this method is Android only. It will fail if called on other /// platforms. It also requires API Level ≥ 19. On older API levels it /// returns an empty url. - static Future getSafParameter( - String uriString, String openMode) async { + static Future getSafParameter(String uriString, String openMode) async { try { await init(); return _platform.ffmpegKitConfigGetSafParameter(uriString, openMode); @@ -441,9 +435,7 @@ class FFmpegKitConfig { static Future getSession(int sessionId) async { try { await init(); - return _platform - .ffmpegKitConfigGetSession(sessionId) - .then(FFmpegKitFactory.mapToNullableSession); + return _platform.ffmpegKitConfigGetSession(sessionId).then(FFmpegKitFactory.mapToNullableSession); } on PlatformException catch (e, stack) { print("Plugin getSession error: ${e.message}"); return Future.error("getSession failed.", stack); @@ -454,9 +446,7 @@ class FFmpegKitConfig { static Future getLastSession() async { try { await init(); - return _platform - .ffmpegKitConfigGetLastSession() - .then(FFmpegKitFactory.mapToNullableSession); + return _platform.ffmpegKitConfigGetLastSession().then(FFmpegKitFactory.mapToNullableSession); } on PlatformException catch (e, stack) { print("Plugin getLastSession error: ${e.message}"); return Future.error("getLastSession failed.", stack); @@ -467,9 +457,7 @@ class FFmpegKitConfig { static Future getLastCompletedSession() async { try { await init(); - return _platform - .ffmpegKitConfigGetLastCompletedSession() - .then(FFmpegKitFactory.mapToNullableSession); + return _platform.ffmpegKitConfigGetLastCompletedSession().then(FFmpegKitFactory.mapToNullableSession); } on PlatformException catch (e, stack) { print("Plugin getLastCompletedSession error: ${e.message}"); return Future.error("getLastCompletedSession failed.", stack); @@ -485,8 +473,7 @@ class FFmpegKitConfig { return List.empty(); } else { return sessions - .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession( - sessionObject as Map)) + .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession(sessionObject as Map)) .toList(); } }); @@ -517,8 +504,7 @@ class FFmpegKitConfig { return List.empty(); } else { return sessions - .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession( - sessionObject as Map)) + .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession(sessionObject as Map)) .map((session) => session as FFmpegSession) .toList(); } @@ -538,8 +524,7 @@ class FFmpegKitConfig { return List.empty(); } else { return sessions - .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession( - sessionObject as Map)) + .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession(sessionObject as Map)) .map((session) => session as FFprobeSession) .toList(); } @@ -551,19 +536,15 @@ class FFmpegKitConfig { } /// Returns all MediaInformation sessions in the session history. - static Future> - getMediaInformationSessions() async { + static Future> getMediaInformationSessions() async { try { await FFmpegKitConfig.init(); - return _platform - .ffprobeKitListMediaInformationSessions() - .then((sessions) { + return _platform.ffprobeKitListMediaInformationSessions().then((sessions) { if (sessions == null) { return List.empty(); } else { return sessions - .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession( - sessionObject as Map)) + .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession(sessionObject as Map)) .map((session) => session as MediaInformationSession) .toList(); } @@ -575,19 +556,15 @@ class FFmpegKitConfig { } /// Returns sessions that have [sessionState]. - static Future> getSessionsByState( - SessionState sessionState) async { + static Future> getSessionsByState(SessionState sessionState) async { try { await init(); - return _platform - .ffmpegKitConfigGetSessionsByState(sessionState.index) - .then((sessions) { + return _platform.ffmpegKitConfigGetSessionsByState(sessionState.index).then((sessions) { if (sessions == null) { return List.empty(); } else { return sessions - .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession( - sessionObject as Map)) + .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession(sessionObject as Map)) .toList(); } }); @@ -598,12 +575,10 @@ class FFmpegKitConfig { } /// Returns the active log redirection strategy. - static LogRedirectionStrategy getLogRedirectionStrategy() => - _globalLogRedirectionStrategy; + static LogRedirectionStrategy getLogRedirectionStrategy() => _globalLogRedirectionStrategy; /// Sets the log redirection strategy. - static void setLogRedirectionStrategy( - LogRedirectionStrategy logRedirectionStrategy) { + static void setLogRedirectionStrategy(LogRedirectionStrategy logRedirectionStrategy) { _globalLogRedirectionStrategy = logRedirectionStrategy; } @@ -630,8 +605,6 @@ class FFmpegKitConfig { return "FAILED"; case SessionState.completed: return "COMPLETED"; - default: - return ""; } } @@ -660,8 +633,7 @@ class FFmpegKitConfig { argumentList.add(currentArgument.toString()); currentArgument = new StringBuffer(); } - } else if (currentChar == '\''.codeUnitAt(0) && - (previousChar == null || previousChar != '\\'.codeUnitAt(0))) { + } else if (currentChar == '\''.codeUnitAt(0) && (previousChar == null || previousChar != '\\'.codeUnitAt(0))) { if (singleQuoteStarted) { singleQuoteStarted = false; } else if (doubleQuoteStarted) { @@ -669,8 +641,7 @@ class FFmpegKitConfig { } else { singleQuoteStarted = true; } - } else if (currentChar == '\"'.codeUnitAt(0) && - (previousChar == null || previousChar != '\\'.codeUnitAt(0))) { + } else if (currentChar == '\"'.codeUnitAt(0) && (previousChar == null || previousChar != '\\'.codeUnitAt(0))) { if (doubleQuoteStarted) { doubleQuoteStarted = false; } else if (singleQuoteStarted) { @@ -782,8 +753,7 @@ class FFmpegKitConfig { /// /// Note that this method is Android only. It will fail if called on other /// platforms. - static Future selectDocumentForRead( - [String? type = null, List? extraTypes = null]) async { + static Future selectDocumentForRead([String? type = null, List? extraTypes = null]) async { try { await init(); 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 /// platforms. - static Future selectDocumentForWrite( - [String? title = null, - String? type = null, - List? extraTypes = null]) async { + static Future selectDocumentForWrite([ + String? title = null, + String? type = null, + List? extraTypes = null, + ]) async { try { await init(); - return _platform.ffmpegKitConfigSelectDocumentForWrite( - title, type, extraTypes); + return _platform.ffmpegKitConfigSelectDocumentForWrite(title, type, extraTypes); } on PlatformException catch (e, stack) { print("Plugin selectDocumentForWrite error: ${e.message}"); return Future.error("selectDocumentForWrite failed.", stack); diff --git a/flutter/flutter/lib/ffmpeg_session.dart b/flutter/flutter/lib/ffmpeg_session.dart index e3a655c..f145875 100644 --- a/flutter/flutter/lib/ffmpeg_session.dart +++ b/flutter/flutter/lib/ffmpeg_session.dart @@ -32,17 +32,17 @@ import 'statistics_callback.dart'; /// An FFmpeg session. class FFmpegSession extends AbstractSession { /// Creates a new FFmpeg session with [argumentsArray]. - static Future create(List argumentsArray, - [FFmpegSessionCompleteCallback? completeCallback = null, - LogCallback? logCallback = null, - StatisticsCallback? statisticsCallback = null, - LogRedirectionStrategy? logRedirectionStrategy = null]) async { - final session = await AbstractSession.createFFmpegSession( - argumentsArray, logRedirectionStrategy); + static Future create( + List argumentsArray, [ + FFmpegSessionCompleteCallback? completeCallback = null, + LogCallback? logCallback = null, + StatisticsCallback? statisticsCallback = null, + LogRedirectionStrategy? logRedirectionStrategy = null, + ]) async { + final session = await AbstractSession.createFFmpegSession(argumentsArray, logRedirectionStrategy); final sessionId = session.getSessionId(); - FFmpegKitFactory.setFFmpegSessionCompleteCallback( - sessionId, completeCallback); + FFmpegKitFactory.setFFmpegSessionCompleteCallback(sessionId, completeCallback); FFmpegKitFactory.setLogCallback(sessionId, logCallback); FFmpegKitFactory.setStatisticsCallback(sessionId, statisticsCallback); @@ -50,8 +50,7 @@ class FFmpegSession extends AbstractSession { } /// Returns the session specific statistics callback. - StatisticsCallback? getStatisticsCallback() => - FFmpegKitFactory.getStatisticsCallback(this.getSessionId()); + StatisticsCallback? getStatisticsCallback() => FFmpegKitFactory.getStatisticsCallback(this.getSessionId()); /// Returns the session specific complete callback. FFmpegSessionCompleteCallback? getCompleteCallback() => @@ -63,16 +62,17 @@ class FFmpegSession extends AbstractSession { Future> getAllStatistics([int? waitTimeout]) async { try { await FFmpegKitConfig.init(); - return FFmpegKitPlatform.instance - .ffmpegSessionGetAllStatistics(this.getSessionId(), waitTimeout) - .then((allStatistics) { + return FFmpegKitPlatform.instance.ffmpegSessionGetAllStatistics(this.getSessionId(), waitTimeout).then(( + allStatistics, + ) { if (allStatistics == null) { return List.empty(); } else { return allStatistics - .map((dynamic statisticsObject) => - FFmpegKitFactory.mapToStatistics( - statisticsObject as Map)) + .map( + (dynamic statisticsObject) => + FFmpegKitFactory.mapToStatistics(statisticsObject as Map), + ) .toList(); } }); @@ -88,16 +88,15 @@ class FFmpegSession extends AbstractSession { Future> getStatistics() async { try { await FFmpegKitConfig.init(); - return FFmpegKitPlatform.instance - .ffmpegSessionGetStatistics(this.getSessionId()) - .then((statistics) { + return FFmpegKitPlatform.instance.ffmpegSessionGetStatistics(this.getSessionId()).then((statistics) { if (statistics == null) { return List.empty(); } else { return statistics - .map((dynamic statisticsObject) => - FFmpegKitFactory.mapToStatistics( - statisticsObject as Map)) + .map( + (dynamic statisticsObject) => + FFmpegKitFactory.mapToStatistics(statisticsObject as Map), + ) .toList(); } }); @@ -108,14 +107,13 @@ class FFmpegSession extends AbstractSession { } /// Returns the last received statistics entry. - Future getLastReceivedStatistics() async => - this.getStatistics().then((statistics) { - if (statistics.length > 0) { - return statistics[statistics.length - 1]; - } else { - return null; - } - }); + Future getLastReceivedStatistics() async => this.getStatistics().then((statistics) { + if (statistics.length > 0) { + return statistics[statistics.length - 1]; + } else { + return null; + } + }); bool isFFmpeg() => true; diff --git a/flutter/flutter/lib/ffprobe_kit.dart b/flutter/flutter/lib/ffprobe_kit.dart index 49165a2..c184ea1 100644 --- a/flutter/flutter/lib/ffprobe_kit.dart +++ b/flutter/flutter/lib/ffprobe_kit.dart @@ -39,10 +39,8 @@ class FFprobeKit { FFprobeKit.executeWithArguments(FFmpegKitConfig.parseArguments(command)); /// Synchronously executes FFprobe with arguments provided. - static Future executeWithArguments( - List commandArguments) async { - final session = - await FFprobeSession.create(commandArguments, null, null, null); + static Future executeWithArguments(List commandArguments) async { + final session = await FFprobeSession.create(commandArguments, null, null, null); 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 /// [FFprobeSessionCompleteCallback] if you want to be notified about the result. - static Future executeAsync(String command, - [FFprobeSessionCompleteCallback? completeCallback = null, - LogCallback? logCallback = null]) async => - FFprobeKit.executeWithArgumentsAsync( - FFmpegKitConfig.parseArguments(command), - completeCallback, - logCallback); + static Future executeAsync( + String command, [ + FFprobeSessionCompleteCallback? completeCallback = null, + LogCallback? logCallback = null, + ]) async => + FFprobeKit.executeWithArgumentsAsync(FFmpegKitConfig.parseArguments(command), completeCallback, logCallback); /// 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 /// [FFprobeSessionCompleteCallback] if you want to be notified about the result. static Future executeWithArgumentsAsync( - List commandArguments, - [FFprobeSessionCompleteCallback? completeCallback = null, - LogCallback? logCallback = null]) async { - final session = await FFprobeSession.create( - commandArguments, completeCallback, logCallback, null); + List commandArguments, [ + FFprobeSessionCompleteCallback? completeCallback = null, + LogCallback? logCallback = null, + ]) async { + final session = await FFprobeSession.create(commandArguments, completeCallback, logCallback, null); await FFmpegKitConfig.asyncFFprobeExecute(session); @@ -79,8 +76,7 @@ class FFprobeKit { } /// Extracts media information for the file specified with path. - static Future getMediaInformation(String path, - [int? waitTimeout = null]) async { + static Future getMediaInformation(String path, [int? waitTimeout = null]) async { final commandArguments = [ "-v", "error", @@ -91,29 +87,27 @@ class FFprobeKit { "-show_streams", "-show_chapters", "-i", - path + path, ]; - return FFprobeKit.getMediaInformationFromCommandArguments( - commandArguments, waitTimeout); + return FFprobeKit.getMediaInformationFromCommandArguments(commandArguments, waitTimeout); } /// Extracts media information using the command provided. The command /// passed to this method must generate the output in JSON format in order to /// successfully extract media information from it. static Future getMediaInformationFromCommand( - String command, - [int? waitTimeout = null]) async => - FFprobeKit.getMediaInformationFromCommandArguments( - FFmpegKitConfig.parseArguments(command), waitTimeout); + String command, [ + int? waitTimeout = null, + ]) async => FFprobeKit.getMediaInformationFromCommandArguments(FFmpegKitConfig.parseArguments(command), waitTimeout); /// Extracts media information using the command arguments provided. The /// command passed to this method must generate the output in JSON format in /// order to successfully extract media information from it. - static Future - getMediaInformationFromCommandArguments(List commandArguments, - [int? waitTimeout = null]) async { - final session = - await MediaInformationSession.create(commandArguments, null, null); + static Future getMediaInformationFromCommandArguments( + List commandArguments, [ + int? waitTimeout = null, + ]) async { + final session = await MediaInformationSession.create(commandArguments, null, null); 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 /// [MediaInformationSessionCompleteCallback] if you want to be notified about the result. - static Future getMediaInformationAsync(String path, - [MediaInformationSessionCompleteCallback? completeCallback = null, - LogCallback? logCallback = null, - int? waitTimeout = null]) async { + static Future getMediaInformationAsync( + String path, [ + MediaInformationSessionCompleteCallback? completeCallback = null, + LogCallback? logCallback = null, + int? waitTimeout = null, + ]) async { final commandArguments = [ "-v", "error", @@ -145,10 +141,14 @@ class FFprobeKit { "-show_streams", "-show_chapters", "-i", - path + path, ]; 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 @@ -157,15 +157,16 @@ class FFprobeKit { /// 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. static Future getMediaInformationFromCommandAsync( - String command, - [MediaInformationSessionCompleteCallback? completeCallback = null, - LogCallback? logCallback = null, - int? waitTimeout = null]) async => - FFprobeKit.getMediaInformationFromCommandArgumentsAsync( - FFmpegKitConfig.parseArguments(command), - completeCallback, - logCallback, - waitTimeout); + String command, [ + MediaInformationSessionCompleteCallback? completeCallback = null, + LogCallback? logCallback = null, + int? waitTimeout = null, + ]) async => FFprobeKit.getMediaInformationFromCommandArgumentsAsync( + FFmpegKitConfig.parseArguments(command), + completeCallback, + logCallback, + waitTimeout, + ); /// Starts an asynchronous FFprobe execution to extract media information /// 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 /// to complete. You must use an [MediaInformationSessionCompleteCallback] if you want to be /// notified about the result. - static Future - getMediaInformationFromCommandArgumentsAsync( - List commandArguments, - [MediaInformationSessionCompleteCallback? completeCallback = null, - LogCallback? logCallback = null, - int? waitTimeout = null]) async { - final session = await MediaInformationSession.create( - commandArguments, completeCallback, logCallback); + static Future getMediaInformationFromCommandArgumentsAsync( + List commandArguments, [ + MediaInformationSessionCompleteCallback? completeCallback = null, + LogCallback? logCallback = null, + int? waitTimeout = null, + ]) async { + final session = await MediaInformationSession.create(commandArguments, completeCallback, logCallback); await FFmpegKitConfig.asyncGetMediaInformationExecute(session, waitTimeout); @@ -205,8 +205,7 @@ class FFprobeKit { return List.empty(); } else { return sessions - .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession( - sessionObject as Map)) + .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession(sessionObject as Map)) .map((session) => session as FFprobeSession) .toList(); } @@ -218,19 +217,15 @@ class FFprobeKit { } /// Lists all MediaInformation sessions in the session history. - static Future> - listMediaInformationSessions() async { + static Future> listMediaInformationSessions() async { try { await FFmpegKitConfig.init(); - return _platform - .ffprobeKitListMediaInformationSessions() - .then((sessions) { + return _platform.ffprobeKitListMediaInformationSessions().then((sessions) { if (sessions == null) { return List.empty(); } else { return sessions - .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession( - sessionObject as Map)) + .map((dynamic sessionObject) => FFmpegKitFactory.mapToSession(sessionObject as Map)) .map((session) => session as MediaInformationSession) .toList(); } diff --git a/flutter/flutter/lib/ffprobe_session.dart b/flutter/flutter/lib/ffprobe_session.dart index 42e826d..a6532d6 100644 --- a/flutter/flutter/lib/ffprobe_session.dart +++ b/flutter/flutter/lib/ffprobe_session.dart @@ -26,16 +26,16 @@ import 'src/ffmpeg_kit_factory.dart'; /// An FFprobe session. class FFprobeSession extends AbstractSession { /// Creates a new FFprobe session with [argumentsArray]. - static Future create(List argumentsArray, - [FFprobeSessionCompleteCallback? completeCallback = null, - LogCallback? logCallback = null, - LogRedirectionStrategy? logRedirectionStrategy = null]) async { - final session = await AbstractSession.createFFprobeSession( - argumentsArray, logRedirectionStrategy); + static Future create( + List argumentsArray, [ + FFprobeSessionCompleteCallback? completeCallback = null, + LogCallback? logCallback = null, + LogRedirectionStrategy? logRedirectionStrategy = null, + ]) async { + final session = await AbstractSession.createFFprobeSession(argumentsArray, logRedirectionStrategy); final sessionId = session.getSessionId(); - FFmpegKitFactory.setFFprobeSessionCompleteCallback( - sessionId, completeCallback); + FFmpegKitFactory.setFFprobeSessionCompleteCallback(sessionId, completeCallback); FFmpegKitFactory.setLogCallback(sessionId, logCallback); return session; diff --git a/flutter/flutter/lib/log_redirection_strategy.dart b/flutter/flutter/lib/log_redirection_strategy.dart index 259119e..f83bccc 100644 --- a/flutter/flutter/lib/log_redirection_strategy.dart +++ b/flutter/flutter/lib/log_redirection_strategy.dart @@ -22,5 +22,5 @@ enum LogRedirectionStrategy { printLogsWhenNoCallbacksDefined, printLogsWhenGlobalCallbackNotDefined, printLogsWhenSessionCallbackNotDefined, - neverPrintLogs + neverPrintLogs, } diff --git a/flutter/flutter/lib/media_information.dart b/flutter/flutter/lib/media_information.dart index 1abb89e..800d244 100644 --- a/flutter/flutter/lib/media_information.dart +++ b/flutter/flutter/lib/media_information.dart @@ -38,35 +38,28 @@ class MediaInformation { MediaInformation(this._allProperties); /// Returns file name. - String? getFilename() => - this.getStringFormatProperty(MediaInformation.keyFilename); + String? getFilename() => this.getStringFormatProperty(MediaInformation.keyFilename); /// Returns format. - String? getFormat() => - this.getStringFormatProperty(MediaInformation.keyFormat); + String? getFormat() => this.getStringFormatProperty(MediaInformation.keyFormat); /// Returns long format. - String? getLongFormat() => - this.getStringFormatProperty(MediaInformation.keyFormatLong); + String? getLongFormat() => this.getStringFormatProperty(MediaInformation.keyFormatLong); /// Returns duration. - String? getDuration() => - this.getStringFormatProperty(MediaInformation.keyDuration); + String? getDuration() => this.getStringFormatProperty(MediaInformation.keyDuration); /// Returns start time. - String? getStartTime() => - this.getStringFormatProperty(MediaInformation.keyStartTime); + String? getStartTime() => this.getStringFormatProperty(MediaInformation.keyStartTime); /// Returns size. String? getSize() => this.getStringFormatProperty(MediaInformation.keySize); /// Returns bitrate. - String? getBitrate() => - this.getStringFormatProperty(MediaInformation.keyBitRate); + String? getBitrate() => this.getStringFormatProperty(MediaInformation.keyBitRate); /// Returns all tags. - Map? getTags() => - this.getFormatProperty(StreamInformation.keyTags); + Map? getTags() => this.getFormatProperty(StreamInformation.keyTags); /// Returns the property associated with the key. String? getStringProperty(String key) => this.getAllProperties()?[key]; @@ -78,8 +71,7 @@ class MediaInformation { dynamic getProperty(String key) => this.getAllProperties()?[key]; /// Returns the format property associated with the key. - String? getStringFormatProperty(String key) => - this.getFormatProperties()?[key]; + String? getStringFormatProperty(String key) => this.getFormatProperties()?[key]; /// Returns the format property associated with the key. num? getNumberFormatProperty(String key) => this.getFormatProperties()?[key]; @@ -89,8 +81,7 @@ class MediaInformation { /// Returns all streams found as a list. List getStreams() { - final List list = - List.empty(growable: true); + final List list = List.empty(growable: true); dynamic createStreamInformation(Map streamProperties) => list.add(new StreamInformation(streamProperties)); @@ -106,8 +97,7 @@ class MediaInformation { List getChapters() { final List list = List.empty(growable: true); - dynamic createChapter(Map chapterProperties) => - list.add(new Chapter(chapterProperties)); + dynamic createChapter(Map chapterProperties) => list.add(new Chapter(chapterProperties)); this._allProperties?["chapters"]?.forEach((Object? chapter) { createChapter(chapter as Map); @@ -117,8 +107,7 @@ class MediaInformation { } /// Returns all format properties found. - Map? getFormatProperties() => - this._allProperties?[keyFormatProperties]; + Map? getFormatProperties() => this._allProperties?[keyFormatProperties]; /// Returns all properties found, including stream properties. Map? getAllProperties() => this._allProperties; diff --git a/flutter/flutter/lib/media_information_json_parser.dart b/flutter/flutter/lib/media_information_json_parser.dart index f409a51..05978b0 100644 --- a/flutter/flutter/lib/media_information_json_parser.dart +++ b/flutter/flutter/lib/media_information_json_parser.dart @@ -33,9 +33,7 @@ class MediaInformationJsonParser { static Future from(String ffprobeJsonOutput) async { try { await FFmpegKitConfig.init(); - return _platform - .mediaInformationJsonParserFrom(ffprobeJsonOutput) - .then((properties) { + return _platform.mediaInformationJsonParserFrom(ffprobeJsonOutput).then((properties) { if (properties == null || properties.length == 0) { return null; } else { @@ -49,8 +47,7 @@ class MediaInformationJsonParser { } /// Extracts MediaInformation from the given FFprobe json output. - static Future fromWithError( - String ffprobeJsonOutput) async { + static Future fromWithError(String ffprobeJsonOutput) async { try { await FFmpegKitConfig.init(); return _platform diff --git a/flutter/flutter/lib/media_information_session.dart b/flutter/flutter/lib/media_information_session.dart index 472fa1b..e675d43 100644 --- a/flutter/flutter/lib/media_information_session.dart +++ b/flutter/flutter/lib/media_information_session.dart @@ -29,15 +29,15 @@ class MediaInformationSession extends AbstractSession { MediaInformation? _mediaInformation; /// Creates a new MediaInformation session with [argumentsArray]. - static Future create(List argumentsArray, - [MediaInformationSessionCompleteCallback? completeCallback = null, - LogCallback? logCallback = null]) async { - final session = - await AbstractSession.createMediaInformationSession(argumentsArray); + static Future create( + List argumentsArray, [ + MediaInformationSessionCompleteCallback? completeCallback = null, + LogCallback? logCallback = null, + ]) async { + final session = await AbstractSession.createMediaInformationSession(argumentsArray); final sessionId = session.getSessionId(); - FFmpegKitFactory.setMediaInformationSessionCompleteCallback( - sessionId, completeCallback); + FFmpegKitFactory.setMediaInformationSessionCompleteCallback(sessionId, completeCallback); FFmpegKitFactory.setLogCallback(sessionId, logCallback); return session; @@ -53,8 +53,7 @@ class MediaInformationSession extends AbstractSession { /// Returns the session specific complete callback. MediaInformationSessionCompleteCallback? getCompleteCallback() => - FFmpegKitFactory.getMediaInformationSessionCompleteCallback( - this.getSessionId()); + FFmpegKitFactory.getMediaInformationSessionCompleteCallback(this.getSessionId()); bool isFFmpeg() => false; diff --git a/flutter/flutter/lib/media_information_session_complete_callback.dart b/flutter/flutter/lib/media_information_session_complete_callback.dart index 213900f..b80bb8a 100644 --- a/flutter/flutter/lib/media_information_session_complete_callback.dart +++ b/flutter/flutter/lib/media_information_session_complete_callback.dart @@ -26,5 +26,4 @@ import 'media_information_session.dart'; /// see the execution result. /// If "getState" returns SessionState.failed then "getFailStackTrace" should /// be used to get the failure reason. -typedef MediaInformationSessionCompleteCallback = void Function( - MediaInformationSession session); +typedef MediaInformationSessionCompleteCallback = void Function(MediaInformationSession session); diff --git a/flutter/flutter/lib/return_code.dart b/flutter/flutter/lib/return_code.dart index 9a34ec5..e3fc1c1 100644 --- a/flutter/flutter/lib/return_code.dart +++ b/flutter/flutter/lib/return_code.dart @@ -25,18 +25,15 @@ class ReturnCode { ReturnCode(this._value); - static bool isSuccess(ReturnCode? returnCode) => - returnCode?.getValue() == ReturnCode.success; + static bool isSuccess(ReturnCode? returnCode) => returnCode?.getValue() == ReturnCode.success; - static bool isCancel(ReturnCode? returnCode) => - returnCode?.getValue() == ReturnCode.cancel; + static bool isCancel(ReturnCode? returnCode) => returnCode?.getValue() == ReturnCode.cancel; int getValue() => this._value; bool isValueSuccess() => this._value == ReturnCode.success; - bool isValueError() => - (this._value != ReturnCode.success) && (this._value != ReturnCode.cancel); + bool isValueError() => (this._value != ReturnCode.success) && (this._value != ReturnCode.cancel); bool isValueCancel() => this._value == ReturnCode.cancel; diff --git a/flutter/flutter/lib/src/ffmpeg_kit_factory.dart b/flutter/flutter/lib/src/ffmpeg_kit_factory.dart index 936b14d..2da3149 100644 --- a/flutter/flutter/lib/src/ffmpeg_kit_factory.dart +++ b/flutter/flutter/lib/src/ffmpeg_kit_factory.dart @@ -29,12 +29,9 @@ import '../session.dart'; import '../statistics.dart'; import '../statistics_callback.dart'; -final ffmpegSessionCompleteCallbackMap = - new Map(); -final ffprobeSessionCompleteCallbackMap = - new Map(); -final mediaInformationSessionCompleteCallbackMap = - new Map(); +final ffmpegSessionCompleteCallbackMap = new Map(); +final ffprobeSessionCompleteCallbackMap = new Map(); +final mediaInformationSessionCompleteCallbackMap = new Map(); final logCallbackMap = new Map(); final statisticsCallbackMap = new Map(); final logRedirectionStrategyMap = new Map(); @@ -44,22 +41,20 @@ class FFmpegKitFactory { static StatisticsCallback? _statisticsCallback; static FFmpegSessionCompleteCallback? _ffmpegSessionCompleteCallback; static FFprobeSessionCompleteCallback? _ffprobeSessionCompleteCallback; - static MediaInformationSessionCompleteCallback? - _mediaInformationSessionCompleteCallback; + static MediaInformationSessionCompleteCallback? _mediaInformationSessionCompleteCallback; - static Statistics mapToStatistics(Map statisticsMap) => - new Statistics( - statisticsMap["sessionId"], - statisticsMap["videoFrameNumber"], - statisticsMap["videoFps"], - statisticsMap["videoQuality"], - statisticsMap["size"], - statisticsMap["time"], - statisticsMap["bitrate"], - statisticsMap["speed"]); + static Statistics mapToStatistics(Map statisticsMap) => new Statistics( + statisticsMap["sessionId"], + statisticsMap["videoFrameNumber"], + statisticsMap["videoFps"], + statisticsMap["videoQuality"], + statisticsMap["size"], + statisticsMap["time"], + statisticsMap["bitrate"], + statisticsMap["speed"], + ); - static Log mapToLog(Map logMap) => - new Log(logMap["sessionId"], logMap["level"], logMap["message"]); + static Log mapToLog(Map logMap) => new Log(logMap["sessionId"], logMap["level"], logMap["message"]); static Session mapToSession(Map sessionMap) { switch (sessionMap["type"]) { @@ -79,8 +74,7 @@ class FFmpegKitFactory { case 2: return AbstractSession.createFFprobeSessionFromMap(sessionMap); case 3: - return AbstractSession.createMediaInformationSessionFromMap( - sessionMap); + return AbstractSession.createMediaInformationSessionFromMap(sessionMap); case 1: default: return AbstractSession.createFFmpegSessionFromMap(sessionMap); @@ -90,8 +84,7 @@ class FFmpegKitFactory { } } - static MediaInformation? mapToNullableMediaInformation( - Map? mediaInformationMap) { + static MediaInformation? mapToNullableMediaInformation(Map? mediaInformationMap) { if (mediaInformationMap != null) { return new MediaInformation(mediaInformationMap); } else { @@ -101,18 +94,15 @@ class FFmpegKitFactory { static String getVersion() => "6.0.3"; - static LogRedirectionStrategy? getLogRedirectionStrategy(int? sessionId) => - logRedirectionStrategyMap[sessionId]; + static LogRedirectionStrategy? getLogRedirectionStrategy(int? sessionId) => logRedirectionStrategyMap[sessionId]; - static void setLogRedirectionStrategy( - int? sessionId, LogRedirectionStrategy? logRedirectionStrategy) { + static void setLogRedirectionStrategy(int? sessionId, LogRedirectionStrategy? logRedirectionStrategy) { if (sessionId != null && logRedirectionStrategy != null) { logRedirectionStrategyMap[sessionId] = logRedirectionStrategy; } } - static LogCallback? getLogCallback(int? sessionId) => - logCallbackMap[sessionId]; + static LogCallback? getLogCallback(int? sessionId) => logCallbackMap[sessionId]; static void setLogCallback(int? sessionId, LogCallback? logCallback) { if (sessionId != null && logCallback != null) { @@ -126,81 +116,68 @@ class FFmpegKitFactory { _logCallback = logCallback; } - static StatisticsCallback? getStatisticsCallback(int? sessionId) => - statisticsCallbackMap[sessionId]; + static StatisticsCallback? getStatisticsCallback(int? sessionId) => statisticsCallbackMap[sessionId]; - static void setStatisticsCallback( - int? sessionId, StatisticsCallback? statisticsCallback) { + static void setStatisticsCallback(int? sessionId, StatisticsCallback? statisticsCallback) { if (sessionId != null && statisticsCallback != null) { statisticsCallbackMap[sessionId] = statisticsCallback; } } - static StatisticsCallback? getGlobalStatisticsCallback() => - _statisticsCallback; + static StatisticsCallback? getGlobalStatisticsCallback() => _statisticsCallback; - static void setGlobalStatisticsCallback( - StatisticsCallback? statisticsCallback) { + static void setGlobalStatisticsCallback(StatisticsCallback? statisticsCallback) { _statisticsCallback = statisticsCallback; } - static FFmpegSessionCompleteCallback? getFFmpegSessionCompleteCallback( - int? sessionId) => + static FFmpegSessionCompleteCallback? getFFmpegSessionCompleteCallback(int? sessionId) => ffmpegSessionCompleteCallbackMap[sessionId]; - static void setFFmpegSessionCompleteCallback( - int? sessionId, FFmpegSessionCompleteCallback? completeCallback) { + static void setFFmpegSessionCompleteCallback(int? sessionId, FFmpegSessionCompleteCallback? completeCallback) { if (sessionId != null && completeCallback != null) { ffmpegSessionCompleteCallbackMap[sessionId] = completeCallback; } } - static FFmpegSessionCompleteCallback? - getGlobalFFmpegSessionCompleteCallback() => - _ffmpegSessionCompleteCallback; + static FFmpegSessionCompleteCallback? getGlobalFFmpegSessionCompleteCallback() => _ffmpegSessionCompleteCallback; - static void setGlobalFFmpegSessionCompleteCallback( - FFmpegSessionCompleteCallback? completeCallback) { + static void setGlobalFFmpegSessionCompleteCallback(FFmpegSessionCompleteCallback? completeCallback) { _ffmpegSessionCompleteCallback = completeCallback; } - static FFprobeSessionCompleteCallback? getFFprobeSessionCompleteCallback( - int? sessionId) => + static FFprobeSessionCompleteCallback? getFFprobeSessionCompleteCallback(int? sessionId) => ffprobeSessionCompleteCallbackMap[sessionId]; - static void setFFprobeSessionCompleteCallback( - int? sessionId, FFprobeSessionCompleteCallback? completeCallback) { + static void setFFprobeSessionCompleteCallback(int? sessionId, FFprobeSessionCompleteCallback? completeCallback) { if (sessionId != null && completeCallback != null) { ffprobeSessionCompleteCallbackMap[sessionId] = completeCallback; } } - static FFprobeSessionCompleteCallback? - getGlobalFFprobeSessionCompleteCallback() => - _ffprobeSessionCompleteCallback; + static FFprobeSessionCompleteCallback? getGlobalFFprobeSessionCompleteCallback() => _ffprobeSessionCompleteCallback; - static void setGlobalFFprobeSessionCompleteCallback( - FFprobeSessionCompleteCallback? completeCallback) { + static void setGlobalFFprobeSessionCompleteCallback(FFprobeSessionCompleteCallback? completeCallback) { _ffprobeSessionCompleteCallback = completeCallback; } - static MediaInformationSessionCompleteCallback? - getMediaInformationSessionCompleteCallback(int? sessionId) => - mediaInformationSessionCompleteCallbackMap[sessionId]; + static MediaInformationSessionCompleteCallback? getMediaInformationSessionCompleteCallback(int? sessionId) => + mediaInformationSessionCompleteCallbackMap[sessionId]; - static void setMediaInformationSessionCompleteCallback(int? sessionId, - MediaInformationSessionCompleteCallback? completeCallback) { + static void setMediaInformationSessionCompleteCallback( + int? sessionId, + MediaInformationSessionCompleteCallback? completeCallback, + ) { if (sessionId != null && completeCallback != null) { mediaInformationSessionCompleteCallbackMap[sessionId] = completeCallback; } } - static MediaInformationSessionCompleteCallback? - getGlobalMediaInformationSessionCompleteCallback() => - _mediaInformationSessionCompleteCallback; + static MediaInformationSessionCompleteCallback? getGlobalMediaInformationSessionCompleteCallback() => + _mediaInformationSessionCompleteCallback; static void setGlobalMediaInformationSessionCompleteCallback( - MediaInformationSessionCompleteCallback? completeCallback) { + MediaInformationSessionCompleteCallback? completeCallback, + ) { _mediaInformationSessionCompleteCallback = completeCallback; } diff --git a/flutter/flutter/lib/src/ffmpeg_kit_flutter_initializer.dart b/flutter/flutter/lib/src/ffmpeg_kit_flutter_initializer.dart index 6c54e21..9dcb2b0 100644 --- a/flutter/flutter/lib/src/ffmpeg_kit_flutter_initializer.dart +++ b/flutter/flutter/lib/src/ffmpeg_kit_flutter_initializer.dart @@ -41,8 +41,7 @@ import 'ffmpeg_kit_factory.dart'; class FFmpegKitInitializer { static FFmpegKitPlatform _platform = FFmpegKitPlatform.instance; - static const EventChannel _eventChannel = - const EventChannel('flutter.arthenica.com/ffmpeg_kit_event'); + static const EventChannel _eventChannel = const EventChannel('flutter.arthenica.com/ffmpeg_kit_event'); static FFmpegKitInitializer _instance = new FFmpegKitInitializer(); @@ -59,12 +58,9 @@ class FFmpegKitInitializer { void _onEvent(dynamic event) { if (event is Map) { final Map eventMap = event.cast(); - final Map? logEvent = - eventMap['FFmpegKitLogCallbackEvent']; - final Map? statisticsEvent = - eventMap['FFmpegKitStatisticsCallbackEvent']; - final Map? completeEvent = - eventMap['FFmpegKitCompleteCallbackEvent']; + final Map? logEvent = eventMap['FFmpegKitLogCallbackEvent']; + final Map? statisticsEvent = eventMap['FFmpegKitStatisticsCallbackEvent']; + final Map? completeEvent = eventMap['FFmpegKitCompleteCallbackEvent']; if (logEvent != null) { _processLogCallbackEvent(logEvent); @@ -92,19 +88,16 @@ class FFmpegKitInitializer { final int activeLogLevel = FFmpegKitConfig.getLogLevel(); var globalCallbackDefined = false; var sessionCallbackDefined = false; - LogRedirectionStrategy activeLogRedirectionStrategy = - FFmpegKitConfig.getLogRedirectionStrategy(); + LogRedirectionStrategy activeLogRedirectionStrategy = FFmpegKitConfig.getLogRedirectionStrategy(); // avLogStderr logs are always redirected - if ((activeLogLevel == Level.avLogQuiet && level != Level.avLogStderr) || - level > activeLogLevel) { + if ((activeLogLevel == Level.avLogQuiet && level != Level.avLogStderr) || level > activeLogLevel) { // LOG NEITHER PRINTED NOR FORWARDED return; } activeLogRedirectionStrategy = - FFmpegKitFactory.getLogRedirectionStrategy(sessionId) ?? - activeLogRedirectionStrategy; + FFmpegKitFactory.getLogRedirectionStrategy(sessionId) ?? activeLogRedirectionStrategy; final LogCallback? logCallback = FFmpegKitFactory.getLogCallback(sessionId); if (logCallback != null) { @@ -182,8 +175,7 @@ class FFmpegKitInitializer { final Statistics statistics = FFmpegKitFactory.mapToStatistics(event); final int sessionId = event["sessionId"]; - final StatisticsCallback? statisticsCallback = - FFmpegKitFactory.getStatisticsCallback(sessionId); + final StatisticsCallback? statisticsCallback = FFmpegKitFactory.getStatisticsCallback(sessionId); if (statisticsCallback != null) { try { // NOTIFY SESSION CALLBACK DEFINED @@ -194,8 +186,7 @@ class FFmpegKitInitializer { } } - final globalStatisticsCallbackFunction = - FFmpegKitFactory.getGlobalStatisticsCallback(); + final globalStatisticsCallbackFunction = FFmpegKitFactory.getGlobalStatisticsCallback(); if (globalStatisticsCallbackFunction != null) { try { // NOTIFY GLOBAL CALLBACK DEFINED @@ -214,8 +205,7 @@ class FFmpegKitInitializer { if (session != null) { if (session.isFFmpeg()) { final ffmpegSession = session as FFmpegSession; - final FFmpegSessionCompleteCallback? completeCallback = - ffmpegSession.getCompleteCallback(); + final FFmpegSessionCompleteCallback? completeCallback = ffmpegSession.getCompleteCallback(); if (completeCallback != null) { try { @@ -227,8 +217,7 @@ class FFmpegKitInitializer { } } - final globalFFmpegSessionCompleteCallback = - FFmpegKitFactory.getGlobalFFmpegSessionCompleteCallback(); + final globalFFmpegSessionCompleteCallback = FFmpegKitFactory.getGlobalFFmpegSessionCompleteCallback(); if (globalFFmpegSessionCompleteCallback != null) { try { // NOTIFY GLOBAL CALLBACK DEFINED @@ -240,8 +229,7 @@ class FFmpegKitInitializer { } } else if (session.isFFprobe()) { final ffprobeSession = session as FFprobeSession; - final FFprobeSessionCompleteCallback? completeCallback = - ffprobeSession.getCompleteCallback(); + final FFprobeSessionCompleteCallback? completeCallback = ffprobeSession.getCompleteCallback(); if (completeCallback != null) { try { @@ -253,8 +241,7 @@ class FFmpegKitInitializer { } } - final globalFFprobeSessionCompleteCallback = - FFmpegKitFactory.getGlobalFFprobeSessionCompleteCallback(); + final globalFFprobeSessionCompleteCallback = FFmpegKitFactory.getGlobalFFprobeSessionCompleteCallback(); if (globalFFprobeSessionCompleteCallback != null) { try { // NOTIFY GLOBAL CALLBACK DEFINED @@ -279,13 +266,12 @@ class FFmpegKitInitializer { } } - final globalMediaInformationSessionCompleteCallback = FFmpegKitFactory - .getGlobalMediaInformationSessionCompleteCallback(); + final globalMediaInformationSessionCompleteCallback = + FFmpegKitFactory.getGlobalMediaInformationSessionCompleteCallback(); if (globalMediaInformationSessionCompleteCallback != null) { try { // NOTIFY GLOBAL CALLBACK DEFINED - globalMediaInformationSessionCompleteCallback( - mediaInformationSession); + globalMediaInformationSessionCompleteCallback(mediaInformationSession); } on Exception catch (e, stack) { print("Exception thrown inside global complete callback. $e"); print(stack); diff --git a/flutter/flutter/lib/statistics.dart b/flutter/flutter/lib/statistics.dart index 513a3f4..dfa3e07 100644 --- a/flutter/flutter/lib/statistics.dart +++ b/flutter/flutter/lib/statistics.dart @@ -28,8 +28,16 @@ class Statistics { double _bitrate; double _speed; - Statistics(this._sessionId, this._videoFrameNumber, this._videoFps, - this._videoQuality, this._size, this._time, this._bitrate, this._speed); + Statistics( + this._sessionId, + this._videoFrameNumber, + this._videoFps, + this._videoQuality, + this._size, + this._time, + this._bitrate, + this._speed, + ); int getSessionId() => this._sessionId; diff --git a/flutter/flutter/lib/stream_information.dart b/flutter/flutter/lib/stream_information.dart index b16b71b..0929ead 100644 --- a/flutter/flutter/lib/stream_information.dart +++ b/flutter/flutter/lib/stream_information.dart @@ -53,62 +53,49 @@ class StreamInformation { String? getCodec() => this.getStringProperty(StreamInformation.keyCodec); /// Returns stream codec in long format. - String? getCodecLong() => - this.getStringProperty(StreamInformation.keyCodecLong); + String? getCodecLong() => this.getStringProperty(StreamInformation.keyCodecLong); /// Returns stream format. String? getFormat() => this.getStringProperty(StreamInformation.keyFormat); /// Returns width. - int? getWidth() => - this.getNumberProperty(StreamInformation.keyWidth)?.toInt(); + int? getWidth() => this.getNumberProperty(StreamInformation.keyWidth)?.toInt(); /// Returns height. - int? getHeight() => - this.getNumberProperty(StreamInformation.keyHeight)?.toInt(); + int? getHeight() => this.getNumberProperty(StreamInformation.keyHeight)?.toInt(); /// Returns bitrate. String? getBitrate() => this.getStringProperty(StreamInformation.keyBitRate); /// Returns sample rate. - String? getSampleRate() => - this.getStringProperty(StreamInformation.keySampleRate); + String? getSampleRate() => this.getStringProperty(StreamInformation.keySampleRate); /// Returns sample format. - String? getSampleFormat() => - this.getStringProperty(StreamInformation.keySampleFormat); + String? getSampleFormat() => this.getStringProperty(StreamInformation.keySampleFormat); /// Returns channel layout. - String? getChannelLayout() => - this.getStringProperty(StreamInformation.keyChannelLayout); + String? getChannelLayout() => this.getStringProperty(StreamInformation.keyChannelLayout); /// Returns sample aspect ratio. - String? getSampleAspectRatio() => - this.getStringProperty(StreamInformation.keySampleAspectRatio); + String? getSampleAspectRatio() => this.getStringProperty(StreamInformation.keySampleAspectRatio); /// Returns display aspect ratio. - String? getDisplayAspectRatio() => - this.getStringProperty(StreamInformation.keyDisplayAspectRatio); + String? getDisplayAspectRatio() => this.getStringProperty(StreamInformation.keyDisplayAspectRatio); /// Returns average frame rate. - String? getAverageFrameRate() => - this.getStringProperty(StreamInformation.keyAverageFrameRate); + String? getAverageFrameRate() => this.getStringProperty(StreamInformation.keyAverageFrameRate); /// Returns real frame rate. - String? getRealFrameRate() => - this.getStringProperty(StreamInformation.keyRealFrameRate); + String? getRealFrameRate() => this.getStringProperty(StreamInformation.keyRealFrameRate); /// Returns time base. - String? getTimeBase() => - this.getStringProperty(StreamInformation.keyTimeBase); + String? getTimeBase() => this.getStringProperty(StreamInformation.keyTimeBase); /// Returns codec time base. - String? getCodecTimeBase() => - this.getStringProperty(StreamInformation.keyCodecTimeBase); + String? getCodecTimeBase() => this.getStringProperty(StreamInformation.keyCodecTimeBase); /// Returns all tags. - Map? getTags() => - this.getProperty(StreamInformation.keyTags); + Map? getTags() => this.getProperty(StreamInformation.keyTags); /// Returns the stream property associated with the key. String? getStringProperty(String key) => this._allProperties?[key]; diff --git a/flutter/flutter/macos/ffmpeg_kit_flutter.podspec b/flutter/flutter/macos/ffmpeg_kit_flutter.podspec index 899a9b1..0dc5607 100644 --- a/flutter/flutter/macos/ffmpeg_kit_flutter.podspec +++ b/flutter/flutter/macos/ffmpeg_kit_flutter.podspec @@ -15,7 +15,7 @@ Pod::Spec.new do |s| s.source_files = 'Classes/**/*' s.public_header_files = 'Classes/**/*.h' - s.default_subspec = 'https' + s.default_subspec = 'https-lts' s.dependency 'FlutterMacOS' s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } @@ -24,112 +24,112 @@ Pod::Spec.new do |s| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-macos-min', "6.0" - ss.osx.deployment_target = '10.15' + ss.osx.deployment_target = '11.0' end s.subspec 'min-lts' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-macos-min', "6.0.LTS" - ss.osx.deployment_target = '10.12' + ss.osx.deployment_target = '11.0' end s.subspec 'min-gpl' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-macos-min-gpl', "6.0" - ss.osx.deployment_target = '10.15' + ss.osx.deployment_target = '11.0' end s.subspec 'min-gpl-lts' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-macos-min-gpl', "6.0.LTS" - ss.osx.deployment_target = '10.12' + ss.osx.deployment_target = '11.0' end s.subspec 'https' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-macos-https', "6.0" - ss.osx.deployment_target = '10.15' + ss.osx.deployment_target = '11.0' end s.subspec 'https-lts' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-macos-https', "6.0.LTS" - ss.osx.deployment_target = '10.12' + ss.osx.deployment_target = '11.0' end s.subspec 'https-gpl' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-macos-https-gpl', "6.0" - ss.osx.deployment_target = '10.15' + ss.osx.deployment_target = '11.0' end s.subspec 'https-gpl-lts' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-macos-https-gpl', "6.0.LTS" - ss.osx.deployment_target = '10.12' + ss.osx.deployment_target = '11.0' end s.subspec 'audio' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-macos-audio', "6.0" - ss.osx.deployment_target = '10.15' + ss.osx.deployment_target = '11.0' end s.subspec 'audio-lts' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-macos-audio', "6.0.LTS" - ss.osx.deployment_target = '10.12' + ss.osx.deployment_target = '11.0' end s.subspec 'video' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-macos-video', "6.0" - ss.osx.deployment_target = '10.15' + ss.osx.deployment_target = '11.0' end s.subspec 'video-lts' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-macos-video', "6.0.LTS" - ss.osx.deployment_target = '10.12' + ss.osx.deployment_target = '11.0' end s.subspec 'full' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-macos-full', "6.0" - ss.osx.deployment_target = '10.15' + ss.osx.deployment_target = '11.0' end s.subspec 'full-lts' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-macos-full', "6.0.LTS" - ss.osx.deployment_target = '10.12' + ss.osx.deployment_target = '11.0' end s.subspec 'full-gpl' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-macos-full-gpl', "6.0" - ss.osx.deployment_target = '10.15' + ss.osx.deployment_target = '11.0' end s.subspec 'full-gpl-lts' do |ss| ss.source_files = 'Classes/**/*' ss.public_header_files = 'Classes/**/*.h' ss.dependency 'ffmpeg-kit-macos-full-gpl', "6.0.LTS" - ss.osx.deployment_target = '10.12' + ss.osx.deployment_target = '11.0' end end diff --git a/flutter/flutter/pubspec.yaml b/flutter/flutter/pubspec.yaml index 45782aa..bc48da0 100644 --- a/flutter/flutter/pubspec.yaml +++ b/flutter/flutter/pubspec.yaml @@ -6,8 +6,8 @@ homepage: https://github.com/arthenica/ffmpeg-kit version: 6.0.3 environment: - sdk: ">=2.12.0 <4.0.0" - flutter: ">=2.0.0" + sdk: ">=3.7.0 <4.0.0" + flutter: ">=3.29.0" flutter: plugin: @@ -21,11 +21,12 @@ flutter: pluginClass: FFmpegKitFlutterPlugin 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: sdk: flutter dev_dependencies: - flutter_test: - sdk: flutter - plugin_platform_interface: ^2.1.5 + carapacik_lints: ^1.11.1 diff --git a/flutter/flutter_platform_interface/.gitignore b/flutter/flutter_platform_interface/.gitignore index 16f71de..44408ea 100644 --- a/flutter/flutter_platform_interface/.gitignore +++ b/flutter/flutter_platform_interface/.gitignore @@ -3,3 +3,4 @@ .packages .pub/ build/ +pubspec.lock diff --git a/flutter/flutter_platform_interface/analysis_options.yaml b/flutter/flutter_platform_interface/analysis_options.yaml index a5dd89f..5562025 100644 --- a/flutter/flutter_platform_interface/analysis_options.yaml +++ b/flutter/flutter_platform_interface/analysis_options.yaml @@ -1,68 +1,3 @@ -analyzer: - enable-experiment: - - non-nullable - 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 \ No newline at end of file +include: package:carapacik_lints/core.yaml +formatter: + page_width: 120 diff --git a/flutter/flutter_platform_interface/lib/ffmpeg_kit_flutter_platform_interface.dart b/flutter/flutter_platform_interface/lib/ffmpeg_kit_flutter_platform_interface.dart index 779dcff..549bda8 100644 --- a/flutter/flutter_platform_interface/lib/ffmpeg_kit_flutter_platform_interface.dart +++ b/flutter/flutter_platform_interface/lib/ffmpeg_kit_flutter_platform_interface.dart @@ -20,10 +20,9 @@ * SOFTWARE. */ +import 'package:ffmpeg_kit_flutter_platform_interface/method_channel_ffmpeg_kit_flutter.dart'; import 'package:plugin_platform_interface/plugin_platform_interface.dart'; -import 'method_channel_ffmpeg_kit_flutter.dart'; - abstract class FFmpegKitPlatform extends PlatformInterface { /// Constructs a FFmpegKitPlatform. FFmpegKitPlatform() : super(token: _token); @@ -47,71 +46,58 @@ abstract class FFmpegKitPlatform extends PlatformInterface { // AbstractSession - Future?> abstractSessionCreateFFmpegSession( - List argumentsArray) async { - throw UnimplementedError( - 'abstractSessionCreateFFmpegSession() has not been implemented!'); + Future?> abstractSessionCreateFFmpegSession(List argumentsArray) async { + throw UnimplementedError('abstractSessionCreateFFmpegSession() has not been implemented!'); } - Future?> abstractSessionCreateFFprobeSession( - List argumentsArray) async { - throw UnimplementedError( - 'abstractSessionCreateFFprobeSession() has not been implemented!'); + Future?> abstractSessionCreateFFprobeSession(List argumentsArray) async { + throw UnimplementedError('abstractSessionCreateFFprobeSession() has not been implemented!'); } - Future?> abstractSessionCreateMediaInformationSession( - List argumentsArray) async { - throw UnimplementedError('abstractSessionCreateMediaInformationSession()' - ' has not been implemented!'); + Future?> abstractSessionCreateMediaInformationSession(List argumentsArray) async { + throw UnimplementedError( + 'abstractSessionCreateMediaInformationSession()' + ' has not been implemented!', + ); } Future abstractSessionGetEndTime(int? sessionId) async { - throw UnimplementedError( - 'abstractSessionGetEndTime() has not been implemented!'); + throw UnimplementedError('abstractSessionGetEndTime() has not been implemented!'); } Future abstractSessionGetDuration(int? sessionId) async { - throw UnimplementedError( - 'abstractSessionGetDuration() has not been implemented!'); + throw UnimplementedError('abstractSessionGetDuration() has not been implemented!'); } - Future?> abstractSessionGetAllLogs( - int? sessionId, int? waitTimeout) async { - throw UnimplementedError( - 'abstractSessionGetAllLogs() has not been implemented!'); + Future?> abstractSessionGetAllLogs(int? sessionId, int? waitTimeout) async { + throw UnimplementedError('abstractSessionGetAllLogs() has not been implemented!'); } Future?> abstractSessionGetLogs(int? sessionId) async { - throw UnimplementedError( - 'abstractSessionGetLogs() has not been implemented!'); + throw UnimplementedError('abstractSessionGetLogs() has not been implemented!'); } - Future abstractSessionGetAllLogsAsString( - int? sessionId, int? waitTimeout) async { - throw UnimplementedError( - 'abstractSessionGetAllLogsAsString() has not been implemented!'); + Future abstractSessionGetAllLogsAsString(int? sessionId, int? waitTimeout) async { + throw UnimplementedError('abstractSessionGetAllLogsAsString() has not been implemented!'); } Future abstractSessionGetState(int? sessionId) async { - throw UnimplementedError( - 'abstractSessionGetState() has not been implemented!'); + throw UnimplementedError('abstractSessionGetState() has not been implemented!'); } Future abstractSessionGetReturnCode(int? sessionId) async { - throw UnimplementedError( - 'abstractSessionGetReturnCode() has not been implemented!'); + throw UnimplementedError('abstractSessionGetReturnCode() has not been implemented!'); } Future abstractSessionGetFailStackTrace(int? sessionId) async { - throw UnimplementedError( - 'abstractSessionGetFailStackTrace() has not been implemented!'); + throw UnimplementedError('abstractSessionGetFailStackTrace() has not been implemented!'); } - Future abstractSessionThereAreAsynchronousMessagesInTransmit( - int? sessionId) async { + Future abstractSessionThereAreAsynchronousMessagesInTransmit(int? sessionId) async { throw UnimplementedError( - 'abstractSessionThereAreAsynchronousMessagesInTransmit()' - ' has not been implemented!'); + 'abstractSessionThereAreAsynchronousMessagesInTransmit()' + ' has not been implemented!', + ); } // ArchDetect @@ -127,265 +113,213 @@ abstract class FFmpegKitPlatform extends PlatformInterface { } Future ffmpegKitCancelSession(int sessionId) async { - throw UnimplementedError( - 'ffmpegKitCancelSession() has not been implemented!'); + throw UnimplementedError('ffmpegKitCancelSession() has not been implemented!'); } Future?> ffmpegKitListSessions() async { - throw UnimplementedError( - 'ffmpegKitListSessions() has not been implemented!'); + throw UnimplementedError('ffmpegKitListSessions() has not been implemented!'); } // FFmpegKitConfig Future ffmpegKitConfigEnableRedirection() async { - throw UnimplementedError( - 'ffmpegKitConfigEnableRedirection() has not been implemented!'); + throw UnimplementedError('ffmpegKitConfigEnableRedirection() has not been implemented!'); } Future ffmpegKitConfigDisableRedirection() async { - throw UnimplementedError( - 'ffmpegKitConfigDisableRedirection() has not been implemented!'); + throw UnimplementedError('ffmpegKitConfigDisableRedirection() has not been implemented!'); } - Future ffmpegKitConfigSetFontconfigConfigurationPath( - String path) async { - throw UnimplementedError('ffmpegKitConfigSetFontconfigConfigurationPath()' - ' has not been implemented!'); + Future ffmpegKitConfigSetFontconfigConfigurationPath(String path) async { + throw UnimplementedError( + 'ffmpegKitConfigSetFontconfigConfigurationPath()' + ' has not been implemented!', + ); } - Future ffmpegKitConfigSetFontDirectory( - String path, Map? mapping) async { - throw UnimplementedError( - 'ffmpegKitConfigSetFontDirectory() has not been implemented!'); + Future ffmpegKitConfigSetFontDirectory(String path, Map? mapping) async { + throw UnimplementedError('ffmpegKitConfigSetFontDirectory() has not been implemented!'); } - Future ffmpegKitConfigSetFontDirectoryList( - List fontDirectoryList, Map? mapping) async { - throw UnimplementedError( - 'ffmpegKitConfigSetFontDirectoryList() has not been implemented!'); + Future ffmpegKitConfigSetFontDirectoryList(List fontDirectoryList, Map? mapping) async { + throw UnimplementedError('ffmpegKitConfigSetFontDirectoryList() has not been implemented!'); } Future ffmpegKitConfigRegisterNewFFmpegPipe() async { - throw UnimplementedError( - 'ffmpegKitConfigRegisterNewFFmpegPipe() has not been implemented!'); + throw UnimplementedError('ffmpegKitConfigRegisterNewFFmpegPipe() has not been implemented!'); } Future ffmpegKitConfigCloseFFmpegPipe(String ffmpegPipePath) async { - throw UnimplementedError( - 'ffmpegKitConfigCloseFFmpegPipe() has not been implemented!'); + throw UnimplementedError('ffmpegKitConfigCloseFFmpegPipe() has not been implemented!'); } Future ffmpegKitConfigGetFFmpegVersion() async { - throw UnimplementedError( - 'ffmpegKitConfigGetFFmpegVersion() has not been implemented!'); + throw UnimplementedError('ffmpegKitConfigGetFFmpegVersion() has not been implemented!'); } Future ffmpegKitConfigIsLTSBuild() async { - throw UnimplementedError( - 'ffmpegKitConfigIsLTSBuild() has not been implemented!'); + throw UnimplementedError('ffmpegKitConfigIsLTSBuild() has not been implemented!'); } Future ffmpegKitConfigGetBuildDate() async { - throw UnimplementedError( - 'ffmpegKitConfigGetBuildDate() has not been implemented!'); + throw UnimplementedError('ffmpegKitConfigGetBuildDate() has not been implemented!'); } - Future ffmpegKitConfigSetEnvironmentVariable( - String name, String value) async { - throw UnimplementedError( - 'ffmpegKitConfigSetEnvironmentVariable() has not been implemented!'); + Future ffmpegKitConfigSetEnvironmentVariable(String name, String value) async { + throw UnimplementedError('ffmpegKitConfigSetEnvironmentVariable() has not been implemented!'); } Future ffmpegKitConfigIgnoreSignal(int signal) async { - throw UnimplementedError( - 'ffmpegKitConfigIgnoreSignal() has not been implemented!'); + throw UnimplementedError('ffmpegKitConfigIgnoreSignal() has not been implemented!'); } Future ffmpegKitConfigAsyncFFmpegExecute(int? sessionId) async { - throw UnimplementedError( - 'ffmpegKitConfigAsyncFFmpegExecute() has not been implemented!'); + throw UnimplementedError('ffmpegKitConfigAsyncFFmpegExecute() has not been implemented!'); } Future ffmpegKitConfigAsyncFFprobeExecute(int? sessionId) async { - throw UnimplementedError( - 'ffmpegKitConfigAsyncFFprobeExecute() has not been implemented!'); + throw UnimplementedError('ffmpegKitConfigAsyncFFprobeExecute() has not been implemented!'); } - Future ffmpegKitConfigAsyncGetMediaInformationExecute( - int? sessionId, int? waitTimeout) async { - throw UnimplementedError('ffmpegKitConfigAsyncGetMediaInformationExecute()' - ' has not been implemented!'); + Future ffmpegKitConfigAsyncGetMediaInformationExecute(int? sessionId, int? waitTimeout) async { + throw UnimplementedError( + 'ffmpegKitConfigAsyncGetMediaInformationExecute()' + ' has not been implemented!', + ); } Future ffmpegKitConfigFFmpegExecute(int? sessionId) async { - throw UnimplementedError( - 'ffmpegKitConfigFFmpegExecute() has not been implemented!'); + throw UnimplementedError('ffmpegKitConfigFFmpegExecute() has not been implemented!'); } Future ffmpegKitConfigFFprobeExecute(int? sessionId) async { - throw UnimplementedError( - 'ffmpegKitConfigFFprobeExecute() has not been implemented!'); + throw UnimplementedError('ffmpegKitConfigFFprobeExecute() has not been implemented!'); } - Future ffmpegKitConfigGetMediaInformationExecute( - int? sessionId, int? waitTimeout) async { - throw UnimplementedError('ffmpegKitConfigGetMediaInformationExecute()' - ' has not been implemented!'); + Future ffmpegKitConfigGetMediaInformationExecute(int? sessionId, int? waitTimeout) async { + throw UnimplementedError( + 'ffmpegKitConfigGetMediaInformationExecute()' + ' has not been implemented!', + ); } Future ffmpegKitConfigSetLogLevel(int logLevel) async { - throw UnimplementedError( - 'ffmpegKitConfigSetLogLevel() has not been implemented!'); + throw UnimplementedError('ffmpegKitConfigSetLogLevel() has not been implemented!'); } Future ffmpegKitConfigGetSessionHistorySize() async { - throw UnimplementedError( - 'ffmpegKitConfigGetSessionHistorySize() has not been implemented!'); + throw UnimplementedError('ffmpegKitConfigGetSessionHistorySize() has not been implemented!'); } - Future ffmpegKitConfigSetSessionHistorySize( - int sessionHistorySize) async { - throw UnimplementedError( - 'ffmpegKitConfigSetSessionHistorySize() has not been implemented!'); + Future ffmpegKitConfigSetSessionHistorySize(int sessionHistorySize) async { + throw UnimplementedError('ffmpegKitConfigSetSessionHistorySize() has not been implemented!'); } - Future?> ffmpegKitConfigGetSession( - int sessionId) async { - throw UnimplementedError( - 'ffmpegKitConfigGetSession() has not been implemented!'); + Future?> ffmpegKitConfigGetSession(int sessionId) async { + throw UnimplementedError('ffmpegKitConfigGetSession() has not been implemented!'); } Future?> ffmpegKitConfigGetLastSession() async { - throw UnimplementedError( - 'ffmpegKitConfigGetLastSession() has not been implemented!'); + throw UnimplementedError('ffmpegKitConfigGetLastSession() has not been implemented!'); } - Future?> - ffmpegKitConfigGetLastCompletedSession() async { - throw UnimplementedError( - 'ffmpegKitConfigGetLastCompletedSession() has not been implemented!'); + Future?> ffmpegKitConfigGetLastCompletedSession() async { + throw UnimplementedError('ffmpegKitConfigGetLastCompletedSession() has not been implemented!'); } Future?> ffmpegKitConfigGetSessions() async { - throw UnimplementedError( - 'ffmpegKitConfigGetSessions() has not been implemented!'); + throw UnimplementedError('ffmpegKitConfigGetSessions() has not been implemented!'); } Future clearSessions() async { throw UnimplementedError('clearSessions() has not been implemented!'); } - Future?> ffmpegKitConfigGetSessionsByState( - int sessionState) async { - throw UnimplementedError( - 'ffmpegKitConfigGetSessionsByState() has not been implemented!'); + Future?> ffmpegKitConfigGetSessionsByState(int sessionState) async { + throw UnimplementedError('ffmpegKitConfigGetSessionsByState() has not been implemented!'); } Future ffmpegKitConfigMessagesInTransmit(int sessionId) async { - throw UnimplementedError( - 'ffmpegKitConfigMessagesInTransmit() has not been implemented!'); + throw UnimplementedError('ffmpegKitConfigMessagesInTransmit() has not been implemented!'); } Future ffmpegKitConfigEnableLogs() async { - throw UnimplementedError( - 'ffmpegKitConfigEnableLogs() has not been implemented!'); + throw UnimplementedError('ffmpegKitConfigEnableLogs() has not been implemented!'); } Future ffmpegKitConfigDisableLogs() async { - throw UnimplementedError( - 'ffmpegKitConfigDisableLogs() has not been implemented!'); + throw UnimplementedError('ffmpegKitConfigDisableLogs() has not been implemented!'); } Future ffmpegKitConfigEnableStatistics() async { - throw UnimplementedError( - 'ffmpegKitConfigEnableStatistics() has not been implemented!'); + throw UnimplementedError('ffmpegKitConfigEnableStatistics() has not been implemented!'); } Future ffmpegKitConfigDisableStatistics() async { - throw UnimplementedError( - 'ffmpegKitConfigDisableStatistics() has not been implemented!'); + throw UnimplementedError('ffmpegKitConfigDisableStatistics() has not been implemented!'); } Future ffmpegKitConfigGetPlatform() async { - throw UnimplementedError( - 'ffmpegKitConfigGetPlatform() has not been implemented!'); + throw UnimplementedError('ffmpegKitConfigGetPlatform() has not been implemented!'); } - Future ffmpegKitConfigWriteToPipe( - String inputPath, String pipePath) async { - throw UnimplementedError( - 'ffmpegKitConfigWriteToPipe() has not been implemented!'); + Future ffmpegKitConfigWriteToPipe(String inputPath, String pipePath) async { + throw UnimplementedError('ffmpegKitConfigWriteToPipe() has not been implemented!'); } - Future ffmpegKitConfigSelectDocumentForRead( - String? type, List? extraTypes) async { - throw UnimplementedError( - 'ffmpegKitConfigSelectDocumentForRead() has not been implemented!'); + Future ffmpegKitConfigSelectDocumentForRead(String? type, List? extraTypes) async { + throw UnimplementedError('ffmpegKitConfigSelectDocumentForRead() has not been implemented!'); } - Future ffmpegKitConfigSelectDocumentForWrite( - String? title, String? type, List? extraTypes) async { - throw UnimplementedError( - 'ffmpegKitConfigSelectDocumentForWrite() has not been implemented!'); + Future ffmpegKitConfigSelectDocumentForWrite(String? title, String? type, List? extraTypes) async { + throw UnimplementedError('ffmpegKitConfigSelectDocumentForWrite() has not been implemented!'); } - Future ffmpegKitConfigGetSafParameter( - String uriString, String openMode) async { - throw UnimplementedError( - 'ffmpegKitConfigGetSafParameter() has not been implemented!'); + Future ffmpegKitConfigGetSafParameter(String uriString, String openMode) async { + throw UnimplementedError('ffmpegKitConfigGetSafParameter() has not been implemented!'); } // FFmpegKitFlutterInitializer Future ffmpegKitFlutterInitializerGetLogLevel() async { - throw UnimplementedError( - 'ffmpegKitFlutterInitializerGetLogLevel() has not been implemented!'); + throw UnimplementedError('ffmpegKitFlutterInitializerGetLogLevel() has not been implemented!'); } // FFmpegSession - Future?> ffmpegSessionGetAllStatistics( - int? sessionId, int? waitTimeout) async { - throw UnimplementedError( - 'ffmpegSessionGetAllStatistics() has not been implemented!'); + Future?> ffmpegSessionGetAllStatistics(int? sessionId, int? waitTimeout) async { + throw UnimplementedError('ffmpegSessionGetAllStatistics() has not been implemented!'); } Future?> ffmpegSessionGetStatistics(int? sessionId) async { - throw UnimplementedError( - 'ffmpegSessionGetStatistics() has not been implemented!'); + throw UnimplementedError('ffmpegSessionGetStatistics() has not been implemented!'); } // FFprobeKit Future?> ffprobeKitListFFprobeSessions() async { - throw UnimplementedError( - 'ffprobeKitListFFprobeSessions() has not been implemented!'); + throw UnimplementedError('ffprobeKitListFFprobeSessions() has not been implemented!'); } Future?> ffprobeKitListMediaInformationSessions() async { - throw UnimplementedError( - 'ffprobeKitListMediaInformationSessions() has not been implemented!'); + throw UnimplementedError('ffprobeKitListMediaInformationSessions() has not been implemented!'); } // MediaInformationJsonParser - Future?> mediaInformationJsonParserFrom( - String ffprobeJsonOutput) async { - throw UnimplementedError( - 'mediaInformationJsonParserFrom() has not been implemented!'); + Future?> mediaInformationJsonParserFrom(String ffprobeJsonOutput) async { + throw UnimplementedError('mediaInformationJsonParserFrom() has not been implemented!'); } - Future?> mediaInformationJsonParserFromWithError( - String ffprobeJsonOutput) async { - throw UnimplementedError( - 'mediaInformationJsonParserFromWithError() has not been implemented!'); + Future?> mediaInformationJsonParserFromWithError(String ffprobeJsonOutput) async { + throw UnimplementedError('mediaInformationJsonParserFromWithError() has not been implemented!'); } - Future?> mediaInformationSessionGetMediaInformation( - int? sessionId) async { - throw UnimplementedError('mediaInformationSessionGetMediaInformation() ' - 'has not been implemented!'); + Future?> mediaInformationSessionGetMediaInformation(int? sessionId) async { + throw UnimplementedError( + 'mediaInformationSessionGetMediaInformation() ' + 'has not been implemented!', + ); } Future getPackageName() async { @@ -393,7 +327,6 @@ abstract class FFmpegKitPlatform extends PlatformInterface { } Future?> getExternalLibraries() async { - throw UnimplementedError( - 'getExternalLibraries() has not been implemented!'); + throw UnimplementedError('getExternalLibraries() has not been implemented!'); } } diff --git a/flutter/flutter_platform_interface/lib/method_channel_ffmpeg_kit_flutter.dart b/flutter/flutter_platform_interface/lib/method_channel_ffmpeg_kit_flutter.dart index 9de767f..4979728 100644 --- a/flutter/flutter_platform_interface/lib/method_channel_ffmpeg_kit_flutter.dart +++ b/flutter/flutter_platform_interface/lib/method_channel_ffmpeg_kit_flutter.dart @@ -20,13 +20,11 @@ * SOFTWARE. */ +import 'package:ffmpeg_kit_flutter_platform_interface/ffmpeg_kit_flutter_platform_interface.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; -import 'ffmpeg_kit_flutter_platform_interface.dart'; - -const MethodChannel _channel = - const MethodChannel('flutter.arthenica.com/ffmpeg_kit'); +const MethodChannel _channel = MethodChannel('flutter.arthenica.com/ffmpeg_kit'); /// An implementation of [FFmpegKitPlatform] that uses method channels. class MethodChannelFFmpegKit extends FFmpegKitPlatform { @@ -37,76 +35,58 @@ class MethodChannelFFmpegKit extends FFmpegKitPlatform { // AbstractSession @override - Future?> abstractSessionCreateFFmpegSession( - List argumentsArray) async => - _channel.invokeMethod>( - 'ffmpegSession', {'arguments': argumentsArray}); + Future?> abstractSessionCreateFFmpegSession(List argumentsArray) async => + _channel.invokeMethod>('ffmpegSession', {'arguments': argumentsArray}); @override - Future?> abstractSessionCreateFFprobeSession( - List argumentsArray) async => - _channel.invokeMethod>( - 'ffprobeSession', {'arguments': argumentsArray}); + Future?> abstractSessionCreateFFprobeSession(List argumentsArray) async => + _channel.invokeMethod>('ffprobeSession', {'arguments': argumentsArray}); @override - Future?> abstractSessionCreateMediaInformationSession( - List argumentsArray) async => - _channel.invokeMethod>( - 'mediaInformationSession', {'arguments': argumentsArray}); + Future?> abstractSessionCreateMediaInformationSession(List argumentsArray) async => + _channel.invokeMethod>('mediaInformationSession', {'arguments': argumentsArray}); @override - Future abstractSessionGetEndTime(int? sessionId) async => _channel - .invokeMethod('abstractSessionGetEndTime', {'sessionId': sessionId}); + Future abstractSessionGetEndTime(int? sessionId) async => + _channel.invokeMethod('abstractSessionGetEndTime', {'sessionId': sessionId}); @override Future abstractSessionGetDuration(int? sessionId) async => - _channel.invokeMethod( - 'abstractSessionGetDuration', {'sessionId': sessionId}); + _channel.invokeMethod('abstractSessionGetDuration', {'sessionId': sessionId}); @override - Future?> abstractSessionGetAllLogs( - int? sessionId, int? waitTimeout) async => - _channel.invokeMethod>('abstractSessionGetAllLogs', - {'sessionId': sessionId, 'waitTimeout': waitTimeout}); + Future?> abstractSessionGetAllLogs(int? sessionId, int? waitTimeout) async => _channel + .invokeMethod>('abstractSessionGetAllLogs', {'sessionId': sessionId, 'waitTimeout': waitTimeout}); @override Future?> abstractSessionGetLogs(int? sessionId) async => - _channel.invokeMethod>( - 'abstractSessionGetLogs', {'sessionId': sessionId}); + _channel.invokeMethod>('abstractSessionGetLogs', {'sessionId': sessionId}); @override - Future abstractSessionGetAllLogsAsString( - int? sessionId, int? waitTimeout) async => - _channel.invokeMethod('abstractSessionGetAllLogsAsString', - {'sessionId': sessionId, 'waitTimeout': waitTimeout}); + Future abstractSessionGetAllLogsAsString(int? sessionId, int? waitTimeout) async => _channel + .invokeMethod('abstractSessionGetAllLogsAsString', {'sessionId': sessionId, 'waitTimeout': waitTimeout}); @override - Future abstractSessionGetState(int? sessionId) async => _channel - .invokeMethod('abstractSessionGetState', {'sessionId': sessionId}); + Future abstractSessionGetState(int? sessionId) async => + _channel.invokeMethod('abstractSessionGetState', {'sessionId': sessionId}); @override Future abstractSessionGetReturnCode(int? sessionId) async => - _channel.invokeMethod( - 'abstractSessionGetReturnCode', {'sessionId': sessionId}); + _channel.invokeMethod('abstractSessionGetReturnCode', {'sessionId': sessionId}); @override Future abstractSessionGetFailStackTrace(int? sessionId) async => - _channel.invokeMethod( - 'abstractSessionGetFailStackTrace', {'sessionId': sessionId}); + _channel.invokeMethod('abstractSessionGetFailStackTrace', {'sessionId': sessionId}); @override - Future abstractSessionThereAreAsynchronousMessagesInTransmit( - int? sessionId) async => - _channel.invokeMethod( - 'abstractSessionThereAreAsynchronousMessagesInTransmit', - {'sessionId': sessionId}).then((bool? value) => value ?? false); + Future abstractSessionThereAreAsynchronousMessagesInTransmit(int? sessionId) async => _channel + .invokeMethod('abstractSessionThereAreAsynchronousMessagesInTransmit', {'sessionId': sessionId}) + .then((value) => value ?? false); // ArchDetect @override - Future archDetectGetArch() async => _channel - .invokeMethod('getArch') - .then((String? value) => value ?? ""); + Future archDetectGetArch() async => _channel.invokeMethod('getArch').then((value) => value ?? ''); // FFmpegKit @@ -118,36 +98,32 @@ class MethodChannelFFmpegKit extends FFmpegKitPlatform { _channel.invokeMethod('cancelSession', {'sessionId': sessionId}); @override - Future?> ffmpegKitListSessions() async => - _channel.invokeMethod>('getFFmpegSessions'); + Future?> ffmpegKitListSessions() async => _channel.invokeMethod>('getFFmpegSessions'); // FFmpegKitConfig @override - Future ffmpegKitConfigEnableRedirection() async => - _channel.invokeMethod('enableRedirection'); + Future ffmpegKitConfigEnableRedirection() async => _channel.invokeMethod('enableRedirection'); @override - Future ffmpegKitConfigDisableRedirection() async => - _channel.invokeMethod('disableRedirection'); + Future ffmpegKitConfigDisableRedirection() async => _channel.invokeMethod('disableRedirection'); @override - Future ffmpegKitConfigSetFontconfigConfigurationPath( - String path) async => - _channel - .invokeMethod('setFontconfigConfigurationPath', {'path': path}); + Future ffmpegKitConfigSetFontconfigConfigurationPath(String path) async => + _channel.invokeMethod('setFontconfigConfigurationPath', {'path': path}); @override - Future ffmpegKitConfigSetFontDirectory( - String path, Map? mapping) async => - _channel.invokeMethod( - 'setFontDirectory', {'fontDirectory': path, 'fontNameMap': mapping}); + Future ffmpegKitConfigSetFontDirectory(String path, Map? mapping) async => + _channel.invokeMethod('setFontDirectory', {'fontDirectory': path, 'fontNameMap': mapping}); @override Future ffmpegKitConfigSetFontDirectoryList( - List fontDirectoryList, Map? mapping) async => - _channel.invokeMethod('setFontDirectoryList', - {'fontDirectoryList': fontDirectoryList, 'fontNameMap': mapping}); + List fontDirectoryList, + Map? mapping, + ) async => _channel.invokeMethod('setFontDirectoryList', { + 'fontDirectoryList': fontDirectoryList, + 'fontNameMap': mapping, + }); @override Future ffmpegKitConfigRegisterNewFFmpegPipe() async => @@ -155,174 +131,139 @@ class MethodChannelFFmpegKit extends FFmpegKitPlatform { @override Future ffmpegKitConfigCloseFFmpegPipe(String ffmpegPipePath) async => - _channel.invokeMethod( - 'closeFFmpegPipe', {'ffmpegPipePath': ffmpegPipePath}); + _channel.invokeMethod('closeFFmpegPipe', {'ffmpegPipePath': ffmpegPipePath}); @override - Future ffmpegKitConfigGetFFmpegVersion() async => - _channel.invokeMethod('getFFmpegVersion'); + Future ffmpegKitConfigGetFFmpegVersion() async => _channel.invokeMethod('getFFmpegVersion'); @override - Future ffmpegKitConfigIsLTSBuild() async => - _channel.invokeMethod('isLTSBuild'); + Future ffmpegKitConfigIsLTSBuild() async => _channel.invokeMethod('isLTSBuild'); @override - Future ffmpegKitConfigGetBuildDate() async => - _channel.invokeMethod('getBuildDate'); + Future ffmpegKitConfigGetBuildDate() async => _channel.invokeMethod('getBuildDate'); @override - Future ffmpegKitConfigSetEnvironmentVariable( - String name, String value) async => - _channel.invokeMethod('setEnvironmentVariable', - {'variableName': name, 'variableValue': value}); + Future ffmpegKitConfigSetEnvironmentVariable(String name, String value) async => + _channel.invokeMethod('setEnvironmentVariable', {'variableName': name, 'variableValue': value}); @override Future ffmpegKitConfigIgnoreSignal(int signal) async => _channel.invokeMethod('ignoreSignal', {'signal': signal}); @override - Future ffmpegKitConfigFFmpegExecute(int? sessionId) async => _channel - .invokeMethod('ffmpegSessionExecute', {'sessionId': sessionId}); + Future ffmpegKitConfigFFmpegExecute(int? sessionId) async => + _channel.invokeMethod('ffmpegSessionExecute', {'sessionId': sessionId}); @override - Future ffmpegKitConfigFFprobeExecute(int? sessionId) async => _channel - .invokeMethod('ffprobeSessionExecute', {'sessionId': sessionId}); + Future ffmpegKitConfigFFprobeExecute(int? sessionId) async => + _channel.invokeMethod('ffprobeSessionExecute', {'sessionId': sessionId}); @override - Future ffmpegKitConfigGetMediaInformationExecute( - int? sessionId, int? waitTimeout) async => - _channel.invokeMethod('mediaInformationSessionExecute', - {'sessionId': sessionId, 'waitTimeout': waitTimeout}); + Future ffmpegKitConfigGetMediaInformationExecute(int? sessionId, int? waitTimeout) async => _channel + .invokeMethod('mediaInformationSessionExecute', {'sessionId': sessionId, 'waitTimeout': waitTimeout}); @override Future ffmpegKitConfigAsyncFFmpegExecute(int? sessionId) async => - _channel.invokeMethod( - 'asyncFFmpegSessionExecute', {'sessionId': sessionId}); + _channel.invokeMethod('asyncFFmpegSessionExecute', {'sessionId': sessionId}); @override Future ffmpegKitConfigAsyncFFprobeExecute(int? sessionId) async => - _channel.invokeMethod( - 'asyncFFprobeSessionExecute', {'sessionId': sessionId}); + _channel.invokeMethod('asyncFFprobeSessionExecute', {'sessionId': sessionId}); @override - Future ffmpegKitConfigAsyncGetMediaInformationExecute( - int? sessionId, int? waitTimeout) async => - _channel.invokeMethod('asyncMediaInformationSessionExecute', - {'sessionId': sessionId, 'waitTimeout': waitTimeout}); + Future ffmpegKitConfigAsyncGetMediaInformationExecute(int? sessionId, int? waitTimeout) async => _channel + .invokeMethod('asyncMediaInformationSessionExecute', {'sessionId': sessionId, 'waitTimeout': waitTimeout}); @override Future ffmpegKitConfigSetLogLevel(int logLevel) async => _channel.invokeMethod('setLogLevel', {'level': logLevel}); @override - Future ffmpegKitConfigGetSessionHistorySize() async => - _channel.invokeMethod('getSessionHistorySize'); + Future ffmpegKitConfigGetSessionHistorySize() async => _channel.invokeMethod('getSessionHistorySize'); @override - Future ffmpegKitConfigSetSessionHistorySize( - int sessionHistorySize) async => - _channel.invokeMethod( - 'setSessionHistorySize', {'sessionHistorySize': sessionHistorySize}); + Future ffmpegKitConfigSetSessionHistorySize(int sessionHistorySize) async => + _channel.invokeMethod('setSessionHistorySize', {'sessionHistorySize': sessionHistorySize}); @override - Future?> ffmpegKitConfigGetSession( - int sessionId) async => - _channel.invokeMethod>( - 'getSession', {'sessionId': sessionId}); + Future?> ffmpegKitConfigGetSession(int sessionId) async => + _channel.invokeMethod>('getSession', {'sessionId': sessionId}); @override Future?> ffmpegKitConfigGetLastSession() async => _channel.invokeMethod>('getLastSession'); @override - Future?> - ffmpegKitConfigGetLastCompletedSession() async => _channel - .invokeMethod>('getLastCompletedSession'); + Future?> ffmpegKitConfigGetLastCompletedSession() async => + _channel.invokeMethod>('getLastCompletedSession'); @override - Future?> ffmpegKitConfigGetSessions() async => - _channel.invokeMethod>('getSessions'); + Future?> ffmpegKitConfigGetSessions() async => _channel.invokeMethod>('getSessions'); @override - Future clearSessions() async => - _channel.invokeMethod('clearSessions'); + Future clearSessions() async => _channel.invokeMethod('clearSessions'); @override - Future?> ffmpegKitConfigGetSessionsByState( - int sessionState) async => - _channel.invokeMethod>( - 'getSessionsByState', {'state': sessionState}); + Future?> ffmpegKitConfigGetSessionsByState(int sessionState) async => + _channel.invokeMethod>('getSessionsByState', {'state': sessionState}); @override Future ffmpegKitConfigMessagesInTransmit(int sessionId) async => - _channel - .invokeMethod('messagesInTransmit', {'sessionId': sessionId}); + _channel.invokeMethod('messagesInTransmit', {'sessionId': sessionId}); @override - Future ffmpegKitConfigEnableLogs() async => - _channel.invokeMethod('enableLogs'); + Future ffmpegKitConfigEnableLogs() async => _channel.invokeMethod('enableLogs'); @override - Future ffmpegKitConfigDisableLogs() async => - _channel.invokeMethod('disableLogs'); + Future ffmpegKitConfigDisableLogs() async => _channel.invokeMethod('disableLogs'); @override - Future ffmpegKitConfigEnableStatistics() async => - _channel.invokeMethod('enableStatistics'); + Future ffmpegKitConfigEnableStatistics() async => _channel.invokeMethod('enableStatistics'); @override - Future ffmpegKitConfigDisableStatistics() async => - _channel.invokeMethod('disableStatistics'); + Future ffmpegKitConfigDisableStatistics() async => _channel.invokeMethod('disableStatistics'); @override - Future ffmpegKitConfigGetPlatform() async => - _channel.invokeMethod('getPlatform'); + Future ffmpegKitConfigGetPlatform() async => _channel.invokeMethod('getPlatform'); @override - Future ffmpegKitConfigWriteToPipe( - String inputPath, String pipePath) async => - _channel.invokeMethod( - 'writeToPipe', {'input': inputPath, 'pipe': pipePath}); + Future ffmpegKitConfigWriteToPipe(String inputPath, String pipePath) async => + _channel.invokeMethod('writeToPipe', {'input': inputPath, 'pipe': pipePath}); @override - Future ffmpegKitConfigSelectDocumentForRead( - String? type, List? extraTypes) async => - _channel.invokeMethod('selectDocument', - {'writable': false, 'type': type, 'extraTypes': extraTypes}); + Future ffmpegKitConfigSelectDocumentForRead(String? type, List? extraTypes) async => + _channel.invokeMethod('selectDocument', {'writable': false, 'type': type, 'extraTypes': extraTypes}); @override - Future ffmpegKitConfigSelectDocumentForWrite( - String? title, String? type, List? extraTypes) async => + Future ffmpegKitConfigSelectDocumentForWrite(String? title, String? type, List? extraTypes) async => _channel.invokeMethod('selectDocument', { 'writable': true, 'title': title, 'type': type, - 'extraTypes': extraTypes + 'extraTypes': extraTypes, }); @override - Future ffmpegKitConfigGetSafParameter( - String uriString, String openMode) async => - _channel.invokeMethod( - 'getSafParameter', {'uri': uriString, 'openMode': openMode}); + Future ffmpegKitConfigGetSafParameter(String uriString, String openMode) async => + _channel.invokeMethod('getSafParameter', {'uri': uriString, 'openMode': openMode}); // FFmpegKitFlutterInitializer - Future ffmpegKitFlutterInitializerGetLogLevel() async => - _channel.invokeMethod('getLogLevel'); + @override + Future ffmpegKitFlutterInitializerGetLogLevel() async => _channel.invokeMethod('getLogLevel'); // FFmpegSession @override - Future?> ffmpegSessionGetAllStatistics( - int? sessionId, int? waitTimeout) async => - _channel.invokeMethod>('ffmpegSessionGetAllStatistics', - {'sessionId': sessionId, 'waitTimeout': waitTimeout}); + Future?> ffmpegSessionGetAllStatistics(int? sessionId, int? waitTimeout) async => + _channel.invokeMethod>('ffmpegSessionGetAllStatistics', { + 'sessionId': sessionId, + 'waitTimeout': waitTimeout, + }); @override Future?> ffmpegSessionGetStatistics(int? sessionId) async => - _channel.invokeMethod>( - 'ffmpegSessionGetStatistics', {'sessionId': sessionId}); + _channel.invokeMethod>('ffmpegSessionGetStatistics', {'sessionId': sessionId}); // FFprobeKit @@ -337,32 +278,24 @@ class MethodChannelFFmpegKit extends FFmpegKitPlatform { // MediaInformationJsonParser @override - Future?> mediaInformationJsonParserFrom( - String ffprobeJsonOutput) async => - _channel.invokeMethod>( - 'mediaInformationJsonParserFrom', - {'ffprobeJsonOutput': ffprobeJsonOutput}); + Future?> mediaInformationJsonParserFrom(String ffprobeJsonOutput) async => _channel + .invokeMethod>('mediaInformationJsonParserFrom', {'ffprobeJsonOutput': ffprobeJsonOutput}); @override - Future?> mediaInformationJsonParserFromWithError( - String ffprobeJsonOutput) async => - _channel.invokeMethod>( - 'mediaInformationJsonParserFromWithError', - {'ffprobeJsonOutput': ffprobeJsonOutput}); + Future?> mediaInformationJsonParserFromWithError(String ffprobeJsonOutput) async => + _channel.invokeMethod>('mediaInformationJsonParserFromWithError', { + 'ffprobeJsonOutput': ffprobeJsonOutput, + }); // MediaInformationSession @override - Future?> mediaInformationSessionGetMediaInformation( - int? sessionId) async => - _channel.invokeMethod>( - 'getMediaInformation', {'sessionId': sessionId}); + Future?> mediaInformationSessionGetMediaInformation(int? sessionId) async => + _channel.invokeMethod>('getMediaInformation', {'sessionId': sessionId}); @override - Future getPackageName() async => - _channel.invokeMethod('getPackageName'); + Future getPackageName() async => _channel.invokeMethod('getPackageName'); @override - Future?> getExternalLibraries() async => - _channel.invokeMethod>('getExternalLibraries'); + Future?> getExternalLibraries() async => _channel.invokeMethod>('getExternalLibraries'); } diff --git a/flutter/flutter_platform_interface/pubspec.yaml b/flutter/flutter_platform_interface/pubspec.yaml index dde6b42..4afde9a 100644 --- a/flutter/flutter_platform_interface/pubspec.yaml +++ b/flutter/flutter_platform_interface/pubspec.yaml @@ -8,14 +8,13 @@ homepage: https://github.com/arthenica/ffmpeg-kit version: 0.2.1 environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=2.0.0" + sdk: ">=3.7.0 <4.0.0" + flutter: ">=3.29.0" dependencies: flutter: sdk: flutter - plugin_platform_interface: ^2.0.2 + plugin_platform_interface: ^2.1.8 dev_dependencies: - flutter_test: - sdk: flutter + carapacik_lints: ^1.11.1