Merge branch 'main' into development

This commit is contained in:
Taner Sener 2022-09-30 22:58:46 +01:00
commit 8148022090
14 changed files with 128 additions and 61 deletions

View File

@ -14,7 +14,15 @@ on:
- 'android.sh'
pull_request:
branches:
- development
- main
paths:
- '.github/workflows/android-build-scripts.yml'
- 'android/**'
- '!android/README.md'
- 'scripts/**'
- 'tools/**'
- 'android.sh'
jobs:
build-main-on-linux:
@ -133,3 +141,32 @@ jobs:
- name: print ffbuild logs
if: ${{ failure() }}
run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log'
build-main-without-ffmpeg-kit-protocols-on-linux:
name: build without ffmpeg-kit protocols
runs-on: ubuntu-20.04
strategy:
matrix:
ndk-version: [ 'r22b-linux-x86_64' ]
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v2
- name: set up adopt jdk 11
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
- name: set up android ndk
run: |
curl -s "https://dl.google.com/android/repository/android-ndk-${{ matrix.ndk-version }}.zip" -o ndk.zip
unzip -q -o ndk.zip -d .ndk
echo "ANDROID_NDK_ROOT=$PWD/.ndk/$(ls .ndk)" >> $GITHUB_ENV
- name: run the build script
run: ./android.sh --no-ffmpeg-kit-protocols --disable-x86 --disable-x86-64 --disable-arm-v7a --disable-arm-v7a-neon
- name: print build logs
if: ${{ always() }}
run: cat build.log
- name: print ffbuild logs
if: ${{ failure() }}
run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log'

View File

@ -15,10 +15,12 @@ on:
- 'ios.sh'
pull_request:
branches:
- development
- main
paths:
- '.github/workflows/ios-build-scripts.yml'
- 'apple/**'
- '!apple/README.md'
- 'scripts/**'
- 'tools/**'
- 'apple.sh'

View File

@ -15,7 +15,16 @@ on:
- 'macos.sh'
pull_request:
branches:
- development
- main
paths:
- '.github/workflows/macos-build-scripts.yml'
- 'apple/**'
- '!apple/README.md'
- 'scripts/**'
- 'tools/**'
- 'apple.sh'
- 'macos.sh'
jobs:
build-main-on-macos-bigsur:

View File

@ -2,23 +2,25 @@ name: mark stale issues and pull requests
on:
schedule:
- cron: "0 0 * * *"
- cron: "30 1 * * *"
jobs:
stale:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v4
- uses: actions/stale@v5
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.'
stale-pr-message: 'This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.'
days-before-stale: 60
stale-issue-message: 'This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.'
stale-pr-message: 'This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.'
close-issue-message: 'This issue was closed because it has been stalled for 7 days with no activity.'
close-pr-message: 'This PR was closed because it has been stalled for 7 days with no activity.'
stale-issue-label: 'no-issue-activity'
stale-pr-label: 'no-pr-activity'
exempt-issue-labels: 'enhancement'
exempt-pr-labels: 'enhancement'
exempt-issue-labels: 'enhancement,unreleased'
exempt-pr-labels: 'enhancement,unreleased'
exempt-all-assignees: 'true'
permissions:
issues: write
pull-requests: write

View File

@ -15,7 +15,16 @@ on:
- 'tvos.sh'
pull_request:
branches:
- development
- main
paths:
- '.github/workflows/tvos-build-scripts.yml'
- 'apple/**'
- '!apple/README.md'
- 'scripts/**'
- 'tools/**'
- 'apple.sh'
- 'tvos.sh'
jobs:
build-main-on-macos-bigsur:

View File

@ -118,16 +118,17 @@ include them.
The exact version number of `FFmpeg` is obtained using `git describe --tags`. `dev` part in the version string
indicates that `FFmpeg` source code is cloned from the `FFmpeg` `master` branch.
| Platforms | FFmpegKit Version | FFmpeg Version | Release Date |
|:----------------:|:--------------------------------------------------------------------------------------------:| :------------: |:------------:|
| 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 |
| Android | [4.5.1](https://github.com/arthenica/ffmpeg-kit/releases/tag/v4.5.1) | 4.5-dev-3393 | Jan 01, 2022 |
| Apple | [4.5.1](https://github.com/arthenica/ffmpeg-kit/releases/tag/v4.5.1) | 4.5-dev-3393 | Jan 14, 2022 |
| Flutter | [4.5.0](https://github.com/arthenica/ffmpeg-kit/releases/tag/flutter.v4.5.0) | 4.5-dev-2008 | Oct 05, 2021 |
| React Native | [4.5.0](https://github.com/arthenica/ffmpeg-kit/releases/tag/react.native.v4.5.0) | 4.5-dev-2008 | Oct 01, 2021 |
| Android<br>Apple | [4.5](https://github.com/arthenica/ffmpeg-kit/releases/tag/v4.5) | 4.5-dev-2008 | Sep 18, 2021 |
| Android<br>Apple | [4.4](https://github.com/arthenica/ffmpeg-kit/releases/tag/v4.4) | 4.4-dev-3015 | Mar 03, 2021 |
| Platforms | FFmpegKit Version | FFmpeg Version | Release Date |
|:----------------:|:----------------------------------------------------------------------------------:| :------------: |:------------:|
| React Native | [4.5.2](https://github.com/tanersener/ffmpeg-kit/releases/tag/react.native.v4.5.2) | 4.5-dev-3393 | May 25, 2022 |
| Flutter | [4.5.1](https://github.com/tanersener/ffmpeg-kit/releases/tag/flutter.v4.5.1) | 4.5-dev-3393 | Jan 02, 2022 |
| React Native | [4.5.1](https://github.com/tanersener/ffmpeg-kit/releases/tag/react.native.v4.5.1) | 4.5-dev-3393 | Jan 02, 2022 |
| Android | [4.5.1](https://github.com/tanersener/ffmpeg-kit/releases/tag/v4.5.1) | 4.5-dev-3393 | Jan 01, 2022 |
| Apple | [4.5.1](https://github.com/tanersener/ffmpeg-kit/releases/tag/v4.5.1) | 4.5-dev-3393 | Dec 30, 2021 |
| Flutter | [4.5.0](https://github.com/tanersener/ffmpeg-kit/releases/tag/flutter.v4.5.0) | 4.5-dev-2008 | Oct 05, 2021 |
| React Native | [4.5.0](https://github.com/tanersener/ffmpeg-kit/releases/tag/react.native.v4.5.0) | 4.5-dev-2008 | Oct 01, 2021 |
| Android<br>Apple | [4.5](https://github.com/tanersener/ffmpeg-kit/releases/tag/v4.5) | 4.5-dev-2008 | Sep 18, 2021 |
| Android<br>Apple | [4.4](https://github.com/tanersener/ffmpeg-kit/releases/tag/v4.4) | 4.4-dev-3015 | Mar 03, 2021 |
### 10. LTS Releases

View File

@ -77,7 +77,7 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
}
dependencies {
implementation 'com.arthenica:ffmpeg-kit-full:4.5.1'
implementation 'com.arthenica:ffmpeg-kit-full:4.5.1-1'
}
```

View File

@ -31,8 +31,8 @@ android {
defaultConfig {
minSdkVersion safeExtGet('ffmpegKitPackage', 'https').contains("-lts") ? 16 : 24
targetSdkVersion 30
versionCode 451
versionName "4.5.1"
versionCode 452
versionName "4.5.2"
}
buildTypes {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Taner Sener
* Copyright (c) 2021-2022 Taner Sener
*
* This file is part of FFmpegKit.
*
@ -47,7 +47,6 @@ import com.arthenica.ffmpegkit.Signal;
import com.arthenica.ffmpegkit.Statistics;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.BaseActivityEventListener;
import com.facebook.react.bridge.LifecycleEventListener;
import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
@ -75,7 +74,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicBoolean;
public class FFmpegKitReactNativeModule extends ReactContextBaseJavaModule implements LifecycleEventListener {
public class FFmpegKitReactNativeModule extends ReactContextBaseJavaModule {
public static final String LIBRARY_NAME = "ffmpeg-kit-react-native";
public static final String PLATFORM_NAME = "android";
@ -131,7 +130,6 @@ public class FFmpegKitReactNativeModule extends ReactContextBaseJavaModule imple
this.asyncExecutorService = Executors.newFixedThreadPool(asyncWriteToPipeConcurrencyLimit);
if (reactContext != null) {
reactContext.addLifecycleEventListener(this);
registerGlobalCallbacks(reactContext);
}
}
@ -151,19 +149,6 @@ public class FFmpegKitReactNativeModule extends ReactContextBaseJavaModule imple
return "FFmpegKitReactNativeModule";
}
@Override
public void onHostResume() {
}
@Override
public void onHostPause() {
}
@Override
public void onHostDestroy() {
this.asyncExecutorService.shutdown();
}
protected void registerGlobalCallbacks(final ReactApplicationContext reactContext) {
FFmpegKitConfig.enableFFmpegSessionCompleteCallback(session -> {
final DeviceEventManagerModule.RCTDeviceEventEmitter jsModule = reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class);
@ -984,6 +969,12 @@ public class FFmpegKitReactNativeModule extends ReactContextBaseJavaModule imple
promise.resolve(toStringArray(Packages.getExternalLibraries()));
}
@ReactMethod
public void uninit(final Promise promise) {
this.asyncExecutorService.shutdown();
promise.resolve(null);
}
protected void enableLogs() {
logsEnabled.compareAndSet(false, true);
}
@ -1144,16 +1135,18 @@ public class FFmpegKitReactNativeModule extends ReactContextBaseJavaModule imple
}
protected static WritableMap toMap(final MediaInformation mediaInformation) {
WritableMap map = Arguments.createMap();
if (mediaInformation != null) {
WritableMap map = Arguments.createMap();
JSONObject allProperties = mediaInformation.getAllProperties();
if (allProperties != null) {
map = toMap(allProperties);
}
}
return map;
return map;
} else {
return null;
}
}
protected static WritableMap toMap(final JSONObject jsonObject) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Taner Sener
* Copyright (c) 2021-2022 Taner Sener
*
* This file is part of FFmpegKit.
*
@ -695,6 +695,10 @@ RCT_EXPORT_METHOD(getExternalLibraries:(RCTPromiseResolveBlock)resolve rejecter:
resolve([Packages getExternalLibraries]);
}
RCT_EXPORT_METHOD(uninit:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
resolve(nil);
}
- (void)enableLogs {
logsEnabled = true;
}
@ -724,16 +728,14 @@ RCT_EXPORT_METHOD(getExternalLibraries:(RCTPromiseResolveBlock)resolve rejecter:
dictionary[KEY_SESSION_START_TIME] = [NSNumber numberWithDouble:[[session getStartTime] timeIntervalSince1970]*1000];
dictionary[KEY_SESSION_COMMAND] = [session getCommand];
if ([session isFFprobe]) {
if ([session isMediaInformation]) {
MediaInformationSession *mediaInformationSession = (MediaInformationSession*)session;
dictionary[KEY_SESSION_MEDIA_INFORMATION] = [FFmpegKitReactNativeModule toMediaInformationDictionary:[mediaInformationSession getMediaInformation]];
dictionary[KEY_SESSION_TYPE] = [NSNumber numberWithInt:SESSION_TYPE_MEDIA_INFORMATION];
} else {
dictionary[KEY_SESSION_TYPE] = [NSNumber numberWithInt:SESSION_TYPE_FFPROBE];
}
} else {
if ([session isFFmpeg]) {
dictionary[KEY_SESSION_TYPE] = [NSNumber numberWithInt:SESSION_TYPE_FFMPEG];
} else if ([session isFFprobe]) {
dictionary[KEY_SESSION_TYPE] = [NSNumber numberWithInt:SESSION_TYPE_FFPROBE];
} else if ([session isMediaInformation]) {
MediaInformationSession *mediaInformationSession = (MediaInformationSession*)session;
dictionary[KEY_SESSION_MEDIA_INFORMATION] = [FFmpegKitReactNativeModule toMediaInformationDictionary:[mediaInformationSession getMediaInformation]];
dictionary[KEY_SESSION_TYPE] = [NSNumber numberWithInt:SESSION_TYPE_MEDIA_INFORMATION];
}
return dictionary;

View File

@ -1,6 +1,6 @@
{
"name": "ffmpeg-kit-react-native",
"version": "4.5.1",
"version": "4.5.2",
"description": "FFmpeg Kit for React Native",
"main": "src/index",
"types": "src/index.d.ts",

View File

@ -92,6 +92,8 @@ declare module 'ffmpeg-kit-react-native' {
static init(): Promise<void>;
static uninit(): Promise<void>;
static enableRedirection(): Promise<void>;
static disableRedirection(): Promise<void>;

View File

@ -669,11 +669,12 @@ export class AbstractSession extends Session {
}
/**
* Cancels running the session.
* Cancels running the session. Only starts cancellation. Does not guarantee that session is cancelled when promise resolves.
*/
cancel() {
async cancel() {
const sessionId = this.getSessionId();
if (sessionId === undefined) {
return FFmpegKitReactNativeModule.cancel();
return Promise.reject(new Error('sessionId is not defined'));
} else {
return FFmpegKitReactNativeModule.cancelSession(sessionId);
}
@ -811,6 +812,15 @@ export class FFmpegKitConfig {
await FFmpegKitInitializer.initialize();
}
/**
* Uninitializes the library.
*
* Calling this method before application termination is recommended but not required.
*/
static async uninit() {
return FFmpegKitReactNativeModule.uninit();
}
/**
* <p>Enables log and statistics redirection.
*
@ -1608,7 +1618,7 @@ class FFmpegKitFactory {
}
static getVersion() {
return "4.5.1";
return "4.5.2";
}
static getLogRedirectionStrategy(sessionId) {
@ -2474,7 +2484,7 @@ export class MediaInformation {
/**
* Returns duration.
*
* @return media duration in milliseconds
* @return media duration in "seconds.microseconds" format
*/
getDuration() {
return this.getStringProperty(MediaInformation.KEY_DURATION);

View File

@ -401,7 +401,7 @@ ${SED_INLINE} 's/static int av_log_level/__thread int av_log_level/g' "${BASEDIR
# 2. Enable ffmpeg-kit protocols
if [[ ${NO_FFMPEG_KIT_PROTOCOLS} == "1" ]]; then
${SED_INLINE} "s/ av_set_fd_close/\/\/av_set_fd_close/g" "${BASEDIR}"/android/ffmpeg-kit-android-lib/src/main/cpp/ffmpegkit.c 1>>"${BASEDIR}"/build.log 2>&1
${SED_INLINE} "s| av_set_saf|//av_set_saf|g" "${BASEDIR}"/android/ffmpeg-kit-android-lib/src/main/cpp/ffmpegkit.c 1>>"${BASEDIR}"/build.log 2>&1
echo -e "\nINFO: Disabled custom ffmpeg-kit protocols\n" 1>>"${BASEDIR}"/build.log 2>&1
else
cat ../../tools/protocols/libavformat_file.c >> libavformat/file.c