Skip to content

Commit

Permalink
Merge branch 'main' into development-react-native
Browse files Browse the repository at this point in the history
  • Loading branch information
tanersener committed Oct 2, 2022
2 parents 554d736 + de919e3 commit 80dc3ae
Show file tree
Hide file tree
Showing 20 changed files with 223 additions and 176 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ It includes scripts to build `FFmpeg` native libraries, a wrapper library to run
- Supports hybrid platforms: Flutter, React Native
- Based on FFmpeg `v4.5-dev` or later with optional system and external libraries
- 8 prebuilt binary packages available at [Github](https://github.com/arthenica/ffmpeg-kit/releases), [Maven Central](https://search.maven.org), [CocoaPods](https://cocoapods.org), [pub](https://pub.dev) and [npm](https://www.npmjs.com)
- Licensed under `LGPL 3.0`, or `GPL v3.0` if GPL licensed libraries are enabled
- Licensed under `LGPL 3.0` by default, `GPL v3.0` if GPL licensed libraries are enabled

### 2. Android

Expand Down Expand Up @@ -126,6 +126,7 @@ the exact version number of `FFmpeg` is obtained using the `git describe --tags`

| Platforms | FFmpegKit Version | FFmpeg Version | Release Date |
|:----------------:|:----------------------------------------------------------------------------------:|:--------------:|:------------:|
| Flutter | [5.1.0](https://github.com/arthenica/ffmpeg-kit/releases/tag/flutter.v5.1.0) | 5.1.2 | Oct 02, 2022 |
| Android | [5.1](https://github.com/arthenica/ffmpeg-kit/releases/tag/v5.1) | 5.1.2 | Sep 29, 2022 |
| Apple | [5.1](https://github.com/arthenica/ffmpeg-kit/releases/tag/v5.1) | 5.1.2 | Sep 29, 2022 |
| React Native | [4.5.2](https://github.com/arthenica/ffmpeg-kit/releases/tag/react.native.v4.5.2) | 4.5-dev-3393 | May 25, 2022 |
Expand Down
9 changes: 5 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ applications and 8 prebuilt binary packages available at [Github](https://github
- Supports hybrid platforms: Flutter, React Native
- Based on FFmpeg `v4.5-dev` or later with optional system and external libraries
- 8 prebuilt binary packages available at [Github](https://github.com/arthenica/ffmpeg-kit/releases), [Maven Central](https://search.maven.org), [CocoaPods](https://cocoapods.org), [pub](https://pub.dev) and [npm](https://www.npmjs.com)
- Licensed under `LGPL 3.0`, or `GPL v3.0` if GPL licensed libraries are enabled
- Licensed under `LGPL 3.0` by default, some packages licensed by `GPL v3.0` effectively

### 2. Android

Expand Down Expand Up @@ -112,10 +112,11 @@ the same `FFmpeg` release branch.
`dev` part in the version string indicates that `FFmpeg` source code is cloned from the `FFmpeg` `master` branch and
the exact version number of `FFmpeg` is obtained using the `git describe --tags` command.

| Platforms | FFmpegKit Version | FFmpeg Version | Release Date |
|:----------------:|:----------------------------------------------------------------------------------:|:--------------:|:------------:|
| Platforms | FFmpegKit Version | FFmpeg Version | Release Date |
|:----------------:|:---------------------------------------------------------------------------------:|:--------------:|:------------:|
| Flutter | [5.1.0](https://github.com/arthenica/ffmpeg-kit/releases/tag/flutter.v5.1.0) | 5.1.2 | Oct 02, 2022 |
| Android | [5.1](https://github.com/arthenica/ffmpeg-kit/releases/tag/v5.1) | 5.1.2 | Sep 29, 2022 |
| Apple | [5.1](https://github.com/arthenica/ffmpeg-kit/releases/tag/v5.1) | 5.1.2 | Sep 29, 2022 |
| Apple | [5.1](https://github.com/arthenica/ffmpeg-kit/releases/tag/v5.1) | 5.1.2 | Sep 29, 2022 |
| React Native | [4.5.2](https://github.com/arthenica/ffmpeg-kit/releases/tag/react.native.v4.5.2) | 4.5-dev-3393 | May 25, 2022 |
| Flutter | [4.5.1](https://github.com/arthenica/ffmpeg-kit/releases/tag/flutter.v4.5.1) | 4.5-dev-3393 | Jan 02, 2022 |
| React Native | [4.5.1](https://github.com/arthenica/ffmpeg-kit/releases/tag/react.native.v4.5.1) | 4.5-dev-3393 | Jan 02, 2022 |
Expand Down
10 changes: 10 additions & 0 deletions flutter/flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 5.1.0
- Feature release based on native v5.1
- Implements AbstractSession.cancel() method
- Runs iOS and macOS callbacks on main queue

## 5.1.0-LTS
- Feature release based on native v5.1.LTS
- Implements AbstractSession.cancel() method
- Runs iOS and macOS callbacks on main queue

## 4.5.1
- Feature release based on native v4.5.1

Expand Down
48 changes: 28 additions & 20 deletions flutter/flutter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@
- Includes both `FFmpeg` and `FFprobe`
- Supports
- `Android`, `iOS` and `macOS`
- FFmpeg `v4.5-dev` releases
- FFmpeg `v5.1.2`
- `arm-v7a`, `arm-v7a-neon`, `arm64-v8a`, `x86` and `x86_64` architectures on Android
- `Android API Level 16` or later
- `Android API Level 24` or later
- `API Level 16` on LTS releases
- `armv7`, `armv7s`, `arm64`, `arm64-simulator`, `i386`, `x86_64`, `x86_64-mac-catalyst` and `arm64-mac-catalyst`
architectures on iOS
- `iOS SDK 10` or later
- `iOS SDK 12.1` or later
- `iOS SDK 10` on LTS releases
- `arm64` and `x86_64` architectures on macOS
- `macOS SDK 10.12+` or later
- `macOS SDK 10.15` or later
- `macOS SDK 10.12` on LTS releases
- Can process Storage Access Framework (SAF) Uris on Android
- 25 external libraries

Expand All @@ -24,29 +27,29 @@

`vid.stab`, `x264`, `x265`, `xvidcore`

- Licensed under LGPL 3.0, can be customized to support GPL v3.0
- Licensed under `LGPL 3.0` by default, some packages licensed by `GPL v3.0` effectively

### 2. Installation

Add `ffmpeg_kit_flutter` as a dependency in your `pubspec.yaml file`.

```yaml
dependencies:
ffmpeg_kit_flutter: 4.5.1
ffmpeg_kit_flutter: 5.1.0
```

#### 2.1 Packages

`ffmpeg` includes built-in encoders for some popular formats. However, there are certain external libraries that needs
`FFmpeg` includes built-in encoders for some popular formats. However, there are certain external libraries that needs
to be enabled in order to encode specific formats/codecs. For example, to encode an `mp3` file you need `lame` or
`shine` library enabled. You have to install a `ffmpeg_kit_flutter` package that has at least one of them inside. To
encode an `h264` video, you need to install a package with `x264` inside. To encode `vp8` or `vp9` videos, you need
a `ffmpeg_kit_flutter` package with `libvpx` inside.

`ffmpeg-kit` provides eight packages that include different sets of external libraries. These packages are named
according to the external libraries included in them. Refer to
[Packages](https://github.com/arthenica/ffmpeg-kit#8-packages) section of the project README to see the names of those
packages and external libraries included in each of them.
according to the external libraries included. Refer to the
[Packages](https://github.com/arthenica/ffmpeg-kit/wiki/Packages) wiki page to see the names of those
packages and external libraries included in each one of them.

#### 2.2 Installing Packages

Expand All @@ -55,7 +58,7 @@ using the following dependency format.

```yaml
dependencies:
ffmpeg_kit_flutter_<package name>: 4.5.1
ffmpeg_kit_flutter_<package name>: 5.1.0
```

Note that hyphens in the package name must be replaced with underscores. Additionally, do not forget to use the package
Expand All @@ -67,39 +70,44 @@ In order to install the `LTS` variant, append `-LTS` to the version you have for

```yaml
dependencies:
ffmpeg_kit_flutter: 4.5.1-LTS
ffmpeg_kit_flutter: 5.1.0-LTS
```

#### 2.4 LTS Releases

`ffmpeg_kit_flutter` is published in two different variants: `Main Release` and `LTS Release`. Both releases share the
same source code but is built with different settings (Architectures, API Level, iOS Min SDK, etc.). Refer to
[LTS Releases](https://github.com/arthenica/ffmpeg-kit#10-lts-releases) section of the project README to see how they
compare to each other.
`ffmpeg_kit_flutter` is published in two variants: `Main Release` and `LTS Release`. Both releases share the
same source code but is built with different settings (Architectures, API Level, iOS Min SDK, etc.). Refer to the
[LTS Releases](https://github.com/arthenica/ffmpeg-kit/wiki/LTS-Releases) wiki page to see how they differ from each
other.

#### 2.5 Android and iOS Support
#### 2.5 Platform Support

The following table shows the Android API level and iOS deployment target required in `ffmpeg_kit_flutter` releases.
The following table shows Android API level, iOS deployment target and macOS deployment target requirements in
`ffmpeg_kit_flutter` releases.

<table>
<thead>
<tr>
<th align="center" colspan="2">Main Release</th>
<th align="center" colspan="2">LTS Release</th>
<th align="center" colspan="3">Main Release</th>
<th align="center" colspan="3">LTS Release</th>
</tr>
<tr>
<th align="center">Android<br>API Level</th>
<th align="center">iOS Minimum<br>Deployment Target</th>
<th align="center">macOS Minimum<br>Deployment Target</th>
<th align="center">Android<br>API Level</th>
<th align="center">iOS Minimum<br>Deployment Target</th>
<th align="center">macOS Minimum<br>Deployment Target</th>
</tr>
</thead>
<tbody>
<tr>
<td align="center">24</td>
<td align="center">12.1</td>
<td align="center">10.15</td>
<td align="center">16</td>
<td align="center">10</td>
<td align="center">10.12</td>
</tr>
</tbody>
</table>
Expand Down
28 changes: 14 additions & 14 deletions flutter/flutter/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath 'com.android.tools.build:gradle:7.1.2'
}
}

rootProject.allprojects {
repositories {
google()
mavenCentral()
}
}

apply plugin: 'com.android.library'

android {
compileSdkVersion 30
compileSdkVersion 31

defaultConfig {
minSdkVersion 24
targetSdkVersion 30
versionCode 451
versionName "4.5.1"
targetSdkVersion 31
versionCode 510
versionName "5.1.0"
}

buildTypes {
Expand All @@ -35,14 +42,7 @@ android {
}
}

repositories {
mavenCentral()
jcenter()
google()
}

dependencies {
implementation 'androidx.annotation:annotation:1.2.0'
implementation 'com.arthenica:ffmpeg-kit-https:4.5.1-1'
implementation 'com.arthenica:ffmpeg-kit-https:5.1'
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2021 Taner Sener
* Copyright (c) 2018-2022 Taner Sener
*
* This file is part of FFmpegKit.
*
Expand Down Expand Up @@ -831,7 +831,7 @@ protected void getArch(@NonNull final Result result) {
// FFmpegSession

protected void ffmpegSession(@NonNull final List<String> arguments, @NonNull final Result result) {
final FFmpegSession session = new FFmpegSession(arguments.toArray(new String[0]), null, null, null, LogRedirectionStrategy.NEVER_PRINT_LOGS);
final FFmpegSession session = FFmpegSession.create(arguments.toArray(new String[0]), null, null, null, LogRedirectionStrategy.NEVER_PRINT_LOGS);
resultHandler.successAsync(result, toMap(session));
}

Expand Down Expand Up @@ -872,14 +872,14 @@ protected void ffmpegSessionGetStatistics(@NonNull final Integer sessionId, @Non
// FFprobeSession

protected void ffprobeSession(@NonNull final List<String> arguments, @NonNull final Result result) {
final FFprobeSession session = new FFprobeSession(arguments.toArray(new String[0]), null, null, LogRedirectionStrategy.NEVER_PRINT_LOGS);
final FFprobeSession session = FFprobeSession.create(arguments.toArray(new String[0]), null, null, LogRedirectionStrategy.NEVER_PRINT_LOGS);
resultHandler.successAsync(result, toMap(session));
}

// MediaInformationSession

protected void mediaInformationSession(@NonNull final List<String> arguments, @NonNull final Result result) {
final MediaInformationSession session = new MediaInformationSession(arguments.toArray(new String[0]), null, null);
final MediaInformationSession session = MediaInformationSession.create(arguments.toArray(new String[0]), null, null);
resultHandler.successAsync(result, toMap(session));
}

Expand Down
46 changes: 27 additions & 19 deletions flutter/flutter/ios/Classes/FFmpegKitFlutterPlugin.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2021 Taner Sener
* Copyright (c) 2018-2022 Taner Sener
*
* This file is part of FFmpegKit.
*
Expand Down Expand Up @@ -112,30 +112,40 @@ + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
- (void)registerGlobalCallbacks {
[FFmpegKitConfig enableFFmpegSessionCompleteCallback:^(FFmpegSession* session){
NSDictionary *dictionary = [FFmpegKitFlutterPlugin toSessionDictionary:session];
self->_eventSink([FFmpegKitFlutterPlugin toStringDictionary:EVENT_COMPLETE_CALLBACK_EVENT withDictionary:dictionary]);
dispatch_async(dispatch_get_main_queue(), ^() {
self->_eventSink([FFmpegKitFlutterPlugin toStringDictionary:EVENT_COMPLETE_CALLBACK_EVENT withDictionary:dictionary]);
});
}];

[FFmpegKitConfig enableFFprobeSessionCompleteCallback:^(FFprobeSession* session){
NSDictionary *dictionary = [FFmpegKitFlutterPlugin toSessionDictionary:session];
self->_eventSink([FFmpegKitFlutterPlugin toStringDictionary:EVENT_COMPLETE_CALLBACK_EVENT withDictionary:dictionary]);
dispatch_async(dispatch_get_main_queue(), ^() {
self->_eventSink([FFmpegKitFlutterPlugin toStringDictionary:EVENT_COMPLETE_CALLBACK_EVENT withDictionary:dictionary]);
});
}];

[FFmpegKitConfig enableMediaInformationSessionCompleteCallback:^(MediaInformationSession* session){
NSDictionary *dictionary = [FFmpegKitFlutterPlugin toSessionDictionary:session];
self->_eventSink([FFmpegKitFlutterPlugin toStringDictionary:EVENT_COMPLETE_CALLBACK_EVENT withDictionary:dictionary]);
dispatch_async(dispatch_get_main_queue(), ^() {
self->_eventSink([FFmpegKitFlutterPlugin toStringDictionary:EVENT_COMPLETE_CALLBACK_EVENT withDictionary:dictionary]);
});
}];

[FFmpegKitConfig enableLogCallback: ^(Log* log){
if (self->logsEnabled) {
NSDictionary *dictionary = [FFmpegKitFlutterPlugin toLogDictionary:log];
self->_eventSink([FFmpegKitFlutterPlugin toStringDictionary:EVENT_LOG_CALLBACK_EVENT withDictionary:dictionary]);
dispatch_async(dispatch_get_main_queue(), ^() {
self->_eventSink([FFmpegKitFlutterPlugin toStringDictionary:EVENT_LOG_CALLBACK_EVENT withDictionary:dictionary]);
});
}
}];

[FFmpegKitConfig enableStatisticsCallback:^(Statistics* statistics){
if (self->statisticsEnabled) {
NSDictionary *dictionary = [FFmpegKitFlutterPlugin toStatisticsDictionary:statistics];
self->_eventSink([FFmpegKitFlutterPlugin toStringDictionary:EVENT_STATISTICS_CALLBACK_EVENT withDictionary:dictionary]);
dispatch_async(dispatch_get_main_queue(), ^() {
self->_eventSink([FFmpegKitFlutterPlugin toStringDictionary:EVENT_STATISTICS_CALLBACK_EVENT withDictionary:dictionary]);
});
}
}];
}
Expand Down Expand Up @@ -563,7 +573,7 @@ - (void)getArch:(FlutterResult)result {
// FFmpegSession

- (void)ffmpegSession:(NSArray*)arguments result:(FlutterResult)result {
FFmpegSession* session = [[FFmpegSession alloc] init:arguments withCompleteCallback:nil withLogCallback:nil withStatisticsCallback:nil withLogRedirectionStrategy:LogRedirectionStrategyNeverPrintLogs];
FFmpegSession* session = [FFmpegSession create:arguments withCompleteCallback:nil withLogCallback:nil withStatisticsCallback:nil withLogRedirectionStrategy:LogRedirectionStrategyNeverPrintLogs];
result([FFmpegKitFlutterPlugin toSessionDictionary:session]);
}

Expand Down Expand Up @@ -604,14 +614,14 @@ - (void)ffmpegSessionGetStatistics:(NSNumber*)sessionId result:(FlutterResult)re
// FFprobeSession

- (void)ffprobeSession:(NSArray*)arguments result:(FlutterResult)result {
FFprobeSession* session = [[FFprobeSession alloc] init:arguments withCompleteCallback:nil withLogCallback:nil withLogRedirectionStrategy:LogRedirectionStrategyNeverPrintLogs];
FFprobeSession* session = [FFprobeSession create:arguments withCompleteCallback:nil withLogCallback:nil withLogRedirectionStrategy:LogRedirectionStrategyNeverPrintLogs];
result([FFmpegKitFlutterPlugin toSessionDictionary:session]);
}

// MediaInformationSession

- (void)mediaInformationSession:(NSArray*)arguments result:(FlutterResult)result {
MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withCompleteCallback:nil withLogCallback:nil];
MediaInformationSession* session = [MediaInformationSession create:arguments withCompleteCallback:nil withLogCallback:nil];
result([FFmpegKitFlutterPlugin toSessionDictionary:session]);
}

Expand All @@ -632,23 +642,21 @@ - (void)getMediaInformation:(NSNumber*)sessionId result:(FlutterResult)result {
// MediaInformationJsonParser

- (void)mediaInformationJsonParserFrom:(NSString*)ffprobeJsonOutput result:(FlutterResult)result {
NSError *error;
MediaInformation* mediaInformation = [MediaInformationJsonParser from:ffprobeJsonOutput with:error];
if (error == nil) {
@try {
MediaInformation* mediaInformation = [MediaInformationJsonParser fromWithError:ffprobeJsonOutput];
result([FFmpegKitFlutterPlugin toMediaInformationDictionary:mediaInformation]);
} else {
NSLog(@"Parsing MediaInformation failed: %@.\n", error);
} @catch (NSException *exception) {
NSLog(@"Parsing MediaInformation failed: %@.\n", [NSString stringWithFormat:@"%@\n%@", [exception userInfo], [exception callStackSymbols]]);
result(nil);
}
}

- (void)mediaInformationJsonParserFromWithError:(NSString*)ffprobeJsonOutput result:(FlutterResult)result {
NSError *error;
MediaInformation* mediaInformation = [MediaInformationJsonParser from:ffprobeJsonOutput with:error];
if (error == nil) {
@try {
MediaInformation* mediaInformation = [MediaInformationJsonParser fromWithError:ffprobeJsonOutput];
result([FFmpegKitFlutterPlugin toMediaInformationDictionary:mediaInformation]);
} else {
NSLog(@"Parsing MediaInformation failed: %@.\n", error);
} @catch (NSException *exception) {
NSLog(@"Parsing MediaInformation failed: %@.\n", [NSString stringWithFormat:@"%@\n%@", [exception userInfo], [exception callStackSymbols]]);
result([FlutterError errorWithCode:@"PARSE_FAILED" message:@"Parsing MediaInformation failed with JSON error." details:nil]);
}
}
Expand Down

0 comments on commit 80dc3ae

Please sign in to comment.