From da1bb4cf92261202f86e3de6c62bf3eb6f9e3031 Mon Sep 17 00:00:00 2001 From: Taner Sener Date: Sat, 13 Mar 2021 19:30:50 +0000 Subject: [PATCH] release v0.4.0 --- .gitignore | 3 ++- CHANGELOG.md | 11 ++++------- README.md | 4 ++-- android/build.gradle | 2 +- .../flutter/ffmpeg/FlutterFFmpegPlugin.java | 15 +++++++++++---- example/android/app/build.gradle | 2 +- example/android/app/proguard-rules.pro | 7 ------- example/android/app/src/main/AndroidManifest.xml | 3 +-- example/android/build.gradle | 2 +- example/android/gradle.properties | 3 +-- example/lib/flutter_ffmpeg_api_wrapper.dart | 4 ++++ example/lib/pipe_tab.dart | 2 +- example/lib/video_util.dart | 5 ++++- example/pubspec.lock | 4 ++-- example/pubspec.yaml | 6 +++--- ios/Classes/FlutterFFmpegPlugin.m | 5 +++++ ios/flutter_ffmpeg.podspec | 2 +- lib/flutter_ffmpeg.dart | 11 +++++++++++ pubspec.yaml | 3 ++- 19 files changed, 57 insertions(+), 37 deletions(-) diff --git a/.gitignore b/.gitignore index 779ac66..85688a3 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ build/ .settings/ .project -.classpath \ No newline at end of file +.classpath + diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bb25d0..7db2603 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,8 @@ -## 0.4.0-nullsafety.0 +## 0.4.0 - Migrated to nullsafety -- Updated example application, changed example to use full-gpl ffmpeg package (video stabilization not present in full package) -- Fixes issue #266 and possibly #246 - -### Known issues -- Burn subtitles in example not working properly (stuck at Burning subtitles) - +- Fixes issue #246 and #266 +- Adds closeFFmpegPipe method to close pipes +- Updated example application ## 0.3.1 - Adds mavenCentral() repository for Android diff --git a/README.md b/README.md index 65e11a0..2b9320d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # flutter_ffmpeg -![GitHub release](https://img.shields.io/badge/release-v0.3.1-blue.svg) +![GitHub release](https://img.shields.io/badge/release-v0.4.0-blue.svg) ![](https://img.shields.io/pub/v/flutter_ffmpeg.svg) FFmpeg plugin for Flutter. Supports iOS and Android. @@ -35,7 +35,7 @@ FFmpeg plugin for Flutter. Supports iOS and Android. Add `flutter_ffmpeg` as a dependency in your `pubspec.yaml file`. ``` dependencies: - flutter_ffmpeg: ^0.3.1 + flutter_ffmpeg: ^0.4.0 ``` #### 2.1 Packages diff --git a/android/build.gradle b/android/build.gradle index f22bce8..fac486a 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -11,7 +11,7 @@ String safeExtGet(String prop, String fallback) { } group 'com.arthenica.flutter.ffmpeg' -version '0.3.1' +version '0.4.0' buildscript { repositories { diff --git a/android/src/main/java/com/arthenica/flutter/ffmpeg/FlutterFFmpegPlugin.java b/android/src/main/java/com/arthenica/flutter/ffmpeg/FlutterFFmpegPlugin.java index bde8412..96b24bb 100644 --- a/android/src/main/java/com/arthenica/flutter/ffmpeg/FlutterFFmpegPlugin.java +++ b/android/src/main/java/com/arthenica/flutter/ffmpeg/FlutterFFmpegPlugin.java @@ -48,7 +48,6 @@ import io.flutter.plugin.common.MethodChannel; import io.flutter.plugin.common.MethodChannel.MethodCallHandler; import io.flutter.plugin.common.MethodChannel.Result; -import io.flutter.plugin.common.PluginRegistry.Registrar; /** *

Flutter FFmpeg Plugin

@@ -90,7 +89,8 @@ public class FlutterFFmpegPlugin implements MethodCallHandler, EventChannel.Stre public static final String EVENT_EXECUTE = "FlutterFFmpegExecuteCallback"; private EventChannel.EventSink eventSink; - private final Registrar registrar; + @SuppressWarnings("deprecation") + private final io.flutter.plugin.common.PluginRegistry.Registrar registrar; private final FlutterFFmpegResultHandler flutterFFmpegResultHandler; /** @@ -98,7 +98,8 @@ public class FlutterFFmpegPlugin implements MethodCallHandler, EventChannel.Stre * * @param registrar receiver of plugin registration */ - public static void registerWith(final Registrar registrar) { + @SuppressWarnings("deprecation") + public static void registerWith(final io.flutter.plugin.common.PluginRegistry.Registrar registrar) { FlutterFFmpegPlugin flutterFFmpegPlugin = new FlutterFFmpegPlugin(registrar); final MethodChannel channel = new MethodChannel(registrar.messenger(), "flutter_ffmpeg"); @@ -108,7 +109,8 @@ public static void registerWith(final Registrar registrar) { eventChannel.setStreamHandler(flutterFFmpegPlugin); } - private FlutterFFmpegPlugin(Registrar registrar) { + @SuppressWarnings("deprecation") + private FlutterFFmpegPlugin(io.flutter.plugin.common.PluginRegistry.Registrar registrar) { this.registrar = registrar; this.flutterFFmpegResultHandler = new FlutterFFmpegResultHandler(); @@ -286,6 +288,11 @@ public void apply(final Statistics statistics) { final String pipe = Config.registerNewFFmpegPipe(getActiveContext()); flutterFFmpegResultHandler.success(result, toStringMap(KEY_PIPE, pipe)); + } else if (call.method.equals("closeFFmpegPipe")) { + String ffmpegPipePath = call.argument("ffmpegPipePath"); + + Config.closeFFmpegPipe(ffmpegPipePath); + } else if (call.method.equals("setEnvironmentVariable")) { String variableName = call.argument("variableName"); String variableValue = call.argument("variableValue"); diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index ecf779f..0b72b0e 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -26,7 +26,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { compileSdkVersion 29 - ndkVersion "21.3.6528147" + ndkVersion "21.4.7075529" lintOptions { disable 'InvalidPackage' diff --git a/example/android/app/proguard-rules.pro b/example/android/app/proguard-rules.pro index 362897b..5aa1c22 100644 --- a/example/android/app/proguard-rules.pro +++ b/example/android/app/proguard-rules.pro @@ -16,10 +16,3 @@ -keep class io.flutter.view.** { *; } -keep class io.flutter.** { *; } -keep class io.flutter.plugins.** { *; } - -# Flutter FFmpeg --keep class com.arthenica.mobileffmpeg.Config { - native ; - void log(int, byte[]); - void statistics(int, float, float, long , int, double, double); -} diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 71d9bed..eafd293 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -15,8 +15,7 @@ FlutterApplication and put your custom class here. --> + android:icon="@mipmap/ic_launcher"> registerNewFFmpegPipe() async { return await _flutterFFmpegConfig.registerNewFFmpegPipe(); } +Future closeFFmpegPipe(String ffmpegPipePath) async { + return await _flutterFFmpegConfig.closeFFmpegPipe(ffmpegPipePath); +} + Future setEnvironmentVariable( String variableName, String variableValue) async { return await _flutterFFmpegConfig.setEnvironmentVariable( diff --git a/example/lib/pipe_tab.dart b/example/lib/pipe_tab.dart index 19c5cc5..64b6966 100644 --- a/example/lib/pipe_tab.dart +++ b/example/lib/pipe_tab.dart @@ -60,7 +60,7 @@ class PipeTab implements PlayerTab { } void asyncAssetWriteToPipe(String assetName, String pipePath) { - VideoUtil.assetToPipe(assetName, pipePath); + VideoUtil.writeAssetToPipeAndClose(assetName, pipePath); } void createVideo() { diff --git a/example/lib/video_util.dart b/example/lib/video_util.dart index 3fef5bd..d60431e 100644 --- a/example/lib/video_util.dart +++ b/example/lib/video_util.dart @@ -74,7 +74,8 @@ class VideoUtil { return fileFuture; } - static void assetToPipe(String assetName, String pipePath) async { + static void writeAssetToPipeAndClose( + String assetName, String pipePath) async { final ByteData byteData = await rootBundle.load('assets/$assetName'); var pipeFile = new File(pipePath); @@ -85,6 +86,8 @@ class VideoUtil { flush: false); ffprint('assets/$assetName saved to pipe at $pipePath.'); + + closeFFmpegPipe(pipePath); } static Future assetPath(String assetName) async { diff --git a/example/pubspec.lock b/example/pubspec.lock index e344b87..322b999 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -82,7 +82,7 @@ packages: path: ".." relative: true source: path - version: "0.4.0-nullsafety.0" + version: "0.4.0" flutter_test: dependency: "direct dev" description: flutter @@ -251,7 +251,7 @@ packages: name: video_player url: "https://pub.dartlang.org" source: hosted - version: "2.0.1" + version: "2.0.2" video_player_platform_interface: dependency: transitive description: diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 260375f..4795df7 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_ffmpeg_example description: Demonstrates how to use the flutter_ffmpeg plugin. -version: 0.3.1 +version: 0.4.0 publish_to: 'none' environment: @@ -11,9 +11,9 @@ dependencies: sdk: flutter cupertino_icons: ^1.0.2 path_provider: ^2.0.1 - path: ^1.7.0 + path: ^1.8.0 fluttertoast: ^8.0.1-nullsafety.0 - video_player: ^2.0.1 + video_player: ^2.0.2 flutter_ffmpeg: path: ../ diff --git a/ios/Classes/FlutterFFmpegPlugin.m b/ios/Classes/FlutterFFmpegPlugin.m index 4c13fe7..ee83c48 100644 --- a/ios/Classes/FlutterFFmpegPlugin.m +++ b/ios/Classes/FlutterFFmpegPlugin.m @@ -226,6 +226,11 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { NSString *pipe = [MobileFFmpegConfig registerNewFFmpegPipe]; result([FlutterFFmpegPlugin toStringDictionary:KEY_PIPE :pipe]); + } else if ([@"closeFFmpegPipe" isEqualToString:call.method]) { + + NSString* ffmpegPipePath = call.arguments[@"ffmpegPipePath"]; + [MobileFFmpegConfig closeFFmpegPipe:ffmpegPipePath]; + } else if ([@"setEnvironmentVariable" isEqualToString:call.method]) { NSString* variableName = call.arguments[@"variableName"]; diff --git a/ios/flutter_ffmpeg.podspec b/ios/flutter_ffmpeg.podspec index e710eb3..21e57b1 100644 --- a/ios/flutter_ffmpeg.podspec +++ b/ios/flutter_ffmpeg.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'flutter_ffmpeg' - s.version = '0.3.1' + s.version = '0.4.0' s.summary = 'FFmpeg plugin for Flutter.' s.description = 'FFmpeg plugin based on mobile-ffmpeg for Flutter.' s.homepage = 'https://github.com/tanersener/flutter-ffmpeg' diff --git a/lib/flutter_ffmpeg.dart b/lib/flutter_ffmpeg.dart index d93caa4..ecb0a82 100644 --- a/lib/flutter_ffmpeg.dart +++ b/lib/flutter_ffmpeg.dart @@ -401,6 +401,17 @@ class FlutterFFmpegConfig { } } + /// Closes a previously created FFmpeg pipe. + Future closeFFmpegPipe(String ffmpegPipePath) async { + try { + await _methodChannel + .invokeMethod('closeFFmpegPipe', {'ffmpegPipePath': ffmpegPipePath}); + } on PlatformException catch (e, stack) { + print("Plugin closeFFmpegPipe error: ${e.message}"); + return Future.error("closeFFmpegPipe failed.", stack); + } + } + /// Sets an environment variable. Future setEnvironmentVariable( String variableName, String variableValue) async { diff --git a/pubspec.yaml b/pubspec.yaml index 79a96e0..ded967e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,10 +1,11 @@ name: flutter_ffmpeg description: Flutter plugin to run FFmpeg on mobile platforms. Supports iOS and Android. -version: 0.4.0-nullsafety.0 +version: 0.4.0 homepage: https://github.com/tanersener/flutter-ffmpeg environment: sdk: '>=2.12.0 <3.0.0' + flutter: ">=1.10.0" dependencies: flutter: