Skip to content
This repository has been archived by the owner on Oct 14, 2021. It is now read-only.

merge v0.4.0 to master #279

Merged
merged 12 commits into from
Mar 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ build/
/pubspec.lock
/.packages
/.gradle/

.settings/
.project
.classpath

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.4.0
- Migrated to nullsafety
- Fixes issue #246 and #266
- Adds closeFFmpegPipe method to close pipes
- Updated example application

## 0.3.1
- Adds mavenCentral() repository for Android
- Minor updates in the test application
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
* <h3>Flutter FFmpeg Plugin</h3>
Expand Down Expand Up @@ -90,15 +89,17 @@ 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;

/**
* Registers plugin to registry.
*
* @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");
Expand All @@ -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();
Expand Down Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
7 changes: 0 additions & 7 deletions example/android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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 <methods>;
void log(int, byte[]);
void statistics(int, float, float, long , int, double, double);
}
25 changes: 16 additions & 9 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,35 @@
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="flutter_ffmpeg_example"
android:icon="@mipmap/ic_launcher"
tools:replace="android:label">
android:icon="@mipmap/ic_launcher">

<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
defined in @style/LaunchTheme). -->
<!-- Specify that the launch screen should continue being displayed -->
<!-- until Flutter renders its first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background" />

<!-- Theme to apply as soon as Flutter begins rendering frames -->
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>

<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
package com.arthenica.flutter.ffmpeg.flutterffmpegexample;

import android.os.Bundle;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;
import io.flutter.embedding.android.FlutterActivity;

public class MainActivity extends FlutterActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GeneratedPluginRegistrant.registerWith(this);
}

}
5 changes: 5 additions & 0 deletions example/android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@@android:color/white</item>
</style>
</resources>
3 changes: 1 addition & 2 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
org.gradle.jvmargs=-Xmx1536M
android.enableJetifier=true
android.useAndroidX=true
android.enableR8=true
android.useAndroidX=true
14 changes: 7 additions & 7 deletions example/lib/audio_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ import 'package:flutter_ffmpeg_example/video_util.dart';
import 'util.dart';

class AudioTab {
RefreshablePlayerDialogFactory _refreshablePlayerDialogFactory;
String _selectedCodec;
String _outputText;
late RefreshablePlayerDialogFactory _refreshablePlayerDialogFactory;
late String _selectedCodec;
String _outputText = "";

void init(RefreshablePlayerDialogFactory refreshablePlayerDialogFactory) {
_refreshablePlayerDialogFactory = refreshablePlayerDialogFactory;
List<DropdownMenuItem<String>> videoCodecList = getAudioCodecList();
_selectedCodec = videoCodecList[0].value;
_selectedCodec = videoCodecList[0].value!;
clearLog();
}

Expand All @@ -65,8 +65,8 @@ class AudioTab {
_outputText = "";
}

void changedAudioCodec(String selectedCodec) {
_selectedCodec = selectedCodec;
void changedAudioCodec(String? selectedCodec) {
_selectedCodec = selectedCodec!;
_refreshablePlayerDialogFactory.refresh();
}

Expand Down Expand Up @@ -222,7 +222,7 @@ class AudioTab {
}

List<DropdownMenuItem<String>> getAudioCodecList() {
List<DropdownMenuItem<String>> list = new List();
List<DropdownMenuItem<String>> list = List.empty(growable: true);

list.add(new DropdownMenuItem(
value: "mp2 (twolame)",
Expand Down
6 changes: 3 additions & 3 deletions example/lib/command_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import 'flutter_ffmpeg_api_wrapper.dart';
import 'util.dart';

class CommandTab {
Refreshable _refreshable;
TextEditingController _commandText;
String _outputText;
late Refreshable _refreshable;
late TextEditingController _commandText;
String _outputText = "";

void init(Refreshable refreshable) {
_refreshable = refreshable;
Expand Down
10 changes: 5 additions & 5 deletions example/lib/concurrent_execution_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ import 'package:flutter_ffmpeg_example/video_util.dart';
import 'util.dart';

class ConcurrentExecutionTab {
Refreshable _refreshable;
String _outputText;
int _executionId1;
int _executionId2;
int _executionId3;
late Refreshable _refreshable;
String _outputText = "";
late int _executionId1;
late int _executionId2;
late int _executionId3;

void init(Refreshable refreshable) {
_refreshable = refreshable;
Expand Down
10 changes: 7 additions & 3 deletions example/lib/flutter_ffmpeg_api_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ final FlutterFFmpegConfig _flutterFFmpegConfig = new FlutterFFmpegConfig();
final FlutterFFmpeg _flutterFFmpeg = new FlutterFFmpeg();
final FlutterFFprobe _flutterFFprobe = new FlutterFFprobe();

void enableLogCallback(LogCallback callback) {
void enableLogCallback(LogCallback? callback) {
_flutterFFmpegConfig.enableLogCallback(callback);
}

void enableStatisticsCallback(StatisticsCallback callback) {
void enableStatisticsCallback(StatisticsCallback? callback) {
_flutterFFmpegConfig.enableStatisticsCallback(callback);
}

Expand Down Expand Up @@ -143,6 +143,10 @@ Future<String> registerNewFFmpegPipe() async {
return await _flutterFFmpegConfig.registerNewFFmpegPipe();
}

Future<void> closeFFmpegPipe(String ffmpegPipePath) async {
return await _flutterFFmpegConfig.closeFFmpegPipe(ffmpegPipePath);
}

Future<void> setEnvironmentVariable(
String variableName, String variableValue) async {
return await _flutterFFmpegConfig.setEnvironmentVariable(
Expand All @@ -153,6 +157,6 @@ Future<List<FFmpegExecution>> listFFmpegExecutions() async {
return await _flutterFFmpeg.listExecutions();
}

List<String> parseArguments(command) {
List<String>? parseArguments(command) {
return FlutterFFmpeg.parseArguments(command);
}
Loading