[libav-devel] [PATCH 12/12] build: Fine-grained link-time dependency settings
Previously, all link-time dependencies were added for all libraries, resulting in bogus link-time dependencies since not all dependencies are shared across libraries. Also, in some cases like libavutil, not all dependencies were taken into account, resulting in some cases of underlinking. To address all this mess a machinery is added for tracking which dependency belongs to which library component and then leveraged to determine correct dependencies for all individual libraries. --- Makefile| 2 +- avbuild/common.mak | 2 +- avbuild/library.mak | 2 +- configure | 156 +++- tests/checkasm/Makefile | 2 +- 5 files changed, 118 insertions(+), 46 deletions(-) diff --git a/Makefile b/Makefile index 3e6f7e2..07eb292 100644 --- a/Makefile +++ b/Makefile @@ -118,7 +118,7 @@ FF_STATIC_DEP_LIBS := $(STATIC_DEP_LIBS) all: $(AVPROGS) alltools checkheaders examples testprogs $(TOOLS): %$(EXESUF): %.o - $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(EXTRALIBS) $(ELIBS) + $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(EXTRALIBS-$(*F)) $(EXTRALIBS) $(ELIBS) CONFIGURABLE_COMPONENTS = \ $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c)) \ diff --git a/avbuild/common.mak b/avbuild/common.mak index 236380e..a627dc0 100644 --- a/avbuild/common.mak +++ b/avbuild/common.mak @@ -8,7 +8,7 @@ OBJS += $(OBJS-yes) FFLIBS:= $($(NAME)_FFLIBS) $(FFLIBS-yes) $(FFLIBS) TESTPROGS += $(TESTPROGS-yes) -FFEXTRALIBS := $(FFLIBS:%=$(LD_LIB)) $(EXTRALIBS) +FFEXTRALIBS := $(FFLIBS:%=$(LD_LIB)) $(foreach lib,EXTRALIBS-$(NAME) $(FFLIBS:%=EXTRALIBS-%),$($(lib))) $(EXTRALIBS) OBJS := $(sort $(OBJS:%=$(SUBDIR)%)) TESTOBJS := $(TESTOBJS:%=$(SUBDIR)tests/%) $(TESTPROGS:%=$(SUBDIR)tests/%.o) diff --git a/avbuild/library.mak b/avbuild/library.mak index e5f6d7d..be6098c 100644 --- a/avbuild/library.mak +++ b/avbuild/library.mak @@ -30,7 +30,7 @@ $(TOOLS): THISLIB = $(NAME:%=$(LD_LIB)) $(TESTPROGS): THISLIB = $(SUBDIR)$(LIBNAME) $(TESTPROGS) $(TOOLS): %$(EXESUF): %.o - $$(LD) $(LDFLAGS) $(LDEXEFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(THISLIB) $(FFEXTRALIBS) $$(ELIBS) + $$(LD) $(LDFLAGS) $(LDEXEFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(THISLIB) $(FFEXTRALIBS) $$(EXTRALIBS-$$(*F)) $$(ELIBS) $(SUBDIR)lib$(NAME).version: $(SUBDIR)version.h | $(SUBDIR) $$(M) $$(SRC_PATH)/avbuild/libversion.sh $(NAME) $$< > $$@ diff --git a/configure b/configure index e07dd0d..bc949a4 100755 --- a/configure +++ b/configure @@ -610,7 +610,7 @@ is_in(){ return 1 } -do_check_deps(){ +check_deps(){ for cfg; do cfg="${cfg#!}" enabled ${cfg}_checking && die "Circular dependency for $cfg." @@ -640,24 +640,17 @@ do_check_deps(){ if enabled $cfg; then enable_deep $dep_sel enable_deep_weak $dep_sgs +for dep in $dep_all $dep_any $dep_sgs; do +# filter out library deps, these do not belong in extralibs +is_in $dep $LIBRARY_LIST && continue +enabled $dep && eval append ${cfg}_extralibs ${dep}_extralibs +done fi disable ${cfg}_checking done } -check_deps(){ -unset allopts - -do_check_deps "$@" - -for cfg in $allopts; do -enabled $cfg || continue -eval dep_extralibs="\$${cfg}_extralibs" -test -n "$dep_extralibs" && add_extralibs $dep_extralibs -done -} - print_config(){ pfx=$1 files=$2 @@ -712,6 +705,15 @@ unique(){ eval "$var=\"${uniq_list}\"" } +resolve(){ +var=$1 +tmpvar= +for entry in $(eval echo \$$var); do +tmpvar="$tmpvar $(eval echo \$${entry})" +done +eval "$var=\"${tmpvar}\"" +} + add_cppflags(){ append CPPFLAGS "$@" } @@ -748,6 +750,12 @@ add_extralibs(){ prepend extralibs $($ldflags_filter "$@") } +add_extralibs_component(){ +component=$1 +shift +prepend extralibs_${component} $($ldflags_filter "$@") +} + add_host_cppflags(){ append host_cppflags "$@" } @@ -1016,7 +1024,7 @@ check_lib(){ shift 3 disable $name check_func_headers "$headers" "$funcs" "$@" && -enable $name && add_extralibs "$@" +enable $name && eval ${name}_extralibs="\$@" } check_pkg_config(){ @@ -1143,7 +1151,7 @@ require_pkg_config(){ test "$name" = "" && name=$pkg check_pkg_config "$@" || die "ERROR: $pkg_version not found" add_cflags$(get_safe "${pkg}_cflags") -add_extralibs $(get_safe "${name}_extralibs") +eval $(sanitize_var_name ${name}_extralibs)="\$(get_safe ${pkg}_extralibs)" } hostcc_e(){ @@ -1256,6 +1264,12 @@ EXAMPLE_LIST=" transcode_aac_example " +# catchall list of things that require external libs to link +EXTRALIBS_LIST=" +cpu_init +cws2fws +" + HWACCEL_LIBRARY_NONFREE_LIST=" cuda libnpp @@ -2492,24 +2506,35 @@
[libav-devel] [PATCH 09/12] configure: Add proper weak dependency of drawtext filter on libfontconfig
--- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 90bc8b2..9ff6ad0 100755 --- a/configure +++ b/configure @@ -2471,6 +2471,7 @@ deinterlace_qsv_filter_deps="libmfx" deinterlace_vaapi_filter_deps="vaapi" delogo_filter_deps="gpl" drawtext_filter_deps="libfreetype" +drawtext_filter_suggest="libfontconfig" frei0r_filter_deps="frei0r dlopen" frei0r_filter_extralibs='$ldl' frei0r_src_filter_deps="frei0r dlopen" -- 2.1.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [v3] fine-grained library dependencies for all components
.. and along comes another iteration of my patch along with another host of preliminaries .. This addresses the main concern of the last iteration that each external library dependency added another extralibs line in configure, resulting in a lot of boilerplate duplication. This is taken care of by some logic to resolve extralibs in a smarter fashion. The diffstat is much more sexy. Before: 4 files changed, 250 insertions(+), 79 deletions(-) After: 5 files changed, 118 insertions(+), 46 deletions(-) So roundabout 100 lines of repetitive boredom are gone. VDA and avfoundation that require -frameworks flags are still broken. This will have to be handled similarly, but in parallel to extralibs somehow. I have an idea, but no implementation yet. Other than that, I'm happy. This is starting to look convincing. Review away ... ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 04/12] configure: Simplify libxcb check
--- configure | 18 -- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/configure b/configure index c543c05..4ee4dab 100755 --- a/configure +++ b/configure @@ -2397,6 +2397,7 @@ sndio_outdev_deps="sndio" v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h" vfwcap_indev_deps="vfw32 vfwcap_defines" xcbgrab_indev_deps="libxcb" +xcbgrab_indev_suggest="libxcb_shm libxcb_xfixes" # protocols ffrtmpcrypt_protocol_deps="!librtmp_protocol" @@ -4763,22 +4764,11 @@ if enabled libcdio; then fi if enabled libxcb; then -check_pkg_config xcb-shape xcb/shape.h xcb_shape_rectangles || { -enabled libxcb && die "ERROR: libxcb not found"; -} && enable libxcb - +require_pkg_config xcb-shape xcb/shape.h xcb_shape_rectangles disabled libxcb_shm || -check_pkg_config xcb-shm xcb/shm.h xcb_shm_attach || { -enabled libxcb_shm && die "ERROR: libxcb_shm not found"; -} && check_header sys/shm.h && enable libxcb_shm - +require_pkg_config xcb-shm xcb/shm.h xcb_shm_attach disabled libxcb_xfixes || -check_pkg_config xcb-xfixes xcb/xfixes.h xcb_xfixes_get_cursor_image || { -enabled libxcb_xfixes && die "ERROR: libxcb_xfixes not found"; -} && enable libxcb_xfixes - -add_cflags "$xcb_shape_cflags $xcb_shm_cflags $xcb_xfixes_cflags" -add_extralibs "$xcb_shape_extralibs $xcb_shm_extralibs $xcb_xfixes_extralibs" +require_pkg_config xcb-xfixes xcb/xfixes.h xcb_xfixes_get_cursor_image fi enabled dxva2 && -- 2.1.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 01/12] configure: Use cppflags check helper functions where appropriate
--- configure | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/configure b/configure index 61d1807..2c8b57e 100755 --- a/configure +++ b/configure @@ -3746,18 +3746,12 @@ add_cppflags -D_ISOC99_SOURCE # some compilers silently accept -std=c11, so we also need to check that the # version macro is defined properly -if test_cflags_cpp -std=c11 "__STDC_VERSION__ >= 201112L"; then -add_cflags -std=c11 -else +check_cpp_condition stdlib.h "__STDC_VERSION__ >= 201112L" && +add_cflags -std=c11 || check_cflags -std=c99 -fi -check_cc -D_FILE_OFFSET_BITS=64 < -EOF -check_cc -D_LARGEFILE_SOURCE < -EOF +check_cppflags -D_FILE_OFFSET_BITS=64 +check_cppflags -D_LARGEFILE_SOURCE add_host_cppflags -D_ISOC99_SOURCE check_host_cflags -std=c99 -- 2.1.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 05/12] configure: Add require_header() convenience function
Simplifies checking for external library headers and aborting if the external library support was requested, but is not available. --- configure | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 4ee4dab..a5d8274 100755 --- a/configure +++ b/configure @@ -1117,6 +1117,13 @@ require(){ check_lib $name "$headers" $func "$@" || die "ERROR: $name_version not found" } +require_header(){ +log require "$@" +header="$1" +shift +check_header "$header" "$@" || die "ERROR: $header not found" +} + require_pkg_config(){ log require_pkg_config "$@" pkg_version="$1" @@ -4616,10 +4623,10 @@ for func in $MATH_FUNCS; do done # these are off by default, so fail if requested and not available -enabled avisynth && { check_header avisynth/avisynth_c.h || die "ERROR: avisynth/avisynth_c.h header not found"; } +enabled avisynth && require_header avisynth/avisynth_c.h enabled avxsynth && require avxsynth "avxsynth/avxsynth_c.h dlfcn.h" dlopen -ldl enabled cuda && require cuda cuda.h cuInit -lcuda -enabled frei0r&& { check_header frei0r.h || die "ERROR: frei0r.h header not found"; } +enabled frei0r&& require_header frei0r.h enabled gnutls&& require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init enabled libbs2b && require_pkg_config libbs2b bs2b.h bs2b_open enabled libdc1394 && require_pkg_config libdc1394-2 dc1394/dc1394.h dc1394_new @@ -4697,7 +4704,7 @@ enabled mmal && { check_lib mmal interface/mmal/mmal.h mmal_port_co enabled omx_rpi && { check_header OMX_Core.h || { ! enabled cross_compile && add_cflags -isystem/opt/vc/include/IL && check_header OMX_Core.h ; } || die "ERROR: OpenMAX IL headers not found"; } -enabled omx && { check_header OMX_Core.h || die "ERROR: OpenMAX IL headers not found"; } +enabled omx && require_header OMX_Core.h enabled openssl && { { check_pkg_config openssl openssl/ssl.h OPENSSL_init_ssl || check_pkg_config openssl openssl/ssl.h SSL_library_init; } && { add_cflags $openssl_cflags && add_extralibs $openssl_extralibs; } || @@ -4709,7 +4716,7 @@ enabled openssl && { { check_pkg_config openssl openssl/ssl.h OPENSSL_ enabled gnutls&& check_lib gmp gmp.h mpz_export -lgmp if enabled nvenc; then -check_header nvEncodeAPI.h || die "ERROR: nvEncodeAPI.h not found." +require_header nvEncodeAPI.h check_cpp_condition nvEncodeAPI.h "NVENCAPI_MAJOR_VERSION >= 6" || die "ERROR: NVENC API version 5 or older is not supported" fi -- 2.1.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 02/12] configure: Merge compiler/libc/os hacks sections
--- configure | 27 +-- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/configure b/configure index 2c8b57e..f7436c5 100755 --- a/configure +++ b/configure @@ -4097,26 +4097,25 @@ test -n "$libc_type" && enable libc_$libc_type probe_libc host_ test -n "$host_libc_type" && enable host_libc_$host_libc_type +# hacks for compiler/libc/os combinations + case $libc_type in bionic) add_compat strtod.o strtod=avpriv_strtod ;; +glibc) +if enabled tms470; then +CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}" +add_cppflags -D__USER_LABEL_PREFIX__= +add_cppflags -D__builtin_memset=memset +add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED +add_cflags -pds=48# incompatible redefinition of macro +elif enabled ccc; then +add_ldflags -Wl,-z,now # calls to libots crash without this +fi +;; esac -# hacks for compiler/libc/os combinations - -if enabled_all tms470 libc_glibc; then -CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}" -add_cppflags -D__USER_LABEL_PREFIX__= -add_cppflags -D__builtin_memset=memset -add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED -add_cflags -pds=48# incompatible redefinition of macro -fi - -if enabled_all ccc libc_glibc; then -add_ldflags -Wl,-z,now # calls to libots crash without this -fi - check_compile_assert flt_lim "float.h limits.h" "DBL_MAX == (double)DBL_MAX" || add_cppflags '-I\$(SRC_PATH)/compat/float' -- 2.1.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 11/12] configure: Simplify dlopen check
--- configure | 23 --- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/configure b/configure index 04f3beb..e07dd0d 100755 --- a/configure +++ b/configure @@ -2220,10 +2220,8 @@ wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel" wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel" # hardware-accelerated codecs -nvenc_deps_any="dlopen LoadLibrary" -nvenc_extralibs='$ldl' -omx_deps="dlopen pthreads" -omx_extralibs='$ldl' +nvenc_deps_any="libdl LoadLibrary" +omx_deps="libdl pthreads" omx_rpi_select="omx" qsvdec_select="qsv" qsvenc_select="qsv" @@ -2278,7 +2276,7 @@ mjpeg2jpeg_bsf_select="jpegtables" # external libraries avisynth_deps="LoadLibrary" -avxsynth_deps="dlopen" +avxsynth_deps="libdl" avisynth_demuxer_deps_any="avisynth avxsynth" avisynth_demuxer_select="riffdec" libdcadec_decoder_deps="libdcadec" @@ -2471,10 +2469,8 @@ deinterlace_vaapi_filter_deps="vaapi" delogo_filter_deps="gpl" drawtext_filter_deps="libfreetype" drawtext_filter_suggest="libfontconfig" -frei0r_filter_deps="frei0r dlopen" -frei0r_filter_extralibs='$ldl' -frei0r_src_filter_deps="frei0r dlopen" -frei0r_src_filter_extralibs='$ldl' +frei0r_filter_deps="frei0r libdl" +frei0r_src_filter_deps="frei0r libdl" hdcd_filter_deps="libhdcd" hqdn3d_filter_deps="gpl" interlace_filter_deps="gpl" @@ -4452,11 +4448,8 @@ check_code cc arm_neon.h "int16x8_t test = vdupq_n_s16(0)" && enable intrinsics_ check_ldflags -Wl,--as-needed -if check_func dlopen; then -ldl= -elif check_func dlopen -ldl; then -ldl=-ldl -fi +# On some systems dynamic loading requires no extra linker flags +check_lib libdl dlfcn.h dlopen || check_lib libdl dlfcn.h dlopen -ldl if ! disabled network; then check_func getaddrinfo $network_extralibs @@ -4639,7 +4632,7 @@ done # these are off by default, so fail if requested and not available enabled avisynth && require_header avisynth/avisynth_c.h -enabled avxsynth && require avxsynth "avxsynth/avxsynth_c.h dlfcn.h" dlopen -ldl +enabled avxsynth && require_header avxsynth/avxsynth_c.h enabled cuda && require cuda cuda.h cuInit -lcuda enabled frei0r&& require_header frei0r.h enabled gnutls&& require_pkg_config "" gnutls gnutls/gnutls.h gnutls_global_init -- 2.1.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 10/12] configure: Drop weak dependencies on external libraries for webm muxer
Weak dependencies on external libraries do not obviate having to explicitly enable these libraries, so the weak dependency does not simplify the configure command line nor have any real effect. --- configure | 1 - 1 file changed, 1 deletion(-) diff --git a/configure b/configure index 9ff6ad0..04f3beb 100755 --- a/configure +++ b/configure @@ -2392,7 +2392,6 @@ w64_demuxer_select="wav_demuxer" wav_demuxer_select="riffdec" wav_muxer_select="riffenc" webm_muxer_select="iso_media riffenc" -webm_muxer_suggest="libopus_encoder libvorbis_encoder libvpx_vp8_encoder libvpx_vp9_encoder" wtv_demuxer_select="mpegts_demuxer riffdec" xmv_demuxer_select="riffdec" xwma_demuxer_select="riffdec" -- 2.1.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 08/12] configure: Rework dependency handling for conflicting components
This makes the feature more visible and obvious. --- configure | 22 +- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/configure b/configure index d3fd489..90bc8b2 100755 --- a/configure +++ b/configure @@ -620,19 +620,21 @@ do_check_deps(){ eval dep_all="\$${cfg}_deps" eval dep_any="\$${cfg}_deps_any" +eval dep_not="\$${cfg}_not" eval dep_sel="\$${cfg}_select" eval dep_sgs="\$${cfg}_suggest" eval dep_ifa="\$${cfg}_if" eval dep_ifn="\$${cfg}_if_any" -pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn -do_check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn -popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn +pushvar cfg dep_all dep_any dep_not dep_sel dep_sgs dep_ifa dep_ifn +check_deps $dep_all $dep_any $dep_not $dep_sel $dep_sgs $dep_ifa $dep_ifn +popvar cfg dep_all dep_any dep_not dep_sel dep_sgs dep_ifa dep_ifn [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; } [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; } enabled_all $dep_all || disable $cfg enabled_any $dep_any || disable $cfg +disabled_all $dep_not || disable $cfg disabled_any $dep_sel && disable $cfg if enabled $cfg; then @@ -1921,7 +1923,8 @@ simd_align_32_if_any="avx" # system capabilities symver_if_any="symver_asm_label symver_gnu_asm" -valgrind_backtrace_deps="!optimizations valgrind_valgrind_h" +valgrind_backtrace_deps="valgrind_valgrind_h" +valgrind_backtrace_not="optimizations" # threading support atomics_gcc_if="sync_val_compare_and_swap" @@ -2418,10 +2421,10 @@ xcbgrab_indev_deps="libxcb" xcbgrab_indev_suggest="libxcb_shm libxcb_xfixes" # protocols -ffrtmpcrypt_protocol_deps="!librtmp_protocol" ffrtmpcrypt_protocol_deps_any="gmp openssl" +ffrtmpcrypt_protocol_not="librtmp_protocol" ffrtmpcrypt_protocol_select="tcp_protocol" -ffrtmphttp_protocol_deps="!librtmp_protocol" +ffrtmphttp_protocol_not="librtmp_protocol" ffrtmphttp_protocol_select="http_protocol" gopher_protocol_select="network" http_protocol_select="tcp_protocol" @@ -2435,10 +2438,10 @@ librtmpt_protocol_deps="librtmp" librtmpte_protocol_deps="librtmp" mmsh_protocol_select="http_protocol" mmst_protocol_select="network" -rtmp_protocol_deps="!librtmp_protocol" +rtmp_protocol_not="librtmp_protocol" rtmp_protocol_select="tcp_protocol" rtmpe_protocol_select="ffrtmpcrypt_protocol" -rtmps_protocol_deps="!librtmp_protocol" +rtmps_protocol_not="librtmp_protocol" rtmps_protocol_select="tls_protocol" rtmpt_protocol_select="ffrtmphttp_protocol" rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol" @@ -2450,7 +2453,8 @@ srtp_protocol_select="rtp_protocol srtp" tcp_protocol_select="network" tls_gnutls_protocol_deps="gnutls" tls_gnutls_protocol_select="tcp_protocol" -tls_openssl_protocol_deps="openssl !tls_gnutls_protocol" +tls_openssl_protocol_deps="openssl" +tls_openssl_protocol_not="tls_gnutls_protocol" tls_openssl_protocol_select="tcp_protocol" tls_protocol_deps_any="tls_gnutls_protocol tls_openssl_protocol" udp_protocol_select="network" -- 2.1.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 03/12] configure: Use inline asm check helper function where appropriate
--- configure | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/configure b/configure index f7436c5..c543c05 100755 --- a/configure +++ b/configure @@ -4165,9 +4165,7 @@ EOF sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }') extern_prefix=${sym%%ff_extern*} -check_cc
[libav-devel] [PATCH 06/12] configure: Add require_cpp_condition() convenience function
Simplifies checking for conditions in external library headers and aborting if said conditions are not met. --- configure | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/configure b/configure index a5d8274..747ce17 100755 --- a/configure +++ b/configure @@ -1124,6 +1124,14 @@ require_header(){ check_header "$header" "$@" || die "ERROR: $header not found" } +require_cpp_condition(){ +log require "$@" +header="$1" +condition="$2" +shift 2 +check_cpp_condition "$header" "$condition" "$@" || die "ERROR: $condition not satisfied" +} + require_pkg_config(){ log require_pkg_config "$@" pkg_version="$1" @@ -4685,13 +4693,11 @@ enabled libvpx&& require_pkg_config "vpx >= 1.3.0" vpx/vpx_codec.h v enabled libwavpack&& require libwavpack wavpack/wavpack.h WavpackOpenFileOutput -lwavpack enabled libwebp && require_pkg_config libwebp webp/encode.h WebPGetEncoderVersion enabled libx264 && require_pkg_config x264 "stdint.h x264.h" x264_encoder_encode && - { check_cpp_condition x264.h "X264_BUILD >= 118" || - die "ERROR: libx264 version must be >= 0.118."; } && + require_cpp_condition x264.h "X264_BUILD >= 118" && { check_cpp_condition x264.h "X264_MPEG2" && enable libx262; } enabled libx265 && require_pkg_config x265 x265.h x265_api_get && - { check_cpp_condition x265.h "X265_BUILD >= 57" || - die "ERROR: libx265 version must be >= 57."; } + require_cpp_condition x265.h "X265_BUILD >= 57" enabled libxavs && require libxavs "stdint.h xavs.h" xavs_encoder_encode -lxavs enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore enabled mmal && { check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host || @@ -4717,8 +4723,7 @@ enabled gnutls&& check_lib gmp gmp.h mpz_export -lgmp if enabled nvenc; then require_header nvEncodeAPI.h -check_cpp_condition nvEncodeAPI.h "NVENCAPI_MAJOR_VERSION >= 6" || -die "ERROR: NVENC API version 5 or older is not supported" +require_cpp_condition nvEncodeAPI.h "NVENCAPI_MAJOR_VERSION >= 6" fi if check_pkg_config sdl SDL_events.h SDL_PollEvent; then -- 2.1.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 07/12] configure: Add name parameter to require_pkg_config() helper function
This allows distinguishing between the internal variable name for external libraries and the pkg-config package name. Having both names available avoids special-casing outside the helper function when the two identifiers do not match. --- configure | 59 +++ 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/configure b/configure index 747ce17..d3fd489 100755 --- a/configure +++ b/configure @@ -1134,11 +1134,14 @@ require_cpp_condition(){ require_pkg_config(){ log require_pkg_config "$@" -pkg_version="$1" -pkg="${1%% *}" +name="$1" +pkg_version="$2" +pkg="${2%% *}" +shift +test "$name" = "" && name=$pkg check_pkg_config "$@" || die "ERROR: $pkg_version not found" add_cflags$(get_safe "${pkg}_cflags") -add_extralibs $(get_safe "${pkg}_extralibs") +add_extralibs $(get_safe "${name}_extralibs") } hostcc_e(){ @@ -4501,7 +4504,7 @@ case "$custom_allocator" in require libjemalloc jemalloc/jemalloc.h malloc -ljemalloc ;; tcmalloc) -require_pkg_config libtcmalloc gperftools/tcmalloc.h tc_malloc +require_pkg_config "" libtcmalloc gperftools/tcmalloc.h tc_malloc malloc_prefix=tc_ ;; esac @@ -4635,41 +4638,41 @@ enabled avisynth && require_header avisynth/avisynth_c.h enabled avxsynth && require avxsynth "avxsynth/avxsynth_c.h dlfcn.h" dlopen -ldl enabled cuda && require cuda cuda.h cuInit -lcuda enabled frei0r&& require_header frei0r.h -enabled gnutls&& require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init -enabled libbs2b && require_pkg_config libbs2b bs2b.h bs2b_open -enabled libdc1394 && require_pkg_config libdc1394-2 dc1394/dc1394.h dc1394_new +enabled gnutls&& require_pkg_config "" gnutls gnutls/gnutls.h gnutls_global_init +enabled libbs2b && require_pkg_config "" libbs2b bs2b.h bs2b_open +enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new enabled libdcadec && require libdcadec libdcadec/dca_context.h dcadec_context_create -ldcadec enabled libfaac && require libfaac "stdint.h faac.h" faacEncGetVersion -lfaac -enabled libfdk_aac&& require_pkg_config fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen -enabled libfontconfig && require_pkg_config fontconfig "fontconfig/fontconfig.h" FcInit -enabled libfreetype && require_pkg_config freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType +enabled libfdk_aac&& require_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen +enabled libfontconfig && require_pkg_config libfontconfig fontconfig "fontconfig/fontconfig.h" FcInit +enabled libfreetype && require_pkg_config libfreetype freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType enabled libgsm&& { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do check_lib libgsm "${gsm_hdr}" gsm_create -lgsm && break; done || die "ERROR: libgsm not found"; } -enabled libhdcd && require_pkg_config libhdcd "hdcd/hdcd_simple.h" hdcd_new +enabled libhdcd && require_pkg_config "" libhdcd "hdcd/hdcd_simple.h" hdcd_new enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc -enabled libkvazaar&& require_pkg_config "kvazaar >= 0.8.1" kvazaar.h kvz_api_get -enabled libmfx&& require_pkg_config libmfx "mfx/mfxvideo.h" MFXInit +enabled libkvazaar&& require_pkg_config libkvazaar "kvazaar >= 0.8.1" kvazaar.h kvz_api_get +enabled libmfx&& require_pkg_config "" libmfx "mfx/mfxvideo.h" MFXInit enabled libmp3lame&& require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame enabled libnpp&& require libnpp npp.h nppGetLibVersion -lnppi -lnppc enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb -enabled libopencv && require_pkg_config opencv opencv/cv.h cvCreateImageHeader -enabled libopenh264 && require_pkg_config openh264 wels/codec_api.h WelsGetCodecVersion +enabled libopencv && require_pkg_config libopencv opencv opencv/cv.h cvCreateImageHeader +enabled libopenh264 && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion enabled libopenjpeg && { check_lib libopenjpeg openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC || - require_pkg_config libopenjpeg1 openjpeg.h opj_version -DOPJ_STATIC; } -enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create -enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h
Re: [libav-devel] [PATCH 09/11] wma: Convert to the new bitstream reader
On Wed, Jan 11, 2017 at 6:10 PM, Diego Biurrunwrote: > From: Alexandra Hájková > > --- > libavcodec/wma.c| 41 +++ > libavcodec/wma.h| 8 +- > libavcodec/wmadec.c | 64 +-- > libavcodec/wmalosslessdec.c | 188 +++ > libavcodec/wmaprodec.c | 207 +- > libavcodec/wmavoice.c | 262 > ++-- > 6 files changed, 387 insertions(+), 383 deletions(-) should be ok, couldn't find anything relevant -- Vittorio ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/3] build: Map -Wall compiler flag to -W3 for MSVC and -Wextra to -W4
On 19/01/2017 11:43, Diego Biurrun wrote: > These are more appropriate warning level equivalents. > --- > configure | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > Not against. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 3/3] configure: Use proper compiler-specific speed flags for hostcc
On 19/01/2017 11:43, Diego Biurrun wrote: > --- > configure | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/configure b/configure > index 7d78ac0..09d2e06 100755 > --- a/configure > +++ b/configure > @@ -3375,6 +3375,7 @@ set_ccvars CC > > probe_cc hostcc "$host_cc" > host_cflags_filter=$_flags_filter > +host_cflags_speed=$_cflags_speed > add_host_cflags $_flags $_cflags > set_ccvars HOSTCC > > @@ -3762,7 +3763,7 @@ EOF > add_host_cppflags -D_ISOC99_SOURCE > check_host_cflags -std=c99 > check_host_cflags -Wall > -check_host_cflags -O3 > +check_host_cflags $host_cflags_speed > > check_64bit(){ > arch32=$1 > Ok. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 2/3] configure: Move optflags checks to a more sensible place
On 19/01/2017 11:43, Diego Biurrun wrote: > --- > configure | 7 +++ > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/configure b/configure > index 461d47c..7d78ac0 100755 > --- a/configure > +++ b/configure > @@ -4929,6 +4929,9 @@ check_optflags(){ > enabled lto && check_ldflags "$@" > } > > +check_optflags $optflags > +check_optflags -fno-math-errno > +check_optflags -fno-signed-zeros > > if enabled lto; then > test "$cc_type" != "$ld_type" && die "LTO requires same compiler and > linker" > @@ -4936,10 +4939,6 @@ if enabled lto; then > check_ldflags -flto $cpuflags > fi > > -check_optflags $optflags > -check_optflags -fno-math-errno > -check_optflags -fno-signed-zeros > - > if enabled icc; then > # Just warnings, no remarks > check_cflags -w1 > Ok. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 06/11] tak: Convert to the new bitstream reader
On Wed, Jan 11, 2017 at 6:10 PM, Diego Biurrunwrote: > From: Alexandra Hájková > > --- > libavcodec/tak.c| 49 +++ > libavcodec/tak.h| 10 +-- > libavcodec/tak_parser.c | 15 ++--- > libavcodec/takdec.c | 158 > > libavformat/takdec.c| 13 ++-- > 5 files changed, 125 insertions(+), 120 deletions(-) > > -static int get_bits_esc4(GetBitContext *gb) > +static int get_bits_esc4(BitstreamContext *bc) > { > -if (get_bits1(gb)) > -return get_bits(gb, 4) + 1; > +if (bitstream_read_bit(bc)) > +return bitstream_read(bc, 4) + 1; > else > return 0; > } should this function get a rename too? something that is unrelated to bitstream_ and at the same time doesn't use the old prefix, like "bits_esc4"? maybe it could be done later it should be ok if you don't want to rename it now -- Vittorio ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 2/2] truemotion2rt: Convert to the new bitstream reader
On Wed, Jan 11, 2017 at 10:44 PM, Diego Biurrunwrote: > --- > > This one is too old and fringe to need benchmarking. > > libavcodec/truemotion2rt.c | 16 > 1 file changed, 8 insertions(+), 8 deletions(-) sure -- Vittorio ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/2] magicyuv: Convert to the new bitstream reader
On Wed, Jan 11, 2017 at 10:44 PM, Diego Biurrunwrote: > --- > > Another fringe codec that should need no benchmarks. > > libavcodec/magicyuv.c | 33 + > 1 file changed, 17 insertions(+), 16 deletions(-) > > diff --git a/libavcodec/magicyuv.c b/libavcodec/magicyuv.c > index 310ead4..8dec6bb 100644 > --- a/libavcodec/magicyuv.c > +++ b/libavcodec/magicyuv.c > @@ -22,14 +22,15 @@ > #include > #include > > -#include "../libavutil/pixdesc.h" > +#include "libavutil/pixdesc.h" > > #include "avcodec.h" > +#include "bitstream.h" > #include "bytestream.h" > -#include "get_bits.h" > #include "huffyuvdsp.h" > #include "internal.h" > #include "thread.h" > +#include "vlc.h" > > typedef struct Slice { > uint32_t start; > @@ -108,7 +109,7 @@ static int magy_decode_slice(AVCodecContext *avctx, void > *tdata, > int interlaced = s->interlaced; > AVFrame *p = s->p; > int i, k, x; > -GetBitContext gb; > +BitstreamContext bc; > uint8_t *dst; > > for (i = 0; i < s->planes; i++) { > @@ -119,20 +120,20 @@ static int magy_decode_slice(AVCodecContext *avctx, > void *tdata, > ptrdiff_t fake_stride = p->linesize[i] * (1 + interlaced); > ptrdiff_t stride = p->linesize[i]; > int flags, pred; > -int ret = init_get_bits8(, s->buf + s->slices[i][j].start, > - s->slices[i][j].size); > +int ret = bitstream_init8(, s->buf + s->slices[i][j].start, > + s->slices[i][j].size); > > if (ret < 0) > return ret; > > -flags = get_bits(, 8); > -pred = get_bits(, 8); > +flags = bitstream_read(, 8); > +pred = bitstream_read(, 8); > > dst = p->data[i] + j * sheight * stride; > if (flags & 1) { > for (k = 0; k < height; k++) { > for (x = 0; x < width; x++) > -dst[x] = get_bits(, 8); > +dst[x] = bitstream_read(, 8); > > dst += stride; > } > @@ -140,10 +141,10 @@ static int magy_decode_slice(AVCodecContext *avctx, > void *tdata, > for (k = 0; k < height; k++) { > for (x = 0; x < width; x++) { > int pix; > -if (get_bits_left() <= 0) > +if (bitstream_bits_left() <= 0) > return AVERROR_INVALIDDATA; > > -pix = get_vlc2(, s->vlc[i].table, s->vlc[i].bits, 3); > +pix = bitstream_read_vlc(, s->vlc[i].table, > s->vlc[i].bits, 3); > if (pix < 0) > return AVERROR_INVALIDDATA; > > @@ -238,7 +239,7 @@ static int magy_decode_frame(AVCodecContext *avctx, void > *data, > ThreadFrame frame = { .f = data }; > AVFrame *p = data; > GetByteContext gbyte; > -GetBitContext gbit; > +BitstreamContext gbit; I wonder whether we should call it 'bc' like the others > uint32_t first_offset, offset, next_offset, header_size, slice_width; > int width, height, format, version, table_size; > int ret, i, j, k; > @@ -370,16 +371,16 @@ static int magy_decode_frame(AVCodecContext *avctx, > void *data, > if (table_size < 2) > return AVERROR_INVALIDDATA; > > -ret = init_get_bits8(, avpkt->data + bytestream2_tell(), > table_size); > +ret = bitstream_init8(, avpkt->data + bytestream2_tell(), > table_size); > if (ret < 0) > return ret; > > memset(s->len, 0, sizeof(s->len)); > j = i = 0; > -while (get_bits_left() >= 8) { > -int b = get_bits(, 4); > -int x = get_bits(, 4); > -int l = get_bitsz(, b) + 1; > +while (bitstream_bits_left() >= 8) { > +int b = bitstream_read(, 4); > +int x = bitstream_read(, 4); > +int l = bitstream_read(, b) + 1; > > for (k = 0; k < l; k++) > if (j + k < 256) > -- should be fine either way -- Vittorio ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] swscale-test: const correctness for pointer variable
On Tue, Jan 24, 2017 at 11:33 AM, Diego Biurrunwrote: > On Thu, Jan 19, 2017 at 12:02:43PM +0100, Diego Biurrun wrote: >> libswscale/swscale-test.c:369:20: warning: passing argument 2 of ‘sws_scale’ >> from incompatible pointer type [-Wincompatible-pointer-types] >> libswscale/swscale.h:207:5: note: expected ‘const uint8_t * const* {aka >> const unsigned char * const*}’ but argument is of type ‘uint8_t ** {aka >> unsigned char **}’ >> --- >> libswscale/tests/swscale.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) > > ping sure -- Vittorio ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] des-test: Pass the proper types to av_des_*() functions
On Thu, Jan 19, 2017 at 12:10:41PM +0100, Diego Biurrun wrote: > Fixes a number of incompatible pointer type warnings. > --- > > Better names for the union or alternative suggestions welcome. > > libavutil/tests/des.c | 35 +++ > 1 file changed, 19 insertions(+), 16 deletions(-) ping Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] swscale-test: const correctness for pointer variable
On Thu, Jan 19, 2017 at 12:02:43PM +0100, Diego Biurrun wrote: > libswscale/swscale-test.c:369:20: warning: passing argument 2 of ‘sws_scale’ > from incompatible pointer type [-Wincompatible-pointer-types] > libswscale/swscale.h:207:5: note: expected ‘const uint8_t * const* {aka const > unsigned char * const*}’ but argument is of type ‘uint8_t ** {aka unsigned > char **}’ > --- > libswscale/tests/swscale.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) ping Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/3] build: Map -Wall compiler flag to -W3 for MSVC and -Wextra to -W4
On Thu, Jan 19, 2017 at 11:43:38AM +0100, Diego Biurrun wrote: > These are more appropriate warning level equivalents. > --- > configure | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) ping the set Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 05/11] mpc: Convert to the new bitstream reader
On 11/01/2017 18:10, Diego Biurrun wrote: > From: Alexandra Hájková> Sounds Ok. lu ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 07/11] wavpack: Convert to the new bitstream reader
On 11/01/2017 18:10, Diego Biurrun wrote: > From: Alexandra Hájková> > --- > libavcodec/wavpack.c | 92 > ++-- > 1 file changed, 46 insertions(+), 46 deletions(-) > Seems still ok. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/4] vaapi_encode: Pass framerate parameters to driver
Quoting Mark Thompson (2017-01-21 23:10:54) > On 13/01/17 11:07, Anton Khirnov wrote: > > Quoting Mark Thompson (2017-01-10 00:47:55) > >> --- > >> The i965 driver has been updated so that this works consistently. > >> > >> libavcodec/vaapi_encode.c | 14 ++ > >> libavcodec/vaapi_encode.h | 4 > >> 2 files changed, 18 insertions(+) > >> > > > > Code itself looks ok, but won't old versions of the driver misbehave? > > It will make the bitrate-targetted RC modes for VP8 and VP9 do nasty things > with the Intel driver before 1.8.0. > > Would you prefer this to have some sort of hack to try to parse the > Intel driver version out of the vendor string and fail out for some > codecs? (That's the only way I can see to test it - the API is clear > that this has always been valid, it was just the driver which didn't > implement it properly.) > > For VP8 it's essentially irrelevant because the driver is so terrible > in current versions that noone in their right mind would ever use it > (there are now patches outstanding on the libva list which make it > usable). For VP9 it's unfortunate because it does already work mostly > sensibly, but given how recent the hardware is one would hope that > people aren't going to blindly expect an earlier version of libva to > work properly? I guess if it's just VP8 and VP9 then we shouldn't be too concerned too much. Perhaps just mention on the wiki or somewhere that old intel drivers don't work properly. -- Anton Khirnov ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel