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

Commit

Permalink
freeze v0.2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
tanersener committed Oct 28, 2019
1 parent 2c845ae commit 8d83d73
Show file tree
Hide file tree
Showing 21 changed files with 233 additions and 111 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
patreon: tanersener
custom: ['https://buymeacoff.ee/tanersener','https://paypal.me/teodosiy']
custom: ['https://buymeacoff.ee/tanersener','https://paypal.me/teodosiyminchev']
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/issue-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ What happened.
If applicable, add screenshots to help explain your problem.

**Logs**
Post logs here or paste them to [Ghostbin](https://ghostbin.com) and insert the link here.
Post logs here or paste them to [Ghostbin](https://ghostbin.co) and insert the link here.

**Environment**
Flutter doctor output
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.2.8
- Uses ffmpeg v4.3
- Implements registerNewFFmpegPipe API method

## 0.2.7
- Uses new package selection mechanism
- Fixes issue #52
Expand Down
32 changes: 21 additions & 11 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.2.7-blue.svg)
![GitHub release](https://img.shields.io/badge/release-v0.2.8-blue.svg)
![](https://img.shields.io/pub/v/flutter_ffmpeg.svg)

FFmpeg plugin for Flutter. Supports iOS and Android.
Expand All @@ -11,7 +11,7 @@ FFmpeg plugin for Flutter. Supports iOS and Android.
- Based on MobileFFmpeg
- Supports
- Both Android (API Level 16+) and iOS (SDK 9.3+)
- FFmpeg `v4.2-dev-x` (master) releases
- FFmpeg `v4.2-dev-x` and `v4.3-dev-x` (master) releases
- `arm-v7a`, `arm-v7a-neon`, `arm64-v8a`, `x86` and `x86_64` architectures on Android
- `armv7`, `armv7s`, `arm64`, `arm64e`, `i386` and `x86_64` architectures on iOS
- 24 external libraries
Expand Down Expand Up @@ -70,7 +70,7 @@ FFmpeg plugin for Flutter. Supports iOS and Android.
Add `flutter_ffmpeg` as a dependency in your `pubspec.yaml file`.
```
dependencies:
flutter_ffmpeg: ^0.2.7
flutter_ffmpeg: ^0.2.8
```

#### 2.1 Packages
Expand All @@ -94,16 +94,20 @@ Installation of `FlutterFFmpeg` using `pub` enables the default package, which i
Do not forget to specify package name in `<package name>` section.

```
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.map { |p|
symlink = File.join('.symlinks', 'plugins', p[:name])
File.symlink(p[:path], symlink)
if p[:name] == 'flutter_ffmpeg'
pod p[:name]+'/<package name>', :path => File.join(symlink, 'ios')
else
pod p[:name], :path => File.join(symlink, 'ios')
plugin_pods.each do |name, path|
symlink = File.join('.symlinks', 'plugins', name)
File.symlink(path, symlink)
if name == 'flutter_ffmpeg'
pod name+'/<package name>', :path => File.join(symlink, 'ios')
else
pod name, :path => File.join(symlink, 'ios')
end
end
}
```

##### 2.1.3 Package Names
Expand Down Expand Up @@ -335,6 +339,12 @@ In order to install the `LTS` variant, install the `https-lts` package using ins
packageList.forEach((value) => print("External library: $value"));
});
```
15. Create new `FFmpeg` pipe.
```
_flutterFFmpeg.registerNewFFmpegPipe().then((path) {
then((stats) => print("New ffmpeg pipe at $path"));
});
```

### 4. Tips

Expand Down
4 changes: 2 additions & 2 deletions 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.2.7'
version '0.2.8'

buildscript {
repositories {
Expand Down Expand Up @@ -45,5 +45,5 @@ android {
}

dependencies {
implementation 'com.arthenica:mobile-ffmpeg-' + safePackageName(safeExtGet('flutterFFmpegPackage', 'https')) + ':' + safePackageVersion(safeExtGet('flutterFFmpegPackage', 'https'), '4.2.2', '4.2.2')
implementation 'com.arthenica:mobile-ffmpeg-' + safePackageName(safeExtGet('flutterFFmpegPackage', 'https')) + ':' + safePackageVersion(safeExtGet('flutterFFmpegPackage', 'https'), '4.3', '4.2.2')
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected Integer doInBackground(final String... strings) {

Log.d(FlutterFFmpegPlugin.LIBRARY_NAME, String.format("Running FFmpeg command: %s with delimiter %s.", command, delimiter));

rc = FFmpeg.execute(command, delimiter);
rc = FFmpeg.execute(command);

Log.d(FlutterFFmpegPlugin.LIBRARY_NAME, String.format("FFmpeg exited with rc: %d", rc));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public class FlutterFFmpegPlugin implements MethodCallHandler, EventChannel.Stre
public static final String KEY_PLATFORM = "platform";
public static final String KEY_PACKAGE_NAME = "packageName";
public static final String KEY_LAST_RC = "lastRc";
public static final String KEY_PIPE = "pipe";

public static final String KEY_LAST_COMMAND_OUTPUT = "lastCommandOutput";
public static final String KEY_LOG_TEXT = "log";
Expand Down Expand Up @@ -241,6 +242,11 @@ public void apply(final Statistics statistics) {
final FlutterFFmpegGetMediaInformationAsyncTask asyncTask = new FlutterFFmpegGetMediaInformationAsyncTask(flutterFFmpegResultHandler, timeout, result);
asyncTask.execute(path);

} else if (call.method.equals("registerNewFFmpegPipe")) {

final String pipe = Config.registerNewFFmpegPipe(getActiveContext());
flutterFFmpegResultHandler.success(result, toStringMap(KEY_PIPE, pipe));

} else {
flutterFFmpegResultHandler.notImplemented(result);
}
Expand Down
6 changes: 6 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
.pub-cache/
.pub/
build/
flutter_*.png
linked_*.ds
unlinked.ds
unlinked_spec.ds

# Android related
**/android/**/gradle-wrapper.jar
Expand Down Expand Up @@ -55,10 +59,12 @@ build/
**/ios/.generated/
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.podspec
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/Flutter/flutter_export_environment.sh
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*

Expand Down
9 changes: 8 additions & 1 deletion example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,11 @@ Demonstrates how to use the flutter_ffmpeg plugin.
_flutterFFmpeg.getExternalLibraries().then((packageList) {
packageList.forEach((value) => print("External library: $value"));
});
```
```
15. Create new `FFmpeg` pipe.
```
_flutterFFmpeg.registerNewFFmpegPipe().then((path) {
then((stats) => print("New ffmpeg pipe at $path"));
});
```

3 changes: 2 additions & 1 deletion example/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
org.gradle.jvmargs=-Xmx1536M
android.enableJetifier=true
android.useAndroidX=true
android.useAndroidX=true
android.enableR8=true
91 changes: 55 additions & 36 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,58 +15,77 @@ def parse_KV_file(file, separator='=')
if !File.exists? file_abs_path
return [];
end
pods_ary = []
generated_key_values = {}
skip_line_start_symbols = ["#", "/"]
File.foreach(file_abs_path) { |line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
plugin = line.split(pattern=separator)
if plugin.length == 2
podname = plugin[0].strip()
path = plugin[1].strip()
podpath = File.expand_path("#{path}", file_abs_path)
pods_ary.push({:name => podname, :path => podpath});
else
puts "Invalid plugin specification: #{line}"
end
}
return pods_ary
File.foreach(file_abs_path) do |line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
plugin = line.split(pattern=separator)
if plugin.length == 2
podname = plugin[0].strip()
path = plugin[1].strip()
podpath = File.expand_path("#{path}", file_abs_path)
generated_key_values[podname] = podpath
else
puts "Invalid plugin specification: #{line}"
end
end
generated_key_values
end

target 'Runner' do
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
# Flutter Pod

# Flutter Pods
generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
if generated_xcode_build_settings.empty?
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
end
generated_xcode_build_settings.map { |p|
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
symlink = File.join('.symlinks', 'flutter')
File.symlink(File.dirname(p[:path]), symlink)
pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
copied_flutter_dir = File.join(__dir__, 'Flutter')
copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
# Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
# That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
# CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.

generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
unless File.exist?(generated_xcode_build_settings_path)
raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
}
generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];

unless File.exist?(copied_framework_path)
FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
end
unless File.exist?(copied_podspec_path)
FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
end
end

# Keep pod path relative so it can be checked into Podfile.lock.
pod 'Flutter', :path => 'Flutter'

# Plugin Pods

# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.map { |p|
symlink = File.join('.symlinks', 'plugins', p[:name])
File.symlink(p[:path], symlink)
if p[:name] == 'flutter_ffmpeg'
pod p[:name]+'/full', :path => File.join(symlink, 'ios')
plugin_pods.each do |name, path|
symlink = File.join('.symlinks', 'plugins', name)
File.symlink(path, symlink)
if name == 'flutter_ffmpeg'
pod name+'/full', :path => File.join(symlink, 'ios')
else
pod p[:name], :path => File.join(symlink, 'ios')
pod name, :path => File.join(symlink, 'ios')
end
}
end
end

# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
install! 'cocoapods', :disable_input_output_paths => true

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['PROVISIONING_PROFILE_SPECIFIER'] = ''
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
Expand Down
24 changes: 12 additions & 12 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
PODS:
- Flutter (1.0.0)
- flutter_ffmpeg/full (0.2.7):
- flutter_ffmpeg/full (0.2.8):
- Flutter
- mobile-ffmpeg-full (= 4.2.2)
- mobile-ffmpeg-full (4.2.2)
- mobile-ffmpeg-full (= 4.3)
- mobile-ffmpeg-full (4.3)
- path_provider (0.0.1):
- Flutter

DEPENDENCIES:
- Flutter (from `.symlinks/flutter/ios`)
- Flutter (from `Flutter`)
- flutter_ffmpeg/full (from `.symlinks/plugins/flutter_ffmpeg/ios`)
- path_provider (from `.symlinks/plugins/path_provider/ios`)

SPEC REPOS:
https://github.com/cocoapods/specs.git:
trunk:
- mobile-ffmpeg-full

EXTERNAL SOURCES:
Flutter:
:path: ".symlinks/flutter/ios"
:path: Flutter
flutter_ffmpeg:
:path: ".symlinks/plugins/flutter_ffmpeg/ios"
path_provider:
:path: ".symlinks/plugins/path_provider/ios"

SPEC CHECKSUMS:
Flutter: 58dd7d1b27887414a370fcccb9e645c08ffd7a6a
flutter_ffmpeg: 05ee218287a2b55a13df8f7970aab1a52094083e
mobile-ffmpeg-full: 42f654ef799818c6b8344ffd5a63c83b53f86745
path_provider: f96fff6166a8867510d2c25fdcc346327cc4b259
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
flutter_ffmpeg: c515a3a8a2d4e070fd684e85b2dd2084c749a585
mobile-ffmpeg-full: af38edede256cb1d4fcbf10dddef39bf529ecd50
path_provider: fb74bd0465e96b594bb3b5088ee4a4e7bb1f2a9d

PODFILE CHECKSUM: 3c42d7d5cb11914bdcd50bd04ea49997cf3f22b5
PODFILE CHECKSUM: 67dc48fdfc7437590697cf64597a0949c9173184

COCOAPODS: 1.7.3
COCOAPODS: 1.8.4
3 changes: 0 additions & 3 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,9 @@
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down
9 changes: 7 additions & 2 deletions example/lib/flutter_ffmpeg_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,12 @@ class FlutterFFmpegTestAppState extends State<MainPage> with TickerProviderState

void testRunCommand() {
getLastReturnCode().then((rc) => print("Last rc: $rc"));
getLastCommandOutput().then((output) => print("Last command output: $output"));
getLastCommandOutput().then((output) => debugPrint("Last command output: \"$output\"", wrapWidth: 1024));

print("Testing ParseArguments.");

testParseArguments();
registerNewFFmpegPipe().then((path) => print("New FFmpeg pipe: $path"));

print("Testing COMMAND.");

Expand Down Expand Up @@ -281,7 +282,7 @@ class FlutterFFmpegTestAppState extends State<MainPage> with TickerProviderState
VideoUtil.assetPath(videoPath).then((fullVideoPath) {
execute(VideoUtil.generateEncodeVideoScript(image1Path, image2Path, image3Path, fullVideoPath, ffmpegCodec, customOptions)).then((rc) {
if (rc == 0) {
testGetMediaInformation(fullVideoPath);
getLastCommandOutput().then((output) => debugPrint("Last command output: \"$output\"", wrapWidth: 1024));
}
});

Expand Down Expand Up @@ -411,6 +412,10 @@ class FlutterFFmpegTestAppState extends State<MainPage> with TickerProviderState
return await _flutterFFmpeg.getMediaInformation(path);
}

Future<String> registerNewFFmpegPipe() async {
return await _flutterFFmpeg.registerNewFFmpegPipe();
}

void _changedCodec(String selectedCodec) {
setState(() {
_currentCodec = selectedCodec;
Expand Down
Loading

0 comments on commit 8d83d73

Please sign in to comment.