Merge pull request #172 from tanersener/development

Support Xcode 13
pull/179/head
Taner Şener 4 years ago committed by GitHub
commit 21eaa9a729
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 35
      android/README.md
  2. 34
      apple/README.md
  3. 16
      scripts/function-apple.sh
  4. 6
      scripts/function-ios.sh
  5. 2
      scripts/function-macos.sh
  6. 2
      scripts/function-tvos.sh

@ -71,7 +71,7 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
`ffmpeg-kit-<package name>` pattern. Use one of the `FFmpegKit` package names given in the `ffmpeg-kit-<package name>` pattern. Use one of the `FFmpegKit` package names given in the
project [README](https://github.com/tanersener/ffmpeg-kit). project [README](https://github.com/tanersener/ffmpeg-kit).
``` ```yaml
repositories { repositories {
mavenCentral() mavenCentral()
} }
@ -83,9 +83,8 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
2. Execute synchronous `FFmpeg` commands. 2. Execute synchronous `FFmpeg` commands.
``` ```java
import com.arthenica.ffmpegkit.FFmpegKit; import com.arthenica.ffmpegkit.FFmpegKit;
import com.arthenica.ffmpegkit.ReturnCode;
FFmpegSession session = FFmpegKit.execute("-i file1.mp4 -c:v mpeg4 file2.mp4"); FFmpegSession session = FFmpegKit.execute("-i file1.mp4 -c:v mpeg4 file2.mp4");
if (ReturnCode.isSuccess(session.getReturnCode())) { if (ReturnCode.isSuccess(session.getReturnCode())) {
@ -107,7 +106,7 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
3. Each `execute` call (sync or async) creates a new session. Access every detail about your execution from the 3. Each `execute` call (sync or async) creates a new session. Access every detail about your execution from the
session created. session created.
``` ```java
FFmpegSession session = FFmpegKit.execute("-i file1.mp4 -c:v mpeg4 file2.mp4"); FFmpegSession session = FFmpegKit.execute("-i file1.mp4 -c:v mpeg4 file2.mp4");
// Unique session id created for this execution // Unique session id created for this execution
@ -144,7 +143,7 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
4. Execute asynchronous `FFmpeg` commands by providing session specific `execute`/`log`/`session` callbacks. 4. Execute asynchronous `FFmpeg` commands by providing session specific `execute`/`log`/`session` callbacks.
``` ```java
FFmpegKit.executeAsync("-i file1.mp4 -c:v mpeg4 file2.mp4", new ExecuteCallback() { FFmpegKit.executeAsync("-i file1.mp4 -c:v mpeg4 file2.mp4", new ExecuteCallback() {
@Override @Override
@ -179,7 +178,7 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
- Synchronous - Synchronous
``` ```java
FFprobeSession session = FFprobeKit.execute(ffprobeCommand); FFprobeSession session = FFprobeKit.execute(ffprobeCommand);
if (!ReturnCode.isSuccess(session.getReturnCode())) { if (!ReturnCode.isSuccess(session.getReturnCode())) {
@ -189,7 +188,7 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
- Asynchronous - Asynchronous
``` ```java
FFprobeKit.executeAsync(ffprobeCommand, new ExecuteCallback() { FFprobeKit.executeAsync(ffprobeCommand, new ExecuteCallback() {
@Override @Override
@ -203,7 +202,7 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
6. Get media information for a file. 6. Get media information for a file.
``` ```java
MediaInformationSession mediaInformation = FFprobeKit.getMediaInformation("<file path or uri>"); MediaInformationSession mediaInformation = FFprobeKit.getMediaInformation("<file path or uri>");
mediaInformation.getMediaInformation(); mediaInformation.getMediaInformation();
``` ```
@ -211,18 +210,18 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
7. Stop ongoing `FFmpeg` operations. 7. Stop ongoing `FFmpeg` operations.
- Stop all executions - Stop all executions
``` ```java
FFmpegKit.cancel(); FFmpegKit.cancel();
``` ```
- Stop a specific session - Stop a specific session
``` ```java
FFmpegKit.cancel(sessionId); FFmpegKit.cancel(sessionId);
``` ```
8. Convert Storage Access Framework (SAF) Uris into paths that can be read or written by `FFmpegKit`. 8. Convert Storage Access Framework (SAF) Uris into paths that can be read or written by `FFmpegKit`.
- Reading a file: - Reading a file:
``` ```java
Uri safUri = intent.getData(); Uri safUri = intent.getData();
String inputVideoPath = FFmpegKitConfig.getSafParameterForRead(requireContext(), safUri); String inputVideoPath = FFmpegKitConfig.getSafParameterForRead(requireContext(), safUri);
FFmpegKit.execute("-i " + inputVideoPath + " -c:v mpeg4 file2.mp4"); FFmpegKit.execute("-i " + inputVideoPath + " -c:v mpeg4 file2.mp4");
@ -230,7 +229,7 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
- Writing to a file: - Writing to a file:
``` ```java
Uri safUri = intent.getData(); Uri safUri = intent.getData();
String outputVideoPath = FFmpegKitConfig.getSafParameterForWrite(requireContext(), safUri); String outputVideoPath = FFmpegKitConfig.getSafParameterForWrite(requireContext(), safUri);
FFmpegKit.execute("-i file1.mp4 -c:v mpeg4 " + outputVideoPath); FFmpegKit.execute("-i file1.mp4 -c:v mpeg4 " + outputVideoPath);
@ -238,7 +237,7 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
9. Get previous `FFmpeg` and `FFprobe` sessions from session history. 9. Get previous `FFmpeg` and `FFprobe` sessions from session history.
``` ```java
List<Session> sessions = FFmpegKitConfig.getSessions(); List<Session> sessions = FFmpegKitConfig.getSessions();
for (int i = 0; i < sessions.size(); i++) { for (int i = 0; i < sessions.size(); i++) {
Session session = sessions.get(i); Session session = sessions.get(i);
@ -256,7 +255,7 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
- Execute Callback, called when an async execution is ended - Execute Callback, called when an async execution is ended
``` ```java
FFmpegKitConfig.enableExecuteCallback(new ExecuteCallback() { FFmpegKitConfig.enableExecuteCallback(new ExecuteCallback() {
@Override @Override
@ -268,7 +267,7 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
- Log Callback, called when a session generates logs - Log Callback, called when a session generates logs
``` ```java
FFmpegKitConfig.enableLogCallback(new LogCallback() { FFmpegKitConfig.enableLogCallback(new LogCallback() {
@Override @Override
@ -280,7 +279,7 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
- Statistics Callback, called when a session generates statistics - Statistics Callback, called when a session generates statistics
``` ```java
FFmpegKitConfig.enableStatisticsCallback(new StatisticsCallback() { FFmpegKitConfig.enableStatisticsCallback(new StatisticsCallback() {
@Override @Override
@ -292,13 +291,13 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
11. Ignore the handling of a signal. Required by `Mono` and frameworks that use `Mono`, e.g. `Unity` and `Xamarin`. 11. Ignore the handling of a signal. Required by `Mono` and frameworks that use `Mono`, e.g. `Unity` and `Xamarin`.
``` ```java
FFmpegKitConfig.ignoreSignal(Signal.SIGXCPU); FFmpegKitConfig.ignoreSignal(Signal.SIGXCPU);
``` ```
12. Register system fonts and custom font directories. 12. Register system fonts and custom font directories.
``` ```java
FFmpegKitConfig.setFontDirectoryList(context, Arrays.asList("/system/fonts", "<folder with fonts>"), Collections.EMPTY_MAP); FFmpegKitConfig.setFontDirectoryList(context, Arrays.asList("/system/fonts", "<folder with fonts>"), Collections.EMPTY_MAP);
``` ```

@ -113,23 +113,23 @@ All libraries created can be found under the `prebuilt` directory.
`FFmpegKit` package names given in the project [README](https://github.com/tanersener/ffmpeg-kit). `FFmpegKit` package names given in the project [README](https://github.com/tanersener/ffmpeg-kit).
- iOS - iOS
``` ```yaml
pod 'ffmpeg-kit-ios-full', '~> 4.5' pod 'ffmpeg-kit-ios-full', '~> 4.5'
``` ```
- macOS - macOS
``` ```yaml
pod 'ffmpeg-kit-macos-full', '~> 4.5' pod 'ffmpeg-kit-macos-full', '~> 4.5'
``` ```
- tvOS - tvOS
``` ```yaml
pod 'ffmpeg-kit-tvos-full', '~> 4.5' pod 'ffmpeg-kit-tvos-full', '~> 4.5'
``` ```
2. Execute synchronous `FFmpeg` commands. 2. Execute synchronous `FFmpeg` commands.
``` ```objectivec
#include <ffmpegkit/FFmpegKit.h> #include <ffmpegkit/FFmpegKit.h>
FFmpegSession *session = [FFmpegKit execute:@"-i file1.mp4 -c:v mpeg4 file2.mp4"]; FFmpegSession *session = [FFmpegKit execute:@"-i file1.mp4 -c:v mpeg4 file2.mp4"];
@ -153,7 +153,7 @@ All libraries created can be found under the `prebuilt` directory.
3. Each `execute` call (sync or async) creates a new session. Access every detail about your execution from the 3. Each `execute` call (sync or async) creates a new session. Access every detail about your execution from the
session created. session created.
``` ```objectivec
FFmpegSession *session = [FFmpegKit execute:@"-i file1.mp4 -c:v mpeg4 file2.mp4"]; FFmpegSession *session = [FFmpegKit execute:@"-i file1.mp4 -c:v mpeg4 file2.mp4"];
// Unique session id created for this execution // Unique session id created for this execution
@ -190,7 +190,7 @@ All libraries created can be found under the `prebuilt` directory.
4. Execute asynchronous `FFmpeg` commands by providing session specific `execute`/`log`/`session` callbacks. 4. Execute asynchronous `FFmpeg` commands by providing session specific `execute`/`log`/`session` callbacks.
``` ```objectivec
id<Session> session = [FFmpegKit executeAsync:@"-i file1.mp4 -c:v mpeg4 file2.mp4" withExecuteCallback:^(id<Session> session){ id<Session> session = [FFmpegKit executeAsync:@"-i file1.mp4 -c:v mpeg4 file2.mp4" withExecuteCallback:^(id<Session> session){
SessionState state = [session getState]; SessionState state = [session getState];
ReturnCode *returnCode = [session getReturnCode]; ReturnCode *returnCode = [session getReturnCode];
@ -214,7 +214,7 @@ All libraries created can be found under the `prebuilt` directory.
- Synchronous - Synchronous
``` ```objectivec
FFprobeSession *session = [FFprobeKit execute:ffprobeCommand]; FFprobeSession *session = [FFprobeKit execute:ffprobeCommand];
if ([ReturnCode isSuccess:[session getReturnCode]]) { if ([ReturnCode isSuccess:[session getReturnCode]]) {
@ -224,7 +224,7 @@ All libraries created can be found under the `prebuilt` directory.
- Asynchronous - Asynchronous
``` ```objectivec
[FFprobeKit executeAsync:ffmpegCommand withExecuteCallback:^(id<Session> session) { [FFprobeKit executeAsync:ffmpegCommand withExecuteCallback:^(id<Session> session) {
CALLED WHEN SESSION IS EXECUTED CALLED WHEN SESSION IS EXECUTED
@ -234,7 +234,7 @@ All libraries created can be found under the `prebuilt` directory.
6. Get media information for a file. 6. Get media information for a file.
``` ```objectivec
MediaInformationSession *mediaInformation = [FFprobeKit getMediaInformation:"<file path or uri>"]; MediaInformationSession *mediaInformation = [FFprobeKit getMediaInformation:"<file path or uri>"];
MediaInformation *mediaInformation =[mediaInformation getMediaInformation]; MediaInformation *mediaInformation =[mediaInformation getMediaInformation];
``` ```
@ -242,17 +242,17 @@ All libraries created can be found under the `prebuilt` directory.
7. Stop ongoing `FFmpeg` operations. 7. Stop ongoing `FFmpeg` operations.
- Stop all executions - Stop all executions
``` ```objectivec
[FFmpegKit cancel]; [FFmpegKit cancel];
``` ```
- Stop a specific session - Stop a specific session
``` ```objectivec
[FFmpegKit cancel:sessionId]; [FFmpegKit cancel:sessionId];
``` ```
8. Get previous `FFmpeg` and `FFprobe` sessions from session history. 8. Get previous `FFmpeg` and `FFprobe` sessions from session history.
``` ```objectivec
NSArray* sessions = [FFmpegKitConfig getSessions]; NSArray* sessions = [FFmpegKitConfig getSessions];
for (int i = 0; i < [sessions count]; i++) { for (int i = 0; i < [sessions count]; i++) {
id<Session> session = [sessions objectAtIndex:i]; id<Session> session = [sessions objectAtIndex:i];
@ -270,7 +270,7 @@ All libraries created can be found under the `prebuilt` directory.
- Execute Callback, called when an async execution is ended - Execute Callback, called when an async execution is ended
``` ```objectivec
[FFmpegKitConfig enableExecuteCallback:^(id<Session> session) { [FFmpegKitConfig enableExecuteCallback:^(id<Session> session) {
... ...
}]; }];
@ -278,7 +278,7 @@ All libraries created can be found under the `prebuilt` directory.
- Log Callback, called when a session generates logs - Log Callback, called when a session generates logs
``` ```objectivec
[FFmpegKitConfig enableLogCallback:^(Log *log) { [FFmpegKitConfig enableLogCallback:^(Log *log) {
... ...
}]; }];
@ -286,7 +286,7 @@ All libraries created can be found under the `prebuilt` directory.
- Statistics Callback, called when a session generates statistics - Statistics Callback, called when a session generates statistics
``` ```objectivec
[FFmpegKitConfig enableStatisticsCallback:^(Statistics *statistics) { [FFmpegKitConfig enableStatisticsCallback:^(Statistics *statistics) {
... ...
}]; }];
@ -294,13 +294,13 @@ All libraries created can be found under the `prebuilt` directory.
10. Ignore the handling of a signal. Required by `Mono` and frameworks that use `Mono`, e.g. `Unity` and `Xamarin`. 10. Ignore the handling of a signal. Required by `Mono` and frameworks that use `Mono`, e.g. `Unity` and `Xamarin`.
``` ```objectivec
[FFmpegKitConfig ignoreSignal:SIGXCPU]; [FFmpegKitConfig ignoreSignal:SIGXCPU];
``` ```
11. Register system fonts and custom font directories. 11. Register system fonts and custom font directories.
``` ```objectivec
[FFmpegKitConfig setFontDirectoryList:[NSArray arrayWithObjects:@"/System/Library/Fonts", @"<folder with fonts>", nil] with:nil]; [FFmpegKitConfig setFontDirectoryList:[NSArray arrayWithObjects:@"/System/Library/Fonts", @"<folder with fonts>", nil] with:nil];
``` ```

@ -30,8 +30,8 @@ disable_ios_architecture_not_supported_on_detected_sdk_version() {
case ${ARCH_NAME} in case ${ARCH_NAME} in
armv7 | armv7s | i386) armv7 | armv7s | i386)
# SUPPORTED UNTIL IOS SDK 10 # SUPPORTED UNTIL IOS SDK 10.3.1
if [[ $2 == 11* ]] || [[ $2 == 12* ]] || [[ $2 == 13* ]] || [[ $2 == 14* ]]; then if [[ $(echo "$2 > 10.4" | bc) -eq 1 ]]; then
local SUPPORTED=0 local SUPPORTED=0
else else
local SUPPORTED=1 local SUPPORTED=1
@ -39,8 +39,8 @@ disable_ios_architecture_not_supported_on_detected_sdk_version() {
;; ;;
arm64e) arm64e)
# INTRODUCED IN IOS SDK 10 # INTRODUCED IN IOS SDK 10.1
if [[ $2 == 10* ]] || [[ $2 == 11* ]] || [[ $2 == 12* ]] || [[ $2 == 13* ]] || [[ $2 == 14* ]]; then if [[ $(echo "$2 > 10" | bc) -eq 1 ]]; then
local SUPPORTED=1 local SUPPORTED=1
else else
local SUPPORTED=0 local SUPPORTED=0
@ -49,7 +49,7 @@ disable_ios_architecture_not_supported_on_detected_sdk_version() {
x86-64-mac-catalyst) x86-64-mac-catalyst)
# INTRODUCED IN IOS SDK 13 # INTRODUCED IN IOS SDK 13
if [[ $2 == 13* ]] || [[ $2 == 14* ]]; then if [[ $(echo "$2 > 12.4" | bc) -eq 1 ]]; then
local SUPPORTED=1 local SUPPORTED=1
else else
local SUPPORTED=0 local SUPPORTED=0
@ -58,7 +58,7 @@ disable_ios_architecture_not_supported_on_detected_sdk_version() {
arm64-*) arm64-*)
# INTRODUCED IN IOS SDK 14 # INTRODUCED IN IOS SDK 14
if [[ $2 == 14* ]]; then if [[ $(echo "$2 > 13.7" | bc) -eq 1 ]]; then
local SUPPORTED=1 local SUPPORTED=1
else else
local SUPPORTED=0 local SUPPORTED=0
@ -88,7 +88,7 @@ disable_tvos_architecture_not_supported_on_detected_sdk_version() {
arm64-simulator) arm64-simulator)
# INTRODUCED IN TVOS SDK 14 # INTRODUCED IN TVOS SDK 14
if [[ $2 == 14* ]]; then if [[ $(echo "$2 > 13.4" | bc) -eq 1 ]]; then
local SUPPORTED=1 local SUPPORTED=1
else else
local SUPPORTED=0 local SUPPORTED=0
@ -118,7 +118,7 @@ disable_macos_architecture_not_supported_on_detected_sdk_version() {
arm64) arm64)
# INTRODUCED IN MACOS SDK 11 # INTRODUCED IN MACOS SDK 11
if [[ $2 == 11* ]]; then if [[ $(echo "$2 > 10.16" | bc) -eq 1 ]]; then
local SUPPORTED=1 local SUPPORTED=1
else else
local SUPPORTED=0 local SUPPORTED=0

@ -119,13 +119,13 @@ get_arch_specific_cflags() {
echo "-arch arm64e -target $(get_target) -march=armv8.3-a+crc+crypto -mcpu=generic -DFFMPEG_KIT_ARM64E" echo "-arch arm64e -target $(get_target) -march=armv8.3-a+crc+crypto -mcpu=generic -DFFMPEG_KIT_ARM64E"
;; ;;
i386) i386)
echo "-arch i386 -target $(get_target) -march=i386 -mtune=intel -mssse3 -mfpmath=sse -m32 -DFFMPEG_KIT_I386" echo "-arch i386 -target $(get_target) -march=i386 -mssse3 -mfpmath=sse -m32 -DFFMPEG_KIT_I386"
;; ;;
x86-64) x86-64)
echo "-arch x86_64 -target $(get_target) -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel -DFFMPEG_KIT_X86_64" echo "-arch x86_64 -target $(get_target) -march=x86-64 -msse4.2 -mpopcnt -m64 -DFFMPEG_KIT_X86_64"
;; ;;
x86-64-mac-catalyst) x86-64-mac-catalyst)
echo "-arch x86_64 -target $(get_target) -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel -DFFMPEG_KIT_X86_64_MAC_CATALYST -isysroot ${SDK_PATH} -isystem ${SDK_PATH}/System/iOSSupport/usr/include -iframework ${SDK_PATH}/System/iOSSupport/System/Library/Frameworks" echo "-arch x86_64 -target $(get_target) -march=x86-64 -msse4.2 -mpopcnt -m64 -DFFMPEG_KIT_X86_64_MAC_CATALYST -isysroot ${SDK_PATH} -isystem ${SDK_PATH}/System/iOSSupport/usr/include -iframework ${SDK_PATH}/System/iOSSupport/System/Library/Frameworks"
;; ;;
esac esac
} }

@ -84,7 +84,7 @@ get_arch_specific_cflags() {
echo "-arch arm64 -target $(get_target) -march=armv8-a+crc+crypto -mcpu=generic -DFFMPEG_KIT_ARM64" echo "-arch arm64 -target $(get_target) -march=armv8-a+crc+crypto -mcpu=generic -DFFMPEG_KIT_ARM64"
;; ;;
x86-64) x86-64)
echo "-arch x86_64 -target $(get_target) -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel -DFFMPEG_KIT_X86_64" echo "-arch x86_64 -target $(get_target) -march=x86-64 -msse4.2 -mpopcnt -m64 -DFFMPEG_KIT_X86_64"
;; ;;
esac esac
} }

@ -90,7 +90,7 @@ get_arch_specific_cflags() {
echo "-arch arm64 -target $(get_target) -march=armv8-a+crc+crypto -mcpu=generic -DFFMPEG_KIT_ARM64_SIMULATOR" echo "-arch arm64 -target $(get_target) -march=armv8-a+crc+crypto -mcpu=generic -DFFMPEG_KIT_ARM64_SIMULATOR"
;; ;;
x86-64) x86-64)
echo "-arch x86_64 -target $(get_target) -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel -DFFMPEG_KIT_X86_64" echo "-arch x86_64 -target $(get_target) -march=x86-64 -msse4.2 -mpopcnt -m64 -DFFMPEG_KIT_X86_64"
;; ;;
esac esac
} }

Loading…
Cancel
Save