diff --git a/mythtv/configure b/mythtv/configure index ea14b046099..fc7fc9f5252 100755 --- a/mythtv/configure +++ b/mythtv/configure @@ -173,6 +173,7 @@ EOF < $TMPS log_file $TMPS shift 1 - check_cmd $yasmexe $YASMFLAGS -Werror "$@" -o $TMPO $TMPS + check_cmd $x86asmexe $X86ASMFLAGS -Werror "$@" -o $TMPO $TMPS } ld_o(){ @@ -1128,8 +1160,8 @@ check_code(){ check_cppflags(){ log check_cppflags "$@" - check_cc "$@" < EOF } @@ -1155,15 +1187,15 @@ EOF } test_objcflags(){ - log test_cflags "$@" - set -- $($cflags_filter "$@") + log test_objcflags "$@" + set -- $($objcflags_filter "$@") check_objcc "$@" <" echo "int main(void) { return 0; }" - } | check_objcc && check_stat "$TMPO" && enable_safe $headers + } | check_objcc && check_stat "$TMPO" && enable_safe $header +} + +check_apple_framework(){ + log check_apple_framework "$@" + framework="$1" + name="$(tolower $framework)" + header="${framework}/${framework}.h" + disable $name + check_header_objcc $header && enable $name && add_extralibs "-framework $framework" } check_func(){ @@ -1265,10 +1306,16 @@ check_func_headers(){ for hdr in $headers; do print_include $hdr done + echo "#include " for func in $funcs; do echo "long check_$func(void) { return (long) $func; }" done - echo "int main(void) { return 0; }" + echo "int main(void) { int ret = 0;" + # LTO could optimize out the test functions without this + for func in $funcs; do + echo " ret |= ((intptr_t)check_$func) & 0xFFFF;" + done + echo "return ret; }" } | check_ld "cc" "$@" && enable $funcs && enable_safe $headers } @@ -1304,20 +1351,30 @@ check_cpp_condition(){ EOF } -check_lib(){ - log check_lib "$@" - header="$1" - func="$2" - shift 2 - check_header $header && check_func $func "$@" && add_extralibs "$@" +test_cflags_cc(){ + log test_cflags_cc "$@" + flags=$1 + header=$2 + condition=$3 + shift 3 + set -- $($cflags_filter "$flags") + check_cc "$@" < +#if !($condition) +#error "unsatisfied condition: $condition" +#endif +EOF } -check_lib2(){ - log check_lib2 "$@" - headers="$1" - funcs="$2" - shift 2 - check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@" +check_lib(){ + log check_lib "$@" + name="$1" + headers="$2" + funcs="$3" + shift 3 + disable $name + check_func_headers "$headers" "$funcs" "$@" && + enable $name && add_extralibs "$@" } check_lib_cpp(){ @@ -1330,17 +1387,20 @@ check_lib_cpp(){ check_pkg_config(){ log check_pkg_config "$@" - pkgandversion="$1" - pkg="${1%% *}" - headers="$2" - funcs="$3" - shift 3 - check_cmd $pkg_config --exists --print-errors $pkgandversion || return + name="$1" + pkg_version="$2" + pkg="${2%% *}" + headers="$3" + funcs="$4" + shift 4 + disable $name + check_cmd $pkg_config --exists --print-errors $pkg_version || return pkg_cflags=$($pkg_config --cflags $pkg_config_flags $pkg) pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg) check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" && - set_safe "${pkg}_cflags" $pkg_cflags && - set_safe "${pkg}_libs" $pkg_libs + enable $name && + set_safe "${pkg}_cflags" $pkg_cflags && + set_safe "${pkg}_extralibs" $pkg_libs } check_exec(){ @@ -1348,6 +1408,7 @@ check_exec(){ } check_exec_crash(){ + log check_exec_crash "$@" code=$(cat) # exit() is not async signal safe. _Exit (C99) and _exit (POSIX) @@ -1418,19 +1479,13 @@ check_compile_assert(){ } require(){ - name="$1" - header="$2" - func="$3" - shift 3 - check_lib $header $func "$@" || die "ERROR: $name not found" -} - -require2(){ - name="$1" + log require "$@" + name_version="$1" + name="${1%% *}" headers="$2" func="$3" shift 3 - check_lib2 "$headers" $func "$@" || die "ERROR: $name not found" + check_lib $name "$headers" $func "$@" || die "ERROR: $name_version not found" } require_cpp(){ @@ -1441,35 +1496,33 @@ require_cpp(){ check_lib_cpp "$headers" "$classes" "$@" || die "ERROR: $name not found" } +require_header(){ + log require "$@" + header="$1" + shift + check_header "$header" "$@" || die "ERROR: $header header not found" +} + +require_cpp_condition(){ + log require "$@" + header="$1" + condition="$2" + shift 2 + check_cpp_condition "$header" "$condition" "$@" || die "ERROR: $condition not satisfied" +} + use_pkg_config(){ - pkg="$1" + log use_pkg_config "$@" + pkg="${2%% *}" check_pkg_config "$@" || return 1 add_cflags $(get_safe "${pkg}_cflags") - add_extralibs $(get_safe "${pkg}_libs") + add_extralibs $(get_safe "${pkg}_extralibs") } require_pkg_config(){ - use_pkg_config "$@" || die "ERROR: $pkg not found using pkg-config$pkg_config_fail_message" -} - -require_libfreetype(){ - log require_libfreetype "$@" - pkg="freetype2" - check_cmd $pkg_config --exists --print-errors $pkg \ - || die "ERROR: $pkg not found" - pkg_cflags=$($pkg_config --cflags $pkg_config_flags $pkg) - pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg) - { - echo "#include " - echo "#include FT_FREETYPE_H" - echo "long check_func(void) { return (long) FT_Init_FreeType; }" - echo "int main(void) { return 0; }" - } | check_ld "cc" $pkg_cflags $pkg_libs \ - && set_safe "${pkg}_cflags" $pkg_cflags \ - && set_safe "${pkg}_libs" $pkg_libs \ - || die "ERROR: $pkg not found" - add_cflags $(get_safe "${pkg}_cflags") - add_extralibs $(get_safe "${pkg}_libs") + log require_pkg_config "$@" + pkg_version="$2" + use_pkg_config "$@" || die "ERROR: $pkg_version not found using pkg-config$pkg_config_fail_message" } hostcc_e(){ @@ -1496,8 +1549,8 @@ check_host_cpp(){ check_host_cppflags(){ log check_host_cppflags "$@" - check_host_cc "$@" < EOF } @@ -1523,9 +1576,10 @@ EOF } cp_if_changed(){ - cmp -s "$1" "$2" && echo "$2 is unchanged" && return + cmp -s "$1" "$2" && { test "$quiet" != "yes" && echo "$2 is unchanged"; } && return mkdir -p "$(dirname $2)" - $cp_f "$1" "$2" + cp -f "$1" "$2" + echo "Created $2" } # MythTV Custom Tests @@ -1689,9 +1743,11 @@ AVDEVICE_COMPONENTS=" indevs outdevs " + AVFILTER_COMPONENTS=" filters " + AVFORMAT_COMPONENTS=" demuxers muxers @@ -1699,6 +1755,7 @@ AVFORMAT_COMPONENTS=" " AVRESAMPLE_COMPONENTS="" + AVUTIL_COMPONENTS="" COMPONENT_LIST=" @@ -1713,13 +1770,17 @@ COMPONENT_LIST=" EXAMPLE_LIST=" avio_dir_cmd_example avio_reading_example - decoding_encoding_example + decode_audio_example + decode_video_example demuxing_decoding_example + encode_audio_example + encode_video_example extract_mvs_example filter_audio_example filtering_audio_example filtering_video_example http_multiclient_example + hw_decode_example metadata_example muxing_example qsvdec_example @@ -1730,28 +1791,76 @@ EXAMPLE_LIST=" transcoding_example " -EXTERNAL_LIBRARY_LIST=" - avisynth +EXTERNAL_AUTODETECT_LIBRARY_LIST=" + alsa + appkit + avfoundation bzlib - chromaprint - crystalhd - decklink + coreimage + iconv + jack + libxcb + libxcb_shm + libxcb_shape + libxcb_xfixes + lzma + schannel + sdl2 + securetransport + sndio + xlib + zlib +" + +EXTERNAL_LIBRARY_GPL_LIST=" + avisynth frei0r - gcrypt + libcdio + librubberband + libvidstab + libx264 + libx265 + libxavs + libxvid +" + +EXTERNAL_LIBRARY_NONFREE_LIST=" + decklink + libndi_newtek + libfdk_aac + openssl +" + +EXTERNAL_LIBRARY_VERSION3_LIST=" gmp + libopencore_amrnb + libopencore_amrwb + libvo_amrwbenc + rkmpp +" + +EXTERNAL_LIBRARY_GPLV3_LIST=" + libsmbclient +" + +EXTERNAL_LIBRARY_LIST=" + $EXTERNAL_AUTODETECT_LIBRARY_LIST + $EXTERNAL_LIBRARY_GPL_LIST + $EXTERNAL_LIBRARY_NONFREE_LIST + $EXTERNAL_LIBRARY_VERSION3_LIST + $EXTERNAL_LIBRARY_GPLV3_LIST + chromaprint + gcrypt gnutls - iconv jni ladspa libass libbluray libbs2b libcaca - libcdio libcelt libdc1394 - libebur128 - libfdk_aac + libdrm libflite libfontconfig libfreetype @@ -1763,18 +1872,15 @@ EXTERNAL_LIBRARY_LIST=" libkvazaar libmodplug libmp3lame - libnut - libopencore_amrnb - libopencore_amrwb + libmysofa libopencv libopenh264 libopenjpeg libopenmpt libopus libpulse + librsvg librtmp - librubberband - libschroedinger libshine libsmbclient libsnappy @@ -1785,58 +1891,50 @@ EXTERNAL_LIBRARY_LIST=" libtheora libtwolame libv4l2 - libvidstab - libvo_amrwbenc + libvmaf libvorbis libvpx libwavpack libwebp - libx264 - libx265 - libxavs - libxcb - libxcb_shm - libxcb_shape - libxcb_xfixes - libxvid + libxml2 libzimg libzmq libzvbi - lzma mediacodec - netcdf openal opencl opengl - openssl - schannel - sdl - sdl2 - securetransport - videotoolbox - x11grab - xlib - zlib " -HWACCEL_LIBRARY_LIST=" +HWACCEL_AUTODETECT_LIBRARY_LIST=" audiotoolbox + crystalhd cuda cuvid d3d11va dxva2 - libmfx - libnpp - mmal nvenc - omx vaapi vda vdpau - videotoolbox_hwaccel + videotoolbox + v4l2_m2m xvmc " +HWACCEL_LIBRARY_NONFREE_LIST=" + cuda_sdk + libnpp +" + +HWACCEL_LIBRARY_LIST=" + $HWACCEL_AUTODETECT_LIBRARY_LIST + $HWACCEL_LIBRARY_NONFREE_LIST + libmfx + mmal + omx +" + DOCUMENT_LIST=" doc htmlpages @@ -1898,8 +1996,8 @@ SUBSYSTEM_LIST=" rdft " +# COMPONENT_LIST needs to come last to ensure correct dependency checking CONFIG_LIST=" - $COMPONENT_LIST $DOCUMENT_LIST $EXAMPLE_LIST $EXTERNAL_LIBRARY_LIST @@ -1909,16 +2007,17 @@ CONFIG_LIST=" $LIBRARY_LIST $PROGRAM_LIST $SUBSYSTEM_LIST + autodetect fontconfig - memalign_hack + linux_perf memory_poisoning neon_clobber_test + ossfuzz pic - pod2man - raise_major thumb valgrind_backtrace xmm_clobber_test + $COMPONENT_LIST " THREADS_LIST=" @@ -1933,6 +2032,12 @@ ATOMICS_LIST=" atomics_win32 " +AUTODETECT_LIBS=" + $EXTERNAL_AUTODETECT_LIBRARY_LIST + $HWACCEL_AUTODETECT_LIBRARY_LIST + $THREADS_LIST +" + ARCH_LIST=" aarch64 alpha @@ -2040,11 +2145,11 @@ ARCH_FEATURES=" local_aligned_16 local_aligned_32 simd_align_16 + simd_align_32 " BUILTIN_LIST=" atomic_cas_ptr - atomic_compare_exchange machine_rw_barrier MemoryBarrier mm_empty @@ -2056,7 +2161,7 @@ BUILTIN_LIST=" HAVE_LIST_CMDLINE=" inline_asm symver - yasm + x86asm " HAVE_LIST_PUB=" @@ -2065,12 +2170,13 @@ HAVE_LIST_PUB=" " HEADERS_LIST=" - alsa_asoundlib_h altivec_h arpa_inet_h asm_types_h cdio_paranoia_h cdio_paranoia_paranoia_h + cuda_h + d3d11_h dispatch_dispatch_h dev_bktr_ioctl_bt848_h dev_bktr_ioctl_meteor_h @@ -2080,7 +2186,7 @@ HEADERS_LIST=" direct_h dirent_h dlfcn_h - d3d11_h + dxgidebug_h dxva_h ES2_gl_h EGL_egl_h @@ -2093,13 +2199,15 @@ HEADERS_LIST=" machine_ioctl_meteor_h malloc_h opencv2_core_core_c_h + openjpeg_2_3_openjpeg_h + openjpeg_2_2_openjpeg_h openjpeg_2_1_openjpeg_h openjpeg_2_0_openjpeg_h openjpeg_1_5_openjpeg_h OpenGL_gl3_h poll_h - sndio_h soundcard_h + stdatomic_h sys_mman_h sys_param_h sys_resource_h @@ -2166,7 +2274,6 @@ SYSTEM_FUNCS=" CommandLineToArgvW CoTaskMemFree CryptGenRandom - dlopen fcntl flt_lim fork @@ -2218,11 +2325,13 @@ SYSTEM_FUNCS=" TOOLCHAIN_FEATURES=" as_dn_directive + as_fpu_directive as_func as_object_arch asm_mod_q attribute_may_alias attribute_packed + blocks_extension ebp_available ebx_available gnu_as @@ -2242,6 +2351,7 @@ TOOLCHAIN_FEATURES=" TYPES_LIST=" CONDITION_VARIABLE_Ptr + kCMVideoCodecType_HEVC socklen_t struct_addrinfo struct_group_source_req @@ -2277,25 +2387,20 @@ HAVE_LIST=" $TYPES_LIST atomics_native dos_paths - dxva2_lib - dxva2api_cobj libc_msvcrt - libdc1394_1 - libdc1394_2 makeinfo makeinfo_html MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS perl pod2man - sdl2 section_data_rel_ro texi2html threads + uwp vaapi_drm vaapi_x11 vdpau_x11 winrt - xlib " # options emitted with CONFIG_ prefix but not available on the command line @@ -2322,15 +2427,17 @@ CONFIG_EXTRA=" h263dsp h264chroma h264dsp + h264parse h264pred h264qpel + hevcparse hpeldsp huffman huffyuvdsp huffyuvencdsp idctdsp iirfilter - imdct15 + mdct15 intrax8 iso_media ividsp @@ -2339,12 +2446,14 @@ CONFIG_EXTRA=" libx262 llauddsp llviddsp + llvidencdsp lpc lzf me_cmp mpeg_er mpegaudio mpegaudiodsp + mpegaudioheader mpegvideo mpegvideoenc mss34dsp @@ -2366,13 +2475,13 @@ CONFIG_EXTRA=" texturedsp texturedspenc tpeldsp + vaapi_1 vaapi_encode vc1dsp videodsp vp3dsp vp56dsp vp8dsp - vt_bt2020 wma_freqs wmv2dsp " @@ -2547,10 +2656,11 @@ CMDLINE_SET=" gas host_cc host_cflags + host_extralibs host_ld host_ldflags - host_libs host_os + ignore_tests install ld ln_s @@ -2558,6 +2668,7 @@ CMDLINE_SET=" malloc_prefix nm optflags + nvccflags pkg_config pkg_config_flags progs_suffix @@ -2575,7 +2686,7 @@ CMDLINE_SET=" tempprefix toolchain valgrind - yasmexe + x86asmexe $MYTHTV_PATHS_LIST $MYTHTV_CMDLINE_SET " @@ -2646,7 +2757,7 @@ fma3_deps="avx" fma4_deps="avx" avx2_deps="avx" -mmx_external_deps="yasm" +mmx_external_deps="x86asm" mmx_inline_deps="inline_asm" mmx_suggest="mmx_external mmx_inline" @@ -2662,13 +2773,15 @@ fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64" fast_clz_if_any="aarch64 alpha avr32 mips ppc x86" fast_unaligned_if_any="aarch64 ppc x86" simd_align_16_if_any="altivec neon sse" +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_conflict="optimizations" +valgrind_backtrace_deps="valgrind_valgrind_h" # threading support -atomics_gcc_if_any="sync_val_compare_and_swap atomic_compare_exchange" +atomics_gcc_if="sync_val_compare_and_swap" atomics_suncc_if="atomic_cas_ptr machine_rw_barrier" atomics_win32_if="MemoryBarrier" atomics_native_if_any="$ATOMICS_LIST" @@ -2682,12 +2795,14 @@ error_resilience_select="me_cmp" faandct_deps="faan fdctdsp" faanidct_deps="faan idctdsp" h264dsp_select="startcode" +hevcparse_select="golomb" frame_thread_encoder_deps="encoders threads" intrax8_select="blockdsp idctdsp" mdct_select="fft" +mdct15_select="fft" me_cmp_select="fdctdsp idctdsp pixblockdsp" mpeg_er_select="error_resilience" -mpegaudio_select="mpegaudiodsp" +mpegaudio_select="mpegaudiodsp mpegaudioheader" mpegaudiodsp_select="dct" mpegvideo_select="blockdsp h264chroma hpeldsp idctdsp me_cmp mpeg_er videodsp" mpegvideoenc_select="me_cmp mpegvideo pixblockdsp qpeldsp" @@ -2695,7 +2810,7 @@ vc1dsp_select="h264chroma qpeldsp startcode" rdft_select="fft" # decoders / encoders -aac_decoder_select="imdct15 mdct sinewin" +aac_decoder_select="mdct15 mdct sinewin" aac_fixed_decoder_select="mdct sinewin" aac_encoder_select="audio_frame_queue iirfilter lpc mdct sinewin" aac_latm_decoder_select="aac_decoder aac_latm_parser" @@ -2714,7 +2829,7 @@ amv_decoder_select="sp5x_decoder exif" amv_encoder_select="aandcttables jpegtables mpegvideoenc" ape_decoder_select="bswapdsp llauddsp" apng_decoder_select="zlib" -apng_encoder_select="huffyuvencdsp zlib" +apng_encoder_select="llvidencdsp zlib" asv1_decoder_select="blockdsp bswapdsp idctdsp" asv1_encoder_select="bswapdsp fdctdsp pixblockdsp" asv2_decoder_select="blockdsp bswapdsp idctdsp" @@ -2727,6 +2842,7 @@ bink_decoder_select="blockdsp hpeldsp" binkaudio_dct_decoder_select="mdct rdft dct sinewin wma_freqs" binkaudio_rdft_decoder_select="mdct rdft sinewin wma_freqs" cavs_decoder_select="blockdsp golomb h264chroma idctdsp qpeldsp videodsp" +clearvideo_decoder_select="idctdsp" cllc_decoder_select="bswapdsp" comfortnoise_encoder_select="lpc" cook_decoder_select="audiodsp mdct sinewin" @@ -2737,6 +2853,7 @@ dds_decoder_select="texturedsp" dirac_decoder_select="dirac_parse dwt golomb videodsp mpegvideoenc" dnxhd_decoder_select="blockdsp idctdsp" dnxhd_encoder_select="aandcttables blockdsp fdctdsp idctdsp mpegvideoenc pixblockdsp" +dolby_e_decoder_select="mdct" dvvideo_decoder_select="dvprofile idctdsp" dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp" dxa_decoder_select="zlib" @@ -2747,13 +2864,13 @@ eamad_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpegvideo" eatgq_decoder_select="aandcttables" eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp" exr_decoder_select="zlib" -ffv1_decoder_select="golomb rangecoder" +ffv1_decoder_select="rangecoder" ffv1_encoder_select="rangecoder" ffvhuff_decoder_select="huffyuv_decoder" ffvhuff_encoder_select="huffyuv_encoder" fic_decoder_select="golomb" -flac_decoder_select="flacdsp golomb" -flac_encoder_select="bswapdsp flacdsp golomb lpc" +flac_decoder_select="flacdsp" +flac_encoder_select="bswapdsp flacdsp lpc" flashsv2_decoder_select="zlib" flashsv2_encoder_select="zlib" flashsv_decoder_select="zlib" @@ -2771,36 +2888,33 @@ h263_encoder_select="aandcttables h263dsp mpegvideoenc" h263i_decoder_select="h263_decoder" h263p_decoder_select="h263_decoder" h263p_encoder_select="h263_encoder" -h264_decoder_select="cabac golomb h264chroma h264dsp h264pred h264qpel videodsp" +h264_decoder_select="cabac golomb h264chroma h264dsp h264parse h264pred h264qpel videodsp" h264_decoder_suggest="error_resilience" hap_decoder_select="snappy texturedsp" hap_encoder_deps="libsnappy" hap_encoder_select="texturedspenc" -hevc_decoder_select="bswapdsp cabac golomb videodsp" +hevc_decoder_select="bswapdsp cabac golomb hevcparse videodsp" huffyuv_decoder_select="bswapdsp huffyuvdsp llviddsp" -huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp llviddsp" +huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp llvidencdsp" iac_decoder_select="imc_decoder" imc_decoder_select="bswapdsp fft mdct sinewin" indeo3_decoder_select="hpeldsp" indeo4_decoder_select="ividsp" indeo5_decoder_select="ividsp" interplay_video_decoder_select="hpeldsp" -jpegls_decoder_select="golomb mjpeg_decoder" -jpegls_encoder_select="golomb" +jpegls_decoder_select="mjpeg_decoder" jv_decoder_select="blockdsp" -lagarith_decoder_select="huffyuvdsp" -ljpeg_encoder_select="aandcttables idctdsp jpegtables" -loco_decoder_select="golomb" -magicyuv_decoder_select="huffyuvdsp" +lagarith_decoder_select="llviddsp" +ljpeg_encoder_select="aandcttables idctdsp jpegtables mpegvideoenc" +magicyuv_decoder_select="llviddsp" mdec_decoder_select="blockdsp idctdsp mpegvideo" metasound_decoder_select="lsp mdct sinewin" mimic_decoder_select="blockdsp bswapdsp hpeldsp idctdsp" mjpeg_decoder_select="blockdsp hpeldsp exif idctdsp jpegtables" mjpeg_encoder_select="aandcttables jpegtables mpegvideoenc" mjpegb_decoder_select="mjpeg_decoder" -mjpeg_vaapi_encoder_deps="VAEncPictureParameterBufferJPEG" -mjpeg_vaapi_encoder_select="vaapi_encode jpegtables" mlp_decoder_select="mlp_parser" +mlp_encoder_select="lpc" motionpixels_decoder_select="bswapdsp" mp1_decoder_select="mpegaudio" mp1float_decoder_select="mpegaudio" @@ -2824,12 +2938,13 @@ mpeg2video_encoder_select="aandcttables mpegvideoenc h263dsp" mpeg4_decoder_select="h263_decoder mpeg4video_parser" mpeg4_encoder_select="h263_encoder" msa1_decoder_select="mss34dsp" +mscc_decoder_select="zlib" msmpeg4v1_decoder_select="h263_decoder" msmpeg4v2_decoder_select="h263_decoder" msmpeg4v2_encoder_select="h263_encoder" msmpeg4v3_decoder_select="h263_decoder" msmpeg4v3_encoder_select="h263_encoder" -mss2_decoder_select="vc1_decoder mpegvideo" +mss2_decoder_select="mpegvideo qpeldsp vc1_decoder" mts2_decoder_select="mss34dsp" mxpeg_decoder_select="mjpeg_decoder" nellymoser_decoder_select="mdct sinewin" @@ -2837,9 +2952,10 @@ nellymoser_encoder_select="audio_frame_queue mdct sinewin" nuv_decoder_select="idctdsp lzo" on2avc_decoder_select="mdct" opus_decoder_deps="swresample" -opus_decoder_select="imdct15" +opus_decoder_select="mdct15" +opus_encoder_select="audio_frame_queue mdct15" png_decoder_select="zlib" -png_encoder_select="huffyuvencdsp zlib" +png_encoder_select="llvidencdsp zlib" prores_decoder_select="blockdsp idctdsp" prores_encoder_select="fdctdsp" qcelp_decoder_select="lsp" @@ -2857,7 +2973,7 @@ rv20_encoder_select="h263_encoder" rv30_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp" rv40_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp" screenpresso_decoder_select="zlib" -shorten_decoder_select="golomb" +shorten_decoder_select="bswapdsp" sipr_decoder_select="lsp" snow_decoder_select="dwt h264qpel hpeldsp me_cmp rangecoder videodsp" snow_encoder_select="aandcttables dwt h264qpel hpeldsp me_cmp mpegvideoenc rangecoder" @@ -2865,9 +2981,10 @@ sonic_decoder_select="golomb rangecoder" sonic_encoder_select="golomb rangecoder" sonic_ls_encoder_select="golomb rangecoder" sp5x_decoder_select="mjpeg_decoder" +srgc_decoder_select="zlib" svq1_decoder_select="hpeldsp" svq1_encoder_select="aandcttables hpeldsp me_cmp mpegvideoenc" -svq3_decoder_select="golomb h264dsp h264pred hpeldsp tpeldsp videodsp" +svq3_decoder_select="golomb h264dsp h264parse h264pred hpeldsp tpeldsp videodsp" svq3_decoder_suggest="zlib" tak_decoder_select="audiodsp" tdsc_decoder_select="zlib mjpeg_decoder" @@ -2876,17 +2993,18 @@ thp_decoder_select="mjpeg_decoder" tiff_decoder_suggest="zlib lzma" tiff_encoder_suggest="zlib" truehd_decoder_select="mlp_parser" +truehd_encoder_select="lpc" truemotion2_decoder_select="bswapdsp" truespeech_decoder_select="bswapdsp" tscc_decoder_select="zlib" twinvq_decoder_select="mdct lsp sinewin" txd_decoder_select="texturedsp" -utvideo_decoder_select="bswapdsp" -utvideo_encoder_select="bswapdsp huffman huffyuvencdsp" -vble_decoder_select="huffyuvdsp" +utvideo_decoder_select="bswapdsp llviddsp" +utvideo_encoder_select="bswapdsp huffman llvidencdsp" +vble_decoder_select="llviddsp" vc1_decoder_select="blockdsp h263_decoder h264qpel intrax8 mpegvideo vc1dsp" vc1_qsv_decoder_deps="libmfx" -vc1_qsv_decoder_select="qsvdec vc1_qsv_hwaccel" +vc1_qsv_decoder_select="qsvdec vc1_qsv_hwaccel vc1_parser" vc1image_decoder_select="vc1_decoder" vorbis_decoder_select="mdct" vorbis_encoder_select="mdct" @@ -2920,64 +3038,53 @@ zlib_encoder_select="zlib" zmbv_decoder_select="zlib" zmbv_encoder_select="zlib" -# platform codecs -audiotoolbox_deps="AudioToolbox_AudioToolbox_h" -audiotoolbox_extralibs="-framework CoreFoundation -framework AudioToolbox -framework CoreMedia" - # hardware accelerators crystalhd_deps="libcrystalhd_libcrystalhd_if_h" +cuda_deps_any="libdl LoadLibrary" cuvid_deps="cuda" d3d11va_deps="d3d11_h dxva_h ID3D11VideoDecoder ID3D11VideoContext" -dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode" -vaapi_deps="va_va_h" -vda_framework_deps="VideoDecodeAcceleration_VDADecoder_h" +dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode ole32" +dxva2_extralibs="-luser32" +vda_framework_deps="VideoDecodeAcceleration_VDADecoder_h blocks_extension" vda_framework_extralibs="-framework VideoDecodeAcceleration" vda_deps="vda_framework pthreads" vda_extralibs="-framework CoreFoundation -framework QuartzCore" -vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h" videotoolbox_hwaccel_deps="videotoolbox pthreads" videotoolbox_hwaccel_extralibs="-framework QuartzCore" xvmc_deps="X11_extensions_XvMClib_h" -h263_cuvid_hwaccel_deps="cuda cuvid" h263_vaapi_hwaccel_deps="vaapi" h263_vaapi_hwaccel_select="h263_decoder" h263_videotoolbox_hwaccel_deps="videotoolbox" h263_videotoolbox_hwaccel_select="h263_decoder" -h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser" h264_cuvid_hwaccel_deps="cuda cuvid" +h264_cuvid_hwaccel_select="h264_cuvid_decoder" h264_d3d11va_hwaccel_deps="d3d11va" h264_d3d11va_hwaccel_select="h264_decoder" +h264_d3d11va2_hwaccel_deps="d3d11va" +h264_d3d11va2_hwaccel_select="h264_decoder" h264_dxva2_hwaccel_deps="dxva2" h264_dxva2_hwaccel_select="h264_decoder" -h264_mediacodec_decoder_deps="mediacodec" h264_mediacodec_hwaccel_deps="mediacodec" -h264_mediacodec_decoder_select="h264_mp4toannexb_bsf h264_parser" -h264_mmal_decoder_deps="mmal" -h264_mmal_decoder_select="mmal" h264_mmal_hwaccel_deps="mmal" -h264_omx_encoder_deps="omx" h264_qsv_hwaccel_deps="libmfx" h264_vaapi_hwaccel_deps="vaapi" h264_vaapi_hwaccel_select="h264_decoder" -h264_vda_decoder_deps="vda" -h264_vda_decoder_select="h264_decoder" h264_vda_hwaccel_deps="vda" h264_vda_hwaccel_select="h264_decoder" h264_vda_old_hwaccel_deps="vda" h264_vda_old_hwaccel_select="h264_decoder" -h264_vdpau_decoder_deps="vdpau" -h264_vdpau_decoder_select="h264_decoder" h264_vdpau_hwaccel_deps="vdpau" h264_vdpau_hwaccel_select="h264_decoder" h264_videotoolbox_hwaccel_deps="videotoolbox" h264_videotoolbox_hwaccel_select="h264_decoder" hevc_cuvid_hwaccel_deps="cuda cuvid" +hevc_cuvid_hwaccel_select="hevc_cuvid_decoder" hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC" hevc_d3d11va_hwaccel_select="hevc_decoder" -hevc_mediacodec_decoder_deps="mediacodec" hevc_mediacodec_hwaccel_deps="mediacodec" -hevc_mediacodec_decoder_select="hevc_mp4toannexb_bsf hevc_parser" +hevc_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_HEVC" +hevc_d3d11va2_hwaccel_select="hevc_decoder" hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC" hevc_dxva2_hwaccel_select="hevc_decoder" hevc_qsv_hwaccel_deps="libmfx" @@ -2985,28 +3092,29 @@ hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC" hevc_vaapi_hwaccel_select="hevc_decoder" hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC" hevc_vdpau_hwaccel_select="hevc_decoder" +hevc_videotoolbox_hwaccel_deps="videotoolbox" +hevc_videotoolbox_hwaccel_select="hevc_decoder" mjpeg_cuvid_hwaccel_deps="cuda cuvid" -mpeg_vdpau_decoder_deps="vdpau" -mpeg_vdpau_decoder_select="mpeg2video_decoder" +mjpeg_cuvid_hwaccel_select="mjpeg_cuvid_decoder" mpeg_xvmc_hwaccel_deps="xvmc" mpeg_xvmc_hwaccel_select="mpeg2video_decoder" mpeg1_cuvid_hwaccel_deps="cuda cuvid" -mpeg1_vdpau_decoder_deps="vdpau" -mpeg1_vdpau_decoder_select="mpeg1video_decoder" +mpeg1_cuvid_hwaccel_select="mpeg1_cuvid_decoder" mpeg1_vdpau_hwaccel_deps="vdpau" mpeg1_vdpau_hwaccel_select="mpeg1video_decoder" mpeg1_videotoolbox_hwaccel_deps="videotoolbox" mpeg1_videotoolbox_hwaccel_select="mpeg1video_decoder" mpeg1_xvmc_hwaccel_deps="xvmc" mpeg1_xvmc_hwaccel_select="mpeg1video_decoder" -mpeg2_crystalhd_decoder_select="crystalhd" mpeg2_cuvid_hwaccel_deps="cuda cuvid" +mpeg2_cuvid_hwaccel_select="mpeg2_cuvid_decoder" mpeg2_d3d11va_hwaccel_deps="d3d11va" mpeg2_d3d11va_hwaccel_select="mpeg2video_decoder" +mpeg2_d3d11va2_hwaccel_deps="d3d11va" +mpeg2_d3d11va2_hwaccel_select="mpeg2video_decoder" mpeg2_dxva2_hwaccel_deps="dxva2" mpeg2_dxva2_hwaccel_select="mpeg2video_decoder" -mpeg2_mmal_decoder_deps="mmal" -mpeg2_mmal_decoder_select="mmal" +mpeg2_mediacodec_hwaccel_deps="mediacodec" mpeg2_mmal_hwaccel_deps="mmal" mpeg2_qsv_hwaccel_deps="libmfx" mpeg2_qsv_hwaccel_select="qsvdec_mpeg2" @@ -3018,117 +3126,168 @@ mpeg2_videotoolbox_hwaccel_deps="videotoolbox" mpeg2_videotoolbox_hwaccel_select="mpeg2video_decoder" mpeg2_xvmc_hwaccel_deps="xvmc" mpeg2_xvmc_hwaccel_select="mpeg2video_decoder" -mpeg4_crystalhd_decoder_select="crystalhd" mpeg4_cuvid_hwaccel_deps="cuda cuvid" -mpeg4_mediacodec_decoder_deps="mediacodec" +mpeg4_cuvid_hwaccel_select="mpeg4_cuvid_decoder" mpeg4_mediacodec_hwaccel_deps="mediacodec" -mpeg4_mmal_decoder_deps="mmal" -mpeg4_mmal_decoder_select="mmal" mpeg4_mmal_hwaccel_deps="mmal" -mpeg4_omx_encoder_deps="omx" mpeg4_vaapi_hwaccel_deps="vaapi" mpeg4_vaapi_hwaccel_select="mpeg4_decoder" -mpeg4_vdpau_decoder_deps="vdpau" -mpeg4_vdpau_decoder_select="mpeg4_decoder" mpeg4_vdpau_hwaccel_deps="vdpau" mpeg4_vdpau_hwaccel_select="mpeg4_decoder" mpeg4_videotoolbox_hwaccel_deps="videotoolbox" mpeg4_videotoolbox_hwaccel_select="mpeg4_decoder" -msmpeg4_crystalhd_decoder_select="crystalhd" -vc1_crystalhd_decoder_select="crystalhd" vc1_cuvid_hwaccel_deps="cuda cuvid" +vc1_cuvid_hwaccel_select="vc1_cuvid_decoder" vc1_d3d11va_hwaccel_deps="d3d11va" vc1_d3d11va_hwaccel_select="vc1_decoder" +vc1_d3d11va2_hwaccel_deps="d3d11va" +vc1_d3d11va2_hwaccel_select="vc1_decoder" vc1_dxva2_hwaccel_deps="dxva2" vc1_dxva2_hwaccel_select="vc1_decoder" -vc1_mmal_decoder_deps="mmal" -vc1_mmal_decoder_select="mmal" vc1_mmal_hwaccel_deps="mmal" vc1_qsv_hwaccel_deps="libmfx" vc1_qsv_hwaccel_select="qsvdec_vc1" vc1_vaapi_hwaccel_deps="vaapi" vc1_vaapi_hwaccel_select="vc1_decoder" -vc1_vdpau_decoder_deps="vdpau" -vc1_vdpau_decoder_select="vc1_decoder" vc1_vdpau_hwaccel_deps="vdpau" vc1_vdpau_hwaccel_select="vc1_decoder" vp8_cuvid_hwaccel_deps="cuda cuvid" +vp8_cuvid_hwaccel_select="vp8_cuvid_decoder" vp9_cuvid_hwaccel_deps="cuda cuvid" -vp8_mediacodec_decoder_deps="mediacodec" +vp9_cuvid_hwaccel_select="vp9_cuvid_decoder" vp8_mediacodec_hwaccel_deps="mediacodec" +vp8_qsv_hwaccel_deps="libmfx" vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9" vp9_d3d11va_hwaccel_select="vp9_decoder" +vp9_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_VP9" +vp9_d3d11va2_hwaccel_select="vp9_decoder" vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9" vp9_dxva2_hwaccel_select="vp9_decoder" -vp9_mediacodec_decoder_deps="mediacodec" vp9_mediacodec_hwaccel_deps="mediacodec" -vp9_vaapi_hwaccel_deps="vaapi VADecPictureParameterBufferVP9" +vp9_vaapi_hwaccel_deps="vaapi VADecPictureParameterBufferVP9_bit_depth" vp9_vaapi_hwaccel_select="vp9_decoder" -wmv3_crystalhd_decoder_select="crystalhd" wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel" +wmv3_d3d11va2_hwaccel_select="vc1_d3d11va2_hwaccel" wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel" wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel" -wmv3_vdpau_decoder_select="vc1_vdpau_decoder" wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel" # hardware-accelerated codecs -omx_deps="dlopen pthreads" -omx_extralibs='$ldl' +omx_deps="libdl pthreads" +omx_rpi_select="omx" qsvdec_select="qsv" qsvenc_select="qsv" vaapi_encode_deps="vaapi" +v4l2_m2m_deps_any="linux_videodev2_h" hwupload_cuda_filter_deps="cuda" scale_npp_filter_deps="cuda libnpp" +scale_cuda_filter_deps="cuda_sdk" +thumbnail_cuda_filter_deps="cuda_sdk" -nvenc_deps_any="dlopen LoadLibrary" +nvenc_deps="cuda" +nvenc_deps_any="libdl LoadLibrary" nvenc_encoder_deps="nvenc" -h263_cuvid_decoder_deps="cuda cuvid" -h263_cuvid_decoder_select="h263_cuvid_hwaccel" + +h263_v4l2m2m_decoder_deps="v4l2_m2m h263_v4l2_m2m" +h263_v4l2m2m_encoder_deps="v4l2_m2m h263_v4l2_m2m" +h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser" h264_cuvid_decoder_deps="cuda cuvid" -h264_cuvid_decoder_select="h264_mp4toannexb_bsf h264_cuvid_hwaccel" +h264_cuvid_decoder_select="h264_mp4toannexb_bsf" +h264_mediacodec_decoder_deps="mediacodec" +h264_mediacodec_decoder_select="h264_mp4toannexb_bsf h264_parser" +h264_mmal_decoder_deps="mmal" h264_nvenc_encoder_deps="nvenc" +h264_omx_encoder_deps="omx" h264_qsv_decoder_deps="libmfx" h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec h264_qsv_hwaccel" h264_qsv_encoder_deps="libmfx" h264_qsv_encoder_select="qsvenc" +h264_rkmpp_decoder_deps="rkmpp" +h264_rkmpp_decoder_select="h264_mp4toannexb_bsf" h264_vaapi_encoder_deps="VAEncPictureParameterBufferH264" h264_vaapi_encoder_select="vaapi_encode golomb" - +h264_vda_decoder_deps="vda" +h264_vda_decoder_select="h264_decoder" +h264_vdpau_decoder_deps="vdpau" +h264_vdpau_decoder_select="h264_decoder" +h264_v4l2m2m_decoder_deps="v4l2_m2m h264_v4l2_m2m" +h264_v4l2m2m_encoder_deps="v4l2_m2m h264_v4l2_m2m" hevc_cuvid_decoder_deps="cuda cuvid" -hevc_cuvid_decoder_select="hevc_mp4toannexb_bsf hevc_cuvid_hwaccel" +hevc_cuvid_decoder_select="hevc_mp4toannexb_bsf" +hevc_mediacodec_decoder_deps="mediacodec" +hevc_mediacodec_decoder_select="hevc_mp4toannexb_bsf hevc_parser" hevc_nvenc_encoder_deps="nvenc" hevc_qsv_decoder_deps="libmfx" hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser qsvdec hevc_qsv_hwaccel" hevc_qsv_encoder_deps="libmfx" -hevc_qsv_encoder_select="qsvenc" +hevc_qsv_encoder_select="hevcparse qsvenc" +hevc_rkmpp_decoder_deps="rkmpp" +hevc_rkmpp_decoder_select="hevc_mp4toannexb_bsf" hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC" hevc_vaapi_encoder_select="vaapi_encode golomb" +hevc_v4l2m2m_decoder_deps="v4l2_m2m hevc_v4l2_m2m" +hevc_v4l2m2m_encoder_deps="v4l2_m2m hevc_v4l2_m2m" mjpeg_cuvid_decoder_deps="cuda cuvid" -mjpeg_cuvid_decoder_select="mjpeg_cuvid_hwaccel" +mjpeg_vaapi_encoder_deps="VAEncPictureParameterBufferJPEG" +mjpeg_vaapi_encoder_select="vaapi_encode jpegtables" mpeg1_cuvid_decoder_deps="cuda cuvid" -mpeg1_cuvid_decoder_select="mpeg1_cuvid_hwaccel" +mpeg1_vdpau_decoder_deps="vdpau" +mpeg1_vdpau_decoder_select="mpeg1video_decoder" +mpeg1_v4l2m2m_decoder_deps="v4l2_m2m mpeg1_v4l2_m2m" +mpeg2_crystalhd_decoder_select="crystalhd" mpeg2_cuvid_decoder_deps="cuda cuvid" -mpeg2_cuvid_decoder_select="mpeg2_cuvid_hwaccel" +mpeg2_mmal_decoder_deps="mmal" +mpeg2_mediacodec_decoder_deps="mediacodec" mpeg2_qsv_decoder_deps="libmfx" mpeg2_qsv_decoder_select="qsvdec mpeg2_qsv_hwaccel" mpeg2_qsv_encoder_deps="libmfx" mpeg2_qsv_encoder_select="qsvenc" +mpeg2_vaapi_encoder_deps="VAEncPictureParameterBufferMPEG2" +mpeg2_vaapi_encoder_select="vaapi_encode" +mpeg2_v4l2m2m_decoder_deps="v4l2_m2m mpeg2_v4l2_m2m" +mpeg4_crystalhd_decoder_select="crystalhd" mpeg4_cuvid_decoder_deps="cuda cuvid" -mpeg4_cuvid_decoder_select="mpeg4_cuvid_hwaccel" -nvenc_h264_encoder_deps="nvenc" -nvenc_hevc_encoder_deps="nvenc" - +mpeg4_mediacodec_decoder_deps="mediacodec" +mpeg4_mmal_decoder_deps="mmal" +mpeg4_omx_encoder_deps="omx" +mpeg4_vdpau_decoder_deps="vdpau" +mpeg4_vdpau_decoder_select="mpeg4_decoder" +mpeg4_v4l2m2m_decoder_deps="v4l2_m2m mpeg4_v4l2_m2m" +mpeg4_v4l2m2m_encoder_deps="v4l2_m2m mpeg4_v4l2_m2m" +mpeg_vdpau_decoder_deps="vdpau" +mpeg_vdpau_decoder_select="mpeg2video_decoder" +msmpeg4_crystalhd_decoder_select="crystalhd" +nvenc_h264_encoder_select="h264_nvenc_encoder" +nvenc_hevc_encoder_select="hevc_nvenc_encoder" +vc1_crystalhd_decoder_select="crystalhd" vc1_cuvid_decoder_deps="cuda cuvid" -vc1_cuvid_decoder_select="vc1_cuvid_hwaccel" +vc1_mmal_decoder_deps="mmal" +vc1_vdpau_decoder_deps="vdpau" +vc1_vdpau_decoder_select="vc1_decoder" +vc1_v4l2m2m_decoder_deps="v4l2_m2m vc1_v4l2_m2m" vp8_cuvid_decoder_deps="cuda cuvid" -vp8_cuvid_decoder_select="vp8_cuvid_hwaccel" +vp8_mediacodec_decoder_deps="mediacodec" +vp8_qsv_decoder_deps="libmfx" +vp8_qsv_decoder_select="qsvdec vp8_qsv_hwaccel vp8_parser" +vp8_rkmpp_decoder_deps="rkmpp" +vp8_vaapi_encoder_deps="VAEncPictureParameterBufferVP8" +vp8_vaapi_encoder_select="vaapi_encode" +vp8_v4l2m2m_decoder_deps="v4l2_m2m vp8_v4l2_m2m" +vp8_v4l2m2m_encoder_deps="v4l2_m2m vp8_v4l2_m2m" vp9_cuvid_decoder_deps="cuda cuvid" -vp9_cuvid_decoder_select="vp9_cuvid_hwaccel" +vp9_mediacodec_decoder_deps="mediacodec" +vp9_rkmpp_decoder_deps="rkmpp" +vp9_vaapi_encoder_deps="VAEncPictureParameterBufferVP9" +vp9_vaapi_encoder_select="vaapi_encode" +vp9_v4l2m2m_decoder_deps="v4l2_m2m vp9_v4l2_m2m" +wmv3_crystalhd_decoder_select="crystalhd" +wmv3_vdpau_decoder_select="vc1_vdpau_decoder" # parsers -h264_parser_select="golomb h264dsp" -hevc_parser_select="golomb" +h264_parser_select="golomb h264dsp h264parse" +hevc_parser_select="hevcparse" +mpegaudio_parser_select="mpegaudioheader" mpegvideo_parser_select="mpegvideo" mpeg4video_parser_select="h263dsp mpegvideo qpeldsp" vc1_parser_select="vc1dsp" @@ -3138,11 +3297,15 @@ mjpeg2jpeg_bsf_select="jpegtables" # external libraries aac_at_decoder_deps="audiotoolbox" +aac_at_decoder_select="aac_adtstoasc_bsf" ac3_at_decoder_deps="audiotoolbox" ac3_at_decoder_select="ac3_parser" adpcm_ima_qt_at_decoder_deps="audiotoolbox" alac_at_decoder_deps="audiotoolbox" amr_nb_at_decoder_deps="audiotoolbox" +avisynth_deps_any="libdl LoadLibrary" +avisynth_demuxer_deps="avisynth" +avisynth_demuxer_select="riffdec" eac3_at_decoder_deps="audiotoolbox" eac3_at_decoder_select="ac3_parser" gsm_ms_at_decoder_deps="audiotoolbox" @@ -3150,6 +3313,9 @@ ilbc_at_decoder_deps="audiotoolbox" mp1_at_decoder_deps="audiotoolbox" mp2_at_decoder_deps="audiotoolbox" mp3_at_decoder_deps="audiotoolbox" +mp1_at_decoder_select="mpegaudioheader" +mp2_at_decoder_select="mpegaudioheader" +mp3_at_decoder_select="mpegaudioheader" pcm_alaw_at_decoder_deps="audiotoolbox" pcm_mulaw_at_decoder_deps="audiotoolbox" qdmc_at_decoder_deps="audiotoolbox" @@ -3165,7 +3331,8 @@ pcm_alaw_at_encoder_select="audio_frame_queue" pcm_mulaw_at_encoder_deps="audiotoolbox" pcm_mulaw_at_encoder_select="audio_frame_queue" chromaprint_muxer_deps="chromaprint" -h264_videotoolbox_encoder_deps="videotoolbox_encoder pthreads" +h264_videotoolbox_encoder_deps="pthreads" +h264_videotoolbox_encoder_select="videotoolbox_encoder" libcelt_decoder_deps="libcelt" libfdk_aac_decoder_deps="libfdk_aac" libfdk_aac_encoder_deps="libfdk_aac" @@ -3180,7 +3347,7 @@ libilbc_encoder_deps="libilbc" libkvazaar_encoder_deps="libkvazaar" libmodplug_demuxer_deps="libmodplug" libmp3lame_encoder_deps="libmp3lame" -libmp3lame_encoder_select="audio_frame_queue" +libmp3lame_encoder_select="audio_frame_queue mpegaudioheader" libopencore_amrnb_decoder_deps="libopencore_amrnb" libopencore_amrnb_encoder_deps="libopencore_amrnb" libopencore_amrnb_encoder_select="audio_frame_queue" @@ -3194,8 +3361,7 @@ libopenmpt_demuxer_deps="libopenmpt" libopus_decoder_deps="libopus" libopus_encoder_deps="libopus" libopus_encoder_select="audio_frame_queue" -libschroedinger_decoder_deps="libschroedinger" -libschroedinger_encoder_deps="libschroedinger" +librsvg_decoder_deps="librsvg" libshine_encoder_deps="libshine" libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" @@ -3212,6 +3378,7 @@ libvpx_vp8_encoder_deps="libvpx" libvpx_vp9_decoder_deps="libvpx" libvpx_vp9_encoder_deps="libvpx" libwavpack_encoder_deps="libwavpack" +libwavpack_encoder_select="audio_frame_queue" libwebp_encoder_deps="libwebp" libwebp_anim_encoder_deps="libwebp" libx262_encoder_deps="libx262" @@ -3222,24 +3389,23 @@ libx265_encoder_deps="libx265" libxavs_encoder_deps="libxavs" libxvid_encoder_deps="libxvid" libzvbi_teletext_decoder_deps="libzvbi" -videotoolbox_deps="VideoToolbox_VideoToolbox_h" videotoolbox_extralibs="-framework CoreFoundation -framework VideoToolbox -framework CoreMedia -framework CoreVideo" videotoolbox_encoder_deps="videotoolbox VTCompressionSessionPrepareToEncodeFrames" -videotoolbox_encoder_suggest="vda_framework vt_bt2020" -vt_bt2020_deps="kCVImageBufferColorPrimaries_ITU_R_2020" +videotoolbox_encoder_suggest="vda_framework" # demuxers / muxers ac3_demuxer_select="ac3_parser" +aiff_muxer_select="iso_media" asf_demuxer_select="riffdec" asf_o_demuxer_select="riffdec" asf_muxer_select="riffenc" asf_stream_muxer_select="asf_muxer" avi_demuxer_select="iso_media riffdec exif" avi_muxer_select="riffenc" -avisynth_demuxer_deps="avisynth" -avisynth_demuxer_select="riffdec" caf_demuxer_select="iso_media riffdec" +caf_muxer_select="iso_media" dash_muxer_select="mp4_muxer" +dash_demuxer_deps="libxml2" dirac_demuxer_select="dirac_parser" dts_demuxer_select="dca_parser" dtshd_demuxer_select="dca_parser" @@ -3256,8 +3422,6 @@ image2_alias_pix_demuxer_select="image2_demuxer" image2_brender_pix_demuxer_select="image2_demuxer" ipod_muxer_select="mov_muxer" ismv_muxer_select="mov_muxer" -libnut_demuxer_deps="libnut" -libnut_muxer_deps="libnut" matroska_audio_muxer_select="matroska_muxer" matroska_demuxer_select="iso_media riffdec" matroska_demuxer_suggest="bzlib lzo zlib" @@ -3267,6 +3431,7 @@ mov_demuxer_select="iso_media riffdec" mov_demuxer_suggest="zlib" mov_muxer_select="iso_media riffenc rtpenc_chain" mp3_demuxer_select="mpegaudio_parser" +mp3_muxer_select="mpegaudioheader" mp4_muxer_select="mov_muxer" mpegts_demuxer_select="iso_media" mpegts_muxer_select="adts_muxer latm_muxer" @@ -3281,6 +3446,7 @@ ogv_muxer_select="ogg_muxer" opus_muxer_select="ogg_muxer" psp_muxer_select="mov_muxer" rtp_demuxer_select="sdp_demuxer" +rtp_muxer_select="golomb" rtpdec_select="asf_demuxer jpegtables mov_demuxer mpegts_demuxer rm_demuxer rtp_protocol srtp" rtsp_demuxer_select="http_protocol rtpdec" rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain" @@ -3310,28 +3476,32 @@ xwma_demuxer_select="riffdec" image_align=1 # indevs / outdevs -alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp" -alsa_outdev_deps="alsa_asoundlib_h" -avfoundation_indev_extralibs="-framework CoreVideo -framework Foundation -framework AVFoundation -framework CoreMedia" -avfoundation_indev_select="avfoundation" +alsa_indev_deps="alsa" +alsa_outdev_deps="alsa" +avfoundation_indev_deps="avfoundation pthreads" +avfoundation_indev_extralibs="-framework Foundation -framework CoreVideo -framework CoreMedia" bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h" caca_outdev_deps="libcaca" -decklink_indev_deps="decklink pthreads" +decklink_deps_any="libdl LoadLibrary" +decklink_indev_deps="decklink threads" decklink_indev_extralibs="-lstdc++" -decklink_outdev_deps="decklink pthreads" +decklink_outdev_deps="decklink threads" decklink_outdev_extralibs="-lstdc++" +libndi_newtek_indev_deps="libndi_newtek" +libndi_newtek_indev_extralibs="-lndi" +libndi_newtek_outdev_deps="libndi_newtek" +libndi_newtek_outdev_extralibs="-lndi" dshow_indev_deps="IBaseFilter" dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid -loleaut32 -lshlwapi" -dv1394_indev_deps="dv1394" -dv1394_indev_select="dv_demuxer" fbdev_indev_deps="linux_fb_h" fbdev_outdev_deps="linux_fb_h" gdigrab_indev_deps="CreateDIBSection" gdigrab_indev_extralibs="-lgdi32" gdigrab_indev_select="bmp_decoder" iec61883_indev_deps="libiec61883" -jack_indev_deps="jack_jack_h" +jack_indev_deps="jack" jack_indev_deps_any="sem_timedwait dispatch_dispatch_h" +kmsgrab_indev_deps="libdrm" lavfi_indev_deps="avfilter" libcdio_indev_deps="libcdio" libdc1394_indev_deps="libdc1394" @@ -3342,28 +3512,23 @@ oss_indev_deps_any="soundcard_h sys_soundcard_h" oss_outdev_deps_any="soundcard_h sys_soundcard_h" pulse_indev_deps="libpulse" pulse_outdev_deps="libpulse" -qtkit_indev_extralibs="-framework QTKit -framework Foundation -framework QuartzCore" -qtkit_indev_select="qtkit" sdl2_outdev_deps="sdl2" -sndio_indev_deps="sndio_h" -sndio_outdev_deps="sndio_h" -v4l_indev_deps="linux_videodev_h" +sndio_indev_deps="sndio" +sndio_outdev_deps="sndio" v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h" v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h" -vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines" -vfwcap_indev_extralibs="-lavicap32" -x11grab_indev_deps="x11grab" -x11grab_xcb_indev_deps="libxcb" +vfwcap_indev_deps="vfw32 vfwcap_defines" +xcbgrab_indev_deps="libxcb" xv_outdev_deps="X11_extensions_Xvlib_h XvGetPortAttribute" xv_outdev_extralibs="-lXv -lX11 -lXext" # protocols async_protocol_deps="threads" bluray_protocol_deps="libbluray" -ffrtmpcrypt_protocol_deps="!librtmp_protocol" +ffrtmpcrypt_protocol_conflict="librtmp_protocol" ffrtmpcrypt_protocol_deps_any="gcrypt gmp openssl" ffrtmpcrypt_protocol_select="tcp_protocol" -ffrtmphttp_protocol_deps="!librtmp_protocol" +ffrtmphttp_protocol_conflict="librtmp_protocol" ffrtmphttp_protocol_select="http_protocol" ftp_protocol_select="tcp_protocol" gopher_protocol_select="network" @@ -3380,10 +3545,10 @@ libsmbclient_protocol_deps="libsmbclient gplv3" libssh_protocol_deps="libssh" mmsh_protocol_select="http_protocol" mmst_protocol_select="network" -rtmp_protocol_deps="!librtmp_protocol" +rtmp_protocol_conflict="librtmp_protocol" rtmp_protocol_select="tcp_protocol" rtmpe_protocol_select="ffrtmpcrypt_protocol" -rtmps_protocol_deps="!librtmp_protocol" +rtmps_protocol_conflict="librtmp_protocol" rtmps_protocol_select="tls_protocol" rtmpt_protocol_select="ffrtmphttp_protocol" rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol" @@ -3393,9 +3558,11 @@ sctp_protocol_deps="struct_sctp_event_subscribe struct_msghdr_msg_flags" sctp_protocol_select="network" srtp_protocol_select="rtp_protocol srtp" tcp_protocol_select="network" -tls_gnutls_protocol_deps="gnutls !tls_schannel_protocol !tls_securetransport_protocol" +tls_gnutls_protocol_conflict="tls_schannel_protocol tls_securetransport_protocol" +tls_gnutls_protocol_deps="gnutls" tls_gnutls_protocol_select="tcp_protocol" -tls_openssl_protocol_deps="openssl !tls_schannel_protocol !tls_securetransport_protocol !tls_gnutls_protocol" +tls_openssl_protocol_conflict="tls_schannel_protocol tls_securetransport_protocol tls_gnutls_protocol" +tls_openssl_protocol_deps="openssl" tls_openssl_protocol_select="tcp_protocol" tls_schannel_protocol_deps="schannel" tls_schannel_protocol_select="tcp_protocol" @@ -3410,10 +3577,11 @@ unix_protocol_select="network" # filters afftfilt_filter_deps="avcodec" afftfilt_filter_select="fft" +afir_filter_deps="avcodec" +afir_filter_select="fft" amovie_filter_deps="avcodec avformat" aresample_filter_deps="swresample" ass_filter_deps="libass" -asyncts_filter_deps="avresample" atempo_filter_deps="avcodec" atempo_filter_select="rdft" azmq_filter_deps="libzmq" @@ -3421,12 +3589,18 @@ blackframe_filter_deps="gpl" boxblur_filter_deps="gpl" bs2b_filter_deps="libbs2b" colormatrix_filter_deps="gpl" +coreimage_filter_deps="coreimage appkit" +coreimage_filter_extralibs="-framework OpenGL" +coreimagesrc_filter_deps="coreimage appkit" +coreimagesrc_filter_extralibs="-framework OpenGL" cover_rect_filter_deps="avcodec avformat gpl" cropdetect_filter_deps="gpl" +deinterlace_qsv_filter_deps="libmfx" +deinterlace_vaapi_filter_deps="vaapi" delogo_filter_deps="gpl" deshake_filter_select="pixelutils" drawtext_filter_deps="libfreetype" -ebur128_filter_deps="gpl" +elbg_filter_deps="avcodec" eq_filter_deps="gpl" fftfilt_filter_deps="avcodec" fftfilt_filter_select="rdft" @@ -3435,16 +3609,15 @@ firequalizer_filter_deps="avcodec" firequalizer_filter_select="rdft" flite_filter_deps="libflite" framerate_filter_select="pixelutils" -frei0r_filter_deps="frei0r dlopen" -frei0r_src_filter_deps="frei0r dlopen" +frei0r_filter_deps="frei0r libdl" +frei0r_src_filter_deps="frei0r libdl" fspp_filter_deps="gpl" geq_filter_deps="gpl" histeq_filter_deps="gpl" hqdn3d_filter_deps="gpl" interlace_filter_deps="gpl" kerndeint_filter_deps="gpl" -ladspa_filter_deps="ladspa dlopen" -loudnorm_filter_deps="libebur128" +ladspa_filter_deps="ladspa libdl" mcdeint_filter_deps="avcodec gpl" movie_filter_deps="avcodec avformat" mpdecimate_filter_deps="gpl" @@ -3468,6 +3641,7 @@ rubberband_filter_deps="librubberband" sab_filter_deps="gpl swscale" scale2ref_filter_deps="swscale" scale_filter_deps="swscale" +scale_qsv_filter_deps="libmfx" select_filter_select="pixelutils" showcqt_filter_deps="avcodec avformat swscale" showcqt_filter_select="fft" @@ -3477,8 +3651,9 @@ showspectrum_filter_deps="avcodec" showspectrum_filter_select="fft" showspectrumpic_filter_deps="avcodec" showspectrumpic_filter_select="fft" +signature_filter_deps="gpl avcodec avformat" smartblur_filter_deps="gpl swscale" -sofalizer_filter_deps="netcdf avcodec" +sofalizer_filter_deps="libmysofa avcodec" sofalizer_filter_select="fft" spectrumsynth_filter_deps="avcodec" spectrumsynth_filter_select="fft" @@ -3491,28 +3666,34 @@ pixfmts_super2xsai_test_deps="super2xsai_filter" tinterlace_filter_deps="gpl" tinterlace_merge_test_deps="tinterlace_filter" tinterlace_pad_test_deps="tinterlace_filter" +tonemap_filter_deps="const_nan" uspp_filter_deps="gpl avcodec" vaguedenoiser_filter_deps="gpl" vidstabdetect_filter_deps="libvidstab" vidstabtransform_filter_deps="libvidstab" +libvmaf_filter_deps="libvmaf" zmq_filter_deps="libzmq" zoompan_filter_deps="swscale" -zscale_filter_deps="libzimg" +zscale_filter_deps="libzimg const_nan" scale_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer" # examples avio_dir_cmd_deps="avformat avutil" avio_reading_deps="avformat avcodec avutil" -decoding_encoding_example_deps="avcodec avformat avutil" +decode_audio_example_deps="avcodec avutil" +decode_video_example_deps="avcodec avutil" demuxing_decoding_example_deps="avcodec avformat avutil" +encode_audio_example_deps="avcodec avutil" +encode_video_example_deps="avcodec avutil" extract_mvs_example_deps="avcodec avformat avutil" filter_audio_example_deps="avfilter avutil" filtering_audio_example_deps="avfilter avcodec avformat avutil" filtering_video_example_deps="avfilter avcodec avformat avutil" -http_multiclient_example_deps="avformat avutil" +http_multiclient_example_deps="avformat avutil fork" +hw_decode_example_deps="avcodec avformat avutil" metadata_example_deps="avformat avutil" muxing_example_deps="avcodec avformat avutil swscale" -qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder vaapi_x11" +qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder" remuxing_example_deps="avcodec avformat avutil" resampling_audio_example_deps="avutil swresample" scaling_video_example_deps="avutil swscale" @@ -3521,9 +3702,11 @@ transcoding_example_deps="avfilter avcodec avformat avutil" # libraries, in linking order avcodec_deps="avutil" +avcodec_select="null_bsf" avdevice_deps="avformat avcodec avutil" avfilter_deps="avutil" avformat_deps="avcodec avutil" +avformat_suggest="network" avresample_deps="avutil" postproc_deps="avutil gpl" swresample_deps="avutil" @@ -3533,9 +3716,9 @@ swscale_deps="avutil" ffmpeg_deps="avcodec avfilter avformat swresample" ffmpeg_select="aformat_filter anull_filter atrim_filter format_filter null_filter - setpts_filter trim_filter" + trim_filter" ffplay_deps="avcodec avformat swscale swresample sdl2" -ffplay_libs='$sdl2_libs' +ffplay_extralibs='$sdl2_extralibs' ffplay_select="rdft crop_filter transpose_filter hflip_filter vflip_filter rotate_filter" ffprobe_deps="avcodec avformat" ffserver_deps="avformat fork sarestart" @@ -3594,18 +3777,19 @@ ar_default="ar" cc_default="gcc" cxx_default="g++" host_cc_default="gcc" -cp_f="cp -f" doxygen_default="doxygen" install="install" ln_s_default="ln -s -f" nm_default="nm -g" -objformat="elf" pkg_config_default=pkg-config ranlib_default="ranlib" strip_default="strip" version_script='--version-script' -yasmexe_default="yasm" +x86asmexe_default="nasm" windres_default="windres" +nvcc_default="nvcc" +nvccflags_default="-gencode arch=compute_30,code=sm_30 -O2" +striptype="direct" # MythTV toolchain ccache="yes" @@ -3687,14 +3871,6 @@ enable valgrind_backtrace sws_max_filter_size_default=256 set_default sws_max_filter_size -# Enable platform codecs by default. -enable audiotoolbox - -# Enable hwaccels by default. -enable d3d11va dxva2 vaapi vda vdpau videotoolbox_hwaccel xvmc -enable xlib - -enable nvenc vda_framework videotoolbox videotoolbox_encoder # mythtv settings enable shared enable gpl @@ -3756,7 +3932,6 @@ x11_path_default="${sysinclude:-$sysroot/usr/include}/X11" libcec_path_default="${sysinclude:-$sysroot/usr/include}" libxml2_path_default="${sysinclude:-$sysroot/usr/include}/libxml2" firewiresdk_path_default="" - # build settings SHFLAGS='-shared -Wl,-soname,$$(@F)' LIBPREF="libmyth" @@ -3788,6 +3963,7 @@ CXX_O='-o $@' OBJCC_C='-c' OBJCC_E='-E -o $@' OBJCC_O='-o $@' +X86ASM_O='-o $@' LD_O='-o $@' LD_LIB='-l%' LD_MYTH_LIB='-lmyth%' @@ -3795,8 +3971,10 @@ LD_PATH='-L' HOSTCC_C='-c' HOSTCC_O='-o $@' HOSTLD_O='-o $@' +NVCC_C='-c' +NVCC_O='-o $@' -host_libs='-lm' +host_extralibs='-lm' host_cflags_filter=echo host_ldflags_filter=echo @@ -4043,6 +4221,9 @@ for opt do action=${opt%%-random=*} do_random ${action#--} $optval ;; + --enable-sdl) + enable sdl2 + ;; --enable-*=*|--disable-*=*) eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/') is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt" @@ -4052,6 +4233,16 @@ for opt do [ "$list" = "" ] && warn "Option $opt did not match anything" $action $list ;; + --enable-yasm|--disable-yasm) + warn "The ${opt} option is only provided for compatibility and will be\n"\ + "removed in the future. Use --enable-x86asm / --disable-x86asm instead." + test $opt = --enable-yasm && x86asm=yes || x86asm=no + ;; + --yasmexe=*) + warn "The --yasmexe option is only provided for compatibility and will be\n"\ + "removed in the future. Use --x86asmexe instead." + x86asmexe="$optval" + ;; --enable-?*|--disable-?*) eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g') if is_in $option $COMPONENT_LIST; then @@ -4071,8 +4262,13 @@ for opt do ;; --help|-h) show_help ;; + --quiet|-q) quiet=yes + ;; --fatal-warnings) enable fatal_warnings ;; + --libfuzzer=*) + libfuzzer_path="$optval" + ;; *) optname="${opt%%=*}" optname="${optname#--}" @@ -4113,8 +4309,41 @@ for e in $env; do eval "export $e" done +if disabled autodetect; then + + # Unless iconv is explicitely disabled by the user, we still want to probe + # for the iconv from the libc. + disabled iconv || enable libc_iconv + + disable_weak $EXTERNAL_AUTODETECT_LIBRARY_LIST + disable_weak $HWACCEL_AUTODETECT_LIBRARY_LIST +fi +# Mark specifically enabled, but normally autodetected libraries as requested. +for lib in $AUTODETECT_LIBS; do + enabled $lib && request $lib +done +#TODO: switch to $AUTODETECT_LIBS when $THREADS_LIST is supported the same way +enable_weak $EXTERNAL_AUTODETECT_LIBRARY_LIST +enable_weak $HWACCEL_AUTODETECT_LIBRARY_LIST + disabled logging && logfile=/dev/null +die_license_disabled() { + enabled $1 || { enabled $v && die "$v is $1 and --enable-$1 is not specified."; } +} + +die_license_disabled_gpl() { + enabled $1 || { enabled $v && die "$v is incompatible with the gpl and --enable-$1 is not specified."; } +} + +map "die_license_disabled gpl" $EXTERNAL_LIBRARY_GPL_LIST $EXTERNAL_LIBRARY_GPLV3_LIST +map "die_license_disabled version3" $EXTERNAL_LIBRARY_VERSION3_LIST $EXTERNAL_LIBRARY_GPLV3_LIST + +enabled gpl && map "die_license_disabled_gpl nonfree" $EXTERNAL_LIBRARY_NONFREE_LIST +map "die_license_disabled nonfree" $HWACCEL_LIBRARY_NONFREE_LIST + +enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; } + # Disable all the library-specific components if the library itself # is disabled, see AVCODEC_LIST and following _LIST variables. @@ -4132,6 +4361,11 @@ set >> $logfile test -n "$valgrind" && toolchain="valgrind-memcheck" +enabled ossfuzz && { + add_cflags -fsanitize=address,undefined -fsanitize-coverage=trace-pc-guard,trace-cmp -fno-omit-frame-pointer + add_ldflags -fsanitize=address,undefined -fsanitize-coverage=trace-pc-guard,trace-cmp +} + case "$toolchain" in *-asan) cc_default="${toolchain%-asan}" @@ -4145,7 +4379,7 @@ case "$toolchain" in ;; *-tsan) cc_default="${toolchain%-tsan}" - add_cflags -fsanitize=thread -pie + add_cflags -fsanitize=thread -fPIE add_ldflags -fsanitize=thread -pie case "$toolchain" in gcc-tsan) @@ -4180,8 +4414,10 @@ case "$toolchain" in cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p') if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then cc_default="cl" + cxx_default="cl" else cc_default="c99wrap cl" + cxx_default="c99wrap cl" fi ld_default="$source_path/compat/windows/mslink" nm_default="dumpbin -symbols" @@ -4230,7 +4466,7 @@ test -n "$cross_prefix" && enable cross_compile if enabled cross_compile; then test -n "$arch" && test -n "$target_os" || - die "Must specify target arch/cpu and OS when cross-compiling" + die "Must specify target arch (--arch) and OS (--target-os) when cross-compiling" fi ar_default="${cross_prefix}${ar_default}" @@ -4249,7 +4485,7 @@ windres_default="${cross_prefix}${windres_default}" sysinclude_default="${sysroot}/usr/include" set_default arch cc cxx doxygen pkg_config ranlib strip sysinclude \ - target_exec target_os yasmexe + target_exec target_os x86asmexe nvcc enabled cross_compile || host_cc_default=$cc set_default host_cc @@ -4262,7 +4498,7 @@ elif is_in -static $cc $LDFLAGS && ! is_in --static $pkg_config $pkg_config_flag Note: When building a static binary, add --pkg-config-flags=\"--static\"." fi -set_default qmake qmakespecs python yasmexe +set_default qmake qmakespecs python x86asmexe if test $doxygen != $doxygen_default && \ ! $doxygen --version >/dev/null 2>&1; then @@ -4285,26 +4521,32 @@ HOSTEXESUF=$(exesuf $host_os) if [ -n "$tempprefix" ] ; then mktemp(){ - echo $tempprefix.${HOSTNAME}.${UID} + tmpname="$tempprefix.${HOSTNAME}.${UID}" + echo "$tmpname" + mkdir "$tmpname" } elif ! check_cmd mktemp -u XXXXXX; then # simple replacement for missing mktemp # NOT SAFE FOR GENERAL USE mktemp(){ - echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$" + tmpname="${2%%XXX*}.${HOSTNAME}.${UID}.$$" + echo "$tmpname" + mkdir "$tmpname" } fi +FFTMPDIR=$(mktemp -d "${TMPDIR}/ffconf.XXXXXXXX" 2> /dev/null) || + die "Unable to create temporary directory in $TMPDIR." + tmpfile(){ - tmp=$(mktemp -u "${TMPDIR}/mythtv_conf.XXXXXXXX")$2 && - (set -C; exec > $tmp) 2>/dev/null || - die "Unable to create temporary file in $TMPDIR." - append TMPFILES $tmp + tmp="${FFTMPDIR}/test"$2 + (set -C; exec > $tmp) 2> /dev/null || + die "Unable to create temporary file in $FFTMPDIR." eval $1=$tmp } -trap 'rm -f -- $TMPFILES' EXIT -trap exit HUP INT TERM +trap 'rm -rf -- "$FFTMPDIR"' EXIT +trap 'exit 2' HUP INT TERM tmpfile TMPASM .asm tmpfile TMPC .c @@ -4384,6 +4626,7 @@ msvc_common_flags(){ # specific filters, they must be specified here as well or else the # generic catch all at the bottom will print the original flag. -Wall) ;; + -Wextra) ;; -std=c99) ;; # Common flags -fomit-frame-pointer) ;; @@ -4395,9 +4638,8 @@ msvc_common_flags(){ -mthumb) ;; -march=*) ;; -lz) echo zlib.lib ;; - -lavifil32) echo vfw32.lib ;; - -lavicap32) echo vfw32.lib user32.lib ;; -lx264) echo libx264.lib ;; + -lstdc++) ;; -l*) echo ${flag#-l}.lib ;; -LARGEADDRESSAWARE) echo $flag ;; -L*) echo -libpath:${flag#-L} ;; @@ -4410,11 +4652,13 @@ msvc_flags(){ msvc_common_flags "$@" for flag; do case $flag in - -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \ + -Wall) echo -W3 -wd4018 -wd4146 -wd4244 -wd4305 \ + -wd4554 ;; + -Wextra) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \ -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \ -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \ -wd4307 \ - -wd4273 -wd4554 -wd4701 ;; + -wd4273 -wd4554 -wd4701 -wd4703 ;; esac done } @@ -4615,7 +4859,7 @@ probe_cc(){ _ident=$($_cc --version 2>/dev/null | head -n1) _depflags='-MMD -MF $(@:.o=.d) -MT $@' _cflags_speed='-O3' - _cflags_size='-Os' + _cflags_size='-Oz' elif $_cc -V 2>&1 | grep -q Sun; then _type=suncc _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-) @@ -4675,8 +4919,20 @@ probe_cc(){ _flags='-nologo -Qdiag-error:4044,10157' # -Qvec- -Qsimd- to prevent miscompilation, -GS, fp:precise for consistency # with MSVC which enables it by default. - _cflags='-D_USE_MATH_DEFINES -Qms0 -Qvec- -Qsimd- -GS -fp:precise' + _cflags='-Qms0 -Qvec- -Qsimd- -GS -fp:precise' disable stripping + elif $_cc -? 2>/dev/null | grep -q 'LLVM.*Linker'; then + # lld can emulate multiple different linkers; in ms link.exe mode, + # the -? parameter gives the help output which contains an identifyable + # string, while it gives an error in other modes. + _type=lld-link + # The link.exe mode doesn't have a switch for getting the version, + # but we can force it back to gnu mode and get the version from there. + _ident=$($_cc -flavor gnu --version 2>/dev/null) + _ld_o='-out:$@' + _flags_filter=msvc_flags + _ld_lib='lib%.a' + _ld_path='-libpath:' elif $_cc -nologo- 2>&1 | grep -q Microsoft; then _type=msvc _ident=$($_cc 2>&1 | head -n1) @@ -4684,6 +4940,7 @@ probe_cc(){ _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs' _cflags_speed="-O2" _cflags_size="-O1" + _cflags_noopt="-O1" if $_cc -nologo- 2>&1 | grep -q Linker; then _ld_o='-out:$@' else @@ -4695,7 +4952,6 @@ probe_cc(){ _ld_lib='lib%.a' _ld_path='-libpath:' _flags='-nologo' - _cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS' disable stripping elif $_cc --version 2>/dev/null | grep -q ^cparser; then _type=cparser @@ -4732,9 +4988,11 @@ cflags_noopt=$_cflags_noopt add_cflags $_flags $_cflags cc_ldflags=$_ldflags set_ccvars CC +set_ccvars CXX probe_cc hostcc "$host_cc" host_cflags_filter=$_flags_filter +host_cflags_speed=$_cflags_speed add_host_cflags $_flags $_cflags set_ccvars HOSTCC @@ -5453,6 +5711,13 @@ fi add_cppflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 #add_cxxflags -D__STDC_CONSTANT_MACROS +check_cxxflags -std=c++11 || check_cxxflags -std=c++0x + +# some compilers silently accept -std=c11, so we also need to check that the +# version macro is defined properly +test_cflags_cc -std=c11 ctype.h "__STDC_VERSION__ >= 201112L" && + add_cflags -std=c11 || + check_cflags -std=c99 # C++ compiler sanity check check_exec_cxx < -EOF -check_cc -D_LARGEFILE_SOURCE < -EOF + +check_cppflags -D_FILE_OFFSET_BITS=64 +check_cppflags -D_LARGEFILE_SOURCE check_cxx -D_FILE_OFFSET_BITS=64 < EOF @@ -5485,7 +5746,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 @@ -5538,6 +5799,8 @@ esac enable $subarch enabled spic && enable_weak pic +enabled x86_64 && objformat=elf64 || objformat="elf32" + # OS specific case $target_os in aix) @@ -5558,7 +5821,7 @@ case $target_os in haiku) prefix_default="/boot/common" network_extralibs="-lnetwork" - host_libs= + host_extralibs= ;; sunos) SHFLAGS='-shared -Wl,-h,$$(@F)' @@ -5636,7 +5899,7 @@ case $target_os in SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)' SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)' objformat="macho" - enabled x86_64 && objformat="macho64" + enabled x86_64 && objformat="macho64" || objformat="macho32" enabled_any pic shared x86_64 || { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; } check_header dispatch/dispatch.h && @@ -5676,8 +5939,6 @@ case $target_os in else target_os=mingw32 fi - decklink_outdev_extralibs="$decklink_outdev_extralibs -lole32 -loleaut32" - decklink_indev_extralibs="$decklink_indev_extralibs -lole32 -loleaut32" LIBTARGET=i386 if enabled x86_64; then LIBTARGET="i386:x86-64" @@ -5693,7 +5954,7 @@ case $target_os in SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)' dlltool="${cross_prefix}dlltool" if check_cmd lib.exe -list ; then - SLIB_EXTRA_CMD='-lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)' + SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); lib.exe -nologo -machine:$(LIBTARGET) -def:$$(@:$(SLIBSUF)=.def) -out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)' else SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); $(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)' fi @@ -5703,7 +5964,6 @@ case $target_os in install -m 644 $(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) "$(LIBDIR)/lib$(SLIBNAME:$(SLIBSUF)=.dll.a)"' SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"' SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.orig.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base' - objformat="win32" ranlib=: enable dos_paths check_ldflags -Wl,--nxcompat,--dynamicbase @@ -5746,7 +6006,7 @@ case $target_os in SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)' SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)' SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)' - objformat="win32" + enabled x86_64 && objformat="win64" || objformat="win32" ranlib=: enable dos_paths ;; @@ -5763,7 +6023,7 @@ case $target_os in SLIB_INSTALL_LINKS= SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a' SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a' - objformat="win32" + enabled x86_64 && objformat="win64" || objformat="win32" enable dos_paths enabled shared && ! enabled small && check_cmd $windres --version && enable gnu_windres add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 @@ -5777,8 +6037,8 @@ case $target_os in add_cppflags -U__STRICT_ANSI__ ;; linux) - enable dv1394 enable section_data_rel_ro + enabled_any arm aarch64 && enable_weak linux_perf append CCONFIG "linux" enable backend ! disabled joystick_menu && enable joystick_menu @@ -5792,9 +6052,10 @@ case $target_os in ;; os/2*) strip="lxlite -CS" + striptype="" objformat="aout" add_cppflags -D_GNU_SOURCE - add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap + add_ldflags -Zomf -Zbin-files -Zargs-wild -Zhigh-mem -Zmap SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf' LIBSUF="_s.a" SLIBPREF="myth" @@ -5840,18 +6101,6 @@ case $target_os in ;; minix) ;; - plan9) - add_cppflags -D_C99_SNPRINTF_EXTENSION \ - -D_REENTRANT_SOURCE \ - -D_RESEARCH_SOURCE \ - -DFD_SETSIZE=96 \ - -DHAVE_SOCK_OPTS - add_compat strtod.o strtod=avpriv_strtod - network_extralibs='-lbsd' - exeobjs=compat/plan9/main.o - disable ffserver - cp_f='cp' - ;; none) ;; *) @@ -5894,7 +6143,7 @@ probe_libc(){ # MinGW headers can be installed on Cygwin, so check for newlib first. elif check_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then eval ${pfx}libc_type=newlib - add_${pfx}cppflags -U__STRICT_ANSI__ + add_${pfx}cppflags -U__STRICT_ANSI__ -D_XOPEN_SOURCE=600 # MinGW64 is backwards compatible with MinGW32, so check for it first. elif check_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then eval ${pfx}libc_type=mingw64 @@ -5914,6 +6163,8 @@ probe_libc(){ add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1 check_${pfx}cpp_condition _mingw.h "defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0502" || add_${pfx}cppflags -D_WIN32_WINNT=0x0502 + check_${pfx}cpp_condition _mingw.h "__MSVCRT_VERSION__ < 0x0700" && + add_${pfx}cppflags -D__MSVCRT_VERSION__=0x0700 eval test \$${pfx_no_}cc_type = "gcc" && add_${pfx}cppflags -D__printf__=__gnu_printf__ elif check_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then @@ -5928,6 +6179,7 @@ probe_libc(){ vsnprintf=avpriv_vsnprintf fi fi + add_${pfx}cppflags -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to # 0x601 by default unless something else is set by the user. # This can easily lead to us detecting functions only present @@ -5947,6 +6199,10 @@ probe_libc(){ #endif #endif EOF + if [ "$pfx" = "" ]; then + check_func strtoll || add_cflags -Dstrtoll=_strtoi64 + check_func strtoull || add_cflags -Dstrtoull=_strtoui64 + fi elif check_${pfx}cpp_condition stddef.h "defined __KLIBC__"; then eval ${pfx}libc_type=klibc elif check_${pfx}cpp_condition sys/cdefs.h "defined __BIONIC__"; then @@ -5971,28 +6227,27 @@ 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) if test $target_os != android ; then add_compat strtod.o strtod=avpriv_strtod fi ;; + 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' @@ -6000,7 +6255,7 @@ esc(){ echo "$*" | sed 's/%/%25/g;s/:/%3a/g' } -echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $FFMPEG_CONFIGURATION)" >config.fate +echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $FFMPEG_CONFIGURATION)" > config.fate check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic @@ -6042,47 +6297,15 @@ EOF exit 1 fi +disabled optimizations || enabled ossfuzz || check_cflags -fomit-frame-pointer # backward compatibility layer for incompatible_libav/fork_abi enabled incompatible_fork_abi && enable incompatible_libav_abi enabled incompatible_libav_abi && enable incompatible_fork_abi disabled static && LIBNAME="" -die_license_disabled() { - enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; } -} - -die_license_disabled_gpl() { - enabled $1 || { enabled $2 && die "$2 is incompatible with the gpl and --enable-$1 is not specified."; } -} - -die_license_disabled gpl frei0r #die_license_disabled gpl libcdio #die_license_disabled gpl libutvideo -die_license_disabled gpl librubberband -die_license_disabled gpl libsmbclient -die_license_disabled gpl libvidstab -die_license_disabled gpl libx264 -die_license_disabled gpl libx265 -die_license_disabled gpl libxavs -die_license_disabled gpl libxvid -die_license_disabled gpl x11grab - -die_license_disabled nonfree cuda -die_license_disabled nonfree cuvid -die_license_disabled nonfree libnpp -enabled gpl && die_license_disabled_gpl nonfree libfdk_aac -enabled gpl && die_license_disabled_gpl nonfree openssl - -die_license_disabled version3 gmp -die_license_disabled version3 libopencore_amrnb -die_license_disabled version3 libopencore_amrwb -die_license_disabled version3 libsmbclient -die_license_disabled version3 libvo_amrwbenc - -enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; } - -disabled optimizations || check_cflags -fomit-frame-pointer disabled optimizations || check_cxxflags -fomit-frame-pointer enable_weak_pic() { @@ -6152,9 +6375,7 @@ EOF sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }') extern_prefix=${sym%%ff_extern*} -check_cc < +void foo(void) { struct { double d; } static const bar[] = { { NAN } }; } +EOF + if ! enabled ppc64 || enabled bigendian; then disable vsx fi @@ -6289,10 +6515,14 @@ EOF check_as <= 0x0a060100" || die "ERROR: Decklink API version must be >= 10.6.1."; } } -enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; } -enabled gmp && require2 gmp gmp.h mpz_export -lgmp -enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init -enabled jni && { [ $target_os = "android" ] && check_header jni.h && enabled pthreads && - check_lib2 "dlfcn.h" dlopen -ldl; } -enabled ladspa && { check_header ladspa.h || die "ERROR: ladspa.h header not found"; } +enabled libndi_newtek && require_header Processing.NDI.Lib.h +enabled frei0r && require_header frei0r.h +enabled gmp && require gmp gmp.h mpz_export -lgmp +enabled gnutls && require_pkg_config gnutls gnutls gnutls/gnutls.h gnutls_global_init +enabled jni && { [ $target_os = "android" ] && check_header jni.h && enabled pthreads || die "ERROR: jni not found"; } +enabled ladspa && require_header ladspa.h enabled libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883 -#enabled libass && require_pkg_config libass ass/ass.h ass_library_init -enabled libbluray && require libbluray libbluray/bluray.h bd_open -lbluray -enabled libbs2b && require_pkg_config libbs2b bs2b.h bs2b_open +enabled libass && require_pkg_config libass libass ass/ass.h ass_library_init +enabled libbluray && require_pkg_config libbluray libbluray libbluray/bluray.h bd_open -lbluray +enabled libbs2b && require_pkg_config libbs2b libbs2b bs2b.h bs2b_open enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 && - { check_lib celt/celt.h celt_decoder_create_custom -lcelt0 || + { check_lib libcelt celt/celt.h celt_decoder_create_custom -lcelt0 || die "ERROR: libcelt must be installed and version must be >= 0.11.0."; } -enabled libcaca && require_pkg_config caca caca.h caca_create_canvas -enabled libebur128 && require ebur128 ebur128.h ebur128_relative_threshold -lebur128 -enabled libfdk_aac && { use_pkg_config fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen || +enabled libcaca && require_pkg_config libcaca caca caca.h caca_create_canvas +enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new +enabled libdrm && require_pkg_config libdrm libdrm xf86drm.h drmGetVersion +enabled libfdk_aac && { use_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen || { require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac && warn "using libfdk without pkg-config"; } } -flite_libs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex -lflite" -enabled libflite && require2 libflite "flite/flite.h" flite_init $flite_libs +flite_extralibs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex -lflite" +enabled libflite && require libflite "flite/flite.h" flite_init $flite_extralibs enabled fontconfig && enable libfontconfig -enabled libfontconfig && require_pkg_config fontconfig "fontconfig/fontconfig.h" FcInit -enabled libfreetype && require_libfreetype -enabled libfribidi && require_pkg_config fribidi fribidi.h fribidi_version_info -enabled libgme && require libgme gme/gme.h gme_new_emu -lgme -lstdc++ +enabled libfontconfig && require_pkg_config libfontconfig fontconfig "fontconfig/fontconfig.h" FcInit +enabled libfreetype && require_pkg_config libfreetype2 freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType +enabled libfribidi && require_pkg_config libfribidi fribidi fribidi.h fribidi_version_info +enabled libgme && { use_pkg_config libgme libgme gme/gme.h gme_new_emu || + require libgme gme/gme.h gme_new_emu -lgme -lstdc++; } enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do - check_lib "${gsm_hdr}" gsm_create -lgsm && break; + check_lib libgsm "${gsm_hdr}" gsm_create -lgsm && break; done || die "ERROR: libgsm not found"; } 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 libmodplug && require_pkg_config libmodplug libmodplug/modplug.h ModPlug_Load +enabled libkvazaar && require_pkg_config libkvazaar "kvazaar >= 0.8.1" kvazaar.h kvz_api_get +# While it may appear that require is being used as a pkg-config +# fallback for libmfx, it is actually being used to detect a different +# installation route altogether. If libmfx is installed via the Intel +# Media SDK or Intel Media Server Studio, these don't come with +# pkg-config support. Instead, users should make sure that the build +# can find the libraries and headers through other means. +enabled libmfx && { use_pkg_config libmfx libmfx "mfx/mfxvideo.h" MFXInit || + { require libmfx "mfx/mfxvideo.h" MFXInit -llibmfx && warn "using libmfx without pkg-config"; } } +enabled libmodplug && require_pkg_config libmodplug libmodplug libmodplug/modplug.h ModPlug_Load enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame -enabled libnut && require libnut libnut.h nut_demuxer_init -lnut -enabled libnpp && require libnpp npp.h nppGetLibVersion -lnppi -lnppc +enabled libmysofa && require libmysofa "mysofa.h" mysofa_load -lmysofa +enabled libnpp && { check_lib libnpp npp.h nppGetLibVersion -lnppig -lnppicc -lnppc || + check_lib libnpp npp.h nppGetLibVersion -lnppi -lnppc || + die "ERROR: libnpp not found"; } 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 && { check_header opencv2/core/core_c.h && - { use_pkg_config opencv opencv2/core/core_c.h cvCreateImageHeader || + { use_pkg_config libopencv opencv opencv2/core/core_c.h cvCreateImageHeader || require opencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } || - require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader; } -enabled libopenh264 && require_pkg_config openh264 wels/codec_api.h WelsGetCodecVersion -enabled libopenjpeg && { { check_lib2 openjpeg-2.1/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || - check_lib2 openjpeg-2.1/openjpeg.h opj_version -lopenjp2 || - { check_lib2 openjpeg-2.0/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || - { check_lib2 openjpeg-1.5/openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || - { check_lib2 openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || + require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; } +enabled libopenh264 && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion +enabled libopenjpeg && { { check_lib libopenjpeg openjpeg-2.3/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || + check_lib libopenjpeg openjpeg-2.3/openjpeg.h opj_version -lopenjp2 || + { check_lib libopenjpeg openjpeg-2.2/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || + check_lib libopenjpeg openjpeg-2.2/openjpeg.h opj_version -lopenjp2 || + { check_lib libopenjpeg openjpeg-2.1/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || + check_lib libopenjpeg openjpeg-2.1/openjpeg.h opj_version -lopenjp2 || + { check_lib libopenjpeg openjpeg-2.0/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || + { check_lib libopenjpeg openjpeg-1.5/openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || + { check_lib libopenjpeg openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || die "ERROR: libopenjpeg not found"; } -enabled libopenmpt && require_pkg_config "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create -enabled libpulse && require_pkg_config libpulse pulse/pulseaudio.h pa_context_new -enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket -enabled librubberband && require_pkg_config "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init -enabled libshine && require_pkg_config shine shine/layer3.h shine_encode_buffer -enabled libsmbclient && { use_pkg_config smbclient libsmbclient.h smbc_init || +enabled libopenmpt && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create +enabled libopus && { + enabled libopus_decoder && { + require_pkg_config libopus opus opus_multistream.h opus_multistream_decoder_create + } + enabled libopus_encoder && { + require_pkg_config libopus opus opus_multistream.h opus_multistream_surround_encoder_create + } +} +enabled libpulse && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new +enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo +enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket +enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new +enabled libshine && require_pkg_config libshine shine shine/layer3.h shine_encode_buffer +enabled libsmbclient && { use_pkg_config libsmbclient smbclient libsmbclient.h smbc_init || require smbclient libsmbclient.h smbc_init -lsmbclient; } -enabled libsnappy && require snappy snappy-c.h snappy_compress -lsnappy +enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr && LIBSOXR="-lsoxr" -enabled libssh && require_pkg_config libssh libssh/sftp.h sftp_init -enabled libspeex && require_pkg_config speex speex/speex.h speex_decoder_init -lspeex -enabled libtesseract && require_pkg_config tesseract tesseract/capi.h TessBaseAPICreate +enabled libssh && require_pkg_config libssh libssh libssh/sftp.h sftp_init +enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init -lspeex +enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame && - { check_lib twolame.h twolame_encode_buffer_float32_interleaved -ltwolame || + { check_lib libtwolame twolame.h twolame_encode_buffer_float32_interleaved -ltwolame || die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; } -enabled libv4l2 && require_pkg_config libv4l2 libv4l2.h v4l2_ioctl -enabled libvidstab && require_pkg_config "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit +enabled libv4l2 && require_pkg_config libv4l2 libv4l2 libv4l2.h v4l2_ioctl +enabled libvidstab && require_pkg_config libvidstab "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit +enabled libvmaf && require_pkg_config libvmaf libvmaf libvmaf.h compute_vmaf enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc -enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg +enabled libvorbis && require_pkg_config libvorbis vorbis vorbis/codec.h vorbis_info_init && + require_pkg_config libvorbisenc vorbisenc vorbis/vorbisenc.h vorbis_encode_init enabled libvpx && { enabled libvpx_vp8_decoder && { - use_pkg_config "vpx >= 0.9.1" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx || - check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx || + use_pkg_config libvpx_vp8_decoder "vpx >= 0.9.1" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx || + check_lib libvpx_vp8_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx || die "ERROR: libvpx decoder version must be >=0.9.1"; } enabled libvpx_vp8_encoder && { - use_pkg_config "vpx >= 0.9.7" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx || - check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VP8E_SET_MAX_INTRA_BITRATE_PCT" -lvpx || + use_pkg_config libvpx_vp8_encoder "vpx >= 0.9.7" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx || + check_lib libvpx_vp8_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VP8E_SET_MAX_INTRA_BITRATE_PCT" -lvpx || die "ERROR: libvpx encoder version must be >=0.9.7"; } enabled libvpx_vp9_decoder && { - use_pkg_config "vpx >= 1.3.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx || - check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx || - disable libvpx_vp9_decoder; + use_pkg_config libvpx_vp9_decoder "vpx >= 1.3.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx || + check_lib libvpx_vp9_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx } enabled libvpx_vp9_encoder && { - use_pkg_config "vpx >= 1.3.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx || - check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VP9E_SET_AQ_MODE" -lvpx || - disable libvpx_vp9_encoder; + use_pkg_config libvpx_vp9_encoder "vpx >= 1.3.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx || + check_lib libvpx_vp9_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VP9E_SET_AQ_MODE" -lvpx } if disabled_all libvpx_vp8_decoder libvpx_vp9_decoder libvpx_vp8_encoder libvpx_vp9_encoder; then die "libvpx enabled but no supported decoders found" @@ -7005,71 +7257,70 @@ enabled libvpx && { enabled libwavpack && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput -lwavpack enabled libwebp && { - enabled libwebp_encoder && require_pkg_config "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion - enabled libwebp_anim_encoder && { use_pkg_config "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit || disable libwebp_anim_encoder; } } -enabled libx264 && { use_pkg_config x264 "stdint.h x264.h" x264_encoder_encode || - { require libx264 x264.h x264_encoder_encode -lx264 && + enabled libwebp_encoder && require_pkg_config libwebp "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion + enabled libwebp_anim_encoder && use_pkg_config libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; } +enabled libx264 && { use_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode || + { require libx264 "stdint.h x264.h" x264_encoder_encode -lx264 && warn "using libx264 without pkg-config"; } } && - { check_cpp_condition x264.h "X264_BUILD >= 118" || - die "ERROR: libx264 must be installed and 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 >= 68" || - die "ERROR: libx265 version must be >= 68."; } -enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs +enabled libx265 && require_pkg_config libx265 x265 x265.h x265_api_get && + require_cpp_condition x265.h "X265_BUILD >= 68" +enabled libxavs && require libxavs "stdint.h xavs.h" xavs_encoder_encode -lxavs enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore -enabled libzimg && require_pkg_config zimg zimg.h zimg_get_api_version -enabled libzmq && require_pkg_config libzmq zmq.h zmq_ctx_new +enabled libzimg && require_pkg_config libzimg "zimg >= 2.3.0" zimg.h zimg_get_api_version +enabled libzmq && require_pkg_config libzmq libzmq zmq.h zmq_ctx_new enabled libzvbi && require libzvbi libzvbi.h vbi_decoder_new -lzvbi && { check_cpp_condition libzvbi.h "VBI_VERSION_MAJOR > 0 || VBI_VERSION_MINOR > 2 || VBI_VERSION_MINOR == 2 && VBI_VERSION_MICRO >= 28" || enabled gpl || die "ERROR: libzvbi requires version 0.2.28 or --enable-gpl."; } +enabled libxml2 && require_pkg_config libxml2 libxml-2.0 libxml2/libxml/xmlversion.h xmlCheckVersion enabled mediacodec && { enabled jni || die "ERROR: mediacodec requires --enable-jni"; } -enabled mmal && { check_lib interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host || - { ! enabled cross_compile && { - add_cflags -isystem/opt/vc/include/ -isystem/opt/vc/include/interface/vmcs_host/linux -isystem/opt/vc/include/interface/vcos/pthreads -fgnu89-inline ; - add_extralibs -L/opt/vc/lib/ -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ; - check_lib interface/mmal/mmal.h mmal_port_connect ; } - check_lib interface/mmal/mmal.h mmal_port_connect ; } || - die "ERROR: mmal not found"; } -enabled mmal && check_func_headers interface/mmal/mmal.h "MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS" - -enabled netcdf && require_pkg_config netcdf netcdf.h nc_inq_libvers -enabled openal && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do - check_lib 'AL/al.h' alGetError "${al_libs}" && break; done } || +enabled mmal && { check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host || + { ! enabled cross_compile && + add_cflags -isystem/opt/vc/include/ -isystem/opt/vc/include/interface/vmcs_host/linux -isystem/opt/vc/include/interface/vcos/pthreads -fgnu89-inline && + add_ldflags -L/opt/vc/lib/ && + check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host; } || + die "ERROR: mmal not found" && + check_func_headers interface/mmal/mmal.h "MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS"; } +enabled openal && { { for al_extralibs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do + check_lib openal 'AL/al.h' alGetError "${al_extralibs}" && break; done } || die "ERROR: openal not found"; } && { check_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" || die "ERROR: openal must be installed and version must be 1.1 or compatible"; } -enabled opencl && { check_lib2 OpenCL/cl.h clEnqueueNDRangeKernel -Wl,-framework,OpenCL || - check_lib2 CL/cl.h clEnqueueNDRangeKernel -lOpenCL || +enabled opencl && { check_lib opencl OpenCL/cl.h clEnqueueNDRangeKernel -Wl,-framework,OpenCL || + check_lib opencl CL/cl.h clEnqueueNDRangeKernel -lOpenCL || die "ERROR: opencl not found"; } && { check_cpp_condition "OpenCL/cl.h" "defined(CL_VERSION_1_2)" || check_cpp_condition "CL/cl.h" "defined(CL_VERSION_1_2)" || die "ERROR: opencl must be installed and version must be 1.2 or compatible"; } -enabled opengl && { check_lib GL/glx.h glXGetProcAddress "-lGL" || - check_lib2 windows.h wglGetProcAddress "-lopengl32 -lgdi32" || - check_lib2 OpenGL/gl3.h glGetError "-Wl,-framework,OpenGL" || - check_lib2 ES2/gl.h glGetError "-isysroot=${sysroot} -Wl,-framework,OpenGLES" || - check_lib2 GLES/gl.h glGetError "-Wl,-framework,OpenGLES" || - { check_lib2 GLES2/gl2.h glGetError "-lGLESv2" && - check_lib2 EGL/egl.h eglGetProcAddress "-lEGL" +enabled opengl && { check_lib opengl GL/glx.h glXGetProcAddress "-lGL" || + check_lib opengl windows.h wglGetProcAddress "-lopengl32 -lgdi32" || + check_lib opengl OpenGL/gl3.h glGetError "-Wl,-framework,OpenGL" || + check_lib opengl ES2/gl.h glGetError "-isysroot=${sysroot} -Wl,-framework,OpenGLES" || + check_lib GLES/gl.h glGetError "-Wl,-framework,OpenGLES" || + { check_lib GLESv2 GLES2/gl2.h glGetError && + check_lib EGL EGL/egl.h eglGetProcAddress } || die "ERROR: opengl not found." } -enabled omx_rpi && enable omx -enabled omx && { check_header OMX_Core.h || - { ! enabled cross_compile && enabled omx_rpi && { - add_cflags -isystem/opt/vc/include/IL ; } - check_header OMX_Core.h ; } || +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 openssl && { use_pkg_config openssl openssl/ssl.h OPENSSL_init_ssl || - use_pkg_config openssl openssl/ssl.h SSL_library_init || - check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto || - check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 || - check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 || +enabled omx && require_header OMX_Core.h +enabled openssl && { use_pkg_config openssl openssl openssl/ssl.h OPENSSL_init_ssl || + use_pkg_config openssl openssl openssl/ssl.h SSL_library_init || + check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto || + check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 || + check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 || die "ERROR: openssl not found"; } -enabled qtkit_indev && { check_header_objcc QTKit/QTKit.h || disable qtkit_indev; } - +enabled rkmpp && { { require_pkg_config rockchip_mpp rockchip_mpp rockchip/rk_mpi.h mpp_create || + die "ERROR : Rockchip MPP was not found."; } && + { check_func_headers rockchip/rk_mpi_cmd.h "MPP_DEC_GET_FREE_PACKET_SLOT_COUNT" || + die "ERROR: Rockchip MPP is outdated, please get a more recent one."; } && + { enabled libdrm || + die "ERROR: rkmpp requires --enable-libdrm"; } + } if enabled libmpeg2external; then check_lib mpeg2dec/mpeg2.h mpeg2_init -lmpeg2 || disable libmpeg2external if disabled libmpeg2external; then @@ -7078,25 +7329,17 @@ if enabled libmpeg2external; then disable mythtranscode fi -# libdc1394 check -if enabled libdc1394; then - { require_pkg_config libdc1394-2 dc1394/dc1394.h dc1394_new && - enable libdc1394_2; } || - { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 && - enable libdc1394_1; } || - die "ERROR: No version of libdc1394 found " -fi if enabled gcrypt; then GCRYPT_CONFIG="${cross_prefix}libgcrypt-config" if "${GCRYPT_CONFIG}" --version > /dev/null 2>&1; then gcrypt_cflags=$("${GCRYPT_CONFIG}" --cflags) - gcrypt_libs=$("${GCRYPT_CONFIG}" --libs) - check_func_headers gcrypt.h gcry_mpi_new $gcrypt_cflags $gcrypt_libs || + gcrypt_extralibs=$("${GCRYPT_CONFIG}" --libs) + check_func_headers gcrypt.h gcry_mpi_new $gcrypt_cflags $gcrypt_extralibs || die "ERROR: gcrypt not found" - add_cflags $gcrypt_cflags && add_extralibs $gcrypt_libs + add_cflags $gcrypt_cflags && add_extralibs $gcrypt_extralibs else - require2 gcrypt gcrypt.h gcry_mpi_new -lgcrypt + require gcrypt gcrypt.h gcry_mpi_new -lgcrypt fi fi @@ -7141,41 +7384,56 @@ void foo(){switch (0) case 0: case (sizeof(long) == $sizeof):;} EOF done -check_foo_config freetype2 freetype ft2build.h FT_Init_FreeType +# check_foo_config freetype2 freetype ft2build.h FT_Init_FreeType +if require_pkg_config libfreetype2 freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType ; then + enable freetype2 +else + disable freetype2 +fi enabled freetype2 || die "ERROR! You must have FreeType installed to compile MythTV." ########################################## -disabled sdl && disable sdl2 -if ! disabled sdl2; then +if enabled sdl2; then SDL2_CONFIG="${cross_prefix}sdl2-config" - if check_pkg_config sdl2 SDL_events.h SDL_PollEvent; then - check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags && - check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags && - check_func SDL_Init $sdl2_libs $sdl2_cflags && enable sdl2 - else - if "${SDL2_CONFIG}" --version > /dev/null 2>&1; then + if check_pkg_config sdl2 "sdl2 >= 2.0.1 sdl2 < 2.1.0" SDL_events.h SDL_PollEvent; then + check_func SDL_Init $sdl2_extralibs $sdl2_cflags || + disable sdl2 + elif "${SDL2_CONFIG}" --version > /dev/null 2>&1; then sdl2_cflags=$("${SDL2_CONFIG}" --cflags) - sdl2_libs=$("${SDL2_CONFIG}" --libs) + sdl2_extralibs=$("${SDL2_CONFIG}" --libs) check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags && check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags && - check_func SDL_Init $sdl2_libs $sdl2_cflags && enable sdl2 - fi + check_func SDL_Init $sdl2_extralibs $sdl2_cflags && + enable sdl2 fi if test $target_os = "mingw32"; then - sdl2_libs="$sdl2_libs -mconsole" + sdl2_extralibs=$(filter_out '-mwindows' $sdl2_extralibs) fi fi -enabled sdl2 && add_cflags $sdl2_cflags && add_extralibs $sdl2_libs +enabled sdl2 && add_cflags $(filter_out '-Dmain=SDL_main' $sdl2_cflags) && add_extralibs $sdl2_extralibs + +if enabled decklink; then + case $target_os in + mingw32*|mingw64*|win32|win64) + decklink_outdev_extralibs="$decklink_outdev_extralibs -lole32 -loleaut32" + decklink_indev_extralibs="$decklink_indev_extralibs -lole32 -loleaut32" + ;; + esac +fi -disabled securetransport || { check_func SecIdentityCreate "-Wl,-framework,CoreFoundation -Wl,-framework,Security" && - check_lib2 "Security/SecureTransport.h Security/Security.h" "SSLCreateContext SecItemImport" "-Wl,-framework,CoreFoundation -Wl,-framework,Security" && - enable securetransport; } +enabled securetransport && + check_func SecIdentityCreate "-Wl,-framework,CoreFoundation -Wl,-framework,Security" && + check_lib securetransport "Security/SecureTransport.h Security/Security.h" "SSLCreateContext SecItemImport" "-Wl,-framework,CoreFoundation -Wl,-framework,Security" || + disable securetransport -disabled schannel || { check_func_headers "windows.h security.h" InitializeSecurityContext -DSECURITY_WIN32 -lsecur32 && - check_cpp_condition winerror.h "defined(SEC_I_CONTEXT_EXPIRED)" && enable schannel && add_extralibs -lsecur32; } +enabled schannel && + check_func_headers "windows.h security.h" InitializeSecurityContext -DSECURITY_WIN32 -lsecur32 && + check_cpp_condition winerror.h "defined(SEC_I_CONTEXT_EXPIRED)" && + add_extralibs -lsecur32 || + disable schannel makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo enabled makeinfo \ @@ -7186,15 +7444,26 @@ perl -v > /dev/null 2>&1 && enable perl || disable perl pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout +# check V4L2 codecs available in the API check_header linux/fb.h -check_header linux/videodev.h check_header linux/videodev2.h check_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete +check_code cc linux/videodev2.h "int i = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_VIDEO_M2M | V4L2_BUF_FLAG_LAST;" || disable v4l2_m2m +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_VC1_ANNEX_G;" && enable vc1_v4l2_m2m +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG1;" && enable mpeg1_v4l2_m2m +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG2;" && enable mpeg2_v4l2_m2m +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG4;" && enable mpeg4_v4l2_m2m +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_HEVC;" && enable hevc_v4l2_m2m +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_H263;" && enable h263_v4l2_m2m +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_H264;" && enable h264_v4l2_m2m +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_VP8;" && enable vp8_v4l2_m2m +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_VP9;" && enable vp9_v4l2_m2m check_header sys/videoio.h check_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete -check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs" +check_lib user32 "windows.h winuser.h" GetShellWindow -luser32 +check_lib vfw32 "windows.h vfw.h" capCreateCaptureWindow -lvfw32 # check that WM_CAP_DRIVER_CONNECT is defined to the proper value # w32api 3.12 had it defined wrong check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines @@ -7210,7 +7479,6 @@ check_type "dshow.h" IBaseFilter check_header dev/video/bktr/ioctl_bt848.h; } || check_header dev/ic/bt8xx.h -check_header sndio.h if check_struct sys/soundcard.h audio_buf_info bytes; then enable_safe sys/soundcard.h else @@ -7221,17 +7489,16 @@ EOF fi check_header soundcard.h -enabled_any alsa_indev alsa_outdev && - check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound +enabled alsa && check_lib alsa alsa/asoundlib.h snd_pcm_htimestamp -lasound -enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack && +enabled jack && check_lib jack jack/jack.h jack_client_open -ljack && check_func jack_port_get_latency_range -ljack -enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio +enabled sndio && check_lib sndio sndio.h sio_open -lsndio # PulseAudio probe ! disabled audio_pulse && - check_lib pulse/version.h pa_get_library_version -lpulse && + check_lib pulse pulse/version.h pa_get_library_version && $(pkg-config --atleast-version=0.9.7 libpulse) && enable audio_pulse || disable audio_pulse @@ -7245,101 +7512,84 @@ fi # ALSA probe ! disabled audio_alsa && - check_lib alsa/asoundlib.h snd_asoundlib_version -lasound && + check_lib asound alsa/asoundlib.h snd_asoundlib_version && check_cpp_condition alsa/asoundlib.h "(defined(SND_PCM_NO_AUTO_RESAMPLE))" && enable audio_alsa || { { ! enabled audio_alsa || die "ERROR: Alsa >= 1.0.16 required"; } && disable audio_alsa; } if enabled libcdio; then - check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio || - check_lib2 "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio || + check_lib libcdio "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio || + check_lib libcdio "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio || die "ERROR: No usable libcdio/cdparanoia found" fi -enabled xlib && - check_lib X11/Xlib.h XOpenDisplay -lX11 || disable xlib - -if ! disabled libxcb; then - check_pkg_config "xcb >= 1.4" xcb/xcb.h xcb_connect || { - enabled libxcb && die "ERROR: libxcb >= 1.4 not found"; - } && disable x11grab && enable libxcb +enabled libxcb && check_pkg_config libxcb "xcb >= 1.4" xcb/xcb.h xcb_connect || + disable libxcb_shm libxcb_shape libxcb_xfixes if enabled libxcb; then - 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; } - - 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; } - - disabled libxcb_shape || { - check_pkg_config xcb-shape xcb/shape.h xcb_shape_get_rectangles || { - enabled libxcb_shape && die "ERROR: libxcb_shape not found"; - } && enable libxcb_shape; } + enabled libxcb_shm && check_pkg_config libxcb_shm xcb-shm xcb/shm.h xcb_shm_attach + enabled libxcb_shape && check_pkg_config libxcb_shape xcb-shape xcb/shape.h xcb_shape_get_rectangles + enabled libxcb_xfixes && check_pkg_config libxcb_xfixes xcb-xfixes xcb/xfixes.h xcb_xfixes_get_cursor_image add_cflags $xcb_cflags $xcb_shm_cflags $xcb_xfixes_cflags $xcb_shape_cflags - add_extralibs $xcb_libs $xcb_shm_libs $xcb_xfixes_libs $xcb_shape_libs -fi -fi - -if enabled x11grab; then - enabled xlib || die "ERROR: Xlib not found" - require Xext X11/extensions/XShm.h XShmCreateImage -lXext - require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes + add_extralibs $xcb_extralibs $xcb_shm_extralibs $xcb_xfixes_extralibs $xcb_shape_extralibs fi check_func_headers "windows.h" CreateDIBSection "$gdigrab_indev_extralibs" -enabled dxva2api_h && - check_cc < -#include -#include -int main(void) { IDirectXVideoDecoder *o = NULL; IDirectXVideoDecoder_Release(o); return 0; } +# d3d11va requires linking directly to dxgi and d3d11 if not building for +# the desktop api partition +check_cpp < +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) +#error desktop, not uwp +#else +// WINAPI_FAMILY_APP, WINAPI_FAMILY_PHONE_APP => UWP +#endif +#else +#error no family set +#endif EOF enabled vaapi && enabled opengl && check_header GL/glx.h && - check_lib va/va.h vaInitialize -lva || - disable vaapi + check_lib vaapi va/va.h vaInitialize -lva enabled vaapi && check_code cc "va/va.h" "vaCreateSurfaces(0, 0, 0, 0, 0, 0, 0, 0)" || disable vaapi -if enabled vaapi ; then - enabled xlib && - check_lib2 "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 && - enable vaapi_x11 +enabled vaapi && + check_lib vaapi_drm "va/va.h va/va_drm.h" vaGetDisplayDRM -lva -lva-drm - check_lib2 "va/va.h va/va_drm.h" vaGetDisplayDRM -lva -lva-drm && - enable vaapi_drm -fi +enabled vaapi && + check_lib vaapi_x11 "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 -lX11 + +enabled vaapi && + check_cpp_condition "va/va.h" "VA_CHECK_VERSION(1, 0, 0)" && + enable vaapi_1 enabled vdpau && check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" || disable vdpau -enabled vdpau && enabled xlib && - check_lib2 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau && - enable vdpau_x11 +enabled vdpau && + check_lib vdpau_x11 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau -lX11 + +enabled crystalhd && check_lib crystalhd "stdint.h libcrystalhd/libcrystalhd_if.h" DtsCrystalHDVersion -lcrystalhd if enabled x86; then case $target_os in mingw32*|mingw64*|win32|win64|linux|cygwin*) ;; *) - disable nvenc + disable cuda cuvid nvenc ;; esac else - disable nvenc + disable cuda cuvid nvenc fi enabled nvenc && @@ -7351,7 +7601,11 @@ int main(void) { return 0; } EOF # Funny iconv installations are not unusual, so check it after all flags have been set -disabled iconv || check_func_headers iconv.h iconv || check_lib2 iconv.h iconv -liconv || disable iconv +if enabled libc_iconv; then + check_func_headers iconv.h iconv +elif enabled iconv; then + check_func_headers iconv.h iconv || check_lib iconv iconv.h iconv -liconv +fi enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel" enabled debug && add_cxxflags -g"$debuglevel" @@ -7371,19 +7625,41 @@ if [ "$target_os" != "darwin" ]; then fi check_cflags -Wno-pointer-to-int-cast check_cflags -Wstrict-prototypes -enabled extra_warnings && check_cflags -Winline -enabled extra_warnings && check_cflags -Wcast-qual + +if enabled extra_warnings; then + check_cflags -Wcast-qual + check_cflags -Wextra + check_cflags -Wpedantic +fi check_disable_warning(){ warning_flag=-W${1#-Wno-} - test_cflags $warning_flag && add_cflags $1 + test_cflags $unknown_warning_flags $warning_flag && add_cflags $1 } +test_cflags -Werror=unused-command-line-argument && + append unknown_warning_flags "-Werror=unused-command-line-argument" +test_cflags -Werror=unknown-warning-option && + append unknown_warning_flags "-Werror=unknown-warning-option" + check_disable_warning -Wno-parentheses disabled icc && check_disable_warning -Wno-switch check_disable_warning -Wno-format-zero-length check_disable_warning -Wno-pointer-sign check_disable_warning -Wno-unused-const-variable +check_disable_warning -Wno-bool-operation + +check_disable_warning_headers(){ + warning_flag=-W${1#-Wno-} + test_cflags $warning_flag && add_cflags_headers $1 +} + +check_disable_warning_headers -Wno-deprecated-declarations +check_disable_warning_headers -Wno-unused-variable + +check_cc <= 190024218" || + check_cflags -d2SSAOptimizer- + # enable utf-8 source processing on VS2015 U2 and newer + check_cpp_condition windows.h "_MSC_FULL_VER >= 190023918" && + add_cflags -utf-8 fi for pfx in "" host_; do varname=${pfx%_}cc_type eval "type=\$$varname" - if [ $type = "msvc" ]; then + if [ "$type" = "msvc" ]; then check_${pfx}cc < enable ${lib}_deps_${dep} # -> add $dep to ${lib}_deps only once @@ -8045,19 +8321,41 @@ for thread in $THREADS_LIST; do fi done +if disabled stdatomic_h; then + if enabled atomics_gcc; then + add_cppflags '-I\$(SRC_PATH)/compat/atomics/gcc' + elif enabled atomics_win32; then + add_cppflags '-I\$(SRC_PATH)/compat/atomics/win32' + elif enabled atomics_suncc; then + add_cppflags '-I\$(SRC_PATH)/compat/atomics/suncc' + elif enabled pthreads; then + add_compat atomics/pthread/stdatomic.o + add_cppflags '-I\$(SRC_PATH)/compat/atomics/pthread' + else + enabled threads && die "Threading is enabled, but no atomics are available" + add_cppflags '-I\$(SRC_PATH)/compat/atomics/dummy' + fi +fi + +# Check if requested libraries were found. +for lib in $AUTODETECT_LIBS; do + requested $lib && ! enabled $lib && die "ERROR: $lib requested but not found"; +done + enabled zlib && add_cppflags -DZLIB_CONST # conditional library dependencies, in linking order enabled afftfilt_filter && prepend avfilter_deps "avcodec" +enabled afir_filter && prepend avfilter_deps "avcodec" enabled amovie_filter && prepend avfilter_deps "avformat avcodec" enabled aresample_filter && prepend avfilter_deps "swresample" -enabled asyncts_filter && prepend avfilter_deps "avresample" enabled atempo_filter && prepend avfilter_deps "avcodec" enabled cover_rect_filter && prepend avfilter_deps "avformat avcodec" enabled ebur128_filter && enabled swresample && prepend avfilter_deps "swresample" enabled elbg_filter && prepend avfilter_deps "avcodec" enabled fftfilt_filter && prepend avfilter_deps "avcodec" enabled find_rect_filter && prepend avfilter_deps "avformat avcodec" +enabled firequalizer_filter && prepend avfilter_deps "avcodec" enabled mcdeint_filter && prepend avfilter_deps "avcodec" enabled movie_filter && prepend avfilter_deps "avformat avcodec" enabled pan_filter && prepend avfilter_deps "swresample" @@ -8071,10 +8369,13 @@ enabled sofalizer_filter && prepend avfilter_deps "avcodec" enabled showcqt_filter && prepend avfilter_deps "avformat avcodec swscale" enabled showfreqs_filter && prepend avfilter_deps "avcodec" enabled showspectrum_filter && prepend avfilter_deps "avcodec" +enabled signature_filter && prepend avfilter_deps "avcodec avformat" enabled smartblur_filter && prepend avfilter_deps "swscale" enabled spectrumsynth_filter && prepend avfilter_deps "avcodec" +enabled spp_filter && prepend avfilter_deps "avcodec" enabled subtitles_filter && prepend avfilter_deps "avformat avcodec" enabled uspp_filter && prepend avfilter_deps "avcodec" +enabled zoompan_filter && prepend avfilter_deps "swscale" enabled lavfi_indev && prepend avdevice_deps "avfilter" @@ -8098,6 +8399,19 @@ fi enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; } +license="LGPL version 2.1 or later" +if enabled nonfree; then + license="nonfree and unredistributable" +elif enabled gplv3; then + license="GPL version 3 or later" +elif enabled lgplv3; then + license="LGPL version 3 or later" +elif enabled gpl; then + license="GPL version 2 or later" +fi + +if test "$quiet" != "yes"; then + echo "# Basic Settings" echo "Qt minimum version $QT_MIN_VERSION_STR" echo "Qt installed version `$qmake -query QT_VERSION`" @@ -8138,7 +8452,8 @@ echo "big-endian ${bigendian-no}" echo "runtime cpu detection ${runtime_cpudetect-no}" BLOCK_QUOTE if enabled x86; then - echo "${yasmexe} ${yasm-no}" + echo "standalone assembly ${x86asm-no}" + echo "x86 assembler ${x86asmexe}" echo "MMX enabled ${mmx-no}" echo "MMXEXT enabled ${mmxext-no}" echo "3DNow! enabled ${amd3dnow-no}" @@ -8147,6 +8462,7 @@ if enabled x86; then echo "SSSE3 enabled ${ssse3-no}" echo "AESNI enabled ${aesni-no}" echo "AVX enabled ${avx-no}" + echo "AVX2 enabled ${avx2-no}" echo "XOP enabled ${xop-no}" echo "FMA3 enabled ${fma3-no}" echo "FMA4 enabled ${fma4-no}" @@ -8192,13 +8508,9 @@ echo "optimizations ${optimizations-no}" echo "static ${static-no}" echo "shared ${shared-no}" echo "postprocessing support ${postproc-no}" -echo "new filter support ${avfilter-no}" echo "network support ${network-no}" echo "threading support ${thread_type-no}" echo "safe bitstream reader ${safe_bitstream_reader-no}" -echo "SDL2 support ${sdl2-no}" -echo "opencl enabled ${opencl-no}" -echo "JNI support ${jni-no}" echo "texi2html enabled ${texi2html-no}" echo "perl enabled ${perl-no}" echo "pod2man enabled ${pod2man-no}" @@ -8208,10 +8520,6 @@ test -n "$random_seed" && echo "random seed ${random_seed}" echo -echo "Enabled programs:" -print_enabled '' $PROGRAM_LIST | print_in_columns -echo - echo "External libraries:" print_enabled '' $EXTERNAL_LIBRARY_LIST | print_in_columns echo @@ -8224,6 +8532,10 @@ echo "Libraries:" print_enabled '' $LIBRARY_LIST | print_in_columns echo +echo "Programs:" +print_enabled '' $PROGRAM_LIST | print_in_columns +echo + for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do echo "Enabled ${type}s:" eval list=\$$(toupper $type)_LIST @@ -8231,20 +8543,20 @@ for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf ind echo done -license="LGPL version 2.1 or later" -if enabled nonfree; then - license="nonfree and unredistributable" -elif enabled gplv3; then - license="GPL version 3 or later" -elif enabled lgplv3; then - license="LGPL version 3 or later" -elif enabled gpl; then - license="GPL version 2 or later" +if test -n "$ignore_tests"; then + ignore_tests=$(echo $ignore_tests | tr ',' ' ') + echo "Ignored FATE tests:" + echo $ignore_tests | print_in_columns + echo fi echo "License: $license" BLOCK_QUOTE +echo "Creating configuration files ..." + +fi # test "$quiet" != "yes" + echo if enabled frontend; then echo "# Input Support" @@ -8313,8 +8625,9 @@ if enabled source_path_used; then fi enabled stripping || strip="echo skipping strip" +enabled stripping || striptype="" -config_files="$TMPH $TMPMAK" +config_files="$TMPH $TMPMAK doc/config.texi" if enabled backend; then echo "Video4Linux support ${v4l2-no}" @@ -8460,13 +8773,16 @@ DEPCC=$dep_cc DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS) DEPAS=$as DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS) -YASM=$yasmexe -DEPYASM=$yasmexe +X86ASM=$x86asmexe +DEPX86ASM=$x86asmexe +DEPX86ASMFLAGS=\$(X86ASMFLAGS) AR=$ar ARFLAGS=$arflags AR_O=$ar_o RANLIB=$ranlib STRIP=$strip +STRIPTYPE=$striptype +NVCC=$nvcc CP=cp -p LN_S=$ln_s CPPFLAGS=$CPPFLAGS @@ -8474,6 +8790,7 @@ CFLAGS=$CFLAGS CXXFLAGS=$CXXFLAGS OBJCFLAGS=$OBJCFLAGS ASFLAGS=$ASFLAGS +NVCCFLAGS=$nvccflags AS_C=$AS_C AS_O=$AS_O OBJCC_C=$OBJCC_C @@ -8484,7 +8801,10 @@ CC_E=$CC_E CC_O=$CC_O CXX_C=$CXX_C CXX_O=$CXX_O +NVCC_C=$NVCC_C +NVCC_O=$NVCC_O LD_O=$LD_O +X86ASM_O=$X86ASM_O LD_LIB=$LD_LIB LD_MYTH_LIB=$LD_MYTH_LIB LD_PATH=$LD_PATH @@ -8500,7 +8820,7 @@ LDEXEFLAGS=$LDEXEFLAGS LDLIBFLAGS=$LDLIBFLAGS #SHFLAGS=$(echo $($ldflags_filter $SHFLAGS)) ASMSTRIPFLAGS=$ASMSTRIPFLAGS -YASMFLAGS=$YASMFLAGS +X86ASMFLAGS=$X86ASMFLAGS BUILDSUF=$build_suffix PROGSSUF=$progs_suffix FULLNAME=$FULLNAME @@ -8516,15 +8836,18 @@ CXXDEP=$CXXDEP CCDEP_FLAGS=$CCDEP_FLAGS ASDEP=$ASDEP ASDEP_FLAGS=$ASDEP_FLAGS +X86ASMDEP=$X86ASMDEP +X86ASMDEP_FLAGS=$X86ASMDEP_FLAGS CC_DEPFLAGS=$CC_DEPFLAGS AS_DEPFLAGS=$AS_DEPFLAGS +X86ASM_DEPFLAGS=$X86ASM_DEPFLAGS HOSTCC=$host_cc HOSTLD=$host_ld HOSTCFLAGS=$host_cflags HOSTCPPFLAGS=$host_cppflags HOSTEXESUF=$HOSTEXESUF HOSTLDFLAGS=$host_ldflags -HOSTLIBS=$host_libs +HOSTEXTRALIBS=$host_extralibs DEPHOSTCC=$host_cc DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS) HOSTCCDEP=$HOSTCCDEP @@ -8537,11 +8860,11 @@ TARGET_EXEC=$target_exec $target_exec_args TARGET_PATH=$target_path TARGET_SAMPLES=${target_samples:-\$(SAMPLES)} CFLAGS-ffplay=${sdl2_cflags} +CFLAGS_HEADERS=$CFLAGS_HEADERS ZLIB=$($ldflags_filter -lz) #LIB_INSTALL_EXTRA_CMD=$_LIB_INSTALL_EXTRA_CMD EXTRALIBS=$extralibs $ldl COMPAT_OBJS=$compat_objs -EXEOBJS=$exeobjs INSTALL=$install LIBTARGET=${LIBTARGET} SLIBNAME=${SLIBNAME} @@ -8558,34 +8881,22 @@ SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB} VERSION_SCRIPT_POSTPROCESS_CMD=${VERSION_SCRIPT_POSTPROCESS_CMD} SAMPLES=$samples NOREDZONE_FLAGS=$noredzone_flags +LIBFUZZER_PATH=$libfuzzer_path +IGNORE_TESTS=$ignore_tests ANTBIN=$antbin BDJ_TYPE=$bdj_type JDK_HOME=$JDK_HOME JAVA_ARCH=$java_arch EOF -get_version(){ - lcname=lib${1} - name=$(toupper $lcname) - file=$source_path/external/FFmpeg/$lcname/version.h - eval $(awk "/#define ${name}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file") - enabled raise_major && eval ${name}_VERSION_MAJOR=$((${name}_VERSION_MAJOR+100)) - eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO - eval echo "${lcname}_VERSION=\$${name}_VERSION" >> $TMPMAK - eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> $TMPMAK - eval echo "${lcname}_VERSION_MINOR=\$${name}_VERSION_MINOR" >> $TMPMAK -} - -map 'get_version $v' $LIBRARY_LIST - map 'eval echo "${v}_FFLIBS=\$${v}_deps" >> $TMPMAK' $LIBRARY_LIST -print_program_libs(){ - eval "program_libs=\$${1}_libs" - eval echo "LIBS-${1}=${program_libs}" >> $TMPMAK +print_program_extralibs(){ + eval "program_extralibs=\$${1}_extralibs" + eval echo "EXTRALIBS-${1}=${program_extralibs}" >> $TMPMAK } -map 'print_program_libs $v' $PROGRAM_LIST +map 'print_program_extralibs $v' $PROGRAM_LIST echo "RUNPREFIX=$runprefix" >> $TMPMAK echo "SYSROOT=$sysroot" >> $TMPMAK @@ -8620,7 +8931,7 @@ cat > $TMPH <> $TMPH fi -if enabled yasm; then +if enabled x86asm; then append config_files $TMPASM printf '' >$TMPASM fi @@ -8852,7 +9163,7 @@ fi # create config.mak for external/FFmpeg -cat > external/FFmpeg/config.mak < external/FFmpeg/ffbuild/config.mak <> external/FFmpeg/config.mak -cat >> external/FFmpeg/config.mak <> external/FFmpeg/ffbuild/config.mak +cat >> external/FFmpeg/ffbuild/config.mak < $TMPH + echo "static const $struct_name * const $name[] = {" > $TMPH for c in $*; do enabled $c && printf " &ff_%s,\n" $c >> $TMPH done @@ -8983,65 +9294,34 @@ print_enabled_components external/FFmpeg/libavformat/protocol_list.c URLProtocol test -n "$WARNINGS" && printf "\n$WARNINGS" || exit 0 <= \$LIB$(toupper ${1})_VERSION, \"" -} +# Settings for pkg-config files -pkgconfig_generate(){ - name=$1 - shortname=${name#lib}${build_suffix} - comment=$2 - version=$3 - libs=$4 - requires=$(map 'lib_version $v' $(eval echo \$${name#lib}_deps)) - requires=${requires%, } - enabled ${name#lib} || return 0 - mkdir -p $name - cat < $name/$name${build_suffix}.pc +cat > ffbuild/config.sh < doc/examples/pc-uninstalled/$name.pc -prefix= -exec_prefix= -libdir=\${pcfiledir}/../../../$name -includedir=${includedir} - -Name: $name -Description: $comment -Version: $version -Requires: $requires -Conflicts: -Libs: -L\${libdir} -Wl,-rpath,\${libdir} -l${shortname} $(enabled shared || echo $libs) -Cflags: -I\${includedir} +incdir=$incdir +rpath=$(enabled rpath && echo "-Wl,-rpath,\${libdir}") +source_path=${source_path} +LIBPREF=${LIBPREF} +LIBSUF=${LIBSUF} + +extralibs_avutil="$LIBRT $LIBM" +extralibs_avcodec="$extralibs" +extralibs_avformat="$extralibs" +extralibs_avdevice="$extralibs" +extralibs_avfilter="$extralibs" +extralibs_avresample="$LIBM" +extralibs_postproc="" +extralibs_swscale="$LIBM" +extralibs_swresample="$LIBM $LIBSOXR" EOF -} -pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" "$LIBRT $LIBM" -pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" -pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" -pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" -pkgconfig_generate libavfilter "FFmpeg audio/video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" -pkgconfig_generate libpostproc "FFmpeg postprocessing library" "$LIBPOSTPROC_VERSION" "" -pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$LIBM" -pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" -pkgconfig_generate libswresample "FFmpeg audio resampling library" "$LIBSWRESAMPLE_VERSION" "$LIBM $LIBSOXR" +for lib in $LIBRARY_LIST; do + lib_deps="$(eval echo \$${lib}_deps)" + echo ${lib}_deps=\"$lib_deps\" >> ffbuild/config.sh +done MYTHEOF diff --git a/mythtv/external/FFmpeg/.gitattributes b/mythtv/external/FFmpeg/.gitattributes index a900528e474..5a19b963b66 100644 --- a/mythtv/external/FFmpeg/.gitattributes +++ b/mythtv/external/FFmpeg/.gitattributes @@ -1 +1,2 @@ *.pnm -diff -text +tests/ref/fate/sub-scc eol=crlf diff --git a/mythtv/external/FFmpeg/.gitignore b/mythtv/external/FFmpeg/.gitignore index 524fb73c165..dabb51762d3 100644 --- a/mythtv/external/FFmpeg/.gitignore +++ b/mythtv/external/FFmpeg/.gitignore @@ -18,6 +18,9 @@ *.so.* *.swp *.ver +*.version +*.ptx +*.ptx.c *_g \#* .\#* @@ -27,7 +30,8 @@ /ffplay /ffprobe /ffserver -/config.* +/config.asm +/config.h /coverage.info /avversion.h /lcov/ diff --git a/mythtv/external/FFmpeg/.travis.yml b/mythtv/external/FFmpeg/.travis.yml index e541ee16088..40f01f94c26 100644 --- a/mythtv/external/FFmpeg/.travis.yml +++ b/mythtv/external/FFmpeg/.travis.yml @@ -6,7 +6,7 @@ os: addons: apt: packages: - - yasm + - nasm - diffutils compiler: - clang @@ -17,7 +17,7 @@ cache: before_install: - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update --all; fi install: - - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install yasm; fi + - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install nasm; fi script: - mkdir -p ffmpeg-samples - ./configure --samples=ffmpeg-samples --cc=$CC diff --git a/mythtv/external/FFmpeg/Changelog b/mythtv/external/FFmpeg/Changelog index fd71ad379bf..d9f6b8a87ac 100644 --- a/mythtv/external/FFmpeg/Changelog +++ b/mythtv/external/FFmpeg/Changelog @@ -1,6 +1,173 @@ Entries are sorted chronologically from oldest to youngest within each release, releases are sorted from youngest to oldest. +version 3.4.1: +- avcodec/vp9_superframe_split_bsf: Fix integer overflow in frame_size/total_size checks +- avcodec/amrwbdec: Fix division by 0 in voice_factor() +- avformat/utils: Fix warning: ISO C90 forbids mixed declarations and code +- avcodec/decode: reset codec on receiving packet after EOF in compat_decode +- avcodec/diracdsp: Fix integer overflow in PUT_SIGNED_RECT_CLAMPED() +- avcodec/dirac_dwt: Fix integer overflows in COMPOSE_DAUB97* +- avcodec/extract_extradata_bsf: Fix leak discovered via fuzzing +- avcodec/vorbis: Fix another 1 << 31 > int32_t::max() with 1u. +- avcodec/vorbis: 1 << 31 > int32_t::max(), so use 1u << 31 instead. +- avformat/utils: Prevent undefined shift with wrap_bits > 64. +- avcodec/j2kenc: Fix out of array access in encode_cblk() +- avcodec/hevcdsp_template: Fix undefined shift in put_hevc_epel_bi_w_h() +- lavf/mov: fix huge alloc in mov_read_ctts +- avcodec/mlpdsp: Fix signed integer overflow, 2nd try +- avcodec/h264idct_template: Fix integer overflow in ff_h264_idct8_add +- avcodec/kgv1dec: Check that there is enough input for maximum RLE compression +- avformat/aacdec: Fix leak in adts_aac_read_packet() +- avcodec/dirac_dwt: Fix integer overflow in COMPOSE_FIDELITYi* +- avcodec/sbrdsp_fixed: Fix integer overflow +- avcodec/mpeg4videodec: Check also for negative versions in the validity check +- Close ogg stream upon error when using AV_EF_EXPLODE. +- Fix undefined shift on assumed 8-bit input. +- Use ff_thread_once for fixed, float table init. +- Fix leak of frame_duration_buffer in mov_fix_index(). +- avformat/mov: Propagate errors in mov_switch_root. +- avcodec/hevcdsp_template: Fix invalid shift in put_hevc_epel_bi_w_v() +- avcodec/mlpdsp: Fix undefined shift ff_mlp_pack_output() +- avcodec/zmbv: Check that the buffer is large enough for mvec +- avcodec/dirac_dwt: Fix integer overflow in COMPOSE_DD137iL0() +- avcodec/wmv2dec: Check end of bitstream in parse_mb_skip() and ff_wmv2_decode_mb() +- avcodec/snowdec: Check for remaining bitstream in decode_blocks() +- avcodec/snowdec: Check intra block dc differences. +- avformat/mov: Check size of STSC allocation +- avcodec/vc2enc: Clear coef_buf on allocation +- avcodec/h264dec: Fix potential array overread +- avcodec/x86/mpegvideodsp: Fix signedness bug in need_emu +- avcodec/aacpsdsp_template: Fix integer overflows in ps_decorrelate_c() +- avcodec/aacdec_fixed: Fix undefined shift +- avcodec/mdct_*: Fix integer overflow in addition in RESCALE() +- avcodec/snowdec: Fix integer overflow in header parsing +- avcodec/cngdec: Fix integer clipping +- avcodec/sbrdsp_fixed: Fix integer overflow in shift in sbr_hf_g_filt_c() +- avcodec/aacsbr_fixed: Fix division by zero in sbr_gain_calc() +- avutil/softfloat: Add FLOAT_MIN +- avcodec/h264idct_template: Fix integer overflows in ff_h264_idct8_add() +- avcodec/xan: Check for bitstream end in xan_huffman_decode() +- avcodec/exr: fix undefined shift in pxr24_uncompress() +- avformat: Free the internal codec context at the end +- avcodec/h264idct_template: Fix integer overflows in ff_h264_idct8_add() +- avcodec/xan: Improve overlapping check +- avcodec/aacdec_fixed: Fix integer overflow in apply_dependent_coupling_fixed() +- avcodec/aacdec_fixed: Fix integer overflow in predict() +- avcodec/jpeglsdec: Check for end of bitstream in ls_decode_line() +- avcodec/jpeglsdec: Check ilv for being a supported value +- tests/ffserver.regression.ref: update checksums to what ffserver currently produces +- ffserver: Fix off by 1 error in path +- avcodec/proresdec: align dequantization matrix buffers +- avformat/matroskaenc: add missing allocation failure checks for stream durations +- avformat/matroskaenc: actually enforce the stream limit +- configure: Fix dependencies of aac_at decoder. +- Don't manipulate duration when it's AV_NOPTS_VALUE. +- lavfi/af_pan: fix sign handling in channel coefficient parser +- avformat/hlsenc: write fmp4 init header after first AV frame +- avformat/hlsenc: allocate space for terminating null +- avformat/hlsenc: reindent hlsenc code +- avformat/hlsenc: check hls segment mode for ignore the init filename +- avformat/hlsenc: reindent hlsenc code +- avformat/hlsenc: fix missing first segment bug in fmp4 mode +- avformat/hlsenc: fix base_output_dirname is null when basename_size is 0 bug +- ffplay: use SDL2 audio API +- ffplay: only use hardware accelerated SDL texture formats +- ffplay: create the window and the renderer before starting playback +- ffmpeg: always init output stream before reaping filters +- vc2enc_dwt: pad the temporary buffer by the slice size +- lavu/arm: Check for have_vfp_vm instead of !have_vfpv3 for float_dsp_vfp + +version 3.4: +- deflicker video filter +- doubleweave video filter +- lumakey video filter +- pixscope video filter +- oscilloscope video filter +- config.log and other configuration files moved into ffbuild/ directory +- update cuvid/nvenc headers to Video Codec SDK 8.0.14 +- afir audio filter +- scale_cuda CUDA based video scale filter +- librsvg support for svg rasterization +- crossfeed audio filter +- spec compliant VP9 muxing support in MP4 +- remove the libnut muxer/demuxer wrappers +- remove the libschroedinger encoder/decoder wrappers +- surround audio filter +- sofalizer filter switched to libmysofa +- Gremlin Digital Video demuxer and decoder +- headphone audio filter +- superequalizer audio filter +- roberts video filter +- The x86 assembler default switched from yasm to nasm, pass + --x86asmexe=yasm to configure to restore the old behavior. +- additional frame format support for Interplay MVE movies +- support for decoding through D3D11VA in ffmpeg +- limiter video filter +- libvmaf video filter +- Dolby E decoder and SMPTE 337M demuxer +- unpremultiply video filter +- tlut2 video filter +- floodfill video filter +- pseudocolor video filter +- raw G.726 muxer and demuxer, left- and right-justified +- NewTek NDI input/output device +- Some video filters with several inputs now use a common set of options: + blend, libvmaf, lut3d, overlay, psnr, ssim. + They must always be used by name. +- FITS demuxer and decoder +- FITS muxer and encoder +- add --disable-autodetect build switch +- drop deprecated qtkit input device (use avfoundation instead) +- despill video filter +- haas audio filter +- SUP/PGS subtitle muxer +- convolve video filter +- VP9 tile threading support +- KMS screen grabber +- CUDA thumbnail filter +- V4L2 mem2mem HW assisted codecs +- Rockchip MPP hardware decoding +- vmafmotion video filter +- use MIME type "G726" for little-endian G.726, "AAL2-G726" for big-endian G.726 + + +version 3.3: +- CrystalHD decoder moved to new decode API +- add internal ebur128 library, remove external libebur128 dependency +- Pro-MPEG CoP #3-R2 FEC protocol +- premultiply video filter +- Support for spherical videos +- configure now fails if autodetect-libraries are requested but not found +- PSD Decoder +- 16.8 floating point pcm decoder +- 24.0 floating point pcm decoder +- Apple Pixlet decoder +- QDMC audio decoder +- NewTek SpeedHQ decoder +- MIDI Sample Dump Standard demuxer +- readeia608 filter +- Sample Dump eXchange demuxer +- abitscope multimedia filter +- Scenarist Closed Captions demuxer and muxer +- threshold filter +- midequalizer filter +- Optimal Huffman tables for (M)JPEG encoding +- VAAPI-accelerated MPEG-2 and VP8 encoding +- FM Screen Capture Codec decoder +- native Opus encoder +- ScreenPressor decoder +- incomplete ClearVideo decoder +- Intel QSV video scaling and deinterlacing filters +- Support MOV with multiple sample description tables +- XPM decoder +- Removed the legacy X11 screen grabber, use XCB instead +- MPEG-7 Video Signature filter +- Removed asyncts filter (use af_aresample instead) +- Intel QSV-accelerated VP8 video decoding +- VAAPI-accelerated deinterlacing + + version 3.2: - libopenmpt demuxer - tee protocol @@ -38,6 +205,7 @@ version 3.2: - Matroska muxer now writes CRC32 elements by default in all Level 1 elements - sidedata video and asidedata audio filter - Changed mapping of rtp MIME type G726 to codec g726le. +- spec compliant VAAPI/DXVA2 VC-1 decoding of slices in frame-coded images version 3.1: diff --git a/mythtv/external/FFmpeg/LICENSE.md b/mythtv/external/FFmpeg/LICENSE.md index a384fa0bef1..ba65b059c5b 100644 --- a/mythtv/external/FFmpeg/LICENSE.md +++ b/mythtv/external/FFmpeg/LICENSE.md @@ -17,7 +17,6 @@ Specifically, the GPL parts of FFmpeg are: - `libavcodec/x86/flac_dsp_gpl.asm` - `libavcodec/x86/idct_mmx.c` - `libavfilter/x86/vf_removegrain.asm` -- the X11 grabber in `libavdevice/x11grab.c` - the following building and testing tools - `compat/solaris/make_sunver.pl` - `doc/t2h.pm` @@ -26,7 +25,6 @@ Specifically, the GPL parts of FFmpeg are: - `tests/checkasm/*` - `tests/tiny_ssim.c` - the following filters in libavfilter: - - `f_ebur128.c` - `vf_blackframe.c` - `vf_boxblur.c` - `vf_colormatrix.c` diff --git a/mythtv/external/FFmpeg/MAINTAINERS b/mythtv/external/FFmpeg/MAINTAINERS index d0457a6bc9b..9027ed5846e 100644 --- a/mythtv/external/FFmpeg/MAINTAINERS +++ b/mythtv/external/FFmpeg/MAINTAINERS @@ -47,6 +47,7 @@ project server Árpád Gereöffy, Michael Niedermayer, presets Robert Swain metadata subsystem Aurelien Jacobs release management Michael Niedermayer +API tests Ludmila Glinskih Communication @@ -59,6 +60,7 @@ mailing lists Baptiste Coudurier, Lou Logan Google+ Paul B Mahol, Michael Niedermayer, Alexander Strasser Twitter Lou Logan, Reynaldo H. Verdejo Pinochet Launchpad Timothy Gu +ffmpeg-security Andreas Cadhalpun, Carl Eugen Hoyos, Clément Bœsch, Michael Niedermayer, Reimar Doeffinger, Rodger Combs, wm4 libavutil @@ -114,6 +116,8 @@ Generic Parts: lzw.* Michael Niedermayer floating point AAN DCT: faandct.c, faandct.h Michael Niedermayer + Non-power-of-two MDCT: + mdct15.c, mdct15.h Rostislav Pehlivanov Golomb coding: golomb.c, golomb.h Michael Niedermayer motion estimation: @@ -155,8 +159,10 @@ Codecs: crystalhd.c Philip Langdale cscd.c Reimar Doeffinger cuvid.c Timo Rothenpieler + dca* foo86 dirac* Rostislav Pehlivanov dnxhd* Baptiste Coudurier + dolby_e* foo86 dpcm.c Mike Melanson dss_sp.c Oleksij Rempel dv.c Roman Shaposhnik @@ -175,7 +181,7 @@ Codecs: h263* Michael Niedermayer h264* Loren Merritt, Michael Niedermayer hap* Tom Butterworth - huffyuv* Michael Niedermayer, Christophe Gisquet + huffyuv* Michael Niedermayer idcinvideo.c Mike Melanson interplayvideo.c Mike Melanson jni*, ffjni* Matthieu Bouron @@ -188,7 +194,6 @@ Codecs: libkvazaar.c Arttu Ylä-Outinen libopenjpeg.c Jaikrishnan Menon libopenjpegenc.c Michael Bradshaw - libschroedinger* David Conrad libtheoraenc.c David Conrad libvorbis.c David Conrad libvpx* James Zern @@ -208,13 +213,14 @@ Codecs: msvideo1.c Mike Melanson nuv.c Reimar Doeffinger nvenc* Timo Rothenpieler + opus* Rostislav Pehlivanov paf.* Paul B Mahol pcx.c Ivo van Poorten pgssubdec.c Reimar Doeffinger ptx.c Ivo van Poorten qcelp* Reynaldo H. Verdejo Pinochet qdm2.c, qdm2data.h Roberto Togni - qsv* Ivan Uskov + qsv* Mark Thompson qtrle.c Mike Melanson ra144.c, ra144.h, ra288.c, ra288.h Roberto Togni resample2.c Michael Niedermayer @@ -222,12 +228,12 @@ Codecs: rpza.c Roberto Togni rtjpeg.c, rtjpeg.h Reimar Doeffinger rv10.c Michael Niedermayer - rv4* Christophe Gisquet s3tc* Ivo van Poorten smc.c Mike Melanson smvjpegdec.c Ash Hughes snow* Michael Niedermayer, Loren Merritt sonic.c Alex Beregszaszi + speedhq.c Steinar H. Gunderson srt* Aurelien Jacobs sunrast.c Ivo van Poorten svq3.c Michael Niedermayer @@ -236,7 +242,6 @@ Codecs: tta.c Alex Beregszaszi, Jaikrishnan Menon ttaenc.c Paul B Mahol txd.c Ivo van Poorten - vc1* Christophe Gisquet vc2* Rostislav Pehlivanov vcr1.c Michael Niedermayer vda_h264_dec.c Xidorn Quan @@ -261,7 +266,8 @@ Codecs: Hardware acceleration: crystalhd.c Philip Langdale - dxva2* Hendrik Leppkes, Laurent Aimar + dxva2* Hendrik Leppkes, Laurent Aimar, Steve Lhomme + d3d11va* Steve Lhomme mediacodec* Matthieu Bouron vaapi* Gwenole Beauchesne vaapi_encode* Mark Thompson @@ -276,7 +282,7 @@ libavdevice avfoundation.m Thilo Borgmann - decklink* Deti Fliegl + decklink* Marton Balint dshow.c Roger Pack (CC rogerdpack@gmail.com) fbdev_enc.c Lukasz Marek gdigrab.c Roger Pack (CC rogerdpack@gmail.com) @@ -285,7 +291,6 @@ libavdevice libdc1394.c Roman Shaposhnik opengl_enc.c Lukasz Marek pulse_audio_enc.c Lukasz Marek - qtkit.m Thilo Borgmann sdl Stefano Sabatini sdl2.c Josh de Kock v4l2.c Giorgio Vazzana @@ -324,6 +329,7 @@ Filters: avf_avectorscope.c Paul B Mahol avf_showcqt.c Muhammad Faiz vf_blend.c Paul B Mahol + vf_bwdif Thomas Mundt (CC ) vf_chromakey.c Timo Rothenpieler vf_colorchannelmixer.c Paul B Mahol vf_colorbalance.c Paul B Mahol @@ -339,6 +345,7 @@ Filters: vf_hqx.c Clément Bœsch vf_idet.c Pascal Massimino vf_il.c Paul B Mahol + vf_(t)interlace Thomas Mundt (CC ) vf_lenscorrection.c Daniel Oberhoff vf_mergeplanes.c Paul B Mahol vf_mestimate.c Davinder Singh @@ -384,23 +391,27 @@ Muxers/Demuxers: avisynth.c Stephen Hutchinson avr.c Paul B Mahol bink.c Peter Ross + boadec.c Michael Niedermayer brstm.c Paul B Mahol caf* Peter Ross cdxl.c Paul B Mahol crc.c Michael Niedermayer + dashdec.c Steven Liu daud.c Reimar Doeffinger dss.c Oleksij Rempel + dtsdec.c foo86 dtshddec.c Paul B Mahol dv.c Roman Shaposhnik electronicarts.c Peter Ross epafdec.c Paul B Mahol ffm* Baptiste Coudurier flic.c Mike Melanson - flvdec.c, flvenc.c Michael Niedermayer + flvdec.c Michael Niedermayer + flvenc.c Michael Niedermayer, Steven Liu gxf.c Reimar Doeffinger gxfenc.c Baptiste Coudurier hls.c Anssi Hannula - hls encryption (hlsenc.c) Christian Suloway, Steven Liu + hlsenc.c Christian Suloway, Steven Liu idcin.c Mike Melanson idroqdec.c Mike Melanson iff.c Jaikrishnan Menon @@ -410,7 +421,6 @@ Muxers/Demuxers: iss.c Stefan Gehrer jvdec.c Peter Ross libmodplug.c Clément Bœsch - libnut.c Oded Shimon libopenmpt.c Josh de Kock lmlm4.c Ivo van Poorten lvfdec.c Paul B Mahol @@ -433,7 +443,6 @@ Muxers/Demuxers: msnwc_tcp.c Ramiro Polla mtv.c Reynaldo H. Verdejo Pinochet mxf* Baptiste Coudurier - mxfdec.c Tomas Härdin nistspheredec.c Paul B Mahol nsvdec.c Francois Revol nut* Michael Niedermayer @@ -462,6 +471,7 @@ Muxers/Demuxers: rtpdec_vc2hq.*, rtpenc_vc2hq.* Thomas Volkert rtpdec_vp9.c Thomas Volkert rtpenc_mpv.*, rtpenc_aac.* Martin Storsjo + s337m.c foo86 sbgdec.c Nicolas George sdp.c Martin Storsjo segafilm.c Mike Melanson @@ -511,7 +521,7 @@ Operating systems / CPU architectures ===================================== Alpha Falk Hueffner -MIPS Nedeljko Babic +MIPS Manojkumar Bhosale Mac OS X / PowerPC Romain Dolbeau, Guillaume Poirier Amiga / PowerPC Colin Ward Windows MinGW Alex Beregszaszi, Ramiro Polla @@ -523,6 +533,33 @@ Sparc Roman Shaposhnik OS/2 KO Myung-Hun +Developers with git write access who are currently not maintaining any specific part +==================================================================================== +Alex Converse +Andreas Cadhalpun +Anuradha Suraparaju +Ben Littler +Benjamin Larsson +Bobby Bingham +Daniel Verkamp +Derek Buitenhuis +Ganesh Ajjanagadde +Henrik Gramner +Ivan Uskov +James Darnley +Jan Ekström +Joakim Plate +Kieran Kunhya +Kirill Gavrilov +Martin Storsjö +Panagiotis Issaris +Pedro Arthur +Sebastien Zwickert +Vittorio Giovara +wm4 +(this list is incomplete) + + Releases ======== @@ -565,6 +602,7 @@ Reynaldo H. Verdejo Pinochet 6E27 CD34 170C C78E 4D4F 5F40 C18E 077F 3114 452A Robert Swain EE7A 56EA 4A81 A7B5 2001 A521 67FA 362D A2FC 3E71 Sascha Sommer 38A0 F88B 868E 9D3A 97D4 D6A0 E823 706F 1E07 0D3C Stefano Sabatini 0D0B AD6B 5330 BBAD D3D6 6A0C 719C 2839 FC43 2D5F +Steinar H. Gunderson C2E9 004F F028 C18E 4EAD DB83 7F61 7561 7797 8F76 Stephan Hilb 4F38 0B3A 5F39 B99B F505 E562 8D5C 5554 4E17 8863 Tiancheng "Timothy" Gu 9456 AFC0 814A 8139 E994 8351 7FE6 B095 B582 B0D4 Tim Nicholson 38CF DB09 3ED0 F607 8B67 6CED 0C0B FC44 8B0B FC83 diff --git a/mythtv/external/FFmpeg/Makefile b/mythtv/external/FFmpeg/Makefile index 78636b43ffe..fc97b6b2ecd 100644 --- a/mythtv/external/FFmpeg/Makefile +++ b/mythtv/external/FFmpeg/Makefile @@ -1,52 +1,24 @@ -include config.mak +include ffbuild/config.mak SRC_PATH = ${SRC_PATH_BARE}/external/FFmpeg SRC_DIR = $(SRC_PATH) vpath %.c $(SRC_PATH) vpath %.cpp $(SRC_PATH) -vpath %.m $(SRC_PATH) vpath %.h $(SRC_PATH) +vpath %.inc $(SRC_PATH) +vpath %.m $(SRC_PATH) vpath %.S $(SRC_PATH) vpath %.asm $(SRC_PATH) vpath %.rc $(SRC_PATH) vpath %.v $(SRC_PATH) vpath %.texi $(SRC_PATH) +vpath %.cu $(SRC_PATH) +vpath %.ptx $(SRC_PATH) vpath %/fate_config.sh.template $(SRC_PATH) -AVPROGS-$(CONFIG_FFMPEG) += ffmpeg -AVPROGS-$(CONFIG_FFPLAY) += ffplay -AVPROGS-$(CONFIG_FFPROBE) += ffprobe -AVPROGS-$(CONFIG_FFSERVER) += ffserver - -AVPROGS := $(AVPROGS-yes:%=%$(PROGSSUF)$(EXESUF)) -INSTPROGS = $(AVPROGS-yes:%=%$(PROGSSUF)$(EXESUF)) -PROGS += $(AVPROGS) - -AVBASENAMES = ffmpeg ffplay ffprobe ffserver -ALLAVPROGS = $(AVBASENAMES:%=%$(PROGSSUF)$(EXESUF)) -ALLAVPROGS_G = $(AVBASENAMES:%=%$(PROGSSUF)_g$(EXESUF)) - -$(foreach prog,$(AVBASENAMES),$(eval OBJS-$(prog) += cmdutils.o)) -$(foreach prog,$(AVBASENAMES),$(eval OBJS-$(prog)-$(CONFIG_OPENCL) += cmdutils_opencl.o)) - -OBJS-ffmpeg += ffmpeg_opt.o ffmpeg_filter.o -OBJS-ffmpeg-$(CONFIG_VIDEOTOOLBOX) += ffmpeg_videotoolbox.o -OBJS-ffmpeg-$(CONFIG_LIBMFX) += ffmpeg_qsv.o -OBJS-ffmpeg-$(CONFIG_VAAPI) += ffmpeg_vaapi.o -ifndef CONFIG_VIDEOTOOLBOX -OBJS-ffmpeg-$(CONFIG_VDA) += ffmpeg_videotoolbox.o -endif -OBJS-ffmpeg-$(CONFIG_CUVID) += ffmpeg_cuvid.o -OBJS-ffmpeg-$(HAVE_DXVA2_LIB) += ffmpeg_dxva2.o -OBJS-ffmpeg-$(HAVE_VDPAU_X11) += ffmpeg_vdpau.o -OBJS-ffserver += ffserver_config.o - TESTTOOLS = audiogen videogen rotozoom tiny_psnr tiny_ssim base64 audiomatch HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options -TOOLS = qt-faststart trasher uncoded_frame -TOOLS-$(CONFIG_ZLIB) += cws2fws -MYTHPROGS = $(addprefix myth, ${PROGS}) # $(FFLIBS-yes) needs to be in linking order FFLIBS-$(CONFIG_AVDEVICE) += avdevice @@ -61,39 +33,46 @@ FFLIBS-$(CONFIG_SWSCALE) += swscale FFLIBS := avutil DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.ffpreset) $(SRC_PATH)/doc/ffprobe.xsd -EXAMPLES_FILES := $(wildcard $(SRC_PATH)/doc/examples/*.c) $(SRC_PATH)/doc/examples/Makefile $(SRC_PATH)/doc/examples/README -SKIPHEADERS = cmdutils_common_opts.h \ - compat/w32pthreads.h +SKIPHEADERS = compat/w32pthreads.h + +# first so "all" becomes default target +all: all-yes -include $(SRC_PATH)/common.mak +include $(SRC_PATH)/tools/Makefile +include $(SRC_PATH)/ffbuild/common.mak FF_EXTRALIBS := $(FFEXTRALIBS) FF_DEP_LIBS := $(DEP_LIBS) FF_STATIC_DEP_LIBS := $(STATIC_DEP_LIBS) -all: $(AVPROGS) - -$(TOOLS): %$(EXESUF): %.o $(EXEOBJS) +$(TOOLS): %$(EXESUF): %.o $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) +target_dec_%_fuzzer$(EXESUF): target_dec_%_fuzzer.o $(FF_DEP_LIBS) + $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH) + tools/cws2fws$(EXESUF): ELIBS = $(ZLIB) +tools/sofa2wavs$(EXESUF): ELIBS = $(FF_EXTRALIBS) tools/uncoded_frame$(EXESUF): $(FF_DEP_LIBS) tools/uncoded_frame$(EXESUF): ELIBS = $(FF_EXTRALIBS) +tools/target_dec_%_fuzzer$(EXESUF): $(FF_DEP_LIBS) -${MYTHPROGS}: myth%: % - $(CP) $< $@ +CONFIGURABLE_COMPONENTS = \ + $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c)) \ + $(SRC_PATH)/libavcodec/bitstream_filters.c \ + $(SRC_PATH)/libavformat/protocols.c \ -config.h: .config -.config: $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c)) +config.h: ffbuild/.config +ffbuild/.config: $(CONFIGURABLE_COMPONENTS) @-tput bold 2>/dev/null - @-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n' + @-printf '\nWARNING: $(?) newer than config.h, rerun configure\n\n' @-tput sgr0 2>/dev/null -SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS \ +SUBDIR_VARS := CLEANFILES FFLIBS HOSTPROGS TESTPROGS TOOLS \ HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \ ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \ - ALTIVEC-OBJS MMX-OBJS YASM-OBJS \ + ALTIVEC-OBJS VSX-OBJS MMX-OBJS X86ASM-OBJS \ MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSP-OBJS MSA-OBJS \ MMI-OBJS OBJS SLIBOBJS HOSTOBJS TESTOBJS @@ -108,41 +87,33 @@ SUBDIR := $(1)/ include $(SRC_PATH_BARE)/external/FFmpeg/$(1)/Makefile -include $(SRC_PATH_BARE)/external/FFmpeg/$(1)/$(ARCH)/Makefile -include $(SRC_PATH_BARE)/external/FFmpeg/$(1)/$(INTRINSICS)/Makefile -include $(SRC_PATH_BARE)/external/FFmpeg/library.mak +include $(SRC_PATH_BARE)/external/FFmpeg/ffbuild/library.mak + endef $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D)))) +include $(SRC_PATH)/fftools/Makefile include $(SRC_PATH)/doc/Makefile +include $(SRC_PATH)/doc/examples/Makefile -define DOPROG -OBJS-$(1) += $(1).o $(EXEOBJS) $(OBJS-$(1)-yes) -$(1)$(PROGSSUF)_g$(EXESUF): $$(OBJS-$(1)) -$$(OBJS-$(1)): CFLAGS += $(CFLAGS-$(1)) -$(1)$(PROGSSUF)_g$(EXESUF): LDFLAGS += $(LDFLAGS-$(1)) -$(1)$(PROGSSUF)_g$(EXESUF): FF_EXTRALIBS += $(LIBS-$(1)) --include $$(OBJS-$(1):.o=.d) -endef - -$(foreach P,$(PROGS),$(eval $(call DOPROG,$(P:$(PROGSSUF)$(EXESUF)=)))) - -ffprobe.o cmdutils.o libavcodec/utils.o libavformat/utils.o libavdevice/avdevice.o libavfilter/avfilter.o libavutil/utils.o libpostproc/postprocess.o libswresample/swresample.o libswscale/utils.o : libavutil/ffversion.h +libavcodec/utils.o libavformat/utils.o libavdevice/avdevice.o libavfilter/avfilter.o libavutil/utils.o libpostproc/postprocess.o libswresample/swresample.o libswscale/utils.o : libavutil/ffversion.h $(PROGS): %$(PROGSSUF)$(EXESUF): %$(PROGSSUF)_g$(EXESUF) +ifeq ($(STRIPTYPE),direct) + $(STRIP) -o $@ $< +else $(CP) $< $@ $(STRIP) $@ +endif -%$(PROGSSUF)_g$(EXESUF): %.o $(FF_DEP_LIBS) +%$(PROGSSUF)_g$(EXESUF): $(FF_DEP_LIBS) $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS) -OBJDIRS += tools - --include $(wildcard tools/*.d) - -VERSION_SH = $(SRC_PATH_BARE)/external/FFmpeg/version.sh +VERSION_SH = $(SRC_PATH_BARE)/external/FFmpeg/ffbuild/version.sh GIT_LOG = $(SRC_PATH_BARE)/.git/logs/HEAD -.version: $(wildcard $(GIT_LOG)) $(VERSION_SH) config.mak +.version: $(wildcard $(GIT_LOG)) $(VERSION_SH) ffbuild/config.mak .version: M=@ libavutil/ffversion.h .version: @@ -152,48 +123,33 @@ libavutil/ffversion.h .version: # force version.sh to run whenever version might have changed -include .version -ifdef AVPROGS -install: install-mythprogs -endif - install: install-libs install-headers install-libs: install-libs-yes -install-progs-yes: -install-progs-$(CONFIG_SHARED): install-libs - -install-progs: install-progs-yes $(AVPROGS) - $(Q)mkdir -p "$(BINDIR)" - $(INSTALL) -c -m 755 $(INSTPROGS) "$(BINDIR)" - -install-mythprogs: install-progs-yes $(MYTHPROGS) - $(Q)mkdir -p "$(BINDIR)" - $(INSTALL) -c -m 755 $(MYTHPROGS) "$(BINDIR)" - -install-data: $(DATA_FILES) $(EXAMPLES_FILES) - $(Q)mkdir -p "$(DATADIR)/examples" +install-data: $(DATA_FILES) + $(Q)mkdir -p "$(DATADIR)" $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)" - $(INSTALL) -m 644 $(EXAMPLES_FILES) "$(DATADIR)/examples" - -uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data -uninstall-progs: - $(RM) $(addprefix "$(BINDIR)/", $(ALLAVPROGS)) +uninstall: uninstall-libs uninstall-headers uninstall-data uninstall-data: $(RM) -r "$(DATADIR)" clean:: - $(RM) $(ALLAVPROGS) $(ALLAVPROGS_G) $(RM) $(CLEANSUFFIXES) - $(RM) $(CLEANSUFFIXES:%=tools/%) + $(RM) $(CLEANSUFFIXES:%=compat/msvcrt/%) + $(RM) $(CLEANSUFFIXES:%=compat/atomics/pthread/%) + $(RM) $(CLEANSUFFIXES:%=compat/%) $(RM) -r coverage-html $(RM) -rf coverage.info coverage.info.in lcov distclean:: $(RM) $(DISTCLEANSUFFIXES) - $(RM) config.* .config libavutil/avconfig.h .version mapfile avversion.h version.h libavutil/ffversion.h libavcodec/codec_names.h libavcodec/bsf_list.c libavformat/protocol_list.c + $(RM) .version avversion.h config.asm config.h mapfile \ + ffbuild/.config ffbuild/config.* libavutil/avconfig.h \ + version.h libavutil/ffversion.h libavcodec/codec_names.h \ + libavcodec/bsf_list.c libavformat/protocol_list.c ifeq ($(SRC_LINK),src) $(RM) src endif @@ -217,5 +173,4 @@ $(sort $(OBJDIRS)): # so this saves some time on slow systems. .SUFFIXES: -.PHONY: all all-yes alltools check *clean config install* -.PHONY: testprogs uninstall* +.PHONY: all all-yes alltools check *clean config install* testprogs uninstall* diff --git a/mythtv/external/FFmpeg/RELEASE b/mythtv/external/FFmpeg/RELEASE index a3ec5a4bd3d..47b322c971c 100644 --- a/mythtv/external/FFmpeg/RELEASE +++ b/mythtv/external/FFmpeg/RELEASE @@ -1 +1 @@ -3.2 +3.4.1 diff --git a/mythtv/external/FFmpeg/RELEASE_NOTES b/mythtv/external/FFmpeg/RELEASE_NOTES index c3ec010069e..d649c77bd52 100644 --- a/mythtv/external/FFmpeg/RELEASE_NOTES +++ b/mythtv/external/FFmpeg/RELEASE_NOTES @@ -1,10 +1,10 @@ - ┌────────────────────────────────────────┐ - │ RELEASE NOTES for FFmpeg 3.2 "Hypatia" │ - └────────────────────────────────────────┘ + ┌───────────────────────────────────────┐ + │ RELEASE NOTES for FFmpeg 3.4 "Cantor" │ + └───────────────────────────────────────┘ - The FFmpeg Project proudly presents FFmpeg 3.2 "Hypatia", about 4 - months after the release of FFmpeg 3.1. + The FFmpeg Project proudly presents FFmpeg 3.4 "Cantor", about 6 + months after the release of FFmpeg 3.3. A complete Changelog is available at the root of the project, and the complete Git history on http://source.ffmpeg.org. diff --git a/mythtv/external/FFmpeg/compat/atomics/dummy/stdatomic.h b/mythtv/external/FFmpeg/compat/atomics/dummy/stdatomic.h new file mode 100644 index 00000000000..59d85f915d6 --- /dev/null +++ b/mythtv/external/FFmpeg/compat/atomics/dummy/stdatomic.h @@ -0,0 +1,176 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * based on vlc_atomic.h from VLC + * Copyright (C) 2010 Rémi Denis-Courmont + */ + +#ifndef COMPAT_ATOMICS_DUMMY_STDATOMIC_H +#define COMPAT_ATOMICS_DUMMY_STDATOMIC_H + +#include + +#define ATOMIC_FLAG_INIT 0 + +#define ATOMIC_VAR_INIT(value) (value) + +#define atomic_init(obj, value) \ +do { \ + *(obj) = (value); \ +} while(0) + +#define kill_dependency(y) ((void)0) + +#define atomic_thread_fence(order) \ + ((void)0) + +#define atomic_signal_fence(order) \ + ((void)0) + +#define atomic_is_lock_free(obj) 0 + +typedef intptr_t atomic_flag; +typedef intptr_t atomic_bool; +typedef intptr_t atomic_char; +typedef intptr_t atomic_schar; +typedef intptr_t atomic_uchar; +typedef intptr_t atomic_short; +typedef intptr_t atomic_ushort; +typedef intptr_t atomic_int; +typedef intptr_t atomic_uint; +typedef intptr_t atomic_long; +typedef intptr_t atomic_ulong; +typedef intptr_t atomic_llong; +typedef intptr_t atomic_ullong; +typedef intptr_t atomic_wchar_t; +typedef intptr_t atomic_int_least8_t; +typedef intptr_t atomic_uint_least8_t; +typedef intptr_t atomic_int_least16_t; +typedef intptr_t atomic_uint_least16_t; +typedef intptr_t atomic_int_least32_t; +typedef intptr_t atomic_uint_least32_t; +typedef intptr_t atomic_int_least64_t; +typedef intptr_t atomic_uint_least64_t; +typedef intptr_t atomic_int_fast8_t; +typedef intptr_t atomic_uint_fast8_t; +typedef intptr_t atomic_int_fast16_t; +typedef intptr_t atomic_uint_fast16_t; +typedef intptr_t atomic_int_fast32_t; +typedef intptr_t atomic_uint_fast32_t; +typedef intptr_t atomic_int_fast64_t; +typedef intptr_t atomic_uint_fast64_t; +typedef intptr_t atomic_intptr_t; +typedef intptr_t atomic_uintptr_t; +typedef intptr_t atomic_size_t; +typedef intptr_t atomic_ptrdiff_t; +typedef intptr_t atomic_intmax_t; +typedef intptr_t atomic_uintmax_t; + +#define atomic_store(object, desired) \ +do { \ + *(object) = (desired); \ +} while (0) + +#define atomic_store_explicit(object, desired, order) \ + atomic_store(object, desired) + +#define atomic_load(object) \ + (*(object)) + +#define atomic_load_explicit(object, order) \ + atomic_load(object) + +static inline intptr_t atomic_exchange(intptr_t *object, intptr_t desired) +{ + intptr_t ret = *object; + *object = desired; + return ret; +} + +#define atomic_exchange_explicit(object, desired, order) \ + atomic_exchange(object, desired) + +static inline int atomic_compare_exchange_strong(intptr_t *object, intptr_t *expected, + intptr_t desired) +{ + int ret; + if (*object == *expected) { + *object = desired; + ret = 1; + } else { + *expected = *object; + ret = 0; + } + return ret; +} + +#define atomic_compare_exchange_strong_explicit(object, expected, desired, success, failure) \ + atomic_compare_exchange_strong(object, expected, desired) + +#define atomic_compare_exchange_weak(object, expected, desired) \ + atomic_compare_exchange_strong(object, expected, desired) + +#define atomic_compare_exchange_weak_explicit(object, expected, desired, success, failure) \ + atomic_compare_exchange_weak(object, expected, desired) + +#define FETCH_MODIFY(opname, op) \ +static inline intptr_t atomic_fetch_ ## opname(intptr_t *object, intptr_t operand) \ +{ \ + intptr_t ret; \ + ret = *object; \ + *object = *object op operand; \ + return ret; \ +} + +FETCH_MODIFY(add, +) +FETCH_MODIFY(sub, -) +FETCH_MODIFY(or, |) +FETCH_MODIFY(xor, ^) +FETCH_MODIFY(and, &) + +#undef FETCH_MODIFY + +#define atomic_fetch_add_explicit(object, operand, order) \ + atomic_fetch_add(object, operand) + +#define atomic_fetch_sub_explicit(object, operand, order) \ + atomic_fetch_sub(object, operand) + +#define atomic_fetch_or_explicit(object, operand, order) \ + atomic_fetch_or(object, operand) + +#define atomic_fetch_xor_explicit(object, operand, order) \ + atomic_fetch_xor(object, operand) + +#define atomic_fetch_and_explicit(object, operand, order) \ + atomic_fetch_and(object, operand) + +#define atomic_flag_test_and_set(object) \ + atomic_exchange(object, 1) + +#define atomic_flag_test_and_set_explicit(object, order) \ + atomic_flag_test_and_set(object) + +#define atomic_flag_clear(object) \ + atomic_store(object, 0) + +#define atomic_flag_clear_explicit(object, order) \ + atomic_flag_clear(object) + +#endif /* COMPAT_ATOMICS_DUMMY_STDATOMIC_H */ diff --git a/mythtv/external/FFmpeg/compat/atomics/gcc/stdatomic.h b/mythtv/external/FFmpeg/compat/atomics/gcc/stdatomic.h new file mode 100644 index 00000000000..e13ed0e068b --- /dev/null +++ b/mythtv/external/FFmpeg/compat/atomics/gcc/stdatomic.h @@ -0,0 +1,173 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * based on vlc_atomic.h from VLC + * Copyright (C) 2010 Rémi Denis-Courmont + */ + +#ifndef COMPAT_ATOMICS_GCC_STDATOMIC_H +#define COMPAT_ATOMICS_GCC_STDATOMIC_H + +#include +#include + +#define ATOMIC_FLAG_INIT 0 + +#define ATOMIC_VAR_INIT(value) (value) + +#define atomic_init(obj, value) \ +do { \ + *(obj) = (value); \ +} while(0) + +#define kill_dependency(y) ((void)0) + +#define atomic_thread_fence(order) \ + __sync_synchronize() + +#define atomic_signal_fence(order) \ + ((void)0) + +#define atomic_is_lock_free(obj) 0 + +typedef _Bool atomic_flag; +typedef _Bool atomic_bool; +typedef char atomic_char; +typedef signed char atomic_schar; +typedef unsigned char atomic_uchar; +typedef short atomic_short; +typedef unsigned short atomic_ushort; +typedef int atomic_int; +typedef unsigned int atomic_uint; +typedef long atomic_long; +typedef unsigned long atomic_ulong; +typedef long long atomic_llong; +typedef unsigned long long atomic_ullong; +typedef wchar_t atomic_wchar_t; +typedef int_least8_t atomic_int_least8_t; +typedef uint_least8_t atomic_uint_least8_t; +typedef int_least16_t atomic_int_least16_t; +typedef uint_least16_t atomic_uint_least16_t; +typedef int_least32_t atomic_int_least32_t; +typedef uint_least32_t atomic_uint_least32_t; +typedef int_least64_t atomic_int_least64_t; +typedef uint_least64_t atomic_uint_least64_t; +typedef int_fast8_t atomic_int_fast8_t; +typedef uint_fast8_t atomic_uint_fast8_t; +typedef int_fast16_t atomic_int_fast16_t; +typedef uint_fast16_t atomic_uint_fast16_t; +typedef int_fast32_t atomic_int_fast32_t; +typedef uint_fast32_t atomic_uint_fast32_t; +typedef int_fast64_t atomic_int_fast64_t; +typedef uint_fast64_t atomic_uint_fast64_t; +typedef intptr_t atomic_intptr_t; +typedef uintptr_t atomic_uintptr_t; +typedef size_t atomic_size_t; +typedef ptrdiff_t atomic_ptrdiff_t; +typedef intmax_t atomic_intmax_t; +typedef uintmax_t atomic_uintmax_t; + +#define atomic_store(object, desired) \ +do { \ + *(object) = (desired); \ + __sync_synchronize(); \ +} while (0) + +#define atomic_store_explicit(object, desired, order) \ + atomic_store(object, desired) + +#define atomic_load(object) \ + (__sync_synchronize(), *(object)) + +#define atomic_load_explicit(object, order) \ + atomic_load(object) + +#define atomic_exchange(object, desired) \ +({ \ + __typeof__(object) _obj = (object); \ + __typeof__(*object) _old; \ + do \ + _old = atomic_load(_obj); \ + while (!__sync_bool_compare_and_swap(_obj, _old, (desired))); \ + _old; \ +}) + +#define atomic_exchange_explicit(object, desired, order) \ + atomic_exchange(object, desired) + +#define atomic_compare_exchange_strong(object, expected, desired) \ +({ \ + __typeof__(object) _exp = (expected); \ + __typeof__(*object) _old = *_exp; \ + *_exp = __sync_val_compare_and_swap((object), _old, (desired)); \ + *_exp == _old; \ +}) + +#define atomic_compare_exchange_strong_explicit(object, expected, desired, success, failure) \ + atomic_compare_exchange_strong(object, expected, desired) + +#define atomic_compare_exchange_weak(object, expected, desired) \ + atomic_compare_exchange_strong(object, expected, desired) + +#define atomic_compare_exchange_weak_explicit(object, expected, desired, success, failure) \ + atomic_compare_exchange_weak(object, expected, desired) + +#define atomic_fetch_add(object, operand) \ + __sync_fetch_and_add(object, operand) + +#define atomic_fetch_add_explicit(object, operand, order) \ + atomic_fetch_add(object, operand) + +#define atomic_fetch_sub(object, operand) \ + __sync_fetch_and_sub(object, operand) + +#define atomic_fetch_sub_explicit(object, operand, order) \ + atomic_fetch_sub(object, operand) + +#define atomic_fetch_or(object, operand) \ + __sync_fetch_and_or(object, operand) + +#define atomic_fetch_or_explicit(object, operand, order) \ + atomic_fetch_or(object, operand) + +#define atomic_fetch_xor(object, operand) \ + __sync_fetch_and_xor(object, operand) + +#define atomic_fetch_xor_explicit(object, operand, order) \ + atomic_fetch_xor(object, operand) + +#define atomic_fetch_and(object, operand) \ + __sync_fetch_and_and(object, operand) + +#define atomic_fetch_and_explicit(object, operand, order) \ + atomic_fetch_and(object, operand) + +#define atomic_flag_test_and_set(object) \ + atomic_exchange(object, 1) + +#define atomic_flag_test_and_set_explicit(object, order) \ + atomic_flag_test_and_set(object) + +#define atomic_flag_clear(object) \ + atomic_store(object, 0) + +#define atomic_flag_clear_explicit(object, order) \ + atomic_flag_clear(object) + +#endif /* COMPAT_ATOMICS_GCC_STDATOMIC_H */ diff --git a/mythtv/external/FFmpeg/compat/atomics/pthread/stdatomic.c b/mythtv/external/FFmpeg/compat/atomics/pthread/stdatomic.c new file mode 100644 index 00000000000..9fca98980b9 --- /dev/null +++ b/mythtv/external/FFmpeg/compat/atomics/pthread/stdatomic.c @@ -0,0 +1,39 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * based on vlc_atomic.h from VLC + * Copyright (C) 2010 Rémi Denis-Courmont + */ + +#include +#include + +#include "stdatomic.h" + +static pthread_mutex_t atomic_lock = PTHREAD_MUTEX_INITIALIZER; + +void avpriv_atomic_lock(void) +{ + pthread_mutex_lock(&atomic_lock); +} + +void avpriv_atomic_unlock(void) +{ + pthread_mutex_unlock(&atomic_lock); +} diff --git a/mythtv/external/FFmpeg/compat/atomics/pthread/stdatomic.h b/mythtv/external/FFmpeg/compat/atomics/pthread/stdatomic.h new file mode 100644 index 00000000000..81a60f102bb --- /dev/null +++ b/mythtv/external/FFmpeg/compat/atomics/pthread/stdatomic.h @@ -0,0 +1,197 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * based on vlc_atomic.h from VLC + * Copyright (C) 2010 Rémi Denis-Courmont + */ + +#ifndef COMPAT_ATOMICS_PTHREAD_STDATOMIC_H +#define COMPAT_ATOMICS_PTHREAD_STDATOMIC_H + +#include + +#define ATOMIC_FLAG_INIT 0 + +#define ATOMIC_VAR_INIT(value) (value) + +#define atomic_init(obj, value) \ +do { \ + *(obj) = (value); \ +} while(0) + +#define kill_dependency(y) ((void)0) + +#define atomic_signal_fence(order) \ + ((void)0) + +#define atomic_is_lock_free(obj) 0 + +typedef intptr_t atomic_flag; +typedef intptr_t atomic_bool; +typedef intptr_t atomic_char; +typedef intptr_t atomic_schar; +typedef intptr_t atomic_uchar; +typedef intptr_t atomic_short; +typedef intptr_t atomic_ushort; +typedef intptr_t atomic_int; +typedef intptr_t atomic_uint; +typedef intptr_t atomic_long; +typedef intptr_t atomic_ulong; +typedef intptr_t atomic_llong; +typedef intptr_t atomic_ullong; +typedef intptr_t atomic_wchar_t; +typedef intptr_t atomic_int_least8_t; +typedef intptr_t atomic_uint_least8_t; +typedef intptr_t atomic_int_least16_t; +typedef intptr_t atomic_uint_least16_t; +typedef intptr_t atomic_int_least32_t; +typedef intptr_t atomic_uint_least32_t; +typedef intptr_t atomic_int_least64_t; +typedef intptr_t atomic_uint_least64_t; +typedef intptr_t atomic_int_fast8_t; +typedef intptr_t atomic_uint_fast8_t; +typedef intptr_t atomic_int_fast16_t; +typedef intptr_t atomic_uint_fast16_t; +typedef intptr_t atomic_int_fast32_t; +typedef intptr_t atomic_uint_fast32_t; +typedef intptr_t atomic_int_fast64_t; +typedef intptr_t atomic_uint_fast64_t; +typedef intptr_t atomic_intptr_t; +typedef intptr_t atomic_uintptr_t; +typedef intptr_t atomic_size_t; +typedef intptr_t atomic_ptrdiff_t; +typedef intptr_t atomic_intmax_t; +typedef intptr_t atomic_uintmax_t; + +void avpriv_atomic_lock(void); +void avpriv_atomic_unlock(void); + +static inline void atomic_thread_fence(int order) +{ + avpriv_atomic_lock(); + avpriv_atomic_unlock(); +} + +static inline void atomic_store(intptr_t *object, intptr_t desired) +{ + avpriv_atomic_lock(); + *object = desired; + avpriv_atomic_unlock(); +} + +#define atomic_store_explicit(object, desired, order) \ + atomic_store(object, desired) + +static inline intptr_t atomic_load(intptr_t *object) +{ + intptr_t ret; + avpriv_atomic_lock(); + ret = *object; + avpriv_atomic_unlock(); + return ret; +} + +#define atomic_load_explicit(object, order) \ + atomic_load(object) + +static inline intptr_t atomic_exchange(intptr_t *object, intptr_t desired) +{ + intptr_t ret; + avpriv_atomic_lock(); + ret = *object; + *object = desired; + avpriv_atomic_unlock(); + return ret; +} + +#define atomic_exchange_explicit(object, desired, order) \ + atomic_exchange(object, desired) + +static inline int atomic_compare_exchange_strong(intptr_t *object, intptr_t *expected, + intptr_t desired) +{ + int ret; + avpriv_atomic_lock(); + if (*object == *expected) { + ret = 1; + *object = desired; + } else { + ret = 0; + *expected = *object; + } + avpriv_atomic_unlock(); + return ret; +} + +#define atomic_compare_exchange_strong_explicit(object, expected, desired, success, failure) \ + atomic_compare_exchange_strong(object, expected, desired) + +#define atomic_compare_exchange_weak(object, expected, desired) \ + atomic_compare_exchange_strong(object, expected, desired) + +#define atomic_compare_exchange_weak_explicit(object, expected, desired, success, failure) \ + atomic_compare_exchange_weak(object, expected, desired) + +#define FETCH_MODIFY(opname, op) \ +static inline intptr_t atomic_fetch_ ## opname(intptr_t *object, intptr_t operand) \ +{ \ + intptr_t ret; \ + avpriv_atomic_lock(); \ + ret = *object; \ + *object = *object op operand; \ + avpriv_atomic_unlock(); \ + return ret; \ +} + +FETCH_MODIFY(add, +) +FETCH_MODIFY(sub, -) +FETCH_MODIFY(or, |) +FETCH_MODIFY(xor, ^) +FETCH_MODIFY(and, &) + +#undef FETCH_MODIFY + +#define atomic_fetch_add_explicit(object, operand, order) \ + atomic_fetch_add(object, operand) + +#define atomic_fetch_sub_explicit(object, operand, order) \ + atomic_fetch_sub(object, operand) + +#define atomic_fetch_or_explicit(object, operand, order) \ + atomic_fetch_or(object, operand) + +#define atomic_fetch_xor_explicit(object, operand, order) \ + atomic_fetch_xor(object, operand) + +#define atomic_fetch_and_explicit(object, operand, order) \ + atomic_fetch_and(object, operand) + +#define atomic_flag_test_and_set(object) \ + atomic_exchange(object, 1) + +#define atomic_flag_test_and_set_explicit(object, order) \ + atomic_flag_test_and_set(object) + +#define atomic_flag_clear(object) \ + atomic_store(object, 0) + +#define atomic_flag_clear_explicit(object, order) \ + atomic_flag_clear(object) + +#endif /* COMPAT_ATOMICS_PTHREAD_STDATOMIC_H */ diff --git a/mythtv/external/FFmpeg/compat/atomics/suncc/stdatomic.h b/mythtv/external/FFmpeg/compat/atomics/suncc/stdatomic.h new file mode 100644 index 00000000000..0cf89e0f78d --- /dev/null +++ b/mythtv/external/FFmpeg/compat/atomics/suncc/stdatomic.h @@ -0,0 +1,186 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef COMPAT_ATOMICS_SUNCC_STDATOMIC_H +#define COMPAT_ATOMICS_SUNCC_STDATOMIC_H + +#include +#include +#include +#include + +#define ATOMIC_FLAG_INIT 0 + +#define ATOMIC_VAR_INIT(value) (value) + +#define atomic_init(obj, value) \ +do { \ + *(obj) = (value); \ +} while(0) + +#define kill_dependency(y) ((void)0) + +#define atomic_thread_fence(order) \ + __machine_rw_barrier(); + +#define atomic_signal_fence(order) \ + ((void)0) + +#define atomic_is_lock_free(obj) 0 + +typedef intptr_t atomic_flag; +typedef intptr_t atomic_bool; +typedef intptr_t atomic_char; +typedef intptr_t atomic_schar; +typedef intptr_t atomic_uchar; +typedef intptr_t atomic_short; +typedef intptr_t atomic_ushort; +typedef intptr_t atomic_int; +typedef intptr_t atomic_uint; +typedef intptr_t atomic_long; +typedef intptr_t atomic_ulong; +typedef intptr_t atomic_llong; +typedef intptr_t atomic_ullong; +typedef intptr_t atomic_wchar_t; +typedef intptr_t atomic_int_least8_t; +typedef intptr_t atomic_uint_least8_t; +typedef intptr_t atomic_int_least16_t; +typedef intptr_t atomic_uint_least16_t; +typedef intptr_t atomic_int_least32_t; +typedef intptr_t atomic_uint_least32_t; +typedef intptr_t atomic_int_least64_t; +typedef intptr_t atomic_uint_least64_t; +typedef intptr_t atomic_int_fast8_t; +typedef intptr_t atomic_uint_fast8_t; +typedef intptr_t atomic_int_fast16_t; +typedef intptr_t atomic_uint_fast16_t; +typedef intptr_t atomic_int_fast32_t; +typedef intptr_t atomic_uint_fast32_t; +typedef intptr_t atomic_int_fast64_t; +typedef intptr_t atomic_uint_fast64_t; +typedef intptr_t atomic_intptr_t; +typedef intptr_t atomic_uintptr_t; +typedef intptr_t atomic_size_t; +typedef intptr_t atomic_ptrdiff_t; +typedef intptr_t atomic_intmax_t; +typedef intptr_t atomic_uintmax_t; + +static inline void atomic_store(intptr_t *object, intptr_t desired) +{ + *object = desired; + __machine_rw_barrier(); +} + +#define atomic_store_explicit(object, desired, order) \ + atomic_store(object, desired) + +static inline intptr_t atomic_load(intptr_t *object) +{ + __machine_rw_barrier(); + return *object; +} + +#define atomic_load_explicit(object, order) \ + atomic_load(object) + +#define atomic_exchange(object, desired) \ + atomic_swap_ptr(object, desired) + +#define atomic_exchange_explicit(object, desired, order) \ + atomic_exchange(object, desired) + +static inline int atomic_compare_exchange_strong(intptr_t *object, intptr_t *expected, + intptr_t desired) +{ + intptr_t old = *expected; + *expected = (intptr_t)atomic_cas_ptr(object, (void *)old, (void *)desired); + return *expected == old; +} + +#define atomic_compare_exchange_strong_explicit(object, expected, desired, success, failure) \ + atomic_compare_exchange_strong(object, expected, desired) + +#define atomic_compare_exchange_weak(object, expected, desired) \ + atomic_compare_exchange_strong(object, expected, desired) + +#define atomic_compare_exchange_weak_explicit(object, expected, desired, success, failure) \ + atomic_compare_exchange_weak(object, expected, desired) + +static inline intptr_t atomic_fetch_add(intptr_t *object, intptr_t operand) +{ + return atomic_add_ptr_nv(object, operand) - operand; +} + +#define atomic_fetch_sub(object, operand) \ + atomic_fetch_add(object, -(operand)) + +static inline intptr_t atomic_fetch_or(intptr_t *object, intptr_t operand) +{ + intptr_t old; + do { + old = atomic_load(object); + } while (!atomic_compare_exchange_strong(object, old, old | operand)); + return old; +} + +static inline intptr_t atomic_fetch_xor(intptr_t *object, intptr_t operand) +{ + intptr_t old; + do { + old = atomic_load(object); + } while (!atomic_compare_exchange_strong(object, old, old ^ operand)); + return old; +} + +static inline intptr_t atomic_fetch_and(intptr_t *object, intptr_t operand) +{ + intptr_t old; + do { + old = atomic_load(object); + } while (!atomic_compare_exchange_strong(object, old, old & operand)); + return old; +} + +#define atomic_fetch_add_explicit(object, operand, order) \ + atomic_fetch_add(object, operand) + +#define atomic_fetch_sub_explicit(object, operand, order) \ + atomic_fetch_sub(object, operand) + +#define atomic_fetch_or_explicit(object, operand, order) \ + atomic_fetch_or(object, operand) + +#define atomic_fetch_xor_explicit(object, operand, order) \ + atomic_fetch_xor(object, operand) + +#define atomic_fetch_and_explicit(object, operand, order) \ + atomic_fetch_and(object, operand) + +#define atomic_flag_test_and_set(object) \ + atomic_exchange(object, 1) + +#define atomic_flag_test_and_set_explicit(object, order) \ + atomic_flag_test_and_set(object) + +#define atomic_flag_clear(object) \ + atomic_store(object, 0) + +#define atomic_flag_clear_explicit(object, order) \ + atomic_flag_clear(object) + +#endif /* COMPAT_ATOMICS_SUNCC_STDATOMIC_H */ diff --git a/mythtv/external/FFmpeg/compat/atomics/win32/stdatomic.h b/mythtv/external/FFmpeg/compat/atomics/win32/stdatomic.h new file mode 100644 index 00000000000..bb8e6e7e15a --- /dev/null +++ b/mythtv/external/FFmpeg/compat/atomics/win32/stdatomic.h @@ -0,0 +1,181 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef COMPAT_ATOMICS_WIN32_STDATOMIC_H +#define COMPAT_ATOMICS_WIN32_STDATOMIC_H + +#define WIN32_LEAN_AND_MEAN +#include +#include +#include + +#define ATOMIC_FLAG_INIT 0 + +#define ATOMIC_VAR_INIT(value) (value) + +#define atomic_init(obj, value) \ +do { \ + *(obj) = (value); \ +} while(0) + +#define kill_dependency(y) ((void)0) + +#define atomic_thread_fence(order) \ + MemoryBarrier(); + +#define atomic_signal_fence(order) \ + ((void)0) + +#define atomic_is_lock_free(obj) 0 + +typedef intptr_t atomic_flag; +typedef intptr_t atomic_bool; +typedef intptr_t atomic_char; +typedef intptr_t atomic_schar; +typedef intptr_t atomic_uchar; +typedef intptr_t atomic_short; +typedef intptr_t atomic_ushort; +typedef intptr_t atomic_int; +typedef intptr_t atomic_uint; +typedef intptr_t atomic_long; +typedef intptr_t atomic_ulong; +typedef intptr_t atomic_llong; +typedef intptr_t atomic_ullong; +typedef intptr_t atomic_wchar_t; +typedef intptr_t atomic_int_least8_t; +typedef intptr_t atomic_uint_least8_t; +typedef intptr_t atomic_int_least16_t; +typedef intptr_t atomic_uint_least16_t; +typedef intptr_t atomic_int_least32_t; +typedef intptr_t atomic_uint_least32_t; +typedef intptr_t atomic_int_least64_t; +typedef intptr_t atomic_uint_least64_t; +typedef intptr_t atomic_int_fast8_t; +typedef intptr_t atomic_uint_fast8_t; +typedef intptr_t atomic_int_fast16_t; +typedef intptr_t atomic_uint_fast16_t; +typedef intptr_t atomic_int_fast32_t; +typedef intptr_t atomic_uint_fast32_t; +typedef intptr_t atomic_int_fast64_t; +typedef intptr_t atomic_uint_fast64_t; +typedef intptr_t atomic_intptr_t; +typedef intptr_t atomic_uintptr_t; +typedef intptr_t atomic_size_t; +typedef intptr_t atomic_ptrdiff_t; +typedef intptr_t atomic_intmax_t; +typedef intptr_t atomic_uintmax_t; + +#define atomic_store(object, desired) \ +do { \ + *(object) = (desired); \ + MemoryBarrier(); \ +} while (0) + +#define atomic_store_explicit(object, desired, order) \ + atomic_store(object, desired) + +#define atomic_load(object) \ + (MemoryBarrier(), *(object)) + +#define atomic_load_explicit(object, order) \ + atomic_load(object) + +#define atomic_exchange(object, desired) \ + InterlockedExchangePointer(object, desired); + +#define atomic_exchange_explicit(object, desired, order) \ + atomic_exchange(object, desired) + +static inline int atomic_compare_exchange_strong(intptr_t *object, intptr_t *expected, + intptr_t desired) +{ + intptr_t old = *expected; + *expected = (intptr_t)InterlockedCompareExchangePointer( + (PVOID *)object, (PVOID)desired, (PVOID)old); + return *expected == old; +} + +#define atomic_compare_exchange_strong_explicit(object, expected, desired, success, failure) \ + atomic_compare_exchange_strong(object, expected, desired) + +#define atomic_compare_exchange_weak(object, expected, desired) \ + atomic_compare_exchange_strong(object, expected, desired) + +#define atomic_compare_exchange_weak_explicit(object, expected, desired, success, failure) \ + atomic_compare_exchange_weak(object, expected, desired) + +#ifdef _WIN64 +#define atomic_fetch_add(object, operand) \ + InterlockedExchangeAdd64(object, operand) + +#define atomic_fetch_sub(object, operand) \ + InterlockedExchangeAdd64(object, -(operand)) + +#define atomic_fetch_or(object, operand) \ + InterlockedOr64(object, operand) + +#define atomic_fetch_xor(object, operand) \ + InterlockedXor64(object, operand) + +#define atomic_fetch_and(object, operand) \ + InterlockedAnd64(object, operand) +#else +#define atomic_fetch_add(object, operand) \ + InterlockedExchangeAdd(object, operand) + +#define atomic_fetch_sub(object, operand) \ + InterlockedExchangeAdd(object, -(operand)) + +#define atomic_fetch_or(object, operand) \ + InterlockedOr(object, operand) + +#define atomic_fetch_xor(object, operand) \ + InterlockedXor(object, operand) + +#define atomic_fetch_and(object, operand) \ + InterlockedAnd(object, operand) +#endif /* _WIN64 */ + +#define atomic_fetch_add_explicit(object, operand, order) \ + atomic_fetch_add(object, operand) + +#define atomic_fetch_sub_explicit(object, operand, order) \ + atomic_fetch_sub(object, operand) + +#define atomic_fetch_or_explicit(object, operand, order) \ + atomic_fetch_or(object, operand) + +#define atomic_fetch_xor_explicit(object, operand, order) \ + atomic_fetch_xor(object, operand) + +#define atomic_fetch_and_explicit(object, operand, order) \ + atomic_fetch_and(object, operand) + +#define atomic_flag_test_and_set(object) \ + atomic_exchange(object, 1) + +#define atomic_flag_test_and_set_explicit(object, order) \ + atomic_flag_test_and_set(object) + +#define atomic_flag_clear(object) \ + atomic_store(object, 0) + +#define atomic_flag_clear_explicit(object, order) \ + atomic_flag_clear(object) + +#endif /* COMPAT_ATOMICS_WIN32_STDATOMIC_H */ diff --git a/mythtv/external/FFmpeg/compat/cuda/cuviddec.h b/mythtv/external/FFmpeg/compat/cuda/cuviddec.h deleted file mode 100644 index f9257ea5300..00000000000 --- a/mythtv/external/FFmpeg/compat/cuda/cuviddec.h +++ /dev/null @@ -1,827 +0,0 @@ -/* - * This copyright notice applies to this header file only: - * - * Copyright (c) 2010-2016 NVIDIA Corporation - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the software, and to permit persons to whom the - * software is furnished to do so, subject to the following - * conditions: - * - * 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. - */ - -/** - * \file cuviddec.h - * NvCuvid API provides Video Decoding interface to NVIDIA GPU devices. - * \date 2015-2016 - * This file contains constants, structure definitions and function prototypes used for decoding. - */ - -#if !defined(__CUDA_VIDEO_H__) -#define __CUDA_VIDEO_H__ - -#ifndef __cuda_cuda_h__ -#include -#endif // __cuda_cuda_h__ - -#if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64) -#if (CUDA_VERSION >= 3020) && (!defined(CUDA_FORCE_API_VERSION) || (CUDA_FORCE_API_VERSION >= 3020)) -#define __CUVID_DEVPTR64 -#endif -#endif - -#if defined(__cplusplus) -extern "C" { -#endif /* __cplusplus */ - -typedef void *CUvideodecoder; -typedef struct _CUcontextlock_st *CUvideoctxlock; - -/** - * \addtogroup VIDEO_DECODER Video Decoder - * @{ - */ - -/*! - * \enum cudaVideoCodec - * Video Codec Enums - */ -typedef enum cudaVideoCodec_enum { - cudaVideoCodec_MPEG1=0, /**< MPEG1 */ - cudaVideoCodec_MPEG2, /**< MPEG2 */ - cudaVideoCodec_MPEG4, /**< MPEG4 */ - cudaVideoCodec_VC1, /**< VC1 */ - cudaVideoCodec_H264, /**< H264 */ - cudaVideoCodec_JPEG, /**< JPEG */ - cudaVideoCodec_H264_SVC, /**< H264-SVC */ - cudaVideoCodec_H264_MVC, /**< H264-MVC */ - cudaVideoCodec_HEVC, /**< HEVC */ - cudaVideoCodec_VP8, /**< VP8 */ - cudaVideoCodec_VP9, /**< VP9 */ - cudaVideoCodec_NumCodecs, /**< Max COdecs */ - // Uncompressed YUV - cudaVideoCodec_YUV420 = (('I'<<24)|('Y'<<16)|('U'<<8)|('V')), /**< Y,U,V (4:2:0) */ - cudaVideoCodec_YV12 = (('Y'<<24)|('V'<<16)|('1'<<8)|('2')), /**< Y,V,U (4:2:0) */ - cudaVideoCodec_NV12 = (('N'<<24)|('V'<<16)|('1'<<8)|('2')), /**< Y,UV (4:2:0) */ - cudaVideoCodec_YUYV = (('Y'<<24)|('U'<<16)|('Y'<<8)|('V')), /**< YUYV/YUY2 (4:2:2) */ - cudaVideoCodec_UYVY = (('U'<<24)|('Y'<<16)|('V'<<8)|('Y')) /**< UYVY (4:2:2) */ -} cudaVideoCodec; - -/*! - * \enum cudaVideoSurfaceFormat - * Video Surface Formats Enums - */ -typedef enum cudaVideoSurfaceFormat_enum { - cudaVideoSurfaceFormat_NV12=0 /**< NV12 (currently the only supported output format) */ -} cudaVideoSurfaceFormat; - -/*! - * \enum cudaVideoDeinterlaceMode - * Deinterlacing Modes Enums - */ -typedef enum cudaVideoDeinterlaceMode_enum { - cudaVideoDeinterlaceMode_Weave=0, /**< Weave both fields (no deinterlacing) */ - cudaVideoDeinterlaceMode_Bob, /**< Drop one field */ - cudaVideoDeinterlaceMode_Adaptive /**< Adaptive deinterlacing */ -} cudaVideoDeinterlaceMode; - -/*! - * \enum cudaVideoChromaFormat - * Chroma Formats Enums - */ -typedef enum cudaVideoChromaFormat_enum { - cudaVideoChromaFormat_Monochrome=0, /**< MonoChrome */ - cudaVideoChromaFormat_420, /**< 4:2:0 */ - cudaVideoChromaFormat_422, /**< 4:2:2 */ - cudaVideoChromaFormat_444 /**< 4:4:4 */ -} cudaVideoChromaFormat; - -/*! - * \enum cudaVideoCreateFlags - * Decoder Flags Enums - */ -typedef enum cudaVideoCreateFlags_enum { - cudaVideoCreate_Default = 0x00, /**< Default operation mode: use dedicated video engines */ - cudaVideoCreate_PreferCUDA = 0x01, /**< Use a CUDA-based decoder if faster than dedicated engines (requires a valid vidLock object for multi-threading) */ - cudaVideoCreate_PreferDXVA = 0x02, /**< Go through DXVA internally if possible (requires D3D9 interop) */ - cudaVideoCreate_PreferCUVID = 0x04 /**< Use dedicated video engines directly */ -} cudaVideoCreateFlags; - -/*! - * \struct CUVIDDECODECREATEINFO - * Struct used in create decoder - */ -typedef struct _CUVIDDECODECREATEINFO -{ - unsigned long ulWidth; /**< Coded Sequence Width */ - unsigned long ulHeight; /**< Coded Sequence Height */ - unsigned long ulNumDecodeSurfaces; /**< Maximum number of internal decode surfaces */ - cudaVideoCodec CodecType; /**< cudaVideoCodec_XXX */ - cudaVideoChromaFormat ChromaFormat; /**< cudaVideoChromaFormat_XXX (only 4:2:0 is currently supported) */ - unsigned long ulCreationFlags; /**< Decoder creation flags (cudaVideoCreateFlags_XXX) */ - unsigned long bitDepthMinus8; - unsigned long Reserved1[4]; /**< Reserved for future use - set to zero */ - /** - * area of the frame that should be displayed - */ - struct { - short left; - short top; - short right; - short bottom; - } display_area; - - cudaVideoSurfaceFormat OutputFormat; /**< cudaVideoSurfaceFormat_XXX */ - cudaVideoDeinterlaceMode DeinterlaceMode; /**< cudaVideoDeinterlaceMode_XXX */ - unsigned long ulTargetWidth; /**< Post-processed Output Width (Should be aligned to 2) */ - unsigned long ulTargetHeight; /**< Post-processed Output Height (Should be aligbed to 2) */ - unsigned long ulNumOutputSurfaces; /**< Maximum number of output surfaces simultaneously mapped */ - CUvideoctxlock vidLock; /**< If non-NULL, context lock used for synchronizing ownership of the cuda context */ - /** - * target rectangle in the output frame (for aspect ratio conversion) - * if a null rectangle is specified, {0,0,ulTargetWidth,ulTargetHeight} will be used - */ - struct { - short left; - short top; - short right; - short bottom; - } target_rect; - unsigned long Reserved2[5]; /**< Reserved for future use - set to zero */ -} CUVIDDECODECREATEINFO; - -/*! - * \struct CUVIDH264DPBENTRY - * H.264 DPB Entry - */ -typedef struct _CUVIDH264DPBENTRY -{ - int PicIdx; /**< picture index of reference frame */ - int FrameIdx; /**< frame_num(short-term) or LongTermFrameIdx(long-term) */ - int is_long_term; /**< 0=short term reference, 1=long term reference */ - int not_existing; /**< non-existing reference frame (corresponding PicIdx should be set to -1) */ - int used_for_reference; /**< 0=unused, 1=top_field, 2=bottom_field, 3=both_fields */ - int FieldOrderCnt[2]; /**< field order count of top and bottom fields */ -} CUVIDH264DPBENTRY; - -/*! - * \struct CUVIDH264MVCEXT - * H.264 MVC Picture Parameters Ext - */ -typedef struct _CUVIDH264MVCEXT -{ - int num_views_minus1; - int view_id; - unsigned char inter_view_flag; - unsigned char num_inter_view_refs_l0; - unsigned char num_inter_view_refs_l1; - unsigned char MVCReserved8Bits; - int InterViewRefsL0[16]; - int InterViewRefsL1[16]; -} CUVIDH264MVCEXT; - -/*! - * \struct CUVIDH264SVCEXT - * H.264 SVC Picture Parameters Ext - */ -typedef struct _CUVIDH264SVCEXT -{ - unsigned char profile_idc; - unsigned char level_idc; - unsigned char DQId; - unsigned char DQIdMax; - unsigned char disable_inter_layer_deblocking_filter_idc; - unsigned char ref_layer_chroma_phase_y_plus1; - signed char inter_layer_slice_alpha_c0_offset_div2; - signed char inter_layer_slice_beta_offset_div2; - - unsigned short DPBEntryValidFlag; - unsigned char inter_layer_deblocking_filter_control_present_flag; - unsigned char extended_spatial_scalability_idc; - unsigned char adaptive_tcoeff_level_prediction_flag; - unsigned char slice_header_restriction_flag; - unsigned char chroma_phase_x_plus1_flag; - unsigned char chroma_phase_y_plus1; - - unsigned char tcoeff_level_prediction_flag; - unsigned char constrained_intra_resampling_flag; - unsigned char ref_layer_chroma_phase_x_plus1_flag; - unsigned char store_ref_base_pic_flag; - unsigned char Reserved8BitsA; - unsigned char Reserved8BitsB; - // For the 4 scaled_ref_layer_XX fields below, - // if (extended_spatial_scalability_idc == 1), SPS field, G.7.3.2.1.4, add prefix "seq_" - // if (extended_spatial_scalability_idc == 2), SLH field, G.7.3.3.4, - short scaled_ref_layer_left_offset; - short scaled_ref_layer_top_offset; - short scaled_ref_layer_right_offset; - short scaled_ref_layer_bottom_offset; - unsigned short Reserved16Bits; - struct _CUVIDPICPARAMS *pNextLayer; /**< Points to the picparams for the next layer to be decoded. Linked list ends at the target layer. */ - int bRefBaseLayer; /**< whether to store ref base pic */ -} CUVIDH264SVCEXT; - -/*! - * \struct CUVIDH264PICPARAMS - * H.264 Picture Parameters - */ -typedef struct _CUVIDH264PICPARAMS -{ - // SPS - int log2_max_frame_num_minus4; - int pic_order_cnt_type; - int log2_max_pic_order_cnt_lsb_minus4; - int delta_pic_order_always_zero_flag; - int frame_mbs_only_flag; - int direct_8x8_inference_flag; - int num_ref_frames; // NOTE: shall meet level 4.1 restrictions - unsigned char residual_colour_transform_flag; - unsigned char bit_depth_luma_minus8; // Must be 0 (only 8-bit supported) - unsigned char bit_depth_chroma_minus8; // Must be 0 (only 8-bit supported) - unsigned char qpprime_y_zero_transform_bypass_flag; - // PPS - int entropy_coding_mode_flag; - int pic_order_present_flag; - int num_ref_idx_l0_active_minus1; - int num_ref_idx_l1_active_minus1; - int weighted_pred_flag; - int weighted_bipred_idc; - int pic_init_qp_minus26; - int deblocking_filter_control_present_flag; - int redundant_pic_cnt_present_flag; - int transform_8x8_mode_flag; - int MbaffFrameFlag; - int constrained_intra_pred_flag; - int chroma_qp_index_offset; - int second_chroma_qp_index_offset; - int ref_pic_flag; - int frame_num; - int CurrFieldOrderCnt[2]; - // DPB - CUVIDH264DPBENTRY dpb[16]; // List of reference frames within the DPB - // Quantization Matrices (raster-order) - unsigned char WeightScale4x4[6][16]; - unsigned char WeightScale8x8[2][64]; - // FMO/ASO - unsigned char fmo_aso_enable; - unsigned char num_slice_groups_minus1; - unsigned char slice_group_map_type; - signed char pic_init_qs_minus26; - unsigned int slice_group_change_rate_minus1; - union - { - unsigned long long slice_group_map_addr; - const unsigned char *pMb2SliceGroupMap; - } fmo; - unsigned int Reserved[12]; - // SVC/MVC - union - { - CUVIDH264MVCEXT mvcext; - CUVIDH264SVCEXT svcext; - }; -} CUVIDH264PICPARAMS; - - -/*! - * \struct CUVIDMPEG2PICPARAMS - * MPEG-2 Picture Parameters - */ -typedef struct _CUVIDMPEG2PICPARAMS -{ - int ForwardRefIdx; // Picture index of forward reference (P/B-frames) - int BackwardRefIdx; // Picture index of backward reference (B-frames) - int picture_coding_type; - int full_pel_forward_vector; - int full_pel_backward_vector; - int f_code[2][2]; - int intra_dc_precision; - int frame_pred_frame_dct; - int concealment_motion_vectors; - int q_scale_type; - int intra_vlc_format; - int alternate_scan; - int top_field_first; - // Quantization matrices (raster order) - unsigned char QuantMatrixIntra[64]; - unsigned char QuantMatrixInter[64]; -} CUVIDMPEG2PICPARAMS; - -//////////////////////////////////////////////////////////////////////////////////////////////// -// -// MPEG-4 Picture Parameters -// - -// MPEG-4 has VOP types instead of Picture types -#define I_VOP 0 -#define P_VOP 1 -#define B_VOP 2 -#define S_VOP 3 - -/*! - * \struct CUVIDMPEG4PICPARAMS - * MPEG-4 Picture Parameters - */ -typedef struct _CUVIDMPEG4PICPARAMS -{ - int ForwardRefIdx; // Picture index of forward reference (P/B-frames) - int BackwardRefIdx; // Picture index of backward reference (B-frames) - // VOL - int video_object_layer_width; - int video_object_layer_height; - int vop_time_increment_bitcount; - int top_field_first; - int resync_marker_disable; - int quant_type; - int quarter_sample; - int short_video_header; - int divx_flags; - // VOP - int vop_coding_type; - int vop_coded; - int vop_rounding_type; - int alternate_vertical_scan_flag; - int interlaced; - int vop_fcode_forward; - int vop_fcode_backward; - int trd[2]; - int trb[2]; - // Quantization matrices (raster order) - unsigned char QuantMatrixIntra[64]; - unsigned char QuantMatrixInter[64]; - int gmc_enabled; -} CUVIDMPEG4PICPARAMS; - -/*! - * \struct CUVIDVC1PICPARAMS - * VC1 Picture Parameters - */ -typedef struct _CUVIDVC1PICPARAMS -{ - int ForwardRefIdx; /**< Picture index of forward reference (P/B-frames) */ - int BackwardRefIdx; /**< Picture index of backward reference (B-frames) */ - int FrameWidth; /**< Actual frame width */ - int FrameHeight; /**< Actual frame height */ - // PICTURE - int intra_pic_flag; /**< Set to 1 for I,BI frames */ - int ref_pic_flag; /**< Set to 1 for I,P frames */ - int progressive_fcm; /**< Progressive frame */ - // SEQUENCE - int profile; - int postprocflag; - int pulldown; - int interlace; - int tfcntrflag; - int finterpflag; - int psf; - int multires; - int syncmarker; - int rangered; - int maxbframes; - // ENTRYPOINT - int panscan_flag; - int refdist_flag; - int extended_mv; - int dquant; - int vstransform; - int loopfilter; - int fastuvmc; - int overlap; - int quantizer; - int extended_dmv; - int range_mapy_flag; - int range_mapy; - int range_mapuv_flag; - int range_mapuv; - int rangeredfrm; // range reduction state -} CUVIDVC1PICPARAMS; - -/*! - * \struct CUVIDJPEGPICPARAMS - * JPEG Picture Parameters - */ -typedef struct _CUVIDJPEGPICPARAMS -{ - int Reserved; -} CUVIDJPEGPICPARAMS; - - - /*! - * \struct CUVIDHEVCPICPARAMS - * HEVC Picture Parameters - */ -typedef struct _CUVIDHEVCPICPARAMS -{ - // sps - int pic_width_in_luma_samples; - int pic_height_in_luma_samples; - unsigned char log2_min_luma_coding_block_size_minus3; - unsigned char log2_diff_max_min_luma_coding_block_size; - unsigned char log2_min_transform_block_size_minus2; - unsigned char log2_diff_max_min_transform_block_size; - unsigned char pcm_enabled_flag; - unsigned char log2_min_pcm_luma_coding_block_size_minus3; - unsigned char log2_diff_max_min_pcm_luma_coding_block_size; - unsigned char pcm_sample_bit_depth_luma_minus1; - - unsigned char pcm_sample_bit_depth_chroma_minus1; - unsigned char pcm_loop_filter_disabled_flag; - unsigned char strong_intra_smoothing_enabled_flag; - unsigned char max_transform_hierarchy_depth_intra; - unsigned char max_transform_hierarchy_depth_inter; - unsigned char amp_enabled_flag; - unsigned char separate_colour_plane_flag; - unsigned char log2_max_pic_order_cnt_lsb_minus4; - - unsigned char num_short_term_ref_pic_sets; - unsigned char long_term_ref_pics_present_flag; - unsigned char num_long_term_ref_pics_sps; - unsigned char sps_temporal_mvp_enabled_flag; - unsigned char sample_adaptive_offset_enabled_flag; - unsigned char scaling_list_enable_flag; - unsigned char IrapPicFlag; - unsigned char IdrPicFlag; - - unsigned char bit_depth_luma_minus8; - unsigned char bit_depth_chroma_minus8; - unsigned char reserved1[14]; - - // pps - unsigned char dependent_slice_segments_enabled_flag; - unsigned char slice_segment_header_extension_present_flag; - unsigned char sign_data_hiding_enabled_flag; - unsigned char cu_qp_delta_enabled_flag; - unsigned char diff_cu_qp_delta_depth; - signed char init_qp_minus26; - signed char pps_cb_qp_offset; - signed char pps_cr_qp_offset; - - unsigned char constrained_intra_pred_flag; - unsigned char weighted_pred_flag; - unsigned char weighted_bipred_flag; - unsigned char transform_skip_enabled_flag; - unsigned char transquant_bypass_enabled_flag; - unsigned char entropy_coding_sync_enabled_flag; - unsigned char log2_parallel_merge_level_minus2; - unsigned char num_extra_slice_header_bits; - - unsigned char loop_filter_across_tiles_enabled_flag; - unsigned char loop_filter_across_slices_enabled_flag; - unsigned char output_flag_present_flag; - unsigned char num_ref_idx_l0_default_active_minus1; - unsigned char num_ref_idx_l1_default_active_minus1; - unsigned char lists_modification_present_flag; - unsigned char cabac_init_present_flag; - unsigned char pps_slice_chroma_qp_offsets_present_flag; - - unsigned char deblocking_filter_override_enabled_flag; - unsigned char pps_deblocking_filter_disabled_flag; - signed char pps_beta_offset_div2; - signed char pps_tc_offset_div2; - unsigned char tiles_enabled_flag; - unsigned char uniform_spacing_flag; - unsigned char num_tile_columns_minus1; - unsigned char num_tile_rows_minus1; - - unsigned short column_width_minus1[21]; - unsigned short row_height_minus1[21]; - unsigned int reserved3[15]; - - // RefPicSets - int NumBitsForShortTermRPSInSlice; - int NumDeltaPocsOfRefRpsIdx; - int NumPocTotalCurr; - int NumPocStCurrBefore; - int NumPocStCurrAfter; - int NumPocLtCurr; - int CurrPicOrderCntVal; - int RefPicIdx[16]; // [refpic] Indices of valid reference pictures (-1 if unused for reference) - int PicOrderCntVal[16]; // [refpic] - unsigned char IsLongTerm[16]; // [refpic] 0=not a long-term reference, 1=long-term reference - unsigned char RefPicSetStCurrBefore[8]; // [0..NumPocStCurrBefore-1] -> refpic (0..15) - unsigned char RefPicSetStCurrAfter[8]; // [0..NumPocStCurrAfter-1] -> refpic (0..15) - unsigned char RefPicSetLtCurr[8]; // [0..NumPocLtCurr-1] -> refpic (0..15) - unsigned char RefPicSetInterLayer0[8]; - unsigned char RefPicSetInterLayer1[8]; - unsigned int reserved4[12]; - - // scaling lists (diag order) - unsigned char ScalingList4x4[6][16]; // [matrixId][i] - unsigned char ScalingList8x8[6][64]; // [matrixId][i] - unsigned char ScalingList16x16[6][64]; // [matrixId][i] - unsigned char ScalingList32x32[2][64]; // [matrixId][i] - unsigned char ScalingListDCCoeff16x16[6]; // [matrixId] - unsigned char ScalingListDCCoeff32x32[2]; // [matrixId] -} CUVIDHEVCPICPARAMS; - - -/*! - * \struct CUVIDVP8PICPARAMS - * VP8 Picture Parameters - */ -typedef struct _CUVIDVP8PICPARAMS -{ - int width; - int height; - unsigned int first_partition_size; - //Frame Indexes - unsigned char LastRefIdx; - unsigned char GoldenRefIdx; - unsigned char AltRefIdx; - union { - struct { - unsigned char frame_type : 1; /**< 0 = KEYFRAME, 1 = INTERFRAME */ - unsigned char version : 3; - unsigned char show_frame : 1; - unsigned char update_mb_segmentation_data : 1; /**< Must be 0 if segmentation is not enabled */ - unsigned char Reserved2Bits : 2; - }; - unsigned char wFrameTagFlags; - }; - unsigned char Reserved1[4]; - unsigned int Reserved2[3]; -} CUVIDVP8PICPARAMS; - -/*! - * \struct CUVIDVP9PICPARAMS - * VP9 Picture Parameters - */ -typedef struct _CUVIDVP9PICPARAMS -{ - unsigned int width; - unsigned int height; - - //Frame Indices - unsigned char LastRefIdx; - unsigned char GoldenRefIdx; - unsigned char AltRefIdx; - unsigned char colorSpace; - - unsigned short profile : 3; - unsigned short frameContextIdx : 2; - unsigned short frameType : 1; - unsigned short showFrame : 1; - unsigned short errorResilient : 1; - unsigned short frameParallelDecoding : 1; - unsigned short subSamplingX : 1; - unsigned short subSamplingY : 1; - unsigned short intraOnly : 1; - unsigned short allow_high_precision_mv : 1; - unsigned short refreshEntropyProbs : 1; - unsigned short reserved2Bits : 2; - - unsigned short reserved16Bits; - - unsigned char refFrameSignBias[4]; - - unsigned char bitDepthMinus8Luma; - unsigned char bitDepthMinus8Chroma; - unsigned char loopFilterLevel; - unsigned char loopFilterSharpness; - - unsigned char modeRefLfEnabled; - unsigned char log2_tile_columns; - unsigned char log2_tile_rows; - - unsigned char segmentEnabled : 1; - unsigned char segmentMapUpdate : 1; - unsigned char segmentMapTemporalUpdate : 1; - unsigned char segmentFeatureMode : 1; - unsigned char reserved4Bits : 4; - - - unsigned char segmentFeatureEnable[8][4]; - short segmentFeatureData[8][4]; - unsigned char mb_segment_tree_probs[7]; - unsigned char segment_pred_probs[3]; - unsigned char reservedSegment16Bits[2]; - - int qpYAc; - int qpYDc; - int qpChDc; - int qpChAc; - - unsigned int activeRefIdx[3]; - unsigned int resetFrameContext; - unsigned int mcomp_filter_type; - unsigned int mbRefLfDelta[4]; - unsigned int mbModeLfDelta[2]; - unsigned int frameTagSize; - unsigned int offsetToDctParts; - unsigned int reserved128Bits[4]; - -} CUVIDVP9PICPARAMS; - - -/*! - * \struct CUVIDPICPARAMS - * Picture Parameters for Decoding - */ -typedef struct _CUVIDPICPARAMS -{ - int PicWidthInMbs; /**< Coded Frame Size */ - int FrameHeightInMbs; /**< Coded Frame Height */ - int CurrPicIdx; /**< Output index of the current picture */ - int field_pic_flag; /**< 0=frame picture, 1=field picture */ - int bottom_field_flag; /**< 0=top field, 1=bottom field (ignored if field_pic_flag=0) */ - int second_field; /**< Second field of a complementary field pair */ - // Bitstream data - unsigned int nBitstreamDataLen; /**< Number of bytes in bitstream data buffer */ - const unsigned char *pBitstreamData; /**< Ptr to bitstream data for this picture (slice-layer) */ - unsigned int nNumSlices; /**< Number of slices in this picture */ - const unsigned int *pSliceDataOffsets; /**< nNumSlices entries, contains offset of each slice within the bitstream data buffer */ - int ref_pic_flag; /**< This picture is a reference picture */ - int intra_pic_flag; /**< This picture is entirely intra coded */ - unsigned int Reserved[30]; /**< Reserved for future use */ - // Codec-specific data - union { - CUVIDMPEG2PICPARAMS mpeg2; /**< Also used for MPEG-1 */ - CUVIDH264PICPARAMS h264; - CUVIDVC1PICPARAMS vc1; - CUVIDMPEG4PICPARAMS mpeg4; - CUVIDJPEGPICPARAMS jpeg; - CUVIDHEVCPICPARAMS hevc; - CUVIDVP8PICPARAMS vp8; - CUVIDVP9PICPARAMS vp9; - unsigned int CodecReserved[1024]; - } CodecSpecific; -} CUVIDPICPARAMS; - - -/*! - * \struct CUVIDPROCPARAMS - * Picture Parameters for Postprocessing - */ -typedef struct _CUVIDPROCPARAMS -{ - int progressive_frame; /**< Input is progressive (deinterlace_mode will be ignored) */ - int second_field; /**< Output the second field (ignored if deinterlace mode is Weave) */ - int top_field_first; /**< Input frame is top field first (1st field is top, 2nd field is bottom) */ - int unpaired_field; /**< Input only contains one field (2nd field is invalid) */ - // The fields below are used for raw YUV input - unsigned int reserved_flags; /**< Reserved for future use (set to zero) */ - unsigned int reserved_zero; /**< Reserved (set to zero) */ - unsigned long long raw_input_dptr; /**< Input CUdeviceptr for raw YUV extensions */ - unsigned int raw_input_pitch; /**< pitch in bytes of raw YUV input (should be aligned appropriately) */ - unsigned int raw_input_format; /**< Reserved for future use (set to zero) */ - unsigned long long raw_output_dptr; /**< Reserved for future use (set to zero) */ - unsigned int raw_output_pitch; /**< Reserved for future use (set to zero) */ - unsigned int Reserved[48]; - void *Reserved3[3]; -} CUVIDPROCPARAMS; - - -/** - * - * In order to minimize decode latencies, there should be always at least 2 pictures in the decode - * queue at any time, in order to make sure that all decode engines are always busy. - * - * Overall data flow: - * - cuvidCreateDecoder(...) - * For each picture: - * - cuvidDecodePicture(N) - * - cuvidMapVideoFrame(N-4) - * - do some processing in cuda - * - cuvidUnmapVideoFrame(N-4) - * - cuvidDecodePicture(N+1) - * - cuvidMapVideoFrame(N-3) - * ... - * - cuvidDestroyDecoder(...) - * - * NOTE: - * - When the cuda context is created from a D3D device, the D3D device must also be created - * with the D3DCREATE_MULTITHREADED flag. - * - There is a limit to how many pictures can be mapped simultaneously (ulNumOutputSurfaces) - * - cuVidDecodePicture may block the calling thread if there are too many pictures pending - * in the decode queue - */ - -/** - * \fn CUresult CUDAAPI cuvidCreateDecoder(CUvideodecoder *phDecoder, CUVIDDECODECREATEINFO *pdci) - * Create the decoder object - */ -CUresult CUDAAPI cuvidCreateDecoder(CUvideodecoder *phDecoder, CUVIDDECODECREATEINFO *pdci); - -/** - * \fn CUresult CUDAAPI cuvidDestroyDecoder(CUvideodecoder hDecoder) - * Destroy the decoder object - */ -CUresult CUDAAPI cuvidDestroyDecoder(CUvideodecoder hDecoder); - -/** - * \fn CUresult CUDAAPI cuvidDecodePicture(CUvideodecoder hDecoder, CUVIDPICPARAMS *pPicParams) - * Decode a single picture (field or frame) - */ -CUresult CUDAAPI cuvidDecodePicture(CUvideodecoder hDecoder, CUVIDPICPARAMS *pPicParams); - - -#if !defined(__CUVID_DEVPTR64) || defined(__CUVID_INTERNAL) -/** - * \fn CUresult CUDAAPI cuvidMapVideoFrame(CUvideodecoder hDecoder, int nPicIdx, unsigned int *pDevPtr, unsigned int *pPitch, CUVIDPROCPARAMS *pVPP); - * Post-process and map a video frame for use in cuda - */ -CUresult CUDAAPI cuvidMapVideoFrame(CUvideodecoder hDecoder, int nPicIdx, - unsigned int *pDevPtr, unsigned int *pPitch, - CUVIDPROCPARAMS *pVPP); - -/** - * \fn CUresult CUDAAPI cuvidUnmapVideoFrame(CUvideodecoder hDecoder, unsigned int DevPtr) - * Unmap a previously mapped video frame - */ -CUresult CUDAAPI cuvidUnmapVideoFrame(CUvideodecoder hDecoder, unsigned int DevPtr); -#endif - -#if defined(WIN64) || defined(_WIN64) || defined(__x86_64) || defined(AMD64) || defined(_M_AMD64) -/** - * \fn CUresult CUDAAPI cuvidMapVideoFrame64(CUvideodecoder hDecoder, int nPicIdx, unsigned long long *pDevPtr, unsigned int *pPitch, CUVIDPROCPARAMS *pVPP); - * map a video frame - */ -CUresult CUDAAPI cuvidMapVideoFrame64(CUvideodecoder hDecoder, int nPicIdx, unsigned long long *pDevPtr, - unsigned int *pPitch, CUVIDPROCPARAMS *pVPP); - -/** - * \fn CUresult CUDAAPI cuvidUnmapVideoFrame64(CUvideodecoder hDecoder, unsigned long long DevPtr); - * Unmap a previously mapped video frame - */ -CUresult CUDAAPI cuvidUnmapVideoFrame64(CUvideodecoder hDecoder, unsigned long long DevPtr); - -#if defined(__CUVID_DEVPTR64) && !defined(__CUVID_INTERNAL) -#define cuvidMapVideoFrame cuvidMapVideoFrame64 -#define cuvidUnmapVideoFrame cuvidUnmapVideoFrame64 -#endif -#endif - - - -/** - * - * Context-locking: to facilitate multi-threaded implementations, the following 4 functions - * provide a simple mutex-style host synchronization. If a non-NULL context is specified - * in CUVIDDECODECREATEINFO, the codec library will acquire the mutex associated with the given - * context before making any cuda calls. - * A multi-threaded application could create a lock associated with a context handle so that - * multiple threads can safely share the same cuda context: - * - use cuCtxPopCurrent immediately after context creation in order to create a 'floating' context - * that can be passed to cuvidCtxLockCreate. - * - When using a floating context, all cuda calls should only be made within a cuvidCtxLock/cuvidCtxUnlock section. - * - * NOTE: This is a safer alternative to cuCtxPushCurrent and cuCtxPopCurrent, and is not related to video - * decoder in any way (implemented as a critical section associated with cuCtx{Push|Pop}Current calls). -*/ - -/** - * \fn CUresult CUDAAPI cuvidCtxLockCreate(CUvideoctxlock *pLock, CUcontext ctx) - */ -CUresult CUDAAPI cuvidCtxLockCreate(CUvideoctxlock *pLock, CUcontext ctx); - -/** - * \fn CUresult CUDAAPI cuvidCtxLockDestroy(CUvideoctxlock lck) - */ -CUresult CUDAAPI cuvidCtxLockDestroy(CUvideoctxlock lck); - -/** - * \fn CUresult CUDAAPI cuvidCtxLock(CUvideoctxlock lck, unsigned int reserved_flags) - */ -CUresult CUDAAPI cuvidCtxLock(CUvideoctxlock lck, unsigned int reserved_flags); - -/** - * \fn CUresult CUDAAPI cuvidCtxUnlock(CUvideoctxlock lck, unsigned int reserved_flags) - */ -CUresult CUDAAPI cuvidCtxUnlock(CUvideoctxlock lck, unsigned int reserved_flags); - -/** @} */ /* End VIDEO_DECODER */ -//////////////////////////////////////////////////////////////////////////////////////////////// - -#if defined(__cplusplus) - -// Auto-lock helper for C++ applications -class CCtxAutoLock -{ -private: - CUvideoctxlock m_ctx; -public: - CCtxAutoLock(CUvideoctxlock ctx); - ~CCtxAutoLock(); -}; - -} - -#endif /* __cplusplus */ - -#endif // __CUDA_VIDEO_H__ - diff --git a/mythtv/external/FFmpeg/compat/cuda/dynlink_cuda.h b/mythtv/external/FFmpeg/compat/cuda/dynlink_cuda.h new file mode 100644 index 00000000000..3a13611ce64 --- /dev/null +++ b/mythtv/external/FFmpeg/compat/cuda/dynlink_cuda.h @@ -0,0 +1,98 @@ +/* + * This copyright notice applies to this header file only: + * + * Copyright (c) 2016 + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the software, and to permit persons to whom the + * software is furnished to do so, subject to the following + * conditions: + * + * 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. + */ + +#if !defined(AV_COMPAT_DYNLINK_CUDA_H) && !defined(CUDA_VERSION) +#define AV_COMPAT_DYNLINK_CUDA_H + +#include + +#define CUDA_VERSION 7050 + +#if defined(_WIN32) || defined(__CYGWIN__) +#define CUDAAPI __stdcall +#else +#define CUDAAPI +#endif + +#define CU_CTX_SCHED_BLOCKING_SYNC 4 + +typedef int CUdevice; +typedef void* CUarray; +typedef void* CUcontext; +typedef void* CUstream; +#if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64) +typedef unsigned long long CUdeviceptr; +#else +typedef unsigned int CUdeviceptr; +#endif + +typedef enum cudaError_enum { + CUDA_SUCCESS = 0 +} CUresult; + +typedef enum CUmemorytype_enum { + CU_MEMORYTYPE_HOST = 1, + CU_MEMORYTYPE_DEVICE = 2 +} CUmemorytype; + +typedef struct CUDA_MEMCPY2D_st { + size_t srcXInBytes; + size_t srcY; + CUmemorytype srcMemoryType; + const void *srcHost; + CUdeviceptr srcDevice; + CUarray srcArray; + size_t srcPitch; + + size_t dstXInBytes; + size_t dstY; + CUmemorytype dstMemoryType; + void *dstHost; + CUdeviceptr dstDevice; + CUarray dstArray; + size_t dstPitch; + + size_t WidthInBytes; + size_t Height; +} CUDA_MEMCPY2D; + +typedef CUresult CUDAAPI tcuInit(unsigned int Flags); +typedef CUresult CUDAAPI tcuDeviceGetCount(int *count); +typedef CUresult CUDAAPI tcuDeviceGet(CUdevice *device, int ordinal); +typedef CUresult CUDAAPI tcuDeviceGetName(char *name, int len, CUdevice dev); +typedef CUresult CUDAAPI tcuDeviceComputeCapability(int *major, int *minor, CUdevice dev); +typedef CUresult CUDAAPI tcuCtxCreate_v2(CUcontext *pctx, unsigned int flags, CUdevice dev); +typedef CUresult CUDAAPI tcuCtxPushCurrent_v2(CUcontext *pctx); +typedef CUresult CUDAAPI tcuCtxPopCurrent_v2(CUcontext *pctx); +typedef CUresult CUDAAPI tcuCtxDestroy_v2(CUcontext ctx); +typedef CUresult CUDAAPI tcuMemAlloc_v2(CUdeviceptr *dptr, size_t bytesize); +typedef CUresult CUDAAPI tcuMemFree_v2(CUdeviceptr dptr); +typedef CUresult CUDAAPI tcuMemcpy2D_v2(const CUDA_MEMCPY2D *pcopy); +typedef CUresult CUDAAPI tcuGetErrorName(CUresult error, const char** pstr); +typedef CUresult CUDAAPI tcuGetErrorString(CUresult error, const char** pstr); + +#endif diff --git a/mythtv/external/FFmpeg/compat/cuda/dynlink_cuviddec.h b/mythtv/external/FFmpeg/compat/cuda/dynlink_cuviddec.h new file mode 100644 index 00000000000..4af78a186ba --- /dev/null +++ b/mythtv/external/FFmpeg/compat/cuda/dynlink_cuviddec.h @@ -0,0 +1,886 @@ +/* + * This copyright notice applies to this header file only: + * + * Copyright (c) 2010-2017 NVIDIA Corporation + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the software, and to permit persons to whom the + * software is furnished to do so, subject to the following + * conditions: + * + * 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. + */ + +/*****************************************************************************************************/ +//! \file cuviddec.h +//! NVDECODE API provides video decoding interface to NVIDIA GPU devices. +//! \date 2015-2017 +//! This file contains constants, structure definitions and function prototypes used for decoding. +/*****************************************************************************************************/ + +#if !defined(__CUDA_VIDEO_H__) +#define __CUDA_VIDEO_H__ + +#if defined(_WIN64) || defined(__LP64__) || defined(__x86_64) || defined(AMD64) || defined(_M_AMD64) +#if (CUDA_VERSION >= 3020) && (!defined(CUDA_FORCE_API_VERSION) || (CUDA_FORCE_API_VERSION >= 3020)) +#define __CUVID_DEVPTR64 +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus */ + +#if defined(__CYGWIN__) +typedef unsigned int tcu_ulong; +#else +typedef unsigned long tcu_ulong; +#endif + +typedef void *CUvideodecoder; +typedef struct _CUcontextlock_st *CUvideoctxlock; + +/*********************************************************************************/ +//! \enum cudaVideoCodec +//! Video codec enums +//! These enums are used in CUVIDDECODECREATEINFO and CUVIDDECODECAPS structures +/*********************************************************************************/ +typedef enum cudaVideoCodec_enum { + cudaVideoCodec_MPEG1=0, /**< MPEG1 */ + cudaVideoCodec_MPEG2, /**< MPEG2 */ + cudaVideoCodec_MPEG4, /**< MPEG4 */ + cudaVideoCodec_VC1, /**< VC1 */ + cudaVideoCodec_H264, /**< H264 */ + cudaVideoCodec_JPEG, /**< JPEG */ + cudaVideoCodec_H264_SVC, /**< H264-SVC */ + cudaVideoCodec_H264_MVC, /**< H264-MVC */ + cudaVideoCodec_HEVC, /**< HEVC */ + cudaVideoCodec_VP8, /**< VP8 */ + cudaVideoCodec_VP9, /**< VP9 */ + cudaVideoCodec_NumCodecs, /**< Max codecs */ + // Uncompressed YUV + cudaVideoCodec_YUV420 = (('I'<<24)|('Y'<<16)|('U'<<8)|('V')), /**< Y,U,V (4:2:0) */ + cudaVideoCodec_YV12 = (('Y'<<24)|('V'<<16)|('1'<<8)|('2')), /**< Y,V,U (4:2:0) */ + cudaVideoCodec_NV12 = (('N'<<24)|('V'<<16)|('1'<<8)|('2')), /**< Y,UV (4:2:0) */ + cudaVideoCodec_YUYV = (('Y'<<24)|('U'<<16)|('Y'<<8)|('V')), /**< YUYV/YUY2 (4:2:2) */ + cudaVideoCodec_UYVY = (('U'<<24)|('Y'<<16)|('V'<<8)|('Y')) /**< UYVY (4:2:2) */ +} cudaVideoCodec; + +/*********************************************************************************/ +//! \enum cudaVideoSurfaceFormat +//! Video surface format enums used for output format of decoded output +//! These enums are used in CUVIDDECODECREATEINFO structure +/*********************************************************************************/ +typedef enum cudaVideoSurfaceFormat_enum { + cudaVideoSurfaceFormat_NV12=0, /**< NV12 format */ + cudaVideoSurfaceFormat_P016=1 /**< 16 bit semiplaner format. Can be used for 10 bit(6LSB bits 0), + 12 bit (4LSB bits 0) */ +} cudaVideoSurfaceFormat; + +/******************************************************************************************************************/ +//! \enum cudaVideoDeinterlaceMode +//! Deinterlacing mode enums +//! These enums are used in CUVIDDECODECREATEINFO structure +//! Use cudaVideoDeinterlaceMode_Weave for progressive content and for content that doesn't need deinterlacing +//! cudaVideoDeinterlaceMode_Adaptive needs more video memory than other DImodes +/******************************************************************************************************************/ +typedef enum cudaVideoDeinterlaceMode_enum { + cudaVideoDeinterlaceMode_Weave=0, /**< Weave both fields (no deinterlacing) */ + cudaVideoDeinterlaceMode_Bob, /**< Drop one field */ + cudaVideoDeinterlaceMode_Adaptive /**< Adaptive deinterlacing */ +} cudaVideoDeinterlaceMode; + +/**************************************************************************************************************/ +//! \enum cudaVideoChromaFormat +//! Chroma format enums +//! These enums are used in CUVIDDECODECREATEINFO and CUVIDDECODECAPS structures +//! JPEG supports Monochrome, YUV 4:2:0, YUV 4:2:2 and YUV 4:4:4 chroma formats. +//! H264, HEVC, VP9, VP8, VC1, MPEG1, MPEG2 and MPEG4 support YUV 4:2:0 chroma format only. +/**************************************************************************************************************/ +typedef enum cudaVideoChromaFormat_enum { + cudaVideoChromaFormat_Monochrome=0, /**< MonoChrome */ + cudaVideoChromaFormat_420, /**< YUV 4:2:0 */ + cudaVideoChromaFormat_422, /**< YUV 4:2:2 */ + cudaVideoChromaFormat_444 /**< YUV 4:4:4 */ +} cudaVideoChromaFormat; + +/*************************************************************************************************************/ +//! \enum cudaVideoCreateFlags +//! Decoder flag enums to select preferred decode path +//! cudaVideoCreate_Default and cudaVideoCreate_PreferCUVID are most optimized, use these whenever possible +/*************************************************************************************************************/ +typedef enum cudaVideoCreateFlags_enum { + cudaVideoCreate_Default = 0x00, /**< Default operation mode: use dedicated video engines */ + cudaVideoCreate_PreferCUDA = 0x01, /**< Use CUDA-based decoder (requires valid vidLock object for multi-threading) */ + cudaVideoCreate_PreferDXVA = 0x02, /**< Go through DXVA internally if possible (requires D3D9 interop) */ + cudaVideoCreate_PreferCUVID = 0x04 /**< Use dedicated video engines directly */ +} cudaVideoCreateFlags; + + +/**************************************************************************************************************/ +//! \struct CUVIDDECODECAPS; +//! This structure is used in cuvidGetDecoderCaps API +/**************************************************************************************************************/ +typedef struct _CUVIDDECODECAPS +{ + cudaVideoCodec eCodecType; /**< IN: cudaVideoCodec_XXX */ + cudaVideoChromaFormat eChromaFormat; /**< IN: cudaVideoChromaFormat_XXX */ + unsigned int nBitDepthMinus8; /**< IN: The Value "BitDepth minus 8" */ + unsigned int reserved1[3]; /**< Reserved for future use - set to zero */ + + unsigned char bIsSupported; /**< OUT: 1 if codec supported, 0 if not supported */ + unsigned char reserved2[3]; /**< Reserved for future use - set to zero */ + unsigned int nMaxWidth; /**< OUT: Max supported coded width in pixels */ + unsigned int nMaxHeight; /**< OUT: Max supported coded height in pixels */ + unsigned int nMaxMBCount; /**< OUT: Max supported macroblock count + CodedWidth*CodedHeight/256 must be <= nMaxMBCount */ + unsigned short nMinWidth; /**< OUT: Min supported coded width in pixels */ + unsigned short nMinHeight; /**< OUT: Min supported coded height in pixels */ + unsigned int reserved3[11]; /**< Reserved for future use - set to zero */ +} CUVIDDECODECAPS; + +/**************************************************************************************************************/ +//! \struct CUVIDDECODECREATEINFO +//! This structure is used in cuvidCreateDecoder API +/**************************************************************************************************************/ +typedef struct _CUVIDDECODECREATEINFO +{ + tcu_ulong ulWidth; /**< IN: Coded sequence width in pixels */ + tcu_ulong ulHeight; /**< IN: Coded sequence height in pixels */ + tcu_ulong ulNumDecodeSurfaces; /**< IN: Maximum number of internal decode surfaces */ + cudaVideoCodec CodecType; /**< IN: cudaVideoCodec_XXX */ + cudaVideoChromaFormat ChromaFormat; /**< IN: cudaVideoChromaFormat_XXX */ + tcu_ulong ulCreationFlags; /**< IN: Decoder creation flags (cudaVideoCreateFlags_XXX) */ + tcu_ulong bitDepthMinus8; /**< IN: The value "BitDepth minus 8" */ + tcu_ulong ulIntraDecodeOnly; /**< IN: Set 1 only if video has all intra frames (default value is 0). This will + optimize video memory for Intra frames only decoding. The support is limited + to specific codecs(H264 rightnow), the flag will be ignored for codecs which + are not supported. However decoding might fail if the flag is enabled in case + of supported codecs for regular bit streams having P and/or B frames. */ + tcu_ulong Reserved1[3]; /**< Reserved for future use - set to zero */ + /** + * IN: area of the frame that should be displayed + */ + struct { + short left; + short top; + short right; + short bottom; + } display_area; + + cudaVideoSurfaceFormat OutputFormat; /**< IN: cudaVideoSurfaceFormat_XXX */ + cudaVideoDeinterlaceMode DeinterlaceMode; /**< IN: cudaVideoDeinterlaceMode_XXX */ + tcu_ulong ulTargetWidth; /**< IN: Post-processed output width (Should be aligned to 2) */ + tcu_ulong ulTargetHeight; /**< IN: Post-processed output height (Should be aligbed to 2) */ + tcu_ulong ulNumOutputSurfaces; /**< IN: Maximum number of output surfaces simultaneously mapped */ + CUvideoctxlock vidLock; /**< IN: If non-NULL, context lock used for synchronizing ownership of + the cuda context. Needed for cudaVideoCreate_PreferCUDA decode */ + /** + * IN: target rectangle in the output frame (for aspect ratio conversion) + * if a null rectangle is specified, {0,0,ulTargetWidth,ulTargetHeight} will be used + */ + struct { + short left; + short top; + short right; + short bottom; + } target_rect; + tcu_ulong Reserved2[5]; /**< Reserved for future use - set to zero */ +} CUVIDDECODECREATEINFO; + +/*********************************************************/ +//! \struct CUVIDH264DPBENTRY +//! H.264 DPB entry +//! This structure is used in CUVIDH264PICPARAMS structure +/*********************************************************/ +typedef struct _CUVIDH264DPBENTRY +{ + int PicIdx; /**< picture index of reference frame */ + int FrameIdx; /**< frame_num(short-term) or LongTermFrameIdx(long-term) */ + int is_long_term; /**< 0=short term reference, 1=long term reference */ + int not_existing; /**< non-existing reference frame (corresponding PicIdx should be set to -1) */ + int used_for_reference; /**< 0=unused, 1=top_field, 2=bottom_field, 3=both_fields */ + int FieldOrderCnt[2]; /**< field order count of top and bottom fields */ +} CUVIDH264DPBENTRY; + +/************************************************************/ +//! \struct CUVIDH264MVCEXT +//! H.264 MVC picture parameters ext +//! This structure is used in CUVIDH264PICPARAMS structure +/************************************************************/ +typedef struct _CUVIDH264MVCEXT +{ + int num_views_minus1; /**< Max number of coded views minus 1 in video : Range - 0 to 1023 */ + int view_id; /**< view identifier */ + unsigned char inter_view_flag; /**< 1 if used for inter-view prediction, 0 if not */ + unsigned char num_inter_view_refs_l0; /**< number of inter-view ref pics in RefPicList0 */ + unsigned char num_inter_view_refs_l1; /**< number of inter-view ref pics in RefPicList1 */ + unsigned char MVCReserved8Bits; /**< Reserved bits */ + int InterViewRefsL0[16]; /**< view id of the i-th view component for inter-view prediction in RefPicList0 */ + int InterViewRefsL1[16]; /**< view id of the i-th view component for inter-view prediction in RefPicList1 */ +} CUVIDH264MVCEXT; + +/*********************************************************/ +//! \struct CUVIDH264SVCEXT +//! H.264 SVC picture parameters ext +//! This structure is used in CUVIDH264PICPARAMS structure +/*********************************************************/ +typedef struct _CUVIDH264SVCEXT +{ + unsigned char profile_idc; + unsigned char level_idc; + unsigned char DQId; + unsigned char DQIdMax; + unsigned char disable_inter_layer_deblocking_filter_idc; + unsigned char ref_layer_chroma_phase_y_plus1; + signed char inter_layer_slice_alpha_c0_offset_div2; + signed char inter_layer_slice_beta_offset_div2; + + unsigned short DPBEntryValidFlag; + unsigned char inter_layer_deblocking_filter_control_present_flag; + unsigned char extended_spatial_scalability_idc; + unsigned char adaptive_tcoeff_level_prediction_flag; + unsigned char slice_header_restriction_flag; + unsigned char chroma_phase_x_plus1_flag; + unsigned char chroma_phase_y_plus1; + + unsigned char tcoeff_level_prediction_flag; + unsigned char constrained_intra_resampling_flag; + unsigned char ref_layer_chroma_phase_x_plus1_flag; + unsigned char store_ref_base_pic_flag; + unsigned char Reserved8BitsA; + unsigned char Reserved8BitsB; + + short scaled_ref_layer_left_offset; + short scaled_ref_layer_top_offset; + short scaled_ref_layer_right_offset; + short scaled_ref_layer_bottom_offset; + unsigned short Reserved16Bits; + struct _CUVIDPICPARAMS *pNextLayer; /**< Points to the picparams for the next layer to be decoded. + Linked list ends at the target layer. */ + int bRefBaseLayer; /**< whether to store ref base pic */ +} CUVIDH264SVCEXT; + +/******************************************************/ +//! \struct CUVIDH264PICPARAMS +//! H.264 picture parameters +//! This structure is used in CUVIDPICPARAMS structure +/******************************************************/ +typedef struct _CUVIDH264PICPARAMS +{ + // SPS + int log2_max_frame_num_minus4; + int pic_order_cnt_type; + int log2_max_pic_order_cnt_lsb_minus4; + int delta_pic_order_always_zero_flag; + int frame_mbs_only_flag; + int direct_8x8_inference_flag; + int num_ref_frames; // NOTE: shall meet level 4.1 restrictions + unsigned char residual_colour_transform_flag; + unsigned char bit_depth_luma_minus8; // Must be 0 (only 8-bit supported) + unsigned char bit_depth_chroma_minus8; // Must be 0 (only 8-bit supported) + unsigned char qpprime_y_zero_transform_bypass_flag; + // PPS + int entropy_coding_mode_flag; + int pic_order_present_flag; + int num_ref_idx_l0_active_minus1; + int num_ref_idx_l1_active_minus1; + int weighted_pred_flag; + int weighted_bipred_idc; + int pic_init_qp_minus26; + int deblocking_filter_control_present_flag; + int redundant_pic_cnt_present_flag; + int transform_8x8_mode_flag; + int MbaffFrameFlag; + int constrained_intra_pred_flag; + int chroma_qp_index_offset; + int second_chroma_qp_index_offset; + int ref_pic_flag; + int frame_num; + int CurrFieldOrderCnt[2]; + // DPB + CUVIDH264DPBENTRY dpb[16]; // List of reference frames within the DPB + // Quantization Matrices (raster-order) + unsigned char WeightScale4x4[6][16]; + unsigned char WeightScale8x8[2][64]; + // FMO/ASO + unsigned char fmo_aso_enable; + unsigned char num_slice_groups_minus1; + unsigned char slice_group_map_type; + signed char pic_init_qs_minus26; + unsigned int slice_group_change_rate_minus1; + union + { + unsigned long long slice_group_map_addr; + const unsigned char *pMb2SliceGroupMap; + } fmo; + unsigned int Reserved[12]; + // SVC/MVC + union + { + CUVIDH264MVCEXT mvcext; + CUVIDH264SVCEXT svcext; + }; +} CUVIDH264PICPARAMS; + + +/********************************************************/ +//! \struct CUVIDMPEG2PICPARAMS +//! MPEG-2 picture parameters +//! This structure is used in CUVIDPICPARAMS structure +/********************************************************/ +typedef struct _CUVIDMPEG2PICPARAMS +{ + int ForwardRefIdx; // Picture index of forward reference (P/B-frames) + int BackwardRefIdx; // Picture index of backward reference (B-frames) + int picture_coding_type; + int full_pel_forward_vector; + int full_pel_backward_vector; + int f_code[2][2]; + int intra_dc_precision; + int frame_pred_frame_dct; + int concealment_motion_vectors; + int q_scale_type; + int intra_vlc_format; + int alternate_scan; + int top_field_first; + // Quantization matrices (raster order) + unsigned char QuantMatrixIntra[64]; + unsigned char QuantMatrixInter[64]; +} CUVIDMPEG2PICPARAMS; + +// MPEG-4 has VOP types instead of Picture types +#define I_VOP 0 +#define P_VOP 1 +#define B_VOP 2 +#define S_VOP 3 + +/*******************************************************/ +//! \struct CUVIDMPEG4PICPARAMS +//! MPEG-4 picture parameters +//! This structure is used in CUVIDPICPARAMS structure +/*******************************************************/ +typedef struct _CUVIDMPEG4PICPARAMS +{ + int ForwardRefIdx; // Picture index of forward reference (P/B-frames) + int BackwardRefIdx; // Picture index of backward reference (B-frames) + // VOL + int video_object_layer_width; + int video_object_layer_height; + int vop_time_increment_bitcount; + int top_field_first; + int resync_marker_disable; + int quant_type; + int quarter_sample; + int short_video_header; + int divx_flags; + // VOP + int vop_coding_type; + int vop_coded; + int vop_rounding_type; + int alternate_vertical_scan_flag; + int interlaced; + int vop_fcode_forward; + int vop_fcode_backward; + int trd[2]; + int trb[2]; + // Quantization matrices (raster order) + unsigned char QuantMatrixIntra[64]; + unsigned char QuantMatrixInter[64]; + int gmc_enabled; +} CUVIDMPEG4PICPARAMS; + +/********************************************************/ +//! \struct CUVIDVC1PICPARAMS +//! VC1 picture parameters +//! This structure is used in CUVIDPICPARAMS structure +/********************************************************/ +typedef struct _CUVIDVC1PICPARAMS +{ + int ForwardRefIdx; /**< Picture index of forward reference (P/B-frames) */ + int BackwardRefIdx; /**< Picture index of backward reference (B-frames) */ + int FrameWidth; /**< Actual frame width */ + int FrameHeight; /**< Actual frame height */ + // PICTURE + int intra_pic_flag; /**< Set to 1 for I,BI frames */ + int ref_pic_flag; /**< Set to 1 for I,P frames */ + int progressive_fcm; /**< Progressive frame */ + // SEQUENCE + int profile; + int postprocflag; + int pulldown; + int interlace; + int tfcntrflag; + int finterpflag; + int psf; + int multires; + int syncmarker; + int rangered; + int maxbframes; + // ENTRYPOINT + int panscan_flag; + int refdist_flag; + int extended_mv; + int dquant; + int vstransform; + int loopfilter; + int fastuvmc; + int overlap; + int quantizer; + int extended_dmv; + int range_mapy_flag; + int range_mapy; + int range_mapuv_flag; + int range_mapuv; + int rangeredfrm; // range reduction state +} CUVIDVC1PICPARAMS; + +/***********************************************************/ +//! \struct CUVIDJPEGPICPARAMS +//! JPEG picture parameters +//! This structure is used in CUVIDPICPARAMS structure +/***********************************************************/ +typedef struct _CUVIDJPEGPICPARAMS +{ + int Reserved; +} CUVIDJPEGPICPARAMS; + + +/*******************************************************/ +//! \struct CUVIDHEVCPICPARAMS +//! HEVC picture parameters +//! This structure is used in CUVIDPICPARAMS structure +/*******************************************************/ +typedef struct _CUVIDHEVCPICPARAMS +{ + // sps + int pic_width_in_luma_samples; + int pic_height_in_luma_samples; + unsigned char log2_min_luma_coding_block_size_minus3; + unsigned char log2_diff_max_min_luma_coding_block_size; + unsigned char log2_min_transform_block_size_minus2; + unsigned char log2_diff_max_min_transform_block_size; + unsigned char pcm_enabled_flag; + unsigned char log2_min_pcm_luma_coding_block_size_minus3; + unsigned char log2_diff_max_min_pcm_luma_coding_block_size; + unsigned char pcm_sample_bit_depth_luma_minus1; + + unsigned char pcm_sample_bit_depth_chroma_minus1; + unsigned char pcm_loop_filter_disabled_flag; + unsigned char strong_intra_smoothing_enabled_flag; + unsigned char max_transform_hierarchy_depth_intra; + unsigned char max_transform_hierarchy_depth_inter; + unsigned char amp_enabled_flag; + unsigned char separate_colour_plane_flag; + unsigned char log2_max_pic_order_cnt_lsb_minus4; + + unsigned char num_short_term_ref_pic_sets; + unsigned char long_term_ref_pics_present_flag; + unsigned char num_long_term_ref_pics_sps; + unsigned char sps_temporal_mvp_enabled_flag; + unsigned char sample_adaptive_offset_enabled_flag; + unsigned char scaling_list_enable_flag; + unsigned char IrapPicFlag; + unsigned char IdrPicFlag; + + unsigned char bit_depth_luma_minus8; + unsigned char bit_depth_chroma_minus8; + unsigned char reserved1[14]; + + // pps + unsigned char dependent_slice_segments_enabled_flag; + unsigned char slice_segment_header_extension_present_flag; + unsigned char sign_data_hiding_enabled_flag; + unsigned char cu_qp_delta_enabled_flag; + unsigned char diff_cu_qp_delta_depth; + signed char init_qp_minus26; + signed char pps_cb_qp_offset; + signed char pps_cr_qp_offset; + + unsigned char constrained_intra_pred_flag; + unsigned char weighted_pred_flag; + unsigned char weighted_bipred_flag; + unsigned char transform_skip_enabled_flag; + unsigned char transquant_bypass_enabled_flag; + unsigned char entropy_coding_sync_enabled_flag; + unsigned char log2_parallel_merge_level_minus2; + unsigned char num_extra_slice_header_bits; + + unsigned char loop_filter_across_tiles_enabled_flag; + unsigned char loop_filter_across_slices_enabled_flag; + unsigned char output_flag_present_flag; + unsigned char num_ref_idx_l0_default_active_minus1; + unsigned char num_ref_idx_l1_default_active_minus1; + unsigned char lists_modification_present_flag; + unsigned char cabac_init_present_flag; + unsigned char pps_slice_chroma_qp_offsets_present_flag; + + unsigned char deblocking_filter_override_enabled_flag; + unsigned char pps_deblocking_filter_disabled_flag; + signed char pps_beta_offset_div2; + signed char pps_tc_offset_div2; + unsigned char tiles_enabled_flag; + unsigned char uniform_spacing_flag; + unsigned char num_tile_columns_minus1; + unsigned char num_tile_rows_minus1; + + unsigned short column_width_minus1[21]; + unsigned short row_height_minus1[21]; + unsigned int reserved3[15]; + + // RefPicSets + int NumBitsForShortTermRPSInSlice; + int NumDeltaPocsOfRefRpsIdx; + int NumPocTotalCurr; + int NumPocStCurrBefore; + int NumPocStCurrAfter; + int NumPocLtCurr; + int CurrPicOrderCntVal; + int RefPicIdx[16]; // [refpic] Indices of valid reference pictures (-1 if unused for reference) + int PicOrderCntVal[16]; // [refpic] + unsigned char IsLongTerm[16]; // [refpic] 0=not a long-term reference, 1=long-term reference + unsigned char RefPicSetStCurrBefore[8]; // [0..NumPocStCurrBefore-1] -> refpic (0..15) + unsigned char RefPicSetStCurrAfter[8]; // [0..NumPocStCurrAfter-1] -> refpic (0..15) + unsigned char RefPicSetLtCurr[8]; // [0..NumPocLtCurr-1] -> refpic (0..15) + unsigned char RefPicSetInterLayer0[8]; + unsigned char RefPicSetInterLayer1[8]; + unsigned int reserved4[12]; + + // scaling lists (diag order) + unsigned char ScalingList4x4[6][16]; // [matrixId][i] + unsigned char ScalingList8x8[6][64]; // [matrixId][i] + unsigned char ScalingList16x16[6][64]; // [matrixId][i] + unsigned char ScalingList32x32[2][64]; // [matrixId][i] + unsigned char ScalingListDCCoeff16x16[6]; // [matrixId] + unsigned char ScalingListDCCoeff32x32[2]; // [matrixId] +} CUVIDHEVCPICPARAMS; + + +/***********************************************************/ +//! \struct CUVIDVP8PICPARAMS +//! VP8 picture parameters +//! This structure is used in CUVIDPICPARAMS structure +/***********************************************************/ +typedef struct _CUVIDVP8PICPARAMS +{ + int width; + int height; + unsigned int first_partition_size; + //Frame Indexes + unsigned char LastRefIdx; + unsigned char GoldenRefIdx; + unsigned char AltRefIdx; + union { + struct { + unsigned char frame_type : 1; /**< 0 = KEYFRAME, 1 = INTERFRAME */ + unsigned char version : 3; + unsigned char show_frame : 1; + unsigned char update_mb_segmentation_data : 1; /**< Must be 0 if segmentation is not enabled */ + unsigned char Reserved2Bits : 2; + }; + unsigned char wFrameTagFlags; + }; + unsigned char Reserved1[4]; + unsigned int Reserved2[3]; +} CUVIDVP8PICPARAMS; + +/***********************************************************/ +//! \struct CUVIDVP9PICPARAMS +//! VP9 picture parameters +//! This structure is used in CUVIDPICPARAMS structure +/***********************************************************/ +typedef struct _CUVIDVP9PICPARAMS +{ + unsigned int width; + unsigned int height; + + //Frame Indices + unsigned char LastRefIdx; + unsigned char GoldenRefIdx; + unsigned char AltRefIdx; + unsigned char colorSpace; + + unsigned short profile : 3; + unsigned short frameContextIdx : 2; + unsigned short frameType : 1; + unsigned short showFrame : 1; + unsigned short errorResilient : 1; + unsigned short frameParallelDecoding : 1; + unsigned short subSamplingX : 1; + unsigned short subSamplingY : 1; + unsigned short intraOnly : 1; + unsigned short allow_high_precision_mv : 1; + unsigned short refreshEntropyProbs : 1; + unsigned short reserved2Bits : 2; + + unsigned short reserved16Bits; + + unsigned char refFrameSignBias[4]; + + unsigned char bitDepthMinus8Luma; + unsigned char bitDepthMinus8Chroma; + unsigned char loopFilterLevel; + unsigned char loopFilterSharpness; + + unsigned char modeRefLfEnabled; + unsigned char log2_tile_columns; + unsigned char log2_tile_rows; + + unsigned char segmentEnabled : 1; + unsigned char segmentMapUpdate : 1; + unsigned char segmentMapTemporalUpdate : 1; + unsigned char segmentFeatureMode : 1; + unsigned char reserved4Bits : 4; + + + unsigned char segmentFeatureEnable[8][4]; + short segmentFeatureData[8][4]; + unsigned char mb_segment_tree_probs[7]; + unsigned char segment_pred_probs[3]; + unsigned char reservedSegment16Bits[2]; + + int qpYAc; + int qpYDc; + int qpChDc; + int qpChAc; + + unsigned int activeRefIdx[3]; + unsigned int resetFrameContext; + unsigned int mcomp_filter_type; + unsigned int mbRefLfDelta[4]; + unsigned int mbModeLfDelta[2]; + unsigned int frameTagSize; + unsigned int offsetToDctParts; + unsigned int reserved128Bits[4]; + +} CUVIDVP9PICPARAMS; + + +/******************************************************************************************/ +//! \struct CUVIDPICPARAMS +//! Picture parameters for decoding +//! This structure is used in cuvidDecodePicture API +//! IN for cuvidDecodePicture +/******************************************************************************************/ +typedef struct _CUVIDPICPARAMS +{ + int PicWidthInMbs; /**< IN: Coded frame size in macroblocks */ + int FrameHeightInMbs; /**< IN: Coded frame height in macroblocks */ + int CurrPicIdx; /**< IN: Output index of the current picture */ + int field_pic_flag; /**< IN: 0=frame picture, 1=field picture */ + int bottom_field_flag; /**< IN: 0=top field, 1=bottom field (ignored if field_pic_flag=0) */ + int second_field; /**< IN: Second field of a complementary field pair */ + // Bitstream data + unsigned int nBitstreamDataLen; /**< IN: Number of bytes in bitstream data buffer */ + const unsigned char *pBitstreamData; /**< IN: Ptr to bitstream data for this picture (slice-layer) */ + unsigned int nNumSlices; /**< IN: Number of slices in this picture */ + const unsigned int *pSliceDataOffsets; /**< IN: nNumSlices entries, contains offset of each slice within + the bitstream data buffer */ + int ref_pic_flag; /**< IN: This picture is a reference picture */ + int intra_pic_flag; /**< IN: This picture is entirely intra coded */ + unsigned int Reserved[30]; /**< Reserved for future use */ + // IN: Codec-specific data + union { + CUVIDMPEG2PICPARAMS mpeg2; /**< Also used for MPEG-1 */ + CUVIDH264PICPARAMS h264; + CUVIDVC1PICPARAMS vc1; + CUVIDMPEG4PICPARAMS mpeg4; + CUVIDJPEGPICPARAMS jpeg; + CUVIDHEVCPICPARAMS hevc; + CUVIDVP8PICPARAMS vp8; + CUVIDVP9PICPARAMS vp9; + unsigned int CodecReserved[1024]; + } CodecSpecific; +} CUVIDPICPARAMS; + + +/******************************************************/ +//! \struct CUVIDPROCPARAMS +//! Picture parameters for postprocessing +//! This structure is used in cuvidMapVideoFrame API +/******************************************************/ +typedef struct _CUVIDPROCPARAMS +{ + int progressive_frame; /**< IN: Input is progressive (deinterlace_mode will be ignored) */ + int second_field; /**< IN: Output the second field (ignored if deinterlace mode is Weave) */ + int top_field_first; /**< IN: Input frame is top field first (1st field is top, 2nd field is bottom) */ + int unpaired_field; /**< IN: Input only contains one field (2nd field is invalid) */ + // The fields below are used for raw YUV input + unsigned int reserved_flags; /**< Reserved for future use (set to zero) */ + unsigned int reserved_zero; /**< Reserved (set to zero) */ + unsigned long long raw_input_dptr; /**< IN: Input CUdeviceptr for raw YUV extensions */ + unsigned int raw_input_pitch; /**< IN: pitch in bytes of raw YUV input (should be aligned appropriately) */ + unsigned int raw_input_format; /**< IN: Input YUV format (cudaVideoCodec_enum) */ + unsigned long long raw_output_dptr; /**< IN: Output CUdeviceptr for raw YUV extensions */ + unsigned int raw_output_pitch; /**< IN: pitch in bytes of raw YUV output (should be aligned appropriately) */ + unsigned int Reserved1; /**< Reserved for future use (set to zero) */ + CUstream output_stream; /**< IN: stream object used by cuvidMapVideoFrame */ + unsigned int Reserved[46]; /**< Reserved for future use (set to zero) */ + void *Reserved2[2]; /**< Reserved for future use (set to zero) */ +} CUVIDPROCPARAMS; + + +/***********************************************************************************************************/ +//! VIDEO_DECODER +//! +//! In order to minimize decode latencies, there should be always at least 2 pictures in the decode +//! queue at any time, in order to make sure that all decode engines are always busy. +//! +//! Overall data flow: +//! - cuvidGetDecoderCaps(...) +//! - cuvidCreateDecoder(...) +//! - For each picture: +//! + cuvidDecodePicture(N) +//! + cuvidMapVideoFrame(N-4) +//! + do some processing in cuda +//! + cuvidUnmapVideoFrame(N-4) +//! + cuvidDecodePicture(N+1) +//! + cuvidMapVideoFrame(N-3) +//! + ... +//! - cuvidDestroyDecoder(...) +//! +//! NOTE: +//! - When the cuda context is created from a D3D device, the D3D device must also be created +//! with the D3DCREATE_MULTITHREADED flag. +//! - There is a limit to how many pictures can be mapped simultaneously (ulNumOutputSurfaces) +//! - cuvidDecodePicture may block the calling thread if there are too many pictures pending +//! in the decode queue +/***********************************************************************************************************/ + + +/**********************************************************************************************************************/ +//! \fn CUresult CUDAAPI cuvidGetDecoderCaps(CUVIDDECODECAPS *pdc) +//! Queries decode capabilities of NVDEC-HW based on CodecType, ChromaFormat and BitDepthMinus8 parameters. +//! 1. Application fills IN parameters CodecType, ChromaFormat and BitDepthMinus8 of CUVIDDECODECAPS structure +//! 2. On calling cuvidGetDecoderCaps, driver fills OUT parameters if the IN parameters are supported +//! If IN parameters passed to the driver are not supported by NVDEC-HW, then all OUT params are set to 0. +//! E.g. on Geforce GTX 960: +//! App fills - eCodecType = cudaVideoCodec_H264; eChromaFormat = cudaVideoChromaFormat_420; nBitDepthMinus8 = 0; +//! Given IN parameters are supported, hence driver fills: bIsSupported = 1; nMinWidth = 48; nMinHeight = 16; +//! nMaxWidth = 4096; nMaxHeight = 4096; nMaxMBCount = 65536; +//! CodedWidth*CodedHeight/256 must be less than or equal to nMaxMBCount +/**********************************************************************************************************************/ +typedef CUresult CUDAAPI tcuvidGetDecoderCaps(CUVIDDECODECAPS *pdc); + +/********************************************************************************************************************/ +//! \fn CUresult CUDAAPI cuvidCreateDecoder(CUvideodecoder *phDecoder, CUVIDDECODECREATEINFO *pdci) +//! Create the decoder object based on pdci. A handle to the created decoder is returned +/********************************************************************************************************************/ +typedef CUresult CUDAAPI tcuvidCreateDecoder(CUvideodecoder *phDecoder, CUVIDDECODECREATEINFO *pdci); +/********************************************************************************************************************/ +//! \fn CUresult CUDAAPI cuvidDestroyDecoder(CUvideodecoder hDecoder) +//! Destroy the decoder object. +/********************************************************************************************************************/ +typedef CUresult CUDAAPI tcuvidDestroyDecoder(CUvideodecoder hDecoder); + +/********************************************************************************************************************/ +//! \fn CUresult CUDAAPI cuvidDecodePicture(CUvideodecoder hDecoder, CUVIDPICPARAMS *pPicParams) +//! Decode a single picture (field or frame) +//! Kicks off HW decoding +/********************************************************************************************************************/ +typedef CUresult CUDAAPI tcuvidDecodePicture(CUvideodecoder hDecoder, CUVIDPICPARAMS *pPicParams); + + +#if !defined(__CUVID_DEVPTR64) || defined(__CUVID_INTERNAL) +/************************************************************************************************************************/ +//! \fn CUresult CUDAAPI cuvidMapVideoFrame(CUvideodecoder hDecoder, int nPicIdx, unsigned int *pDevPtr, +//! unsigned int *pPitch, CUVIDPROCPARAMS *pVPP); +//! Post-process and map video frame corresponding to nPicIdx for use in cuda. Returns cuda device pointer and associated +//! pitch of the video frame +/************************************************************************************************************************/ +typedef CUresult CUDAAPI tcuvidMapVideoFrame(CUvideodecoder hDecoder, int nPicIdx, + unsigned int *pDevPtr, unsigned int *pPitch, + CUVIDPROCPARAMS *pVPP); + +/********************************************************************************************************************/ +//! \fn CUresult CUDAAPI cuvidUnmapVideoFrame(CUvideodecoder hDecoder, unsigned int DevPtr) +//! Unmap a previously mapped video frame +/********************************************************************************************************************/ +typedef CUresult CUDAAPI tcuvidUnmapVideoFrame(CUvideodecoder hDecoder, unsigned int DevPtr); +#endif + +#if defined(_WIN64) || defined(__LP64__) || defined(__x86_64) || defined(AMD64) || defined(_M_AMD64) +/************************************************************************************************************************/ +//! \fn CUresult CUDAAPI cuvidMapVideoFrame64(CUvideodecoder hDecoder, int nPicIdx, unsigned long long *pDevPtr, +//! unsigned int *pPitch, CUVIDPROCPARAMS *pVPP); +//! Post-process and map video frame corresponding to nPicIdx for use in cuda. Returns cuda device pointer and associated +//! pitch of the video frame +/************************************************************************************************************************/ +typedef CUresult CUDAAPI tcuvidMapVideoFrame64(CUvideodecoder hDecoder, int nPicIdx, unsigned long long *pDevPtr, + unsigned int *pPitch, CUVIDPROCPARAMS *pVPP); + +/********************************************************************************************************************/ +//! \fn CUresult CUDAAPI cuvidUnmapVideoFrame64(CUvideodecoder hDecoder, unsigned long long DevPtr); +//! Unmap a previously mapped video frame +/********************************************************************************************************************/ +typedef CUresult CUDAAPI tcuvidUnmapVideoFrame64(CUvideodecoder hDecoder, unsigned long long DevPtr); + +#if defined(__CUVID_DEVPTR64) && !defined(__CUVID_INTERNAL) +#define tcuvidMapVideoFrame tcuvidMapVideoFrame64 +#define tcuvidUnmapVideoFrame tcuvidUnmapVideoFrame64 +#endif +#endif + + + +/********************************************************************************************************************/ +//! +//! Context-locking: to facilitate multi-threaded implementations, the following 4 functions +//! provide a simple mutex-style host synchronization. If a non-NULL context is specified +//! in CUVIDDECODECREATEINFO, the codec library will acquire the mutex associated with the given +//! context before making any cuda calls. +//! A multi-threaded application could create a lock associated with a context handle so that +//! multiple threads can safely share the same cuda context: +//! - use cuCtxPopCurrent immediately after context creation in order to create a 'floating' context +//! that can be passed to cuvidCtxLockCreate. +//! - When using a floating context, all cuda calls should only be made within a cuvidCtxLock/cuvidCtxUnlock section. +//! +//! NOTE: This is a safer alternative to cuCtxPushCurrent and cuCtxPopCurrent, and is not related to video +//! decoder in any way (implemented as a critical section associated with cuCtx{Push|Pop}Current calls). +/********************************************************************************************************************/ + +/********************************************************************************************************************/ +//! \fn CUresult CUDAAPI cuvidCtxLockCreate(CUvideoctxlock *pLock, CUcontext ctx) +//! This API is used to create CtxLock object +/********************************************************************************************************************/ +typedef CUresult CUDAAPI tcuvidCtxLockCreate(CUvideoctxlock *pLock, CUcontext ctx); + +/********************************************************************************************************************/ +//! \fn CUresult CUDAAPI cuvidCtxLockDestroy(CUvideoctxlock lck) +//! This API is used to free CtxLock object +/********************************************************************************************************************/ +typedef CUresult CUDAAPI tcuvidCtxLockDestroy(CUvideoctxlock lck); + +/********************************************************************************************************************/ +//! \fn CUresult CUDAAPI cuvidCtxLock(CUvideoctxlock lck, unsigned int reserved_flags) +//! This API is used to acquire ctxlock +/********************************************************************************************************************/ +typedef CUresult CUDAAPI tcuvidCtxLock(CUvideoctxlock lck, unsigned int reserved_flags); + +/********************************************************************************************************************/ +//! \fn CUresult CUDAAPI cuvidCtxUnlock(CUvideoctxlock lck, unsigned int reserved_flags) +//! This API is used to release ctxlock +/********************************************************************************************************************/ +typedef CUresult CUDAAPI tcuvidCtxUnlock(CUvideoctxlock lck, unsigned int reserved_flags); + +/**********************************************************************************************/ + +#if defined(__cplusplus) +} +#endif /* __cplusplus */ + +#endif // __CUDA_VIDEO_H__ diff --git a/mythtv/external/FFmpeg/compat/cuda/dynlink_loader.h b/mythtv/external/FFmpeg/compat/cuda/dynlink_loader.h new file mode 100644 index 00000000000..7d2c87449e1 --- /dev/null +++ b/mythtv/external/FFmpeg/compat/cuda/dynlink_loader.h @@ -0,0 +1,268 @@ +/* + * This copyright notice applies to this header file only: + * + * Copyright (c) 2016 + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the software, and to permit persons to whom the + * software is furnished to do so, subject to the following + * conditions: + * + * 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. + */ + +#ifndef AV_COMPAT_CUDA_DYNLINK_LOADER_H +#define AV_COMPAT_CUDA_DYNLINK_LOADER_H + +#include "compat/cuda/dynlink_cuda.h" +#include "compat/cuda/dynlink_nvcuvid.h" +#include "compat/nvenc/nvEncodeAPI.h" +#include "compat/w32dlfcn.h" + +#include "libavutil/log.h" +#include "libavutil/error.h" + +#if defined(_WIN32) +# define LIB_HANDLE HMODULE +#else +# define LIB_HANDLE void* +#endif + +#if defined(_WIN32) || defined(__CYGWIN__) +# define CUDA_LIBNAME "nvcuda.dll" +# define NVCUVID_LIBNAME "nvcuvid.dll" +# if ARCH_X86_64 +# define NVENC_LIBNAME "nvEncodeAPI64.dll" +# else +# define NVENC_LIBNAME "nvEncodeAPI.dll" +# endif +#else +# define CUDA_LIBNAME "libcuda.so.1" +# define NVCUVID_LIBNAME "libnvcuvid.so.1" +# define NVENC_LIBNAME "libnvidia-encode.so.1" +#endif + +#define LOAD_LIBRARY(l, path) \ + do { \ + if (!((l) = dlopen(path, RTLD_LAZY))) { \ + av_log(NULL, AV_LOG_ERROR, "Cannot load %s\n", path); \ + ret = AVERROR_UNKNOWN; \ + goto error; \ + } \ + av_log(NULL, AV_LOG_TRACE, "Loaded lib: %s\n", path); \ + } while (0) + +#define LOAD_SYMBOL(fun, tp, symbol) \ + do { \ + if (!((f->fun) = (tp*)dlsym(f->lib, symbol))) { \ + av_log(NULL, AV_LOG_ERROR, "Cannot load %s\n", symbol); \ + ret = AVERROR_UNKNOWN; \ + goto error; \ + } \ + av_log(NULL, AV_LOG_TRACE, "Loaded sym: %s\n", symbol); \ + } while (0) + +#define LOAD_SYMBOL_OPT(fun, tp, symbol) \ + do { \ + if (!((f->fun) = (tp*)dlsym(f->lib, symbol))) { \ + av_log(NULL, AV_LOG_DEBUG, "Cannot load optional %s\n", symbol); \ + } else { \ + av_log(NULL, AV_LOG_TRACE, "Loaded sym: %s\n", symbol); \ + } \ + } while (0) + +#define GENERIC_LOAD_FUNC_PREAMBLE(T, n, N) \ + T *f; \ + int ret; \ + \ + n##_free_functions(functions); \ + \ + f = *functions = av_mallocz(sizeof(*f)); \ + if (!f) \ + return AVERROR(ENOMEM); \ + \ + LOAD_LIBRARY(f->lib, N); + +#define GENERIC_LOAD_FUNC_FINALE(n) \ + return 0; \ +error: \ + n##_free_functions(functions); \ + return ret; + +#define GENERIC_FREE_FUNC() \ + if (!functions) \ + return; \ + if (*functions && (*functions)->lib) \ + dlclose((*functions)->lib); \ + av_freep(functions); + +#ifdef AV_COMPAT_DYNLINK_CUDA_H +typedef struct CudaFunctions { + tcuInit *cuInit; + tcuDeviceGetCount *cuDeviceGetCount; + tcuDeviceGet *cuDeviceGet; + tcuDeviceGetName *cuDeviceGetName; + tcuDeviceComputeCapability *cuDeviceComputeCapability; + tcuCtxCreate_v2 *cuCtxCreate; + tcuCtxPushCurrent_v2 *cuCtxPushCurrent; + tcuCtxPopCurrent_v2 *cuCtxPopCurrent; + tcuCtxDestroy_v2 *cuCtxDestroy; + tcuMemAlloc_v2 *cuMemAlloc; + tcuMemFree_v2 *cuMemFree; + tcuMemcpy2D_v2 *cuMemcpy2D; + tcuGetErrorName *cuGetErrorName; + tcuGetErrorString *cuGetErrorString; + + LIB_HANDLE lib; +} CudaFunctions; +#else +typedef struct CudaFunctions CudaFunctions; +#endif + +typedef struct CuvidFunctions { + tcuvidGetDecoderCaps *cuvidGetDecoderCaps; + tcuvidCreateDecoder *cuvidCreateDecoder; + tcuvidDestroyDecoder *cuvidDestroyDecoder; + tcuvidDecodePicture *cuvidDecodePicture; + tcuvidMapVideoFrame *cuvidMapVideoFrame; + tcuvidUnmapVideoFrame *cuvidUnmapVideoFrame; + tcuvidCtxLockCreate *cuvidCtxLockCreate; + tcuvidCtxLockDestroy *cuvidCtxLockDestroy; + tcuvidCtxLock *cuvidCtxLock; + tcuvidCtxUnlock *cuvidCtxUnlock; + + tcuvidCreateVideoSource *cuvidCreateVideoSource; + tcuvidCreateVideoSourceW *cuvidCreateVideoSourceW; + tcuvidDestroyVideoSource *cuvidDestroyVideoSource; + tcuvidSetVideoSourceState *cuvidSetVideoSourceState; + tcuvidGetVideoSourceState *cuvidGetVideoSourceState; + tcuvidGetSourceVideoFormat *cuvidGetSourceVideoFormat; + tcuvidGetSourceAudioFormat *cuvidGetSourceAudioFormat; + tcuvidCreateVideoParser *cuvidCreateVideoParser; + tcuvidParseVideoData *cuvidParseVideoData; + tcuvidDestroyVideoParser *cuvidDestroyVideoParser; + + LIB_HANDLE lib; +} CuvidFunctions; + +typedef NVENCSTATUS NVENCAPI tNvEncodeAPICreateInstance(NV_ENCODE_API_FUNCTION_LIST *functionList); +typedef NVENCSTATUS NVENCAPI tNvEncodeAPIGetMaxSupportedVersion(uint32_t* version); + +typedef struct NvencFunctions { + tNvEncodeAPICreateInstance *NvEncodeAPICreateInstance; + tNvEncodeAPIGetMaxSupportedVersion *NvEncodeAPIGetMaxSupportedVersion; + + LIB_HANDLE lib; +} NvencFunctions; + +#ifdef AV_COMPAT_DYNLINK_CUDA_H +static inline void cuda_free_functions(CudaFunctions **functions) +{ + GENERIC_FREE_FUNC(); +} +#endif + +static inline void cuvid_free_functions(CuvidFunctions **functions) +{ + GENERIC_FREE_FUNC(); +} + +static inline void nvenc_free_functions(NvencFunctions **functions) +{ + GENERIC_FREE_FUNC(); +} + +#ifdef AV_COMPAT_DYNLINK_CUDA_H +static inline int cuda_load_functions(CudaFunctions **functions) +{ + GENERIC_LOAD_FUNC_PREAMBLE(CudaFunctions, cuda, CUDA_LIBNAME); + + LOAD_SYMBOL(cuInit, tcuInit, "cuInit"); + LOAD_SYMBOL(cuDeviceGetCount, tcuDeviceGetCount, "cuDeviceGetCount"); + LOAD_SYMBOL(cuDeviceGet, tcuDeviceGet, "cuDeviceGet"); + LOAD_SYMBOL(cuDeviceGetName, tcuDeviceGetName, "cuDeviceGetName"); + LOAD_SYMBOL(cuDeviceComputeCapability, tcuDeviceComputeCapability, "cuDeviceComputeCapability"); + LOAD_SYMBOL(cuCtxCreate, tcuCtxCreate_v2, "cuCtxCreate_v2"); + LOAD_SYMBOL(cuCtxPushCurrent, tcuCtxPushCurrent_v2, "cuCtxPushCurrent_v2"); + LOAD_SYMBOL(cuCtxPopCurrent, tcuCtxPopCurrent_v2, "cuCtxPopCurrent_v2"); + LOAD_SYMBOL(cuCtxDestroy, tcuCtxDestroy_v2, "cuCtxDestroy_v2"); + LOAD_SYMBOL(cuMemAlloc, tcuMemAlloc_v2, "cuMemAlloc_v2"); + LOAD_SYMBOL(cuMemFree, tcuMemFree_v2, "cuMemFree_v2"); + LOAD_SYMBOL(cuMemcpy2D, tcuMemcpy2D_v2, "cuMemcpy2D_v2"); + LOAD_SYMBOL(cuGetErrorName, tcuGetErrorName, "cuGetErrorName"); + LOAD_SYMBOL(cuGetErrorString, tcuGetErrorString, "cuGetErrorString"); + + GENERIC_LOAD_FUNC_FINALE(cuda); +} +#endif + +static inline int cuvid_load_functions(CuvidFunctions **functions) +{ + GENERIC_LOAD_FUNC_PREAMBLE(CuvidFunctions, cuvid, NVCUVID_LIBNAME); + + LOAD_SYMBOL_OPT(cuvidGetDecoderCaps, tcuvidGetDecoderCaps, "cuvidGetDecoderCaps"); + LOAD_SYMBOL(cuvidCreateDecoder, tcuvidCreateDecoder, "cuvidCreateDecoder"); + LOAD_SYMBOL(cuvidDestroyDecoder, tcuvidDestroyDecoder, "cuvidDestroyDecoder"); + LOAD_SYMBOL(cuvidDecodePicture, tcuvidDecodePicture, "cuvidDecodePicture"); +#ifdef __CUVID_DEVPTR64 + LOAD_SYMBOL(cuvidMapVideoFrame, tcuvidMapVideoFrame, "cuvidMapVideoFrame64"); + LOAD_SYMBOL(cuvidUnmapVideoFrame, tcuvidUnmapVideoFrame, "cuvidUnmapVideoFrame64"); +#else + LOAD_SYMBOL(cuvidMapVideoFrame, tcuvidMapVideoFrame, "cuvidMapVideoFrame"); + LOAD_SYMBOL(cuvidUnmapVideoFrame, tcuvidUnmapVideoFrame, "cuvidUnmapVideoFrame"); +#endif + LOAD_SYMBOL(cuvidCtxLockCreate, tcuvidCtxLockCreate, "cuvidCtxLockCreate"); + LOAD_SYMBOL(cuvidCtxLockDestroy, tcuvidCtxLockDestroy, "cuvidCtxLockDestroy"); + LOAD_SYMBOL(cuvidCtxLock, tcuvidCtxLock, "cuvidCtxLock"); + LOAD_SYMBOL(cuvidCtxUnlock, tcuvidCtxUnlock, "cuvidCtxUnlock"); + + LOAD_SYMBOL(cuvidCreateVideoSource, tcuvidCreateVideoSource, "cuvidCreateVideoSource"); + LOAD_SYMBOL(cuvidCreateVideoSourceW, tcuvidCreateVideoSourceW, "cuvidCreateVideoSourceW"); + LOAD_SYMBOL(cuvidDestroyVideoSource, tcuvidDestroyVideoSource, "cuvidDestroyVideoSource"); + LOAD_SYMBOL(cuvidSetVideoSourceState, tcuvidSetVideoSourceState, "cuvidSetVideoSourceState"); + LOAD_SYMBOL(cuvidGetVideoSourceState, tcuvidGetVideoSourceState, "cuvidGetVideoSourceState"); + LOAD_SYMBOL(cuvidGetSourceVideoFormat, tcuvidGetSourceVideoFormat, "cuvidGetSourceVideoFormat"); + LOAD_SYMBOL(cuvidGetSourceAudioFormat, tcuvidGetSourceAudioFormat, "cuvidGetSourceAudioFormat"); + LOAD_SYMBOL(cuvidCreateVideoParser, tcuvidCreateVideoParser, "cuvidCreateVideoParser"); + LOAD_SYMBOL(cuvidParseVideoData, tcuvidParseVideoData, "cuvidParseVideoData"); + LOAD_SYMBOL(cuvidDestroyVideoParser, tcuvidDestroyVideoParser, "cuvidDestroyVideoParser"); + + GENERIC_LOAD_FUNC_FINALE(cuvid); +} + +static inline int nvenc_load_functions(NvencFunctions **functions) +{ + GENERIC_LOAD_FUNC_PREAMBLE(NvencFunctions, nvenc, NVENC_LIBNAME); + + LOAD_SYMBOL(NvEncodeAPICreateInstance, tNvEncodeAPICreateInstance, "NvEncodeAPICreateInstance"); + LOAD_SYMBOL(NvEncodeAPIGetMaxSupportedVersion, tNvEncodeAPIGetMaxSupportedVersion, "NvEncodeAPIGetMaxSupportedVersion"); + + GENERIC_LOAD_FUNC_FINALE(nvenc); +} + +#undef GENERIC_LOAD_FUNC_PREAMBLE +#undef LOAD_LIBRARY +#undef LOAD_SYMBOL +#undef GENERIC_LOAD_FUNC_FINALE +#undef GENERIC_FREE_FUNC +#undef CUDA_LIBNAME +#undef NVCUVID_LIBNAME +#undef NVENC_LIBNAME +#undef LIB_HANDLE + +#endif + diff --git a/mythtv/external/FFmpeg/compat/cuda/dynlink_nvcuvid.h b/mythtv/external/FFmpeg/compat/cuda/dynlink_nvcuvid.h new file mode 100644 index 00000000000..87294248e5a --- /dev/null +++ b/mythtv/external/FFmpeg/compat/cuda/dynlink_nvcuvid.h @@ -0,0 +1,356 @@ +/* + * This copyright notice applies to this header file only: + * + * Copyright (c) 2010-2017 NVIDIA Corporation + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the software, and to permit persons to whom the + * software is furnished to do so, subject to the following + * conditions: + * + * 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. + */ + +/********************************************************************************************************************/ +//! \file nvcuvid.h +//! NVDECODE API provides video decoding interface to NVIDIA GPU devices. +//! \date 2015-2017 +//! This file contains the interface constants, structure definitions and function prototypes. +/********************************************************************************************************************/ + +#if !defined(__NVCUVID_H__) +#define __NVCUVID_H__ + +#include "compat/cuda/dynlink_cuviddec.h" + +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus */ + +/********************************* +** Initialization +*********************************/ +CUresult CUDAAPI cuvidInit(unsigned int Flags); + +/***********************************************/ +//! +//! High-level helper APIs for video sources +//! +/***********************************************/ + +typedef void *CUvideosource; +typedef void *CUvideoparser; +typedef long long CUvideotimestamp; + + +/************************************************************************/ +//! \enum cudaVideoState +//! Video source state enums +//! Used in cuvidSetVideoSourceState and cuvidGetVideoSourceState APIs +/************************************************************************/ +typedef enum { + cudaVideoState_Error = -1, /**< Error state (invalid source) */ + cudaVideoState_Stopped = 0, /**< Source is stopped (or reached end-of-stream) */ + cudaVideoState_Started = 1 /**< Source is running and delivering data */ +} cudaVideoState; + +/************************************************************************/ +//! \enum cudaAudioCodec +//! Audio compression enums +//! Used in CUAUDIOFORMAT structure +/************************************************************************/ +typedef enum { + cudaAudioCodec_MPEG1=0, /**< MPEG-1 Audio */ + cudaAudioCodec_MPEG2, /**< MPEG-2 Audio */ + cudaAudioCodec_MP3, /**< MPEG-1 Layer III Audio */ + cudaAudioCodec_AC3, /**< Dolby Digital (AC3) Audio */ + cudaAudioCodec_LPCM, /**< PCM Audio */ + cudaAudioCodec_AAC, /**< AAC Audio */ +} cudaAudioCodec; + +/************************************************************************************************/ +//! \ingroup STRUCTS +//! \struct CUVIDEOFORMAT +//! Video format +//! Used in cuvidGetSourceVideoFormat API +/************************************************************************************************/ +typedef struct +{ + cudaVideoCodec codec; /**< OUT: Compression format */ + /** + * OUT: frame rate = numerator / denominator (for example: 30000/1001) + */ + struct { + /**< OUT: frame rate numerator (0 = unspecified or variable frame rate) */ + unsigned int numerator; + /**< OUT: frame rate denominator (0 = unspecified or variable frame rate) */ + unsigned int denominator; + } frame_rate; + unsigned char progressive_sequence; /**< OUT: 0=interlaced, 1=progressive */ + unsigned char bit_depth_luma_minus8; /**< OUT: high bit depth luma. E.g, 2 for 10-bitdepth, 4 for 12-bitdepth */ + unsigned char bit_depth_chroma_minus8; /**< OUT: high bit depth chroma. E.g, 2 for 10-bitdepth, 4 for 12-bitdepth */ + unsigned char reserved1; /**< Reserved for future use */ + unsigned int coded_width; /**< OUT: coded frame width in pixels */ + unsigned int coded_height; /**< OUT: coded frame height in pixels */ + /** + * area of the frame that should be displayed + * typical example: + * coded_width = 1920, coded_height = 1088 + * display_area = { 0,0,1920,1080 } + */ + struct { + int left; /**< OUT: left position of display rect */ + int top; /**< OUT: top position of display rect */ + int right; /**< OUT: right position of display rect */ + int bottom; /**< OUT: bottom position of display rect */ + } display_area; + cudaVideoChromaFormat chroma_format; /**< OUT: Chroma format */ + unsigned int bitrate; /**< OUT: video bitrate (bps, 0=unknown) */ + /** + * OUT: Display Aspect Ratio = x:y (4:3, 16:9, etc) + */ + struct { + int x; + int y; + } display_aspect_ratio; + /** + * Video Signal Description + * Refer section E.2.1 (VUI parameters semantics) of H264 spec file + */ + struct { + unsigned char video_format : 3; /**< OUT: 0-Component, 1-PAL, 2-NTSC, 3-SECAM, 4-MAC, 5-Unspecified */ + unsigned char video_full_range_flag : 1; /**< OUT: indicates the black level and luma and chroma range */ + unsigned char reserved_zero_bits : 4; /**< Reserved bits */ + unsigned char color_primaries; /**< OUT: chromaticity coordinates of source primaries */ + unsigned char transfer_characteristics; /**< OUT: opto-electronic transfer characteristic of the source picture */ + unsigned char matrix_coefficients; /**< OUT: used in deriving luma and chroma signals from RGB primaries */ + } video_signal_description; + unsigned int seqhdr_data_length; /**< OUT: Additional bytes following (CUVIDEOFORMATEX) */ +} CUVIDEOFORMAT; + +/****************************************************************/ +//! \ingroup STRUCTS +//! \struct CUVIDEOFORMATEX +//! Video format including raw sequence header information +//! Used in cuvidGetSourceVideoFormat API +/****************************************************************/ +typedef struct +{ + CUVIDEOFORMAT format; /**< OUT: CUVIDEOFORMAT structure */ + unsigned char raw_seqhdr_data[1024]; /**< OUT: Sequence header data */ +} CUVIDEOFORMATEX; + +/****************************************************************/ +//! \ingroup STRUCTS +//! \struct CUAUDIOFORMAT +//! Audio formats +//! Used in cuvidGetSourceAudioFormat API +/****************************************************************/ +typedef struct +{ + cudaAudioCodec codec; /**< OUT: Compression format */ + unsigned int channels; /**< OUT: number of audio channels */ + unsigned int samplespersec; /**< OUT: sampling frequency */ + unsigned int bitrate; /**< OUT: For uncompressed, can also be used to determine bits per sample */ + unsigned int reserved1; /**< Reserved for future use */ + unsigned int reserved2; /**< Reserved for future use */ +} CUAUDIOFORMAT; + + +/***************************************************************/ +//! \enum CUvideopacketflags +//! Data packet flags +//! Used in CUVIDSOURCEDATAPACKET structure +/***************************************************************/ +typedef enum { + CUVID_PKT_ENDOFSTREAM = 0x01, /**< Set when this is the last packet for this stream */ + CUVID_PKT_TIMESTAMP = 0x02, /**< Timestamp is valid */ + CUVID_PKT_DISCONTINUITY = 0x04, /**< Set when a discontinuity has to be signalled */ + CUVID_PKT_ENDOFPICTURE = 0x08, /**< Set when the packet contains exactly one frame */ +} CUvideopacketflags; + +/*****************************************************************************/ +//! \ingroup STRUCTS +//! \struct CUVIDSOURCEDATAPACKET +//! Data Packet +//! Used in cuvidParseVideoData API +//! IN for cuvidParseVideoData +/*****************************************************************************/ +typedef struct _CUVIDSOURCEDATAPACKET +{ + tcu_ulong flags; /**< IN: Combination of CUVID_PKT_XXX flags */ + tcu_ulong payload_size; /**< IN: number of bytes in the payload (may be zero if EOS flag is set) */ + const unsigned char *payload; /**< IN: Pointer to packet payload data (may be NULL if EOS flag is set) */ + CUvideotimestamp timestamp; /**< IN: Presentation time stamp (10MHz clock), only valid if + CUVID_PKT_TIMESTAMP flag is set */ +} CUVIDSOURCEDATAPACKET; + +// Callback for packet delivery +typedef int (CUDAAPI *PFNVIDSOURCECALLBACK)(void *, CUVIDSOURCEDATAPACKET *); + +/**************************************************************************************************************************/ +//! \ingroup STRUCTS +//! \struct CUVIDSOURCEPARAMS +//! Describes parameters needed in cuvidCreateVideoSource API +//! NVDECODE API is intended for HW accelerated video decoding so CUvideosource doesn't have audio demuxer for all supported +//! containers. It's recommended to clients to use their own or third party demuxer if audio support is needed. +/**************************************************************************************************************************/ +typedef struct _CUVIDSOURCEPARAMS +{ + unsigned int ulClockRate; /**< IN: Time stamp units in Hz (0=default=10000000Hz) */ + unsigned int uReserved1[7]; /**< Reserved for future use - set to zero */ + void *pUserData; /**< IN: User private data passed in to the data handlers */ + PFNVIDSOURCECALLBACK pfnVideoDataHandler; /**< IN: Called to deliver video packets */ + PFNVIDSOURCECALLBACK pfnAudioDataHandler; /**< IN: Called to deliver audio packets. */ + void *pvReserved2[8]; /**< Reserved for future use - set to NULL */ +} CUVIDSOURCEPARAMS; + + +/**********************************************/ +//! \ingroup ENUMS +//! \enum CUvideosourceformat_flags +//! CUvideosourceformat_flags +//! Used in cuvidGetSourceVideoFormat API +/**********************************************/ +typedef enum { + CUVID_FMT_EXTFORMATINFO = 0x100 /**< Return extended format structure (CUVIDEOFORMATEX) */ +} CUvideosourceformat_flags; + +#if !defined(__APPLE__) +/**************************************************************************************************************************/ +//! \fn CUresult CUDAAPI cuvidCreateVideoSource(CUvideosource *pObj, const char *pszFileName, CUVIDSOURCEPARAMS *pParams) +//! Create CUvideosource object. CUvideosource spawns demultiplexer thread that provides two callbacks: +//! pfnVideoDataHandler() and pfnAudioDataHandler() +//! NVDECODE API is intended for HW accelerated video decoding so CUvideosource doesn't have audio demuxer for all supported +//! containers. It's recommended to clients to use their own or third party demuxer if audio support is needed. +/**************************************************************************************************************************/ +typedef CUresult CUDAAPI tcuvidCreateVideoSource(CUvideosource *pObj, const char *pszFileName, CUVIDSOURCEPARAMS *pParams); + +/****************************************************************************************************************************/ +//! \fn CUresult CUDAAPI cuvidCreateVideoSourceW(CUvideosource *pObj, const wchar_t *pwszFileName, CUVIDSOURCEPARAMS *pParams) +//! Create video source object and initialize +/****************************************************************************************************************************/ +typedef CUresult CUDAAPI tcuvidCreateVideoSourceW(CUvideosource *pObj, const wchar_t *pwszFileName, CUVIDSOURCEPARAMS *pParams); + +/*********************************************************************/ +//! \fn CUresult CUDAAPI cuvidDestroyVideoSource(CUvideosource obj) +//! Destroy video source +/*********************************************************************/ +typedef CUresult CUDAAPI tcuvidDestroyVideoSource(CUvideosource obj); + +/******************************************************************************************/ +//! \fn CUresult CUDAAPI cuvidSetVideoSourceState(CUvideosource obj, cudaVideoState state) +//! Set video source state +/******************************************************************************************/ +typedef CUresult CUDAAPI tcuvidSetVideoSourceState(CUvideosource obj, cudaVideoState state); + +/******************************************************************************************/ +//! \fn cudaVideoState CUDAAPI cuvidGetVideoSourceState(CUvideosource obj) +//! Get video source state +/******************************************************************************************/ +typedef cudaVideoState CUDAAPI tcuvidGetVideoSourceState(CUvideosource obj); + +/****************************************************************************************************************/ +//! \fn CUresult CUDAAPI cuvidGetSourceVideoFormat(CUvideosource obj, CUVIDEOFORMAT *pvidfmt, unsigned int flags) +//! Gets details of video stream in pvidfmt +/****************************************************************************************************************/ +typedef CUresult CUDAAPI tcuvidGetSourceVideoFormat(CUvideosource obj, CUVIDEOFORMAT *pvidfmt, unsigned int flags); + +/****************************************************************************************************************/ +//! \fn CUresult CUDAAPI cuvidGetSourceAudioFormat(CUvideosource obj, CUAUDIOFORMAT *paudfmt, unsigned int flags) +//! Get audio source format +//! NVDECODE API is intended for HW accelarated video decoding so CUvideosource doesn't have audio demuxer for all suppported +//! containers. It's recommended to clients to use their own or third party demuxer if audio support is needed. +/****************************************************************************************************************/ +typedef CUresult CUDAAPI tcuvidGetSourceAudioFormat(CUvideosource obj, CUAUDIOFORMAT *paudfmt, unsigned int flags); + +#endif +/**********************************************************************************/ +//! \ingroup STRUCTS +//! \struct CUVIDPARSERDISPINFO +//! Used in cuvidParseVideoData API with PFNVIDDISPLAYCALLBACK pfnDisplayPicture +/**********************************************************************************/ +typedef struct _CUVIDPARSERDISPINFO +{ + int picture_index; /**< OUT: Index of the current picture */ + int progressive_frame; /**< OUT: 1 if progressive frame; 0 otherwise */ + int top_field_first; /**< OUT: 1 if top field is displayed first; 0 otherwise */ + int repeat_first_field; /**< OUT: Number of additional fields (1=ivtc, 2=frame doubling, 4=frame tripling, + -1=unpaired field) */ + CUvideotimestamp timestamp; /**< OUT: Presentation time stamp */ +} CUVIDPARSERDISPINFO; + +/***********************************************************************************************************************/ +//! Parser callbacks +//! The parser will call these synchronously from within cuvidParseVideoData(), whenever a picture is ready to +//! be decoded and/or displayed. First argument in functions is "void *pUserData" member of structure CUVIDSOURCEPARAMS +/***********************************************************************************************************************/ +typedef int (CUDAAPI *PFNVIDSEQUENCECALLBACK)(void *, CUVIDEOFORMAT *); +typedef int (CUDAAPI *PFNVIDDECODECALLBACK)(void *, CUVIDPICPARAMS *); +typedef int (CUDAAPI *PFNVIDDISPLAYCALLBACK)(void *, CUVIDPARSERDISPINFO *); + +/**************************************/ +//! \ingroup STRUCTS +//! \struct CUVIDPARSERPARAMS +//! Used in cuvidCreateVideoParser API +/**************************************/ +typedef struct _CUVIDPARSERPARAMS +{ + cudaVideoCodec CodecType; /**< IN: cudaVideoCodec_XXX */ + unsigned int ulMaxNumDecodeSurfaces; /**< IN: Max # of decode surfaces (parser will cycle through these) */ + unsigned int ulClockRate; /**< IN: Timestamp units in Hz (0=default=10000000Hz) */ + unsigned int ulErrorThreshold; /**< IN: % Error threshold (0-100) for calling pfnDecodePicture (100=always + IN: call pfnDecodePicture even if picture bitstream is fully corrupted) */ + unsigned int ulMaxDisplayDelay; /**< IN: Max display queue delay (improves pipelining of decode with display) + 0=no delay (recommended values: 2..4) */ + unsigned int uReserved1[5]; /**< IN: Reserved for future use - set to 0 */ + void *pUserData; /**< IN: User data for callbacks */ + PFNVIDSEQUENCECALLBACK pfnSequenceCallback; /**< IN: Called before decoding frames and/or whenever there is a fmt change */ + PFNVIDDECODECALLBACK pfnDecodePicture; /**< IN: Called when a picture is ready to be decoded (decode order) */ + PFNVIDDISPLAYCALLBACK pfnDisplayPicture; /**< IN: Called whenever a picture is ready to be displayed (display order) */ + void *pvReserved2[7]; /**< Reserved for future use - set to NULL */ + CUVIDEOFORMATEX *pExtVideoInfo; /**< IN: [Optional] sequence header data from system layer */ +} CUVIDPARSERPARAMS; + +/************************************************************************************************/ +//! \fn CUresult CUDAAPI cuvidCreateVideoParser(CUvideoparser *pObj, CUVIDPARSERPARAMS *pParams) +//! Create video parser object and initialize +/************************************************************************************************/ +typedef CUresult CUDAAPI tcuvidCreateVideoParser(CUvideoparser *pObj, CUVIDPARSERPARAMS *pParams); + +/************************************************************************************************/ +//! \fn CUresult CUDAAPI cuvidParseVideoData(CUvideoparser obj, CUVIDSOURCEDATAPACKET *pPacket) +//! Parse the video data from source data packet in pPacket +//! Extracts parameter sets like SPS, PPS, bitstream etc. from pPacket and +//! calls back pfnDecodePicture with CUVIDPICPARAMS data for kicking of HW decoding +/************************************************************************************************/ +typedef CUresult CUDAAPI tcuvidParseVideoData(CUvideoparser obj, CUVIDSOURCEDATAPACKET *pPacket); + +/*******************************************************************/ +//! \fn CUresult CUDAAPI cuvidDestroyVideoParser(CUvideoparser obj) +/*******************************************************************/ +typedef CUresult CUDAAPI tcuvidDestroyVideoParser(CUvideoparser obj); + +/**********************************************************************************************/ + +#if defined(__cplusplus) +} +#endif /* __cplusplus */ + +#endif // __NVCUVID_H__ + + diff --git a/mythtv/external/FFmpeg/compat/cuda/nvcuvid.h b/mythtv/external/FFmpeg/compat/cuda/nvcuvid.h deleted file mode 100644 index 738d8e38d5b..00000000000 --- a/mythtv/external/FFmpeg/compat/cuda/nvcuvid.h +++ /dev/null @@ -1,321 +0,0 @@ -/* - * This copyright notice applies to this header file only: - * - * Copyright (c) 2010-2016 NVIDIA Corporation - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the software, and to permit persons to whom the - * software is furnished to do so, subject to the following - * conditions: - * - * 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. - */ - -/** - * \file nvcuvid.h - * NvCuvid API provides Video Decoding interface to NVIDIA GPU devices. - * \date 2015-2015 - * This file contains the interface constants, structure definitions and function prototypes. - */ - -#if !defined(__NVCUVID_H__) -#define __NVCUVID_H__ - -#include "compat/cuda/cuviddec.h" - -#if defined(__cplusplus) -extern "C" { -#endif /* __cplusplus */ - -/********************************* -** Initialization -*********************************/ -CUresult CUDAAPI cuvidInit(unsigned int Flags); - -//////////////////////////////////////////////////////////////////////////////////////////////// -// -// High-level helper APIs for video sources -// - -typedef void *CUvideosource; -typedef void *CUvideoparser; -typedef long long CUvideotimestamp; - -/** - * \addtogroup VIDEO_PARSER Video Parser - * @{ - */ - -/*! - * \enum cudaVideoState - * Video Source State - */ -typedef enum { - cudaVideoState_Error = -1, /**< Error state (invalid source) */ - cudaVideoState_Stopped = 0, /**< Source is stopped (or reached end-of-stream) */ - cudaVideoState_Started = 1 /**< Source is running and delivering data */ -} cudaVideoState; - -/*! - * \enum cudaAudioCodec - * Audio compression - */ -typedef enum { - cudaAudioCodec_MPEG1=0, /**< MPEG-1 Audio */ - cudaAudioCodec_MPEG2, /**< MPEG-2 Audio */ - cudaAudioCodec_MP3, /**< MPEG-1 Layer III Audio */ - cudaAudioCodec_AC3, /**< Dolby Digital (AC3) Audio */ - cudaAudioCodec_LPCM /**< PCM Audio */ -} cudaAudioCodec; - -/*! - * \struct CUVIDEOFORMAT - * Video format - */ -typedef struct -{ - cudaVideoCodec codec; /**< Compression format */ - /** - * frame rate = numerator / denominator (for example: 30000/1001) - */ - struct { - unsigned int numerator; /**< frame rate numerator (0 = unspecified or variable frame rate) */ - unsigned int denominator; /**< frame rate denominator (0 = unspecified or variable frame rate) */ - } frame_rate; - unsigned char progressive_sequence; /**< 0=interlaced, 1=progressive */ - unsigned char bit_depth_luma_minus8; /**< high bit depth Luma */ - unsigned char bit_depth_chroma_minus8; /**< high bit depth Chroma */ - unsigned char reserved1; /**< Reserved for future use */ - unsigned int coded_width; /**< coded frame width */ - unsigned int coded_height; /**< coded frame height */ - /** - * area of the frame that should be displayed - * typical example: - * coded_width = 1920, coded_height = 1088 - * display_area = { 0,0,1920,1080 } - */ - struct { - int left; /**< left position of display rect */ - int top; /**< top position of display rect */ - int right; /**< right position of display rect */ - int bottom; /**< bottom position of display rect */ - } display_area; - cudaVideoChromaFormat chroma_format; /**< Chroma format */ - unsigned int bitrate; /**< video bitrate (bps, 0=unknown) */ - /** - * Display Aspect Ratio = x:y (4:3, 16:9, etc) - */ - struct { - int x; - int y; - } display_aspect_ratio; - /** - * Video Signal Description - */ - struct { - unsigned char video_format : 3; - unsigned char video_full_range_flag : 1; - unsigned char reserved_zero_bits : 4; - unsigned char color_primaries; - unsigned char transfer_characteristics; - unsigned char matrix_coefficients; - } video_signal_description; - unsigned int seqhdr_data_length; /**< Additional bytes following (CUVIDEOFORMATEX) */ -} CUVIDEOFORMAT; - -/*! - * \struct CUVIDEOFORMATEX - * Video format including raw sequence header information - */ -typedef struct -{ - CUVIDEOFORMAT format; - unsigned char raw_seqhdr_data[1024]; -} CUVIDEOFORMATEX; - -/*! - * \struct CUAUDIOFORMAT - * Audio Formats - */ -typedef struct -{ - cudaAudioCodec codec; /**< Compression format */ - unsigned int channels; /**< number of audio channels */ - unsigned int samplespersec; /**< sampling frequency */ - unsigned int bitrate; /**< For uncompressed, can also be used to determine bits per sample */ - unsigned int reserved1; /**< Reserved for future use */ - unsigned int reserved2; /**< Reserved for future use */ -} CUAUDIOFORMAT; - - -/*! - * \enum CUvideopacketflags - * Data packet flags - */ -typedef enum { - CUVID_PKT_ENDOFSTREAM = 0x01, /**< Set when this is the last packet for this stream */ - CUVID_PKT_TIMESTAMP = 0x02, /**< Timestamp is valid */ - CUVID_PKT_DISCONTINUITY = 0x04 /**< Set when a discontinuity has to be signalled */ -} CUvideopacketflags; - -/*! - * \struct CUVIDSOURCEDATAPACKET - * Data Packet - */ -typedef struct _CUVIDSOURCEDATAPACKET -{ - unsigned long flags; /**< Combination of CUVID_PKT_XXX flags */ - unsigned long payload_size; /**< number of bytes in the payload (may be zero if EOS flag is set) */ - const unsigned char *payload; /**< Pointer to packet payload data (may be NULL if EOS flag is set) */ - CUvideotimestamp timestamp; /**< Presentation timestamp (10MHz clock), only valid if CUVID_PKT_TIMESTAMP flag is set */ -} CUVIDSOURCEDATAPACKET; - -// Callback for packet delivery -typedef int (CUDAAPI *PFNVIDSOURCECALLBACK)(void *, CUVIDSOURCEDATAPACKET *); - -/*! - * \struct CUVIDSOURCEPARAMS - * Source Params - */ -typedef struct _CUVIDSOURCEPARAMS -{ - unsigned int ulClockRate; /**< Timestamp units in Hz (0=default=10000000Hz) */ - unsigned int uReserved1[7]; /**< Reserved for future use - set to zero */ - void *pUserData; /**< Parameter passed in to the data handlers */ - PFNVIDSOURCECALLBACK pfnVideoDataHandler; /**< Called to deliver audio packets */ - PFNVIDSOURCECALLBACK pfnAudioDataHandler; /**< Called to deliver video packets */ - void *pvReserved2[8]; /**< Reserved for future use - set to NULL */ -} CUVIDSOURCEPARAMS; - -/*! - * \enum CUvideosourceformat_flags - * CUvideosourceformat_flags - */ -typedef enum { - CUVID_FMT_EXTFORMATINFO = 0x100 /**< Return extended format structure (CUVIDEOFORMATEX) */ -} CUvideosourceformat_flags; - -#if !defined(__APPLE__) -/** - * \fn CUresult CUDAAPI cuvidCreateVideoSource(CUvideosource *pObj, const char *pszFileName, CUVIDSOURCEPARAMS *pParams) - * Create Video Source - */ -CUresult CUDAAPI cuvidCreateVideoSource(CUvideosource *pObj, const char *pszFileName, CUVIDSOURCEPARAMS *pParams); - -/** - * \fn CUresult CUDAAPI cuvidCreateVideoSourceW(CUvideosource *pObj, const wchar_t *pwszFileName, CUVIDSOURCEPARAMS *pParams) - * Create Video Source - */ -CUresult CUDAAPI cuvidCreateVideoSourceW(CUvideosource *pObj, const wchar_t *pwszFileName, CUVIDSOURCEPARAMS *pParams); - -/** - * \fn CUresult CUDAAPI cuvidDestroyVideoSource(CUvideosource obj) - * Destroy Video Source - */ -CUresult CUDAAPI cuvidDestroyVideoSource(CUvideosource obj); - -/** - * \fn CUresult CUDAAPI cuvidSetVideoSourceState(CUvideosource obj, cudaVideoState state) - * Set Video Source state - */ -CUresult CUDAAPI cuvidSetVideoSourceState(CUvideosource obj, cudaVideoState state); - -/** - * \fn cudaVideoState CUDAAPI cuvidGetVideoSourceState(CUvideosource obj) - * Get Video Source state - */ -cudaVideoState CUDAAPI cuvidGetVideoSourceState(CUvideosource obj); - -/** - * \fn CUresult CUDAAPI cuvidGetSourceVideoFormat(CUvideosource obj, CUVIDEOFORMAT *pvidfmt, unsigned int flags) - * Get Video Source Format - */ -CUresult CUDAAPI cuvidGetSourceVideoFormat(CUvideosource obj, CUVIDEOFORMAT *pvidfmt, unsigned int flags); - -/** - * \fn CUresult CUDAAPI cuvidGetSourceAudioFormat(CUvideosource obj, CUAUDIOFORMAT *paudfmt, unsigned int flags) - * Set Video Source state - */ -CUresult CUDAAPI cuvidGetSourceAudioFormat(CUvideosource obj, CUAUDIOFORMAT *paudfmt, unsigned int flags); - -#endif - -/** - * \struct CUVIDPARSERDISPINFO - */ -typedef struct _CUVIDPARSERDISPINFO -{ - int picture_index; /**< */ - int progressive_frame; /**< */ - int top_field_first; /**< */ - int repeat_first_field; /**< Number of additional fields (1=ivtc, 2=frame doubling, 4=frame tripling, -1=unpaired field) */ - CUvideotimestamp timestamp; /**< */ -} CUVIDPARSERDISPINFO; - -// -// Parser callbacks -// The parser will call these synchronously from within cuvidParseVideoData(), whenever a picture is ready to -// be decoded and/or displayed. -// -typedef int (CUDAAPI *PFNVIDSEQUENCECALLBACK)(void *, CUVIDEOFORMAT *); -typedef int (CUDAAPI *PFNVIDDECODECALLBACK)(void *, CUVIDPICPARAMS *); -typedef int (CUDAAPI *PFNVIDDISPLAYCALLBACK)(void *, CUVIDPARSERDISPINFO *); - -/** - * \struct CUVIDPARSERPARAMS - */ -typedef struct _CUVIDPARSERPARAMS -{ - cudaVideoCodec CodecType; /**< cudaVideoCodec_XXX */ - unsigned int ulMaxNumDecodeSurfaces; /**< Max # of decode surfaces (parser will cycle through these) */ - unsigned int ulClockRate; /**< Timestamp units in Hz (0=default=10000000Hz) */ - unsigned int ulErrorThreshold; /**< % Error threshold (0-100) for calling pfnDecodePicture (100=always call pfnDecodePicture even if picture bitstream is fully corrupted) */ - unsigned int ulMaxDisplayDelay; /**< Max display queue delay (improves pipelining of decode with display) - 0=no delay (recommended values: 2..4) */ - unsigned int uReserved1[5]; /**< Reserved for future use - set to 0 */ - void *pUserData; /**< User data for callbacks */ - PFNVIDSEQUENCECALLBACK pfnSequenceCallback; /**< Called before decoding frames and/or whenever there is a format change */ - PFNVIDDECODECALLBACK pfnDecodePicture; /**< Called when a picture is ready to be decoded (decode order) */ - PFNVIDDISPLAYCALLBACK pfnDisplayPicture; /**< Called whenever a picture is ready to be displayed (display order) */ - void *pvReserved2[7]; /**< Reserved for future use - set to NULL */ - CUVIDEOFORMATEX *pExtVideoInfo; /**< [Optional] sequence header data from system layer */ -} CUVIDPARSERPARAMS; - -/** - * \fn CUresult CUDAAPI cuvidCreateVideoParser(CUvideoparser *pObj, CUVIDPARSERPARAMS *pParams) - */ -CUresult CUDAAPI cuvidCreateVideoParser(CUvideoparser *pObj, CUVIDPARSERPARAMS *pParams); - -/** - * \fn CUresult CUDAAPI cuvidParseVideoData(CUvideoparser obj, CUVIDSOURCEDATAPACKET *pPacket) - */ -CUresult CUDAAPI cuvidParseVideoData(CUvideoparser obj, CUVIDSOURCEDATAPACKET *pPacket); - -/** - * \fn CUresult CUDAAPI cuvidDestroyVideoParser(CUvideoparser obj) - */ -CUresult CUDAAPI cuvidDestroyVideoParser(CUvideoparser obj); - -/** @} */ /* END VIDEO_PARSER */ -//////////////////////////////////////////////////////////////////////////////////////////////// - -#if defined(__cplusplus) -} -#endif /* __cplusplus */ - -#endif // __NVCUVID_H__ - - diff --git a/mythtv/external/FFmpeg/compat/cuda/ptx2c.sh b/mythtv/external/FFmpeg/compat/cuda/ptx2c.sh new file mode 100755 index 00000000000..5ccabbf56f1 --- /dev/null +++ b/mythtv/external/FFmpeg/compat/cuda/ptx2c.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +# Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# 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. + +set -e + +OUT="$1" +IN="$2" +NAME="$(basename "$IN" | sed 's/\..*//')" + +printf "const char %s_ptx[] = \\" "$NAME" > "$OUT" +while read LINE +do + printf "\n\t\"%s\\\n\"" "$(printf "%s" "$LINE" | sed -e 's/\r//g' -e 's/["\\]/\\&/g')" >> "$OUT" +done < "$IN" +printf ";\n" >> "$OUT" + +exit 0 diff --git a/mythtv/external/FFmpeg/compat/nvenc/nvEncodeAPI.h b/mythtv/external/FFmpeg/compat/nvenc/nvEncodeAPI.h index 18cf522d17f..c3a82942128 100644 --- a/mythtv/external/FFmpeg/compat/nvenc/nvEncodeAPI.h +++ b/mythtv/external/FFmpeg/compat/nvenc/nvEncodeAPI.h @@ -1,7 +1,7 @@ /* * This copyright notice applies to this header file only: * - * Copyright (c) 2010-2015 NVIDIA Corporation + * Copyright (c) 2010-2017 NVIDIA Corporation * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -27,8 +27,10 @@ /** * \file nvEncodeAPI.h - * NvEncodeAPI provides a NVENC Video Encoding interface to NVIDIA GPU devices based on the Kepler architecture. - * \date 2011-2016 + * NVIDIA GPUs - beginning with the Kepler generation - contain a hardware-based encoder + * (referred to as NVENC) which provides fully-accelerated hardware-based video encoding. + * NvEncodeAPI provides the interface for NVIDIA video encoder (NVENC). + * \date 2011-2017 * This file contains the interface constants, structure definitions and function prototypes. */ @@ -111,7 +113,7 @@ typedef void* NV_ENC_INPUT_PTR; /**< NVENCODE API input buffer typedef void* NV_ENC_OUTPUT_PTR; /**< NVENCODE API output buffer*/ typedef void* NV_ENC_REGISTERED_PTR; /**< A Resource that has been registered with NVENCODE API*/ -#define NVENCAPI_MAJOR_VERSION 7 +#define NVENCAPI_MAJOR_VERSION 8 #define NVENCAPI_MINOR_VERSION 0 #define NVENCAPI_VERSION (NVENCAPI_MAJOR_VERSION | (NVENCAPI_MINOR_VERSION << 24)) @@ -255,13 +257,16 @@ typedef enum _NV_ENC_PARAMS_RC_MODE NV_ENC_PARAMS_RC_CONSTQP = 0x0, /**< Constant QP mode */ NV_ENC_PARAMS_RC_VBR = 0x1, /**< Variable bitrate mode */ NV_ENC_PARAMS_RC_CBR = 0x2, /**< Constant bitrate mode */ - NV_ENC_PARAMS_RC_VBR_MINQP = 0x4, /**< Variable bitrate mode with MinQP */ - NV_ENC_PARAMS_RC_2_PASS_QUALITY = 0x8, /**< Multi pass encoding optimized for image quality and works only with low latency mode */ - NV_ENC_PARAMS_RC_2_PASS_FRAMESIZE_CAP = 0x10, /**< Multi pass encoding optimized for maintaining frame size and works only with low latency mode */ - NV_ENC_PARAMS_RC_2_PASS_VBR = 0x20 /**< Multi pass VBR */ + NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ = 0x8, /**< low-delay CBR, high quality */ + NV_ENC_PARAMS_RC_CBR_HQ = 0x10, /**< CBR, high quality (slower) */ + NV_ENC_PARAMS_RC_VBR_HQ = 0x20 /**< VBR, high quality (slower) */ } NV_ENC_PARAMS_RC_MODE; -#define NV_ENC_PARAMS_RC_CBR2 NV_ENC_PARAMS_RC_CBR /**< Deprecated */ +#define NV_ENC_PARAMS_RC_VBR_MINQP (NV_ENC_PARAMS_RC_MODE)0x4 /**< Deprecated */ +#define NV_ENC_PARAMS_RC_2_PASS_QUALITY NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ /**< Deprecated */ +#define NV_ENC_PARAMS_RC_2_PASS_FRAMESIZE_CAP NV_ENC_PARAMS_RC_CBR_HQ /**< Deprecated */ +#define NV_ENC_PARAMS_RC_2_PASS_VBR NV_ENC_PARAMS_RC_VBR_HQ /**< Deprecated */ +#define NV_ENC_PARAMS_RC_CBR2 NV_ENC_PARAMS_RC_CBR /**< Deprecated */ /** * Input picture structure @@ -313,11 +318,26 @@ typedef enum _NV_ENC_BUFFER_FORMAT NV_ENC_BUFFER_FORMAT_YUV444 = 0x00001000, /**< Planar YUV [Y plane followed by U and V planes] */ NV_ENC_BUFFER_FORMAT_YUV420_10BIT = 0x00010000, /**< 10 bit Semi-Planar YUV [Y plane followed by interleaved UV plane]. Each pixel of size 2 bytes. Most Significant 10 bits contain pixel data. */ NV_ENC_BUFFER_FORMAT_YUV444_10BIT = 0x00100000, /**< 10 bit Planar YUV444 [Y plane followed by U and V planes]. Each pixel of size 2 bytes. Most Significant 10 bits contain pixel data. */ - NV_ENC_BUFFER_FORMAT_ARGB = 0x01000000, /**< 8 bit Packed A8R8G8B8 */ - NV_ENC_BUFFER_FORMAT_ARGB10 = 0x02000000, /**< 10 bit Packed A2R10G10B10. Each pixel of size 2 bytes. Most Significant 10 bits contain pixel data. */ - NV_ENC_BUFFER_FORMAT_AYUV = 0x04000000, /**< 8 bit Packed A8Y8U8V8 */ - NV_ENC_BUFFER_FORMAT_ABGR = 0x10000000, /**< 8 bit Packed A8B8G8R8 */ - NV_ENC_BUFFER_FORMAT_ABGR10 = 0x20000000, /**< 10 bit Packed A2B10G10R10. Each pixel of size 2 bytes. Most Significant 10 bits contain pixel data. */ + NV_ENC_BUFFER_FORMAT_ARGB = 0x01000000, /**< 8 bit Packed A8R8G8B8. This is a word-ordered format + where a pixel is represented by a 32-bit word with B + in the lowest 8 bits, G in the next 8 bits, R in the + 8 bits after that and A in the highest 8 bits. */ + NV_ENC_BUFFER_FORMAT_ARGB10 = 0x02000000, /**< 10 bit Packed A2R10G10B10. This is a word-ordered format + where a pixel is represented by a 32-bit word with B + in the lowest 10 bits, G in the next 10 bits, R in the + 10 bits after that and A in the highest 2 bits. */ + NV_ENC_BUFFER_FORMAT_AYUV = 0x04000000, /**< 8 bit Packed A8Y8U8V8. This is a word-ordered format + where a pixel is represented by a 32-bit word with V + in the lowest 8 bits, U in the next 8 bits, Y in the + 8 bits after that and A in the highest 8 bits. */ + NV_ENC_BUFFER_FORMAT_ABGR = 0x10000000, /**< 8 bit Packed A8B8G8R8. This is a word-ordered format + where a pixel is represented by a 32-bit word with R + in the lowest 8 bits, G in the next 8 bits, B in the + 8 bits after that and A in the highest 8 bits. */ + NV_ENC_BUFFER_FORMAT_ABGR10 = 0x20000000, /**< 10 bit Packed A2B10G10R10. This is a word-ordered format + where a pixel is represented by a 32-bit word with R + in the lowest 10 bits, G in the next 10 bits, B in the + 10 bits after that and A in the highest 2 bits. */ } NV_ENC_BUFFER_FORMAT; #define NV_ENC_BUFFER_FORMAT_NV12_PL NV_ENC_BUFFER_FORMAT_NV12 @@ -629,6 +649,7 @@ typedef enum _NV_ENC_INPUT_RESOURCE_TYPE NV_ENC_INPUT_RESOURCE_TYPE_DIRECTX = 0x0, /**< input resource type is a directx9 surface*/ NV_ENC_INPUT_RESOURCE_TYPE_CUDADEVICEPTR = 0x1, /**< input resource type is a cuda device pointer surface*/ NV_ENC_INPUT_RESOURCE_TYPE_CUDAARRAY = 0x2, /**< input resource type is a cuda array surface */ + NV_ENC_INPUT_RESOURCE_TYPE_OPENGL_TEX = 0x3 /**< input resource type is an OpenGL texture */ } NV_ENC_INPUT_RESOURCE_TYPE; /** @@ -638,6 +659,8 @@ typedef enum _NV_ENC_DEVICE_TYPE { NV_ENC_DEVICE_TYPE_DIRECTX = 0x0, /**< encode device type is a directx9 device */ NV_ENC_DEVICE_TYPE_CUDA = 0x1, /**< encode device type is a cuda device */ + NV_ENC_DEVICE_TYPE_OPENGL = 0x2 /**< encode device type is an OpenGL device. + Use of this device type is supported only on Linux */ } NV_ENC_DEVICE_TYPE; /** @@ -896,7 +919,8 @@ typedef enum _NV_ENC_CAPS /** * Indicates HW support for MEOnly Mode. * \n 0 : MEOnly Mode not supported. - * \n 1 : MEOnly Mode supported. + * \n 1 : MEOnly Mode supported for I and P frames. + * \n 2 : MEOnly Mode supported for I, P and B frames. */ NV_ENC_CAPS_SUPPORT_MEONLY_MODE, @@ -919,6 +943,17 @@ typedef enum _NV_ENC_CAPS * \n 1 : 10 bit encoding supported. */ NV_ENC_CAPS_SUPPORT_10BIT_ENCODE, + /** + * Maximum number of Long Term Reference frames supported + */ + NV_ENC_CAPS_NUM_MAX_LTR_FRAMES, + + /** + * Indicates HW support for Weighted Predicition. + * \n 0 : Weighted Predicition not supported. + * \n 1 : Weighted Predicition supported. + */ + NV_ENC_CAPS_SUPPORT_WEIGHTED_PREDICTION, /** * Reserved - Not to be used by clients. @@ -960,7 +995,7 @@ typedef struct _NV_ENC_CREATE_INPUT_BUFFER uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_CREATE_INPUT_BUFFER_VER */ uint32_t width; /**< [in]: Input buffer width */ uint32_t height; /**< [in]: Input buffer width */ - NV_ENC_MEMORY_HEAP memoryHeap; /**< [in]: Deprecated. Will be removed in sdk 8.0 */ + NV_ENC_MEMORY_HEAP memoryHeap; /**< [in]: Deprecated. Do not use */ NV_ENC_BUFFER_FORMAT bufferFmt; /**< [in]: Input buffer format */ uint32_t reserved; /**< [in]: Reserved and must be set to 0 */ NV_ENC_INPUT_PTR inputBuffer; /**< [out]: Pointer to input buffer */ @@ -978,8 +1013,8 @@ typedef struct _NV_ENC_CREATE_INPUT_BUFFER typedef struct _NV_ENC_CREATE_BITSTREAM_BUFFER { uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_CREATE_BITSTREAM_BUFFER_VER */ - uint32_t size; /**< [in]: Size of the bitstream buffer to be created */ - NV_ENC_MEMORY_HEAP memoryHeap; /**< [in]: Deprecated. Will be removed in sdk 8.0 */ + uint32_t size; /**< [in]: Deprecated. Do not use */ + NV_ENC_MEMORY_HEAP memoryHeap; /**< [in]: Deprecated. Do not use */ uint32_t reserved; /**< [in]: Reserved and must be set to 0 */ NV_ENC_OUTPUT_PTR bitstreamBuffer; /**< [out]: Pointer to the output bitstream buffer */ void* bitstreamBufferPtr; /**< [out]: Reserved and should not be used */ @@ -1073,14 +1108,15 @@ typedef struct _NV_ENC_QP uint32_t zeroReorderDelay :1; /**< [in]: Set this to 1 to indicate zero latency operation (no reordering delay, num_reorder_frames=0) */ uint32_t enableNonRefP :1; /**< [in]: Set this to 1 to enable automatic insertion of non-reference P-frames (no effect if enablePTD=0) */ uint32_t strictGOPTarget :1; /**< [in]: Set this to 1 to minimize GOP-to-GOP rate fluctuations */ - uint32_t aqStrength :4; /**< [in]: When AQ (Spatial) is enabled (i.e. NV_ENC_RC_PARAMS::enableAQ is set), this field is used to specify AQ strength. AQ strength scale is from 1 (low) - 15 (aggressive). If not set, strength is autoselected by driver. Currently supported only with h264 */ + uint32_t aqStrength :4; /**< [in]: When AQ (Spatial) is enabled (i.e. NV_ENC_RC_PARAMS::enableAQ is set), this field is used to specify AQ strength. AQ strength scale is from 1 (low) - 15 (aggressive). If not set, strength is autoselected by driver. */ uint32_t reservedBitFields :16; /**< [in]: Reserved bitfields and must be set to 0 */ NV_ENC_QP minQP; /**< [in]: Specifies the minimum QP used for rate control. Client must set NV_ENC_CONFIG::enableMinQP to 1. */ NV_ENC_QP maxQP; /**< [in]: Specifies the maximum QP used for rate control. Client must set NV_ENC_CONFIG::enableMaxQP to 1. */ NV_ENC_QP initialRCQP; /**< [in]: Specifies the initial QP used for rate control. Client must set NV_ENC_CONFIG::enableInitialRCQP to 1. */ uint32_t temporallayerIdxMask; /**< [in]: Specifies the temporal layers (as a bitmask) whose QPs have changed. Valid max bitmask is [2^NV_ENC_CAPS_NUM_MAX_TEMPORAL_LAYERS - 1] */ uint8_t temporalLayerQP[8]; /**< [in]: Specifies the temporal layer QPs used for rate control. Temporal layer index is used as as the array index */ - uint16_t targetQuality; /**< [in]: Target CQ (Constant Quality) level for VBR mode (range 0-51 with 0-automatic) */ + uint8_t targetQuality; /**< [in]: Target CQ (Constant Quality) level for VBR mode (range 0-51 with 0-automatic) */ + uint8_t targetQualityLSB; /**< [in]: Fractional part of target quality (as 8.8 fixed point format) */ uint16_t lookaheadDepth; /**< [in]: Maximum depth of lookahead with range 0-32 (only used if enableLookahead=1) */ uint32_t reserved[9]; } NV_ENC_RC_PARAMS; @@ -1117,13 +1153,14 @@ typedef NV_ENC_CONFIG_H264_VUI_PARAMETERS NV_ENC_CONFIG_HEVC_VUI_PARAMETERS; /** * \struct _NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE * External motion vector hint counts per block type. + * H264 supports multiple hint while HEVC supports one hint for each valid candidate. */ typedef struct _NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE { - uint32_t numCandsPerBlk16x16 : 4; /**< [in]: Specifies the number of candidates per 16x16 block. */ - uint32_t numCandsPerBlk16x8 : 4; /**< [in]: Specifies the number of candidates per 16x8 block. */ - uint32_t numCandsPerBlk8x16 : 4; /**< [in]: Specifies the number of candidates per 8x16 block. */ - uint32_t numCandsPerBlk8x8 : 4; /**< [in]: Specifies the number of candidates per 8x8 block. */ + uint32_t numCandsPerBlk16x16 : 4; /**< [in]: Supported for H264,HEVC.It Specifies the number of candidates per 16x16 block. */ + uint32_t numCandsPerBlk16x8 : 4; /**< [in]: Supported for H264 only.Specifies the number of candidates per 16x8 block. */ + uint32_t numCandsPerBlk8x16 : 4; /**< [in]: Supported for H264 only.Specifies the number of candidates per 8x16 block. */ + uint32_t numCandsPerBlk8x8 : 4; /**< [in]: Supported for H264,HEVC.Specifies the number of candidates per 8x8 block. */ uint32_t reserved : 16; /**< [in]: Reserved for padding. */ uint32_t reserved1[3]; /**< [in]: Reserved for future use. */ } NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE; @@ -1156,7 +1193,8 @@ typedef struct _NV_ENC_CONFIG_H264 uint32_t hierarchicalPFrames :1; /**< [in]: Set to 1 to enable hierarchical PFrames */ uint32_t hierarchicalBFrames :1; /**< [in]: Set to 1 to enable hierarchical BFrames */ uint32_t outputBufferingPeriodSEI :1; /**< [in]: Set to 1 to write SEI buffering period syntax in the bitstream */ - uint32_t outputPictureTimingSEI :1; /**< [in]: Set to 1 to write SEI picture timing syntax in the bitstream */ + uint32_t outputPictureTimingSEI :1; /**< [in]: Set to 1 to write SEI picture timing syntax in the bitstream. When set for following rateControlMode : NV_ENC_PARAMS_RC_CBR, NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ, + NV_ENC_PARAMS_RC_CBR_HQ, filler data is inserted if needed to achieve hrd bitrate */ uint32_t outputAUD :1; /**< [in]: Set to 1 to write access unit delimiter syntax in bitstream */ uint32_t disableSPSPPS :1; /**< [in]: Set to 1 to disable writing of Sequence and Picture parameter info in bitstream */ uint32_t outputFramePackingSEI :1; /**< [in]: Set to 1 to enable writing of frame packing arrangement SEI messages to bitstream */ @@ -1166,7 +1204,13 @@ typedef struct _NV_ENC_CONFIG_H264 Check support for constrained encoding using ::NV_ENC_CAPS_SUPPORT_CONSTRAINED_ENCODING caps. */ uint32_t repeatSPSPPS :1; /**< [in]: Set to 1 to enable writing of Sequence and Picture parameter for every IDR frame */ uint32_t enableVFR :1; /**< [in]: Set to 1 to enable variable frame rate. */ - uint32_t enableLTR :1; /**< [in]: Currently this feature is not available and must be set to 0. Set to 1 to enable LTR support and auto-mark the first */ + uint32_t enableLTR :1; /**< [in]: Set to 1 to enable LTR (Long Term Reference) frame support. LTR can be used in two modes: "LTR Trust" mode and "LTR Per Picture" mode. + LTR Trust mode: In this mode, ltrNumFrames pictures after IDR are automatically marked as LTR. This mode is enabled by setting ltrTrustMode = 1. + Use of LTR Trust mode is strongly discouraged as this mode may be deprecated in future. + LTR Per Picture mode: In this mode, client can control whether the current picture should be marked as LTR. Enable this mode by setting + ltrTrustMode = 0 and ltrMarkFrame = 1 for the picture to be marked as LTR. This is the preferred mode + for using LTR. + Note that LTRs are not supported if encoding session is configured with B-frames */ uint32_t qpPrimeYZeroTransformBypassFlag :1; /**< [in]: To enable lossless encode set this to 1, set QP to 0 and RC_mode to NV_ENC_PARAMS_RC_CONSTQP and profile to HIGH_444_PREDICTIVE_PROFILE. Check support for lossless encoding using ::NV_ENC_CAPS_SUPPORT_LOSSLESS_ENCODE caps. */ uint32_t useConstrainedIntraPred :1; /**< [in]: Set 1 to enable constrained intra prediction. */ @@ -1176,8 +1220,8 @@ typedef struct _NV_ENC_CONFIG_H264 uint32_t separateColourPlaneFlag; /**< [in]: Set to 1 to enable 4:4:4 separate colour planes */ uint32_t disableDeblockingFilterIDC; /**< [in]: Specifies the deblocking filter mode. Permissible value range: [0,2] */ uint32_t numTemporalLayers; /**< [in]: Specifies max temporal layers to be used for hierarchical coding. Valid value range is [1,::NV_ENC_CAPS_NUM_MAX_TEMPORAL_LAYERS] */ - uint32_t spsId; /**< [in]: Specifies the SPS id of the sequence header. Currently reserved and must be set to 0. */ - uint32_t ppsId; /**< [in]: Specifies the PPS id of the picture header. Currently reserved and must be set to 0. */ + uint32_t spsId; /**< [in]: Specifies the SPS id of the sequence header */ + uint32_t ppsId; /**< [in]: Specifies the PPS id of the picture header */ NV_ENC_H264_ADAPTIVE_TRANSFORM_MODE adaptiveTransformMode; /**< [in]: Specifies the AdaptiveTransform Mode. Check support for AdaptiveTransform mode using ::NV_ENC_CAPS_SUPPORT_ADAPTIVE_TRANSFORM caps. */ NV_ENC_H264_FMO_MODE fmoMode; /**< [in]: Specified the FMO Mode. Check support for FMO using ::NV_ENC_CAPS_SUPPORT_FMO caps. */ NV_ENC_H264_BDIRECT_MODE bdirectMode; /**< [in]: Specifies the BDirect mode. Check support for BDirect mode using ::NV_ENC_CAPS_SUPPORT_BDIRECT_MODE caps.*/ @@ -1200,13 +1244,13 @@ typedef struct _NV_ENC_CONFIG_H264 sliceMode = 2, sliceModeData specifies # of MB rows in each slice (except last slice) sliceMode = 3, sliceModeData specifies number of slices in the picture. Driver will divide picture into slices optimally */ NV_ENC_CONFIG_H264_VUI_PARAMETERS h264VUIParameters; /**< [in]: Specifies the H264 video usability info pamameters */ - uint32_t ltrNumFrames; /**< [in]: Specifies the number of LTR frames used. - If ltrTrustMode=1, encoder will mark first numLTRFrames base layer reference frames within each IDR interval as LTR. - If ltrMarkFrame=1, ltrNumFrames specifies maximum number of ltr frames in DPB. - If ltrNumFrames value is more that DPB size(maxNumRefFrames) encoder will take decision on its own. */ - uint32_t ltrTrustMode; /**< [in]: Specifies the LTR operating mode. - Set to 0 to disallow encoding using LTR frames until later specified. - Set to 1 to allow encoding using LTR frames unless later invalidated.*/ + uint32_t ltrNumFrames; /**< [in]: Specifies the number of LTR frames. This parameter has different meaning in two LTR modes. + In "LTR Trust" mode (ltrTrustMode = 1), encoder will mark the first ltrNumFrames base layer reference frames within each IDR interval as LTR. + In "LTR Per Picture" mode (ltrTrustMode = 0 and ltrMarkFrame = 1), ltrNumFrames specifies maximum number of LTR frames in DPB. */ + uint32_t ltrTrustMode; /**< [in]: Specifies the LTR operating mode. See comments near NV_ENC_CONFIG_H264::enableLTR for description of the two modes. + Set to 1 to use "LTR Trust" mode of LTR operation. Clients are discouraged to use "LTR Trust" mode as this mode may + be deprecated in future releases. + Set to 0 when using "LTR Per Picture" mode of LTR operation. */ uint32_t chromaFormatIDC; /**< [in]: Specifies the chroma format. Should be set to 1 for yuv420 input, 3 for yuv444 input. Check support for YUV444 encoding using ::NV_ENC_CAPS_SUPPORT_YUV444_ENCODE caps.*/ uint32_t maxTemporalLayers; /**< [in]: Specifies the max temporal layer used for hierarchical coding. */ @@ -1230,7 +1274,13 @@ typedef struct _NV_ENC_CONFIG_HEVC uint32_t outputBufferingPeriodSEI :1; /**< [in]: Set 1 to write SEI buffering period syntax in the bitstream */ uint32_t outputPictureTimingSEI :1; /**< [in]: Set 1 to write SEI picture timing syntax in the bitstream */ uint32_t outputAUD :1; /**< [in]: Set 1 to write Access Unit Delimiter syntax. */ - uint32_t enableLTR :1; /**< [in]: Set 1 to enable use of long term reference pictures for inter prediction. */ + uint32_t enableLTR :1; /**< [in]: Set to 1 to enable LTR (Long Term Reference) frame support. LTR can be used in two modes: "LTR Trust" mode and "LTR Per Picture" mode. + LTR Trust mode: In this mode, ltrNumFrames pictures after IDR are automatically marked as LTR. This mode is enabled by setting ltrTrustMode = 1. + Use of LTR Trust mode is strongly discouraged as this mode may be deprecated in future releases. + LTR Per Picture mode: In this mode, client can control whether the current picture should be marked as LTR. Enable this mode by setting + ltrTrustMode = 0 and ltrMarkFrame = 1 for the picture to be marked as LTR. This is the preferred mode + for using LTR. + Note that LTRs are not supported if encoding session is configured with B-frames */ uint32_t disableSPSPPS :1; /**< [in]: Set 1 to disable VPS,SPS and PPS signalling in the bitstream. */ uint32_t repeatSPSPPS :1; /**< [in]: Set 1 to output VPS,SPS and PPS for every IDR frame.*/ uint32_t enableIntraRefresh :1; /**< [in]: Set 1 to enable gradual decoder refresh or intra refresh. If the GOP structure uses B frames this will be ignored */ @@ -1242,13 +1292,12 @@ typedef struct _NV_ENC_CONFIG_HEVC Will be disabled if NV_ENC_CONFIG::gopLength is not set to NVENC_INFINITE_GOPLENGTH. */ uint32_t intraRefreshCnt; /**< [in]: Specifies the length of intra refresh in number of frames for periodic intra refresh. This value should be smaller than intraRefreshPeriod */ uint32_t maxNumRefFramesInDPB; /**< [in]: Specifies the maximum number of references frames in the DPB.*/ - uint32_t ltrNumFrames; /**< [in]: Specifies the number of LTR frames used. - If ltrTrustMode=1, encoder will mark first numLTRFrames base layer reference frames within each IDR interval as LTR. - If ltrMarkFrame=1, ltrNumFrames specifies maximum number of ltr frames in DPB. - If ltrNumFrames value is more that DPB size(maxNumRefFramesInDPB) encoder will take decision on its own. */ - uint32_t vpsId; /**< [in]: Specifies the VPS id of the video parameter set. Currently reserved and must be set to 0. */ - uint32_t spsId; /**< [in]: Specifies the SPS id of the sequence header. Currently reserved and must be set to 0. */ - uint32_t ppsId; /**< [in]: Specifies the PPS id of the picture header. Currently reserved and must be set to 0. */ + uint32_t ltrNumFrames; /**< [in]: This parameter has different meaning in two LTR modes. + In "LTR Trust" mode (ltrTrustMode = 1), encoder will mark the first ltrNumFrames base layer reference frames within each IDR interval as LTR. + In "LTR Per Picture" mode (ltrTrustMode = 0 and ltrMarkFrame = 1), ltrNumFrames specifies maximum number of LTR frames in DPB. */ + uint32_t vpsId; /**< [in]: Specifies the VPS id of the video parameter set */ + uint32_t spsId; /**< [in]: Specifies the SPS id of the sequence header */ + uint32_t ppsId; /**< [in]: Specifies the PPS id of the picture header */ uint32_t sliceMode; /**< [in]: This parameter in conjunction with sliceModeData specifies the way in which the picture is divided into slices sliceMode = 0 CTU based slices, sliceMode = 1 Byte based slices, sliceMode = 2 CTU row based slices, sliceMode = 3, numSlices in Picture When sliceMode == 0 and sliceModeData == 0 whole picture will be coded with one slice */ @@ -1259,22 +1308,55 @@ typedef struct _NV_ENC_CONFIG_HEVC sliceMode = 3, sliceModeData specifies number of slices in the picture. Driver will divide picture into slices optimally */ uint32_t maxTemporalLayersMinus1; /**< [in]: Specifies the max temporal layer used for hierarchical coding. */ NV_ENC_CONFIG_HEVC_VUI_PARAMETERS hevcVUIParameters; /**< [in]: Specifies the HEVC video usability info pamameters */ - uint32_t ltrTrustMode; /**< [in]: Specifies the LTR operating mode. - Set to 0 to disallow encoding using LTR frames until later specified. - Set to 1 to allow encoding using LTR frames unless later invalidated.*/ + uint32_t ltrTrustMode; /**< [in]: Specifies the LTR operating mode. See comments near NV_ENC_CONFIG_HEVC::enableLTR for description of the two modes. + Set to 1 to use "LTR Trust" mode of LTR operation. Clients are discouraged to use "LTR Trust" mode as this mode may + be deprecated in future releases. + Set to 0 when using "LTR Per Picture" mode of LTR operation. */ uint32_t reserved1[217]; /**< [in]: Reserved and must be set to 0.*/ void* reserved2[64]; /**< [in]: Reserved and must be set to NULL */ } NV_ENC_CONFIG_HEVC; +/** + * \struct _NV_ENC_CONFIG_H264_MEONLY + * H264 encoder configuration parameters for ME only Mode + * + */ +typedef struct _NV_ENC_CONFIG_H264_MEONLY +{ + uint32_t disablePartition16x16 :1; /**< [in]: Disable MotionEstimation on 16x16 blocks*/ + uint32_t disablePartition8x16 :1; /**< [in]: Disable MotionEstimation on 8x16 blocks*/ + uint32_t disablePartition16x8 :1; /**< [in]: Disable MotionEstimation on 16x8 blocks*/ + uint32_t disablePartition8x8 :1; /**< [in]: Disable MotionEstimation on 8x8 blocks*/ + uint32_t disableIntraSearch :1; /**< [in]: Disable Intra search during MotionEstimation*/ + uint32_t bStereoEnable :1; /**< [in]: Enable Stereo Mode for Motion Estimation where each view is independently executed*/ + uint32_t reserved :26; /**< [in]: Reserved and must be set to 0 */ + uint32_t reserved1 [255]; /**< [in]: Reserved and must be set to 0 */ + void* reserved2[64]; /**< [in]: Reserved and must be set to NULL */ +} NV_ENC_CONFIG_H264_MEONLY; + + +/** + * \struct _NV_ENC_CONFIG_HEVC_MEONLY + * HEVC encoder configuration parameters for ME only Mode + * + */ +typedef struct _NV_ENC_CONFIG_HEVC_MEONLY +{ + uint32_t reserved [256]; /**< [in]: Reserved and must be set to 0 */ + void* reserved1[64]; /**< [in]: Reserved and must be set to NULL */ +} NV_ENC_CONFIG_HEVC_MEONLY; + /** * \struct _NV_ENC_CODEC_CONFIG * Codec-specific encoder configuration parameters to be set during initialization. */ typedef union _NV_ENC_CODEC_CONFIG { - NV_ENC_CONFIG_H264 h264Config; /**< [in]: Specifies the H.264-specific encoder configuration. */ - NV_ENC_CONFIG_HEVC hevcConfig; /**< [in]: Specifies the HEVC-specific encoder configuration. */ - uint32_t reserved[256]; /**< [in]: Reserved and must be set to 0 */ + NV_ENC_CONFIG_H264 h264Config; /**< [in]: Specifies the H.264-specific encoder configuration. */ + NV_ENC_CONFIG_HEVC hevcConfig; /**< [in]: Specifies the HEVC-specific encoder configuration. */ + NV_ENC_CONFIG_H264_MEONLY h264MeOnlyConfig; /**< [in]: Specifies the H.264-specific ME only encoder configuration. */ + NV_ENC_CONFIG_HEVC_MEONLY hevcMeOnlyConfig; /**< [in]: Specifies the HEVC-specific ME only encoder configuration. */ + uint32_t reserved[320]; /**< [in]: Reserved and must be set to 0 */ } NV_ENC_CODEC_CONFIG; @@ -1325,7 +1407,8 @@ typedef struct _NV_ENC_INITIALIZE_PARAMS uint32_t enableExternalMEHints :1; /**< [in]: Set to 1 to enable external ME hints for the current frame. For NV_ENC_INITIALIZE_PARAMS::enablePTD=1 with B frames, programming L1 hints is optional for B frames since Client doesn't know internal GOP structure. NV_ENC_PIC_PARAMS::meHintRefPicDist should preferably be set with enablePTD=1. */ uint32_t enableMEOnlyMode :1; /**< [in]: Set to 1 to enable ME Only Mode .*/ - uint32_t reservedBitFields :28; /**< [in]: Reserved bitfields and must be set to 0 */ + uint32_t enableWeightedPrediction :1; /**< [in]: Set this to 1 to enable weighted prediction. Not supported if encode session is configured for B-Frames( 'frameIntervalP' in NV_ENC_CONFIG is greater than 1).*/ + uint32_t reservedBitFields :27; /**< [in]: Reserved bitfields and must be set to 0 */ uint32_t privDataSize; /**< [in]: Reserved private data buffer size and must be set to 0 */ void* privData; /**< [in]: Reserved private data buffer and must be set to NULL */ NV_ENC_CONFIG* encodeConfig; /**< [in]: Specifies the advanced codec specific structure. If client has sent a valid codec config structure, it will override parameters set by the NV_ENC_INITIALIZE_PARAMS::presetGUID parameter. If set to NULL the NvEncodeAPI interface will use the NV_ENC_INITIALIZE_PARAMS::presetGUID to set the codec specific parameters. @@ -1428,8 +1511,8 @@ typedef struct _NV_ENC_PIC_PARAMS_H264 sliceMode = 2, sliceModeData specifies # of MB rows in each slice (except last slice) sliceMode = 3, sliceModeData specifies number of slices in the picture. Driver will divide picture into slices optimally */ uint32_t ltrMarkFrameIdx; /**< [in]: Specifies the long term referenceframe index to use for marking this frame as LTR.*/ - uint32_t ltrUseFrameBitmap; /**< [in]: Specifies the the associated bitmap of LTR frame indices when encoding this frame. */ - uint32_t ltrUsageMode; /**< [in]: Specifies additional usage constraints for encoding using LTR frames from this point further. 0: no constraints, 1: no short term refs older than current, no previous LTR frames.*/ + uint32_t ltrUseFrameBitmap; /**< [in]: Specifies the the associated bitmap of LTR frame indices to use when encoding this frame. */ + uint32_t ltrUsageMode; /**< [in]: Not supported. Reserved for future use and must be set to 0. */ uint32_t reserved [243]; /**< [in]: Reserved and must be set to 0. */ void* reserved2[62]; /**< [in]: Reserved and must be set to NULL. */ } NV_ENC_PIC_PARAMS_H264; @@ -1468,8 +1551,8 @@ typedef struct _NV_ENC_PIC_PARAMS_HEVC sliceMode = 2, sliceModeData specifies # of CTU rows in each slice (except last slice) sliceMode = 3, sliceModeData specifies number of slices in the picture. Driver will divide picture into slices optimally */ uint32_t ltrMarkFrameIdx; /**< [in]: Specifies the long term reference frame index to use for marking this frame as LTR.*/ - uint32_t ltrUseFrameBitmap; /**< [in]: Specifies the associated bitmap of LTR frame indices when encoding this frame. */ - uint32_t ltrUsageMode; /**< [in]: Specifies additional usage constraints for encoding using LTR frames from this point further. 0: no constraints, 1: no short term refs older than current, no previous LTR frames.*/ + uint32_t ltrUseFrameBitmap; /**< [in]: Specifies the associated bitmap of LTR frame indices to use when encoding this frame. */ + uint32_t ltrUsageMode; /**< [in]: Not supported. Reserved for future use and must be set to 0. */ uint32_t seiPayloadArrayCnt; /**< [in]: Specifies the number of elements allocated in seiPayloadArray array. */ uint32_t reserved; /**< [in]: Reserved and must be set to 0. */ NV_ENC_SEI_PAYLOAD* seiPayloadArray; /**< [in]: Array of SEI payloads which will be inserted for this frame. */ @@ -1484,7 +1567,7 @@ typedef struct _NV_ENC_PIC_PARAMS_HEVC typedef union _NV_ENC_CODEC_PIC_PARAMS { NV_ENC_PIC_PARAMS_H264 h264PicParams; /**< [in]: H264 encode picture params. */ - NV_ENC_PIC_PARAMS_HEVC hevcPicParams; /**< [in]: HEVC encode picture params. Currently unsupported and must not to be used. */ + NV_ENC_PIC_PARAMS_HEVC hevcPicParams; /**< [in]: HEVC encode picture params. */ uint32_t reserved[256]; /**< [in]: Reserved and must be set to 0. */ } NV_ENC_CODEC_PIC_PARAMS; @@ -1511,7 +1594,7 @@ typedef struct _NV_ENC_PIC_PARAMS NV_ENC_CODEC_PIC_PARAMS codecPicParams; /**< [in]: Specifies the codec specific per-picture encoding parameters. */ NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE meHintCountsPerBlock[2]; /**< [in]: Specifies the number of hint candidates per block per direction for the current frame. meHintCountsPerBlock[0] is for L0 predictors and meHintCountsPerBlock[1] is for L1 predictors. The candidate count in NV_ENC_PIC_PARAMS::meHintCountsPerBlock[lx] must never exceed NV_ENC_INITIALIZE_PARAMS::maxMEHintCountsPerBlock[lx] provided during encoder intialization. */ - NVENC_EXTERNAL_ME_HINT *meExternalHints; /**< [in]: Specifies the pointer to ME external hints for the current frame. The size of ME hint buffer should be equal to number of macroblocks multiplied by the total number of candidates per macroblock. + NVENC_EXTERNAL_ME_HINT *meExternalHints; /**< [in]: Specifies the pointer to ME external hints for the current frame. The size of ME hint buffer should be equal to number of macroblocks * the total number of candidates per macroblock. The total number of candidates per MB per direction = 1*meHintCountsPerBlock[Lx].numCandsPerBlk16x16 + 2*meHintCountsPerBlock[Lx].numCandsPerBlk16x8 + 2*meHintCountsPerBlock[Lx].numCandsPerBlk8x8 + 4*meHintCountsPerBlock[Lx].numCandsPerBlk8x8. For frames using bidirectional ME , the total number of candidates for single macroblock is sum of total number of candidates per MB for each direction (L0 and L1) */ uint32_t reserved1[6]; /**< [in]: Reserved and must be set to 0 */ @@ -1532,6 +1615,7 @@ typedef struct _NV_ENC_PIC_PARAMS /** * \struct _NV_ENC_MEONLY_PARAMS * MEOnly parameters that need to be sent on a per motion estimation basis. + * NV_ENC_MEONLY_PARAMS::meExternalHints is supported for H264 only. */ typedef struct _NV_ENC_MEONLY_PARAMS { @@ -1545,12 +1629,20 @@ typedef struct _NV_ENC_MEONLY_PARAMS void* completionEvent; /**< [in]: Specifies an event to be signalled on completion of motion estimation of this Frame [only if operating in Asynchronous mode]. Each output buffer should be associated with a distinct event pointer. */ - uint32_t reserved1[252]; /**< [in]: Reserved and must be set to 0 */ - void* reserved2[60]; /**< [in]: Reserved and must be set to NULL */ + uint32_t viewID; /**< [in]: Specifies left,right viewID if NV_ENC_CONFIG_H264_MEONLY::bStereoEnable is set. + viewID can be 0,1 if bStereoEnable is set, 0 otherwise. */ + NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE + meHintCountsPerBlock[2]; /**< [in]: Specifies the number of hint candidates per block for the current frame. meHintCountsPerBlock[0] is for L0 predictors. + The candidate count in NV_ENC_PIC_PARAMS::meHintCountsPerBlock[lx] must never exceed NV_ENC_INITIALIZE_PARAMS::maxMEHintCountsPerBlock[lx] provided during encoder intialization. */ + NVENC_EXTERNAL_ME_HINT *meExternalHints; /**< [in]: Specifies the pointer to ME external hints for the current frame. The size of ME hint buffer should be equal to number of macroblocks * the total number of candidates per macroblock. + The total number of candidates per MB per direction = 1*meHintCountsPerBlock[Lx].numCandsPerBlk16x16 + 2*meHintCountsPerBlock[Lx].numCandsPerBlk16x8 + 2*meHintCountsPerBlock[Lx].numCandsPerBlk8x8 + + 4*meHintCountsPerBlock[Lx].numCandsPerBlk8x8. For frames using bidirectional ME , the total number of candidates for single macroblock is sum of total number of candidates per MB for each direction (L0 and L1) */ + uint32_t reserved1[243]; /**< [in]: Reserved and must be set to 0 */ + void* reserved2[59]; /**< [in]: Reserved and must be set to NULL */ } NV_ENC_MEONLY_PARAMS; /** NV_ENC_MEONLY_PARAMS struct version*/ -#define NV_ENC_MEONLY_PARAMS_VER NVENCAPI_STRUCT_VERSION(2) +#define NV_ENC_MEONLY_PARAMS_VER NVENCAPI_STRUCT_VERSION(3) /** @@ -1627,6 +1719,17 @@ typedef struct _NV_ENC_MAP_INPUT_RESOURCE /** Macro for constructing the version field of ::_NV_ENC_MAP_INPUT_RESOURCE */ #define NV_ENC_MAP_INPUT_RESOURCE_VER NVENCAPI_STRUCT_VERSION(4) +/** + * \struct _NV_ENC_INPUT_RESOURCE_OPENGL_TEX + * NV_ENC_REGISTER_RESOURCE::resourceToRegister must be a pointer to a variable of this type, + * when NV_ENC_REGISTER_RESOURCE::resourceType is NV_ENC_INPUT_RESOURCE_TYPE_OPENGL_TEX + */ +typedef struct _NV_ENC_INPUT_RESOURCE_OPENGL_TEX +{ + uint32_t texture; /**< [in]: The name of the texture to be used. */ + uint32_t target; /**< [in]: Accepted values are GL_TEXTURE_RECTANGLE and GL_TEXTURE_2D. */ +} NV_ENC_INPUT_RESOURCE_OPENGL_TEX; + /** * \struct _NV_ENC_REGISTER_RESOURCE * Register a resource for future use with the Nvidia Video Encoder Interface. @@ -1634,7 +1737,11 @@ typedef struct _NV_ENC_MAP_INPUT_RESOURCE typedef struct _NV_ENC_REGISTER_RESOURCE { uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_REGISTER_RESOURCE_VER. */ - NV_ENC_INPUT_RESOURCE_TYPE resourceType; /**< [in]: Specifies the type of resource to be registered. Supported values are ::NV_ENC_INPUT_RESOURCE_TYPE_DIRECTX, ::NV_ENC_INPUT_RESOURCE_TYPE_CUDADEVICEPTR. */ + NV_ENC_INPUT_RESOURCE_TYPE resourceType; /**< [in]: Specifies the type of resource to be registered. + Supported values are + ::NV_ENC_INPUT_RESOURCE_TYPE_DIRECTX, + ::NV_ENC_INPUT_RESOURCE_TYPE_CUDADEVICEPTR, + ::NV_ENC_INPUT_RESOURCE_TYPE_OPENGL_TEX */ uint32_t width; /**< [in]: Input buffer Width. */ uint32_t height; /**< [in]: Input buffer Height. */ uint32_t pitch; /**< [in]: Input buffer Pitch. */ @@ -2734,7 +2841,7 @@ NVENCSTATUS NVENCAPI NvEncUnregisterAsyncEvent (void* encoder, * mapped resource is returned in the field NV_ENC_MAP_INPUT_RESOURCE::outputResourcePtr. * The NvEncodeAPI interface also returns the buffer format of the mapped resource * in the field NV_ENC_MAP_INPUT_RESOURCE::outbufferFmt. - * This function provides synchronization guarantee that any direct3d or cuda + * This function provides synchronization guarantee that any graphics or compute * work submitted on the input buffer is completed before the buffer is used for encoding. * The client should not access any input buffer while they are mapped by the encoder. * @@ -2865,7 +2972,9 @@ NVENCSTATUS NVENCAPI NvEncInvalidateRefFrames(void* encoder, uint64_t invalidRef * Opens an encoding session and returns a pointer to the encoder interface in * the \p **encoder parameter. The client should start encoding process by calling * this API first. - * The client must pass a pointer to IDirect3DDevice9/CUDA interface in the \p *device parameter. + * The client must pass a pointer to IDirect3DDevice9 device or CUDA context in the \p *device parameter. + * For the OpenGL interface, \p device must be NULL. An OpenGL context must be current when + * calling all NvEncodeAPI functions. * If the creation of encoder session fails, the client must call ::NvEncDestroyEncoder API * before exiting. * @@ -2892,8 +3001,6 @@ NVENCSTATUS NVENCAPI NvEncOpenEncodeSessionEx (NV_ENC_OPEN_ENC * * Registers a resource with the Nvidia Video Encoder Interface for book keeping. * The client is expected to pass the registered resource handle as well, while calling ::NvEncMapInputResource API. - * This API is not implemented for the DirectX Interface. - * DirectX based clients need not change their implementation. * * \param [in] encoder * Pointer to the NVEncodeAPI interface. @@ -2925,8 +3032,6 @@ NVENCSTATUS NVENCAPI NvEncRegisterResource (void* encoder, * Unregisters a resource previously registered with the Nvidia Video Encoder Interface. * The client is expected to unregister any resource that it has registered with the * Nvidia Video Encoder Interface before destroying the resource. - * This API is not implemented for the DirectX Interface. - * DirectX based clients need not change their implementation. * * \param [in] encoder * Pointer to the NVEncodeAPI interface. diff --git a/mythtv/external/FFmpeg/compat/plan9/head b/mythtv/external/FFmpeg/compat/plan9/head deleted file mode 100755 index 2840b2d50f9..00000000000 --- a/mythtv/external/FFmpeg/compat/plan9/head +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -n=10 - -case "$1" in - -n) n=$2; shift 2 ;; - -n*) n=${1#-n}; shift ;; -esac - -exec sed ${n}q "$@" diff --git a/mythtv/external/FFmpeg/compat/plan9/printf b/mythtv/external/FFmpeg/compat/plan9/printf deleted file mode 100755 index 1a70a9e91a9..00000000000 --- a/mythtv/external/FFmpeg/compat/plan9/printf +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec awk "BEGIN { for (i = 2; i < ARGC; i++) printf \"$1\", ARGV[i] }" "$@" diff --git a/mythtv/external/FFmpeg/compat/strtod.c b/mythtv/external/FFmpeg/compat/strtod.c index 3a9452eac2b..8b4243b3132 100644 --- a/mythtv/external/FFmpeg/compat/strtod.c +++ b/mythtv/external/FFmpeg/compat/strtod.c @@ -25,9 +25,9 @@ #include "libavutil/avstring.h" #include "libavutil/mathematics.h" -static char *check_nan_suffix(char *s) +static const char *check_nan_suffix(const char *s) { - char *start = s; + const char *start = s; if (*s++ != '(') return start; @@ -44,7 +44,7 @@ double strtod(const char *, char **); double avpriv_strtod(const char *nptr, char **endptr) { - char *end; + const char *end; double res; /* Skip leading spaces */ @@ -81,13 +81,13 @@ double avpriv_strtod(const char *nptr, char **endptr) !av_strncasecmp(nptr, "+0x", 3)) { /* FIXME this doesn't handle exponents, non-integers (float/double) * and numbers too large for long long */ - res = strtoll(nptr, &end, 16); + res = strtoll(nptr, (char **)&end, 16); } else { - res = strtod(nptr, &end); + res = strtod(nptr, (char **)&end); } if (endptr) - *endptr = end; + *endptr = (char *)end; return res; } diff --git a/mythtv/external/FFmpeg/compat/w32dlfcn.h b/mythtv/external/FFmpeg/compat/w32dlfcn.h new file mode 100644 index 00000000000..78cc8f4c96d --- /dev/null +++ b/mythtv/external/FFmpeg/compat/w32dlfcn.h @@ -0,0 +1,93 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef COMPAT_W32DLFCN_H +#define COMPAT_W32DLFCN_H + +#ifdef _WIN32 +#include +#if (_WIN32_WINNT < 0x0602) || HAVE_WINRT +#include "libavutil/wchar_filename.h" +#endif +/** + * Safe function used to open dynamic libs. This attempts to improve program security + * by removing the current directory from the dll search path. Only dll's found in the + * executable or system directory are allowed to be loaded. + * @param name The dynamic lib name. + * @return A handle to the opened lib. + */ +static inline HMODULE win32_dlopen(const char *name) +{ +#if _WIN32_WINNT < 0x0602 + // Need to check if KB2533623 is available + if (!GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "SetDefaultDllDirectories")) { + HMODULE module = NULL; + wchar_t *path = NULL, *name_w = NULL; + DWORD pathlen; + if (utf8towchar(name, &name_w)) + goto exit; + path = (wchar_t *)av_mallocz_array(MAX_PATH, sizeof(wchar_t)); + // Try local directory first + pathlen = GetModuleFileNameW(NULL, path, MAX_PATH); + pathlen = wcsrchr(path, '\\') - path; + if (pathlen == 0 || pathlen + wcslen(name_w) + 2 > MAX_PATH) + goto exit; + path[pathlen] = '\\'; + wcscpy(path + pathlen + 1, name_w); + module = LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + if (module == NULL) { + // Next try System32 directory + pathlen = GetSystemDirectoryW(path, MAX_PATH); + if (pathlen == 0 || pathlen + wcslen(name_w) + 2 > MAX_PATH) + goto exit; + path[pathlen] = '\\'; + wcscpy(path + pathlen + 1, name_w); + module = LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + } +exit: + av_free(path); + av_free(name_w); + return module; + } +#endif +#ifndef LOAD_LIBRARY_SEARCH_APPLICATION_DIR +# define LOAD_LIBRARY_SEARCH_APPLICATION_DIR 0x00000200 +#endif +#ifndef LOAD_LIBRARY_SEARCH_SYSTEM32 +# define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800 +#endif +#if HAVE_WINRT + wchar_t *name_w = NULL; + int ret; + if (utf8towchar(name, &name_w)) + return NULL; + ret = LoadPackagedLibrary(name_w, 0); + av_free(name_w); + return ret; +#else + return LoadLibraryExA(name, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32); +#endif +} +#define dlopen(name, flags) win32_dlopen(name) +#define dlclose FreeLibrary +#define dlsym GetProcAddress +#else +#include +#endif + +#endif /* COMPAT_W32DLFCN_H */ diff --git a/mythtv/external/FFmpeg/compat/w32pthreads.h b/mythtv/external/FFmpeg/compat/w32pthreads.h index 4ac2a995b84..eeead6051f2 100644 --- a/mythtv/external/FFmpeg/compat/w32pthreads.h +++ b/mythtv/external/FFmpeg/compat/w32pthreads.h @@ -77,7 +77,7 @@ typedef struct pthread_cond_t { static av_unused unsigned __stdcall attribute_align_arg win32thread_worker(void *arg) { - pthread_t *h = arg; + pthread_t *h = (pthread_t*)arg; h->ret = h->func(h->arg); return 0; } @@ -270,7 +270,7 @@ static av_unused int pthread_cond_init(pthread_cond_t *cond, const void *unused_ } /* non native condition variables */ - win32_cond = av_mallocz(sizeof(win32_cond_t)); + win32_cond = (win32_cond_t*)av_mallocz(sizeof(win32_cond_t)); if (!win32_cond) return ENOMEM; cond->Ptr = win32_cond; @@ -288,7 +288,7 @@ static av_unused int pthread_cond_init(pthread_cond_t *cond, const void *unused_ static av_unused int pthread_cond_destroy(pthread_cond_t *cond) { - win32_cond_t *win32_cond = cond->Ptr; + win32_cond_t *win32_cond = (win32_cond_t*)cond->Ptr; /* native condition variables do not destroy */ if (cond_init) return 0; @@ -305,7 +305,7 @@ static av_unused int pthread_cond_destroy(pthread_cond_t *cond) static av_unused int pthread_cond_broadcast(pthread_cond_t *cond) { - win32_cond_t *win32_cond = cond->Ptr; + win32_cond_t *win32_cond = (win32_cond_t*)cond->Ptr; int have_waiter; if (cond_broadcast) { @@ -337,7 +337,7 @@ static av_unused int pthread_cond_broadcast(pthread_cond_t *cond) static av_unused int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) { - win32_cond_t *win32_cond = cond->Ptr; + win32_cond_t *win32_cond = (win32_cond_t*)cond->Ptr; int last_waiter; if (cond_wait) { cond_wait(cond, mutex, INFINITE); @@ -369,7 +369,7 @@ static av_unused int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mu static av_unused int pthread_cond_signal(pthread_cond_t *cond) { - win32_cond_t *win32_cond = cond->Ptr; + win32_cond_t *win32_cond = (win32_cond_t*)cond->Ptr; int have_waiter; if (cond_signal) { cond_signal(cond); @@ -397,20 +397,20 @@ static av_unused int pthread_cond_signal(pthread_cond_t *cond) static av_unused void w32thread_init(void) { #if _WIN32_WINNT < 0x0600 - HANDLE kernel_dll = GetModuleHandle(TEXT("kernel32.dll")); + HMODULE kernel_dll = GetModuleHandle(TEXT("kernel32.dll")); /* if one is available, then they should all be available */ - cond_init = - (void*)GetProcAddress(kernel_dll, "InitializeConditionVariable"); - cond_broadcast = - (void*)GetProcAddress(kernel_dll, "WakeAllConditionVariable"); - cond_signal = - (void*)GetProcAddress(kernel_dll, "WakeConditionVariable"); - cond_wait = - (void*)GetProcAddress(kernel_dll, "SleepConditionVariableCS"); - initonce_begin = - (void*)GetProcAddress(kernel_dll, "InitOnceBeginInitialize"); - initonce_complete = - (void*)GetProcAddress(kernel_dll, "InitOnceComplete"); + cond_init = (void (WINAPI*)(pthread_cond_t *)) + GetProcAddress(kernel_dll, "InitializeConditionVariable"); + cond_broadcast = (void (WINAPI*)(pthread_cond_t *)) + GetProcAddress(kernel_dll, "WakeAllConditionVariable"); + cond_signal = (void (WINAPI*)(pthread_cond_t *)) + GetProcAddress(kernel_dll, "WakeConditionVariable"); + cond_wait = (BOOL (WINAPI*)(pthread_cond_t *, pthread_mutex_t *, DWORD)) + GetProcAddress(kernel_dll, "SleepConditionVariableCS"); + initonce_begin = (BOOL (WINAPI*)(pthread_once_t *, DWORD, BOOL *, void **)) + GetProcAddress(kernel_dll, "InitOnceBeginInitialize"); + initonce_complete = (BOOL (WINAPI*)(pthread_once_t *, DWORD, void *)) + GetProcAddress(kernel_dll, "InitOnceComplete"); #endif } diff --git a/mythtv/external/FFmpeg/configure b/mythtv/external/FFmpeg/configure index 08707a93a42..1797c5dd4f8 100755 --- a/mythtv/external/FFmpeg/configure +++ b/mythtv/external/FFmpeg/configure @@ -63,6 +63,7 @@ Options: [defaults in brackets after descriptions] Help options: --help print this message + --quiet Suppress showing informative output --list-decoders show all available decoders --list-encoders show all available encoders --list-hwaccels show all available hardware accelerators @@ -76,10 +77,10 @@ Help options: --list-filters show all available filters Standard options: - --logfile=FILE log tests and output to FILE [config.log] + --logfile=FILE log tests and output to FILE [ffbuild/config.log] --disable-logging do not log configure debug information --fatal-warnings fail if any configure warning is generated - --prefix=PREFIX install in PREFIX [$prefix] + --prefix=PREFIX install in PREFIX [$prefix_default] --bindir=DIR install binaries in DIR [PREFIX/bin] --datadir=DIR install data files in DIR [PREFIX/share/ffmpeg] --docdir=DIR install documentation in DIR [PREFIX/share/doc/ffmpeg] @@ -90,7 +91,7 @@ Standard options: --pkgconfigdir=DIR install pkg-config files in DIR [LIBDIR/pkgconfig] --enable-rpath use rpath to allow installing libraries in paths not part of the dynamic linker search path - use rpath when linking programs [USE WITH CARE] + use rpath when linking programs (USE WITH CARE) --install-name-dir=DIR Darwin directory name for installed targets Licensing options: @@ -104,11 +105,11 @@ Configuration options: --disable-static do not build static libraries [no] --enable-shared build shared libraries [no] --enable-small optimize for size instead of speed - --disable-runtime-cpudetect disable detecting cpu capabilities at runtime (smaller binary) + --disable-runtime-cpudetect disable detecting CPU capabilities at runtime (smaller binary) --enable-gray enable full grayscale support (slower color) --disable-swscale-alpha disable alpha channel support in swscale --disable-all disable building components, libraries and programs - --enable-raise-major increase major version numbers in sonames [no] + --disable-autodetect disable automatically detected external libraries [no] Program options: --disable-programs do not build command line programs @@ -184,6 +185,7 @@ Individual component options: --enable-filter=NAME enable filter NAME --disable-filter=NAME disable filter NAME --disable-filters disable all filters + --disable-v4l2_m2m disable V4L2 mem2mem code [autodetect] External library support: @@ -200,8 +202,12 @@ External library support: Also note that the following help text describes the purpose of the libraries themselves, not all their features will necessarily be usable by FFmpeg. + --disable-alsa disable ALSA support [autodetect] + --disable-appkit disable Apple AppKit framework [autodetect] + --disable-avfoundation disable Apple AVFoundation framework [autodetect] --enable-avisynth enable reading of AviSynth script files [no] --disable-bzlib disable bzlib [autodetect] + --disable-coreimage disable Apple CoreImage framework [autodetect] --enable-chromaprint enable audio fingerprinting with chromaprint [no] --enable-frei0r enable frei0r video filtering [no] --enable-gcrypt enable gcrypt, needed for rtmp(t)e support @@ -211,6 +217,7 @@ External library support: --enable-gnutls enable gnutls, needed for https support if openssl is not used [no] --disable-iconv disable iconv [autodetect] + --disable-jack disable libjack support [autodetect] --enable-jni enable JNI support [no] --enable-ladspa enable LADSPA audio filtering [no] --enable-libass enable libass subtitles rendering, @@ -222,8 +229,6 @@ External library support: --enable-libcdio enable audio CD grabbing with libcdio [no] --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394 and libraw1394 [no] - --enable-libebur128 enable libebur128 for EBU R128 measurement, - needed for loudnorm filter [no] --enable-libfdk-aac enable AAC de/encoding via libfdk-aac [no] --enable-libflite enable flite (voice synthesis) support via libflite [no] --enable-libfontconfig enable libfontconfig, useful for drawtext filter [no] @@ -236,8 +241,6 @@ External library support: --enable-libkvazaar enable HEVC encoding via libkvazaar [no] --enable-libmodplug enable ModPlug via libmodplug [no] --enable-libmp3lame enable MP3 encoding via libmp3lame [no] - --enable-libnut enable NUT (de)muxing via libnut, - native (de)muxer exists [no] --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no] --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no] --enable-libopencv enable video filtering via libopencv [no] @@ -246,9 +249,9 @@ External library support: --enable-libopenmpt enable decoding tracked files via libopenmpt [no] --enable-libopus enable Opus de/encoding via libopus [no] --enable-libpulse enable Pulseaudio input via libpulse [no] + --enable-librsvg enable SVG rasterization via librsvg [no] --enable-librubberband enable rubberband needed for rubberband filter [no] --enable-librtmp enable RTMP[E] support via librtmp [no] - --enable-libschroedinger enable Dirac de/encoding via libschroedinger [no] --enable-libshine enable fixed-point MP3 encoding via libshine [no] --enable-libsmbclient enable Samba protocol via libsmbclient [no] --enable-libsnappy enable Snappy compression, needed for hap encoding [no] @@ -260,6 +263,7 @@ External library support: --enable-libtwolame enable MP2 encoding via libtwolame [no] --enable-libv4l2 enable libv4l2/v4l-utils [no] --enable-libvidstab enable video stabilization using vid.stab [no] + --enable-libvmaf enable vmaf filter via libvmaf [no] --enable-libvo-amrwbenc enable AMR-WB encoding via libvo-amrwbenc [no] --enable-libvorbis enable Vorbis en/decoding via libvorbis, native implementation exists [no] @@ -275,39 +279,44 @@ External library support: --enable-libxcb-shape enable X11 grabbing shape rendering [autodetect] --enable-libxvid enable Xvid encoding via xvidcore, native MPEG-4/Xvid encoder exists [no] + --enable-libxml2 enable XML parsing using the C library libxml2 [no] --enable-libzimg enable z.lib, needed for zscale filter [no] --enable-libzmq enable message passing via libzmq [no] --enable-libzvbi enable teletext support via libzvbi [no] --disable-lzma disable lzma [autodetect] --enable-decklink enable Blackmagic DeckLink I/O support [no] + --enable-libndi_newtek enable Newteck NDI I/O support [no] --enable-mediacodec enable Android MediaCodec support [no] - --enable-netcdf enable NetCDF, needed for sofalizer filter [no] + --enable-libmysofa enable libmysofa, needed for sofalizer filter [no] --enable-openal enable OpenAL 1.1 capture support [no] --enable-opencl enable OpenCL code --enable-opengl enable OpenGL rendering [no] --enable-openssl enable openssl, needed for https support if gnutls is not used [no] + --disable-sndio disable sndio support [autodetect] --disable-schannel disable SChannel SSP, needed for TLS support on Windows if openssl and gnutls are not used [autodetect] --disable-sdl2 disable sdl2 [autodetect] --disable-securetransport disable Secure Transport, needed for TLS support on OSX if openssl and gnutls are not used [autodetect] - --enable-x11grab enable X11 grabbing (legacy) [no] --disable-xlib disable xlib [autodetect] --disable-zlib disable zlib [autodetect] The following libraries provide various hardware acceleration features: --disable-audiotoolbox disable Apple AudioToolbox code [autodetect] - --enable-cuda enable dynamically linked Nvidia CUDA code [no] - --enable-cuvid enable Nvidia CUVID support [autodetect] + --disable-cuda disable dynamically linked Nvidia CUDA code [autodetect] + --enable-cuda-sdk enable CUDA features that require the CUDA SDK [no] + --disable-cuvid disable Nvidia CUVID support [autodetect] --disable-d3d11va disable Microsoft Direct3D 11 video acceleration code [autodetect] --disable-dxva2 disable Microsoft DirectX 9 video acceleration code [autodetect] + --enable-libdrm enable DRM code (Linux) [no] --enable-libmfx enable Intel MediaSDK (AKA Quick Sync Video) code via libmfx [no] --enable-libnpp enable Nvidia Performance Primitives-based code [no] --enable-mmal enable Broadcom Multi-Media Abstraction Layer (Raspberry Pi) via MMAL [no] --disable-nvenc disable Nvidia video encoding code [autodetect] --enable-omx enable OpenMAX IL code [no] --enable-omx-rpi enable OpenMAX IL code for Raspberry Pi [no] + --enable-rkmpp enable Rockchip Media Process Platform code [no] --disable-vaapi disable Video Acceleration API (mainly Unix/Intel) code [autodetect] --disable-vda disable Apple Video Decode Acceleration code [autodetect] --disable-vdpau disable Nvidia Video Decode and Presentation API for Unix code [autodetect] @@ -334,11 +343,12 @@ Toolchain options: --ln_s=LN_S use symbolic link tool LN_S [$ln_s_default] --strip=STRIP use strip tool STRIP [$strip_default] --windres=WINDRES use windows resource compiler WINDRES [$windres_default] - --yasmexe=EXE use yasm-compatible assembler EXE [$yasmexe_default] + --x86asmexe=EXE use nasm-compatible assembler EXE [$x86asmexe_default] --cc=CC use C compiler CC [$cc_default] --cxx=CXX use C compiler CXX [$cxx_default] --objcc=OCC use ObjC compiler OCC [$cc_default] --dep-cc=DEPCC use dependency generator DEPCC [$cc_default] + --nvcc=NVCC use Nvidia CUDA compiler NVCC [$nvcc_default] --ld=LD use linker LD [$ld_default] --pkg-config=PKGCONFIG use pkg-config tool PKGCONFIG [$pkg_config_default] --pkg-config-flags=FLAGS pass additional flags to pkgconf [] @@ -360,6 +370,7 @@ Toolchain options: --extra-libs=ELIBS add ELIBS [$ELIBS] --extra-version=STRING version string suffix [] --optflags=OPTFLAGS override optimization-related compiler flags + --nvccflags=NVCCFLAGS override nvcc flags [$nvccflags_default] --build-suffix=SUFFIX library name suffix [] --enable-pic build position-independent code --enable-thumb compile for Thumb instruction set @@ -374,7 +385,6 @@ Advanced options (experts only): --disable-safe-bitstream-reader disable buffer boundary checking in bitreaders (faster, but may crash) - --enable-memalign-hack emulate memalign, interferes with memory debuggers --sws-max-filter-size=N the max filter size swscale uses [$sws_max_filter_size_default] Optimization options (experts only): @@ -404,7 +414,7 @@ Optimization options (experts only): --disable-vfp disable VFP optimizations --disable-neon disable NEON optimizations --disable-inline-asm disable use of inline assembly - --disable-yasm disable use of nasm/yasm assembly + --disable-x86asm disable use of standalone x86 assembly --disable-mipsdsp disable MIPS DSP ASE R1 optimizations --disable-mipsdspr2 disable MIPS DSP ASE R2 optimizations --disable-msa disable MSA optimizations @@ -441,6 +451,11 @@ Developer options (useful when working on FFmpeg itself): --random-seed=VALUE seed value for --enable/disable-random --disable-valgrind-backtrace do not print a backtrace under Valgrind (only applies to --disable-optimizations builds) + --enable-osfuzz Enable building fuzzer tool + --libfuzzer=PATH path to libfuzzer + --ignore-tests=TESTS comma-separated list (without "fate-" prefix + in the name) of tests whose result is ignored + --enable-linux-perf enable Linux Performance Monitor API NOTE: Object files are built at the place where configure is launched. EOF @@ -526,7 +541,7 @@ filter(){ pat=$1 shift for v; do - eval "case $v in $pat) echo $v ;; esac" + eval "case $v in $pat) printf '%s ' $v ;; esac" done } @@ -534,7 +549,7 @@ filter_out(){ pat=$1 shift for v; do - eval "case $v in $pat) ;; *) echo $v ;; esac" + eval "case $v in $pat) ;; *) printf '%s ' $v ;; esac" done } @@ -599,6 +614,13 @@ popvar(){ done } +request(){ + for var in $*; do + eval ${var}_requested=yes + eval $var= + done +} + enable(){ set_all yes $* } @@ -655,6 +677,11 @@ enable_deep_weak(){ done } +requested(){ + test "${1#!}" = "$1" && op='=' || op=!= + eval test "x\$${1#!}_requested" $op "xyes" +} + enabled(){ test "${1#!}" = "$1" && op='=' || op=!= eval test "x\$${1#!}" $op "xyes" @@ -707,7 +734,6 @@ is_in(){ do_check_deps(){ for cfg; do - cfg="${cfg#!}" enabled ${cfg}_checking && die "Circular dependency for $cfg." disabled ${cfg}_checking && continue enable ${cfg}_checking @@ -715,20 +741,22 @@ do_check_deps(){ eval dep_all="\$${cfg}_deps" eval dep_any="\$${cfg}_deps_any" + eval dep_con="\$${cfg}_conflict" 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_con dep_sel dep_sgs dep_ifa dep_ifn + do_check_deps $dep_all $dep_any $dep_con $dep_sel $dep_sgs $dep_ifa $dep_ifn + popvar cfg dep_all dep_any dep_con 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_any $dep_sel && disable $cfg + enabled_all $dep_all || { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but not all dependencies are satisfied: $dep_all"; } + enabled_any $dep_any || { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but not any dependency is satisfied: $dep_any"; } + disabled_all $dep_con || { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but some conflicting dependencies are unsatisfied: $dep_con"; } + disabled_any $dep_sel && { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but some selected dependency is unsatisfied: $dep_sel"; } if enabled $cfg; then enable_deep $dep_sel @@ -819,6 +847,10 @@ add_cflags(){ append CFLAGS $($cflags_filter "$@") } +add_cflags_headers(){ + append CFLAGS_HEADERS $($cflags_filter "$@") +} + add_cxxflags(){ append CXXFLAGS $($cflags_filter "$@") } @@ -962,12 +994,12 @@ check_insn(){ echo "$2" | check_as && enable ${1}_external || disable ${1}_external } -check_yasm(){ - log check_yasm "$@" +check_x86asm(){ + log check_x86asm "$@" echo "$1" > $TMPS log_file $TMPS shift 1 - check_cmd $yasmexe $YASMFLAGS -Werror "$@" -o $TMPO $TMPS + check_cmd $x86asmexe $X86ASMFLAGS -Werror "$@" -o $TMPO $TMPS } ld_o(){ @@ -1009,8 +1041,8 @@ check_code(){ check_cppflags(){ log check_cppflags "$@" - check_cc "$@" < EOF } @@ -1036,15 +1068,15 @@ EOF } test_objcflags(){ - log test_cflags "$@" - set -- $($cflags_filter "$@") + log test_objcflags "$@" + set -- $($objcflags_filter "$@") check_objcc "$@" <" echo "int main(void) { return 0; }" - } | check_objcc && check_stat "$TMPO" && enable_safe $headers + } | check_objcc && check_stat "$TMPO" && enable_safe $header +} + +check_apple_framework(){ + log check_apple_framework "$@" + framework="$1" + name="$(tolower $framework)" + header="${framework}/${framework}.h" + disable $name + check_header_objcc $header && enable $name && add_extralibs "-framework $framework" } check_func(){ @@ -1146,10 +1187,16 @@ check_func_headers(){ for hdr in $headers; do print_include $hdr done + echo "#include " for func in $funcs; do echo "long check_$func(void) { return (long) $func; }" done - echo "int main(void) { return 0; }" + echo "int main(void) { int ret = 0;" + # LTO could optimize out the test functions without this + for func in $funcs; do + echo " ret |= ((intptr_t)check_$func) & 0xFFFF;" + done + echo "return ret; }" } | check_ld "cc" "$@" && enable $funcs && enable_safe $headers } @@ -1185,20 +1232,30 @@ check_cpp_condition(){ EOF } -check_lib(){ - log check_lib "$@" - header="$1" - func="$2" - shift 2 - check_header $header && check_func $func "$@" && add_extralibs "$@" +test_cflags_cc(){ + log test_cflags_cc "$@" + flags=$1 + header=$2 + condition=$3 + shift 3 + set -- $($cflags_filter "$flags") + check_cc "$@" < +#if !($condition) +#error "unsatisfied condition: $condition" +#endif +EOF } -check_lib2(){ - log check_lib2 "$@" - headers="$1" - funcs="$2" - shift 2 - check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@" +check_lib(){ + log check_lib "$@" + name="$1" + headers="$2" + funcs="$3" + shift 3 + disable $name + check_func_headers "$headers" "$funcs" "$@" && + enable $name && add_extralibs "$@" } check_lib_cpp(){ @@ -1211,17 +1268,20 @@ check_lib_cpp(){ check_pkg_config(){ log check_pkg_config "$@" - pkgandversion="$1" - pkg="${1%% *}" - headers="$2" - funcs="$3" - shift 3 - check_cmd $pkg_config --exists --print-errors $pkgandversion || return + name="$1" + pkg_version="$2" + pkg="${2%% *}" + headers="$3" + funcs="$4" + shift 4 + disable $name + check_cmd $pkg_config --exists --print-errors $pkg_version || return pkg_cflags=$($pkg_config --cflags $pkg_config_flags $pkg) pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg) check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" && - set_safe "${pkg}_cflags" $pkg_cflags && - set_safe "${pkg}_libs" $pkg_libs + enable $name && + set_safe "${pkg}_cflags" $pkg_cflags && + set_safe "${pkg}_extralibs" $pkg_libs } check_exec(){ @@ -1229,6 +1289,7 @@ check_exec(){ } check_exec_crash(){ + log check_exec_crash "$@" code=$(cat) # exit() is not async signal safe. _Exit (C99) and _exit (POSIX) @@ -1299,19 +1360,13 @@ check_compile_assert(){ } require(){ - name="$1" - header="$2" - func="$3" - shift 3 - check_lib $header $func "$@" || die "ERROR: $name not found" -} - -require2(){ - name="$1" + log require "$@" + name_version="$1" + name="${1%% *}" headers="$2" func="$3" shift 3 - check_lib2 "$headers" $func "$@" || die "ERROR: $name not found" + check_lib $name "$headers" $func "$@" || die "ERROR: $name_version not found" } require_cpp(){ @@ -1322,35 +1377,33 @@ require_cpp(){ check_lib_cpp "$headers" "$classes" "$@" || die "ERROR: $name not found" } +require_header(){ + log require "$@" + header="$1" + shift + check_header "$header" "$@" || die "ERROR: $header header not found" +} + +require_cpp_condition(){ + log require "$@" + header="$1" + condition="$2" + shift 2 + check_cpp_condition "$header" "$condition" "$@" || die "ERROR: $condition not satisfied" +} + use_pkg_config(){ - pkg="$1" + log use_pkg_config "$@" + pkg="${2%% *}" check_pkg_config "$@" || return 1 add_cflags $(get_safe "${pkg}_cflags") - add_extralibs $(get_safe "${pkg}_libs") + add_extralibs $(get_safe "${pkg}_extralibs") } require_pkg_config(){ - use_pkg_config "$@" || die "ERROR: $pkg not found using pkg-config$pkg_config_fail_message" -} - -require_libfreetype(){ - log require_libfreetype "$@" - pkg="freetype2" - check_cmd $pkg_config --exists --print-errors $pkg \ - || die "ERROR: $pkg not found" - pkg_cflags=$($pkg_config --cflags $pkg_config_flags $pkg) - pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg) - { - echo "#include " - echo "#include FT_FREETYPE_H" - echo "long check_func(void) { return (long) FT_Init_FreeType; }" - echo "int main(void) { return 0; }" - } | check_ld "cc" $pkg_cflags $pkg_libs \ - && set_safe "${pkg}_cflags" $pkg_cflags \ - && set_safe "${pkg}_libs" $pkg_libs \ - || die "ERROR: $pkg not found" - add_cflags $(get_safe "${pkg}_cflags") - add_extralibs $(get_safe "${pkg}_libs") + log require_pkg_config "$@" + pkg_version="$2" + use_pkg_config "$@" || die "ERROR: $pkg_version not found using pkg-config$pkg_config_fail_message" } hostcc_e(){ @@ -1377,8 +1430,8 @@ check_host_cpp(){ check_host_cppflags(){ log check_host_cppflags "$@" - check_host_cc "$@" < EOF } @@ -1404,9 +1457,9 @@ EOF } cp_if_changed(){ - cmp -s "$1" "$2" && echo "$2 is unchanged" && return + cmp -s "$1" "$2" && { test "$quiet" != "yes" && echo "$2 is unchanged"; } && return mkdir -p "$(dirname $2)" - $cp_f "$1" "$2" + cp -f "$1" "$2" } # CONFIG_LIST contains configurable options, while HAVE_LIST is for @@ -1424,9 +1477,11 @@ AVDEVICE_COMPONENTS=" indevs outdevs " + AVFILTER_COMPONENTS=" filters " + AVFORMAT_COMPONENTS=" demuxers muxers @@ -1434,6 +1489,7 @@ AVFORMAT_COMPONENTS=" " AVRESAMPLE_COMPONENTS="" + AVUTIL_COMPONENTS="" COMPONENT_LIST=" @@ -1448,13 +1504,17 @@ COMPONENT_LIST=" EXAMPLE_LIST=" avio_dir_cmd_example avio_reading_example - decoding_encoding_example + decode_audio_example + decode_video_example demuxing_decoding_example + encode_audio_example + encode_video_example extract_mvs_example filter_audio_example filtering_audio_example filtering_video_example http_multiclient_example + hw_decode_example metadata_example muxing_example qsvdec_example @@ -1465,28 +1525,76 @@ EXAMPLE_LIST=" transcoding_example " -EXTERNAL_LIBRARY_LIST=" - avisynth +EXTERNAL_AUTODETECT_LIBRARY_LIST=" + alsa + appkit + avfoundation bzlib - chromaprint - crystalhd - decklink + coreimage + iconv + jack + libxcb + libxcb_shm + libxcb_shape + libxcb_xfixes + lzma + schannel + sdl2 + securetransport + sndio + xlib + zlib +" + +EXTERNAL_LIBRARY_GPL_LIST=" + avisynth frei0r - gcrypt + libcdio + librubberband + libvidstab + libx264 + libx265 + libxavs + libxvid +" + +EXTERNAL_LIBRARY_NONFREE_LIST=" + decklink + libndi_newtek + libfdk_aac + openssl +" + +EXTERNAL_LIBRARY_VERSION3_LIST=" gmp + libopencore_amrnb + libopencore_amrwb + libvo_amrwbenc + rkmpp +" + +EXTERNAL_LIBRARY_GPLV3_LIST=" + libsmbclient +" + +EXTERNAL_LIBRARY_LIST=" + $EXTERNAL_AUTODETECT_LIBRARY_LIST + $EXTERNAL_LIBRARY_GPL_LIST + $EXTERNAL_LIBRARY_NONFREE_LIST + $EXTERNAL_LIBRARY_VERSION3_LIST + $EXTERNAL_LIBRARY_GPLV3_LIST + chromaprint + gcrypt gnutls - iconv jni ladspa libass libbluray libbs2b libcaca - libcdio libcelt libdc1394 - libebur128 - libfdk_aac + libdrm libflite libfontconfig libfreetype @@ -1498,18 +1606,15 @@ EXTERNAL_LIBRARY_LIST=" libkvazaar libmodplug libmp3lame - libnut - libopencore_amrnb - libopencore_amrwb + libmysofa libopencv libopenh264 libopenjpeg libopenmpt libopus libpulse + librsvg librtmp - librubberband - libschroedinger libshine libsmbclient libsnappy @@ -1520,58 +1625,50 @@ EXTERNAL_LIBRARY_LIST=" libtheora libtwolame libv4l2 - libvidstab - libvo_amrwbenc + libvmaf libvorbis libvpx libwavpack libwebp - libx264 - libx265 - libxavs - libxcb - libxcb_shm - libxcb_shape - libxcb_xfixes - libxvid + libxml2 libzimg libzmq libzvbi - lzma mediacodec - netcdf openal opencl opengl - openssl - schannel - sdl - sdl2 - securetransport - videotoolbox - x11grab - xlib - zlib " -HWACCEL_LIBRARY_LIST=" +HWACCEL_AUTODETECT_LIBRARY_LIST=" audiotoolbox + crystalhd cuda cuvid d3d11va dxva2 - libmfx - libnpp - mmal nvenc - omx vaapi vda vdpau - videotoolbox_hwaccel + videotoolbox + v4l2_m2m xvmc " +HWACCEL_LIBRARY_NONFREE_LIST=" + cuda_sdk + libnpp +" + +HWACCEL_LIBRARY_LIST=" + $HWACCEL_AUTODETECT_LIBRARY_LIST + $HWACCEL_LIBRARY_NONFREE_LIST + libmfx + mmal + omx +" + DOCUMENT_LIST=" doc htmlpages @@ -1633,8 +1730,8 @@ SUBSYSTEM_LIST=" rdft " +# COMPONENT_LIST needs to come last to ensure correct dependency checking CONFIG_LIST=" - $COMPONENT_LIST $DOCUMENT_LIST $EXAMPLE_LIST $EXTERNAL_LIBRARY_LIST @@ -1644,16 +1741,17 @@ CONFIG_LIST=" $LIBRARY_LIST $PROGRAM_LIST $SUBSYSTEM_LIST + autodetect fontconfig - memalign_hack + linux_perf memory_poisoning neon_clobber_test + ossfuzz pic - pod2man - raise_major thumb valgrind_backtrace xmm_clobber_test + $COMPONENT_LIST " THREADS_LIST=" @@ -1668,6 +1766,12 @@ ATOMICS_LIST=" atomics_win32 " +AUTODETECT_LIBS=" + $EXTERNAL_AUTODETECT_LIBRARY_LIST + $HWACCEL_AUTODETECT_LIBRARY_LIST + $THREADS_LIST +" + ARCH_LIST=" aarch64 alpha @@ -1775,11 +1879,11 @@ ARCH_FEATURES=" local_aligned_16 local_aligned_32 simd_align_16 + simd_align_32 " BUILTIN_LIST=" atomic_cas_ptr - atomic_compare_exchange machine_rw_barrier MemoryBarrier mm_empty @@ -1791,7 +1895,7 @@ BUILTIN_LIST=" HAVE_LIST_CMDLINE=" inline_asm symver - yasm + x86asm " HAVE_LIST_PUB=" @@ -1800,12 +1904,13 @@ HAVE_LIST_PUB=" " HEADERS_LIST=" - alsa_asoundlib_h altivec_h arpa_inet_h asm_types_h cdio_paranoia_h cdio_paranoia_paranoia_h + cuda_h + d3d11_h dispatch_dispatch_h dev_bktr_ioctl_bt848_h dev_bktr_ioctl_meteor_h @@ -1815,7 +1920,7 @@ HEADERS_LIST=" direct_h dirent_h dlfcn_h - d3d11_h + dxgidebug_h dxva_h ES2_gl_h gsm_h @@ -1825,13 +1930,15 @@ HEADERS_LIST=" machine_ioctl_meteor_h malloc_h opencv2_core_core_c_h + openjpeg_2_3_openjpeg_h + openjpeg_2_2_openjpeg_h openjpeg_2_1_openjpeg_h openjpeg_2_0_openjpeg_h openjpeg_1_5_openjpeg_h OpenGL_gl3_h poll_h - sndio_h soundcard_h + stdatomic_h sys_mman_h sys_param_h sys_resource_h @@ -1898,7 +2005,6 @@ SYSTEM_FUNCS=" CommandLineToArgvW CoTaskMemFree CryptGenRandom - dlopen fcntl flt_lim fork @@ -1949,11 +2055,13 @@ SYSTEM_FUNCS=" TOOLCHAIN_FEATURES=" as_dn_directive + as_fpu_directive as_func as_object_arch asm_mod_q attribute_may_alias attribute_packed + blocks_extension ebp_available ebx_available gnu_as @@ -1973,6 +2081,7 @@ TOOLCHAIN_FEATURES=" TYPES_LIST=" CONDITION_VARIABLE_Ptr + kCMVideoCodecType_HEVC socklen_t struct_addrinfo struct_group_source_req @@ -2008,25 +2117,20 @@ HAVE_LIST=" $TYPES_LIST atomics_native dos_paths - dxva2_lib - dxva2api_cobj libc_msvcrt - libdc1394_1 - libdc1394_2 makeinfo makeinfo_html MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS perl pod2man - sdl2 section_data_rel_ro texi2html threads + uwp vaapi_drm vaapi_x11 vdpau_x11 winrt - xlib " # options emitted with CONFIG_ prefix but not available on the command line @@ -2053,15 +2157,17 @@ CONFIG_EXTRA=" h263dsp h264chroma h264dsp + h264parse h264pred h264qpel + hevcparse hpeldsp huffman huffyuvdsp huffyuvencdsp idctdsp iirfilter - imdct15 + mdct15 intrax8 iso_media ividsp @@ -2070,12 +2176,14 @@ CONFIG_EXTRA=" libx262 llauddsp llviddsp + llvidencdsp lpc lzf me_cmp mpeg_er mpegaudio mpegaudiodsp + mpegaudioheader mpegvideo mpegvideoenc mss34dsp @@ -2097,13 +2205,13 @@ CONFIG_EXTRA=" texturedsp texturedspenc tpeldsp + vaapi_1 vaapi_encode vc1dsp videodsp vp3dsp vp56dsp vp8dsp - vt_bt2020 wma_freqs wmv2dsp " @@ -2157,10 +2265,11 @@ CMDLINE_SET=" gas host_cc host_cflags + host_extralibs host_ld host_ldflags - host_libs host_os + ignore_tests install ld ln_s @@ -2168,6 +2277,7 @@ CMDLINE_SET=" malloc_prefix nm optflags + nvccflags pkg_config pkg_config_flags progs_suffix @@ -2185,7 +2295,7 @@ CMDLINE_SET=" tempprefix toolchain valgrind - yasmexe + x86asmexe " CMDLINE_APPEND=" @@ -2253,7 +2363,7 @@ fma3_deps="avx" fma4_deps="avx" avx2_deps="avx" -mmx_external_deps="yasm" +mmx_external_deps="x86asm" mmx_inline_deps="inline_asm" mmx_suggest="mmx_external mmx_inline" @@ -2269,13 +2379,15 @@ fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64" fast_clz_if_any="aarch64 alpha avr32 mips ppc x86" fast_unaligned_if_any="aarch64 ppc x86" simd_align_16_if_any="altivec neon sse" +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_conflict="optimizations" +valgrind_backtrace_deps="valgrind_valgrind_h" # threading support -atomics_gcc_if_any="sync_val_compare_and_swap atomic_compare_exchange" +atomics_gcc_if="sync_val_compare_and_swap" atomics_suncc_if="atomic_cas_ptr machine_rw_barrier" atomics_win32_if="MemoryBarrier" atomics_native_if_any="$ATOMICS_LIST" @@ -2289,12 +2401,14 @@ error_resilience_select="me_cmp" faandct_deps="faan fdctdsp" faanidct_deps="faan idctdsp" h264dsp_select="startcode" +hevcparse_select="golomb" frame_thread_encoder_deps="encoders threads" intrax8_select="blockdsp idctdsp" mdct_select="fft" +mdct15_select="fft" me_cmp_select="fdctdsp idctdsp pixblockdsp" mpeg_er_select="error_resilience" -mpegaudio_select="mpegaudiodsp" +mpegaudio_select="mpegaudiodsp mpegaudioheader" mpegaudiodsp_select="dct" mpegvideo_select="blockdsp h264chroma hpeldsp idctdsp me_cmp mpeg_er videodsp" mpegvideoenc_select="me_cmp mpegvideo pixblockdsp qpeldsp" @@ -2302,7 +2416,7 @@ vc1dsp_select="h264chroma qpeldsp startcode" rdft_select="fft" # decoders / encoders -aac_decoder_select="imdct15 mdct sinewin" +aac_decoder_select="mdct15 mdct sinewin" aac_fixed_decoder_select="mdct sinewin" aac_encoder_select="audio_frame_queue iirfilter lpc mdct sinewin" aac_latm_decoder_select="aac_decoder aac_latm_parser" @@ -2321,7 +2435,7 @@ amv_decoder_select="sp5x_decoder exif" amv_encoder_select="aandcttables jpegtables mpegvideoenc" ape_decoder_select="bswapdsp llauddsp" apng_decoder_select="zlib" -apng_encoder_select="huffyuvencdsp zlib" +apng_encoder_select="llvidencdsp zlib" asv1_decoder_select="blockdsp bswapdsp idctdsp" asv1_encoder_select="bswapdsp fdctdsp pixblockdsp" asv2_decoder_select="blockdsp bswapdsp idctdsp" @@ -2334,6 +2448,7 @@ bink_decoder_select="blockdsp hpeldsp" binkaudio_dct_decoder_select="mdct rdft dct sinewin wma_freqs" binkaudio_rdft_decoder_select="mdct rdft sinewin wma_freqs" cavs_decoder_select="blockdsp golomb h264chroma idctdsp qpeldsp videodsp" +clearvideo_decoder_select="idctdsp" cllc_decoder_select="bswapdsp" comfortnoise_encoder_select="lpc" cook_decoder_select="audiodsp mdct sinewin" @@ -2344,6 +2459,7 @@ dds_decoder_select="texturedsp" dirac_decoder_select="dirac_parse dwt golomb videodsp mpegvideoenc" dnxhd_decoder_select="blockdsp idctdsp" dnxhd_encoder_select="aandcttables blockdsp fdctdsp idctdsp mpegvideoenc pixblockdsp" +dolby_e_decoder_select="mdct" dvvideo_decoder_select="dvprofile idctdsp" dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp" dxa_decoder_select="zlib" @@ -2354,13 +2470,13 @@ eamad_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpegvideo" eatgq_decoder_select="aandcttables" eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp" exr_decoder_select="zlib" -ffv1_decoder_select="golomb rangecoder" +ffv1_decoder_select="rangecoder" ffv1_encoder_select="rangecoder" ffvhuff_decoder_select="huffyuv_decoder" ffvhuff_encoder_select="huffyuv_encoder" fic_decoder_select="golomb" -flac_decoder_select="flacdsp golomb" -flac_encoder_select="bswapdsp flacdsp golomb lpc" +flac_decoder_select="flacdsp" +flac_encoder_select="bswapdsp flacdsp lpc" flashsv2_decoder_select="zlib" flashsv2_encoder_select="zlib" flashsv_decoder_select="zlib" @@ -2378,36 +2494,33 @@ h263_encoder_select="aandcttables h263dsp mpegvideoenc" h263i_decoder_select="h263_decoder" h263p_decoder_select="h263_decoder" h263p_encoder_select="h263_encoder" -h264_decoder_select="cabac golomb h264chroma h264dsp h264pred h264qpel videodsp" +h264_decoder_select="cabac golomb h264chroma h264dsp h264parse h264pred h264qpel videodsp" h264_decoder_suggest="error_resilience" hap_decoder_select="snappy texturedsp" hap_encoder_deps="libsnappy" hap_encoder_select="texturedspenc" -hevc_decoder_select="bswapdsp cabac golomb videodsp" +hevc_decoder_select="bswapdsp cabac golomb hevcparse videodsp" huffyuv_decoder_select="bswapdsp huffyuvdsp llviddsp" -huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp llviddsp" +huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp llvidencdsp" iac_decoder_select="imc_decoder" imc_decoder_select="bswapdsp fft mdct sinewin" indeo3_decoder_select="hpeldsp" indeo4_decoder_select="ividsp" indeo5_decoder_select="ividsp" interplay_video_decoder_select="hpeldsp" -jpegls_decoder_select="golomb mjpeg_decoder" -jpegls_encoder_select="golomb" +jpegls_decoder_select="mjpeg_decoder" jv_decoder_select="blockdsp" -lagarith_decoder_select="huffyuvdsp" -ljpeg_encoder_select="aandcttables idctdsp jpegtables" -loco_decoder_select="golomb" -magicyuv_decoder_select="huffyuvdsp" +lagarith_decoder_select="llviddsp" +ljpeg_encoder_select="aandcttables idctdsp jpegtables mpegvideoenc" +magicyuv_decoder_select="llviddsp" mdec_decoder_select="blockdsp idctdsp mpegvideo" metasound_decoder_select="lsp mdct sinewin" mimic_decoder_select="blockdsp bswapdsp hpeldsp idctdsp" mjpeg_decoder_select="blockdsp hpeldsp exif idctdsp jpegtables" mjpeg_encoder_select="aandcttables jpegtables mpegvideoenc" mjpegb_decoder_select="mjpeg_decoder" -mjpeg_vaapi_encoder_deps="VAEncPictureParameterBufferJPEG" -mjpeg_vaapi_encoder_select="vaapi_encode jpegtables" mlp_decoder_select="mlp_parser" +mlp_encoder_select="lpc" motionpixels_decoder_select="bswapdsp" mp1_decoder_select="mpegaudio" mp1float_decoder_select="mpegaudio" @@ -2421,8 +2534,8 @@ mp3on4_decoder_select="mpegaudio" mp3on4float_decoder_select="mpegaudio" mpc7_decoder_select="bswapdsp mpegaudiodsp" mpc8_decoder_select="mpegaudiodsp" -#MYTH mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h" -#MYTH mpeg_xvmc_decoder_select="mpeg2video_decoder" +mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h" +mpeg_xvmc_decoder_select="mpeg2video_decoder" mpegvideo_decoder_select="mpegvideo" mpeg1video_decoder_select="mpegvideo" mpeg1video_encoder_select="aandcttables mpegvideoenc h263dsp" @@ -2431,12 +2544,13 @@ mpeg2video_encoder_select="aandcttables mpegvideoenc h263dsp" mpeg4_decoder_select="h263_decoder mpeg4video_parser" mpeg4_encoder_select="h263_encoder" msa1_decoder_select="mss34dsp" +mscc_decoder_select="zlib" msmpeg4v1_decoder_select="h263_decoder" msmpeg4v2_decoder_select="h263_decoder" msmpeg4v2_encoder_select="h263_encoder" msmpeg4v3_decoder_select="h263_decoder" msmpeg4v3_encoder_select="h263_encoder" -mss2_decoder_select="vc1_decoder mpegvideo" +mss2_decoder_select="mpegvideo qpeldsp vc1_decoder" mts2_decoder_select="mss34dsp" mxpeg_decoder_select="mjpeg_decoder" nellymoser_decoder_select="mdct sinewin" @@ -2444,9 +2558,10 @@ nellymoser_encoder_select="audio_frame_queue mdct sinewin" nuv_decoder_select="idctdsp lzo" on2avc_decoder_select="mdct" opus_decoder_deps="swresample" -opus_decoder_select="imdct15" +opus_decoder_select="mdct15" +opus_encoder_select="audio_frame_queue mdct15" png_decoder_select="zlib" -png_encoder_select="huffyuvencdsp zlib" +png_encoder_select="llvidencdsp zlib" prores_decoder_select="blockdsp idctdsp" prores_encoder_select="fdctdsp" qcelp_decoder_select="lsp" @@ -2464,7 +2579,7 @@ rv20_encoder_select="h263_encoder" rv30_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp" rv40_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp" screenpresso_decoder_select="zlib" -shorten_decoder_select="golomb" +shorten_decoder_select="bswapdsp" sipr_decoder_select="lsp" snow_decoder_select="dwt h264qpel hpeldsp me_cmp rangecoder videodsp" snow_encoder_select="aandcttables dwt h264qpel hpeldsp me_cmp mpegvideoenc rangecoder" @@ -2472,9 +2587,10 @@ sonic_decoder_select="golomb rangecoder" sonic_encoder_select="golomb rangecoder" sonic_ls_encoder_select="golomb rangecoder" sp5x_decoder_select="mjpeg_decoder" +srgc_decoder_select="zlib" svq1_decoder_select="hpeldsp" svq1_encoder_select="aandcttables hpeldsp me_cmp mpegvideoenc" -svq3_decoder_select="golomb h264dsp h264pred hpeldsp tpeldsp videodsp" +svq3_decoder_select="golomb h264dsp h264parse h264pred hpeldsp tpeldsp videodsp" svq3_decoder_suggest="zlib" tak_decoder_select="audiodsp" tdsc_decoder_select="zlib mjpeg_decoder" @@ -2483,17 +2599,18 @@ thp_decoder_select="mjpeg_decoder" tiff_decoder_suggest="zlib lzma" tiff_encoder_suggest="zlib" truehd_decoder_select="mlp_parser" +truehd_encoder_select="lpc" truemotion2_decoder_select="bswapdsp" truespeech_decoder_select="bswapdsp" tscc_decoder_select="zlib" twinvq_decoder_select="mdct lsp sinewin" txd_decoder_select="texturedsp" -utvideo_decoder_select="bswapdsp" -utvideo_encoder_select="bswapdsp huffman huffyuvencdsp" -vble_decoder_select="huffyuvdsp" +utvideo_decoder_select="bswapdsp llviddsp" +utvideo_encoder_select="bswapdsp huffman llvidencdsp" +vble_decoder_select="llviddsp" vc1_decoder_select="blockdsp h263_decoder h264qpel intrax8 mpegvideo vc1dsp" vc1_qsv_decoder_deps="libmfx" -vc1_qsv_decoder_select="qsvdec vc1_qsv_hwaccel" +vc1_qsv_decoder_select="qsvdec vc1_qsv_hwaccel vc1_parser" vc1image_decoder_select="vc1_decoder" vorbis_decoder_select="mdct" vorbis_encoder_select="mdct" @@ -2527,64 +2644,53 @@ zlib_encoder_select="zlib" zmbv_decoder_select="zlib" zmbv_encoder_select="zlib" -# platform codecs -audiotoolbox_deps="AudioToolbox_AudioToolbox_h" -audiotoolbox_extralibs="-framework CoreFoundation -framework AudioToolbox -framework CoreMedia" - # hardware accelerators crystalhd_deps="libcrystalhd_libcrystalhd_if_h" +cuda_deps_any="libdl LoadLibrary" cuvid_deps="cuda" d3d11va_deps="d3d11_h dxva_h ID3D11VideoDecoder ID3D11VideoContext" -dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode" -vaapi_deps="va_va_h" -vda_framework_deps="VideoDecodeAcceleration_VDADecoder_h" +dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode ole32" +dxva2_extralibs="-luser32" +vda_framework_deps="VideoDecodeAcceleration_VDADecoder_h blocks_extension" vda_framework_extralibs="-framework VideoDecodeAcceleration" vda_deps="vda_framework pthreads" vda_extralibs="-framework CoreFoundation -framework QuartzCore" -vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h" videotoolbox_hwaccel_deps="videotoolbox pthreads" videotoolbox_hwaccel_extralibs="-framework QuartzCore" xvmc_deps="X11_extensions_XvMClib_h" -h263_cuvid_hwaccel_deps="cuda cuvid" h263_vaapi_hwaccel_deps="vaapi" h263_vaapi_hwaccel_select="h263_decoder" h263_videotoolbox_hwaccel_deps="videotoolbox" h263_videotoolbox_hwaccel_select="h263_decoder" -h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser" h264_cuvid_hwaccel_deps="cuda cuvid" +h264_cuvid_hwaccel_select="h264_cuvid_decoder" h264_d3d11va_hwaccel_deps="d3d11va" h264_d3d11va_hwaccel_select="h264_decoder" +h264_d3d11va2_hwaccel_deps="d3d11va" +h264_d3d11va2_hwaccel_select="h264_decoder" h264_dxva2_hwaccel_deps="dxva2" h264_dxva2_hwaccel_select="h264_decoder" -h264_mediacodec_decoder_deps="mediacodec" h264_mediacodec_hwaccel_deps="mediacodec" -h264_mediacodec_decoder_select="h264_mp4toannexb_bsf h264_parser" -h264_mmal_decoder_deps="mmal" -h264_mmal_decoder_select="mmal" h264_mmal_hwaccel_deps="mmal" -h264_omx_encoder_deps="omx" h264_qsv_hwaccel_deps="libmfx" h264_vaapi_hwaccel_deps="vaapi" h264_vaapi_hwaccel_select="h264_decoder" -h264_vda_decoder_deps="vda" -h264_vda_decoder_select="h264_decoder" h264_vda_hwaccel_deps="vda" h264_vda_hwaccel_select="h264_decoder" h264_vda_old_hwaccel_deps="vda" h264_vda_old_hwaccel_select="h264_decoder" -h264_vdpau_decoder_deps="vdpau" -h264_vdpau_decoder_select="h264_decoder" h264_vdpau_hwaccel_deps="vdpau" h264_vdpau_hwaccel_select="h264_decoder" h264_videotoolbox_hwaccel_deps="videotoolbox" h264_videotoolbox_hwaccel_select="h264_decoder" hevc_cuvid_hwaccel_deps="cuda cuvid" +hevc_cuvid_hwaccel_select="hevc_cuvid_decoder" hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC" hevc_d3d11va_hwaccel_select="hevc_decoder" -hevc_mediacodec_decoder_deps="mediacodec" hevc_mediacodec_hwaccel_deps="mediacodec" -hevc_mediacodec_decoder_select="hevc_mp4toannexb_bsf hevc_parser" +hevc_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_HEVC" +hevc_d3d11va2_hwaccel_select="hevc_decoder" hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC" hevc_dxva2_hwaccel_select="hevc_decoder" hevc_qsv_hwaccel_deps="libmfx" @@ -2592,28 +2698,29 @@ hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC" hevc_vaapi_hwaccel_select="hevc_decoder" hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC" hevc_vdpau_hwaccel_select="hevc_decoder" +hevc_videotoolbox_hwaccel_deps="videotoolbox" +hevc_videotoolbox_hwaccel_select="hevc_decoder" mjpeg_cuvid_hwaccel_deps="cuda cuvid" -mpeg_vdpau_decoder_deps="vdpau" -mpeg_vdpau_decoder_select="mpeg2video_decoder" +mjpeg_cuvid_hwaccel_select="mjpeg_cuvid_decoder" mpeg_xvmc_hwaccel_deps="xvmc" mpeg_xvmc_hwaccel_select="mpeg2video_decoder" mpeg1_cuvid_hwaccel_deps="cuda cuvid" -mpeg1_vdpau_decoder_deps="vdpau" -mpeg1_vdpau_decoder_select="mpeg1video_decoder" +mpeg1_cuvid_hwaccel_select="mpeg1_cuvid_decoder" mpeg1_vdpau_hwaccel_deps="vdpau" mpeg1_vdpau_hwaccel_select="mpeg1video_decoder" mpeg1_videotoolbox_hwaccel_deps="videotoolbox" mpeg1_videotoolbox_hwaccel_select="mpeg1video_decoder" mpeg1_xvmc_hwaccel_deps="xvmc" mpeg1_xvmc_hwaccel_select="mpeg1video_decoder" -mpeg2_crystalhd_decoder_select="crystalhd" mpeg2_cuvid_hwaccel_deps="cuda cuvid" +mpeg2_cuvid_hwaccel_select="mpeg2_cuvid_decoder" mpeg2_d3d11va_hwaccel_deps="d3d11va" mpeg2_d3d11va_hwaccel_select="mpeg2video_decoder" +mpeg2_d3d11va2_hwaccel_deps="d3d11va" +mpeg2_d3d11va2_hwaccel_select="mpeg2video_decoder" mpeg2_dxva2_hwaccel_deps="dxva2" mpeg2_dxva2_hwaccel_select="mpeg2video_decoder" -mpeg2_mmal_decoder_deps="mmal" -mpeg2_mmal_decoder_select="mmal" +mpeg2_mediacodec_hwaccel_deps="mediacodec" mpeg2_mmal_hwaccel_deps="mmal" mpeg2_qsv_hwaccel_deps="libmfx" mpeg2_qsv_hwaccel_select="qsvdec_mpeg2" @@ -2625,117 +2732,168 @@ mpeg2_videotoolbox_hwaccel_deps="videotoolbox" mpeg2_videotoolbox_hwaccel_select="mpeg2video_decoder" mpeg2_xvmc_hwaccel_deps="xvmc" mpeg2_xvmc_hwaccel_select="mpeg2video_decoder" -mpeg4_crystalhd_decoder_select="crystalhd" mpeg4_cuvid_hwaccel_deps="cuda cuvid" -mpeg4_mediacodec_decoder_deps="mediacodec" +mpeg4_cuvid_hwaccel_select="mpeg4_cuvid_decoder" mpeg4_mediacodec_hwaccel_deps="mediacodec" -mpeg4_mmal_decoder_deps="mmal" -mpeg4_mmal_decoder_select="mmal" mpeg4_mmal_hwaccel_deps="mmal" -mpeg4_omx_encoder_deps="omx" mpeg4_vaapi_hwaccel_deps="vaapi" mpeg4_vaapi_hwaccel_select="mpeg4_decoder" -mpeg4_vdpau_decoder_deps="vdpau" -mpeg4_vdpau_decoder_select="mpeg4_decoder" mpeg4_vdpau_hwaccel_deps="vdpau" mpeg4_vdpau_hwaccel_select="mpeg4_decoder" mpeg4_videotoolbox_hwaccel_deps="videotoolbox" mpeg4_videotoolbox_hwaccel_select="mpeg4_decoder" -msmpeg4_crystalhd_decoder_select="crystalhd" -vc1_crystalhd_decoder_select="crystalhd" vc1_cuvid_hwaccel_deps="cuda cuvid" +vc1_cuvid_hwaccel_select="vc1_cuvid_decoder" vc1_d3d11va_hwaccel_deps="d3d11va" vc1_d3d11va_hwaccel_select="vc1_decoder" +vc1_d3d11va2_hwaccel_deps="d3d11va" +vc1_d3d11va2_hwaccel_select="vc1_decoder" vc1_dxva2_hwaccel_deps="dxva2" vc1_dxva2_hwaccel_select="vc1_decoder" -vc1_mmal_decoder_deps="mmal" -vc1_mmal_decoder_select="mmal" vc1_mmal_hwaccel_deps="mmal" vc1_qsv_hwaccel_deps="libmfx" vc1_qsv_hwaccel_select="qsvdec_vc1" vc1_vaapi_hwaccel_deps="vaapi" vc1_vaapi_hwaccel_select="vc1_decoder" -vc1_vdpau_decoder_deps="vdpau" -vc1_vdpau_decoder_select="vc1_decoder" vc1_vdpau_hwaccel_deps="vdpau" vc1_vdpau_hwaccel_select="vc1_decoder" vp8_cuvid_hwaccel_deps="cuda cuvid" +vp8_cuvid_hwaccel_select="vp8_cuvid_decoder" vp9_cuvid_hwaccel_deps="cuda cuvid" -vp8_mediacodec_decoder_deps="mediacodec" +vp9_cuvid_hwaccel_select="vp9_cuvid_decoder" vp8_mediacodec_hwaccel_deps="mediacodec" +vp8_qsv_hwaccel_deps="libmfx" vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9" vp9_d3d11va_hwaccel_select="vp9_decoder" +vp9_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_VP9" +vp9_d3d11va2_hwaccel_select="vp9_decoder" vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9" vp9_dxva2_hwaccel_select="vp9_decoder" -vp9_mediacodec_decoder_deps="mediacodec" vp9_mediacodec_hwaccel_deps="mediacodec" -vp9_vaapi_hwaccel_deps="vaapi VADecPictureParameterBufferVP9" +vp9_vaapi_hwaccel_deps="vaapi VADecPictureParameterBufferVP9_bit_depth" vp9_vaapi_hwaccel_select="vp9_decoder" -wmv3_crystalhd_decoder_select="crystalhd" wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel" +wmv3_d3d11va2_hwaccel_select="vc1_d3d11va2_hwaccel" wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel" wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel" -wmv3_vdpau_decoder_select="vc1_vdpau_decoder" wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel" # hardware-accelerated codecs -omx_deps="dlopen pthreads" -omx_extralibs='$ldl' +omx_deps="libdl pthreads" +omx_rpi_select="omx" qsvdec_select="qsv" qsvenc_select="qsv" vaapi_encode_deps="vaapi" +v4l2_m2m_deps_any="linux_videodev2_h" hwupload_cuda_filter_deps="cuda" scale_npp_filter_deps="cuda libnpp" +scale_cuda_filter_deps="cuda_sdk" +thumbnail_cuda_filter_deps="cuda_sdk" -nvenc_deps_any="dlopen LoadLibrary" +nvenc_deps="cuda" +nvenc_deps_any="libdl LoadLibrary" nvenc_encoder_deps="nvenc" -h263_cuvid_decoder_deps="cuda cuvid" -h263_cuvid_decoder_select="h263_cuvid_hwaccel" + +h263_v4l2m2m_decoder_deps="v4l2_m2m h263_v4l2_m2m" +h263_v4l2m2m_encoder_deps="v4l2_m2m h263_v4l2_m2m" +h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser" h264_cuvid_decoder_deps="cuda cuvid" -h264_cuvid_decoder_select="h264_mp4toannexb_bsf h264_cuvid_hwaccel" +h264_cuvid_decoder_select="h264_mp4toannexb_bsf" +h264_mediacodec_decoder_deps="mediacodec" +h264_mediacodec_decoder_select="h264_mp4toannexb_bsf h264_parser" +h264_mmal_decoder_deps="mmal" h264_nvenc_encoder_deps="nvenc" +h264_omx_encoder_deps="omx" h264_qsv_decoder_deps="libmfx" h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec h264_qsv_hwaccel" h264_qsv_encoder_deps="libmfx" h264_qsv_encoder_select="qsvenc" +h264_rkmpp_decoder_deps="rkmpp" +h264_rkmpp_decoder_select="h264_mp4toannexb_bsf" h264_vaapi_encoder_deps="VAEncPictureParameterBufferH264" h264_vaapi_encoder_select="vaapi_encode golomb" - +h264_vda_decoder_deps="vda" +h264_vda_decoder_select="h264_decoder" +h264_vdpau_decoder_deps="vdpau" +h264_vdpau_decoder_select="h264_decoder" +h264_v4l2m2m_decoder_deps="v4l2_m2m h264_v4l2_m2m" +h264_v4l2m2m_encoder_deps="v4l2_m2m h264_v4l2_m2m" hevc_cuvid_decoder_deps="cuda cuvid" -hevc_cuvid_decoder_select="hevc_mp4toannexb_bsf hevc_cuvid_hwaccel" +hevc_cuvid_decoder_select="hevc_mp4toannexb_bsf" +hevc_mediacodec_decoder_deps="mediacodec" +hevc_mediacodec_decoder_select="hevc_mp4toannexb_bsf hevc_parser" hevc_nvenc_encoder_deps="nvenc" hevc_qsv_decoder_deps="libmfx" hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser qsvdec hevc_qsv_hwaccel" hevc_qsv_encoder_deps="libmfx" -hevc_qsv_encoder_select="qsvenc" +hevc_qsv_encoder_select="hevcparse qsvenc" +hevc_rkmpp_decoder_deps="rkmpp" +hevc_rkmpp_decoder_select="hevc_mp4toannexb_bsf" hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC" hevc_vaapi_encoder_select="vaapi_encode golomb" +hevc_v4l2m2m_decoder_deps="v4l2_m2m hevc_v4l2_m2m" +hevc_v4l2m2m_encoder_deps="v4l2_m2m hevc_v4l2_m2m" mjpeg_cuvid_decoder_deps="cuda cuvid" -mjpeg_cuvid_decoder_select="mjpeg_cuvid_hwaccel" +mjpeg_vaapi_encoder_deps="VAEncPictureParameterBufferJPEG" +mjpeg_vaapi_encoder_select="vaapi_encode jpegtables" mpeg1_cuvid_decoder_deps="cuda cuvid" -mpeg1_cuvid_decoder_select="mpeg1_cuvid_hwaccel" +mpeg1_vdpau_decoder_deps="vdpau" +mpeg1_vdpau_decoder_select="mpeg1video_decoder" +mpeg1_v4l2m2m_decoder_deps="v4l2_m2m mpeg1_v4l2_m2m" +mpeg2_crystalhd_decoder_select="crystalhd" mpeg2_cuvid_decoder_deps="cuda cuvid" -mpeg2_cuvid_decoder_select="mpeg2_cuvid_hwaccel" +mpeg2_mmal_decoder_deps="mmal" +mpeg2_mediacodec_decoder_deps="mediacodec" mpeg2_qsv_decoder_deps="libmfx" mpeg2_qsv_decoder_select="qsvdec mpeg2_qsv_hwaccel" mpeg2_qsv_encoder_deps="libmfx" mpeg2_qsv_encoder_select="qsvenc" +mpeg2_vaapi_encoder_deps="VAEncPictureParameterBufferMPEG2" +mpeg2_vaapi_encoder_select="vaapi_encode" +mpeg2_v4l2m2m_decoder_deps="v4l2_m2m mpeg2_v4l2_m2m" +mpeg4_crystalhd_decoder_select="crystalhd" mpeg4_cuvid_decoder_deps="cuda cuvid" -mpeg4_cuvid_decoder_select="mpeg4_cuvid_hwaccel" -nvenc_h264_encoder_deps="nvenc" -nvenc_hevc_encoder_deps="nvenc" - +mpeg4_mediacodec_decoder_deps="mediacodec" +mpeg4_mmal_decoder_deps="mmal" +mpeg4_omx_encoder_deps="omx" +mpeg4_vdpau_decoder_deps="vdpau" +mpeg4_vdpau_decoder_select="mpeg4_decoder" +mpeg4_v4l2m2m_decoder_deps="v4l2_m2m mpeg4_v4l2_m2m" +mpeg4_v4l2m2m_encoder_deps="v4l2_m2m mpeg4_v4l2_m2m" +mpeg_vdpau_decoder_deps="vdpau" +mpeg_vdpau_decoder_select="mpeg2video_decoder" +msmpeg4_crystalhd_decoder_select="crystalhd" +nvenc_h264_encoder_select="h264_nvenc_encoder" +nvenc_hevc_encoder_select="hevc_nvenc_encoder" +vc1_crystalhd_decoder_select="crystalhd" vc1_cuvid_decoder_deps="cuda cuvid" -vc1_cuvid_decoder_select="vc1_cuvid_hwaccel" +vc1_mmal_decoder_deps="mmal" +vc1_vdpau_decoder_deps="vdpau" +vc1_vdpau_decoder_select="vc1_decoder" +vc1_v4l2m2m_decoder_deps="v4l2_m2m vc1_v4l2_m2m" vp8_cuvid_decoder_deps="cuda cuvid" -vp8_cuvid_decoder_select="vp8_cuvid_hwaccel" +vp8_mediacodec_decoder_deps="mediacodec" +vp8_qsv_decoder_deps="libmfx" +vp8_qsv_decoder_select="qsvdec vp8_qsv_hwaccel vp8_parser" +vp8_rkmpp_decoder_deps="rkmpp" +vp8_vaapi_encoder_deps="VAEncPictureParameterBufferVP8" +vp8_vaapi_encoder_select="vaapi_encode" +vp8_v4l2m2m_decoder_deps="v4l2_m2m vp8_v4l2_m2m" +vp8_v4l2m2m_encoder_deps="v4l2_m2m vp8_v4l2_m2m" vp9_cuvid_decoder_deps="cuda cuvid" -vp9_cuvid_decoder_select="vp9_cuvid_hwaccel" +vp9_mediacodec_decoder_deps="mediacodec" +vp9_rkmpp_decoder_deps="rkmpp" +vp9_vaapi_encoder_deps="VAEncPictureParameterBufferVP9" +vp9_vaapi_encoder_select="vaapi_encode" +vp9_v4l2m2m_decoder_deps="v4l2_m2m vp9_v4l2_m2m" +wmv3_crystalhd_decoder_select="crystalhd" +wmv3_vdpau_decoder_select="vc1_vdpau_decoder" # parsers -h264_parser_select="golomb h264dsp" -hevc_parser_select="golomb" +h264_parser_select="golomb h264dsp h264parse" +hevc_parser_select="hevcparse" +mpegaudio_parser_select="mpegaudioheader" mpegvideo_parser_select="mpegvideo" mpeg4video_parser_select="h263dsp mpegvideo qpeldsp" vc1_parser_select="vc1dsp" @@ -2745,11 +2903,15 @@ mjpeg2jpeg_bsf_select="jpegtables" # external libraries aac_at_decoder_deps="audiotoolbox" +aac_at_decoder_select="aac_adtstoasc_bsf" ac3_at_decoder_deps="audiotoolbox" ac3_at_decoder_select="ac3_parser" adpcm_ima_qt_at_decoder_deps="audiotoolbox" alac_at_decoder_deps="audiotoolbox" amr_nb_at_decoder_deps="audiotoolbox" +avisynth_deps_any="libdl LoadLibrary" +avisynth_demuxer_deps="avisynth" +avisynth_demuxer_select="riffdec" eac3_at_decoder_deps="audiotoolbox" eac3_at_decoder_select="ac3_parser" gsm_ms_at_decoder_deps="audiotoolbox" @@ -2757,6 +2919,9 @@ ilbc_at_decoder_deps="audiotoolbox" mp1_at_decoder_deps="audiotoolbox" mp2_at_decoder_deps="audiotoolbox" mp3_at_decoder_deps="audiotoolbox" +mp1_at_decoder_select="mpegaudioheader" +mp2_at_decoder_select="mpegaudioheader" +mp3_at_decoder_select="mpegaudioheader" pcm_alaw_at_decoder_deps="audiotoolbox" pcm_mulaw_at_decoder_deps="audiotoolbox" qdmc_at_decoder_deps="audiotoolbox" @@ -2772,7 +2937,8 @@ pcm_alaw_at_encoder_select="audio_frame_queue" pcm_mulaw_at_encoder_deps="audiotoolbox" pcm_mulaw_at_encoder_select="audio_frame_queue" chromaprint_muxer_deps="chromaprint" -h264_videotoolbox_encoder_deps="videotoolbox_encoder pthreads" +h264_videotoolbox_encoder_deps="pthreads" +h264_videotoolbox_encoder_select="videotoolbox_encoder" libcelt_decoder_deps="libcelt" libfdk_aac_decoder_deps="libfdk_aac" libfdk_aac_encoder_deps="libfdk_aac" @@ -2787,7 +2953,7 @@ libilbc_encoder_deps="libilbc" libkvazaar_encoder_deps="libkvazaar" libmodplug_demuxer_deps="libmodplug" libmp3lame_encoder_deps="libmp3lame" -libmp3lame_encoder_select="audio_frame_queue" +libmp3lame_encoder_select="audio_frame_queue mpegaudioheader" libopencore_amrnb_decoder_deps="libopencore_amrnb" libopencore_amrnb_encoder_deps="libopencore_amrnb" libopencore_amrnb_encoder_select="audio_frame_queue" @@ -2801,8 +2967,7 @@ libopenmpt_demuxer_deps="libopenmpt" libopus_decoder_deps="libopus" libopus_encoder_deps="libopus" libopus_encoder_select="audio_frame_queue" -libschroedinger_decoder_deps="libschroedinger" -libschroedinger_encoder_deps="libschroedinger" +librsvg_decoder_deps="librsvg" libshine_encoder_deps="libshine" libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" @@ -2819,6 +2984,7 @@ libvpx_vp8_encoder_deps="libvpx" libvpx_vp9_decoder_deps="libvpx" libvpx_vp9_encoder_deps="libvpx" libwavpack_encoder_deps="libwavpack" +libwavpack_encoder_select="audio_frame_queue" libwebp_encoder_deps="libwebp" libwebp_anim_encoder_deps="libwebp" libx262_encoder_deps="libx262" @@ -2829,24 +2995,23 @@ libx265_encoder_deps="libx265" libxavs_encoder_deps="libxavs" libxvid_encoder_deps="libxvid" libzvbi_teletext_decoder_deps="libzvbi" -videotoolbox_deps="VideoToolbox_VideoToolbox_h" videotoolbox_extralibs="-framework CoreFoundation -framework VideoToolbox -framework CoreMedia -framework CoreVideo" videotoolbox_encoder_deps="videotoolbox VTCompressionSessionPrepareToEncodeFrames" -videotoolbox_encoder_suggest="vda_framework vt_bt2020" -vt_bt2020_deps="kCVImageBufferColorPrimaries_ITU_R_2020" +videotoolbox_encoder_suggest="vda_framework" # demuxers / muxers ac3_demuxer_select="ac3_parser" +aiff_muxer_select="iso_media" asf_demuxer_select="riffdec" asf_o_demuxer_select="riffdec" asf_muxer_select="riffenc" asf_stream_muxer_select="asf_muxer" avi_demuxer_select="iso_media riffdec exif" avi_muxer_select="riffenc" -avisynth_demuxer_deps="avisynth" -avisynth_demuxer_select="riffdec" caf_demuxer_select="iso_media riffdec" +caf_muxer_select="iso_media" dash_muxer_select="mp4_muxer" +dash_demuxer_deps="libxml2" dirac_demuxer_select="dirac_parser" dts_demuxer_select="dca_parser" dtshd_demuxer_select="dca_parser" @@ -2863,8 +3028,6 @@ image2_alias_pix_demuxer_select="image2_demuxer" image2_brender_pix_demuxer_select="image2_demuxer" ipod_muxer_select="mov_muxer" ismv_muxer_select="mov_muxer" -libnut_demuxer_deps="libnut" -libnut_muxer_deps="libnut" matroska_audio_muxer_select="matroska_muxer" matroska_demuxer_select="iso_media riffdec" matroska_demuxer_suggest="bzlib lzo zlib" @@ -2874,6 +3037,7 @@ mov_demuxer_select="iso_media riffdec" mov_demuxer_suggest="zlib" mov_muxer_select="iso_media riffenc rtpenc_chain" mp3_demuxer_select="mpegaudio_parser" +mp3_muxer_select="mpegaudioheader" mp4_muxer_select="mov_muxer" mpegts_demuxer_select="iso_media" mpegts_muxer_select="adts_muxer latm_muxer" @@ -2888,6 +3052,7 @@ ogv_muxer_select="ogg_muxer" opus_muxer_select="ogg_muxer" psp_muxer_select="mov_muxer" rtp_demuxer_select="sdp_demuxer" +rtp_muxer_select="golomb" rtpdec_select="asf_demuxer jpegtables mov_demuxer mpegts_demuxer rm_demuxer rtp_protocol srtp" rtsp_demuxer_select="http_protocol rtpdec" rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain" @@ -2914,28 +3079,32 @@ xmv_demuxer_select="riffdec" xwma_demuxer_select="riffdec" # indevs / outdevs -alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp" -alsa_outdev_deps="alsa_asoundlib_h" -avfoundation_indev_extralibs="-framework CoreVideo -framework Foundation -framework AVFoundation -framework CoreMedia" -avfoundation_indev_select="avfoundation" +alsa_indev_deps="alsa" +alsa_outdev_deps="alsa" +avfoundation_indev_deps="avfoundation pthreads" +avfoundation_indev_extralibs="-framework Foundation -framework CoreVideo -framework CoreMedia" bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h" caca_outdev_deps="libcaca" -decklink_indev_deps="decklink pthreads" +decklink_deps_any="libdl LoadLibrary" +decklink_indev_deps="decklink threads" decklink_indev_extralibs="-lstdc++" -decklink_outdev_deps="decklink pthreads" +decklink_outdev_deps="decklink threads" decklink_outdev_extralibs="-lstdc++" +libndi_newtek_indev_deps="libndi_newtek" +libndi_newtek_indev_extralibs="-lndi" +libndi_newtek_outdev_deps="libndi_newtek" +libndi_newtek_outdev_extralibs="-lndi" dshow_indev_deps="IBaseFilter" dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid -loleaut32 -lshlwapi" -dv1394_indev_deps="dv1394" -dv1394_indev_select="dv_demuxer" fbdev_indev_deps="linux_fb_h" fbdev_outdev_deps="linux_fb_h" gdigrab_indev_deps="CreateDIBSection" gdigrab_indev_extralibs="-lgdi32" gdigrab_indev_select="bmp_decoder" iec61883_indev_deps="libiec61883" -jack_indev_deps="jack_jack_h" +jack_indev_deps="jack" jack_indev_deps_any="sem_timedwait dispatch_dispatch_h" +kmsgrab_indev_deps="libdrm" lavfi_indev_deps="avfilter" libcdio_indev_deps="libcdio" libdc1394_indev_deps="libdc1394" @@ -2946,28 +3115,23 @@ oss_indev_deps_any="soundcard_h sys_soundcard_h" oss_outdev_deps_any="soundcard_h sys_soundcard_h" pulse_indev_deps="libpulse" pulse_outdev_deps="libpulse" -qtkit_indev_extralibs="-framework QTKit -framework Foundation -framework QuartzCore" -qtkit_indev_select="qtkit" sdl2_outdev_deps="sdl2" -sndio_indev_deps="sndio_h" -sndio_outdev_deps="sndio_h" -v4l_indev_deps="linux_videodev_h" +sndio_indev_deps="sndio" +sndio_outdev_deps="sndio" v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h" v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h" -vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines" -vfwcap_indev_extralibs="-lavicap32" -x11grab_indev_deps="x11grab" -x11grab_xcb_indev_deps="libxcb" +vfwcap_indev_deps="vfw32 vfwcap_defines" +xcbgrab_indev_deps="libxcb" xv_outdev_deps="X11_extensions_Xvlib_h XvGetPortAttribute" xv_outdev_extralibs="-lXv -lX11 -lXext" # protocols async_protocol_deps="threads" bluray_protocol_deps="libbluray" -ffrtmpcrypt_protocol_deps="!librtmp_protocol" +ffrtmpcrypt_protocol_conflict="librtmp_protocol" ffrtmpcrypt_protocol_deps_any="gcrypt gmp openssl" ffrtmpcrypt_protocol_select="tcp_protocol" -ffrtmphttp_protocol_deps="!librtmp_protocol" +ffrtmphttp_protocol_conflict="librtmp_protocol" ffrtmphttp_protocol_select="http_protocol" ftp_protocol_select="tcp_protocol" gopher_protocol_select="network" @@ -2984,10 +3148,10 @@ libsmbclient_protocol_deps="libsmbclient gplv3" libssh_protocol_deps="libssh" mmsh_protocol_select="http_protocol" mmst_protocol_select="network" -rtmp_protocol_deps="!librtmp_protocol" +rtmp_protocol_conflict="librtmp_protocol" rtmp_protocol_select="tcp_protocol" rtmpe_protocol_select="ffrtmpcrypt_protocol" -rtmps_protocol_deps="!librtmp_protocol" +rtmps_protocol_conflict="librtmp_protocol" rtmps_protocol_select="tls_protocol" rtmpt_protocol_select="ffrtmphttp_protocol" rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol" @@ -2997,9 +3161,11 @@ sctp_protocol_deps="struct_sctp_event_subscribe struct_msghdr_msg_flags" sctp_protocol_select="network" srtp_protocol_select="rtp_protocol srtp" tcp_protocol_select="network" -tls_gnutls_protocol_deps="gnutls !tls_schannel_protocol !tls_securetransport_protocol" +tls_gnutls_protocol_conflict="tls_schannel_protocol tls_securetransport_protocol" +tls_gnutls_protocol_deps="gnutls" tls_gnutls_protocol_select="tcp_protocol" -tls_openssl_protocol_deps="openssl !tls_schannel_protocol !tls_securetransport_protocol !tls_gnutls_protocol" +tls_openssl_protocol_conflict="tls_schannel_protocol tls_securetransport_protocol tls_gnutls_protocol" +tls_openssl_protocol_deps="openssl" tls_openssl_protocol_select="tcp_protocol" tls_schannel_protocol_deps="schannel" tls_schannel_protocol_select="tcp_protocol" @@ -3014,10 +3180,11 @@ unix_protocol_select="network" # filters afftfilt_filter_deps="avcodec" afftfilt_filter_select="fft" +afir_filter_deps="avcodec" +afir_filter_select="fft" amovie_filter_deps="avcodec avformat" aresample_filter_deps="swresample" ass_filter_deps="libass" -asyncts_filter_deps="avresample" atempo_filter_deps="avcodec" atempo_filter_select="rdft" azmq_filter_deps="libzmq" @@ -3025,12 +3192,18 @@ blackframe_filter_deps="gpl" boxblur_filter_deps="gpl" bs2b_filter_deps="libbs2b" colormatrix_filter_deps="gpl" +coreimage_filter_deps="coreimage appkit" +coreimage_filter_extralibs="-framework OpenGL" +coreimagesrc_filter_deps="coreimage appkit" +coreimagesrc_filter_extralibs="-framework OpenGL" cover_rect_filter_deps="avcodec avformat gpl" cropdetect_filter_deps="gpl" +deinterlace_qsv_filter_deps="libmfx" +deinterlace_vaapi_filter_deps="vaapi" delogo_filter_deps="gpl" deshake_filter_select="pixelutils" drawtext_filter_deps="libfreetype" -ebur128_filter_deps="gpl" +elbg_filter_deps="avcodec" eq_filter_deps="gpl" fftfilt_filter_deps="avcodec" fftfilt_filter_select="rdft" @@ -3039,16 +3212,15 @@ firequalizer_filter_deps="avcodec" firequalizer_filter_select="rdft" flite_filter_deps="libflite" framerate_filter_select="pixelutils" -frei0r_filter_deps="frei0r dlopen" -frei0r_src_filter_deps="frei0r dlopen" +frei0r_filter_deps="frei0r libdl" +frei0r_src_filter_deps="frei0r libdl" fspp_filter_deps="gpl" geq_filter_deps="gpl" histeq_filter_deps="gpl" hqdn3d_filter_deps="gpl" interlace_filter_deps="gpl" kerndeint_filter_deps="gpl" -ladspa_filter_deps="ladspa dlopen" -loudnorm_filter_deps="libebur128" +ladspa_filter_deps="ladspa libdl" mcdeint_filter_deps="avcodec gpl" movie_filter_deps="avcodec avformat" mpdecimate_filter_deps="gpl" @@ -3072,6 +3244,7 @@ rubberband_filter_deps="librubberband" sab_filter_deps="gpl swscale" scale2ref_filter_deps="swscale" scale_filter_deps="swscale" +scale_qsv_filter_deps="libmfx" select_filter_select="pixelutils" showcqt_filter_deps="avcodec avformat swscale" showcqt_filter_select="fft" @@ -3081,8 +3254,9 @@ showspectrum_filter_deps="avcodec" showspectrum_filter_select="fft" showspectrumpic_filter_deps="avcodec" showspectrumpic_filter_select="fft" +signature_filter_deps="gpl avcodec avformat" smartblur_filter_deps="gpl swscale" -sofalizer_filter_deps="netcdf avcodec" +sofalizer_filter_deps="libmysofa avcodec" sofalizer_filter_select="fft" spectrumsynth_filter_deps="avcodec" spectrumsynth_filter_select="fft" @@ -3095,28 +3269,34 @@ pixfmts_super2xsai_test_deps="super2xsai_filter" tinterlace_filter_deps="gpl" tinterlace_merge_test_deps="tinterlace_filter" tinterlace_pad_test_deps="tinterlace_filter" +tonemap_filter_deps="const_nan" uspp_filter_deps="gpl avcodec" vaguedenoiser_filter_deps="gpl" vidstabdetect_filter_deps="libvidstab" vidstabtransform_filter_deps="libvidstab" +libvmaf_filter_deps="libvmaf" zmq_filter_deps="libzmq" zoompan_filter_deps="swscale" -zscale_filter_deps="libzimg" +zscale_filter_deps="libzimg const_nan" scale_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer" # examples avio_dir_cmd_deps="avformat avutil" avio_reading_deps="avformat avcodec avutil" -decoding_encoding_example_deps="avcodec avformat avutil" +decode_audio_example_deps="avcodec avutil" +decode_video_example_deps="avcodec avutil" demuxing_decoding_example_deps="avcodec avformat avutil" +encode_audio_example_deps="avcodec avutil" +encode_video_example_deps="avcodec avutil" extract_mvs_example_deps="avcodec avformat avutil" filter_audio_example_deps="avfilter avutil" filtering_audio_example_deps="avfilter avcodec avformat avutil" filtering_video_example_deps="avfilter avcodec avformat avutil" -http_multiclient_example_deps="avformat avutil" +http_multiclient_example_deps="avformat avutil fork" +hw_decode_example_deps="avcodec avformat avutil" metadata_example_deps="avformat avutil" muxing_example_deps="avcodec avformat avutil swscale" -qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder vaapi_x11" +qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder" remuxing_example_deps="avcodec avformat avutil" resampling_audio_example_deps="avutil swresample" scaling_video_example_deps="avutil swscale" @@ -3125,9 +3305,11 @@ transcoding_example_deps="avfilter avcodec avformat avutil" # libraries, in linking order avcodec_deps="avutil" +avcodec_select="null_bsf" avdevice_deps="avformat avcodec avutil" avfilter_deps="avutil" avformat_deps="avcodec avutil" +avformat_suggest="network" avresample_deps="avutil" postproc_deps="avutil gpl" swresample_deps="avutil" @@ -3137,9 +3319,9 @@ swscale_deps="avutil" ffmpeg_deps="avcodec avfilter avformat swresample" ffmpeg_select="aformat_filter anull_filter atrim_filter format_filter null_filter - setpts_filter trim_filter" + trim_filter" ffplay_deps="avcodec avformat swscale swresample sdl2" -ffplay_libs='$sdl2_libs' +ffplay_extralibs='$sdl2_extralibs' ffplay_select="rdft crop_filter transpose_filter hflip_filter vflip_filter rotate_filter" ffprobe_deps="avcodec avformat" ffserver_deps="avformat fork sarestart" @@ -3155,7 +3337,7 @@ doc_deps_any="manpages htmlpages podpages txtpages" # default parameters -logfile="config.log" +logfile="ffbuild/config.log" # installation paths prefix_default="/usr/local" @@ -3171,18 +3353,19 @@ ar_default="ar" cc_default="gcc" cxx_default="g++" host_cc_default="gcc" -cp_f="cp -f" doxygen_default="doxygen" install="install" ln_s_default="ln -s -f" nm_default="nm -g" -objformat="elf" pkg_config_default=pkg-config ranlib_default="ranlib" strip_default="strip" version_script='--version-script' -yasmexe_default="yasm" +x86asmexe_default="nasm" windres_default="windres" +nvcc_default="nvcc" +nvccflags_default="-gencode arch=compute_30,code=sm_30 -O2" +striptype="direct" # OS target_os_default=$(tolower $(uname -s)) @@ -3219,15 +3402,6 @@ enable valgrind_backtrace sws_max_filter_size_default=256 set_default sws_max_filter_size -# Enable platform codecs by default. -enable audiotoolbox - -# Enable hwaccels by default. -enable d3d11va dxva2 vaapi vda vdpau videotoolbox_hwaccel xvmc -enable xlib - -enable nvenc vda_framework videotoolbox videotoolbox_encoder - # build settings SHFLAGS='-shared -Wl,-soname,$$(@F)' LIBPREF="lib" @@ -3258,16 +3432,18 @@ CXX_O='-o $@' OBJCC_C='-c' OBJCC_E='-E -o $@' OBJCC_O='-o $@' +X86ASM_O='-o $@' LD_O='-o $@' LD_LIB='-l%' -LD_MYTH_LIB='-lmyth%' LD_PATH='-L' HOSTCC_C='-c' HOSTCC_E='-E -o $@' HOSTCC_O='-o $@' HOSTLD_O='-o $@' +NVCC_C='-c' +NVCC_O='-o $@' -host_libs='-lm' +host_extralibs='-lm' host_cflags_filter=echo host_ldflags_filter=echo @@ -3278,6 +3454,8 @@ target_path='$(CURDIR)' DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>/dev/null | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(@F),$(@D)/$(@F)," > $(@:.o=.d)' DEPFLAGS='-MM' +mkdir -p ffbuild + # find source path if test -f configure; then source_path=. @@ -3425,6 +3603,9 @@ for opt do action=${opt%%-random=*} do_random ${action#--} $optval ;; + --enable-sdl) + enable sdl2 + ;; --enable-*=*|--disable-*=*) eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/') is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt" @@ -3434,6 +3615,16 @@ for opt do [ "$list" = "" ] && warn "Option $opt did not match anything" $action $list ;; + --enable-yasm|--disable-yasm) + warn "The ${opt} option is only provided for compatibility and will be\n"\ + "removed in the future. Use --enable-x86asm / --disable-x86asm instead." + test $opt = --enable-yasm && x86asm=yes || x86asm=no + ;; + --yasmexe=*) + warn "The --yasmexe option is only provided for compatibility and will be\n"\ + "removed in the future. Use --x86asmexe instead." + x86asmexe="$optval" + ;; --enable-?*|--disable-?*) eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g') if is_in $option $COMPONENT_LIST; then @@ -3453,8 +3644,13 @@ for opt do ;; --help|-h) show_help ;; + --quiet|-q) quiet=yes + ;; --fatal-warnings) enable fatal_warnings ;; + --libfuzzer=*) + libfuzzer_path="$optval" + ;; *) optname="${opt%%=*}" optname="${optname#--}" @@ -3474,8 +3670,41 @@ for e in $env; do eval "export $e" done +if disabled autodetect; then + + # Unless iconv is explicitely disabled by the user, we still want to probe + # for the iconv from the libc. + disabled iconv || enable libc_iconv + + disable_weak $EXTERNAL_AUTODETECT_LIBRARY_LIST + disable_weak $HWACCEL_AUTODETECT_LIBRARY_LIST +fi +# Mark specifically enabled, but normally autodetected libraries as requested. +for lib in $AUTODETECT_LIBS; do + enabled $lib && request $lib +done +#TODO: switch to $AUTODETECT_LIBS when $THREADS_LIST is supported the same way +enable_weak $EXTERNAL_AUTODETECT_LIBRARY_LIST +enable_weak $HWACCEL_AUTODETECT_LIBRARY_LIST + disabled logging && logfile=/dev/null +die_license_disabled() { + enabled $1 || { enabled $v && die "$v is $1 and --enable-$1 is not specified."; } +} + +die_license_disabled_gpl() { + enabled $1 || { enabled $v && die "$v is incompatible with the gpl and --enable-$1 is not specified."; } +} + +map "die_license_disabled gpl" $EXTERNAL_LIBRARY_GPL_LIST $EXTERNAL_LIBRARY_GPLV3_LIST +map "die_license_disabled version3" $EXTERNAL_LIBRARY_VERSION3_LIST $EXTERNAL_LIBRARY_GPLV3_LIST + +enabled gpl && map "die_license_disabled_gpl nonfree" $EXTERNAL_LIBRARY_NONFREE_LIST +map "die_license_disabled nonfree" $HWACCEL_LIBRARY_NONFREE_LIST + +enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; } + # Disable all the library-specific components if the library itself # is disabled, see AVCODEC_LIST and following _LIST variables. @@ -3493,6 +3722,11 @@ set >> $logfile test -n "$valgrind" && toolchain="valgrind-memcheck" +enabled ossfuzz && { + add_cflags -fsanitize=address,undefined -fsanitize-coverage=trace-pc-guard,trace-cmp -fno-omit-frame-pointer + add_ldflags -fsanitize=address,undefined -fsanitize-coverage=trace-pc-guard,trace-cmp +} + case "$toolchain" in *-asan) cc_default="${toolchain%-asan}" @@ -3506,7 +3740,7 @@ case "$toolchain" in ;; *-tsan) cc_default="${toolchain%-tsan}" - add_cflags -fsanitize=thread -pie + add_cflags -fsanitize=thread -fPIE add_ldflags -fsanitize=thread -pie case "$toolchain" in gcc-tsan) @@ -3541,8 +3775,10 @@ case "$toolchain" in cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p') if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then cc_default="cl" + cxx_default="cl" else cc_default="c99wrap cl" + cxx_default="c99wrap cl" fi ld_default="$source_path/compat/windows/mslink" nm_default="dumpbin -symbols" @@ -3591,7 +3827,7 @@ test -n "$cross_prefix" && enable cross_compile if enabled cross_compile; then test -n "$arch" && test -n "$target_os" || - die "Must specify target arch and OS when cross-compiling" + die "Must specify target arch (--arch) and OS (--target-os) when cross-compiling" fi ar_default="${cross_prefix}${ar_default}" @@ -3610,7 +3846,7 @@ windres_default="${cross_prefix}${windres_default}" sysinclude_default="${sysroot}/usr/include" set_default arch cc cxx doxygen pkg_config ranlib strip sysinclude \ - target_exec target_os yasmexe + target_exec target_os x86asmexe nvcc enabled cross_compile || host_cc_default=$cc set_default host_cc @@ -3644,25 +3880,32 @@ HOSTEXESUF=$(exesuf $host_os) if [ -n "$tempprefix" ] ; then mktemp(){ - echo $tempprefix.${HOSTNAME}.${UID} + tmpname="$tempprefix.${HOSTNAME}.${UID}" + echo "$tmpname" + mkdir "$tmpname" } elif ! check_cmd mktemp -u XXXXXX; then # simple replacement for missing mktemp # NOT SAFE FOR GENERAL USE mktemp(){ - echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$" + tmpname="${2%%XXX*}.${HOSTNAME}.${UID}.$$" + echo "$tmpname" + mkdir "$tmpname" } fi +FFTMPDIR=$(mktemp -d "${TMPDIR}/ffconf.XXXXXXXX" 2> /dev/null) || + die "Unable to create temporary directory in $TMPDIR." + tmpfile(){ - tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 && - (set -C; exec > $tmp) 2>/dev/null || - die "Unable to create temporary file in $TMPDIR." - append TMPFILES $tmp + tmp="${FFTMPDIR}/test"$2 + (set -C; exec > $tmp) 2> /dev/null || + die "Unable to create temporary file in $FFTMPDIR." eval $1=$tmp } -trap 'rm -f -- $TMPFILES' EXIT +trap 'rm -rf -- "$FFTMPDIR"' EXIT +trap 'exit 2' INT tmpfile TMPASM .asm tmpfile TMPC .c @@ -3740,6 +3983,7 @@ msvc_common_flags(){ # specific filters, they must be specified here as well or else the # generic catch all at the bottom will print the original flag. -Wall) ;; + -Wextra) ;; -std=c99) ;; # Common flags -fomit-frame-pointer) ;; @@ -3751,9 +3995,8 @@ msvc_common_flags(){ -mthumb) ;; -march=*) ;; -lz) echo zlib.lib ;; - -lavifil32) echo vfw32.lib ;; - -lavicap32) echo vfw32.lib user32.lib ;; -lx264) echo libx264.lib ;; + -lstdc++) ;; -l*) echo ${flag#-l}.lib ;; -LARGEADDRESSAWARE) echo $flag ;; -L*) echo -libpath:${flag#-L} ;; @@ -3766,11 +4009,13 @@ msvc_flags(){ msvc_common_flags "$@" for flag; do case $flag in - -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \ + -Wall) echo -W3 -wd4018 -wd4146 -wd4244 -wd4305 \ + -wd4554 ;; + -Wextra) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \ -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \ -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \ -wd4307 \ - -wd4273 -wd4554 -wd4701 ;; + -wd4273 -wd4554 -wd4701 -wd4703 ;; esac done } @@ -3971,7 +4216,7 @@ probe_cc(){ _ident=$($_cc --version 2>/dev/null | head -n1) _depflags='-MMD -MF $(@:.o=.d) -MT $@' _cflags_speed='-O3' - _cflags_size='-Os' + _cflags_size='-Oz' elif $_cc -V 2>&1 | grep -q Sun; then _type=suncc _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-) @@ -4031,8 +4276,20 @@ probe_cc(){ _flags='-nologo -Qdiag-error:4044,10157' # -Qvec- -Qsimd- to prevent miscompilation, -GS, fp:precise for consistency # with MSVC which enables it by default. - _cflags='-D_USE_MATH_DEFINES -Qms0 -Qvec- -Qsimd- -GS -fp:precise' + _cflags='-Qms0 -Qvec- -Qsimd- -GS -fp:precise' disable stripping + elif $_cc -? 2>/dev/null | grep -q 'LLVM.*Linker'; then + # lld can emulate multiple different linkers; in ms link.exe mode, + # the -? parameter gives the help output which contains an identifyable + # string, while it gives an error in other modes. + _type=lld-link + # The link.exe mode doesn't have a switch for getting the version, + # but we can force it back to gnu mode and get the version from there. + _ident=$($_cc -flavor gnu --version 2>/dev/null) + _ld_o='-out:$@' + _flags_filter=msvc_flags + _ld_lib='lib%.a' + _ld_path='-libpath:' elif $_cc -nologo- 2>&1 | grep -q Microsoft; then _type=msvc _ident=$($_cc 2>&1 | head -n1) @@ -4040,6 +4297,7 @@ probe_cc(){ _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs' _cflags_speed="-O2" _cflags_size="-O1" + _cflags_noopt="-O1" if $_cc -nologo- 2>&1 | grep -q Linker; then _ld_o='-out:$@' else @@ -4051,7 +4309,6 @@ probe_cc(){ _ld_lib='lib%.a' _ld_path='-libpath:' _flags='-nologo' - _cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS' disable stripping elif $_cc --version 2>/dev/null | grep -q ^cparser; then _type=cparser @@ -4088,9 +4345,11 @@ cflags_noopt=$_cflags_noopt add_cflags $_flags $_cflags cc_ldflags=$_ldflags set_ccvars CC +set_ccvars CXX probe_cc hostcc "$host_cc" host_cflags_filter=$_flags_filter +host_cflags_speed=$_cflags_speed add_host_cflags $_flags $_cflags set_ccvars HOSTCC @@ -4574,19 +4833,21 @@ fi add_cppflags -D_ISOC99_SOURCE add_cxxflags -D__STDC_CONSTANT_MACROS -add_cxxflags -std=c++98 -check_cflags -std=c99 -check_cc -D_FILE_OFFSET_BITS=64 < -EOF -check_cc -D_LARGEFILE_SOURCE < -EOF +check_cxxflags -std=c++11 || check_cxxflags -std=c++0x + +# some compilers silently accept -std=c11, so we also need to check that the +# version macro is defined properly +test_cflags_cc -std=c11 ctype.h "__STDC_VERSION__ >= 201112L" && + add_cflags -std=c11 || + check_cflags -std=c99 + +check_cppflags -D_FILE_OFFSET_BITS=64 +check_cppflags -D_LARGEFILE_SOURCE 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 @@ -4639,6 +4900,8 @@ esac enable $subarch enabled spic && enable_weak pic +enabled x86_64 && objformat=elf64 || objformat="elf32" + # OS specific case $target_os in aix) @@ -4656,7 +4919,7 @@ case $target_os in haiku) prefix_default="/boot/common" network_extralibs="-lnetwork" - host_libs= + host_extralibs= ;; sunos) SHFLAGS='-shared -Wl,-h,$$(@F)' @@ -4709,7 +4972,7 @@ case $target_os in SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)' SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)' objformat="macho" - enabled x86_64 && objformat="macho64" + enabled x86_64 && objformat="macho64" || objformat="macho32" enabled_any pic shared x86_64 || { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; } check_header dispatch/dispatch.h && @@ -4726,8 +4989,6 @@ case $target_os in else target_os=mingw32 fi - decklink_outdev_extralibs="$decklink_outdev_extralibs -lole32 -loleaut32" - decklink_indev_extralibs="$decklink_indev_extralibs -lole32 -loleaut32" LIBTARGET=i386 if enabled x86_64; then LIBTARGET="i386:x86-64" @@ -4743,7 +5004,7 @@ case $target_os in SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)' dlltool="${cross_prefix}dlltool" if check_cmd lib.exe -list; then - SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)' + SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); lib.exe -nologo -machine:$(LIBTARGET) -def:$$(@:$(SLIBSUF)=.def) -out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)' if enabled x86_64; then LIBTARGET=x64 fi @@ -4755,7 +5016,7 @@ case $target_os in SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)' SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)' SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.orig.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--disable-auto-image-base' - objformat="win32" + enabled x86_64 && objformat="win64" || objformat="win32" ranlib=: enable dos_paths check_ldflags -Wl,--nxcompat,--dynamicbase @@ -4779,15 +5040,13 @@ case $target_os in if enabled shared; then # Link to the import library instead of the normal static library # for shared libs. - LD_LIB='myth%.lib' - LD_MYTH_LIB='myth%.lib' + LD_LIB='%.lib' # Cannot build both shared and static libs with MSVC or icl. disable static fi enabled x86_32 && check_ldflags -LARGEADDRESSAWARE shlibdir_default="$bindir_default" - LIBPREF="myth" - SLIBPREF="myth" + SLIBPREF="" SLIBSUF=".dll" SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)' SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)' @@ -4797,7 +5056,7 @@ case $target_os in SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)' SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)' SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)' - objformat="win32" + enabled x86_64 && objformat="win64" || objformat="win32" ranlib=: enable dos_paths ;; @@ -4812,7 +5071,7 @@ case $target_os in SLIB_INSTALL_LINKS= SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a' SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a' - objformat="win32" + enabled x86_64 && objformat="win64" || objformat="win32" enable dos_paths enabled shared && ! enabled small && check_cmd $windres --version && enable gnu_windres add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 @@ -4824,8 +5083,8 @@ case $target_os in add_cppflags -U__STRICT_ANSI__ ;; linux) - enable dv1394 enable section_data_rel_ro + enabled_any arm aarch64 && enable_weak linux_perf ;; irix*) target_os=irix @@ -4833,9 +5092,10 @@ case $target_os in ;; os/2*) strip="lxlite -CS" + striptype="" objformat="aout" add_cppflags -D_GNU_SOURCE - add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap + add_ldflags -Zomf -Zbin-files -Zargs-wild -Zhigh-mem -Zmap SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf' LIBSUF="_s.a" SLIBPREF="" @@ -4881,18 +5141,6 @@ case $target_os in ;; minix) ;; - plan9) - add_cppflags -D_C99_SNPRINTF_EXTENSION \ - -D_REENTRANT_SOURCE \ - -D_RESEARCH_SOURCE \ - -DFD_SETSIZE=96 \ - -DHAVE_SOCK_OPTS - add_compat strtod.o strtod=avpriv_strtod - network_extralibs='-lbsd' - exeobjs=compat/plan9/main.o - disable ffserver - cp_f='cp' - ;; none) ;; *) @@ -4935,7 +5183,7 @@ probe_libc(){ # MinGW headers can be installed on Cygwin, so check for newlib first. elif check_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then eval ${pfx}libc_type=newlib - add_${pfx}cppflags -U__STRICT_ANSI__ + add_${pfx}cppflags -U__STRICT_ANSI__ -D_XOPEN_SOURCE=600 # MinGW64 is backwards compatible with MinGW32, so check for it first. elif check_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then eval ${pfx}libc_type=mingw64 @@ -4955,6 +5203,8 @@ probe_libc(){ add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1 check_${pfx}cpp_condition _mingw.h "defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0502" || add_${pfx}cppflags -D_WIN32_WINNT=0x0502 + check_${pfx}cpp_condition _mingw.h "__MSVCRT_VERSION__ < 0x0700" && + add_${pfx}cppflags -D__MSVCRT_VERSION__=0x0700 eval test \$${pfx_no_}cc_type = "gcc" && add_${pfx}cppflags -D__printf__=__gnu_printf__ elif check_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then @@ -4969,6 +5219,7 @@ probe_libc(){ vsnprintf=avpriv_vsnprintf fi fi + add_${pfx}cppflags -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to # 0x601 by default unless something else is set by the user. # This can easily lead to us detecting functions only present @@ -4988,6 +5239,10 @@ probe_libc(){ #endif #endif EOF + if [ "$pfx" = "" ]; then + check_func strtoll || add_cflags -Dstrtoll=_strtoi64 + check_func strtoull || add_cflags -Dstrtoull=_strtoui64 + fi elif check_${pfx}cpp_condition stddef.h "defined __KLIBC__"; then eval ${pfx}libc_type=klibc elif check_${pfx}cpp_condition sys/cdefs.h "defined __BIONIC__"; then @@ -5012,26 +5267,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' @@ -5039,7 +5293,7 @@ esc(){ echo "$*" | sed 's/%/%25/g;s/:/%3a/g' } -echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $FFMPEG_CONFIGURATION)" >config.fate +echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $FFMPEG_CONFIGURATION)" > ffbuild/config.fate check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic @@ -5061,40 +5315,7 @@ EOF exit 1 fi -die_license_disabled() { - enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; } -} - -die_license_disabled_gpl() { - enabled $1 || { enabled $2 && die "$2 is incompatible with the gpl and --enable-$1 is not specified."; } -} - -die_license_disabled gpl frei0r -die_license_disabled gpl libcdio -die_license_disabled gpl librubberband -die_license_disabled gpl libsmbclient -die_license_disabled gpl libvidstab -die_license_disabled gpl libx264 -die_license_disabled gpl libx265 -die_license_disabled gpl libxavs -die_license_disabled gpl libxvid -die_license_disabled gpl x11grab - -die_license_disabled nonfree cuda -die_license_disabled nonfree cuvid -die_license_disabled nonfree libnpp -enabled gpl && die_license_disabled_gpl nonfree libfdk_aac -enabled gpl && die_license_disabled_gpl nonfree openssl - -die_license_disabled version3 gmp -die_license_disabled version3 libopencore_amrnb -die_license_disabled version3 libopencore_amrwb -die_license_disabled version3 libsmbclient -die_license_disabled version3 libvo_amrwbenc - -enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; } - -disabled optimizations || check_cflags -fomit-frame-pointer +disabled optimizations || enabled ossfuzz || check_cflags -fomit-frame-pointer enable_weak_pic() { disabled pic && return @@ -5118,9 +5339,7 @@ EOF sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }') extern_prefix=${sym%%ff_extern*} -check_cc < +void foo(void) { struct { double d; } static const bar[] = { { NAN } }; } +EOF + if ! enabled ppc64 || enabled bigendian; then disable vsx fi @@ -5255,10 +5479,14 @@ EOF check_as <= 0x0a060100" || die "ERROR: Decklink API version must be >= 10.6.1."; } } -enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; } -enabled gmp && require2 gmp gmp.h mpz_export -lgmp -enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init -enabled jni && { [ $target_os = "android" ] && check_header jni.h && enabled pthreads && - check_lib2 "dlfcn.h" dlopen -ldl; } -enabled ladspa && { check_header ladspa.h || die "ERROR: ladspa.h header not found"; } +enabled libndi_newtek && require_header Processing.NDI.Lib.h +enabled frei0r && require_header frei0r.h +enabled gmp && require gmp gmp.h mpz_export -lgmp +enabled gnutls && require_pkg_config gnutls gnutls gnutls/gnutls.h gnutls_global_init +enabled jni && { [ $target_os = "android" ] && check_header jni.h && enabled pthreads || die "ERROR: jni not found"; } +enabled ladspa && require_header ladspa.h enabled libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883 -enabled libass && require_pkg_config libass ass/ass.h ass_library_init -enabled libbluray && require_pkg_config libbluray libbluray/bluray.h bd_open -enabled libbs2b && require_pkg_config libbs2b bs2b.h bs2b_open +enabled libass && require_pkg_config libass libass ass/ass.h ass_library_init +enabled libbluray && require_pkg_config libbluray libbluray libbluray/bluray.h bd_open +enabled libbs2b && require_pkg_config libbs2b libbs2b bs2b.h bs2b_open enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 && - { check_lib celt/celt.h celt_decoder_create_custom -lcelt0 || + { check_lib libcelt celt/celt.h celt_decoder_create_custom -lcelt0 || die "ERROR: libcelt must be installed and version must be >= 0.11.0."; } -enabled libcaca && require_pkg_config caca caca.h caca_create_canvas -enabled libebur128 && require ebur128 ebur128.h ebur128_relative_threshold -lebur128 -enabled libfdk_aac && { use_pkg_config fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen || +enabled libcaca && require_pkg_config libcaca caca caca.h caca_create_canvas +enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new +enabled libdrm && require_pkg_config libdrm libdrm xf86drm.h drmGetVersion +enabled libfdk_aac && { use_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen || { require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac && warn "using libfdk without pkg-config"; } } -flite_libs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex -lflite" -enabled libflite && require2 libflite "flite/flite.h" flite_init $flite_libs +flite_extralibs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex -lflite" +enabled libflite && require libflite "flite/flite.h" flite_init $flite_extralibs enabled fontconfig && enable libfontconfig -enabled libfontconfig && require_pkg_config fontconfig "fontconfig/fontconfig.h" FcInit -enabled libfreetype && require_libfreetype -enabled libfribidi && require_pkg_config fribidi fribidi.h fribidi_version_info -enabled libgme && require libgme gme/gme.h gme_new_emu -lgme -lstdc++ +enabled libfontconfig && require_pkg_config libfontconfig fontconfig "fontconfig/fontconfig.h" FcInit +enabled libfreetype && require_pkg_config libfreetype2 freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType +enabled libfribidi && require_pkg_config libfribidi fribidi fribidi.h fribidi_version_info +enabled libgme && { use_pkg_config libgme libgme gme/gme.h gme_new_emu || + require libgme gme/gme.h gme_new_emu -lgme -lstdc++; } enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do - check_lib "${gsm_hdr}" gsm_create -lgsm && break; + check_lib libgsm "${gsm_hdr}" gsm_create -lgsm && break; done || die "ERROR: libgsm not found"; } 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 libmodplug && require_pkg_config libmodplug libmodplug/modplug.h ModPlug_Load +enabled libkvazaar && require_pkg_config libkvazaar "kvazaar >= 0.8.1" kvazaar.h kvz_api_get +# While it may appear that require is being used as a pkg-config +# fallback for libmfx, it is actually being used to detect a different +# installation route altogether. If libmfx is installed via the Intel +# Media SDK or Intel Media Server Studio, these don't come with +# pkg-config support. Instead, users should make sure that the build +# can find the libraries and headers through other means. +enabled libmfx && { use_pkg_config libmfx libmfx "mfx/mfxvideo.h" MFXInit || + { require libmfx "mfx/mfxvideo.h" MFXInit -llibmfx && warn "using libmfx without pkg-config"; } } +enabled libmodplug && require_pkg_config libmodplug libmodplug libmodplug/modplug.h ModPlug_Load enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame -enabled libnut && require libnut libnut.h nut_demuxer_init -lnut -enabled libnpp && require libnpp npp.h nppGetLibVersion -lnppi -lnppc +enabled libmysofa && require libmysofa "mysofa.h" mysofa_load -lmysofa +enabled libnpp && { check_lib libnpp npp.h nppGetLibVersion -lnppig -lnppicc -lnppc || + check_lib libnpp npp.h nppGetLibVersion -lnppi -lnppc || + die "ERROR: libnpp not found"; } 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 && { check_header opencv2/core/core_c.h && - { use_pkg_config opencv opencv2/core/core_c.h cvCreateImageHeader || + { use_pkg_config libopencv opencv opencv2/core/core_c.h cvCreateImageHeader || require opencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } || - require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader; } -enabled libopenh264 && require_pkg_config openh264 wels/codec_api.h WelsGetCodecVersion -enabled libopenjpeg && { { check_lib2 openjpeg-2.1/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || - check_lib2 openjpeg-2.1/openjpeg.h opj_version -lopenjp2 || - { check_lib2 openjpeg-2.0/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || - { check_lib2 openjpeg-1.5/openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || - { check_lib2 openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || + require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; } +enabled libopenh264 && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion +enabled libopenjpeg && { { check_lib libopenjpeg openjpeg-2.3/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || + check_lib libopenjpeg openjpeg-2.3/openjpeg.h opj_version -lopenjp2 || + { check_lib libopenjpeg openjpeg-2.2/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || + check_lib libopenjpeg openjpeg-2.2/openjpeg.h opj_version -lopenjp2 || + { check_lib libopenjpeg openjpeg-2.1/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || + check_lib libopenjpeg openjpeg-2.1/openjpeg.h opj_version -lopenjp2 || + { check_lib libopenjpeg openjpeg-2.0/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || + { check_lib libopenjpeg openjpeg-1.5/openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || + { check_lib libopenjpeg openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } || die "ERROR: libopenjpeg not found"; } -enabled libopenmpt && require_pkg_config "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create -enabled libpulse && require_pkg_config libpulse pulse/pulseaudio.h pa_context_new -enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket -enabled librubberband && require_pkg_config "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init -enabled libshine && require_pkg_config shine shine/layer3.h shine_encode_buffer -enabled libsmbclient && { use_pkg_config smbclient libsmbclient.h smbc_init || +enabled libopenmpt && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create +enabled libopus && { + enabled libopus_decoder && { + require_pkg_config libopus opus opus_multistream.h opus_multistream_decoder_create + } + enabled libopus_encoder && { + require_pkg_config libopus opus opus_multistream.h opus_multistream_surround_encoder_create + } +} +enabled libpulse && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new +enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo +enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket +enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new +enabled libshine && require_pkg_config libshine shine shine/layer3.h shine_encode_buffer +enabled libsmbclient && { use_pkg_config libsmbclient smbclient libsmbclient.h smbc_init || require smbclient libsmbclient.h smbc_init -lsmbclient; } -enabled libsnappy && require snappy snappy-c.h snappy_compress -lsnappy +enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr && LIBSOXR="-lsoxr" -enabled libssh && require_pkg_config libssh libssh/sftp.h sftp_init -enabled libspeex && require_pkg_config speex speex/speex.h speex_decoder_init -lspeex -enabled libtesseract && require_pkg_config tesseract tesseract/capi.h TessBaseAPICreate +enabled libssh && require_pkg_config libssh libssh libssh/sftp.h sftp_init +enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init -lspeex +enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame && - { check_lib twolame.h twolame_encode_buffer_float32_interleaved -ltwolame || + { check_lib libtwolame twolame.h twolame_encode_buffer_float32_interleaved -ltwolame || die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; } -enabled libv4l2 && require_pkg_config libv4l2 libv4l2.h v4l2_ioctl -enabled libvidstab && require_pkg_config "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit +enabled libv4l2 && require_pkg_config libv4l2 libv4l2 libv4l2.h v4l2_ioctl +enabled libvidstab && require_pkg_config libvidstab "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit +enabled libvmaf && require_pkg_config libvmaf libvmaf libvmaf.h compute_vmaf enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc -enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg +enabled libvorbis && require_pkg_config libvorbis vorbis vorbis/codec.h vorbis_info_init && + require_pkg_config libvorbisenc vorbisenc vorbis/vorbisenc.h vorbis_encode_init enabled libvpx && { enabled libvpx_vp8_decoder && { - use_pkg_config "vpx >= 0.9.1" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx || - check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx || + use_pkg_config libvpx_vp8_decoder "vpx >= 0.9.1" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx || + check_lib libvpx_vp8_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx || die "ERROR: libvpx decoder version must be >=0.9.1"; } enabled libvpx_vp8_encoder && { - use_pkg_config "vpx >= 0.9.7" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx || - check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VP8E_SET_MAX_INTRA_BITRATE_PCT" -lvpx || + use_pkg_config libvpx_vp8_encoder "vpx >= 0.9.7" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx || + check_lib libvpx_vp8_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VP8E_SET_MAX_INTRA_BITRATE_PCT" -lvpx || die "ERROR: libvpx encoder version must be >=0.9.7"; } enabled libvpx_vp9_decoder && { - use_pkg_config "vpx >= 1.3.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx || - check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx || - disable libvpx_vp9_decoder; + use_pkg_config libvpx_vp9_decoder "vpx >= 1.3.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx || + check_lib libvpx_vp9_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx } enabled libvpx_vp9_encoder && { - use_pkg_config "vpx >= 1.3.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx || - check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VP9E_SET_AQ_MODE" -lvpx || - disable libvpx_vp9_encoder; + use_pkg_config libvpx_vp9_encoder "vpx >= 1.3.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx || + check_lib libvpx_vp9_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VP9E_SET_AQ_MODE" -lvpx } if disabled_all libvpx_vp8_decoder libvpx_vp9_decoder libvpx_vp8_encoder libvpx_vp9_encoder; then die "libvpx enabled but no supported decoders found" @@ -5775,118 +6024,118 @@ enabled libvpx && { enabled libwavpack && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput -lwavpack enabled libwebp && { - enabled libwebp_encoder && require_pkg_config "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion - enabled libwebp_anim_encoder && { use_pkg_config "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit || disable libwebp_anim_encoder; } } -enabled libx264 && { use_pkg_config x264 "stdint.h x264.h" x264_encoder_encode || - { require libx264 x264.h x264_encoder_encode -lx264 && + enabled libwebp_encoder && require_pkg_config libwebp "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion + enabled libwebp_anim_encoder && use_pkg_config libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; } +enabled libx264 && { use_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode || + { require libx264 "stdint.h x264.h" x264_encoder_encode -lx264 && warn "using libx264 without pkg-config"; } } && - { check_cpp_condition x264.h "X264_BUILD >= 118" || - die "ERROR: libx264 must be installed and 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 >= 68" || - die "ERROR: libx265 version must be >= 68."; } -enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs +enabled libx265 && require_pkg_config libx265 x265 x265.h x265_api_get && + require_cpp_condition x265.h "X265_BUILD >= 68" +enabled libxavs && require libxavs "stdint.h xavs.h" xavs_encoder_encode -lxavs enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore -enabled libzimg && require_pkg_config zimg zimg.h zimg_get_api_version -enabled libzmq && require_pkg_config libzmq zmq.h zmq_ctx_new +enabled libzimg && require_pkg_config libzimg "zimg >= 2.3.0" zimg.h zimg_get_api_version +enabled libzmq && require_pkg_config libzmq libzmq zmq.h zmq_ctx_new enabled libzvbi && require libzvbi libzvbi.h vbi_decoder_new -lzvbi && { check_cpp_condition libzvbi.h "VBI_VERSION_MAJOR > 0 || VBI_VERSION_MINOR > 2 || VBI_VERSION_MINOR == 2 && VBI_VERSION_MICRO >= 28" || enabled gpl || die "ERROR: libzvbi requires version 0.2.28 or --enable-gpl."; } +enabled libxml2 && require_pkg_config libxml2 libxml-2.0 libxml2/libxml/xmlversion.h xmlCheckVersion enabled mediacodec && { enabled jni || die "ERROR: mediacodec requires --enable-jni"; } -enabled mmal && { check_lib interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host || - { ! enabled cross_compile && { - add_cflags -isystem/opt/vc/include/ -isystem/opt/vc/include/interface/vmcs_host/linux -isystem/opt/vc/include/interface/vcos/pthreads -fgnu89-inline ; - add_extralibs -L/opt/vc/lib/ -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ; - check_lib interface/mmal/mmal.h mmal_port_connect ; } - check_lib interface/mmal/mmal.h mmal_port_connect ; } || - die "ERROR: mmal not found"; } -enabled mmal && check_func_headers interface/mmal/mmal.h "MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS" - -enabled netcdf && require_pkg_config netcdf netcdf.h nc_inq_libvers -enabled openal && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do - check_lib 'AL/al.h' alGetError "${al_libs}" && break; done } || +enabled mmal && { check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host || + { ! enabled cross_compile && + add_cflags -isystem/opt/vc/include/ -isystem/opt/vc/include/interface/vmcs_host/linux -isystem/opt/vc/include/interface/vcos/pthreads -fgnu89-inline && + add_ldflags -L/opt/vc/lib/ && + check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host; } || + die "ERROR: mmal not found" && + check_func_headers interface/mmal/mmal.h "MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS"; } +enabled openal && { { for al_extralibs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do + check_lib openal 'AL/al.h' alGetError "${al_extralibs}" && break; done } || die "ERROR: openal not found"; } && { check_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" || die "ERROR: openal must be installed and version must be 1.1 or compatible"; } -enabled opencl && { check_lib2 OpenCL/cl.h clEnqueueNDRangeKernel -Wl,-framework,OpenCL || - check_lib2 CL/cl.h clEnqueueNDRangeKernel -lOpenCL || +enabled opencl && { check_lib opencl OpenCL/cl.h clEnqueueNDRangeKernel -Wl,-framework,OpenCL || + check_lib opencl CL/cl.h clEnqueueNDRangeKernel -lOpenCL || die "ERROR: opencl not found"; } && { check_cpp_condition "OpenCL/cl.h" "defined(CL_VERSION_1_2)" || check_cpp_condition "CL/cl.h" "defined(CL_VERSION_1_2)" || die "ERROR: opencl must be installed and version must be 1.2 or compatible"; } -enabled opengl && { check_lib GL/glx.h glXGetProcAddress "-lGL" || - check_lib2 windows.h wglGetProcAddress "-lopengl32 -lgdi32" || - check_lib2 OpenGL/gl3.h glGetError "-Wl,-framework,OpenGL" || - check_lib2 ES2/gl.h glGetError "-isysroot=${sysroot} -Wl,-framework,OpenGLES" || - check_lib2 GLES2/gl2.h glGetError "-lGLESv2" || +enabled opengl && { check_lib opengl GL/glx.h glXGetProcAddress "-lGL" || + check_lib opengl windows.h wglGetProcAddress "-lopengl32 -lgdi32" || + check_lib opengl OpenGL/gl3.h glGetError "-Wl,-framework,OpenGL" || + check_lib opengl ES2/gl.h glGetError "-isysroot=${sysroot} -Wl,-framework,OpenGLES" || die "ERROR: opengl not found." } -enabled omx_rpi && enable omx -enabled omx && { check_header OMX_Core.h || - { ! enabled cross_compile && enabled omx_rpi && { - add_cflags -isystem/opt/vc/include/IL ; } - check_header OMX_Core.h ; } || +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 openssl && { use_pkg_config openssl openssl/ssl.h OPENSSL_init_ssl || - use_pkg_config openssl openssl/ssl.h SSL_library_init || - check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto || - check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 || - check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 || +enabled omx && require_header OMX_Core.h +enabled openssl && { use_pkg_config openssl openssl openssl/ssl.h OPENSSL_init_ssl || + use_pkg_config openssl openssl openssl/ssl.h SSL_library_init || + check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto || + check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 || + check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 || die "ERROR: openssl not found"; } -enabled qtkit_indev && { check_header_objcc QTKit/QTKit.h || disable qtkit_indev; } - -# libdc1394 check -if enabled libdc1394; then - { require_pkg_config libdc1394-2 dc1394/dc1394.h dc1394_new && - enable libdc1394_2; } || - { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 && - enable libdc1394_1; } || - die "ERROR: No version of libdc1394 found " -fi +enabled rkmpp && { { require_pkg_config rockchip_mpp rockchip_mpp rockchip/rk_mpi.h mpp_create || + die "ERROR : Rockchip MPP was not found."; } && + { check_func_headers rockchip/rk_mpi_cmd.h "MPP_DEC_GET_FREE_PACKET_SLOT_COUNT" || + die "ERROR: Rockchip MPP is outdated, please get a more recent one."; } && + { enabled libdrm || + die "ERROR: rkmpp requires --enable-libdrm"; } + } if enabled gcrypt; then GCRYPT_CONFIG="${cross_prefix}libgcrypt-config" if "${GCRYPT_CONFIG}" --version > /dev/null 2>&1; then gcrypt_cflags=$("${GCRYPT_CONFIG}" --cflags) - gcrypt_libs=$("${GCRYPT_CONFIG}" --libs) - check_func_headers gcrypt.h gcry_mpi_new $gcrypt_cflags $gcrypt_libs || + gcrypt_extralibs=$("${GCRYPT_CONFIG}" --libs) + check_func_headers gcrypt.h gcry_mpi_new $gcrypt_cflags $gcrypt_extralibs || die "ERROR: gcrypt not found" - add_cflags $gcrypt_cflags && add_extralibs $gcrypt_libs + add_cflags $gcrypt_cflags && add_extralibs $gcrypt_extralibs else - require2 gcrypt gcrypt.h gcry_mpi_new -lgcrypt + require gcrypt gcrypt.h gcry_mpi_new -lgcrypt fi fi -disabled sdl && disable sdl2 -if ! disabled sdl2; then +if enabled sdl2; then SDL2_CONFIG="${cross_prefix}sdl2-config" - if check_pkg_config sdl2 SDL_events.h SDL_PollEvent; then - check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags && - check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags && - check_func SDL_Init $sdl2_libs $sdl2_cflags && enable sdl2 - else - if "${SDL2_CONFIG}" --version > /dev/null 2>&1; then + if check_pkg_config sdl2 "sdl2 >= 2.0.1 sdl2 < 2.1.0" SDL_events.h SDL_PollEvent; then + check_func SDL_Init $sdl2_extralibs $sdl2_cflags || + disable sdl2 + elif "${SDL2_CONFIG}" --version > /dev/null 2>&1; then sdl2_cflags=$("${SDL2_CONFIG}" --cflags) - sdl2_libs=$("${SDL2_CONFIG}" --libs) + sdl2_extralibs=$("${SDL2_CONFIG}" --libs) check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags && check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags && - check_func SDL_Init $sdl2_libs $sdl2_cflags && enable sdl2 - fi + check_func SDL_Init $sdl2_extralibs $sdl2_cflags && + enable sdl2 fi if test $target_os = "mingw32"; then - sdl2_libs="$sdl2_libs -mconsole" + sdl2_extralibs=$(filter_out '-mwindows' $sdl2_extralibs) fi fi -enabled sdl2 && add_cflags $sdl2_cflags && add_extralibs $sdl2_libs +enabled sdl2 && add_cflags $(filter_out '-Dmain=SDL_main' $sdl2_cflags) && add_extralibs $sdl2_extralibs -disabled securetransport || { check_func SecIdentityCreate "-Wl,-framework,CoreFoundation -Wl,-framework,Security" && - check_lib2 "Security/SecureTransport.h Security/Security.h" "SSLCreateContext SecItemImport" "-Wl,-framework,CoreFoundation -Wl,-framework,Security" && - enable securetransport; } +if enabled decklink; then + case $target_os in + mingw32*|mingw64*|win32|win64) + decklink_outdev_extralibs="$decklink_outdev_extralibs -lole32 -loleaut32" + decklink_indev_extralibs="$decklink_indev_extralibs -lole32 -loleaut32" + ;; + esac +fi -disabled schannel || { check_func_headers "windows.h security.h" InitializeSecurityContext -DSECURITY_WIN32 -lsecur32 && - check_cpp_condition winerror.h "defined(SEC_I_CONTEXT_EXPIRED)" && enable schannel && add_extralibs -lsecur32; } +enabled securetransport && + check_func SecIdentityCreate "-Wl,-framework,CoreFoundation -Wl,-framework,Security" && + check_lib securetransport "Security/SecureTransport.h Security/Security.h" "SSLCreateContext SecItemImport" "-Wl,-framework,CoreFoundation -Wl,-framework,Security" || + disable securetransport + +enabled schannel && + check_func_headers "windows.h security.h" InitializeSecurityContext -DSECURITY_WIN32 -lsecur32 && + check_cpp_condition winerror.h "defined(SEC_I_CONTEXT_EXPIRED)" && + add_extralibs -lsecur32 || + disable schannel makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo enabled makeinfo \ @@ -5897,15 +6146,26 @@ perl -v > /dev/null 2>&1 && enable perl || disable perl pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout +# check V4L2 codecs available in the API check_header linux/fb.h -check_header linux/videodev.h check_header linux/videodev2.h check_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete +check_code cc linux/videodev2.h "int i = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_VIDEO_M2M | V4L2_BUF_FLAG_LAST;" || disable v4l2_m2m +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_VC1_ANNEX_G;" && enable vc1_v4l2_m2m +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG1;" && enable mpeg1_v4l2_m2m +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG2;" && enable mpeg2_v4l2_m2m +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG4;" && enable mpeg4_v4l2_m2m +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_HEVC;" && enable hevc_v4l2_m2m +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_H263;" && enable h263_v4l2_m2m +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_H264;" && enable h264_v4l2_m2m +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_VP8;" && enable vp8_v4l2_m2m +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_VP9;" && enable vp9_v4l2_m2m check_header sys/videoio.h check_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete -check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs" +check_lib user32 "windows.h winuser.h" GetShellWindow -luser32 +check_lib vfw32 "windows.h vfw.h" capCreateCaptureWindow -lvfw32 # check that WM_CAP_DRIVER_CONNECT is defined to the proper value # w32api 3.12 had it defined wrong check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines @@ -5921,7 +6181,6 @@ check_type "dshow.h" IBaseFilter check_header dev/video/bktr/ioctl_bt848.h; } || check_header dev/ic/bt8xx.h -check_header sndio.h if check_struct sys/soundcard.h audio_buf_info bytes; then enable_safe sys/soundcard.h else @@ -5932,102 +6191,84 @@ EOF fi check_header soundcard.h -enabled_any alsa_indev alsa_outdev && - check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound +enabled alsa && check_lib alsa alsa/asoundlib.h snd_pcm_htimestamp -lasound -enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack && +enabled jack && check_lib jack jack/jack.h jack_client_open -ljack && check_func jack_port_get_latency_range -ljack -enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio +enabled sndio && check_lib sndio sndio.h sio_open -lsndio if enabled libcdio; then - check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio || - check_lib2 "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio || + check_lib libcdio "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio || + check_lib libcdio "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio || die "ERROR: No usable libcdio/cdparanoia found" fi -enabled xlib && - check_lib X11/Xlib.h XOpenDisplay -lX11 || disable xlib - -if ! disabled libxcb; then - check_pkg_config "xcb >= 1.4" xcb/xcb.h xcb_connect || { - enabled libxcb && die "ERROR: libxcb >= 1.4 not found"; - } && disable x11grab && enable libxcb +enabled libxcb && check_pkg_config libxcb "xcb >= 1.4" xcb/xcb.h xcb_connect || + disable libxcb_shm libxcb_shape libxcb_xfixes if enabled libxcb; then - 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; } - - 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; } - - disabled libxcb_shape || { - check_pkg_config xcb-shape xcb/shape.h xcb_shape_get_rectangles || { - enabled libxcb_shape && die "ERROR: libxcb_shape not found"; - } && enable libxcb_shape; } + enabled libxcb_shm && check_pkg_config libxcb_shm xcb-shm xcb/shm.h xcb_shm_attach + enabled libxcb_shape && check_pkg_config libxcb_shape xcb-shape xcb/shape.h xcb_shape_get_rectangles + enabled libxcb_xfixes && check_pkg_config libxcb_xfixes xcb-xfixes xcb/xfixes.h xcb_xfixes_get_cursor_image add_cflags $xcb_cflags $xcb_shm_cflags $xcb_xfixes_cflags $xcb_shape_cflags - add_extralibs $xcb_libs $xcb_shm_libs $xcb_xfixes_libs $xcb_shape_libs -fi -fi - -if enabled x11grab; then - enabled xlib || die "ERROR: Xlib not found" - require Xext X11/extensions/XShm.h XShmCreateImage -lXext - require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes + add_extralibs $xcb_extralibs $xcb_shm_extralibs $xcb_xfixes_extralibs $xcb_shape_extralibs fi check_func_headers "windows.h" CreateDIBSection "$gdigrab_indev_extralibs" -enabled dxva2api_h && - check_cc < -#include -#include -int main(void) { IDirectXVideoDecoder *o = NULL; IDirectXVideoDecoder_Release(o); return 0; } +# d3d11va requires linking directly to dxgi and d3d11 if not building for +# the desktop api partition +check_cpp < +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) +#error desktop, not uwp +#else +// WINAPI_FAMILY_APP, WINAPI_FAMILY_PHONE_APP => UWP +#endif +#else +#error no family set +#endif EOF enabled vaapi && - check_lib va/va.h vaInitialize -lva || - disable vaapi + check_lib vaapi va/va.h vaInitialize -lva enabled vaapi && check_code cc "va/va.h" "vaCreateSurfaces(0, 0, 0, 0, 0, 0, 0, 0)" || disable vaapi -if enabled vaapi ; then - enabled xlib && - check_lib2 "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 && - enable vaapi_x11 +enabled vaapi && + check_lib vaapi_drm "va/va.h va/va_drm.h" vaGetDisplayDRM -lva -lva-drm - check_lib2 "va/va.h va/va_drm.h" vaGetDisplayDRM -lva -lva-drm && - enable vaapi_drm -fi +enabled vaapi && + check_lib vaapi_x11 "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 -lX11 + +enabled vaapi && + check_cpp_condition "va/va.h" "VA_CHECK_VERSION(1, 0, 0)" && + enable vaapi_1 enabled vdpau && check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" || disable vdpau -enabled vdpau && enabled xlib && - check_lib2 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau && - enable vdpau_x11 +enabled vdpau && + check_lib vdpau_x11 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau -lX11 + +enabled crystalhd && check_lib crystalhd "stdint.h libcrystalhd/libcrystalhd_if.h" DtsCrystalHDVersion -lcrystalhd if enabled x86; then case $target_os in mingw32*|mingw64*|win32|win64|linux|cygwin*) ;; *) - disable nvenc + disable cuda cuvid nvenc ;; esac else - disable nvenc + disable cuda cuvid nvenc fi enabled nvenc && @@ -6039,7 +6280,11 @@ int main(void) { return 0; } EOF # Funny iconv installations are not unusual, so check it after all flags have been set -disabled iconv || check_func_headers iconv.h iconv || check_lib2 iconv.h iconv -liconv || disable iconv +if enabled libc_iconv; then + check_func_headers iconv.h iconv +elif enabled iconv; then + check_func_headers iconv.h iconv || check_lib iconv iconv.h iconv -liconv +fi enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel" @@ -6056,19 +6301,41 @@ check_cflags -Wmissing-prototypes check_cflags -Wno-pointer-to-int-cast check_cflags -Wstrict-prototypes check_cflags -Wempty-body -enabled extra_warnings && check_cflags -Winline -enabled extra_warnings && check_cflags -Wcast-qual + +if enabled extra_warnings; then + check_cflags -Wcast-qual + check_cflags -Wextra + check_cflags -Wpedantic +fi check_disable_warning(){ warning_flag=-W${1#-Wno-} - test_cflags $warning_flag && add_cflags $1 + test_cflags $unknown_warning_flags $warning_flag && add_cflags $1 } +test_cflags -Werror=unused-command-line-argument && + append unknown_warning_flags "-Werror=unused-command-line-argument" +test_cflags -Werror=unknown-warning-option && + append unknown_warning_flags "-Werror=unknown-warning-option" + check_disable_warning -Wno-parentheses check_disable_warning -Wno-switch check_disable_warning -Wno-format-zero-length check_disable_warning -Wno-pointer-sign check_disable_warning -Wno-unused-const-variable +check_disable_warning -Wno-bool-operation + +check_disable_warning_headers(){ + warning_flag=-W${1#-Wno-} + test_cflags $warning_flag && add_cflags_headers $1 +} + +check_disable_warning_headers -Wno-deprecated-declarations +check_disable_warning_headers -Wno-unused-variable + +check_cc <= 190024218" || + check_cflags -d2SSAOptimizer- + # enable utf-8 source processing on VS2015 U2 and newer + check_cpp_condition windows.h "_MSC_FULL_VER >= 190023918" && + add_cflags -utf-8 fi for pfx in "" host_; do varname=${pfx%_}cc_type eval "type=\$$varname" - if [ $type = "msvc" ]; then + if [ "$type" = "msvc" ]; then check_${pfx}cc < enable ${lib}_deps_${dep} # -> add $dep to ${lib}_deps only once @@ -6367,19 +6634,41 @@ for thread in $THREADS_LIST; do fi done +if disabled stdatomic_h; then + if enabled atomics_gcc; then + add_cppflags '-I\$(SRC_PATH)/compat/atomics/gcc' + elif enabled atomics_win32; then + add_cppflags '-I\$(SRC_PATH)/compat/atomics/win32' + elif enabled atomics_suncc; then + add_cppflags '-I\$(SRC_PATH)/compat/atomics/suncc' + elif enabled pthreads; then + add_compat atomics/pthread/stdatomic.o + add_cppflags '-I\$(SRC_PATH)/compat/atomics/pthread' + else + enabled threads && die "Threading is enabled, but no atomics are available" + add_cppflags '-I\$(SRC_PATH)/compat/atomics/dummy' + fi +fi + +# Check if requested libraries were found. +for lib in $AUTODETECT_LIBS; do + requested $lib && ! enabled $lib && die "ERROR: $lib requested but not found"; +done + enabled zlib && add_cppflags -DZLIB_CONST # conditional library dependencies, in linking order enabled afftfilt_filter && prepend avfilter_deps "avcodec" +enabled afir_filter && prepend avfilter_deps "avcodec" enabled amovie_filter && prepend avfilter_deps "avformat avcodec" enabled aresample_filter && prepend avfilter_deps "swresample" -enabled asyncts_filter && prepend avfilter_deps "avresample" enabled atempo_filter && prepend avfilter_deps "avcodec" enabled cover_rect_filter && prepend avfilter_deps "avformat avcodec" enabled ebur128_filter && enabled swresample && prepend avfilter_deps "swresample" enabled elbg_filter && prepend avfilter_deps "avcodec" enabled fftfilt_filter && prepend avfilter_deps "avcodec" enabled find_rect_filter && prepend avfilter_deps "avformat avcodec" +enabled firequalizer_filter && prepend avfilter_deps "avcodec" enabled mcdeint_filter && prepend avfilter_deps "avcodec" enabled movie_filter && prepend avfilter_deps "avformat avcodec" enabled pan_filter && prepend avfilter_deps "swresample" @@ -6393,10 +6682,13 @@ enabled sofalizer_filter && prepend avfilter_deps "avcodec" enabled showcqt_filter && prepend avfilter_deps "avformat avcodec swscale" enabled showfreqs_filter && prepend avfilter_deps "avcodec" enabled showspectrum_filter && prepend avfilter_deps "avcodec" +enabled signature_filter && prepend avfilter_deps "avcodec avformat" enabled smartblur_filter && prepend avfilter_deps "swscale" enabled spectrumsynth_filter && prepend avfilter_deps "avcodec" +enabled spp_filter && prepend avfilter_deps "avcodec" enabled subtitles_filter && prepend avfilter_deps "avformat avcodec" enabled uspp_filter && prepend avfilter_deps "avcodec" +enabled zoompan_filter && prepend avfilter_deps "swscale" enabled lavfi_indev && prepend avdevice_deps "avfilter" @@ -6414,6 +6706,19 @@ postproc_deps="$(filter_out 'gpl' $postproc_deps)" map 'expand_deps $v' $LIBRARY_LIST +license="LGPL version 2.1 or later" +if enabled nonfree; then + license="nonfree and unredistributable" +elif enabled gplv3; then + license="GPL version 3 or later" +elif enabled lgplv3; then + license="LGPL version 3 or later" +elif enabled gpl; then + license="GPL version 2 or later" +fi + +if test "$quiet" != "yes"; then + echo "install prefix $prefix" echo "source path $source_path" echo "C compiler $cc" @@ -6435,7 +6740,8 @@ fi echo "big-endian ${bigendian-no}" echo "runtime cpu detection ${runtime_cpudetect-no}" if enabled x86; then - echo "${yasmexe} ${yasm-no}" + echo "standalone assembly ${x86asm-no}" + echo "x86 assembler ${x86asmexe}" echo "MMX enabled ${mmx-no}" echo "MMXEXT enabled ${mmxext-no}" echo "3DNow! enabled ${amd3dnow-no}" @@ -6444,6 +6750,7 @@ if enabled x86; then echo "SSSE3 enabled ${ssse3-no}" echo "AESNI enabled ${aesni-no}" echo "AVX enabled ${avx-no}" + echo "AVX2 enabled ${avx2-no}" echo "XOP enabled ${xop-no}" echo "FMA3 enabled ${fma3-no}" echo "FMA4 enabled ${fma4-no}" @@ -6485,13 +6792,9 @@ echo "optimizations ${optimizations-no}" echo "static ${static-no}" echo "shared ${shared-no}" echo "postprocessing support ${postproc-no}" -echo "new filter support ${avfilter-no}" echo "network support ${network-no}" echo "threading support ${thread_type-no}" echo "safe bitstream reader ${safe_bitstream_reader-no}" -echo "SDL2 support ${sdl2-no}" -echo "opencl enabled ${opencl-no}" -echo "JNI support ${jni-no}" echo "texi2html enabled ${texi2html-no}" echo "perl enabled ${perl-no}" echo "pod2man enabled ${pod2man-no}" @@ -6501,10 +6804,6 @@ test -n "$random_seed" && echo "random seed ${random_seed}" echo -echo "Enabled programs:" -print_enabled '' $PROGRAM_LIST | print_in_columns -echo - echo "External libraries:" print_enabled '' $EXTERNAL_LIBRARY_LIST | print_in_columns echo @@ -6517,6 +6816,10 @@ echo "Libraries:" print_enabled '' $LIBRARY_LIST | print_in_columns echo +echo "Programs:" +print_enabled '' $PROGRAM_LIST | print_in_columns +echo + for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do echo "Enabled ${type}s:" eval list=\$$(toupper $type)_LIST @@ -6524,28 +6827,27 @@ for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf ind echo done -license="LGPL version 2.1 or later" -if enabled nonfree; then - license="nonfree and unredistributable" -elif enabled gplv3; then - license="GPL version 3 or later" -elif enabled lgplv3; then - license="LGPL version 3 or later" -elif enabled gpl; then - license="GPL version 2 or later" +if test -n "$ignore_tests"; then + ignore_tests=$(echo $ignore_tests | tr ',' ' ') + echo "Ignored FATE tests:" + echo $ignore_tests | print_in_columns + echo fi echo "License: $license" -echo "Creating config.mak, config.h, and doc/config.texi..." +echo "Creating configuration files ..." + +fi # test "$quiet" != "yes" test -e Makefile || echo "include $source_path/Makefile" > Makefile enabled stripping || strip="echo skipping strip" +enabled stripping || striptype="" -config_files="$TMPH config.mak doc/config.texi" +config_files="$TMPH ffbuild/config.mak doc/config.texi" -cat > config.mak < ffbuild/config.mak <> config.mak - eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak - eval echo "${lcname}_VERSION_MINOR=\$${name}_VERSION_MINOR" >> config.mak -} - -map 'get_version $v' $LIBRARY_LIST - -map 'eval echo "${v}_FFLIBS=\$${v}_deps" >> config.mak' $LIBRARY_LIST +map 'eval echo "${v}_FFLIBS=\$${v}_deps" >> ffbuild/config.mak' $LIBRARY_LIST -print_program_libs(){ - eval "program_libs=\$${1}_libs" - eval echo "LIBS-${1}=${program_libs}" >> config.mak +print_program_extralibs(){ + eval "program_extralibs=\$${1}_extralibs" + eval echo "EXTRALIBS-${1}=${program_extralibs}" >> ffbuild/config.mak } -map 'print_program_libs $v' $PROGRAM_LIST +map 'print_program_extralibs $v' $PROGRAM_LIST cat > $TMPH < $TMPH <>$TMPH -if enabled yasm; then +if enabled x86asm; then append config_files $TMPASM printf '' >$TMPASM fi @@ -6740,13 +7039,13 @@ print_config CONFIG_ "$config_files" $CONFIG_LIST \ $ALL_COMPONENTS \ echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH -echo "endif # FFMPEG_CONFIG_MAK" >> config.mak +echo "endif # FFMPEG_CONFIG_MAK" >> ffbuild/config.mak # Do not overwrite an unchanged config.h to avoid superfluous rebuilds. cp_if_changed $TMPH config.h -touch .config +touch ffbuild/.config -enabled yasm && cp_if_changed $TMPASM config.asm +enabled x86asm && cp_if_changed $TMPASM config.asm cat > $TMPH <> $TMPH cp_if_changed $TMPH libavutil/avconfig.h -if test -n "$WARNINGS"; then - printf "\n%s%s$WARNINGS%s" "$warn_color" "$bold_color" "$reset_color" - enabled fatal_warnings && exit 1 -fi - # generate the lists of enabled components print_enabled_components(){ file=$1 struct_name=$2 name=$3 shift 3 - echo "static const $struct_name *$name[] = {" > $TMPH + echo "static const $struct_name * const $name[] = {" > $TMPH for c in $*; do enabled $c && printf " &ff_%s,\n" $c >> $TMPH done @@ -6782,64 +7076,37 @@ print_enabled_components(){ print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter bitstream_filters $BSF_LIST print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols $PROTOCOL_LIST -# build pkg-config files +if test -n "$WARNINGS"; then + printf "\n%s%s$WARNINGS%s" "$warn_color" "$bold_color" "$reset_color" + enabled fatal_warnings && exit 1 +fi -lib_version(){ - eval printf "\"lib${1}${build_suffix} >= \$LIB$(toupper ${1})_VERSION, \"" -} +# Settings for pkg-config files -pkgconfig_generate(){ - name=$1 - shortname=${name#lib}${build_suffix} - comment=$2 - version=$3 - libs=$4 - requires=$(map 'lib_version $v' $(eval echo \$${name#lib}_deps)) - requires=${requires%, } - enabled ${name#lib} || return 0 - mkdir -p $name - cat < $name/$name${build_suffix}.pc +cat > ffbuild/config.sh < doc/examples/pc-uninstalled/$name.pc -prefix= -exec_prefix= -libdir=\${pcfiledir}/../../../$name -includedir=${includedir} - -Name: $name -Description: $comment -Version: $version -Requires: $requires -Conflicts: -Libs: -L\${libdir} -Wl,-rpath,\${libdir} -l${shortname} $(enabled shared || echo $libs) -Cflags: -I\${includedir} +incdir=$incdir +rpath=$(enabled rpath && echo "-Wl,-rpath,\${libdir}") +source_path=${source_path} +LIBPREF=${LIBPREF} +LIBSUF=${LIBSUF} + +extralibs_avutil="$LIBRT $LIBM" +extralibs_avcodec="$extralibs" +extralibs_avformat="$extralibs" +extralibs_avdevice="$extralibs" +extralibs_avfilter="$extralibs" +extralibs_avresample="$LIBM" +extralibs_postproc="" +extralibs_swscale="$LIBM" +extralibs_swresample="$LIBM $LIBSOXR" EOF -} -pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" "$LIBRT $LIBM" -pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" -pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" -pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" -pkgconfig_generate libavfilter "FFmpeg audio/video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" -pkgconfig_generate libpostproc "FFmpeg postprocessing library" "$LIBPOSTPROC_VERSION" "" -pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$LIBM" -pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" -pkgconfig_generate libswresample "FFmpeg audio resampling library" "$LIBSWRESAMPLE_VERSION" "$LIBM $LIBSOXR" +for lib in $LIBRARY_LIST; do + lib_deps="$(eval echo \$${lib}_deps)" + echo ${lib}_deps=\"$lib_deps\" >> ffbuild/config.sh +done diff --git a/mythtv/external/FFmpeg/doc/APIchanges b/mythtv/external/FFmpeg/doc/APIchanges index 33c549ab679..6803eaaea2d 100644 --- a/mythtv/external/FFmpeg/doc/APIchanges +++ b/mythtv/external/FFmpeg/doc/APIchanges @@ -15,6 +15,233 @@ libavutil: 2015-08-28 API changes, most recent first: +-------- 8< --------- FFmpeg 3.4 was cut here -------- 8< --------- + +2017-09-28 - b6cf66ae1c - lavc 57.106.104 - avcodec.h + Add AV_PKT_DATA_A53_CC packet side data, to export closed captions + +2017-09-27 - 7aa6b8a68f - lavu 55.77.101 / lavu 55.31.1 - frame.h + Allow passing the value of 0 (meaning "automatic") as the required alignment + to av_frame_get_buffer(). + +2017-09-27 - 522f877086 - lavu 55.77.100 / lavu 55.31.0 - cpu.h + Add av_cpu_max_align() for querying maximum required data alignment. + +2017-09-26 - b1cf151c4d - lavc 57.106.102 - avcodec.h + Deprecate AVCodecContext.refcounted_frames. This was useful for deprecated + API only (avcodec_decode_video2/avcodec_decode_audio4). The new decode APIs + (avcodec_send_packet/avcodec_receive_frame) always work with reference + counted frames. + +2017-09-21 - 6f15f1cdc8 - lavu 55.76.100 / 56.6.0 - pixdesc.h + Add av_color_range_from_name(), av_color_primaries_from_name(), + av_color_transfer_from_name(), av_color_space_from_name(), and + av_chroma_location_from_name(). + +2017-09-13 - 82342cead1 - lavc 57.106.100 - avcodec.h + Add AV_PKT_FLAG_TRUSTED. + +2017-09-13 - 9cb23cd9fe - lavu 55.75.100 - hwcontext.h hwcontext_drm.h + Add AV_HWDEVICE_TYPE_DRM and implementation. + +2017-09-08 - 5ba2aef6ec - lavfi 6.103.100 - buffersrc.h + Add av_buffersrc_close(). + +2017-09-04 - 6cadbb16e9 - lavc 57.105.100 - avcodec.h + Add AV_HWACCEL_CODEC_CAP_EXPERIMENTAL, replacing the deprecated + HWACCEL_CODEC_CAP_EXPERIMENTAL flag. + +2017-09-01 - 5d76674756 - lavf 57.81.100 - avio.h + Add avio_read_partial(). + +2017-09-01 - xxxxxxx - lavf 57.80.100 / 57.11.0 - avio.h + Add avio_context_free(). From now on it must be used for freeing AVIOContext. + +2017-08-08 - 1460408703 - lavu 55.74.100 - pixdesc.h + Add AV_PIX_FMT_FLAG_FLOAT pixel format flag. + +2017-08-08 - 463b81de2b - lavu 55.72.100 - imgutils.h + Add av_image_fill_black(). + +2017-08-08 - caa12027ba - lavu 55.71.100 - frame.h + Add av_frame_apply_cropping(). + +2017-07-25 - 24de4fddca - lavu 55.69.100 - frame.h + Add AV_FRAME_DATA_ICC_PROFILE side data type. + +2017-06-27 - 70143a3954 - lavc 57.100.100 - avcodec.h + DXVA2 and D3D11 hardware accelerated decoding now supports the new hwaccel API, + which can create the decoder context and allocate hardware frame automatically. + See AVCodecContext.hw_device_ctx and AVCodecContext.hw_frames_ctx. For D3D11, + the new AV_PIX_FMT_D3D11 pixfmt must be used with the new API. + +2017-06-27 - 3303511f33 - lavu 56.67.100 - hwcontext.h + Add AV_HWDEVICE_TYPE_D3D11VA and AV_PIX_FMT_D3D11. + +2017-06-24 - 09891c5391 - lavf 57.75.100 - avio.h + Add AVIO_DATA_MARKER_FLUSH_POINT to signal preferred flush points to aviobuf. + +2017-06-14 - d59c6a3aeb - lavu 55.66.100 - hwcontext.h + av_hwframe_ctx_create_derived() now takes some AV_HWFRAME_MAP_* combination + as its flags argument (which was previously unused). + +2017-06-14 - 49ae8a5e87 - lavc 57.99.100 - avcodec.h + Add AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH. + +2017-06-14 - 0b1794a43e - lavu 55.65.100 - hwcontext.h + Add AV_HWDEVICE_TYPE_NONE, av_hwdevice_find_type_by_name(), + av_hwdevice_get_type_name() and av_hwdevice_iterate_types(). + +2017-06-14 - b22172f6f3 - lavu 55.64.100 - hwcontext.h + Add av_hwdevice_ctx_create_derived(). + +2017-05-15 - 532b23f079 - lavc 57.96.100 - avcodec.h + VideoToolbox hardware-accelerated decoding now supports the new hwaccel API, + which can create the decoder context and allocate hardware frames automatically. + See AVCodecContext.hw_device_ctx and AVCodecContext.hw_frames_ctx. + +2017-05-15 - 532b23f079 - lavu 57.63.100 - hwcontext.h + Add AV_HWDEVICE_TYPE_VIDEOTOOLBOX and implementation. + +2017-05-08 - f089e02fa2 - lavc 57.95.100 / 57.31.0 - avcodec.h + Add AVCodecContext.apply_cropping to control whether cropping + is handled by libavcodec or the caller. + +2017-05-08 - a47bd5d77e - lavu 55.62.100 / 55.30.0 - frame.h + Add AVFrame.crop_left/right/top/bottom fields for attaching cropping + information to video frames. + +2017-xx-xx - xxxxxxxxxx + Change av_sha_update(), av_sha512_update() and av_md5_sum()/av_md5_update() length + parameter type to size_t at next major bump. + +2017-05-05 - c0f17a905f - lavc 57.94.100 - avcodec.h + The cuvid decoders now support AVCodecContext.hw_device_ctx, which removes + the requirement to set an incomplete AVCodecContext.hw_frames_ctx only to + set the Cuda device handle. + +2017-04-11 - 8378466507 - lavu 55.61.100 - avstring.h + Add av_strireplace(). + +2016-04-06 - 157e57a181 - lavc 57.92.100 - avcodec.h + Add AV_PKT_DATA_CONTENT_LIGHT_LEVEL packet side data. + +2016-04-06 - b378f5bd64 - lavu 55.60.100 - mastering_display_metadata.h + Add AV_FRAME_DATA_CONTENT_LIGHT_LEVEL value, av_content_light_metadata_alloc() + and av_content_light_metadata_create_side_data() API, and AVContentLightMetadata + type to export content light level video properties. + +2017-03-31 - 9033e8723c - lavu 55.57.100 - spherical.h + Add av_spherical_projection_name(). + Add av_spherical_from_name(). + +2017-03-30 - 4cda23f1f1 - lavu 55.53.100 / 55.27.0 - hwcontext.h + Add av_hwframe_map() and associated AV_HWFRAME_MAP_* flags. + Add av_hwframe_ctx_create_derived(). + +2017-03-29 - bfdcdd6d82 - lavu 55.52.100 - avutil.h + add av_fourcc_make_string() function and av_fourcc2str() macro to replace + av_get_codec_tag_string() from lavc. + +2017-03-27 - ddef3d902f - lavf 57.68.100 - avformat.h + Deprecate that demuxers export the stream rotation angle in AVStream.metadata + (via an entry named "rotate"). Use av_stream_get_side_data() with + AV_PKT_DATA_DISPLAYMATRIX instead, and read the rotation angle with + av_display_rotation_get(). The same is done for muxing. Instead of adding a + "rotate" entry to AVStream.metadata, AV_PKT_DATA_DISPLAYMATRIX side data has + to be added to the AVStream. + +2017-03-23 - 7e4ba776a2 - lavc 57.85.101 - avcodec.h + vdpau hardware accelerated decoding now supports the new hwaccel API, which + can create the decoder context and allocate hardware frame automatically. + See AVCodecContext.hw_device_ctx and AVCodecContext.hw_frames_ctx. + +2017-03-23 - 156bd8278f - lavc 57.85.100 - avcodec.h + Add AVCodecContext.hwaccel_flags field. This will control some hwaccels at + a later point. + +2017-03-21 - fc9f14c7de - lavf 57.67.100 / 57.08.0 - avio.h + Add AVIO_SEEKABLE_TIME flag. + +2017-03-21 - d682ae70b4 - lavf 57.66.105, lavc 57.83.101 - avformat.h, avcodec.h + Deprecate AVFMT_FLAG_KEEP_SIDE_DATA. It will be ignored after the next major + bump, and libavformat will behave as if it were always set. + Deprecate av_packet_merge_side_data() and av_packet_split_side_data(). + +2016-03-20 - 8200b16a9c - lavu 55.50.100 / 55.21.0 - imgutils.h + Add av_image_copy_uc_from(), a version of av_image_copy() for copying + from GPU mapped memory. + +2017-03-20 - 9c2436e - lavu 55.49.100 - pixdesc.h + Add AV_PIX_FMT_FLAG_BAYER pixel format flag. + +2017-03-18 - 3796fb2692 - lavfi 6.77.100 - avfilter.h + Deprecate AVFilterGraph.resample_lavr_opts + It's never been used by avfilter nor passed to anything. + +2017-02-10 - 1b7ffddb3a - lavu 55.48.100 / 55.33.0 - spherical.h + Add AV_SPHERICAL_EQUIRECTANGULAR_TILE, av_spherical_tile_bounds(), + and projection-specific properties (bound_left, bound_top, bound_right, + bound_bottom, padding) to AVSphericalMapping. + +2017-03-02 - ade7c1a232 - lavc 57.81.104 - videotoolbox.h + AVVideotoolboxContext.cv_pix_fmt_type can now be set to 0 to output the + native decoder format. (The default value is not changed.) + +2017-03-02 - 554bc4eea8 - lavu 55.47.101, lavc 57.81.102, lavf 57.66.103 + Remove requirement to use AVOption or accessors to access certain fields + in AVFrame, AVCodecContext, and AVFormatContext that were previously + documented as "no direct access" allowed. + +2017-02-13 - c1a5fca06f - lavc 57.80.100 - avcodec.h + Add AVCodecContext.hw_device_ctx. + +2017-02-11 - e3af49b14b - lavu 55.47.100 - frame.h + Add AVFrame.opaque_ref. + +2017-01-31 - 2eab48177d - lavu 55.46.100 / 55.20.0 - cpu.h + Add AV_CPU_FLAG_SSSE3SLOW. + +2017-01-24 - c4618f842a - lavu 55.45.100 - channel_layout.h + Add av_get_extended_channel_layout() + +2017-01-22 - 76c5a69e26 - lavu 55.44.100 - lfg.h + Add av_lfg_init_from_data(). + +2017-01-17 - 2a4a8653b6 - lavc 57.74.100 - vaapi.h + Deprecate struct vaapi_context and the vaapi.h installed header. + Callers should set AVCodecContext.hw_frames_ctx instead. + +2017-01-12 - dbe9dbed31 - lavfi 6.69.100 - buffersink.h + Add av_buffersink_get_*() functions. + +2017-01-06 - 9488032e10 - lavf 57.62.100 - avio.h + Add avio_get_dyn_buf() + +2016-12-10 - f542b152aa - lavu 55.43.100 - imgutils.h + Add av_image_check_size2() + +2016-12-07 - e7a6f8c972 - lavc 57.67.100 / 57.29.0 - avcodec.h + Add AV_PKT_DATA_SPHERICAL packet side data to export AVSphericalMapping + information from containers. + +2016-12-07 - 8f58ecc344 - lavu 55.42.100 / 55.30.0 - spherical.h + Add AV_FRAME_DATA_SPHERICAL value, av_spherical_alloc() API and + AVSphericalMapping type to export and describe spherical video properties. + +2016-11-18 - 2ab50647ff - lavf 57.58.100 - avformat.h + Add av_stream_add_side_data(). + +2016-11-13 - 775a8477b7 - lavu 55.39.100 - hwcontext_vaapi.h + Add AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE. + +2016-11-13 - a8d51bb424 - lavu 55.38.100 - hwcontext_vaapi.h + Add driver quirks field to VAAPI-specific hwdevice and enum with + members AV_VAAPI_DRIVER_QUIRK_* to represent its values. + +2016-11-10 - 638b216d4f - lavu 55.36.100 - pixfmt.h + Add AV_PIX_FMT_GRAY12(LE/BE). + -------- 8< --------- FFmpeg 3.2 was cut here -------- 8< --------- 2016-10-24 - 73ead47 - lavf 57.55.100 - avformat.h diff --git a/mythtv/external/FFmpeg/doc/Doxyfile b/mythtv/external/FFmpeg/doc/Doxyfile index 8f855f8ff57..ca68f1aad60 100644 --- a/mythtv/external/FFmpeg/doc/Doxyfile +++ b/mythtv/external/FFmpeg/doc/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = FFmpeg # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 3.2 +PROJECT_NUMBER = 3.4.1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/mythtv/external/FFmpeg/doc/Makefile b/mythtv/external/FFmpeg/doc/Makefile index a180fbed216..fa4996b5a30 100644 --- a/mythtv/external/FFmpeg/doc/Makefile +++ b/mythtv/external/FFmpeg/doc/Makefile @@ -24,6 +24,7 @@ HTMLPAGES = $(AVPROGS-yes:%=doc/%.html) $(AVPROGS-yes:%=doc/%-all.html) $(COMP doc/fate.html \ doc/general.html \ doc/git-howto.html \ + doc/mailing-list-faq.html \ doc/nut.html \ doc/platform.html \ @@ -36,30 +37,6 @@ DOCS-$(CONFIG_MANPAGES) += $(MANPAGES) DOCS-$(CONFIG_TXTPAGES) += $(TXTPAGES) DOCS = $(DOCS-yes) -DOC_EXAMPLES-$(CONFIG_AVIO_DIR_CMD_EXAMPLE) += avio_dir_cmd -DOC_EXAMPLES-$(CONFIG_AVIO_READING_EXAMPLE) += avio_reading -DOC_EXAMPLES-$(CONFIG_DECODING_ENCODING_EXAMPLE) += decoding_encoding -DOC_EXAMPLES-$(CONFIG_DEMUXING_DECODING_EXAMPLE) += demuxing_decoding -DOC_EXAMPLES-$(CONFIG_EXTRACT_MVS_EXAMPLE) += extract_mvs -DOC_EXAMPLES-$(CONFIG_FILTER_AUDIO_EXAMPLE) += filter_audio -DOC_EXAMPLES-$(CONFIG_FILTERING_AUDIO_EXAMPLE) += filtering_audio -DOC_EXAMPLES-$(CONFIG_FILTERING_VIDEO_EXAMPLE) += filtering_video -DOC_EXAMPLES-$(CONFIG_HTTP_MULTICLIENT_EXAMPLE) += http_multiclient -DOC_EXAMPLES-$(CONFIG_METADATA_EXAMPLE) += metadata -DOC_EXAMPLES-$(CONFIG_MUXING_EXAMPLE) += muxing -DOC_EXAMPLES-$(CONFIG_QSVDEC_EXAMPLE) += qsvdec -DOC_EXAMPLES-$(CONFIG_REMUXING_EXAMPLE) += remuxing -DOC_EXAMPLES-$(CONFIG_RESAMPLING_AUDIO_EXAMPLE) += resampling_audio -DOC_EXAMPLES-$(CONFIG_SCALING_VIDEO_EXAMPLE) += scaling_video -DOC_EXAMPLES-$(CONFIG_TRANSCODE_AAC_EXAMPLE) += transcode_aac -DOC_EXAMPLES-$(CONFIG_TRANSCODING_EXAMPLE) += transcoding -ALL_DOC_EXAMPLES_LIST = $(DOC_EXAMPLES-) $(DOC_EXAMPLES-yes) - -DOC_EXAMPLES := $(DOC_EXAMPLES-yes:%=doc/examples/%$(PROGSSUF)$(EXESUF)) -ALL_DOC_EXAMPLES := $(ALL_DOC_EXAMPLES_LIST:%=doc/examples/%$(PROGSSUF)$(EXESUF)) -ALL_DOC_EXAMPLES_G := $(ALL_DOC_EXAMPLES_LIST:%=doc/examples/%$(PROGSSUF)_g$(EXESUF)) -PROGS += $(DOC_EXAMPLES) - all-$(CONFIG_DOC): doc doc: documentation @@ -67,8 +44,6 @@ doc: documentation apidoc: doc/doxy/html documentation: $(DOCS) -examples: $(DOC_EXAMPLES) - TEXIDEP = perl $(SRC_PATH)/doc/texidep.pl $(SRC_PATH) $< $@ >$(@:%=%.d) doc/%.txt: TAG = TXT @@ -121,11 +96,9 @@ doc/%.3: doc/%.pod $(GENTEXI) $(M)pod2man --section=3 --center=" " --release=" " --date=" " $< > $@ $(DOCS) doc/doxy/html: | doc/ -$(DOC_EXAMPLES:%$(EXESUF)=%.o): | doc/examples -OBJDIRS += doc/examples -DOXY_INPUT = $(INSTHEADERS) $(DOC_EXAMPLES:%$(EXESUF)=%.c) $(LIB_EXAMPLES:%$(EXESUF)=%.c) -DOXY_INPUT_DEPS = $(addprefix $(SRC_PATH)/, $(DOXY_INPUT)) config.mak +DOXY_INPUT = $(INSTHEADERS) +DOXY_INPUT_DEPS = $(addprefix $(SRC_PATH)/, $(DOXY_INPUT)) ffbuild/config.mak doc/doxy/html: TAG = DOXY doc/doxy/html: $(SRC_PATH)/doc/Doxyfile $(SRC_PATH)/doc/doxy-wrapper.sh $(DOXY_INPUT_DEPS) @@ -171,11 +144,7 @@ clean:: docclean distclean:: docclean $(RM) doc/config.texi -examplesclean: - $(RM) $(ALL_DOC_EXAMPLES) $(ALL_DOC_EXAMPLES_G) - $(RM) $(CLEANSUFFIXES:%=doc/examples/%) - -docclean: examplesclean +docclean:: $(RM) $(CLEANSUFFIXES:%=doc/%) $(RM) $(TXTPAGES) doc/*.html doc/*.pod doc/*.1 doc/*.3 doc/avoptions_*.texi $(RM) -r doc/doxy/html diff --git a/mythtv/external/FFmpeg/doc/bitstream_filters.texi b/mythtv/external/FFmpeg/doc/bitstream_filters.texi index a85327ff5c3..2dffe021f92 100644 --- a/mythtv/external/FFmpeg/doc/bitstream_filters.texi +++ b/mythtv/external/FFmpeg/doc/bitstream_filters.texi @@ -26,19 +26,26 @@ with their parameters, if any. @section aac_adtstoasc -Convert MPEG-2/4 AAC ADTS to MPEG-4 Audio Specific Configuration -bitstream filter. +Convert MPEG-2/4 AAC ADTS to an MPEG-4 Audio Specific Configuration +bitstream. This filter creates an MPEG-4 AudioSpecificConfig from an MPEG-2/4 ADTS header and removes the ADTS header. -This is required for example when copying an AAC stream from a raw -ADTS AAC container to a FLV or a MOV/MP4 file. +This filter is required for example when copying an AAC stream from a +raw ADTS AAC or an MPEG-TS container to MP4A-LATM, to an FLV file, or +to MOV/MP4 files and related formats such as 3GP or M4A. Please note +that it is auto-inserted for MP4A-LATM and MOV/MP4 and related formats. @section chomp Remove zero padding at the end of a packet. +@section dca_core + +Extract the core from a DCA/DTS stream, dropping extensions such as +DTS-HD. + @section dump_extra Add extradata to the beginning of the filtered packets. @@ -67,9 +74,23 @@ the header stored in extradata to the key packets: ffmpeg -i INPUT -map 0 -flags:v +global_header -c:v libx264 -bsf:v dump_extra out.ts @end example -@section dca_core +@section extract_extradata + +Extract the in-band extradata. + +Certain codecs allow the long-term headers (e.g. MPEG-2 sequence headers, +or H.264/HEVC (VPS/)SPS/PPS) to be transmitted either "in-band" (i.e. as a part +of the bitstream containing the coded frames) or "out of band" (e.g. on the +container level). This latter form is called "extradata" in FFmpeg terminology. -Extract DCA core from DTS-HD streams. +This bitstream filter detects the in-band headers and makes them available as +extradata. + +@table @option +@item remove +When this option is enabled, the long-term headers are removed from the +bitstream after extraction. +@end table @section h264_mp4toannexb @@ -78,7 +99,7 @@ prefixed mode (as defined in the Annex B of the ITU-T H.264 specification). This is required by some streaming formats, typically the MPEG-2 -transport stream format ("mpegts"). +transport stream format (muxer @code{mpegts}). For example to remux an MP4 file containing an H.264 stream to mpegts format with @command{ffmpeg}, you can use the command: @@ -87,6 +108,29 @@ format with @command{ffmpeg}, you can use the command: ffmpeg -i INPUT.mp4 -codec copy -bsf:v h264_mp4toannexb OUTPUT.ts @end example +Please note that this filter is auto-inserted for MPEG-TS (muxer +@code{mpegts}) and raw H.264 (muxer @code{h264}) output formats. + +@section hevc_mp4toannexb + +Convert an HEVC/H.265 bitstream from length prefixed mode to start code +prefixed mode (as defined in the Annex B of the ITU-T H.265 +specification). + +This is required by some streaming formats, typically the MPEG-2 +transport stream format (muxer @code{mpegts}). + +For example to remux an MP4 file containing an HEVC stream to mpegts +format with @command{ffmpeg}, you can use the command: + +@example +ffmpeg -i INPUT.mp4 -codec copy -bsf:v hevc_mp4toannexb OUTPUT.ts +@end example + +Please note that this filter is auto-inserted for MPEG-TS (muxer +@code{mpegts}) and raw HEVC/H.265 (muxer @code{h265} or +@code{hevc}) output formats. + @section imxdump Modifies the bitstream to fit in MOV and to be usable by the Final Cut @@ -137,11 +181,22 @@ exiftran -i -9 frame*.jpg ffmpeg -i frame_%d.jpg -c:v copy rotated.avi @end example -@section mjpega_dump_header +@section mjpegadump + +Add an MJPEG A header to the bitstream, to enable decoding by +Quicktime. + +@anchor{mov2textsub} +@section mov2textsub + +Extract a representable text file from MOV subtitles, stripping the +metadata header from each subtitle packet. -@section movsub +See also the @ref{text2movsub} filter. -@section mp3_header_decompress +@section mp3decomp + +Decompress non-standard compressed MP3 audio headers. @section mpeg4_unpack_bframes @@ -165,20 +220,74 @@ ffmpeg -i INPUT.avi -codec copy -bsf:v mpeg4_unpack_bframes OUTPUT.avi @section noise -Damages the contents of packets without damaging the container. Can be -used for fuzzing or testing error resilience/concealment. +Damages the contents of packets or simply drops them without damaging the +container. Can be used for fuzzing or testing error resilience/concealment. Parameters: +@table @option +@item amount A numeral string, whose value is related to how often output bytes will be modified. Therefore, values below or equal to 0 are forbidden, and the lower the more frequent bytes will be modified, with 1 meaning every byte is modified. +@item dropamount +A numeral string, whose value is related to how often packets will be dropped. +Therefore, values below or equal to 0 are forbidden, and the lower the more +frequent packets will be dropped, with 1 meaning every packet is dropped. +@end table +The following example applies the modification to every byte but does not drop +any packets. @example ffmpeg -i INPUT -c copy -bsf noise[=1] output.mkv @end example -applies the modification to every byte. + +@section null +This bitstream filter passes the packets through unchanged. @section remove_extra +Remove extradata from packets. + +It accepts the following parameter: +@table @option +@item freq +Set which frame types to remove extradata from. + +@table @samp +@item k +Remove extradata from non-keyframes only. + +@item keyframe +Remove extradata from keyframes only. + +@item e, all +Remove extradata from all frames. + +@end table +@end table + +@anchor{text2movsub} +@section text2movsub + +Convert text subtitles to MOV subtitles (as used by the @code{mov_text} +codec) with metadata headers. + +See also the @ref{mov2textsub} filter. + +@section vp9_superframe + +Merge VP9 invisible (alt-ref) frames back into VP9 superframes. This +fixes merging of split/segmented VP9 streams where the alt-ref frame +was split from its visible counterpart. + +@section vp9_superframe_split + +Split VP9 superframes into single frames. + +@section vp9_raw_reorder + +Given a VP9 stream with correct timestamps but possibly out of order, +insert additional show-existing-frame packets to correct the ordering. + @c man end BITSTREAM FILTERS diff --git a/mythtv/external/FFmpeg/doc/build_system.txt b/mythtv/external/FFmpeg/doc/build_system.txt index 8c12e0e294d..325a9e83d01 100644 --- a/mythtv/external/FFmpeg/doc/build_system.txt +++ b/mythtv/external/FFmpeg/doc/build_system.txt @@ -45,6 +45,9 @@ libswscale/swscale-test config Reconfigure the project with the current configuration. +tools/target_dec__fuzzer + Build fuzzer to fuzz the specified decoder. + Useful standard make commands: make -t diff --git a/mythtv/external/FFmpeg/doc/codecs.texi b/mythtv/external/FFmpeg/doc/codecs.texi index 9d0b980c121..40f64fe4c88 100644 --- a/mythtv/external/FFmpeg/doc/codecs.texi +++ b/mythtv/external/FFmpeg/doc/codecs.texi @@ -138,7 +138,8 @@ Set audio sampling rate (in Hz). Set number of audio channels. @item cutoff @var{integer} (@emph{encoding,audio}) -Set cutoff bandwidth. +Set cutoff bandwidth. (Supported only by selected encoders, see +their respective documentation sections.) @item frame_size @var{integer} (@emph{encoding,audio}) Set audio frame size. @@ -1067,12 +1068,15 @@ SMPTE 240 M Film @item bt2020 BT.2020 +@item smpte428 @item smpte428_1 SMPTE ST 428-1 @item smpte431 SMPTE 431-2 @item smpte432 SMPTE 432-1 +@item jedec-p22 +JEDEC P22 @end table @item color_trc @var{integer} (@emph{decoding/encoding,video}) @@ -1091,21 +1095,29 @@ SMPTE 240 M @item linear Linear @item log +@item log100 Log @item log_sqrt +@item log316 Log square root @item iec61966_2_4 +@item iec61966-2-4 IEC 61966-2-4 @item bt1361 +@item bt1361e BT.1361 @item iec61966_2_1 +@item iec61966-2-1 IEC 61966-2-1 +@item bt2020_10 @item bt2020_10bit BT.2020 - 10 bit +@item bt2020_12 @item bt2020_12bit BT.2020 - 12 bit @item smpte2084 SMPTE ST 2084 +@item smpte428 @item smpte428_1 SMPTE ST 428-1 @item arib-std-b67 @@ -1129,8 +1141,10 @@ SMPTE 170 M SMPTE 240 M @item ycocg YCOCG +@item bt2020nc @item bt2020_ncl BT.2020 NCL +@item bt2020c @item bt2020_cl BT.2020 CL @item smpte2085 @@ -1140,8 +1154,32 @@ SMPTE 2085 @item color_range @var{integer} (@emph{decoding/encoding,video}) If used as input parameter, it serves as a hint to the decoder, which color_range the input has. +Possible values: +@table @samp +@item tv +@item mpeg +MPEG (219*2^(n-8)) +@item pc +@item jpeg +JPEG (2^n-1) +@end table @item chroma_sample_location @var{integer} (@emph{decoding/encoding,video}) +Possible values: +@table @samp +@item left + +@item center + +@item topleft + +@item top + +@item bottomleft + +@item bottom + +@end table @item log_level_offset @var{integer} Set the log level offset. @@ -1220,7 +1258,7 @@ Interlaced video, top coded first, bottom displayed first Interlaced video, bottom coded first, top displayed first @end table -@item skip_alpha @var{integer} (@emph{decoding,video}) +@item skip_alpha @var{bool} (@emph{decoding,video}) Set to 1 to disable processing alpha (transparency). This works like the @samp{gray} flag in the @option{flags} option which skips chroma information instead of alpha. Default is 0. @@ -1237,6 +1275,20 @@ ffprobe -dump_separator " " -i ~/videos/matrixbench_mpeg2.mpg @end example +@item max_pixels @var{integer} (@emph{decoding/encoding,video}) +Maximum number of pixels per image. This value can be used to avoid out of +memory failures due to large images. + +@item apply_cropping @var{bool} (@emph{decoding,video}) +Enable cropping if cropping parameters are multiples of the required +alignment for the left and top parameters. If the alignment is not met the +cropping will be partially applied to maintain alignment. +Default is 1 (enabled). +Note: The required alignment depends on if @code{AV_CODEC_FLAG_UNALIGNED} is set and the +CPU. @code{AV_CODEC_FLAG_UNALIGNED} cannot be changed from the command line. Also hardware +decoders will not apply left/top Cropping. + + @end table @c man end CODEC OPTIONS diff --git a/mythtv/external/FFmpeg/doc/decoders.texi b/mythtv/external/FFmpeg/doc/decoders.texi index babe1297672..d149d2bea51 100644 --- a/mythtv/external/FFmpeg/doc/decoders.texi +++ b/mythtv/external/FFmpeg/doc/decoders.texi @@ -109,7 +109,7 @@ correctly by using lavc's old buggy lpc logic for decoding. @section ffwavesynth -Internal wave synthetizer. +Internal wave synthesizer. This decoder generates wave patterns according to predefined sequences. Its use is purely internal and the format of the data it accepts is not publicly @@ -275,7 +275,7 @@ Y offset of generated bitmaps, default is 0. Chops leading and trailing spaces and removes empty lines from the generated text. This option is useful for teletext based subtitles where empty spaces may be present at the start or at the end of the lines or empty lines may be -present between the subtitle lines because of double-sized teletext charactes. +present between the subtitle lines because of double-sized teletext characters. Default value is 1. @item txt_duration Sets the display duration of the decoded teletext pages or subtitles in diff --git a/mythtv/external/FFmpeg/doc/demuxers.texi b/mythtv/external/FFmpeg/doc/demuxers.texi index 2934a1cf7f4..73dc0feec19 100644 --- a/mythtv/external/FFmpeg/doc/demuxers.texi +++ b/mythtv/external/FFmpeg/doc/demuxers.texi @@ -13,8 +13,9 @@ You can disable all the demuxers using the configure option the option @code{--enable-demuxer=@var{DEMUXER}}, or disable it with the option @code{--disable-demuxer=@var{DEMUXER}}. -The option @code{-formats} of the ff* tools will display the list of -enabled demuxers. +The option @code{-demuxers} of the ff* tools will display the list of +enabled demuxers. Use @code{-formats} to view a combined list of +enabled demuxers and muxers. The description of some of the currently available demuxers follows. @@ -243,11 +244,17 @@ file subdir/file-2.wav @end example @end itemize -@section flv +@section flv, live_flv Adobe Flash Video Format demuxer. -This demuxer is used to demux FLV files and RTMP network streams. +This demuxer is used to demux FLV files and RTMP network streams. In case of live network streams, if you force format, you may use live_flv option instead of flv to survive timestamp discontinuities. + +@example +ffmpeg -f flv -i myfile.flv ... +ffmpeg -f live_flv -i rtmp:///anything/key .... +@end example + @table @option @item -flv_metadata @var{bool} @@ -293,6 +300,24 @@ used to end the output video at the length of the shortest input file, which in this case is @file{input.mp4} as the GIF in this example loops infinitely. +@section hls + +HLS demuxer + +It accepts the following options: + +@table @option +@item live_start_index +segment index to start live streams at (negative values are from the end). + +@item allowed_extensions +',' separated list of file extensions that hls is allowed to access. + +@item max_reload +Maximum number of times a insufficient list is attempted to be reloaded. +Default value is 1000. +@end table + @section image2 Image file demuxer. diff --git a/mythtv/external/FFmpeg/doc/developer.texi b/mythtv/external/FFmpeg/doc/developer.texi index dbe1f5421f5..98540c8f992 100644 --- a/mythtv/external/FFmpeg/doc/developer.texi +++ b/mythtv/external/FFmpeg/doc/developer.texi @@ -131,6 +131,11 @@ designated struct initializers (@samp{struct s x = @{ .i = 17 @};}); @item compound literals (@samp{x = (struct s) @{ 17, 23 @};}). + +@item +Implementation defined behavior for signed integers is assumed to match the +expected behavior for two's complement. Non representable values in integer +casts are binary truncated. Shift right of signed values uses sign extension. @end itemize These features are supported by all compilers we care about, so we will not diff --git a/mythtv/external/FFmpeg/doc/encoders.texi b/mythtv/external/FFmpeg/doc/encoders.texi index 5a60e7ee5a5..431777c4578 100644 --- a/mythtv/external/FFmpeg/doc/encoders.texi +++ b/mythtv/external/FFmpeg/doc/encoders.texi @@ -92,12 +92,12 @@ using the value "enable", which is mainly useful for debugging or disabled using @item aac_is Sets intensity stereo coding tool usage. By default, it's enabled and will -automatically toggle IS for similar pairs of stereo bands if it's benefitial. +automatically toggle IS for similar pairs of stereo bands if it's beneficial. Can be disabled for debugging by setting the value to "disable". @item aac_pns Uses perceptual noise substitution to replace low entropy high frequency bands -with imperceivable white noise during the decoding process. By default, it's +with imperceptible white noise during the decoding process. By default, it's enabled, but can be disabled for debugging purposes by using "disable". @item aac_tns @@ -488,6 +488,10 @@ is an optional AC-3 feature that increases quality by selectively encoding the left/right channels as mid/side. This option is enabled by default, and it is highly recommended that it be left as enabled except for testing purposes. +@item cutoff @var{frequency} +Set lowpass cutoff frequency. If unspecified, the encoder selects a default +determined by various other encoding parameters. + @end table @subsection Floating-Point-Only AC-3 Encoding Options @@ -545,7 +549,8 @@ The following options are supported by FFmpeg's flac encoder. @table @option @item compression_level Sets the compression level, which chooses defaults for many other options -if they are not set explicitly. +if they are not set explicitly. Valid values are from 0 to 12, 5 is the +default. @item frame_size Sets the size of the frames in samples per channel. @@ -594,7 +599,7 @@ Channel mode @item auto The mode is chosen automatically for each frame @item indep -Chanels are independently coded +Channels are independently coded @item left_side @item right_side @item mid_side @@ -612,6 +617,27 @@ and slightly improves compression. @end table +@anchor{opusenc} +@section opus + +Opus encoder. + +This is a native FFmpeg encoder for the Opus format. Currently its in development and +only implements the CELT part of the codec. Its quality is usually worse and at best +is equal to the libopus encoder. + +@subsection Options + +@table @option +@item b +Set bit rate in bits/s. If unspecified it uses the number of channels and the layout +to make a good guess. + +@item opus_delay +Sets the maximum delay in milliseconds. Lower delays than 20ms will very quickly +decrease quality. +@end table + @anchor{libfdk-aac-enc} @section libfdk_aac @@ -817,6 +843,10 @@ Set algorithm quality. Valid arguments are integers in the 0-9 range, with 0 meaning highest quality but slowest, and 9 meaning fastest while producing the worst quality. +@item cutoff (@emph{--lowpass}) +Set lowpass cutoff frequency. If unspecified, the encoder dynamically +adjusts the cutoff. + @item reservoir Enable use of bit reservoir when set to 1. Default value is 1. LAME has this enabled by default, but can be overridden by use @@ -870,6 +900,90 @@ default value is 0 (disabled). @end table +@section libopus + +libopus Opus Interactive Audio Codec encoder wrapper. + +Requires the presence of the libopus headers and library during +configuration. You need to explicitly configure the build with +@code{--enable-libopus}. + +@subsection Option Mapping + +Most libopus options are modelled after the @command{opusenc} utility from +opus-tools. The following is an option mapping chart describing options +supported by the libopus wrapper, and their @command{opusenc}-equivalent +in parentheses. + +@table @option + +@item b (@emph{bitrate}) +Set the bit rate in bits/s. FFmpeg's @option{b} option is +expressed in bits/s, while @command{opusenc}'s @option{bitrate} in +kilobits/s. + +@item vbr (@emph{vbr}, @emph{hard-cbr}, and @emph{cvbr}) +Set VBR mode. The FFmpeg @option{vbr} option has the following +valid arguments, with the @command{opusenc} equivalent options +in parentheses: + +@table @samp +@item off (@emph{hard-cbr}) +Use constant bit rate encoding. + +@item on (@emph{vbr}) +Use variable bit rate encoding (the default). + +@item constrained (@emph{cvbr}) +Use constrained variable bit rate encoding. +@end table + +@item compression_level (@emph{comp}) +Set encoding algorithm complexity. Valid options are integers in +the 0-10 range. 0 gives the fastest encodes but lower quality, while 10 +gives the highest quality but slowest encoding. The default is 10. + +@item frame_duration (@emph{framesize}) +Set maximum frame size, or duration of a frame in milliseconds. The +argument must be exactly the following: 2.5, 5, 10, 20, 40, 60. Smaller +frame sizes achieve lower latency but less quality at a given bitrate. +Sizes greater than 20ms are only interesting at fairly low bitrates. +The default is 20ms. + +@item packet_loss (@emph{expect-loss}) +Set expected packet loss percentage. The default is 0. + +@item application (N.A.) +Set intended application type. Valid options are listed below: + +@table @samp +@item voip +Favor improved speech intelligibility. +@item audio +Favor faithfulness to the input (the default). +@item lowdelay +Restrict to only the lowest delay modes. +@end table + +@item cutoff (N.A.) +Set cutoff bandwidth in Hz. The argument must be exactly one of the +following: 4000, 6000, 8000, 12000, or 20000, corresponding to +narrowband, mediumband, wideband, super wideband, and fullband +respectively. The default is 0 (cutoff disabled). + +@item mapping_family (@emph{mapping_family}) +Set channel mapping family to be used by the encoder. The default value of -1 +uses mapping family 0 for mono and stereo inputs, and mapping family 1 +otherwise. The default also disables the surround masking and LFE bandwidth +optimzations in libopus, and requires that the input contains 8 channels or +fewer. + +Other values include 0 for mono and stereo, 1 for surround sound with masking +and LFE bandwidth optimizations, and 255 for independent streams with an +unspecified channel layout. + +@end table + @anchor{libshine} @section libshine @@ -1009,90 +1123,6 @@ default value is 0 (disabled). @end table -@section libopus - -libopus Opus Interactive Audio Codec encoder wrapper. - -Requires the presence of the libopus headers and library during -configuration. You need to explicitly configure the build with -@code{--enable-libopus}. - -@subsection Option Mapping - -Most libopus options are modelled after the @command{opusenc} utility from -opus-tools. The following is an option mapping chart describing options -supported by the libopus wrapper, and their @command{opusenc}-equivalent -in parentheses. - -@table @option - -@item b (@emph{bitrate}) -Set the bit rate in bits/s. FFmpeg's @option{b} option is -expressed in bits/s, while @command{opusenc}'s @option{bitrate} in -kilobits/s. - -@item vbr (@emph{vbr}, @emph{hard-cbr}, and @emph{cvbr}) -Set VBR mode. The FFmpeg @option{vbr} option has the following -valid arguments, with the @command{opusenc} equivalent options -in parentheses: - -@table @samp -@item off (@emph{hard-cbr}) -Use constant bit rate encoding. - -@item on (@emph{vbr}) -Use variable bit rate encoding (the default). - -@item constrained (@emph{cvbr}) -Use constrained variable bit rate encoding. -@end table - -@item compression_level (@emph{comp}) -Set encoding algorithm complexity. Valid options are integers in -the 0-10 range. 0 gives the fastest encodes but lower quality, while 10 -gives the highest quality but slowest encoding. The default is 10. - -@item frame_duration (@emph{framesize}) -Set maximum frame size, or duration of a frame in milliseconds. The -argument must be exactly the following: 2.5, 5, 10, 20, 40, 60. Smaller -frame sizes achieve lower latency but less quality at a given bitrate. -Sizes greater than 20ms are only interesting at fairly low bitrates. -The default is 20ms. - -@item packet_loss (@emph{expect-loss}) -Set expected packet loss percentage. The default is 0. - -@item application (N.A.) -Set intended application type. Valid options are listed below: - -@table @samp -@item voip -Favor improved speech intelligibility. -@item audio -Favor faithfulness to the input (the default). -@item lowdelay -Restrict to only the lowest delay modes. -@end table - -@item cutoff (N.A.) -Set cutoff bandwidth in Hz. The argument must be exactly one of the -following: 4000, 6000, 8000, 12000, or 20000, corresponding to -narrowband, mediumband, wideband, super wideband, and fullband -respectively. The default is 0 (cutoff disabled). - -@item mapping_family (@emph{mapping_family}) -Set channel mapping family to be used by the encoder. The default value of -1 -uses mapping family 0 for mono and stereo inputs, and mapping family 1 -otherwise. The default also disables the surround masking and LFE bandwidth -optimzations in libopus, and requires that the input contains 8 channels or -fewer. - -Other values include 0 for mono and stereo, 1 for surround sound with masking -and LFE bandwidth optimizations, and 255 for independent streams with an -unspecified channel layout. - -@end table - @section libvorbis libvorbis encoder wrapper. @@ -1192,6 +1222,27 @@ Same as @samp{3}, but with extra processing enabled. @end table @end table +@anchor{mjpegenc} +@section mjpeg + +Motion JPEG encoder. + +@subsection Options + +@table @option +@item huffman +Set the huffman encoding strategy. Possible values: + +@table @samp +@item default +Use the default huffman tables. This is the default strategy. + +@item optimal +Compute and use optimal huffman tables. + +@end table +@end table + @anchor{wavpackenc} @section wavpack @@ -1261,6 +1312,81 @@ disabled A description of some of the currently available video encoders follows. +@section Hap + +Vidvox Hap video encoder. + +@subsection Options + +@table @option +@item format @var{integer} +Specifies the Hap format to encode. + +@table @option +@item hap +@item hap_alpha +@item hap_q +@end table + +Default value is @option{hap}. + +@item chunks @var{integer} +Specifies the number of chunks to split frames into, between 1 and 64. This +permits multithreaded decoding of large frames, potentially at the cost of +data-rate. The encoder may modify this value to divide frames evenly. + +Default value is @var{1}. + +@item compressor @var{integer} +Specifies the second-stage compressor to use. If set to @option{none}, +@option{chunks} will be limited to 1, as chunked uncompressed frames offer no +benefit. + +@table @option +@item none +@item snappy +@end table + +Default value is @option{snappy}. + +@end table + +@section jpeg2000 + +The native jpeg 2000 encoder is lossy by default, the @code{-q:v} +option can be used to set the encoding quality. Lossless encoding +can be selected with @code{-pred 1}. + +@subsection Options + +@table @option +@item format +Can be set to either @code{j2k} or @code{jp2} (the default) that +makes it possible to store non-rgb pix_fmts. + +@end table + +@section libkvazaar + +Kvazaar H.265/HEVC encoder. + +Requires the presence of the libkvazaar headers and library during +configuration. You need to explicitly configure the build with +@option{--enable-libkvazaar}. + +@subsection Options + +@table @option + +@item b +Set target video bitrate in bit/s and enable rate control. + +@item kvazaar-params +Set kvazaar parameters as a list of @var{name}=@var{value} pairs separated +by commas (,). See kvazaar documentation for a list of options. + +@end table + @section libopenh264 Cisco libopenh264 H.264/MPEG-4 AVC encoder wrapper. @@ -1327,30 +1453,6 @@ Set maximum NAL size in bytes. Allow skipping frames to hit the target bitrate if set to 1. @end table -@section jpeg2000 - -The native jpeg 2000 encoder is lossy by default, the @code{-q:v} -option can be used to set the encoding quality. Lossless encoding -can be selected with @code{-pred 1}. - -@subsection Options - -@table @option -@item format -Can be set to either @code{j2k} or @code{jp2} (the default) that -makes it possible to store non-rgb pix_fmts. - -@end table - -@section snow - -@subsection Options - -@table @option -@item iterative_dia_size -dia size for the iterative motion estimation -@end table - @section libtheora libtheora Theora encoder wrapper. @@ -1564,7 +1666,7 @@ option to 2. Enable frame parallel decodability features. @item aq-mode Set adaptive quantization mode (0: off (default), 1: variance 2: complexity, 3: -cyclic refresh). +cyclic refresh, 4: equator360). @item colorspace @emph{color-space} Set input color space. The VP9 bitstream supports signaling the following colorspaces: @@ -1577,6 +1679,8 @@ colorspaces: @item @samp{smpte240m} @emph{smpte240} @item @samp{bt2020_ncl} @emph{bt2020} @end table +@item row-mt @var{boolean} +Enable row based multi-threading. @end table @end table @@ -1584,7 +1688,6 @@ colorspaces: For more information about libvpx see: @url{http://www.webmproject.org/} - @section libwebp libwebp WebP Image encoder wrapper @@ -1690,7 +1793,7 @@ the documentation of the undocumented generic options, see @ref{codec-options,,the Codec Options chapter}. To get a more accurate and extensive documentation of the libx264 -options, invoke the command @command{x264 --full-help} or consult +options, invoke the command @command{x264 --fullhelp} or consult the libx264 documentation. @table @option @@ -1751,6 +1854,10 @@ Exhaustive search. Hadamard exhaustive search (slowest). @end table +@item forced-idr +Normally, when forcing a I-frame type, the encoder can select any type +of I-frame. This option forces it to choose an IDR-frame. + @item subq (@emph{subme}) Sub-pixel motion estimation method. @@ -1999,7 +2106,7 @@ is kept undocumented for some reason. For example to specify libx264 encoding options with @command{ffmpeg}: @example -ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv +ffmpeg -i foo.mpg -c:v libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv @end example @item a53cc @var{boolean} @@ -2041,6 +2148,10 @@ Set the x265 preset. @item tune Set the x265 tune parameter. +@item forced-idr +Normally, when forcing a I-frame type, the encoder can select any type +of I-frame. This option forces it to choose an IDR-frame. + @item x265-params Set x265 options using a list of @var{key}=@var{value} couples separated by ":". See @command{x265 --help} for a list of options. @@ -2270,6 +2381,7 @@ Select the ProRes profile to encode @item standard @item hq @item 4444 +@item 4444xq @end table @item quant_mat @var{integer} @@ -2319,27 +2431,6 @@ Setting a higher @option{bits_per_mb} limit will improve the speed. For the fastest encoding speed set the @option{qscale} parameter (4 is the recommended value) and do not set a size constraint. -@section libkvazaar - -Kvazaar H.265/HEVC encoder. - -Requires the presence of the libkvazaar headers and library during -configuration. You need to explicitly configure the build with -@option{--enable-libkvazaar}. - -@subsection Options - -@table @option - -@item b -Set target video bitrate in bit/s and enable rate control. - -@item kvazaar-params -Set kvazaar parameters as a list of @var{name}=@var{value} pairs separated -by commas (,). See kvazaar documentation for a list of options. - -@end table - @section QSV encoders The family of Intel QuickSync Video encoders (MPEG-2, H.264 and HEVC) @@ -2428,6 +2519,126 @@ encoder use CAVLC instead of CABAC. @end itemize +@section snow + +@subsection Options + +@table @option +@item iterative_dia_size +dia size for the iterative motion estimation +@end table + +@section VAAPI encoders + +Wrappers for hardware encoders accessible via VAAPI. + +These encoders only accept input in VAAPI hardware surfaces. If you have input +in software frames, use the @option{hwupload} filter to upload them to the GPU. + +The following standard libavcodec options are used: +@itemize +@item +@option{g} / @option{gop_size} +@item +@option{bf} / @option{max_b_frames} +@item +@option{profile} +@item +@option{level} +@item +@option{b} / @option{bit_rate} +@item +@option{maxrate} / @option{rc_max_rate} +@item +@option{bufsize} / @option{rc_buffer_size} +@item +@option{rc_init_occupancy} / @option{rc_initial_buffer_occupancy} +@item +@option{compression_level} + +Speed / quality tradeoff: higher values are faster / worse quality. +@item +@option{q} / @option{global_quality} + +Size / quality tradeoff: higher values are smaller / worse quality. +@item +@option{qmin} +(only: @option{qmax} is not supported) +@item +@option{i_qfactor} / @option{i_quant_factor} +@item +@option{i_qoffset} / @option{i_quant_offset} +@item +@option{b_qfactor} / @option{b_quant_factor} +@item +@option{b_qoffset} / @option{b_quant_offset} +@end itemize + +@table @option + +@item h264_vaapi +@option{profile} sets the value of @emph{profile_idc} and the @emph{constraint_set*_flag}s. +@option{level} sets the value of @emph{level_idc}. + +@table @option +@item low_power +Use low-power encoding mode. +@item coder +Set entropy encoder (default is @emph{cabac}). Possible values: + +@table @samp +@item ac +@item cabac +Use CABAC. + +@item vlc +@item cavlc +Use CAVLC. +@end table +@end table + +@item hevc_vaapi +@option{profile} and @option{level} set the values of +@emph{general_profile_idc} and @emph{general_level_idc} respectively. + +@item mjpeg_vaapi +Always encodes using the standard quantisation and huffman tables - +@option{global_quality} scales the standard quantisation table (range 1-100). + +@item mpeg2_vaapi +@option{profile} and @option{level} set the value of @emph{profile_and_level_indication}. + +No rate control is supported. + +@item vp8_vaapi +B-frames are not supported. + +@option{global_quality} sets the @emph{q_idx} used for non-key frames (range 0-127). + +@table @option +@item loop_filter_level +@item loop_filter_sharpness +Manually set the loop filter parameters. +@end table + +@item vp9_vaapi +@option{global_quality} sets the @emph{q_idx} used for P-frames (range 0-255). + +@table @option +@item loop_filter_level +@item loop_filter_sharpness +Manually set the loop filter parameters. +@end table + +B-frames are supported, but the output stream is always in encode order rather than display +order. If B-frames are enabled, it may be necessary to use the @option{vp9_raw_reorder} +bitstream filter to modify the output stream to display frames in the correct order. + +Only normal frames are produced - the @option{vp9_superframe} bitstream filter may be +required to produce a stream usable with all decoders. + +@end table + @section vc2 SMPTE VC-2 (previously BBC Dirac Pro). This codec was primarily aimed at diff --git a/mythtv/external/FFmpeg/doc/examples/.gitignore b/mythtv/external/FFmpeg/doc/examples/.gitignore index 430d3bfbfc7..154c8415f6c 100644 --- a/mythtv/external/FFmpeg/doc/examples/.gitignore +++ b/mythtv/external/FFmpeg/doc/examples/.gitignore @@ -1,12 +1,16 @@ /avio_dir_cmd /avio_reading -/decoding_encoding +/decode_audio +/decode_video /demuxing_decoding +/encode_audio +/encode_video /extract_mvs /filter_audio /filtering_audio /filtering_video /http_multiclient +/hw_decode /metadata /muxing /pc-uninstalled diff --git a/mythtv/external/FFmpeg/doc/examples/Makefile b/mythtv/external/FFmpeg/doc/examples/Makefile index af3815995a0..58afd71b85b 100644 --- a/mythtv/external/FFmpeg/doc/examples/Makefile +++ b/mythtv/external/FFmpeg/doc/examples/Makefile @@ -1,46 +1,62 @@ -# use pkg-config for getting CFLAGS and LDLIBS -FFMPEG_LIBS= libavdevice \ - libavformat \ - libavfilter \ - libavcodec \ - libswresample \ - libswscale \ - libavutil \ - -CFLAGS += -Wall -g -CFLAGS := $(shell pkg-config --cflags $(FFMPEG_LIBS)) $(CFLAGS) -LDLIBS := $(shell pkg-config --libs $(FFMPEG_LIBS)) $(LDLIBS) - -EXAMPLES= avio_dir_cmd \ - avio_reading \ - decoding_encoding \ - demuxing_decoding \ - extract_mvs \ - filtering_video \ - filtering_audio \ - http_multiclient \ - metadata \ - muxing \ - remuxing \ - resampling_audio \ - scaling_video \ - transcode_aac \ - transcoding \ - -OBJS=$(addsuffix .o,$(EXAMPLES)) - -# the following examples make explicit use of the math library -avcodec: LDLIBS += -lm -decoding_encoding: LDLIBS += -lm -muxing: LDLIBS += -lm -resampling_audio: LDLIBS += -lm - -.phony: all clean-test clean - -all: $(OBJS) $(EXAMPLES) - -clean-test: - $(RM) test*.pgm test.h264 test.mp2 test.sw test.mpg - -clean: clean-test - $(RM) $(EXAMPLES) $(OBJS) +EXAMPLES-$(CONFIG_AVIO_DIR_CMD_EXAMPLE) += avio_dir_cmd +EXAMPLES-$(CONFIG_AVIO_READING_EXAMPLE) += avio_reading +EXAMPLES-$(CONFIG_DECODE_AUDIO_EXAMPLE) += decode_audio +EXAMPLES-$(CONFIG_DECODE_VIDEO_EXAMPLE) += decode_video +EXAMPLES-$(CONFIG_DEMUXING_DECODING_EXAMPLE) += demuxing_decoding +EXAMPLES-$(CONFIG_ENCODE_AUDIO_EXAMPLE) += encode_audio +EXAMPLES-$(CONFIG_ENCODE_VIDEO_EXAMPLE) += encode_video +EXAMPLES-$(CONFIG_EXTRACT_MVS_EXAMPLE) += extract_mvs +EXAMPLES-$(CONFIG_FILTER_AUDIO_EXAMPLE) += filter_audio +EXAMPLES-$(CONFIG_FILTERING_AUDIO_EXAMPLE) += filtering_audio +EXAMPLES-$(CONFIG_FILTERING_VIDEO_EXAMPLE) += filtering_video +EXAMPLES-$(CONFIG_HTTP_MULTICLIENT_EXAMPLE) += http_multiclient +EXAMPLES-$(CONFIG_HW_DECODE_EXAMPLE) += hw_decode +EXAMPLES-$(CONFIG_METADATA_EXAMPLE) += metadata +EXAMPLES-$(CONFIG_MUXING_EXAMPLE) += muxing +EXAMPLES-$(CONFIG_QSVDEC_EXAMPLE) += qsvdec +EXAMPLES-$(CONFIG_REMUXING_EXAMPLE) += remuxing +EXAMPLES-$(CONFIG_RESAMPLING_AUDIO_EXAMPLE) += resampling_audio +EXAMPLES-$(CONFIG_SCALING_VIDEO_EXAMPLE) += scaling_video +EXAMPLES-$(CONFIG_TRANSCODE_AAC_EXAMPLE) += transcode_aac +EXAMPLES-$(CONFIG_TRANSCODING_EXAMPLE) += transcoding + +EXAMPLES := $(EXAMPLES-yes:%=doc/examples/%$(PROGSSUF)$(EXESUF)) +EXAMPLES_G := $(EXAMPLES-yes:%=doc/examples/%$(PROGSSUF)_g$(EXESUF)) +ALL_EXAMPLES := $(EXAMPLES) $(EXAMPLES-:%=doc/examples/%$(PROGSSUF)$(EXESUF)) +ALL_EXAMPLES_G := $(EXAMPLES_G) $(EXAMPLES-:%=doc/examples/%$(PROGSSUF)_g$(EXESUF)) +PROGS += $(EXAMPLES) + +EXAMPLE_MAKEFILE := $(SRC_PATH)/doc/examples/Makefile +EXAMPLES_FILES := $(wildcard $(SRC_PATH)/doc/examples/*.c) $(SRC_PATH)/doc/examples/README $(EXAMPLE_MAKEFILE) + +$(foreach P,$(EXAMPLES),$(eval OBJS-$(P:%$(PROGSSUF)$(EXESUF)=%) = $(P:%$(PROGSSUF)$(EXESUF)=%).o)) +$(EXAMPLES_G): %$(PROGSSUF)_g$(EXESUF): %.o + +examples: $(EXAMPLES) + +$(EXAMPLES:%$(PROGSSUF)$(EXESUF)=%.o): | doc/examples +OBJDIRS += doc/examples + +DOXY_INPUT += $(EXAMPLES:%$(PROGSSUF)$(EXESUF)=%.c) + +install: install-examples + +install-examples: $(EXAMPLES_FILES) + $(Q)mkdir -p "$(DATADIR)/examples" + $(INSTALL) -m 644 $(EXAMPLES_FILES) "$(DATADIR)/examples" + $(INSTALL) -m 644 $(EXAMPLE_MAKEFILE:%=%.example) "$(DATADIR)/examples/Makefile" + +uninstall: uninstall-examples + +uninstall-examples: + $(RM) -r "$(DATADIR)/examples" + +examplesclean: + $(RM) $(ALL_EXAMPLES) $(ALL_EXAMPLES_G) + $(RM) $(CLEANSUFFIXES:%=doc/examples/%) + +docclean:: examplesclean + +-include $(wildcard $(EXAMPLES:%$(PROGSSUF)$(EXESUF)=%.d)) + +.PHONY: examples diff --git a/mythtv/external/FFmpeg/doc/examples/Makefile.example b/mythtv/external/FFmpeg/doc/examples/Makefile.example new file mode 100644 index 00000000000..6428154c51d --- /dev/null +++ b/mythtv/external/FFmpeg/doc/examples/Makefile.example @@ -0,0 +1,50 @@ +# use pkg-config for getting CFLAGS and LDLIBS +FFMPEG_LIBS= libavdevice \ + libavformat \ + libavfilter \ + libavcodec \ + libswresample \ + libswscale \ + libavutil \ + +CFLAGS += -Wall -g +CFLAGS := $(shell pkg-config --cflags $(FFMPEG_LIBS)) $(CFLAGS) +LDLIBS := $(shell pkg-config --libs $(FFMPEG_LIBS)) $(LDLIBS) + +EXAMPLES= avio_dir_cmd \ + avio_reading \ + decode_audio \ + decode_video \ + demuxing_decoding \ + encode_audio \ + encode_video \ + extract_mvs \ + filtering_video \ + filtering_audio \ + http_multiclient \ + hw_decode \ + metadata \ + muxing \ + remuxing \ + resampling_audio \ + scaling_video \ + transcode_aac \ + transcoding \ + +OBJS=$(addsuffix .o,$(EXAMPLES)) + +# the following examples make explicit use of the math library +avcodec: LDLIBS += -lm +encode_audio: LDLIBS += -lm +muxing: LDLIBS += -lm +resampling_audio: LDLIBS += -lm + +.phony: all clean-test clean + +all: $(OBJS) $(EXAMPLES) + +clean-test: + $(RM) test*.pgm test.h264 test.mp2 test.sw test.mpg + +clean: clean-test + $(RM) $(EXAMPLES) $(OBJS) diff --git a/mythtv/external/FFmpeg/doc/examples/decode_audio.c b/mythtv/external/FFmpeg/doc/examples/decode_audio.c new file mode 100644 index 00000000000..fb9a9af2f60 --- /dev/null +++ b/mythtv/external/FFmpeg/doc/examples/decode_audio.c @@ -0,0 +1,187 @@ +/* + * Copyright (c) 2001 Fabrice Bellard + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * 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. + */ + +/** + * @file + * audio decoding with libavcodec API example + * + * @example decode_audio.c + */ + +#include +#include +#include + +#include +#include + +#include + +#define AUDIO_INBUF_SIZE 20480 +#define AUDIO_REFILL_THRESH 4096 + +static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, + FILE *outfile) +{ + int i, ch; + int ret, data_size; + + /* send the packet with the compressed data to the decoder */ + ret = avcodec_send_packet(dec_ctx, pkt); + if (ret < 0) { + fprintf(stderr, "Error submitting the packet to the decoder\n"); + exit(1); + } + + /* read all the output frames (in general there may be any number of them */ + while (ret >= 0) { + ret = avcodec_receive_frame(dec_ctx, frame); + if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) + return; + else if (ret < 0) { + fprintf(stderr, "Error during decoding\n"); + exit(1); + } + data_size = av_get_bytes_per_sample(dec_ctx->sample_fmt); + if (data_size < 0) { + /* This should not occur, checking just for paranoia */ + fprintf(stderr, "Failed to calculate data size\n"); + exit(1); + } + for (i = 0; i < frame->nb_samples; i++) + for (ch = 0; ch < dec_ctx->channels; ch++) + fwrite(frame->data[ch] + data_size*i, 1, data_size, outfile); + } +} + +int main(int argc, char **argv) +{ + const char *outfilename, *filename; + const AVCodec *codec; + AVCodecContext *c= NULL; + AVCodecParserContext *parser = NULL; + int len, ret; + FILE *f, *outfile; + uint8_t inbuf[AUDIO_INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE]; + uint8_t *data; + size_t data_size; + AVPacket *pkt; + AVFrame *decoded_frame = NULL; + + if (argc <= 2) { + fprintf(stderr, "Usage: %s \n", argv[0]); + exit(0); + } + filename = argv[1]; + outfilename = argv[2]; + + /* register all the codecs */ + avcodec_register_all(); + + pkt = av_packet_alloc(); + + /* find the MPEG audio decoder */ + codec = avcodec_find_decoder(AV_CODEC_ID_MP2); + if (!codec) { + fprintf(stderr, "Codec not found\n"); + exit(1); + } + + parser = av_parser_init(codec->id); + if (!parser) { + fprintf(stderr, "Parser not found\n"); + exit(1); + } + + c = avcodec_alloc_context3(codec); + if (!c) { + fprintf(stderr, "Could not allocate audio codec context\n"); + exit(1); + } + + /* open it */ + if (avcodec_open2(c, codec, NULL) < 0) { + fprintf(stderr, "Could not open codec\n"); + exit(1); + } + + f = fopen(filename, "rb"); + if (!f) { + fprintf(stderr, "Could not open %s\n", filename); + exit(1); + } + outfile = fopen(outfilename, "wb"); + if (!outfile) { + av_free(c); + exit(1); + } + + /* decode until eof */ + data = inbuf; + data_size = fread(inbuf, 1, AUDIO_INBUF_SIZE, f); + + while (data_size > 0) { + if (!decoded_frame) { + if (!(decoded_frame = av_frame_alloc())) { + fprintf(stderr, "Could not allocate audio frame\n"); + exit(1); + } + } + + ret = av_parser_parse2(parser, c, &pkt->data, &pkt->size, + data, data_size, + AV_NOPTS_VALUE, AV_NOPTS_VALUE, 0); + if (ret < 0) { + fprintf(stderr, "Error while parsing\n"); + exit(1); + } + data += ret; + data_size -= ret; + + if (pkt->size) + decode(c, pkt, decoded_frame, outfile); + + if (data_size < AUDIO_REFILL_THRESH) { + memmove(inbuf, data, data_size); + data = inbuf; + len = fread(data + data_size, 1, + AUDIO_INBUF_SIZE - data_size, f); + if (len > 0) + data_size += len; + } + } + + /* flush the decoder */ + pkt->data = NULL; + pkt->size = 0; + decode(c, pkt, decoded_frame, outfile); + + fclose(outfile); + fclose(f); + + avcodec_free_context(&c); + av_parser_close(parser); + av_frame_free(&decoded_frame); + av_packet_free(&pkt); + + return 0; +} diff --git a/mythtv/external/FFmpeg/doc/examples/decode_video.c b/mythtv/external/FFmpeg/doc/examples/decode_video.c new file mode 100644 index 00000000000..4377fd49e0d --- /dev/null +++ b/mythtv/external/FFmpeg/doc/examples/decode_video.c @@ -0,0 +1,188 @@ +/* + * Copyright (c) 2001 Fabrice Bellard + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * 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. + */ + +/** + * @file + * video decoding with libavcodec API example + * + * @example decode_video.c + */ + +#include +#include +#include + +#include + +#define INBUF_SIZE 4096 + +static void pgm_save(unsigned char *buf, int wrap, int xsize, int ysize, + char *filename) +{ + FILE *f; + int i; + + f = fopen(filename,"w"); + fprintf(f, "P5\n%d %d\n%d\n", xsize, ysize, 255); + for (i = 0; i < ysize; i++) + fwrite(buf + i * wrap, 1, xsize, f); + fclose(f); +} + +static void decode(AVCodecContext *dec_ctx, AVFrame *frame, AVPacket *pkt, + const char *filename) +{ + char buf[1024]; + int ret; + + ret = avcodec_send_packet(dec_ctx, pkt); + if (ret < 0) { + fprintf(stderr, "Error sending a packet for decoding\n"); + exit(1); + } + + while (ret >= 0) { + ret = avcodec_receive_frame(dec_ctx, frame); + if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) + return; + else if (ret < 0) { + fprintf(stderr, "Error during decoding\n"); + exit(1); + } + + printf("saving frame %3d\n", dec_ctx->frame_number); + fflush(stdout); + + /* the picture is allocated by the decoder. no need to + free it */ + snprintf(buf, sizeof(buf), "%s-%d", filename, dec_ctx->frame_number); + pgm_save(frame->data[0], frame->linesize[0], + frame->width, frame->height, buf); + } +} + +int main(int argc, char **argv) +{ + const char *filename, *outfilename; + const AVCodec *codec; + AVCodecParserContext *parser; + AVCodecContext *c= NULL; + FILE *f; + AVFrame *frame; + uint8_t inbuf[INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE]; + uint8_t *data; + size_t data_size; + int ret; + AVPacket *pkt; + + if (argc <= 2) { + fprintf(stderr, "Usage: %s \n", argv[0]); + exit(0); + } + filename = argv[1]; + outfilename = argv[2]; + + avcodec_register_all(); + + pkt = av_packet_alloc(); + if (!pkt) + exit(1); + + /* set end of buffer to 0 (this ensures that no overreading happens for damaged MPEG streams) */ + memset(inbuf + INBUF_SIZE, 0, AV_INPUT_BUFFER_PADDING_SIZE); + + /* find the MPEG-1 video decoder */ + codec = avcodec_find_decoder(AV_CODEC_ID_MPEG1VIDEO); + if (!codec) { + fprintf(stderr, "Codec not found\n"); + exit(1); + } + + parser = av_parser_init(codec->id); + if (!parser) { + fprintf(stderr, "parser not found\n"); + exit(1); + } + + c = avcodec_alloc_context3(codec); + if (!c) { + fprintf(stderr, "Could not allocate video codec context\n"); + exit(1); + } + + /* For some codecs, such as msmpeg4 and mpeg4, width and height + MUST be initialized there because this information is not + available in the bitstream. */ + + /* open it */ + if (avcodec_open2(c, codec, NULL) < 0) { + fprintf(stderr, "Could not open codec\n"); + exit(1); + } + + f = fopen(filename, "rb"); + if (!f) { + fprintf(stderr, "Could not open %s\n", filename); + exit(1); + } + + frame = av_frame_alloc(); + if (!frame) { + fprintf(stderr, "Could not allocate video frame\n"); + exit(1); + } + + while (!feof(f)) { + /* read raw data from the input file */ + data_size = fread(inbuf, 1, INBUF_SIZE, f); + if (!data_size) + break; + + /* use the parser to split the data into frames */ + data = inbuf; + while (data_size > 0) { + ret = av_parser_parse2(parser, c, &pkt->data, &pkt->size, + data, data_size, AV_NOPTS_VALUE, AV_NOPTS_VALUE, 0); + if (ret < 0) { + fprintf(stderr, "Error while parsing\n"); + exit(1); + } + data += ret; + data_size -= ret; + + if (pkt->size) + decode(c, frame, pkt, outfilename); + } + } + + /* flush the decoder */ + decode(c, frame, NULL, outfilename); + + fclose(f); + + av_parser_close(parser); + avcodec_free_context(&c); + av_frame_free(&frame); + av_packet_free(&pkt); + + return 0; +} diff --git a/mythtv/external/FFmpeg/doc/examples/decoding_encoding.c b/mythtv/external/FFmpeg/doc/examples/decoding_encoding.c deleted file mode 100644 index 43a64c2d595..00000000000 --- a/mythtv/external/FFmpeg/doc/examples/decoding_encoding.c +++ /dev/null @@ -1,665 +0,0 @@ -/* - * Copyright (c) 2001 Fabrice Bellard - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * 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. - */ - -/** - * @file - * libavcodec API use example. - * - * @example decoding_encoding.c - * Note that libavcodec only handles codecs (MPEG, MPEG-4, etc...), - * not file formats (AVI, VOB, MP4, MOV, MKV, MXF, FLV, MPEG-TS, MPEG-PS, etc...). - * See library 'libavformat' for the format handling - */ - -#include - -#include -#include -#include -#include -#include -#include -#include - -#define INBUF_SIZE 4096 -#define AUDIO_INBUF_SIZE 20480 -#define AUDIO_REFILL_THRESH 4096 - -/* check that a given sample format is supported by the encoder */ -static int check_sample_fmt(AVCodec *codec, enum AVSampleFormat sample_fmt) -{ - const enum AVSampleFormat *p = codec->sample_fmts; - - while (*p != AV_SAMPLE_FMT_NONE) { - if (*p == sample_fmt) - return 1; - p++; - } - return 0; -} - -/* just pick the highest supported samplerate */ -static int select_sample_rate(AVCodec *codec) -{ - const int *p; - int best_samplerate = 0; - - if (!codec->supported_samplerates) - return 44100; - - p = codec->supported_samplerates; - while (*p) { - best_samplerate = FFMAX(*p, best_samplerate); - p++; - } - return best_samplerate; -} - -/* select layout with the highest channel count */ -static int select_channel_layout(AVCodec *codec) -{ - const uint64_t *p; - uint64_t best_ch_layout = 0; - int best_nb_channels = 0; - - if (!codec->channel_layouts) - return AV_CH_LAYOUT_STEREO; - - p = codec->channel_layouts; - while (*p) { - int nb_channels = av_get_channel_layout_nb_channels(*p); - - if (nb_channels > best_nb_channels) { - best_ch_layout = *p; - best_nb_channels = nb_channels; - } - p++; - } - return best_ch_layout; -} - -/* - * Audio encoding example - */ -static void audio_encode_example(const char *filename) -{ - AVCodec *codec; - AVCodecContext *c= NULL; - AVFrame *frame; - AVPacket pkt; - int i, j, k, ret, got_output; - int buffer_size; - FILE *f; - uint16_t *samples; - float t, tincr; - - printf("Encode audio file %s\n", filename); - - /* find the MP2 encoder */ - codec = avcodec_find_encoder(AV_CODEC_ID_MP2); - if (!codec) { - fprintf(stderr, "Codec not found\n"); - exit(1); - } - - c = avcodec_alloc_context3(codec); - if (!c) { - fprintf(stderr, "Could not allocate audio codec context\n"); - exit(1); - } - - /* put sample parameters */ - c->bit_rate = 64000; - - /* check that the encoder supports s16 pcm input */ - c->sample_fmt = AV_SAMPLE_FMT_S16; - if (!check_sample_fmt(codec, c->sample_fmt)) { - fprintf(stderr, "Encoder does not support sample format %s", - av_get_sample_fmt_name(c->sample_fmt)); - exit(1); - } - - /* select other audio parameters supported by the encoder */ - c->sample_rate = select_sample_rate(codec); - c->channel_layout = select_channel_layout(codec); - c->channels = av_get_channel_layout_nb_channels(c->channel_layout); - - /* open it */ - if (avcodec_open2(c, codec, NULL) < 0) { - fprintf(stderr, "Could not open codec\n"); - exit(1); - } - - f = fopen(filename, "wb"); - if (!f) { - fprintf(stderr, "Could not open %s\n", filename); - exit(1); - } - - /* frame containing input raw audio */ - frame = av_frame_alloc(); - if (!frame) { - fprintf(stderr, "Could not allocate audio frame\n"); - exit(1); - } - - frame->nb_samples = c->frame_size; - frame->format = c->sample_fmt; - frame->channel_layout = c->channel_layout; - - /* the codec gives us the frame size, in samples, - * we calculate the size of the samples buffer in bytes */ - buffer_size = av_samples_get_buffer_size(NULL, c->channels, c->frame_size, - c->sample_fmt, 0); - if (buffer_size < 0) { - fprintf(stderr, "Could not get sample buffer size\n"); - exit(1); - } - samples = av_malloc(buffer_size); - if (!samples) { - fprintf(stderr, "Could not allocate %d bytes for samples buffer\n", - buffer_size); - exit(1); - } - /* setup the data pointers in the AVFrame */ - ret = avcodec_fill_audio_frame(frame, c->channels, c->sample_fmt, - (const uint8_t*)samples, buffer_size, 0); - if (ret < 0) { - fprintf(stderr, "Could not setup audio frame\n"); - exit(1); - } - - /* encode a single tone sound */ - t = 0; - tincr = 2 * M_PI * 440.0 / c->sample_rate; - for (i = 0; i < 200; i++) { - av_init_packet(&pkt); - pkt.data = NULL; // packet data will be allocated by the encoder - pkt.size = 0; - - for (j = 0; j < c->frame_size; j++) { - samples[2*j] = (int)(sin(t) * 10000); - - for (k = 1; k < c->channels; k++) - samples[2*j + k] = samples[2*j]; - t += tincr; - } - /* encode the samples */ - ret = avcodec_encode_audio2(c, &pkt, frame, &got_output); - if (ret < 0) { - fprintf(stderr, "Error encoding audio frame\n"); - exit(1); - } - if (got_output) { - fwrite(pkt.data, 1, pkt.size, f); - av_packet_unref(&pkt); - } - } - - /* get the delayed frames */ - for (got_output = 1; got_output; i++) { - ret = avcodec_encode_audio2(c, &pkt, NULL, &got_output); - if (ret < 0) { - fprintf(stderr, "Error encoding frame\n"); - exit(1); - } - - if (got_output) { - fwrite(pkt.data, 1, pkt.size, f); - av_packet_unref(&pkt); - } - } - fclose(f); - - av_freep(&samples); - av_frame_free(&frame); - avcodec_close(c); - av_free(c); -} - -/* - * Audio decoding. - */ -static void audio_decode_example(const char *outfilename, const char *filename) -{ - AVCodec *codec; - AVCodecContext *c= NULL; - int len; - FILE *f, *outfile; - uint8_t inbuf[AUDIO_INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE]; - AVPacket avpkt; - AVFrame *decoded_frame = NULL; - - av_init_packet(&avpkt); - - printf("Decode audio file %s to %s\n", filename, outfilename); - - /* find the MPEG audio decoder */ - codec = avcodec_find_decoder(AV_CODEC_ID_MP2); - if (!codec) { - fprintf(stderr, "Codec not found\n"); - exit(1); - } - - c = avcodec_alloc_context3(codec); - if (!c) { - fprintf(stderr, "Could not allocate audio codec context\n"); - exit(1); - } - - /* open it */ - if (avcodec_open2(c, codec, NULL) < 0) { - fprintf(stderr, "Could not open codec\n"); - exit(1); - } - - f = fopen(filename, "rb"); - if (!f) { - fprintf(stderr, "Could not open %s\n", filename); - exit(1); - } - outfile = fopen(outfilename, "wb"); - if (!outfile) { - av_free(c); - exit(1); - } - - /* decode until eof */ - avpkt.data = inbuf; - avpkt.size = fread(inbuf, 1, AUDIO_INBUF_SIZE, f); - - while (avpkt.size > 0) { - int i, ch; - int got_frame = 0; - - if (!decoded_frame) { - if (!(decoded_frame = av_frame_alloc())) { - fprintf(stderr, "Could not allocate audio frame\n"); - exit(1); - } - } - - len = avcodec_decode_audio4(c, decoded_frame, &got_frame, &avpkt); - if (len < 0) { - fprintf(stderr, "Error while decoding\n"); - exit(1); - } - if (got_frame) { - /* if a frame has been decoded, output it */ - int data_size = av_get_bytes_per_sample(c->sample_fmt); - if (data_size < 0) { - /* This should not occur, checking just for paranoia */ - fprintf(stderr, "Failed to calculate data size\n"); - exit(1); - } - for (i=0; inb_samples; i++) - for (ch=0; chchannels; ch++) - fwrite(decoded_frame->data[ch] + data_size*i, 1, data_size, outfile); - } - avpkt.size -= len; - avpkt.data += len; - avpkt.dts = - avpkt.pts = AV_NOPTS_VALUE; - if (avpkt.size < AUDIO_REFILL_THRESH) { - /* Refill the input buffer, to avoid trying to decode - * incomplete frames. Instead of this, one could also use - * a parser, or use a proper container format through - * libavformat. */ - memmove(inbuf, avpkt.data, avpkt.size); - avpkt.data = inbuf; - len = fread(avpkt.data + avpkt.size, 1, - AUDIO_INBUF_SIZE - avpkt.size, f); - if (len > 0) - avpkt.size += len; - } - } - - fclose(outfile); - fclose(f); - - avcodec_close(c); - av_free(c); - av_frame_free(&decoded_frame); -} - -/* - * Video encoding example - */ -static void video_encode_example(const char *filename, int codec_id) -{ - AVCodec *codec; - AVCodecContext *c= NULL; - int i, ret, x, y, got_output; - FILE *f; - AVFrame *frame; - AVPacket pkt; - uint8_t endcode[] = { 0, 0, 1, 0xb7 }; - - printf("Encode video file %s\n", filename); - - /* find the video encoder */ - codec = avcodec_find_encoder(codec_id); - if (!codec) { - fprintf(stderr, "Codec not found\n"); - exit(1); - } - - c = avcodec_alloc_context3(codec); - if (!c) { - fprintf(stderr, "Could not allocate video codec context\n"); - exit(1); - } - - /* put sample parameters */ - c->bit_rate = 400000; - /* resolution must be a multiple of two */ - c->width = 352; - c->height = 288; - /* frames per second */ - c->time_base = (AVRational){1,25}; - /* emit one intra frame every ten frames - * check frame pict_type before passing frame - * to encoder, if frame->pict_type is AV_PICTURE_TYPE_I - * then gop_size is ignored and the output of encoder - * will always be I frame irrespective to gop_size - */ - c->gop_size = 10; - c->max_b_frames = 1; - c->pix_fmt = AV_PIX_FMT_YUV420P; - - if (codec_id == AV_CODEC_ID_H264) - av_opt_set(c->priv_data, "preset", "slow", 0); - - /* open it */ - if (avcodec_open2(c, codec, NULL) < 0) { - fprintf(stderr, "Could not open codec\n"); - exit(1); - } - - f = fopen(filename, "wb"); - if (!f) { - fprintf(stderr, "Could not open %s\n", filename); - exit(1); - } - - frame = av_frame_alloc(); - if (!frame) { - fprintf(stderr, "Could not allocate video frame\n"); - exit(1); - } - frame->format = c->pix_fmt; - frame->width = c->width; - frame->height = c->height; - - /* the image can be allocated by any means and av_image_alloc() is - * just the most convenient way if av_malloc() is to be used */ - ret = av_image_alloc(frame->data, frame->linesize, c->width, c->height, - c->pix_fmt, 32); - if (ret < 0) { - fprintf(stderr, "Could not allocate raw picture buffer\n"); - exit(1); - } - - /* encode 1 second of video */ - for (i = 0; i < 25; i++) { - av_init_packet(&pkt); - pkt.data = NULL; // packet data will be allocated by the encoder - pkt.size = 0; - - fflush(stdout); - /* prepare a dummy image */ - /* Y */ - for (y = 0; y < c->height; y++) { - for (x = 0; x < c->width; x++) { - frame->data[0][y * frame->linesize[0] + x] = x + y + i * 3; - } - } - - /* Cb and Cr */ - for (y = 0; y < c->height/2; y++) { - for (x = 0; x < c->width/2; x++) { - frame->data[1][y * frame->linesize[1] + x] = 128 + y + i * 2; - frame->data[2][y * frame->linesize[2] + x] = 64 + x + i * 5; - } - } - - frame->pts = i; - - /* encode the image */ - ret = avcodec_encode_video2(c, &pkt, frame, &got_output); - if (ret < 0) { - fprintf(stderr, "Error encoding frame\n"); - exit(1); - } - - if (got_output) { - printf("Write frame %3d (size=%5d)\n", i, pkt.size); - fwrite(pkt.data, 1, pkt.size, f); - av_packet_unref(&pkt); - } - } - - /* get the delayed frames */ - for (got_output = 1; got_output; i++) { - fflush(stdout); - - ret = avcodec_encode_video2(c, &pkt, NULL, &got_output); - if (ret < 0) { - fprintf(stderr, "Error encoding frame\n"); - exit(1); - } - - if (got_output) { - printf("Write frame %3d (size=%5d)\n", i, pkt.size); - fwrite(pkt.data, 1, pkt.size, f); - av_packet_unref(&pkt); - } - } - - /* add sequence end code to have a real MPEG file */ - fwrite(endcode, 1, sizeof(endcode), f); - fclose(f); - - avcodec_close(c); - av_free(c); - av_freep(&frame->data[0]); - av_frame_free(&frame); - printf("\n"); -} - -/* - * Video decoding example - */ - -static void pgm_save(unsigned char *buf, int wrap, int xsize, int ysize, - char *filename) -{ - FILE *f; - int i; - - f = fopen(filename,"w"); - fprintf(f, "P5\n%d %d\n%d\n", xsize, ysize, 255); - for (i = 0; i < ysize; i++) - fwrite(buf + i * wrap, 1, xsize, f); - fclose(f); -} - -static int decode_write_frame(const char *outfilename, AVCodecContext *avctx, - AVFrame *frame, int *frame_count, AVPacket *pkt, int last) -{ - int len, got_frame; - char buf[1024]; - - len = avcodec_decode_video2(avctx, frame, &got_frame, pkt); - if (len < 0) { - fprintf(stderr, "Error while decoding frame %d\n", *frame_count); - return len; - } - if (got_frame) { - printf("Saving %sframe %3d\n", last ? "last " : "", *frame_count); - fflush(stdout); - - /* the picture is allocated by the decoder, no need to free it */ - snprintf(buf, sizeof(buf), outfilename, *frame_count); - pgm_save(frame->data[0], frame->linesize[0], - frame->width, frame->height, buf); - (*frame_count)++; - } - if (pkt->data) { - pkt->size -= len; - pkt->data += len; - } - return 0; -} - -static void video_decode_example(const char *outfilename, const char *filename) -{ - AVCodec *codec; - AVCodecContext *c= NULL; - int frame_count; - FILE *f; - AVFrame *frame; - uint8_t inbuf[INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE]; - AVPacket avpkt; - - av_init_packet(&avpkt); - - /* set end of buffer to 0 (this ensures that no overreading happens for damaged MPEG streams) */ - memset(inbuf + INBUF_SIZE, 0, AV_INPUT_BUFFER_PADDING_SIZE); - - printf("Decode video file %s to %s\n", filename, outfilename); - - /* find the MPEG-1 video decoder */ - codec = avcodec_find_decoder(AV_CODEC_ID_MPEG1VIDEO); - if (!codec) { - fprintf(stderr, "Codec not found\n"); - exit(1); - } - - c = avcodec_alloc_context3(codec); - if (!c) { - fprintf(stderr, "Could not allocate video codec context\n"); - exit(1); - } - - if (codec->capabilities & AV_CODEC_CAP_TRUNCATED) - c->flags |= AV_CODEC_FLAG_TRUNCATED; // we do not send complete frames - - /* For some codecs, such as msmpeg4 and mpeg4, width and height - MUST be initialized there because this information is not - available in the bitstream. */ - - /* open it */ - if (avcodec_open2(c, codec, NULL) < 0) { - fprintf(stderr, "Could not open codec\n"); - exit(1); - } - - f = fopen(filename, "rb"); - if (!f) { - fprintf(stderr, "Could not open %s\n", filename); - exit(1); - } - - frame = av_frame_alloc(); - if (!frame) { - fprintf(stderr, "Could not allocate video frame\n"); - exit(1); - } - - frame_count = 0; - for (;;) { - avpkt.size = fread(inbuf, 1, INBUF_SIZE, f); - if (avpkt.size == 0) - break; - - /* NOTE1: some codecs are stream based (mpegvideo, mpegaudio) - and this is the only method to use them because you cannot - know the compressed data size before analysing it. - - BUT some other codecs (msmpeg4, mpeg4) are inherently frame - based, so you must call them with all the data for one - frame exactly. You must also initialize 'width' and - 'height' before initializing them. */ - - /* NOTE2: some codecs allow the raw parameters (frame size, - sample rate) to be changed at any frame. We handle this, so - you should also take care of it */ - - /* here, we use a stream based decoder (mpeg1video), so we - feed decoder and see if it could decode a frame */ - avpkt.data = inbuf; - while (avpkt.size > 0) - if (decode_write_frame(outfilename, c, frame, &frame_count, &avpkt, 0) < 0) - exit(1); - } - - /* Some codecs, such as MPEG, transmit the I- and P-frame with a - latency of one frame. You must do the following to have a - chance to get the last frame of the video. */ - avpkt.data = NULL; - avpkt.size = 0; - decode_write_frame(outfilename, c, frame, &frame_count, &avpkt, 1); - - fclose(f); - - avcodec_close(c); - av_free(c); - av_frame_free(&frame); - printf("\n"); -} - -int main(int argc, char **argv) -{ - const char *output_type; - - /* register all the codecs */ - avcodec_register_all(); - - if (argc < 2) { - printf("usage: %s output_type\n" - "API example program to decode/encode a media stream with libavcodec.\n" - "This program generates a synthetic stream and encodes it to a file\n" - "named test.h264, test.mp2 or test.mpg depending on output_type.\n" - "The encoded stream is then decoded and written to a raw data output.\n" - "output_type must be chosen between 'h264', 'mp2', 'mpg'.\n", - argv[0]); - return 1; - } - output_type = argv[1]; - - if (!strcmp(output_type, "h264")) { - video_encode_example("test.h264", AV_CODEC_ID_H264); - } else if (!strcmp(output_type, "mp2")) { - audio_encode_example("test.mp2"); - audio_decode_example("test.pcm", "test.mp2"); - } else if (!strcmp(output_type, "mpg")) { - video_encode_example("test.mpg", AV_CODEC_ID_MPEG1VIDEO); - video_decode_example("test%02d.pgm", "test.mpg"); - } else { - fprintf(stderr, "Invalid output type '%s', choose between 'h264', 'mp2', or 'mpg'\n", - output_type); - return 1; - } - - return 0; -} diff --git a/mythtv/external/FFmpeg/doc/examples/encode_audio.c b/mythtv/external/FFmpeg/doc/examples/encode_audio.c new file mode 100644 index 00000000000..d1ef105d9da --- /dev/null +++ b/mythtv/external/FFmpeg/doc/examples/encode_audio.c @@ -0,0 +1,241 @@ +/* + * Copyright (c) 2001 Fabrice Bellard + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * 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. + */ + +/** + * @file + * audio encoding with libavcodec API example. + * + * @example encode_audio.c + */ + +#include +#include +#include + +#include + +#include +#include +#include +#include + +/* check that a given sample format is supported by the encoder */ +static int check_sample_fmt(const AVCodec *codec, enum AVSampleFormat sample_fmt) +{ + const enum AVSampleFormat *p = codec->sample_fmts; + + while (*p != AV_SAMPLE_FMT_NONE) { + if (*p == sample_fmt) + return 1; + p++; + } + return 0; +} + +/* just pick the highest supported samplerate */ +static int select_sample_rate(const AVCodec *codec) +{ + const int *p; + int best_samplerate = 0; + + if (!codec->supported_samplerates) + return 44100; + + p = codec->supported_samplerates; + while (*p) { + if (!best_samplerate || abs(44100 - *p) < abs(44100 - best_samplerate)) + best_samplerate = *p; + p++; + } + return best_samplerate; +} + +/* select layout with the highest channel count */ +static int select_channel_layout(const AVCodec *codec) +{ + const uint64_t *p; + uint64_t best_ch_layout = 0; + int best_nb_channels = 0; + + if (!codec->channel_layouts) + return AV_CH_LAYOUT_STEREO; + + p = codec->channel_layouts; + while (*p) { + int nb_channels = av_get_channel_layout_nb_channels(*p); + + if (nb_channels > best_nb_channels) { + best_ch_layout = *p; + best_nb_channels = nb_channels; + } + p++; + } + return best_ch_layout; +} + +static void encode(AVCodecContext *ctx, AVFrame *frame, AVPacket *pkt, + FILE *output) +{ + int ret; + + /* send the frame for encoding */ + ret = avcodec_send_frame(ctx, frame); + if (ret < 0) { + fprintf(stderr, "Error sending the frame to the encoder\n"); + exit(1); + } + + /* read all the available output packets (in general there may be any + * number of them */ + while (ret >= 0) { + ret = avcodec_receive_packet(ctx, pkt); + if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) + return; + else if (ret < 0) { + fprintf(stderr, "Error encoding audio frame\n"); + exit(1); + } + + fwrite(pkt->data, 1, pkt->size, output); + av_packet_unref(pkt); + } +} + +int main(int argc, char **argv) +{ + const char *filename; + const AVCodec *codec; + AVCodecContext *c= NULL; + AVFrame *frame; + AVPacket *pkt; + int i, j, k, ret; + FILE *f; + uint16_t *samples; + float t, tincr; + + if (argc <= 1) { + fprintf(stderr, "Usage: %s \n", argv[0]); + return 0; + } + filename = argv[1]; + + /* register all the codecs */ + avcodec_register_all(); + + /* find the MP2 encoder */ + codec = avcodec_find_encoder(AV_CODEC_ID_MP2); + if (!codec) { + fprintf(stderr, "Codec not found\n"); + exit(1); + } + + c = avcodec_alloc_context3(codec); + if (!c) { + fprintf(stderr, "Could not allocate audio codec context\n"); + exit(1); + } + + /* put sample parameters */ + c->bit_rate = 64000; + + /* check that the encoder supports s16 pcm input */ + c->sample_fmt = AV_SAMPLE_FMT_S16; + if (!check_sample_fmt(codec, c->sample_fmt)) { + fprintf(stderr, "Encoder does not support sample format %s", + av_get_sample_fmt_name(c->sample_fmt)); + exit(1); + } + + /* select other audio parameters supported by the encoder */ + c->sample_rate = select_sample_rate(codec); + c->channel_layout = select_channel_layout(codec); + c->channels = av_get_channel_layout_nb_channels(c->channel_layout); + + /* open it */ + if (avcodec_open2(c, codec, NULL) < 0) { + fprintf(stderr, "Could not open codec\n"); + exit(1); + } + + f = fopen(filename, "wb"); + if (!f) { + fprintf(stderr, "Could not open %s\n", filename); + exit(1); + } + + /* packet for holding encoded output */ + pkt = av_packet_alloc(); + if (!pkt) { + fprintf(stderr, "could not allocate the packet\n"); + exit(1); + } + + /* frame containing input raw audio */ + frame = av_frame_alloc(); + if (!frame) { + fprintf(stderr, "Could not allocate audio frame\n"); + exit(1); + } + + frame->nb_samples = c->frame_size; + frame->format = c->sample_fmt; + frame->channel_layout = c->channel_layout; + + /* allocate the data buffers */ + ret = av_frame_get_buffer(frame, 0); + if (ret < 0) { + fprintf(stderr, "Could not allocate audio data buffers\n"); + exit(1); + } + + /* encode a single tone sound */ + t = 0; + tincr = 2 * M_PI * 440.0 / c->sample_rate; + for (i = 0; i < 200; i++) { + /* make sure the frame is writable -- makes a copy if the encoder + * kept a reference internally */ + ret = av_frame_make_writable(frame); + if (ret < 0) + exit(1); + samples = (uint16_t*)frame->data[0]; + + for (j = 0; j < c->frame_size; j++) { + samples[2*j] = (int)(sin(t) * 10000); + + for (k = 1; k < c->channels; k++) + samples[2*j + k] = samples[2*j]; + t += tincr; + } + encode(c, frame, pkt, f); + } + + /* flush the encoder */ + encode(c, NULL, pkt, f); + + fclose(f); + + av_frame_free(&frame); + av_packet_free(&pkt); + avcodec_free_context(&c); + + return 0; +} diff --git a/mythtv/external/FFmpeg/doc/examples/encode_video.c b/mythtv/external/FFmpeg/doc/examples/encode_video.c new file mode 100644 index 00000000000..8cd13219bb5 --- /dev/null +++ b/mythtv/external/FFmpeg/doc/examples/encode_video.c @@ -0,0 +1,199 @@ +/* + * Copyright (c) 2001 Fabrice Bellard + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * 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. + */ + +/** + * @file + * video encoding with libavcodec API example + * + * @example encode_video.c + */ + +#include +#include +#include + +#include + +#include +#include + +static void encode(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt, + FILE *outfile) +{ + int ret; + + /* send the frame to the encoder */ + if (frame) + printf("Send frame %3"PRId64"\n", frame->pts); + + ret = avcodec_send_frame(enc_ctx, frame); + if (ret < 0) { + fprintf(stderr, "Error sending a frame for encoding\n"); + exit(1); + } + + while (ret >= 0) { + ret = avcodec_receive_packet(enc_ctx, pkt); + if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) + return; + else if (ret < 0) { + fprintf(stderr, "Error during encoding\n"); + exit(1); + } + + printf("Write packet %3"PRId64" (size=%5d)\n", pkt->pts, pkt->size); + fwrite(pkt->data, 1, pkt->size, outfile); + av_packet_unref(pkt); + } +} + +int main(int argc, char **argv) +{ + const char *filename, *codec_name; + const AVCodec *codec; + AVCodecContext *c= NULL; + int i, ret, x, y; + FILE *f; + AVFrame *frame; + AVPacket *pkt; + uint8_t endcode[] = { 0, 0, 1, 0xb7 }; + + if (argc <= 2) { + fprintf(stderr, "Usage: %s \n", argv[0]); + exit(0); + } + filename = argv[1]; + codec_name = argv[2]; + + avcodec_register_all(); + + /* find the mpeg1video encoder */ + codec = avcodec_find_encoder_by_name(codec_name); + if (!codec) { + fprintf(stderr, "Codec '%s' not found\n", codec_name); + exit(1); + } + + c = avcodec_alloc_context3(codec); + if (!c) { + fprintf(stderr, "Could not allocate video codec context\n"); + exit(1); + } + + pkt = av_packet_alloc(); + if (!pkt) + exit(1); + + /* put sample parameters */ + c->bit_rate = 400000; + /* resolution must be a multiple of two */ + c->width = 352; + c->height = 288; + /* frames per second */ + c->time_base = (AVRational){1, 25}; + c->framerate = (AVRational){25, 1}; + + /* emit one intra frame every ten frames + * check frame pict_type before passing frame + * to encoder, if frame->pict_type is AV_PICTURE_TYPE_I + * then gop_size is ignored and the output of encoder + * will always be I frame irrespective to gop_size + */ + c->gop_size = 10; + c->max_b_frames = 1; + c->pix_fmt = AV_PIX_FMT_YUV420P; + + if (codec->id == AV_CODEC_ID_H264) + av_opt_set(c->priv_data, "preset", "slow", 0); + + /* open it */ + ret = avcodec_open2(c, codec, NULL); + if (ret < 0) { + fprintf(stderr, "Could not open codec: %s\n", av_err2str(ret)); + exit(1); + } + + f = fopen(filename, "wb"); + if (!f) { + fprintf(stderr, "Could not open %s\n", filename); + exit(1); + } + + frame = av_frame_alloc(); + if (!frame) { + fprintf(stderr, "Could not allocate video frame\n"); + exit(1); + } + frame->format = c->pix_fmt; + frame->width = c->width; + frame->height = c->height; + + ret = av_frame_get_buffer(frame, 32); + if (ret < 0) { + fprintf(stderr, "Could not allocate the video frame data\n"); + exit(1); + } + + /* encode 1 second of video */ + for (i = 0; i < 25; i++) { + fflush(stdout); + + /* make sure the frame data is writable */ + ret = av_frame_make_writable(frame); + if (ret < 0) + exit(1); + + /* prepare a dummy image */ + /* Y */ + for (y = 0; y < c->height; y++) { + for (x = 0; x < c->width; x++) { + frame->data[0][y * frame->linesize[0] + x] = x + y + i * 3; + } + } + + /* Cb and Cr */ + for (y = 0; y < c->height/2; y++) { + for (x = 0; x < c->width/2; x++) { + frame->data[1][y * frame->linesize[1] + x] = 128 + y + i * 2; + frame->data[2][y * frame->linesize[2] + x] = 64 + x + i * 5; + } + } + + frame->pts = i; + + /* encode the image */ + encode(c, frame, pkt, f); + } + + /* flush the encoder */ + encode(c, NULL, pkt, f); + + /* add sequence end code to have a real MPEG file */ + fwrite(endcode, 1, sizeof(endcode), f); + fclose(f); + + avcodec_free_context(&c); + av_frame_free(&frame); + av_packet_free(&pkt); + + return 0; +} diff --git a/mythtv/external/FFmpeg/doc/examples/extract_mvs.c b/mythtv/external/FFmpeg/doc/examples/extract_mvs.c index 975189c77d3..7ae934ead3d 100644 --- a/mythtv/external/FFmpeg/doc/examples/extract_mvs.c +++ b/mythtv/external/FFmpeg/doc/examples/extract_mvs.c @@ -31,23 +31,26 @@ static const char *src_filename = NULL; static int video_stream_idx = -1; static AVFrame *frame = NULL; -static AVPacket pkt; static int video_frame_count = 0; -static int decode_packet(int *got_frame, int cached) +static int decode_packet(const AVPacket *pkt) { - int decoded = pkt.size; - - *got_frame = 0; + int ret = avcodec_send_packet(video_dec_ctx, pkt); + if (ret < 0) { + fprintf(stderr, "Error while sending a packet to the decoder: %s\n", av_err2str(ret)); + return ret; + } - if (pkt.stream_index == video_stream_idx) { - int ret = avcodec_decode_video2(video_dec_ctx, frame, got_frame, &pkt); - if (ret < 0) { - fprintf(stderr, "Error decoding video frame (%s)\n", av_err2str(ret)); + while (ret >= 0) { + ret = avcodec_receive_frame(video_dec_ctx, frame); + if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) { + break; + } else if (ret < 0) { + fprintf(stderr, "Error while receiving a frame from the decoder: %s\n", av_err2str(ret)); return ret; } - if (*got_frame) { + if (ret >= 0) { int i; AVFrameSideData *sd; @@ -58,19 +61,19 @@ static int decode_packet(int *got_frame, int cached) for (i = 0; i < sd->size / sizeof(*mvs); i++) { const AVMotionVector *mv = &mvs[i]; printf("%d,%2d,%2d,%2d,%4d,%4d,%4d,%4d,0x%"PRIx64"\n", - video_frame_count, mv->source, - mv->w, mv->h, mv->src_x, mv->src_y, - mv->dst_x, mv->dst_y, mv->flags); + video_frame_count, mv->source, + mv->w, mv->h, mv->src_x, mv->src_y, + mv->dst_x, mv->dst_y, mv->flags); } } + av_frame_unref(frame); } } - return decoded; + return 0; } -static int open_codec_context(int *stream_idx, - AVFormatContext *fmt_ctx, enum AVMediaType type) +static int open_codec_context(AVFormatContext *fmt_ctx, enum AVMediaType type) { int ret; AVStream *st; @@ -78,24 +81,27 @@ static int open_codec_context(int *stream_idx, AVCodec *dec = NULL; AVDictionary *opts = NULL; - ret = av_find_best_stream(fmt_ctx, type, -1, -1, NULL, 0); + ret = av_find_best_stream(fmt_ctx, type, -1, -1, &dec, 0); if (ret < 0) { fprintf(stderr, "Could not find %s stream in input file '%s'\n", av_get_media_type_string(type), src_filename); return ret; } else { - *stream_idx = ret; - st = fmt_ctx->streams[*stream_idx]; - - /* find decoder for the stream */ - dec_ctx = st->codec; - dec = avcodec_find_decoder(dec_ctx->codec_id); - if (!dec) { - fprintf(stderr, "Failed to find %s codec\n", - av_get_media_type_string(type)); + int stream_idx = ret; + st = fmt_ctx->streams[stream_idx]; + + dec_ctx = avcodec_alloc_context3(dec); + if (!dec_ctx) { + fprintf(stderr, "Failed to allocate codec\n"); return AVERROR(EINVAL); } + ret = avcodec_parameters_to_context(dec_ctx, st->codecpar); + if (ret < 0) { + fprintf(stderr, "Failed to copy codec parameters to codec context\n"); + return ret; + } + /* Init the video decoder */ av_dict_set(&opts, "flags2", "+export_mvs", 0); if ((ret = avcodec_open2(dec_ctx, dec, &opts)) < 0) { @@ -103,6 +109,10 @@ static int open_codec_context(int *stream_idx, av_get_media_type_string(type)); return ret; } + + video_stream_idx = stream_idx; + video_stream = fmt_ctx->streams[video_stream_idx]; + video_dec_ctx = dec_ctx; } return 0; @@ -110,7 +120,8 @@ static int open_codec_context(int *stream_idx, int main(int argc, char **argv) { - int ret = 0, got_frame; + int ret = 0; + AVPacket pkt = { 0 }; if (argc != 2) { fprintf(stderr, "Usage: %s