Skip to content

Commit

Permalink
enable drawtext filter in gpl build
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed Nov 19, 2024
1 parent 53f1ddb commit 069ea9b
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ jobs:
Upload:
runs-on: ubuntu-latest
needs: [VS2022]
needs: [VS2022, VS2022LTL]
steps:
- name: Download vs2022 desktop
uses: actions/download-artifact@v4
Expand Down
25 changes: 20 additions & 5 deletions avbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ export LIB="$VC_LTL_LIB;$VCDIR_LIB;$WindowsSdkDir/Lib/$WindowsSDKVersion/ucrt/${
export AR=$LLVM_AR
export NM=$LLVM_NM
#export V=1 # FFmpeg BUG: AR is overriden in common.mak and becomes an invalid command in makedef(@printf works in makefiles but not sh scripts)
export PKG_CONFIG_PATH=${THIS_DIR}/tools/dep/windows-desktop/${MACHINE/86_/}/lib/pkgconfig:${THIS_DIR}/tools/dep_gpl/windows-desktop/${MACHINE/86_/}/lib/pkgconfig:${THIS_DIR}/tools/dep/windows-desktop/lib/pkgconfig:${THIS_DIR}/tools/dep_gpl/windows-desktop/lib/pkgconfig:$PKG_CONFIG_PATH
export PKG_CONFIG_PATH=${THIS_DIR}/tools/dep/windows/${MACHINE/86_/}/lib/pkgconfig:${THIS_DIR}/tools/dep_gpl/windows-desktop/${MACHINE/86_/}/lib/pkgconfig:${THIS_DIR}/tools/dep/windows/lib/pkgconfig:${THIS_DIR}/tools/dep_gpl/windows-desktop/lib/pkgconfig:$PKG_CONFIG_PATH
EOF
# [ expr1 ] && ... at end returns error if expr1 is false
}
Expand Down Expand Up @@ -692,7 +692,7 @@ setup_vc_env() {
[ -n "$LIBPATH_arch" ] && echo "export LIBPATH=$LIBPATH_arch" >>"$BDIR/.env.sh"
[ -n "$INCLUDE_arch" ] && echo "export INCLUDE=$INCLUDE_arch" >>"$BDIR/.env.sh"
cat >> "$BDIR/.env.sh" <<EOF
export PKG_CONFIG_PATH=${THIS_DIR}/tools/dep/windows-desktop/lib/pkgconfig:${THIS_DIR}/tools/dep_gpl/windows-desktop/lib/pkgconfig:$PKG_CONFIG_PATH
export PKG_CONFIG_PATH=${THIS_DIR}/tools/dep/windows/lib/pkgconfig:${THIS_DIR}/tools/dep_gpl/windows-desktop/lib/pkgconfig:$PKG_CONFIG_PATH
EOF
}

Expand Down Expand Up @@ -1022,7 +1022,10 @@ use armv6t2 or -mthumb-interwork: https://gcc.gnu.org/onlinedocs/gcc-4.5.3/gcc/A
fi
fi
fi
[ -z "${ANDROID_ARCH/*64/}" ] && EXTRA_LDFLAGS+=" -Wl,-z,max-page-size=16384" # 16KB page size required by android 15
[ -z "${ANDROID_ARCH/*64/}" ] && {
EXTRA_CFLAGS+=" -D__BIONIC_NO_PAGE_SIZE_MACRO=1"
EXTRA_LDFLAGS+=" -Wl,-z,max-page-size=16384" # 16KB page size required by android 15
}
#test -d $ANDROID_GCC_DIR || $NDK_ROOT/build/tools/make-standalone-toolchain.sh --platform=android-$API_LEVEL --toolchain=$TOOLCHAIN --install-dir=$ANDROID_GCC_DIR #--system=linux-x86_64
TOOLCHAIN_OPT+=" --extra-ldexeflags=\"-Wl,--gc-sections -Wl,-z,nocopyreloc -pie -fPIE $EXE_FLAGS\""
INSTALL_DIR=sdk-android-${1:-${ANDROID_ARCH}}
Expand Down Expand Up @@ -1363,7 +1366,11 @@ setup_gnu_env(){
exit 1
}
PKG_CONFIG_PATH+=":$SYSROOT/usr/lib/${CROSS_PREFIX%%-}/pkgconfig"
$IS_CROSS_BUILD && TOOLCHAIN_OPT+=" --sysroot=\\\$SYSROOT" # clang searchs host by default, so sysroot is required
$IS_CROSS_BUILD && {
TOOLCHAIN_OPT+=" --sysroot=\\\$SYSROOT" # clang searchs host by default, so sysroot is required
# use pkgconfig in sysroot and user dir(vpl.pc) with aboslute paths, so can not set PKG_CONFIG_SYSROOT_DIR
#export PKG_CONFIG_SYSROOT_DIR== # -I/usr/include => -I=/usr/include
}
# probe compiler first
setup_cc ${USE_TOOLCHAIN:=gcc} "--target=${CROSS_PREFIX%%-}" # clang on mac(apple or opensource) will use apple flags w/o --target=
# t.S: x .dn 0
Expand Down Expand Up @@ -1425,9 +1432,16 @@ setup_linux_env() {
add_elf_flags
enable_opt v4l2-request libudev
enable_opt vaapi vdpau libdrm
include_with_sysroot_compat /usr/include/libdrm
#FILTER_OPT+=" --enable-filter=drawtext"
#enable_opt libfreetype libfribidi libfontconfig libharfbuzz
echo $USER_OPT grep -q libfreetype && {
#enable_opt libfribidi libfontconfig
# pkg-config use aboslute paths, can not set PKG_CONFIG_SYSROOT_DIR because we have .pc outside sysroot, so manually add include dirs
include_with_sysroot_compat /usr/include/freetype2 /usr/include/fribidi /usr/include/harfbuzz
}
$USE_VK && EXTRA_CFLAGS+=" -I\$THIS_DIR/tools/Vulkan-Headers/include"
$IS_CLANG && enable_cuda_llvm
$IS_CLANG && EXTRA_CFLAGS+=" -I=/usr/include/libdrm"

local CC_ARCH=`$USE_TOOLCHAIN -dumpmachine`
CC_ARCH=${CC_ARCH%%-*}
Expand Down Expand Up @@ -1495,6 +1509,7 @@ config1(){
local patch_clock_gettime=0
local enable_pic=true
local enable_lto=true
#TOOLCHAIN_OPT+=" --pkg-config-flags=--define-prefix" # FIXME: wrong result for linux sysroot
: ${VC_BUILD:=false} #global is fine because no parallel configure now
add_librt(){
# clock_gettime in librt instead of glibc>=2.17
Expand Down
4 changes: 3 additions & 1 deletion config-gpl-lite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ USER_OPT="--enable-small \
--disable-protocols \
--disable-parsers --enable-parser=*sub*,*jp*,aac*,ac3,cook,dnxhd,flac,h26[3-4],hevc,m*,opus,rv*,vc1,vorbis,vp[8-9] \
--pkg-config=pkg-config --pkg-config-flags=--static --enable-gpl --enable-libx265 --enable-libx264 \
--enable-libfreetype --enable-libharfbuzz \
$USER_OPT
"
DEC_OPT_MOBILE="--enable-decoder=*sub*,movtext,*web*,aac*,ac3*,eac3*,alac*,ape,ass,av1*,ccaption,cfhd,cook,dca,dnxhd,exr,truehd,*yuv*,flv,flac,gif,h26[3-4]*,hevc*,hap,mp[1-3]*,prores,*[mj]peg*,mlp,mpl2,nellymoser,opus,pcm*,qtrle,*png*,tiff,rawvideo,sami,srt,ssa,v210*,vc1*,vorbis,vp[6-9]*,wm*,wrapped_avframe"
DEMUX_OPT_MOBILE="--enable-demuxer=*sub*,*ac3,*ac,*avs*,*[mj]peg*,*vc*,*web*,au,ape,ass,av[1i],concat,dnxhd,dts*,*dash*,*flv,gif,hls,h264,kux,matroska,mov,mp3,mxf,obu,ogg,pcm*,rawvideo,rt*p,spdif,srt,v210*,wav,*pipe,image2"
ENC_OPT_MOBILE="--enable-encoder=libx26*,aac,cfhd,dnxhd,exr,ff*,*yuv*,gif,h26[3-4]*,av1*,hevc*,mjpeg*,*png,opus,pcm*,prores*,rawvideo,spdif,speedhq,*jpeg,*png,tiff,vp[8-9]*,wrapped_avframe"
MUX_OPT_MOBILE="--enable-muxer=*jpeg,dnxhd,fifo,flv,gif,hls,h264,hevc,image2,mov,mp4,mpegts,matroska,null,og*,pcm*,rawvideo,spdif,*pipe,*segment,webm,wav"
PROT_OPT_MOBILE="--enable-protocol=cache,concat*,crypto*,data,fd,*file,ftp,h*,i*,pipe,rt*,s*,t*,u*"
FILTER_OPT_MOBILE="--enable-filter=*null*,afade,*fifo,*format,*resample,aeval,atempo,pan,crop,eq*,framerate,hw*,scale,volume,yadif*"
FILTER_OPT_MOBILE="--enable-filter=drawtext,*null*,afade,*fifo,*format,*resample,aeval,atempo,pan,crop,eq*,framerate,hw*,scale,volume,yadif*"
PROT_OPT="${PROT_OPT_MOBILE}"
DEC_OPT="${DEC_OPT_MOBILE},rv*,ffv*"
DEMUX_OPT="${DEMUX_OPT_MOBILE},mlv,nsv,nut"
Expand All @@ -27,4 +28,5 @@ ios_OPT="--disable-avdevice"
rpi_OPT="--disable-avdevice"
raspberry_pi_OPT="--disable-avdevice"
sunxi_OPT="--disable-avdevice"
linux_OPT="--enable-libfribidi --enable-fontconfig"
LITE_BUILD=true
30 changes: 30 additions & 0 deletions patches/master/0032-textutils-include-time_internal.h.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
From 3e8678a486b50da2c1c7dae32eeb93d32327feb4 Mon Sep 17 00:00:00 2001
From: wang-bin <[email protected]>
Date: Tue, 19 Nov 2024 19:27:09 +0800
Subject: [PATCH 32/32] textutils: include time_internal.h

fix undefined localtime_r in msvc
---
libavfilter/textutils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/textutils.c b/libavfilter/textutils.c
index e6b5239b20..471346cc51 100644
--- a/libavfilter/textutils.c
+++ b/libavfilter/textutils.c
@@ -31,6 +31,7 @@
#include "libavutil/file.h"
#include "libavutil/mem.h"
#include "libavutil/time.h"
+#include "libavutil/time_internal.h"

static int ff_expand_text_function_internal(FFExpandTextContext *expand_text, AVBPrint *bp,
char *name, unsigned argc, char **argv)
@@ -380,4 +381,3 @@ int ff_load_textfile(void *log_ctx, const char *textfile,

return 0;
}
-
--
2.39.5 (Apple Git-154)

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From 58a25729988efd3a61f3e1e9df97b8a3e0cf6130 Mon Sep 17 00:00:00 2001
From: wang-bin <[email protected]>
Date: Tue, 19 Nov 2024 19:43:02 +0800
Subject: [PATCH 33/33] hwcontext_vaapi: fix undefined close() on windows

---
libavutil/hwcontext_vaapi.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index 95aa38d9d2..95fbba514c 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -1643,8 +1643,10 @@ static void vaapi_device_free(AVHWDeviceContext *ctx)
XCloseDisplay(priv->x11_display);
#endif

+#if HAVE_VAAPI_DRM
if (priv->drm_fd >= 0)
close(priv->drm_fd);
+#endif

av_freep(&priv);
}
--
2.39.5 (Apple Git-154)

0 comments on commit 069ea9b

Please sign in to comment.