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 27, 2021
1 parent 38d88e0 commit 0b2a115
Show file tree
Hide file tree
Showing 65 changed files with 653 additions and 267 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
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
27 changes: 23 additions & 4 deletions scripts/android/ffmpeg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ CONFIGURE_POSTFIX=""
HIGH_PRIORITY_INCLUDES=""

# SET CONFIGURE OPTIONS
for library in {1..58}; do
for library in {1..62}; do
if [[ ${!library} -eq 1 ]]; then
ENABLED_LIBRARY=$(get_library_name $((library - 1)))

Expand Down Expand Up @@ -194,6 +194,11 @@ for library in {1..58}; do
LDFLAGS+=" $(pkg-config --libs --static openh264 2>>"${BASEDIR}"/build.log)"
CONFIGURE_POSTFIX+=" --enable-libopenh264"
;;
openssl)
CFLAGS+=" $(pkg-config --cflags openssl 2>>"${BASEDIR}"/build.log)"
LDFLAGS+=" $(pkg-config --libs --static openssl 2>>"${BASEDIR}"/build.log)"
CONFIGURE_POSTFIX+=" --enable-openssl"
;;
opus)
CFLAGS+=" $(pkg-config --cflags opus 2>>"${BASEDIR}"/build.log)"
LDFLAGS+=" $(pkg-config --libs --static opus 2>>"${BASEDIR}"/build.log)"
Expand Down Expand Up @@ -229,6 +234,11 @@ for library in {1..58}; do
LDFLAGS+=" $(pkg-config --libs --static speex 2>>"${BASEDIR}"/build.log)"
CONFIGURE_POSTFIX+=" --enable-libspeex"
;;
srt)
CFLAGS+=" $(pkg-config --cflags srt 2>>"${BASEDIR}"/build.log)"
LDFLAGS+=" $(pkg-config --libs --static srt 2>>"${BASEDIR}"/build.log)"
CONFIGURE_POSTFIX+=" --enable-libsrt"
;;
tesseract)
CFLAGS+=" $(pkg-config --cflags tesseract 2>>"${BASEDIR}"/build.log)"
LDFLAGS+=" $(pkg-config --libs --static tesseract 2>>"${BASEDIR}"/build.log)"
Expand Down Expand Up @@ -261,6 +271,11 @@ for library in {1..58}; do
LDFLAGS+=" $(pkg-config --libs --static xvidcore 2>>"${BASEDIR}"/build.log)"
CONFIGURE_POSTFIX+=" --enable-libxvid --enable-gpl"
;;
zimg)
CFLAGS+=" $(pkg-config --cflags zimg 2>>"${BASEDIR}"/build.log)"
LDFLAGS+=" $(pkg-config --libs --static zimg 2>>"${BASEDIR}"/build.log)"
CONFIGURE_POSTFIX+=" --enable-libzimg"
;;
expat)
CFLAGS+=" $(pkg-config --cflags expat 2>>"${BASEDIR}"/build.log)"
LDFLAGS+=" $(pkg-config --libs --static expat 2>>"${BASEDIR}"/build.log)"
Expand Down Expand Up @@ -302,6 +317,8 @@ for library in {1..58}; do
CONFIGURE_POSTFIX+=" --disable-zlib"
elif [[ ${library} -eq $((LIBRARY_ANDROID_MEDIA_CODEC + 1)) ]]; then
CONFIGURE_POSTFIX+=" --disable-mediacodec"
elif [[ ${library} -eq $((LIBRARY_OPENSSL + 1)) ]]; then
CONFIGURE_POSTFIX+=" --disable-openssl"
fi
fi
done
Expand Down Expand Up @@ -394,25 +411,27 @@ fi
--enable-version3 \
--arch="${TARGET_ARCH}" \
--cpu="${TARGET_CPU}" \
--target-os=android \
${ASM_OPTIONS} \
--ar="${AR}" \
--cc="${CC}" \
--cxx="${CXX}" \
--ranlib="${RANLIB}" \
--strip="${STRIP}" \
--nm="${NM}" \
--extra-libs="$(pkg-config --libs --static cpu-features)" \
--target-os=android \
${ASM_OPTIONS} \
--disable-autodetect \
--enable-cross-compile \
--enable-pic \
--enable-jni \
--enable-optimizations \
--enable-swscale \
${BUILD_LIBRARY_OPTIONS} \
--enable-pthreads \
--enable-v4l2-m2m \
--disable-outdev=fbdev \
--disable-indev=fbdev \
${SIZE_OPTIONS} \
--disable-openssl \
--disable-xmm-clobber-test \
${DEBUG_OPTIONS} \
--disable-neon-clobber-test \
Expand Down
2 changes: 1 addition & 1 deletion scripts/android/freetype.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ make distclean 2>/dev/null 1>/dev/null
if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/builds/unix/configure ]] || [[ ${RECONF_freetype} -eq 1 ]]; then

# NOTE THAT FREETYPE DOES NOT SUPPORT AUTORECONF BUT IT COMES WITH AN autogen.sh
./autogen.sh || return 1
./autogen.sh || exit 1
fi

./configure \
Expand Down
2 changes: 1 addition & 1 deletion scripts/android/harfbuzz.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ make distclean 2>/dev/null 1>/dev/null

# REGENERATE BUILD FILES IF NECESSARY OR REQUESTED
if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_harfbuzz} -eq 1 ]]; then
NOCONFIGURE=1 ./autogen.sh || return 1
NOCONFIGURE=1 ./autogen.sh || exit 1
fi

./configure \
Expand Down
2 changes: 1 addition & 1 deletion scripts/android/libtheora.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_libtheora}
# WORKAROUND NOT TO RUN CONFIGURE AT THE END OF autogen.sh
${SED_INLINE} 's/$srcdir\/configure/#$srcdir\/configure/g' "${BASEDIR}"/src/"${LIB_NAME}"/autogen.sh || return 1

./autogen.sh || return 1
./autogen.sh || exit 1
fi

./configure \
Expand Down
Loading

0 comments on commit 0b2a115

Please sign in to comment.