From f4817dad4db08be171d112302344771558baaaa3 Mon Sep 17 00:00:00 2001 From: Taner Sener Date: Mon, 3 Jan 2022 00:00:50 +0000 Subject: [PATCH 01/18] fix toSessionDictionary method on ios --- .../reactnative/FFmpegKitReactNativeModule.java | 10 ++++++---- react-native/ios/FFmpegKitReactNativeModule.m | 16 +++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/react-native/android/src/main/java/com/arthenica/ffmpegkit/reactnative/FFmpegKitReactNativeModule.java b/react-native/android/src/main/java/com/arthenica/ffmpegkit/reactnative/FFmpegKitReactNativeModule.java index 7f9ce9d..c978aa3 100644 --- a/react-native/android/src/main/java/com/arthenica/ffmpegkit/reactnative/FFmpegKitReactNativeModule.java +++ b/react-native/android/src/main/java/com/arthenica/ffmpegkit/reactnative/FFmpegKitReactNativeModule.java @@ -1144,16 +1144,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) { diff --git a/react-native/ios/FFmpegKitReactNativeModule.m b/react-native/ios/FFmpegKitReactNativeModule.m index 9babaa4..9f52082 100644 --- a/react-native/ios/FFmpegKitReactNativeModule.m +++ b/react-native/ios/FFmpegKitReactNativeModule.m @@ -724,16 +724,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; From 3d7d7cf41e3cf06bc02d1bc238b92789d5791c86 Mon Sep 17 00:00:00 2001 From: Andrew Shini <13059204+superandrew213@users.noreply.github.com> Date: Tue, 1 Feb 2022 18:09:55 +1000 Subject: [PATCH 02/18] define sessionId --- react-native/src/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/react-native/src/index.js b/react-native/src/index.js index 4b28ff5..16fe215 100644 --- a/react-native/src/index.js +++ b/react-native/src/index.js @@ -672,6 +672,7 @@ export class AbstractSession extends Session { * Cancels running the session. */ cancel() { + const sessionId = this.getSessionId(); if (sessionId === undefined) { return FFmpegKitReactNativeModule.cancel(); } else { From c63401acf34e9d4e218340b496729bab987815f8 Mon Sep 17 00:00:00 2001 From: Andrew Shini <13059204+superandrew213@users.noreply.github.com> Date: Tue, 1 Feb 2022 21:19:56 +1000 Subject: [PATCH 03/18] cancel only session with sessionId --- react-native/src/index.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/react-native/src/index.js b/react-native/src/index.js index 16fe215..98def74 100644 --- a/react-native/src/index.js +++ b/react-native/src/index.js @@ -671,11 +671,9 @@ export class AbstractSession extends Session { /** * Cancels running the session. */ - cancel() { + async cancel() { const sessionId = this.getSessionId(); - if (sessionId === undefined) { - return FFmpegKitReactNativeModule.cancel(); - } else { + if (sessionId !== undefined) { return FFmpegKitReactNativeModule.cancelSession(sessionId); } } From cb124749a848d395f7c5431af3dbc2e837d9b8a2 Mon Sep 17 00:00:00 2001 From: Andrew Shini <13059204+superandrew213@users.noreply.github.com> Date: Wed, 2 Feb 2022 22:02:14 +1000 Subject: [PATCH 04/18] reject if sessionId is not defined --- react-native/src/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/react-native/src/index.js b/react-native/src/index.js index 98def74..3a39aa6 100644 --- a/react-native/src/index.js +++ b/react-native/src/index.js @@ -669,11 +669,13 @@ 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. */ async cancel() { const sessionId = this.getSessionId(); - if (sessionId !== undefined) { + if (sessionId === undefined) { + return Promise.reject(new Error('sessionId is not defined')); + } else { return FFmpegKitReactNativeModule.cancelSession(sessionId); } } From 75c3827657732dca1c012e7afe408d117862a42d Mon Sep 17 00:00:00 2001 From: Michael Matloka Date: Wed, 9 Feb 2022 01:19:28 +0100 Subject: [PATCH 05/18] Suggest installing `gettext` to get `autopoint` --- apple/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apple/README.md b/apple/README.md index 821ae37..1edd4c2 100644 --- a/apple/README.md +++ b/apple/README.md @@ -66,7 +66,7 @@ Please note that `FFmpegKit` project repository includes the source code of `FFm Use your package manager (brew, etc.) to install the following packages. ``` -autoconf automake libtool pkg-config curl cmake gcc gperf texinfo yasm nasm bison autogen git wget autopoint meson ninja +autoconf automake libtool pkg-config curl cmake gcc gperf texinfo yasm nasm bison autogen git wget gettext meson ninja ``` #### 2.2 Options From bd71e4de0666b31bc210cb21f257dd1505271c13 Mon Sep 17 00:00:00 2001 From: Taner Sener Date: Sun, 10 Apr 2022 13:38:25 +0100 Subject: [PATCH 06/18] Provide a workaround for #390 --- .github/workflows/periodic-builds-apple.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/periodic-builds-apple.yml b/.github/workflows/periodic-builds-apple.yml index cf1e24d..7b770ac 100644 --- a/.github/workflows/periodic-builds-apple.yml +++ b/.github/workflows/periodic-builds-apple.yml @@ -23,8 +23,10 @@ jobs: run: brew install autoconf automake libtool pkg-config curl git cmake gcc gperf texinfo yasm nasm bison autogen wget meson ninja - name: set up xcode run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh + - name: set up cmake + run: 'cd /tmp && curl -L https://github.com/Kitware/CMake/releases/download/v3.22.3/cmake-3.22.3-macos-universal.tar.gz --output cmake.tar.gz && tar zxvf cmake.tar.gz && cd -' - name: run the build script - run: PATH="/usr/local/opt/bison/bin:$PATH" ./ios.sh -x --full --enable-gpl --disable-lib-srt + run: PATH="/tmp/cmake-3.22.3-macos-universal/CMake.app/Contents/bin:/usr/local/opt/bison/bin:$PATH" ./ios.sh -x --full --enable-gpl --disable-lib-srt - name: print build logs if: ${{ always() }} run: cat build.log From f56cc05d509faddabc6ac30990c353f9e7a91e68 Mon Sep 17 00:00:00 2001 From: Taner Sener Date: Mon, 11 Apr 2022 12:39:39 +0100 Subject: [PATCH 07/18] update android documentation --- android/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/README.md b/android/README.md index 7c14acb..11ad82c 100644 --- a/android/README.md +++ b/android/README.md @@ -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' } ``` From 502ef4201b35014f665c4531782ab156ce29487d Mon Sep 17 00:00:00 2001 From: Taner Sener Date: Mon, 11 Apr 2022 12:44:50 +0100 Subject: [PATCH 08/18] do not run github actions for doc updates --- .github/workflows/android-build-scripts.yml | 6 ++++++ .github/workflows/ios-build-scripts.yml | 6 ++++++ .github/workflows/macos-build-scripts.yml | 6 ++++++ .github/workflows/tvos-build-scripts.yml | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/.github/workflows/android-build-scripts.yml b/.github/workflows/android-build-scripts.yml index 74f7d12..9b34d4b 100644 --- a/.github/workflows/android-build-scripts.yml +++ b/.github/workflows/android-build-scripts.yml @@ -5,9 +5,15 @@ on: branches: - development - main + paths-ignore: + - '**/README.md' + - 'docs/**' pull_request: branches: - main + paths-ignore: + - '**/README.md' + - 'docs/**' jobs: build-main-on-linux: diff --git a/.github/workflows/ios-build-scripts.yml b/.github/workflows/ios-build-scripts.yml index 1160b7a..2c27abb 100644 --- a/.github/workflows/ios-build-scripts.yml +++ b/.github/workflows/ios-build-scripts.yml @@ -5,9 +5,15 @@ on: branches: - development - main + paths-ignore: + - '**/README.md' + - 'docs/**' pull_request: branches: - main + paths-ignore: + - '**/README.md' + - 'docs/**' jobs: build-main-on-macos-bigsur: diff --git a/.github/workflows/macos-build-scripts.yml b/.github/workflows/macos-build-scripts.yml index 7ba06ff..dc646cc 100644 --- a/.github/workflows/macos-build-scripts.yml +++ b/.github/workflows/macos-build-scripts.yml @@ -5,9 +5,15 @@ on: branches: - development - main + paths-ignore: + - '**/README.md' + - 'docs/**' pull_request: branches: - main + paths-ignore: + - '**/README.md' + - 'docs/**' jobs: build-main-on-macos-bigsur: diff --git a/.github/workflows/tvos-build-scripts.yml b/.github/workflows/tvos-build-scripts.yml index 20f341f..8ef230f 100644 --- a/.github/workflows/tvos-build-scripts.yml +++ b/.github/workflows/tvos-build-scripts.yml @@ -5,9 +5,15 @@ on: branches: - development - main + paths-ignore: + - '**/README.md' + - 'docs/**' pull_request: branches: - main + paths-ignore: + - '**/README.md' + - 'docs/**' jobs: build-main-on-macos-bigsur: From a09c72016f225873eab662fc1f13dd5566938b36 Mon Sep 17 00:00:00 2001 From: Taner Sener Date: Fri, 15 Apr 2022 11:27:20 +0100 Subject: [PATCH 09/18] fix disabling ffmpeg-kit protocols in android build scripts, fixes #395 --- .github/workflows/android-build-scripts.yml | 29 +++++++++++++++++++++ scripts/android/ffmpeg.sh | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/.github/workflows/android-build-scripts.yml b/.github/workflows/android-build-scripts.yml index 9b34d4b..940f6a3 100644 --- a/.github/workflows/android-build-scripts.yml +++ b/.github/workflows/android-build-scripts.yml @@ -132,3 +132,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 8 + uses: actions/setup-java@v2.2.0 + with: + distribution: 'adopt' + java-version: '8' + - 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' diff --git a/scripts/android/ffmpeg.sh b/scripts/android/ffmpeg.sh index 7b6d2d7..6ec6967 100755 --- a/scripts/android/ffmpeg.sh +++ b/scripts/android/ffmpeg.sh @@ -405,7 +405,7 @@ ${SED_INLINE} "s/\$version/$FFMPEG_VERSION/g" "${BASEDIR}"/src/"${LIB_NAME}"/ffb # 3. 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 From bccf4efebc371112d3146ad206b2bb9153c168b8 Mon Sep 17 00:00:00 2001 From: Taner Sener Date: Sun, 15 May 2022 13:08:38 +0100 Subject: [PATCH 10/18] use more specific paths in github workflows --- .github/workflows/android-build-scripts.yml | 18 ++++++++++++------ .github/workflows/ios-build-scripts.yml | 20 ++++++++++++++------ .github/workflows/macos-build-scripts.yml | 20 ++++++++++++++------ .github/workflows/periodic-builds-apple.yml | 12 ++++++------ .github/workflows/tvos-build-scripts.yml | 20 ++++++++++++++------ 5 files changed, 60 insertions(+), 30 deletions(-) diff --git a/.github/workflows/android-build-scripts.yml b/.github/workflows/android-build-scripts.yml index 940f6a3..c5ca558 100644 --- a/.github/workflows/android-build-scripts.yml +++ b/.github/workflows/android-build-scripts.yml @@ -5,15 +5,21 @@ on: branches: - development - main - paths-ignore: - - '**/README.md' - - 'docs/**' + paths: + - '.github/workflows/android-build-scripts.yml' + - 'android/**' + - 'scripts/**' + - 'tools/**' + - 'android.sh' pull_request: branches: - main - paths-ignore: - - '**/README.md' - - 'docs/**' + paths: + - '.github/workflows/android-build-scripts.yml' + - 'android/**' + - 'scripts/**' + - 'tools/**' + - 'android.sh' jobs: build-main-on-linux: diff --git a/.github/workflows/ios-build-scripts.yml b/.github/workflows/ios-build-scripts.yml index 2c27abb..3d2f0f6 100644 --- a/.github/workflows/ios-build-scripts.yml +++ b/.github/workflows/ios-build-scripts.yml @@ -5,15 +5,23 @@ on: branches: - development - main - paths-ignore: - - '**/README.md' - - 'docs/**' + paths: + - '.github/workflows/ios-build-scripts.yml' + - 'apple/**' + - 'scripts/**' + - 'tools/**' + - 'apple.sh' + - 'ios.sh' pull_request: branches: - main - paths-ignore: - - '**/README.md' - - 'docs/**' + paths: + - '.github/workflows/ios-build-scripts.yml' + - 'apple/**' + - 'scripts/**' + - 'tools/**' + - 'apple.sh' + - 'ios.sh' jobs: build-main-on-macos-bigsur: diff --git a/.github/workflows/macos-build-scripts.yml b/.github/workflows/macos-build-scripts.yml index dc646cc..39d7e55 100644 --- a/.github/workflows/macos-build-scripts.yml +++ b/.github/workflows/macos-build-scripts.yml @@ -5,15 +5,23 @@ on: branches: - development - main - paths-ignore: - - '**/README.md' - - 'docs/**' + paths: + - '.github/workflows/macos-build-scripts.yml' + - 'apple/**' + - 'scripts/**' + - 'tools/**' + - 'apple.sh' + - 'macos.sh' pull_request: branches: - main - paths-ignore: - - '**/README.md' - - 'docs/**' + paths: + - '.github/workflows/macos-build-scripts.yml' + - 'apple/**' + - 'scripts/**' + - 'tools/**' + - 'apple.sh' + - 'macos.sh' jobs: build-main-on-macos-bigsur: diff --git a/.github/workflows/periodic-builds-apple.yml b/.github/workflows/periodic-builds-apple.yml index 7b770ac..701a91f 100644 --- a/.github/workflows/periodic-builds-apple.yml +++ b/.github/workflows/periodic-builds-apple.yml @@ -20,7 +20,7 @@ jobs: with: ref: ${{ matrix.branches }} - name: prerequisites - run: brew install autoconf automake libtool pkg-config curl git cmake gcc gperf texinfo yasm nasm bison autogen wget meson ninja + run: brew install autoconf automake libtool pkg-config curl git cmake gcc gperf texinfo yasm nasm bison autogen wget meson ninja ragel --overwrite - name: set up xcode run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh - name: set up cmake @@ -48,7 +48,7 @@ jobs: with: ref: ${{ matrix.branches }} - name: prerequisites - run: brew install autoconf automake libtool pkg-config curl git cmake gcc gperf texinfo yasm nasm bison autogen wget meson ninja + run: brew install autoconf automake libtool pkg-config curl git cmake gcc gperf texinfo yasm nasm bison autogen wget meson ninja ragel --overwrite - name: set up xcode run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh - name: run the build script @@ -74,7 +74,7 @@ jobs: with: ref: ${{ matrix.branches }} - name: prerequisites - run: brew install autoconf automake libtool pkg-config curl git cmake gcc gperf texinfo yasm nasm bison autogen wget meson ninja + run: brew install autoconf automake libtool pkg-config curl git cmake gcc gperf texinfo yasm nasm bison autogen wget meson ninja ragel --overwrite - name: set up xcode run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh - name: run the build script @@ -100,7 +100,7 @@ jobs: with: ref: ${{ matrix.branches }} - name: prerequisites - run: brew install autoconf automake libtool pkg-config curl git cmake gcc gperf texinfo yasm nasm bison autogen wget meson ninja + run: brew install autoconf automake libtool pkg-config curl git cmake gcc gperf texinfo yasm nasm bison autogen wget meson ninja ragel --overwrite - name: set up xcode run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh - name: run the build script @@ -126,7 +126,7 @@ jobs: with: ref: ${{ matrix.branches }} - name: prerequisites - run: brew install autoconf automake libtool pkg-config curl git cmake gcc gperf texinfo yasm nasm bison autogen wget meson ninja + run: brew install autoconf automake libtool pkg-config curl git cmake gcc gperf texinfo yasm nasm bison autogen wget meson ninja ragel --overwrite - name: set up xcode run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh - name: run the build script @@ -152,7 +152,7 @@ jobs: with: ref: ${{ matrix.branches }} - name: prerequisites - run: brew install autoconf automake libtool pkg-config curl git cmake gcc gperf texinfo yasm nasm bison autogen wget meson ninja + run: brew install autoconf automake libtool pkg-config curl git cmake gcc gperf texinfo yasm nasm bison autogen wget meson ninja ragel --overwrite - name: set up xcode run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh - name: run the build script diff --git a/.github/workflows/tvos-build-scripts.yml b/.github/workflows/tvos-build-scripts.yml index 8ef230f..a8523c7 100644 --- a/.github/workflows/tvos-build-scripts.yml +++ b/.github/workflows/tvos-build-scripts.yml @@ -5,15 +5,23 @@ on: branches: - development - main - paths-ignore: - - '**/README.md' - - 'docs/**' + paths: + - '.github/workflows/tvos-build-scripts.yml' + - 'apple/**' + - 'scripts/**' + - 'tools/**' + - 'apple.sh' + - 'tvos.sh' pull_request: branches: - main - paths-ignore: - - '**/README.md' - - 'docs/**' + paths: + - '.github/workflows/tvos-build-scripts.yml' + - 'apple/**' + - 'scripts/**' + - 'tools/**' + - 'apple.sh' + - 'tvos.sh' jobs: build-main-on-macos-bigsur: From 100787b0b8d9d4601aa1858203df76e3395f4a83 Mon Sep 17 00:00:00 2001 From: Taner Sener Date: Sun, 15 May 2022 11:08:38 +0100 Subject: [PATCH 11/18] replace jcenter with mavenCentral for android --- android/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 416b90c..338aa18 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,7 +1,7 @@ buildscript { repositories { google() - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:4.2.2' @@ -11,7 +11,7 @@ buildscript { allprojects { repositories { google() - jcenter() + mavenCentral() } } From 5f601fbac7050ea8bd761d0f73c8a669b73ec76b Mon Sep 17 00:00:00 2001 From: Taner Sener Date: Fri, 20 May 2022 17:07:09 +0100 Subject: [PATCH 12/18] do not listen ActivityEventListener methods on react native, fixes #397 --- .../FFmpegKitReactNativeModule.java | 25 ++++++------------- react-native/ios/FFmpegKitReactNativeModule.m | 6 ++++- react-native/src/index.d.ts | 2 ++ react-native/src/index.js | 9 +++++++ 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/react-native/android/src/main/java/com/arthenica/ffmpegkit/reactnative/FFmpegKitReactNativeModule.java b/react-native/android/src/main/java/com/arthenica/ffmpegkit/reactnative/FFmpegKitReactNativeModule.java index c978aa3..bccdcee 100644 --- a/react-native/android/src/main/java/com/arthenica/ffmpegkit/reactnative/FFmpegKitReactNativeModule.java +++ b/react-native/android/src/main/java/com/arthenica/ffmpegkit/reactnative/FFmpegKitReactNativeModule.java @@ -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); } diff --git a/react-native/ios/FFmpegKitReactNativeModule.m b/react-native/ios/FFmpegKitReactNativeModule.m index 9f52082..7465cda 100644 --- a/react-native/ios/FFmpegKitReactNativeModule.m +++ b/react-native/ios/FFmpegKitReactNativeModule.m @@ -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; } diff --git a/react-native/src/index.d.ts b/react-native/src/index.d.ts index 5836754..8de2b56 100644 --- a/react-native/src/index.d.ts +++ b/react-native/src/index.d.ts @@ -92,6 +92,8 @@ declare module 'ffmpeg-kit-react-native' { static init(): Promise; + static uninit(): Promise; + static enableRedirection(): Promise; static disableRedirection(): Promise; diff --git a/react-native/src/index.js b/react-native/src/index.js index 3a39aa6..e076a54 100644 --- a/react-native/src/index.js +++ b/react-native/src/index.js @@ -812,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(); + } + /** *

Enables log and statistics redirection. * From 9c894431170475a11dcef37c05912e994b49f491 Mon Sep 17 00:00:00 2001 From: Taner Sener Date: Fri, 20 May 2022 17:19:17 +0100 Subject: [PATCH 13/18] freeze v4.5.2 for react-native --- react-native/android/build.gradle | 4 ++-- react-native/package.json | 2 +- react-native/src/index.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/react-native/android/build.gradle b/react-native/android/build.gradle index e509ee4..e00921b 100644 --- a/react-native/android/build.gradle +++ b/react-native/android/build.gradle @@ -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 { diff --git a/react-native/package.json b/react-native/package.json index 7e72211..31dd84f 100644 --- a/react-native/package.json +++ b/react-native/package.json @@ -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", diff --git a/react-native/src/index.js b/react-native/src/index.js index e076a54..2d25604 100644 --- a/react-native/src/index.js +++ b/react-native/src/index.js @@ -1618,7 +1618,7 @@ class FFmpegKitFactory { } static getVersion() { - return "4.5.1"; + return "4.5.2"; } static getLogRedirectionStrategy(sessionId) { From 4f9d48fc31102feb05f75df2ed1972f6a3955b89 Mon Sep 17 00:00:00 2001 From: Taner Sener Date: Fri, 20 May 2022 23:53:00 +0100 Subject: [PATCH 14/18] update getDuration method documentation, fixes #311 --- react-native/src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-native/src/index.js b/react-native/src/index.js index 2d25604..03241f1 100644 --- a/react-native/src/index.js +++ b/react-native/src/index.js @@ -2484,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); From e8cb9abd50e42567e6b5fc876aac54d958c27a9b Mon Sep 17 00:00:00 2001 From: Taner Sener Date: Sun, 22 May 2022 15:09:53 +0100 Subject: [PATCH 15/18] fix apple github workflow builds --- .github/workflows/periodic-builds-apple.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/periodic-builds-apple.yml b/.github/workflows/periodic-builds-apple.yml index 701a91f..11048ee 100644 --- a/.github/workflows/periodic-builds-apple.yml +++ b/.github/workflows/periodic-builds-apple.yml @@ -23,10 +23,8 @@ jobs: run: brew install autoconf automake libtool pkg-config curl git cmake gcc gperf texinfo yasm nasm bison autogen wget meson ninja ragel --overwrite - name: set up xcode run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh - - name: set up cmake - run: 'cd /tmp && curl -L https://github.com/Kitware/CMake/releases/download/v3.22.3/cmake-3.22.3-macos-universal.tar.gz --output cmake.tar.gz && tar zxvf cmake.tar.gz && cd -' - name: run the build script - run: PATH="/tmp/cmake-3.22.3-macos-universal/CMake.app/Contents/bin:/usr/local/opt/bison/bin:$PATH" ./ios.sh -x --full --enable-gpl --disable-lib-srt + run: PATH="/usr/local/opt/bison/bin:$PATH" XML_CATALOG_FILES="/usr/local/etc/xml/catalog" ./ios.sh -x --full --enable-gpl --disable-lib-srt - name: print build logs if: ${{ always() }} run: cat build.log @@ -52,7 +50,7 @@ jobs: - name: set up xcode run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh - name: run the build script - run: PATH="/usr/local/opt/bison/bin:$PATH" ./ios.sh -l --full --enable-gpl --disable-lib-srt + run: PATH="/usr/local/opt/bison/bin:$PATH" XML_CATALOG_FILES="/usr/local/etc/xml/catalog" ./ios.sh -l --full --enable-gpl --disable-lib-srt - name: print build logs if: ${{ always() }} run: cat build.log @@ -78,7 +76,7 @@ jobs: - name: set up xcode run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh - name: run the build script - run: PATH="/usr/local/opt/bison/bin:$PATH" ./macos.sh -x --full --enable-gpl --disable-lib-srt + run: PATH="/usr/local/opt/bison/bin:$PATH" XML_CATALOG_FILES="/usr/local/etc/xml/catalog" ./macos.sh -x --full --enable-gpl --disable-lib-srt - name: print build logs if: ${{ always() }} run: cat build.log @@ -104,7 +102,7 @@ jobs: - name: set up xcode run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh - name: run the build script - run: PATH="/usr/local/opt/bison/bin:$PATH" ./macos.sh -l --full --enable-gpl --disable-lib-srt + run: PATH="/usr/local/opt/bison/bin:$PATH" XML_CATALOG_FILES="/usr/local/etc/xml/catalog" ./macos.sh -l --full --enable-gpl --disable-lib-srt - name: print build logs if: ${{ always() }} run: cat build.log @@ -130,7 +128,7 @@ jobs: - name: set up xcode run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh - name: run the build script - run: PATH="/usr/local/opt/bison/bin:$PATH" ./tvos.sh -x --full --enable-gpl --disable-lib-srt + run: PATH="/usr/local/opt/bison/bin:$PATH" XML_CATALOG_FILES="/usr/local/etc/xml/catalog" ./tvos.sh -x --full --enable-gpl --disable-lib-srt - name: print build logs if: ${{ always() }} run: cat build.log @@ -156,7 +154,7 @@ jobs: - name: set up xcode run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh - name: run the build script - run: PATH="/usr/local/opt/bison/bin:$PATH" ./tvos.sh -l --full --enable-gpl --disable-lib-srt + run: PATH="/usr/local/opt/bison/bin:$PATH" XML_CATALOG_FILES="/usr/local/etc/xml/catalog" ./tvos.sh -l --full --enable-gpl --disable-lib-srt - name: print build logs if: ${{ always() }} run: cat build.log From 31fd50e5fe149c9b7969a2363cb418f0d8e0677d Mon Sep 17 00:00:00 2001 From: Taner Sener Date: Wed, 1 Jun 2022 00:06:46 +0100 Subject: [PATCH 16/18] update versions table --- README.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 8949e56..67eae8b 100644 --- a/README.md +++ b/README.md @@ -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/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
Apple | [4.5](https://github.com/tanersener/ffmpeg-kit/releases/tag/v4.5) | 4.5-dev-2008 | Sep 18, 2021 | -| Android
Apple | [4.4](https://github.com/tanersener/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
Apple | [4.5](https://github.com/tanersener/ffmpeg-kit/releases/tag/v4.5) | 4.5-dev-2008 | Sep 18, 2021 | +| Android
Apple | [4.4](https://github.com/tanersener/ffmpeg-kit/releases/tag/v4.4) | 4.4-dev-3015 | Mar 03, 2021 | ### 10. LTS Releases From 51db78e4048cd0eb0273972acd63885758e615f0 Mon Sep 17 00:00:00 2001 From: Taner Sener Date: Sat, 11 Jun 2022 09:44:24 +0100 Subject: [PATCH 17/18] update stale bot settings --- .github/workflows/stale.yml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 0ca8c1a..171bb10 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -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 \ No newline at end of file From f72051403b2e06d5a34a33b05cec806055ba60bf Mon Sep 17 00:00:00 2001 From: Taner Sener Date: Thu, 18 Aug 2022 23:02:23 +0100 Subject: [PATCH 18/18] enable pr builds for development branch --- .github/workflows/android-build-scripts.yml | 1 + .github/workflows/ios-build-scripts.yml | 1 + .github/workflows/macos-build-scripts.yml | 1 + .github/workflows/tvos-build-scripts.yml | 1 + 4 files changed, 4 insertions(+) diff --git a/.github/workflows/android-build-scripts.yml b/.github/workflows/android-build-scripts.yml index c5ca558..f621ae4 100644 --- a/.github/workflows/android-build-scripts.yml +++ b/.github/workflows/android-build-scripts.yml @@ -13,6 +13,7 @@ on: - 'android.sh' pull_request: branches: + - development - main paths: - '.github/workflows/android-build-scripts.yml' diff --git a/.github/workflows/ios-build-scripts.yml b/.github/workflows/ios-build-scripts.yml index 3d2f0f6..1e3d869 100644 --- a/.github/workflows/ios-build-scripts.yml +++ b/.github/workflows/ios-build-scripts.yml @@ -14,6 +14,7 @@ on: - 'ios.sh' pull_request: branches: + - development - main paths: - '.github/workflows/ios-build-scripts.yml' diff --git a/.github/workflows/macos-build-scripts.yml b/.github/workflows/macos-build-scripts.yml index 39d7e55..9fcb573 100644 --- a/.github/workflows/macos-build-scripts.yml +++ b/.github/workflows/macos-build-scripts.yml @@ -14,6 +14,7 @@ on: - 'macos.sh' pull_request: branches: + - development - main paths: - '.github/workflows/macos-build-scripts.yml' diff --git a/.github/workflows/tvos-build-scripts.yml b/.github/workflows/tvos-build-scripts.yml index a8523c7..841688a 100644 --- a/.github/workflows/tvos-build-scripts.yml +++ b/.github/workflows/tvos-build-scripts.yml @@ -14,6 +14,7 @@ on: - 'tvos.sh' pull_request: branches: + - development - main paths: - '.github/workflows/tvos-build-scripts.yml'