Skip to content

Commit

Permalink
add support for zimg openssl and srt, fixes #28 and #241
Browse files Browse the repository at this point in the history
  • Loading branch information
tanersener committed Dec 28, 2021
1 parent 38d88e0 commit 56a5206
Show file tree
Hide file tree
Showing 68 changed files with 680 additions and 275 deletions.
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,25 +137,25 @@ indicates that `FFmpeg` source code is cloned from the `FFmpeg` `master` branch.

This table shows the differences between two variants.

| | Main Release | LTS Release |
| :----: | :----: | :----: |
| Android API Level | 24 | 16 |
| Android Camera Access | Yes | - |
| | Main Release | LTS Release |
| :----: | :----: |:---------------------------------------------------------:|
| Android API Level | 24 | 16 |
| Android Camera Access | Yes | - |
| Android Architectures | arm-v7a-neon<br/>arm64-v8a<br/>x86<br/>x86-64 | arm-v7a<br/>arm-v7a-neon<br/>arm64-v8a<br/>x86<br/>x86-64 |
| iOS Min SDK | 12.1 | 9.3 |
| iOS VideoToolbox | Yes | - |
| iOS AVFoundation | Yes | - |
| iOS Architectures | arm64<br/>arm64-simulator<br/>arm64-mac-catalyst<br/>x86-64<br/>x86-64-mac-catalyst | armv7<br/>arm64<br/>i386<br/>x86-64 |
| iOS Bundle Format | XCFrameworks | Frameworks |
| Mac Catalyst Min Version | 14.0 | - |
| macOS Min SDK | 10.15 | 10.11 |
| macOS AVFoundation | Yes | - |
| macOS Architectures | arm64<br/>x86-64 | x86-64 |
| macOS Bundle Format | XCFrameworks | Frameworks |
| tvOS Min SDK | 11.0 | 9.2 |
| tvOS VideoToolbox | Yes | - |
| tvOS Architectures | arm64<br/>x86-64<br/>arm64-simulator | arm64<br/>x86-64 |
| tvOS Bundle Format | XCFrameworks | Frameworks |
| iOS Min SDK | 12.1 | 10 |
| iOS VideoToolbox | Yes | - |
| iOS AVFoundation | Yes | - |
| iOS Architectures | arm64<br/>arm64-simulator<br/>arm64-mac-catalyst<br/>x86-64<br/>x86-64-mac-catalyst | armv7<br/>arm64<br/>i386<br/>x86-64 |
| iOS Bundle Format | XCFrameworks | Frameworks |
| Mac Catalyst Min Version | 14.0 | - |
| macOS Min SDK | 10.15 | 10.12 |
| macOS AVFoundation | Yes | - |
| macOS Architectures | arm64<br/>x86-64 | x86-64 |
| macOS Bundle Format | XCFrameworks | Frameworks |
| tvOS Min SDK | 11.0 | 10.0 |
| tvOS VideoToolbox | Yes | - |
| tvOS Architectures | arm64<br/>x86-64<br/>arm64-simulator | arm64<br/>x86-64 |
| tvOS Bundle Format | XCFrameworks | Frameworks |

### 11. Documentation

Expand Down
6 changes: 3 additions & 3 deletions android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ fi

# PROCESS FULL OPTION AS LAST OPTION
if [[ -n ${BUILD_FULL} ]]; then
for library in {0..58}; do
for library in {0..61}; do
if [ ${GPL_ENABLED} == "yes" ]; then
enable_library "$(get_library_name $library)" 1
else
Expand Down Expand Up @@ -214,7 +214,7 @@ for run_arch in {0..12}; do
. "${BASEDIR}"/scripts/main-android.sh "${ENABLED_LIBRARIES[@]}" || exit 1

# CLEAR FLAGS
for library in {0..58}; do
for library in {0..61}; do
library_name=$(get_library_name ${library})
unset "$(echo "OK_${library_name}" | sed "s/\-/\_/g")"
unset "$(echo "DEPENDENCY_REBUILT_${library_name}" | sed "s/\-/\_/g")"
Expand Down Expand Up @@ -272,7 +272,7 @@ if [[ -n ${ANDROID_ARCHITECTURES} ]]; then
# COPY LICENSES
LICENSE_BASEDIR="${BASEDIR}"/android/ffmpeg-kit-android-lib/src/main/res/raw
rm -f "${LICENSE_BASEDIR}"/*.txt 1>>"${BASEDIR}"/build.log 2>&1 || exit 1
for library in {0..46}; do
for library in {0..49}; do
if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then
ENABLED_LIBRARY=$(get_library_name ${library} | sed 's/-/_/g')
LICENSE_FILE="${LICENSE_BASEDIR}/license_${ENABLED_LIBRARY}.txt"
Expand Down
4 changes: 2 additions & 2 deletions android/ffmpeg-kit-android-lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ task javadoc(type: Javadoc) {
}

dependencies {
implementation 'com.arthenica:smart-exception-java:0.1.0'
testImplementation "androidx.test.ext:junit:1.1.2"
implementation 'com.arthenica:smart-exception-java:0.1.1'
testImplementation "androidx.test.ext:junit:1.1.3"
testImplementation "org.json:json:20201115"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Locale;

/**
* <p>Responsible of loading native libraries.
Expand All @@ -35,6 +36,8 @@ public class NativeLoader {

static final String[] FFMPEG_LIBRARIES = {"avutil", "swscale", "swresample", "avcodec", "avformat", "avfilter", "avdevice"};

static final String[] LIBRARIES_LINKED_WITH_CXX = {"openh264", "rubberband", "snappy", "srt", "tesseract", "x265", "zimg"};

static boolean isTestModeDisabled() {
return (System.getProperty("enable.ffmpeg.kit.test.mode") == null);
}
Expand Down Expand Up @@ -113,7 +116,7 @@ static String loadBuildDate() {
if (isTestModeDisabled()) {
return FFmpegKitConfig.getBuildDate();
} else {
return new SimpleDateFormat("yyyyMMdd").format(new Date());
return new SimpleDateFormat("yyyyMMdd", Locale.getDefault()).format(new Date());
}
}

Expand All @@ -135,8 +138,11 @@ static boolean loadFFmpeg() {

/* LOADING LINKED LIBRARIES MANUALLY ON API < 21 */
final List<String> externalLibrariesEnabled = loadExternalLibraries();
if (externalLibrariesEnabled.contains("tesseract") || externalLibrariesEnabled.contains("x265") || externalLibrariesEnabled.contains("snappy") || externalLibrariesEnabled.contains("openh264") || externalLibrariesEnabled.contains("rubberband")) {
loadLibrary("c++_shared");
for (String dependantLibrary : LIBRARIES_LINKED_WITH_CXX) {
if (externalLibrariesEnabled.contains(dependantLibrary)) {
loadLibrary("c++_shared");
break;
}
}

if (AbiDetect.ARM_V7A.equals(loadNativeAbi())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,21 @@ public class Packages {
supportedExternalLibraries.add("libxml2");
supportedExternalLibraries.add("opencore-amr");
supportedExternalLibraries.add("openh264");
supportedExternalLibraries.add("openssl");
supportedExternalLibraries.add("opus");
supportedExternalLibraries.add("rubberband");
supportedExternalLibraries.add("sdl2");
supportedExternalLibraries.add("shine");
supportedExternalLibraries.add("snappy");
supportedExternalLibraries.add("soxr");
supportedExternalLibraries.add("speex");
supportedExternalLibraries.add("srt");
supportedExternalLibraries.add("tesseract");
supportedExternalLibraries.add("twolame");
supportedExternalLibraries.add("x264");
supportedExternalLibraries.add("x265");
supportedExternalLibraries.add("xvid");
supportedExternalLibraries.add("zimg");
}

/**
Expand Down Expand Up @@ -134,7 +137,8 @@ public static String getPackageName() {
externalLibraryList.contains("twolame") &&
externalLibraryList.contains("x264") &&
externalLibraryList.contains("x265") &&
externalLibraryList.contains("xvid")) {
externalLibraryList.contains("xvid") &&
externalLibraryList.contains("zimg")) {
return "full-gpl";
} else {
return "custom";
Expand Down Expand Up @@ -164,7 +168,8 @@ public static String getPackageName() {
externalLibraryList.contains("snappy") &&
externalLibraryList.contains("soxr") &&
externalLibraryList.contains("speex") &&
externalLibraryList.contains("twolame")) {
externalLibraryList.contains("twolame") &&
externalLibraryList.contains("zimg")) {
return "full";
} else {
return "custom";
Expand All @@ -182,7 +187,8 @@ public static String getPackageName() {
externalLibraryList.contains("libtheora") &&
externalLibraryList.contains("libvpx") &&
externalLibraryList.contains("libwebp") &&
externalLibraryList.contains("snappy")) {
externalLibraryList.contains("snappy") &&
externalLibraryList.contains("zimg")) {
return "video";
} else {
return "custom";
Expand Down
46 changes: 5 additions & 41 deletions apple.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,18 @@ After that this script should be used to create an umbrella xcframework.\n"
echo -e " --enable-libxml2\t\tbuild umbrella xcframework for libxml2 [no]"
echo -e " --enable-opencore-amr\t\tbuild umbrella xcframework for opencore-amr [no]"
echo -e " --enable-openh264\t\tbuild umbrella xcframework for openh264 [no]"
echo -e " --enable-openssl\t\tbuild umbrella xcframework for openssl [no]"
echo -e " --enable-opus\t\t\tbuild umbrella xcframework for opus [no]"
echo -e " --enable-sdl\t\t\tbuild umbrella xcframework for sdl [no]"
echo -e " --enable-shine\t\tbuild umbrella xcframework for shine [no]"
echo -e " --enable-snappy\t\tbuild umbrella xcframework for snappy [no]"
echo -e " --enable-soxr\t\t\tbuild umbrella xcframework for soxr [no]"
echo -e " --enable-speex\t\tbuild umbrella xcframework for speex [no]"
echo -e " --enable-srt\t\t\tbuild umbrella xcframework for srt [no]"
echo -e " --enable-tesseract\t\tbuild umbrella xcframework for tesseract [no]"
echo -e " --enable-twolame\t\tbuild umbrella xcframework for twolame [no]"
echo -e " --enable-vo-amrwbenc\t\tbuild umbrella xcframework for vo-amrwbenc [no]\n"
echo -e " --enable-vo-amrwbenc\t\tbuild umbrella xcframework for vo-amrwbenc [no]"
echo -e " --enable-zimg\t\t\tbuild umbrella xcframework for zimg [no]\n"

echo -e "GPL libraries:"
echo -e " --enable-libvidstab\t\tbuild umbrella xcframework for libvidstab [no]"
Expand Down Expand Up @@ -244,7 +247,7 @@ done

# PROCESS FULL OPTION AS LAST OPTION
if [[ -n ${BUILD_FULL} ]]; then
for library in {0..58}; do
for library in {0..61}; do
if [ ${GPL_ENABLED} == "yes" ]; then
set_library "$(get_library_name "$library")" 1
else
Expand Down Expand Up @@ -309,45 +312,6 @@ if [[ -n ${TARGET_ARCHITECTURE_VARIANT_INDEX_ARRAY[0]} ]]; then
# INITIALIZE TARGET FOLDERS
initialize_prebuilt_umbrella_xcframework_folders

# BUILD XCFRAMEWORKS FOR ENABLED LIBRARIES ON ENABLED ARCHITECTURE VARIANTS
for library in {0..46}; do
if [[ ${ENABLED_LIBRARIES[${library}]} -eq 1 ]]; then

if [[ ${LIBRARY_LIBTHEORA} == "${library}" ]]; then

create_umbrella_xcframework "libtheora"
create_umbrella_xcframework "libtheoraenc"
create_umbrella_xcframework "libtheoradec"

elif [[ ${LIBRARY_LIBVORBIS} == "${library}" ]]; then

create_umbrella_xcframework "libvorbisfile"
create_umbrella_xcframework "libvorbisenc"
create_umbrella_xcframework "libvorbis"

elif [[ ${LIBRARY_LIBWEBP} == "${library}" ]]; then

create_umbrella_xcframework "libwebpmux"
create_umbrella_xcframework "libwebpdemux"
create_umbrella_xcframework "libwebp"

elif [[ ${LIBRARY_OPENCOREAMR} == "${library}" ]]; then

create_umbrella_xcframework "libopencore-amrnb"

elif [[ ${LIBRARY_NETTLE} == "${library}" ]]; then

create_umbrella_xcframework "libnettle"
create_umbrella_xcframework "libhogweed"

else

create_umbrella_xcframework "$(get_static_archive_name "${library}")"

fi
fi
done

for FFMPEG_LIB in "${FFMPEG_LIBS[@]}"; do
create_umbrella_xcframework "${FFMPEG_LIB}"
done
Expand Down
28 changes: 14 additions & 14 deletions apple/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,36 @@

### 1. Features
#### 1.1 iOS
- Supports `iOS SDK 12.1+` on Main releases and `iOS SDK 9.3+` on LTS releases
- Supports `iOS SDK 12.1+` on Main releases and `iOS SDK 10+` on LTS releases
- Includes `armv7`, `armv7s`, `arm64`, `arm64-simulator`, `arm64e`, `i386`, `x86_64`, `x86_64-mac-catalyst` and
`arm64-mac-catalyst` architectures
- Objective-C API
- Camera access
- `ARC` enabled library
- Built with `-fembed-bitcode` flag
- Creates static `frameworks`, static `xcframeworks` and static `universal (fat)` libraries (.a)
- Creates shared `frameworks` and `xcframeworks`

#### 1.2 macOS
- Supports `macOS SDK 10.15+` on Main releases and `macOS SDK 10.11+` on LTS releases
- Supports `macOS SDK 10.15+` on Main releases and `macOS SDK 10.12+` on LTS releases
- Includes `arm64` and `x86_64` architectures
- Objective-C API
- Camera access
- `ARC` enabled library
- Built with `-fembed-bitcode` flag
- Creates static `frameworks`, static `xcframeworks` and static `universal (fat)` libraries (.a)
- Creates shared `frameworks` and `xcframeworks`

#### 1.3 tvOS
- Supports `tvOS SDK 10.2+` on Main releases and `tvOS SDK 9.2+` on LTS releases
- Supports `tvOS SDK 11.0+` on Main releases and `tvOS SDK 10.0+` on LTS releases
- Includes `arm64`, `arm64-simulator` and `x86_64` architectures
- Objective-C API
- `ARC` enabled library
- Built with `-fembed-bitcode` flag
- Creates static `frameworks`, static `xcframeworks` and static `universal (fat)` libraries (.a)
- Creates shared `frameworks` and `xcframeworks`

### 2. Building

Run `ios.sh`/`macos.sh`/`tvos.sh` at project root directory to build `ffmpeg-kit` and `ffmpeg` static libraries for a
platform.
Run `ios.sh`/`macos.sh`/`tvos.sh` inside the project root to build `ffmpeg-kit` and `ffmpeg` shared libraries
for a platform.

Optionally, use `apple.sh` to combine bundles created by these three scripts in a single bundle.

Expand All @@ -45,20 +45,20 @@ Please note that `FFmpegKit` project repository includes the source code of `FFm

##### 2.1.1 iOS

- **Xcode 7.3.1** or later
- **iOS SDK 9.3** or later
- **Xcode 8.0** or later
- **iOS SDK 10** or later
- **Command Line Tools**

##### 2.1.2 macOS

- **Xcode 7.3.1** or later
- **macOS SDK 10.11** or later
- **Xcode 8.0** or later
- **macOS SDK 10.12** or later
- **Command Line Tools**

##### 2.1.3 tvOS

- **Xcode 7.3.1** or later
- **tvOS SDK 9.2** or later
- **Xcode 8.0** or later
- **tvOS SDK 10.0** or later
- **Command Line Tools**

##### 2.1.4 Packages
Expand Down
4 changes: 2 additions & 2 deletions ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ done

# PROCESS FULL OPTION AS LAST OPTION
if [[ -n ${BUILD_FULL} ]]; then
for library in {0..58}; do
for library in {0..61}; do
if [ ${GPL_ENABLED} == "yes" ]; then
enable_library "$(get_library_name "$library")" 1
else
Expand Down Expand Up @@ -240,7 +240,7 @@ for run_arch in {0..12}; do
TARGET_ARCH_LIST+=("${FULL_ARCH}")

# CLEAR FLAGS
for library in {0..58}; do
for library in {0..61}; do
library_name=$(get_library_name "${library}")
unset "$(echo "OK_${library_name}" | sed "s/\-/\_/g")"
unset "$(echo "DEPENDENCY_REBUILT_${library_name}" | sed "s/\-/\_/g")"
Expand Down
4 changes: 2 additions & 2 deletions macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ done

# PROCESS FULL OPTION AS LAST OPTION
if [[ -n ${BUILD_FULL} ]]; then
for library in {0..58}; do
for library in {0..61}; do
if [ ${GPL_ENABLED} == "yes" ]; then
enable_library "$(get_library_name "$library")" 1
else
Expand Down Expand Up @@ -209,7 +209,7 @@ for run_arch in {0..12}; do
TARGET_ARCH_LIST+=("${FULL_ARCH}")

# CLEAR FLAGS
for library in {0..58}; do
for library in {0..61}; do
library_name=$(get_library_name "${library}")
unset "$(echo "OK_${library_name}" | sed "s/\-/\_/g")"
unset "$(echo "DEPENDENCY_REBUILT_${library_name}" | sed "s/\-/\_/g")"
Expand Down
Loading

0 comments on commit 56a5206

Please sign in to comment.