forked from jarnedemeulemeester/libmpv-android
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add fftools-ffi - Fix and enable assembly optimizations
- Loading branch information
Showing
22 changed files
with
535 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,11 @@ jobs: | |
run: | | ||
sudo chmod +x bundle_full.sh | ||
./bundle_full.sh | ||
- name: Bundle (encoders-gpl) | ||
working-directory: ./buildscripts | ||
run: | | ||
sudo chmod +x bundle_encoders-gpl.sh | ||
./bundle_encoders-gpl.sh | ||
- uses: actions/[email protected] | ||
with: | ||
name: artifact | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
For the "default" and "full" flavors, the following license applies: | ||
|
||
Copyright (c) 2016 Ilya Zhuravlev | ||
Copyright (c) 2016 sfan5 <[email protected]> | ||
|
||
|
@@ -6,3 +8,20 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
For the "encoders-gpl" flavor, the following license applies: | ||
|
||
Copyright (C) 2023 Callum Moffat | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# -------------------------------------------------- | ||
set -euxo pipefail | ||
|
||
export ENCODERS_GPL=1 | ||
|
||
if [ -d deps ]; then | ||
sudo rm -r deps | ||
fi | ||
if [ -d prefix ]; then | ||
sudo rm -r prefix | ||
fi | ||
|
||
./download.sh | ||
./patch-encoders-gpl.sh | ||
|
||
# -------------------------------------------------- | ||
|
||
rm scripts/ffmpeg.sh | ||
cp flavors/encoders-gpl.sh scripts/ffmpeg.sh | ||
|
||
# -------------------------------------------------- | ||
|
||
./build.sh | ||
|
||
# -------------------------------------------------- | ||
|
||
cd deps/media-kit-android-helper | ||
|
||
sudo chmod +x gradlew | ||
./gradlew assembleRelease | ||
|
||
unzip -o app/build/outputs/apk/release/app-release.apk -d app/build/outputs/apk/release | ||
|
||
ln -sf "$(pwd)/app/build/outputs/apk/release/lib/arm64-v8a/libmediakitandroidhelper.so" "../../../libmpv/src/main/jniLibs/arm64-v8a" | ||
ln -sf "$(pwd)/app/build/outputs/apk/release/lib/armeabi-v7a/libmediakitandroidhelper.so" "../../../libmpv/src/main/jniLibs/armeabi-v7a" | ||
ln -sf "$(pwd)/app/build/outputs/apk/release/lib/x86/libmediakitandroidhelper.so" "../../../libmpv/src/main/jniLibs/x86" | ||
ln -sf "$(pwd)/app/build/outputs/apk/release/lib/x86_64/libmediakitandroidhelper.so" "../../../libmpv/src/main/jniLibs/x86_64" | ||
|
||
cd ../.. | ||
|
||
# -------------------------------------------------- | ||
|
||
cd deps/media_kit/media_kit_native_event_loop | ||
|
||
flutter create --org com.alexmercerind --template plugin_ffi --platforms=android . | ||
|
||
if ! grep -q android "pubspec.yaml"; then | ||
printf " android:\n ffiPlugin: true\n" >> pubspec.yaml | ||
fi | ||
|
||
flutter pub get | ||
|
||
cp -a ../../mpv/libmpv/. src/include/ | ||
|
||
cd example | ||
|
||
flutter clean | ||
flutter build apk --release | ||
|
||
unzip -o build/app/outputs/apk/release/app-release.apk -d build/app/outputs/apk/release | ||
|
||
cd build/app/outputs/apk/release/ | ||
|
||
# -------------------------------------------------- | ||
|
||
rm -r lib/*/libapp.so | ||
rm -r lib/*/libflutter.so | ||
|
||
zip -r "encoders-gpl-arm64-v8a.jar" lib/arm64-v8a | ||
zip -r "encoders-gpl-armeabi-v7a.jar" lib/armeabi-v7a | ||
zip -r "encoders-gpl-x86.jar" lib/x86 | ||
zip -r "encoders-gpl-x86_64.jar" lib/x86_64 | ||
|
||
mkdir ../../../../../../../../../../output | ||
|
||
cp *.jar ../../../../../../../../../../output | ||
|
||
md5sum *.jar | ||
|
||
cd ../../../../../../../../.. | ||
|
||
# -------------------------------------------------- | ||
|
||
zip -r debug-symbols-encoders-gpl.zip prefix/*/lib | ||
cp debug-symbols-encoders-gpl.zip ../output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
#!/bin/bash -e | ||
|
||
. ../../include/depinfo.sh | ||
. ../../include/path.sh | ||
|
||
if [ "$1" == "build" ]; then | ||
true | ||
elif [ "$1" == "clean" ]; then | ||
rm -rf _build$ndk_suffix | ||
exit 0 | ||
else | ||
exit 255 | ||
fi | ||
|
||
mkdir -p _build$ndk_suffix | ||
cd _build$ndk_suffix | ||
|
||
cpu=armv7-a | ||
[[ "$ndk_triple" == "aarch64"* ]] && cpu=armv8-a | ||
[[ "$ndk_triple" == "x86_64"* ]] && cpu=generic | ||
[[ "$ndk_triple" == "i686"* ]] && cpu="i686 --disable-asm" | ||
|
||
cpuflags= | ||
[[ "$ndk_triple" == "arm"* ]] && cpuflags="$cpuflags -mfpu=neon -mcpu=cortex-a8" | ||
|
||
../configure \ | ||
--target-os=android --enable-cross-compile --cross-prefix=$ndk_triple- --ar=$AR --cc=$CC --ranlib=$RANLIB \ | ||
--arch=${ndk_triple%%-*} --cpu=$cpu --pkg-config=pkg-config \ | ||
--extra-cflags="-I$prefix_dir/include $cpuflags" --extra-ldflags="-L$prefix_dir/lib" \ | ||
--pkg-config-flags="--static" \ | ||
\ | ||
--disable-nonfree \ | ||
--enable-version3 \ | ||
--enable-static \ | ||
--disable-shared \ | ||
--disable-vulkan \ | ||
--disable-iconv \ | ||
--disable-stripping \ | ||
--pkg-config-flags=--static \ | ||
\ | ||
--enable-decoders \ | ||
--enable-encoders \ | ||
--enable-libvorbis \ | ||
--enable-libvpx \ | ||
--enable-gpl \ | ||
--enable-libx264 \ | ||
--enable-muxers \ | ||
--enable-demuxers \ | ||
--enable-parsers \ | ||
\ | ||
--disable-protocols \ | ||
--disable-devices \ | ||
--disable-doc \ | ||
--disable-avdevice \ | ||
--disable-postproc \ | ||
--disable-programs \ | ||
--disable-gray \ | ||
--disable-swscale-alpha \ | ||
\ | ||
--enable-jni \ | ||
--enable-bsfs \ | ||
--enable-mediacodec \ | ||
\ | ||
--disable-dxva2 \ | ||
--disable-vaapi \ | ||
--disable-vdpau \ | ||
--disable-bzlib \ | ||
--disable-linux-perf \ | ||
--disable-videotoolbox \ | ||
--disable-audiotoolbox \ | ||
\ | ||
--enable-small \ | ||
--enable-hwaccels \ | ||
--enable-optimizations \ | ||
--enable-runtime-cpudetect \ | ||
\ | ||
--enable-mbedtls \ | ||
\ | ||
--enable-libdav1d \ | ||
\ | ||
--enable-libxml2 \ | ||
\ | ||
--enable-avutil \ | ||
--enable-avcodec \ | ||
--enable-avfilter \ | ||
--enable-avformat \ | ||
--enable-swscale \ | ||
--enable-swresample \ | ||
\ | ||
\ | ||
\ | ||
--enable-filters \ | ||
\ | ||
--enable-protocol=async \ | ||
--enable-protocol=cache \ | ||
--enable-protocol=crypto \ | ||
--enable-protocol=data \ | ||
--enable-protocol=ffrtmphttp \ | ||
--enable-protocol=file \ | ||
--enable-protocol=ftp \ | ||
--enable-protocol=hls \ | ||
--enable-protocol=http \ | ||
--enable-protocol=httpproxy \ | ||
--enable-protocol=https \ | ||
--enable-protocol=pipe \ | ||
--enable-protocol=rtmp \ | ||
--enable-protocol=rtmps \ | ||
--enable-protocol=rtmpt \ | ||
--enable-protocol=rtmpts \ | ||
--enable-protocol=rtp \ | ||
--enable-protocol=subfile \ | ||
--enable-protocol=tcp \ | ||
--enable-protocol=tls \ | ||
--enable-protocol=srt \ | ||
\ | ||
--enable-network \ | ||
|
||
make -j$cores | ||
make DESTDIR="$prefix_dir" install | ||
|
||
ln -sf "$prefix_dir"/lib/libswresample.so "$native_dir" | ||
ln -sf "$prefix_dir"/lib/libpostproc.so "$native_dir" | ||
ln -sf "$prefix_dir"/lib/libavutil.so "$native_dir" | ||
ln -sf "$prefix_dir"/lib/libavcodec.so "$native_dir" | ||
ln -sf "$prefix_dir"/lib/libavformat.so "$native_dir" | ||
ln -sf "$prefix_dir"/lib/libswscale.so "$native_dir" | ||
ln -sf "$prefix_dir"/lib/libavfilter.so "$native_dir" | ||
ln -sf "$prefix_dir"/lib/libavdevice.so "$native_dir" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash -e | ||
|
||
PATCHES=(patches-encoders-gpl/*) | ||
ROOT=$(pwd) | ||
|
||
for dep_path in "${PATCHES[@]}"; do | ||
if [ -d "$dep_path" ]; then | ||
patches=($dep_path/*) | ||
dep=$(echo $dep_path |cut -d/ -f 2) | ||
cd deps/$dep | ||
echo Patching $dep | ||
git reset --hard | ||
for patch in "${patches[@]}"; do | ||
echo Applying $patch | ||
git apply "$ROOT/$patch" | ||
done | ||
cd $ROOT | ||
fi | ||
done | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../patches/ffmpeg |
13 changes: 13 additions & 0 deletions
13
buildscripts/patches-encoders-gpl/libx264/fix_x86_asm.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/configure b/configure | ||
index e242e73c..219381ab 100755 | ||
--- a/configure | ||
+++ b/configure | ||
@@ -738,7 +739,7 @@ LDFLAGS="$LDFLAGS $libm" | ||
|
||
stack_alignment=4 | ||
case $host_cpu in | ||
- i*86) | ||
+ *86) | ||
ARCH="X86" | ||
AS="${AS-nasm}" | ||
AS_EXT=".asm" |
Oops, something went wrong.