Skip to content

Commit 7607e9c

Browse files
committed
Add libdav1d and meson
1 parent aa0b4e5 commit 7607e9c

File tree

3 files changed

+95
-89
lines changed

3 files changed

+95
-89
lines changed

cross_compile_ffmpeg.sh

+95-50
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,70 @@ do_cmake_and_install() {
476476
do_make_and_make_install
477477
}
478478

479+
do_meson() {
480+
local configure_options="$1"
481+
local configure_name="$2"
482+
local configure_env="$3"
483+
local configure_noclean=""
484+
if [[ "$configure_name" = "" ]]; then
485+
configure_name="meson"
486+
fi
487+
local cur_dir2=$(pwd)
488+
local english_name=$(basename $cur_dir2)
489+
local touch_name=$(get_small_touchfile_name already_built "$configure_options $configure_name $LDFLAGS $CFLAGS")
490+
if [ ! -f "$touch_name" ]; then
491+
if [ "$configure_noclean" != "noclean" ]; then
492+
make clean # just in case
493+
fi
494+
rm -f already_* # reset
495+
echo "Using meson: $english_name ($PWD) as $ PATH=$PATH ${configure_env} $configure_name $configure_options"
496+
#env
497+
"$configure_name" $configure_options || exit 1
498+
touch -- "$touch_name"
499+
make clean # just in case
500+
else
501+
echo "Already used meson $(basename $cur_dir2)"
502+
fi
503+
}
504+
505+
generic_meson() {
506+
local extra_configure_options="$1"
507+
mkdir -pv build
508+
do_meson "--prefix=${mingw_w64_x86_64_prefix} --libdir=${mingw_w64_x86_64_prefix}/lib --buildtype=release --strip --default-library=static --cross-file=${top_dir}/meson-cross.mingw.txt $extra_configure_options . build"
509+
}
510+
511+
generic_meson_ninja_install() {
512+
generic_meson "$1"
513+
do_ninja_and_ninja_install
514+
}
515+
516+
do_ninja_and_ninja_install() {
517+
local extra_ninja_options="$1"
518+
do_ninja "$extra_ninja_options"
519+
local touch_name=$(get_small_touchfile_name already_ran_make_install "$extra_ninja_options")
520+
if [ ! -f $touch_name ]; then
521+
echo "ninja installing $(pwd) as $ PATH=$PATH ninja -C build install $extra_make_options"
522+
ninja -C build install || exit 1
523+
touch $touch_name || exit 1
524+
fi
525+
}
526+
527+
do_ninja() {
528+
local extra_make_options=" -j $cpu_count"
529+
local cur_dir2=$(pwd)
530+
local touch_name=$(get_small_touchfile_name already_ran_make "${extra_make_options}")
531+
532+
if [ ! -f $touch_name ]; then
533+
echo
534+
echo "ninja-ing $cur_dir2 as $ PATH=$PATH ninja -C build "${extra_make_options}"
535+
echo
536+
ninja -C build "${extra_make_options} || exit 1
537+
touch $touch_name || exit 1 # only touch if the build was OK
538+
else
539+
echo "already did ninja $(basename "$cur_dir2")"
540+
fi
541+
}
542+
479543
apply_patch() {
480544
local url=$1 # if you want it to use a local file instead of a url one [i.e. local file with local modifications] specify it like file://localhost/full/path/to/filename.patch
481545
local patch_type=$2
@@ -1338,35 +1402,6 @@ build_frei0r() {
13381402
cd ..
13391403
}
13401404

1341-
build_svt-hevc() {
1342-
do_git_checkout https://github.com/OpenVisualCloud/SVT-HEVC.git
1343-
mkdir -p SVT-HEVC_git/release
1344-
cd SVT-HEVC_git/release
1345-
do_cmake_from_build_dir .. "-DCMAKE_BUILD_TYPE=Release"
1346-
do_make_and_make_install
1347-
cd ../..
1348-
}
1349-
1350-
build_svt-av1() {
1351-
do_git_checkout https://github.com/OpenVisualCloud/SVT-AV1.git
1352-
cd SVT-AV1_git
1353-
git apply $patch_dir/SVT-AV1-Windows-lowercase.patch
1354-
cd Build
1355-
do_cmake_from_build_dir .. "-DCMAKE_BUILD_TYPE=Release"
1356-
do_make_and_make_install
1357-
cd ../..
1358-
}
1359-
1360-
build_svt-vp9() {
1361-
do_git_checkout https://github.com/OpenVisualCloud/SVT-VP9.git
1362-
cd SVT-VP9_git
1363-
git apply $patch_dir/SVT-VP9-Windows-lowercase.patch
1364-
cd Build
1365-
do_cmake_from_build_dir ..
1366-
do_make_and_make_install
1367-
cd ../..
1368-
}
1369-
13701405
build_vidstab() {
13711406
do_git_checkout https://github.com/georgmartius/vid.stab.git vid.stab_git
13721407
cd vid.stab_git
@@ -1506,6 +1541,13 @@ build_libaom() {
15061541
cd ../..
15071542
}
15081543

1544+
build_dav1d() {
1545+
do_git_checkout https://code.videolan.org/videolan/dav1d.git libdav1d
1546+
cd libdav1d
1547+
generic_meson_ninja_install
1548+
cd ..
1549+
}
1550+
15091551
build_libx265() {
15101552
# the only one that uses mercurial, so there's some extra initial junk in this method... XXX needs some cleanup :|
15111553
local checkout_dir=x265
@@ -1838,6 +1880,26 @@ reset_cflags() {
18381880
export CFLAGS=$original_cflags
18391881
}
18401882

1883+
build_meson_cross() {
1884+
rm -fv meson-cross.mingw.txt
1885+
echo "[binaries]" >> meson-cross.mingw.txt
1886+
echo "c = '${cross_prefix}gcc'" >> meson-cross.mingw.txt
1887+
echo "cpp = '${cross_prefix}g++'" >> meson-cross.mingw.txt
1888+
echo "ar = '${cross_prefix}ar'" >> meson-cross.mingw.txt
1889+
echo "strip = '${cross_prefix}strip'" >> meson-cross.mingw.txt
1890+
echo "pkgconfig = '${cross_prefix}pkg-config'" >> meson-cross.mingw.txt
1891+
echo "nm = '${cross_prefix}nm'" >> meson-cross.mingw.txt
1892+
echo "windres = '${cross_prefix}windres'" >> meson-cross.mingw.txt
1893+
# echo "[properties]" >> meson-cross.mingw.txt
1894+
# echo "needs_exe_wrapper = true" >> meson-cross.mingw.txt
1895+
echo "[host_machine]" >> meson-cross.mingw.txt
1896+
echo "system = 'windows'" >> meson-cross.mingw.txt
1897+
echo "cpu_family = 'x86_64'" >> meson-cross.mingw.txt
1898+
echo "cpu = 'x86_64'" >> meson-cross.mingw.txt
1899+
echo "endian = 'little'" >> meson-cross.mingw.txt
1900+
mv -v meson-cross.mingw.txt ../..
1901+
}
1902+
18411903
build_mplayer() {
18421904
# pre requisites
18431905
build_libjpeg_turbo
@@ -1959,21 +2021,6 @@ build_ffmpeg() {
19592021

19602022
cd $output_dir
19612023
apply_patch file://$patch_dir/frei0r_load-shared-libraries-dynamically.diff
1962-
#SVT-HEVC
1963-
wget https://raw.githubusercontent.com/OpenVisualCloud/SVT-HEVC/master/ffmpeg_plugin/0001-lavc-svt_hevc-add-libsvt-hevc-encoder-wrapper.patch
1964-
git am 0001-lavc-svt_hevc-add-libsvt-hevc-encoder-wrapper.patch
1965-
#Add SVT-AV1 to SVT-HEVC
1966-
#wget https://raw.githubusercontent.com/OpenVisualCloud/SVT-AV1/master/ffmpeg_plugin/0001-Add-ability-for-ffmpeg-to-run-svt-av1-with-svt-hevc.patch
1967-
#git apply 0001-Add-ability-for-ffmpeg-to-run-svt-av1-with-svt-hevc.patch
1968-
#Add SVT-VP9 to SVT-HEVC & SVT-AV1
1969-
#wget https://raw.githubusercontent.com/OpenVisualCloud/SVT-VP9/master/ffmpeg_plugin/0001-Add-ability-for-ffmpeg-to-run-svt-vp9-with-svt-hevc-av1.patch
1970-
#git apply 0001-Add-ability-for-ffmpeg-to-run-svt-vp9-with-svt-hevc-av1.patch
1971-
#SVT-AV1 only
1972-
#wget https://raw.githubusercontent.com/OpenVisualCloud/SVT-AV1/master/ffmpeg_plugin/0001-Add-ability-for-ffmpeg-to-run-svt-av1.patch
1973-
#git apply 0001-Add-ability-for-ffmpeg-to-run-svt-av1.patch
1974-
#SVT-VP9 only
1975-
#wget https://raw.githubusercontent.com/OpenVisualCloud/SVT-VP9/master/ffmpeg_plugin/0001-Add-ability-for-ffmpeg-to-run-svt-vp9.patch
1976-
#git apply 0001-Add-ability-for-ffmpeg-to-run-svt-vp9.patch
19772024

19782025
if [ "$bits_target" = "32" ]; then
19792026
local arch=x86
@@ -1995,9 +2042,7 @@ build_ffmpeg() {
19952042
# Fix WinXP incompatibility by disabling Microsoft's Secure Channel, because Windows XP doesn't support TLS 1.1 and 1.2, but with GnuTLS or OpenSSL it does. XP compat!
19962043
fi
19972044
config_options="$init_options --enable-libcaca --enable-gray --enable-libtesseract --enable-fontconfig --enable-gmp --enable-gnutls --enable-libass --enable-libbluray --enable-libbs2b --enable-libflite --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libzimg --enable-libzvbi --enable-libmysofa --enable-libaom --enable-libopenjpeg --enable-libopenh264 --enable-liblensfun --enable-libvmaf --enable-libsrt --enable-demuxer=dash --enable-libxml2"
1998-
config_options+=" --enable-libsvthevc"
1999-
#config_options+=" --enable-libsvtav1"
2000-
#config_options+=" --enable-libsvtvp9"
2045+
config_options+=" --enable-libdav1d"
20012046
if [[ $compiler_flavors != "native" ]]; then
20022047
config_options+=" --enable-nvenc --enable-nvdec" # don't work OS X
20032048
fi
@@ -2152,6 +2197,7 @@ build_ffmpeg_dependencies() {
21522197
build_dlfcn
21532198
build_libxavs
21542199
fi
2200+
build_meson_cross
21552201
build_mingw_std_threads
21562202
build_zlib # Zlib in FFmpeg is autodetected.
21572203
build_libcaca # Uses zlib and dlfcn (on windows).
@@ -2208,9 +2254,6 @@ build_ffmpeg_dependencies() {
22082254
build_libsamplerate # Needs libsndfile >= 1.0.6 and fftw >= 0.15.0 for tests. Uses dlfcn.
22092255
build_librubberband # Needs libsamplerate, libsndfile, fftw and vamp_plugin. 'configure' will fail otherwise. Eventhough librubberband doesn't necessarily need them (libsndfile only for 'rubberband.exe' and vamp_plugin only for "Vamp audio analysis plugin"). How to use the bundled libraries '-DUSE_SPEEX' and '-DUSE_KISSFFT'?
22102256
build_frei0r # Needs dlfcn. could use opencv...
2211-
build_svt-hevc
2212-
#build_svt-av1
2213-
#build_svt-vp9
22142257
build_vidstab
22152258
#build_facebooktransform360 # needs modified ffmpeg to use it
22162259
build_libmysofa # Needed for FFmpeg's SOFAlizer filter (https://ffmpeg.org/ffmpeg-filters.html#sofalizer). Uses dlfcn.
@@ -2231,6 +2274,7 @@ build_ffmpeg_dependencies() {
22312274
build_libx265
22322275
build_libopenh264
22332276
build_libaom
2277+
build_dav1d
22342278
build_libx264 # at bottom as it might internally build a coy of ffmpeg (which needs all the above deps...
22352279
}
22362280

@@ -2263,6 +2307,7 @@ build_apps() {
22632307
}
22642308

22652309
# set some parameters initial values
2310+
top_dir="$(pwd)"
22662311
cur_dir="$(pwd)/sandbox"
22672312
patch_dir="$(pwd)/patches"
22682313
cpu_count="$(grep -c processor /proc/cpuinfo 2>/dev/null)" # linux cpu count

patches/SVT-AV1-Windows-lowercase.patch

-26
This file was deleted.

patches/SVT-VP9-Windows-lowercase.patch

-13
This file was deleted.

0 commit comments

Comments
 (0)