From 07eabcc4e6a2d42d0b40815021337d8a020467ba Mon Sep 17 00:00:00 2001 From: ziggi Date: Mon, 7 Dec 2020 23:27:24 +0000 Subject: [PATCH] add libopenh264; update libx264 ffmpeg --- media/ffmpeg/Makefile | 64 +- media/ffmpeg/distinfo | 6 +- media/ffmpeg/files/patch-configure | 17 + .../ffmpeg/files/patch-libavcodec_allcodecs.c | 20 - .../patch-libswscale_ppc_swscale__altivec.c | 55 -- .../patch-libswscale_ppc_yuv2rgb__altivec.c | 145 ++++ media/ffmpeg/files/patch-rav1e | 723 ------------------ media/ffmpeg/files/patch-vdpau_vp9 | 330 -------- media/ffmpeg/pkg-plist | 10 + media/libaom/Makefile | 34 + media/libaom/distinfo | 3 + .../files/patch-aom__ports_arm__cpudetect.c | 73 ++ .../files/patch-aom__ports_ppc__cpudetect.c | 76 ++ .../patch-build_cmake_aom__configure.cmake | 32 + .../libaom/files/patch-build_cmake_cpu.cmake | 13 + media/libaom/files/patch-x-CMakeLists.txt | 20 + media/libaom/pkg-descr | 7 + media/libaom/pkg-plist | 16 + media/libopenh264/Makefile | 34 + media/libopenh264/distinfo | 3 + media/libopenh264/files/_patch-Makefile | 13 + media/libopenh264/files/gmpopenh264.js.in | 3 + .../files/patch-codec_common_src_cpu.cpp | 23 + media/libopenh264/files/patch-x-Makefile | 54 ++ .../files/patch-x-build-platform-bsd.mk | 10 + media/libopenh264/pkg-descr | 4 + media/libopenh264/pkg-plist | 9 + media/libx264/Makefile | 47 +- media/libx264/distinfo | 5 +- media/libx264/files/patch-Makefile | 13 + media/libx264/files/patch-configure | 38 +- media/libx264/files/patch-x-x264.h | 2 +- 32 files changed, 719 insertions(+), 1183 deletions(-) create mode 100644 media/ffmpeg/files/patch-configure delete mode 100644 media/ffmpeg/files/patch-libavcodec_allcodecs.c delete mode 100644 media/ffmpeg/files/patch-libswscale_ppc_swscale__altivec.c create mode 100644 media/ffmpeg/files/patch-libswscale_ppc_yuv2rgb__altivec.c delete mode 100644 media/ffmpeg/files/patch-rav1e delete mode 100644 media/ffmpeg/files/patch-vdpau_vp9 create mode 100644 media/libaom/Makefile create mode 100644 media/libaom/distinfo create mode 100644 media/libaom/files/patch-aom__ports_arm__cpudetect.c create mode 100644 media/libaom/files/patch-aom__ports_ppc__cpudetect.c create mode 100644 media/libaom/files/patch-build_cmake_aom__configure.cmake create mode 100644 media/libaom/files/patch-build_cmake_cpu.cmake create mode 100644 media/libaom/files/patch-x-CMakeLists.txt create mode 100644 media/libaom/pkg-descr create mode 100644 media/libaom/pkg-plist create mode 100644 media/libopenh264/Makefile create mode 100644 media/libopenh264/distinfo create mode 100644 media/libopenh264/files/_patch-Makefile create mode 100644 media/libopenh264/files/gmpopenh264.js.in create mode 100644 media/libopenh264/files/patch-codec_common_src_cpu.cpp create mode 100644 media/libopenh264/files/patch-x-Makefile create mode 100644 media/libopenh264/files/patch-x-build-platform-bsd.mk create mode 100644 media/libopenh264/pkg-descr create mode 100644 media/libopenh264/pkg-plist create mode 100644 media/libx264/files/patch-Makefile diff --git a/media/ffmpeg/Makefile b/media/ffmpeg/Makefile index 0a265d6d..dfb04420 100644 --- a/media/ffmpeg/Makefile +++ b/media/ffmpeg/Makefile @@ -2,7 +2,7 @@ # $Id$ # PORTNAME= ffmpeg -PORTVERSION= 4.2.1 +PORTVERSION= 4.3.1 CATEGORIES= multimedia audio net MASTER_SITES= http://ffmpeg.org/releases/ @@ -11,6 +11,61 @@ COMMENT= Realtime audio/video encoder/converter and streaming server BUILD_DEPENDS= yasm:devel/yasm +LIB_DEPENDS+= libX11.so:x11/libX11 +LIB_DEPENDS+= libXau.so:x11/libXau +LIB_DEPENDS+= libXdmcp.so:x11/libXdmcp +LIB_DEPENDS+= libXext.so:x11/libXext +LIB_DEPENDS+= libXfixes.so:x11/libXfixes +LIB_DEPENDS+= libXv.so:x11/libXv + +#LIB_DEPENDS+= libaom.so:media/libaom + +LIB_DEPENDS+= libdrm.so:system/libdrm + +LIB_DEPENDS+= libfreetype.so:graph/libfreetype2 +LIB_DEPENDS+= libgmp.so:math/libgmp +LIB_DEPENDS+= libgnutls.so:crypto/libgnutls +LIB_DEPENDS+= libgsm.so:media/libgsm +LIB_DEPENDS+= libhogweed.so:crypto/libnettle +LIB_DEPENDS+= libiconv.so:text/libiconv +LIB_DEPENDS+= libidn2.so:net/libidn2 + +LIB_DEPENDS+= libintl.so:devel/gettext +LIB_DEPENDS+= libmodplug.so:media/libmodplug +LIB_DEPENDS+= libmp3lame.so:media/lame + +LIB_DEPENDS+= libnettle.so:crypto/libnettle + +LIB_DEPENDS+= libogg.so:media/libogg +LIB_DEPENDS+= libopencore-amrnb.so:media/libopencore-amr +LIB_DEPENDS+= libopencore-amrwb.so:media/libopencore-amr +LIB_DEPENDS+= libopus.so:media/libopus +LIB_DEPENDS+= libp11-kit.so:crypto/libp11-kit +LIB_DEPENDS+= libpng16.so:graph/libpng +LIB_DEPENDS+= libpostproc.so:media/ffmpeg +LIB_DEPENDS+= libspeex.so:media/libspeex +LIB_DEPENDS+= libswresample.so:media/ffmpeg +LIB_DEPENDS+= libswscale.so:media/ffmpeg +LIB_DEPENDS+= libtasn1.so:crypto/libtasn1 +LIB_DEPENDS+= libtheoradec.so:media/libtheora +LIB_DEPENDS+= libtheoraenc.so:media/libtheora +LIB_DEPENDS+= libva-drm.so:media/libva +LIB_DEPENDS+= libva-x11.so:media/libva +LIB_DEPENDS+= libva.so:media/libva +LIB_DEPENDS+= libvorbisenc.so:media/libvorbis +LIB_DEPENDS+= libvorbis.so:media/libvorbis +LIB_DEPENDS+= libwavpack.so:media/libwavpack +LIB_DEPENDS+= libx264.so:media/libx264 +LIB_DEPENDS+= libx265.so:media/libx265 + +LIB_DEPENDS+= libxcb-shape.so:x11/libxcb +LIB_DEPENDS+= libxcb-shm.so:x11/libxcb +LIB_DEPENDS+= libxcb-xfixes.so:x11/libxcb +LIB_DEPENDS+= libxcb.so:x11/libxcb + +LIB_DEPENDS+= libxvidcore.so:media/libxvid + + LIB_DEPENDS+= libgnutls.so:crypto/libgnutls LIB_DEPENDS+= libintl.so:devel/gettext @@ -43,6 +98,8 @@ LIB_DEPENDS+= libopus.so:media/libopus LIB_DEPENDS+= libX11.so:x11/libX11 LIB_DEPENDS+= libXv.so:x11/libXv +LIB_DEPENDS+= libopenh264.so:media/libopenh264 + BUILD_DEPENDS+= ${PREFIX}/lib/pkgconfig/xau.pc:x11/libXau BUILD_DEPENDS+= ${PREFIX}/lib/pkgconfig/xdmcp.pc:x11/libXdmcp BUILD_DEPENDS+= ${PREFIX}/lib/pkgconfig/xproto.pc:xproto/xproto @@ -102,6 +159,10 @@ CONFIGURE_ARGS+= --enable-libx265 CONFIGURE_ARGS+= --enable-libxvid CONFIGURE_ARGS+= --enable-zlib +CONFIGURE_ARGS+= --enable-libopenh264 +CONFIGURE_ARGS+= --disable-libaom + + CONFIGURE_ARGS+= --enable-version3 CONFIGURE_ARGS+= --enable-gpl @@ -112,6 +173,7 @@ CONFIGURE_ARGS+= --enable-shared CONFIGURE_ARGS+= --enable-pic CONFIGURE_ARGS+= --disable-optimizations + .include .if ${ARCH} == "amd64" diff --git a/media/ffmpeg/distinfo b/media/ffmpeg/distinfo index 8acd2fc0..4a30ba06 100644 --- a/media/ffmpeg/distinfo +++ b/media/ffmpeg/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1577131301 -SHA256 (ffmpeg-4.2.1.tar.xz) = cec7c87e9b60d174509e263ac4011b522385fd0775292e1670ecc1180c9bb6d4 -SIZE (ffmpeg-4.2.1.tar.xz) = 9090632 +TIMESTAMP = 1607330603 +SHA256 (ffmpeg-4.3.1.tar.xz) = ad009240d46e307b4e03a213a0f49c11b650e445b1f8be0dda2a9212b34d2ffb +SIZE (ffmpeg-4.3.1.tar.xz) = 9379424 diff --git a/media/ffmpeg/files/patch-configure b/media/ffmpeg/files/patch-configure new file mode 100644 index 00000000..c801515b --- /dev/null +++ b/media/ffmpeg/files/patch-configure @@ -0,0 +1,17 @@ +--- configure.orig 2020-06-15 18:54:23 UTC ++++ configure +@@ -3744,13 +3744,7 @@ target_os_default=$(tolower $(uname -s)) + host_os=$target_os_default + + # machine +-if test "$target_os_default" = aix; then +- arch_default=$(uname -p) +- strip_default="strip -X32_64" +- nm_default="nm -g -X32_64" +-else +- arch_default=$(uname -m) +-fi ++arch_default=$(uname -p) + cpu="generic" + intrinsics="none" + diff --git a/media/ffmpeg/files/patch-libavcodec_allcodecs.c b/media/ffmpeg/files/patch-libavcodec_allcodecs.c deleted file mode 100644 index 0e27547c..00000000 --- a/media/ffmpeg/files/patch-libavcodec_allcodecs.c +++ /dev/null @@ -1,20 +0,0 @@ -https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/dc0806dd2588 - ---- libavcodec/allcodecs.c.orig 2018-11-05 23:22:25 UTC -+++ libavcodec/allcodecs.c -@@ -679,7 +679,6 @@ extern AVCodec ff_pcm_mulaw_at_encoder; - extern AVCodec ff_pcm_mulaw_at_decoder; - extern AVCodec ff_qdmc_at_decoder; - extern AVCodec ff_qdm2_at_decoder; --extern AVCodec ff_libaom_av1_decoder; - extern AVCodec ff_libaom_av1_encoder; - extern AVCodec ff_libaribb24_decoder; - extern AVCodec ff_libcelt_decoder; -@@ -738,6 +737,7 @@ extern AVCodec ff_idf_decoder; - /* external libraries, that shouldn't be used by default if one of the - * above is available */ - extern AVCodec ff_h263_v4l2m2m_encoder; -+extern AVCodec ff_libaom_av1_decoder; - extern AVCodec ff_libopenh264_encoder; - extern AVCodec ff_libopenh264_decoder; - extern AVCodec ff_h264_amf_encoder; diff --git a/media/ffmpeg/files/patch-libswscale_ppc_swscale__altivec.c b/media/ffmpeg/files/patch-libswscale_ppc_swscale__altivec.c deleted file mode 100644 index e4c1c55c..00000000 --- a/media/ffmpeg/files/patch-libswscale_ppc_swscale__altivec.c +++ /dev/null @@ -1,55 +0,0 @@ ---- libswscale/ppc/swscale_altivec.c.orig 2019-08-11 20:06:32 UTC -+++ libswscale/ppc/swscale_altivec.c -@@ -153,13 +153,13 @@ static void yuv2plane1_float_altivec(const int32_t *sr - const int add = (1 << (shift - 1)); - const int clip = (1 << 16) - 1; - const float fmult = 1.0f / 65535.0f; -- const vector uint32_t vadd = (vector uint32_t) {add, add, add, add}; -- const vector uint32_t vshift = (vector uint32_t) vec_splat_u32(shift); -- const vector uint32_t vlargest = (vector uint32_t) {clip, clip, clip, clip}; -- const vector float vmul = (vector float) {fmult, fmult, fmult, fmult}; -- const vector float vzero = (vector float) {0, 0, 0, 0}; -- vector uint32_t v; -- vector float vd; -+ const vec_u32 vadd = (vec_u32) {add, add, add, add}; -+ const vec_u32 vshift = (vec_u32) vec_splat_u32(shift); -+ const vec_u32 vlargest = (vec_u32) {clip, clip, clip, clip}; -+ const vec_f vmul = (vec_f) {fmult, fmult, fmult, fmult}; -+ const vec_f vzero = (vec_f) {0, 0, 0, 0}; -+ vec_u32 v; -+ vec_f vd; - int i; - - yuv2plane1_float_u(src, dest, dst_u, 0); -@@ -186,14 +186,14 @@ static void yuv2plane1_float_bswap_altivec(const int32 - const int add = (1 << (shift - 1)); - const int clip = (1 << 16) - 1; - const float fmult = 1.0f / 65535.0f; -- const vector uint32_t vadd = (vector uint32_t) {add, add, add, add}; -- const vector uint32_t vshift = (vector uint32_t) vec_splat_u32(shift); -- const vector uint32_t vlargest = (vector uint32_t) {clip, clip, clip, clip}; -+ const vec_u32 vadd = (vec_u32) {add, add, add, add}; -+ const vec_u32 vshift = (vec_u32) vec_splat_u32(shift); -+ const vec_u32 vlargest = (vec_u32) {clip, clip, clip, clip}; - const vector float vmul = (vector float) {fmult, fmult, fmult, fmult}; - const vector float vzero = (vector float) {0, 0, 0, 0}; -- const vector uint32_t vswapbig = (vector uint32_t) {16, 16, 16, 16}; -- const vector uint16_t vswapsmall = vec_splat_u16(8); -- vector uint32_t v; -+ const vec_u32 vswapbig = (vec_u32) {16, 16, 16, 16}; -+ const vec_u16 vswapsmall = vec_splat_u16(8); -+ vec_u32 v; - vector float vd; - int i; - -@@ -208,8 +208,8 @@ static void yuv2plane1_float_bswap_altivec(const int32 - vd = vec_ctf(v, 0); - vd = vec_madd(vd, vmul, vzero); - -- vd = (vector float) vec_rl((vector uint32_t) vd, vswapbig); -- vd = (vector float) vec_rl((vector uint16_t) vd, vswapsmall); -+ vd = (vector float) vec_rl((vec_u32) vd, vswapbig); -+ vd = (vector float) vec_rl((vec_u16) vd, vswapsmall); - - vec_st(vd, 0, (float *) &dest[i]); - } diff --git a/media/ffmpeg/files/patch-libswscale_ppc_yuv2rgb__altivec.c b/media/ffmpeg/files/patch-libswscale_ppc_yuv2rgb__altivec.c new file mode 100644 index 00000000..821c16c5 --- /dev/null +++ b/media/ffmpeg/files/patch-libswscale_ppc_yuv2rgb__altivec.c @@ -0,0 +1,145 @@ +Revert 3a557c5d88b7b15b5954ba2743febb055549b536 to fix build on powerpc and powerpc64. + +Error: +CC libswscale/ppc/yuv2rgb_altivec.o +libswscale/ppc/yuv2rgb_altivec.c: In function ?altivec_yuv2_abgr?: +libswscale/ppc/yuv2rgb_altivec.c:338:18: error: implicit declaration of function ?vec_xl?; did you mean ?vec_rl?? [-Werror=implicit-function-declaration] + 338 | y0 = vec_xl(0, y1i); \ + | ^~~~~~ +libswscale/ppc/yuv2rgb_altivec.c:437:1: note: in expansion of macro ?DEFCSP420_CVT? + 437 | DEFCSP420_CVT(yuv2_abgr, out_abgr) + | ^~~~~~~~~~~~~ +libswscale/ppc/yuv2rgb_altivec.c:338:18: error: incompatible types when assigning to type ?__vector unsigned char? {aka ?__vector(16) unsigned char?} from type ?int? + 338 | y0 = vec_xl(0, y1i); \ + | ^~~~~~ +libswscale/ppc/yuv2rgb_altivec.c:437:1: note: in expansion of macro ?DEFCSP420_CVT? + 437 | DEFCSP420_CVT(yuv2_abgr, out_abgr) + | ^~~~~~~~~~~~~ +libswscale/ppc/yuv2rgb_altivec.c:340:18: error: incompatible types when assigning to type ?__vector unsigned char? {aka ?__vector(16) unsigned char?} from type ?int? + 340 | y1 = vec_xl(0, y2i); \ + | ^~~~~~ +libswscale/ppc/yuv2rgb_altivec.c:437:1: note: in expansion of macro ?DEFCSP420_CVT? + 437 | DEFCSP420_CVT(yuv2_abgr, out_abgr) + | ^~~~~~~~~~~~~ +libswscale/ppc/yuv2rgb_altivec.c:437:1: error: can?t convert a value of type ?int? to vector type ?__vector(16) signed char? which has different size +libswscale/ppc/yuv2rgb_altivec.c:437:1: error: can?t convert a value of type ?int? to vector type ?__vector(16) signed char? which has different size +libswscale/ppc/yuv2rgb_altivec.c: In function ?altivec_yuv2_bgra?: +libswscale/ppc/yuv2rgb_altivec.c:338:18: error: incompatible types when assigning to type ?__vector unsigned char? {aka ?__vector(16) unsigned char?} from type ?int? + 338 | y0 = vec_xl(0, y1i); \ + | ^~~~~~ +libswscale/ppc/yuv2rgb_altivec.c:438:1: note: in expansion of macro ?DEFCSP420_CVT? + 438 | DEFCSP420_CVT(yuv2_bgra, out_bgra) + | ^~~~~~~~~~~~~ +libswscale/ppc/yuv2rgb_altivec.c:340:18: error: incompatible types when assigning to type ?__vector unsigned char? {aka ?__vector(16) unsigned char?} from type ?int? + 340 | y1 = vec_xl(0, y2i); \ + | ^~~~~~ +libswscale/ppc/yuv2rgb_altivec.c:438:1: note: in expansion of macro ?DEFCSP420_CVT? + 438 | DEFCSP420_CVT(yuv2_bgra, out_bgra) + | ^~~~~~~~~~~~~ +libswscale/ppc/yuv2rgb_altivec.c:438:1: error: can?t convert a value of type ?int? to vector type ?__vector(16) signed char? which has different size +libswscale/ppc/yuv2rgb_altivec.c:438:1: error: can?t convert a value of type ?int? to vector type ?__vector(16) signed char? which has different size +libswscale/ppc/yuv2rgb_altivec.c: In function ?altivec_yuv2_rgba?: +libswscale/ppc/yuv2rgb_altivec.c:338:18: error: incompatible types when assigning to type ?__vector unsigned char? {aka ?__vector(16) unsigned char?} from type ?int? + 338 | y0 = vec_xl(0, y1i); \ + | ^~~~~~ +libswscale/ppc/yuv2rgb_altivec.c:439:1: note: in expansion of macro ?DEFCSP420_CVT? + 439 | DEFCSP420_CVT(yuv2_rgba, out_rgba) + | ^~~~~~~~~~~~~ +libswscale/ppc/yuv2rgb_altivec.c:340:18: error: incompatible types when assigning to type ?__vector unsigned char? {aka ?__vector(16) unsigned char?} from type ?int? + 340 | y1 = vec_xl(0, y2i); \ + | ^~~~~~ +libswscale/ppc/yuv2rgb_altivec.c:439:1: note: in expansion of macro ?DEFCSP420_CVT? + 439 | DEFCSP420_CVT(yuv2_rgba, out_rgba) + | ^~~~~~~~~~~~~ +libswscale/ppc/yuv2rgb_altivec.c:439:1: error: can?t convert a value of type ?int? to vector type ?__vector(16) signed char? which has different size +libswscale/ppc/yuv2rgb_altivec.c:439:1: error: can?t convert a value of type ?int? to vector type ?__vector(16) signed char? which has different size +libswscale/ppc/yuv2rgb_altivec.c: In function ?altivec_yuv2_argb?: +libswscale/ppc/yuv2rgb_altivec.c:338:18: error: incompatible types when assigning to type ?__vector unsigned char? {aka ?__vector(16) unsigned char?} from type ?int? + 338 | y0 = vec_xl(0, y1i); \ + | ^~~~~~ +libswscale/ppc/yuv2rgb_altivec.c:440:1: note: in expansion of macro ?DEFCSP420_CVT? + 440 | DEFCSP420_CVT(yuv2_argb, out_argb) + | ^~~~~~~~~~~~~ +libswscale/ppc/yuv2rgb_altivec.c:340:18: error: incompatible types when assigning to type ?__vector unsigned char? {aka ?__vector(16) unsigned char?} from type ?int? + 340 | y1 = vec_xl(0, y2i); \ + | ^~~~~~ +libswscale/ppc/yuv2rgb_altivec.c:440:1: note: in expansion of macro ?DEFCSP420_CVT? + 440 | DEFCSP420_CVT(yuv2_argb, out_argb) + | ^~~~~~~~~~~~~ +libswscale/ppc/yuv2rgb_altivec.c:440:1: error: can?t convert a value of type ?int? to vector type ?__vector(16) signed char? which has different size +libswscale/ppc/yuv2rgb_altivec.c:440:1: error: can?t convert a value of type ?int? to vector type ?__vector(16) signed char? which has different size +libswscale/ppc/yuv2rgb_altivec.c: In function ?altivec_yuv2_rgb24?: +libswscale/ppc/yuv2rgb_altivec.c:338:18: error: incompatible types when assigning to type ?__vector unsigned char? {aka ?__vector(16) unsigned char?} from type ?int? + 338 | y0 = vec_xl(0, y1i); \ + | ^~~~~~ +libswscale/ppc/yuv2rgb_altivec.c:441:1: note: in expansion of macro ?DEFCSP420_CVT? + 441 | DEFCSP420_CVT(yuv2_rgb24, out_rgb24) + | ^~~~~~~~~~~~~ +libswscale/ppc/yuv2rgb_altivec.c:340:18: error: incompatible types when assigning to type ?__vector unsigned char? {aka ?__vector(16) unsigned char?} from type ?int? + 340 | y1 = vec_xl(0, y2i); \ + | ^~~~~~ +libswscale/ppc/yuv2rgb_altivec.c:441:1: note: in expansion of macro ?DEFCSP420_CVT? + 441 | DEFCSP420_CVT(yuv2_rgb24, out_rgb24) + | ^~~~~~~~~~~~~ +libswscale/ppc/yuv2rgb_altivec.c:441:1: error: can?t convert a value of type ?int? to vector type ?__vector(16) signed char? which has different size +libswscale/ppc/yuv2rgb_altivec.c:441:1: error: can?t convert a value of type ?int? to vector type ?__vector(16) signed char? which has different size +libswscale/ppc/yuv2rgb_altivec.c: In function ?altivec_yuv2_bgr24?: +libswscale/ppc/yuv2rgb_altivec.c:338:18: error: incompatible types when assigning to type ?__vector unsigned char? {aka ?__vector(16) unsigned char?} from type ?int? + 338 | y0 = vec_xl(0, y1i); \ + | ^~~~~~ +libswscale/ppc/yuv2rgb_altivec.c:442:1: note: in expansion of macro ?DEFCSP420_CVT? + 442 | DEFCSP420_CVT(yuv2_bgr24, out_bgr24) + | ^~~~~~~~~~~~~ +libswscale/ppc/yuv2rgb_altivec.c:340:18: error: incompatible types when assigning to type ?__vector unsigned char? {aka ?__vector(16) unsigned char?} from type ?int? + 340 | y1 = vec_xl(0, y2i); \ + | ^~~~~~ +libswscale/ppc/yuv2rgb_altivec.c:442:1: note: in expansion of macro ?DEFCSP420_CVT? + 442 | DEFCSP420_CVT(yuv2_bgr24, out_bgr24) + | ^~~~~~~~~~~~~ +libswscale/ppc/yuv2rgb_altivec.c:442:1: error: can?t convert a value of type ?int? to vector type ?__vector(16) signed char? which has different size +libswscale/ppc/yuv2rgb_altivec.c:442:1: error: can?t convert a value of type ?int? to vector type ?__vector(16) signed char? which has different size +cc1: some warnings being treated as errors + +--- libswscale/ppc/yuv2rgb_altivec.c.orig 2020-06-15 18:54:24 UTC ++++ libswscale/ppc/yuv2rgb_altivec.c +@@ -305,6 +305,9 @@ static int altivec_ ## name(SwsContext *c, const unsig + vector signed short R1, G1, B1; \ + vector unsigned char R, G, B; \ + \ ++ const vector unsigned char *y1ivP, *y2ivP, *uivP, *vivP; \ ++ vector unsigned char align_perm; \ ++ \ + vector signed short lCY = c->CY; \ + vector signed short lOY = c->OY; \ + vector signed short lCRV = c->CRV; \ +@@ -335,13 +338,26 @@ static int altivec_ ## name(SwsContext *c, const unsig + vec_dstst(oute, (0x02000002 | (((w * 3 + 32) / 32) << 16)), 1); \ + \ + for (j = 0; j < w / 16; j++) { \ +- y0 = vec_xl(0, y1i); \ ++ y1ivP = (const vector unsigned char *) y1i; \ ++ y2ivP = (const vector unsigned char *) y2i; \ ++ uivP = (const vector unsigned char *) ui; \ ++ vivP = (const vector unsigned char *) vi; \ + \ +- y1 = vec_xl(0, y2i); \ ++ align_perm = vec_lvsl(0, y1i); \ ++ y0 = (vector unsigned char) \ ++ vec_perm(y1ivP[0], y1ivP[1], align_perm); \ + \ +- u = (vector signed char) vec_xl(0, ui); \ ++ align_perm = vec_lvsl(0, y2i); \ ++ y1 = (vector unsigned char) \ ++ vec_perm(y2ivP[0], y2ivP[1], align_perm); \ + \ +- v = (vector signed char) vec_xl(0, vi); \ ++ align_perm = vec_lvsl(0, ui); \ ++ u = (vector signed char) \ ++ vec_perm(uivP[0], uivP[1], align_perm); \ ++ \ ++ align_perm = vec_lvsl(0, vi); \ ++ v = (vector signed char) \ ++ vec_perm(vivP[0], vivP[1], align_perm); \ + \ + u = (vector signed char) \ + vec_sub(u, \ diff --git a/media/ffmpeg/files/patch-rav1e b/media/ffmpeg/files/patch-rav1e deleted file mode 100644 index 9a5d2839..00000000 --- a/media/ffmpeg/files/patch-rav1e +++ /dev/null @@ -1,723 +0,0 @@ -https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/d8bf24459b69 -https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/3a84081cbd98 -https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/1354c39c78e5 - ---- configure.orig 2019-11-11 11:47:47 UTC -+++ configure -@@ -254,6 +254,7 @@ 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-librav1e enable AV1 encoding via rav1e [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] -@@ -1785,6 +1786,7 @@ EXTERNAL_LIBRARY_LIST=" - libopenmpt - libopus - libpulse -+ librav1e - librsvg - librtmp - libshine -@@ -3187,6 +3189,8 @@ libopenmpt_demuxer_deps="libopenmpt" - libopus_decoder_deps="libopus" - libopus_encoder_deps="libopus" - libopus_encoder_select="audio_frame_queue" -+librav1e_encoder_deps="librav1e" -+librav1e_encoder_select="extract_extradata_bsf" - librsvg_decoder_deps="librsvg" - libshine_encoder_deps="libshine" - libshine_encoder_select="audio_frame_queue" -@@ -6255,6 +6259,7 @@ enabled libopus && { - } - } - enabled libpulse && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new -+enabled librav1e && require_pkg_config librav1e "rav1e >= 0.1.0" rav1e.h rav1e_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 -lstdc++ && append librubberband_extralibs "-lstdc++" ---- doc/encoders.texi.orig 2019-08-05 20:52:21 UTC -+++ doc/encoders.texi -@@ -1378,6 +1378,49 @@ makes it possible to store non-rgb pix_fmts. - - @end table - -+@section librav1e -+ -+rav1e AV1 encoder wrapper. -+ -+Requires the presence of the rav1e headers and library during configuration. -+You need to explicitly configure the build with @code{--enable-librav1e}. -+ -+@subsection Options -+ -+@table @option -+@item qmax -+Sets the maximum quantizer to use when using bitrate mode. -+ -+@item qmin -+Sets the minimum quantizer to use when using bitrate mode. -+ -+@item qp -+Uses quantizer mode to encode at the given quantizer. -+ -+@item speed -+Selects the speed preset (0-10) to encode with. -+ -+@item tiles -+Selects how many tiles to encode with. -+ -+@item tile-rows -+Selects how many rows of tiles to encode with. -+ -+@item tile-columns -+Selects how many columns of tiles to encode with. -+ -+@item rav1e-params -+Set rav1e options using a list of @var{key}=@var{value} pairs separated -+by ":". See @command{rav1e --help} for a list of options. -+ -+For example to specify librav1e encoding options with @option{-rav1e-params}: -+ -+@example -+ffmpeg -i input -c:v librav1e -b:v 500K -rav1e-params speed=5:low_latency=true output.mp4 -+@end example -+ -+@end table -+ - @section libaom-av1 - - libaom AV1 encoder wrapper. ---- doc/general.texi.orig 2019-08-05 20:52:21 UTC -+++ doc/general.texi -@@ -243,6 +243,13 @@ FFmpeg can use the OpenJPEG libraries for decoding/enc - instructions. To enable using OpenJPEG in FFmpeg, pass @code{--enable-libopenjpeg} to - @file{./configure}. - -+@section rav1e -+ -+FFmpeg can make use of rav1e (Rust AV1 Encoder) via its C bindings to encode videos. -+Go to @url{https://github.com/xiph/rav1e/} and follow the instructions to build -+the C library. To enable using rav1e in FFmpeg, pass @code{--enable-librav1e} -+to @file{./configure}. -+ - @section TwoLAME - - FFmpeg can make use of the TwoLAME library for MP2 encoding. ---- libavcodec/Makefile.orig 2019-11-11 11:47:47 UTC -+++ libavcodec/Makefile -@@ -988,6 +988,7 @@ OBJS-$(CONFIG_LIBOPUS_DECODER) += libopusde - vorbis_data.o - OBJS-$(CONFIG_LIBOPUS_ENCODER) += libopusenc.o libopus.o \ - vorbis_data.o -+OBJS-$(CONFIG_LIBRAV1E_ENCODER) += librav1e.o - OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o - OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o - OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o ---- libavcodec/allcodecs.c.orig 2019-11-11 11:47:47 UTC -+++ libavcodec/allcodecs.c -@@ -703,6 +703,7 @@ extern AVCodec ff_libopenjpeg_encoder; - extern AVCodec ff_libopenjpeg_decoder; - extern AVCodec ff_libopus_encoder; - extern AVCodec ff_libopus_decoder; -+extern AVCodec ff_librav1e_encoder; - extern AVCodec ff_librsvg_decoder; - extern AVCodec ff_libshine_encoder; - extern AVCodec ff_libspeex_encoder; ---- libavcodec/librav1e.c.orig 2019-11-11 11:47:47 UTC -+++ libavcodec/librav1e.c -@@ -0,0 +1,593 @@ -+/* -+ * librav1e encoder -+ * -+ * Copyright (c) 2019 Derek Buitenhuis -+ * -+ * 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 -+ */ -+ -+#include -+ -+#include "libavutil/internal.h" -+#include "libavutil/avassert.h" -+#include "libavutil/base64.h" -+#include "libavutil/common.h" -+#include "libavutil/mathematics.h" -+#include "libavutil/opt.h" -+#include "libavutil/pixdesc.h" -+#include "avcodec.h" -+#include "internal.h" -+ -+typedef struct librav1eContext { -+ const AVClass *class; -+ -+ RaContext *ctx; -+ AVBSFContext *bsf; -+ -+ uint8_t *pass_data; -+ size_t pass_pos; -+ int pass_size; -+ -+ char *rav1e_opts; -+ int quantizer; -+ int speed; -+ int tiles; -+ int tile_rows; -+ int tile_cols; -+} librav1eContext; -+ -+static inline RaPixelRange range_map(enum AVPixelFormat pix_fmt, enum AVColorRange range) -+{ -+ switch (pix_fmt) { -+ case AV_PIX_FMT_YUVJ420P: -+ case AV_PIX_FMT_YUVJ422P: -+ case AV_PIX_FMT_YUVJ444P: -+ return RA_PIXEL_RANGE_FULL; -+ } -+ -+ switch (range) { -+ case AVCOL_RANGE_JPEG: -+ return RA_PIXEL_RANGE_FULL; -+ case AVCOL_RANGE_MPEG: -+ default: -+ return RA_PIXEL_RANGE_LIMITED; -+ } -+} -+ -+static inline RaChromaSampling pix_fmt_map(enum AVPixelFormat pix_fmt) -+{ -+ switch (pix_fmt) { -+ case AV_PIX_FMT_YUV420P: -+ case AV_PIX_FMT_YUVJ420P: -+ case AV_PIX_FMT_YUV420P10: -+ case AV_PIX_FMT_YUV420P12: -+ return RA_CHROMA_SAMPLING_CS420; -+ case AV_PIX_FMT_YUV422P: -+ case AV_PIX_FMT_YUVJ422P: -+ case AV_PIX_FMT_YUV422P10: -+ case AV_PIX_FMT_YUV422P12: -+ return RA_CHROMA_SAMPLING_CS422; -+ case AV_PIX_FMT_YUV444P: -+ case AV_PIX_FMT_YUVJ444P: -+ case AV_PIX_FMT_YUV444P10: -+ case AV_PIX_FMT_YUV444P12: -+ return RA_CHROMA_SAMPLING_CS444; -+ default: -+ av_assert0(0); -+ } -+} -+ -+static inline RaChromaSamplePosition chroma_loc_map(enum AVChromaLocation chroma_loc) -+{ -+ switch (chroma_loc) { -+ case AVCHROMA_LOC_LEFT: -+ return RA_CHROMA_SAMPLE_POSITION_VERTICAL; -+ case AVCHROMA_LOC_TOPLEFT: -+ return RA_CHROMA_SAMPLE_POSITION_COLOCATED; -+ default: -+ return RA_CHROMA_SAMPLE_POSITION_UNKNOWN; -+ } -+} -+ -+static int get_stats(AVCodecContext *avctx, int eos) -+{ -+ librav1eContext *ctx = avctx->priv_data; -+ RaData* buf = rav1e_twopass_out(ctx->ctx); -+ if (!buf) -+ return 0; -+ -+ if (!eos) { -+ uint8_t *tmp = av_fast_realloc(ctx->pass_data, &ctx->pass_size, -+ ctx->pass_pos + buf->len); -+ if (!tmp) { -+ rav1e_data_unref(buf); -+ return AVERROR(ENOMEM); -+ } -+ -+ ctx->pass_data = tmp; -+ memcpy(ctx->pass_data + ctx->pass_pos, buf->data, buf->len); -+ ctx->pass_pos += buf->len; -+ } else { -+ size_t b64_size = AV_BASE64_SIZE(ctx->pass_pos); -+ -+ memcpy(ctx->pass_data, buf->data, buf->len); -+ -+ avctx->stats_out = av_malloc(b64_size); -+ if (!avctx->stats_out) { -+ rav1e_data_unref(buf); -+ return AVERROR(ENOMEM); -+ } -+ -+ av_base64_encode(avctx->stats_out, b64_size, ctx->pass_data, ctx->pass_pos); -+ -+ av_freep(&ctx->pass_data); -+ } -+ -+ rav1e_data_unref(buf); -+ -+ return 0; -+} -+ -+static int set_stats(AVCodecContext *avctx) -+{ -+ librav1eContext *ctx = avctx->priv_data; -+ int ret = 1; -+ -+ while (ret > 0 && ctx->pass_size - ctx->pass_pos > 0) { -+ ret = rav1e_twopass_in(ctx->ctx, ctx->pass_data + ctx->pass_pos, ctx->pass_size); -+ if (ret < 0) -+ return AVERROR_EXTERNAL; -+ ctx->pass_pos += ret; -+ } -+ -+ return 0; -+} -+ -+static av_cold int librav1e_encode_close(AVCodecContext *avctx) -+{ -+ librav1eContext *ctx = avctx->priv_data; -+ -+ if (ctx->ctx) { -+ rav1e_context_unref(ctx->ctx); -+ ctx->ctx = NULL; -+ } -+ -+ av_bsf_free(&ctx->bsf); -+ av_freep(&ctx->pass_data); -+ -+ return 0; -+} -+ -+static av_cold int librav1e_encode_init(AVCodecContext *avctx) -+{ -+ librav1eContext *ctx = avctx->priv_data; -+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); -+ RaConfig *cfg = NULL; -+ int rret; -+ int ret = 0; -+ -+ cfg = rav1e_config_default(); -+ if (!cfg) { -+ av_log(avctx, AV_LOG_ERROR, "Could not allocate rav1e config.\n"); -+ return AVERROR_EXTERNAL; -+ } -+ -+ rav1e_config_set_time_base(cfg, (RaRational) { -+ avctx->time_base.num * avctx->ticks_per_frame, -+ avctx->time_base.den -+ }); -+ -+ if (avctx->flags & AV_CODEC_FLAG_PASS2) { -+ if (!avctx->stats_in) { -+ av_log(avctx, AV_LOG_ERROR, "No stats file provided for second pass.\n"); -+ ret = AVERROR(EINVAL); -+ goto end; -+ } -+ -+ ctx->pass_size = (strlen(avctx->stats_in) * 3) / 4; -+ ctx->pass_data = av_malloc(ctx->pass_size); -+ if (!ctx->pass_data) { -+ av_log(avctx, AV_LOG_ERROR, "Could not allocate stats buffer.\n"); -+ ret = AVERROR(ENOMEM); -+ goto end; -+ } -+ -+ ctx->pass_size = av_base64_decode(ctx->pass_data, avctx->stats_in, ctx->pass_size); -+ if (ctx->pass_size < 0) { -+ av_log(avctx, AV_LOG_ERROR, "Invalid pass file.\n"); -+ ret = AVERROR(EINVAL); -+ goto end; -+ } -+ } -+ -+ if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) { -+ const AVBitStreamFilter *filter = av_bsf_get_by_name("extract_extradata"); -+ int bret; -+ -+ if (!filter) { -+ av_log(avctx, AV_LOG_ERROR, "extract_extradata bitstream filter " -+ "not found. This is a bug, please report it.\n"); -+ ret = AVERROR_BUG; -+ goto end; -+ } -+ -+ bret = av_bsf_alloc(filter, &ctx->bsf); -+ if (bret < 0) { -+ ret = bret; -+ goto end; -+ } -+ -+ bret = avcodec_parameters_from_context(ctx->bsf->par_in, avctx); -+ if (bret < 0) { -+ ret = bret; -+ goto end; -+ } -+ -+ bret = av_bsf_init(ctx->bsf); -+ if (bret < 0) { -+ ret = bret; -+ goto end; -+ } -+ } -+ -+ if (ctx->rav1e_opts) { -+ AVDictionary *dict = NULL; -+ AVDictionaryEntry *en = NULL; -+ -+ if (!av_dict_parse_string(&dict, ctx->rav1e_opts, "=", ":", 0)) { -+ while (en = av_dict_get(dict, "", en, AV_DICT_IGNORE_SUFFIX)) { -+ int parse_ret = rav1e_config_parse(cfg, en->key, en->value); -+ if (parse_ret < 0) -+ av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s.\n", en->key, en->value); -+ } -+ av_dict_free(&dict); -+ } -+ } -+ -+ rret = rav1e_config_parse_int(cfg, "width", avctx->width); -+ if (rret < 0) { -+ av_log(avctx, AV_LOG_ERROR, "Invalid width passed to rav1e.\n"); -+ ret = AVERROR_INVALIDDATA; -+ goto end; -+ } -+ -+ rret = rav1e_config_parse_int(cfg, "height", avctx->height); -+ if (rret < 0) { -+ av_log(avctx, AV_LOG_ERROR, "Invalid height passed to rav1e.\n"); -+ ret = AVERROR_INVALIDDATA; -+ goto end; -+ } -+ -+ rret = rav1e_config_parse_int(cfg, "threads", avctx->thread_count); -+ if (rret < 0) -+ av_log(avctx, AV_LOG_WARNING, "Invalid number of threads, defaulting to auto.\n"); -+ -+ if (ctx->speed >= 0) { -+ rret = rav1e_config_parse_int(cfg, "speed", ctx->speed); -+ if (rret < 0) { -+ av_log(avctx, AV_LOG_ERROR, "Could not set speed preset.\n"); -+ ret = AVERROR_EXTERNAL; -+ goto end; -+ } -+ } -+ -+ /* rav1e handles precedence between 'tiles' and cols/rows for us. */ -+ if (ctx->tiles > 0) { -+ rret = rav1e_config_parse_int(cfg, "tiles", ctx->tiles); -+ if (rret < 0) { -+ av_log(avctx, AV_LOG_ERROR, "Could not set number of tiles to encode with.\n"); -+ ret = AVERROR_EXTERNAL; -+ goto end; -+ } -+ } -+ if (ctx->tile_rows > 0) { -+ rret = rav1e_config_parse_int(cfg, "tile_rows", ctx->tile_rows); -+ if (rret < 0) { -+ av_log(avctx, AV_LOG_ERROR, "Could not set number of tile rows to encode with.\n"); -+ ret = AVERROR_EXTERNAL; -+ goto end; -+ } -+ } -+ if (ctx->tile_cols > 0) { -+ rret = rav1e_config_parse_int(cfg, "tile_cols", ctx->tile_cols); -+ if (rret < 0) { -+ av_log(avctx, AV_LOG_ERROR, "Could not set number of tile cols to encode with.\n"); -+ ret = AVERROR_EXTERNAL; -+ goto end; -+ } -+ } -+ -+ if (avctx->gop_size > 0) { -+ rret = rav1e_config_parse_int(cfg, "key_frame_interval", avctx->gop_size); -+ if (rret < 0) { -+ av_log(avctx, AV_LOG_ERROR, "Could not set max keyint.\n"); -+ ret = AVERROR_EXTERNAL; -+ goto end; -+ } -+ } -+ -+ if (avctx->keyint_min > 0) { -+ rret = rav1e_config_parse_int(cfg, "min_key_frame_interval", avctx->keyint_min); -+ if (rret < 0) { -+ av_log(avctx, AV_LOG_ERROR, "Could not set min keyint.\n"); -+ ret = AVERROR_EXTERNAL; -+ goto end; -+ } -+ } -+ -+ if (avctx->bit_rate && ctx->quantizer < 0) { -+ int max_quantizer = avctx->qmax >= 0 ? avctx->qmax : 255; -+ -+ rret = rav1e_config_parse_int(cfg, "quantizer", max_quantizer); -+ if (rret < 0) { -+ av_log(avctx, AV_LOG_ERROR, "Could not set max quantizer.\n"); -+ ret = AVERROR_EXTERNAL; -+ goto end; -+ } -+ -+ if (avctx->qmin >= 0) { -+ rret = rav1e_config_parse_int(cfg, "min_quantizer", avctx->qmin); -+ if (rret < 0) { -+ av_log(avctx, AV_LOG_ERROR, "Could not set min quantizer.\n"); -+ ret = AVERROR_EXTERNAL; -+ goto end; -+ } -+ } -+ -+ rret = rav1e_config_parse_int(cfg, "bitrate", avctx->bit_rate); -+ if (rret < 0) { -+ av_log(avctx, AV_LOG_ERROR, "Could not set bitrate.\n"); -+ ret = AVERROR_INVALIDDATA; -+ goto end; -+ } -+ } else if (ctx->quantizer >= 0) { -+ if (avctx->bit_rate) -+ av_log(avctx, AV_LOG_WARNING, "Both bitrate and quantizer specified. Using quantizer mode."); -+ -+ rret = rav1e_config_parse_int(cfg, "quantizer", ctx->quantizer); -+ if (rret < 0) { -+ av_log(avctx, AV_LOG_ERROR, "Could not set quantizer.\n"); -+ ret = AVERROR_EXTERNAL; -+ goto end; -+ } -+ } -+ -+ rret = rav1e_config_set_pixel_format(cfg, desc->comp[0].depth, -+ pix_fmt_map(avctx->pix_fmt), -+ chroma_loc_map(avctx->chroma_sample_location), -+ range_map(avctx->pix_fmt, avctx->color_range)); -+ if (rret < 0) { -+ av_log(avctx, AV_LOG_ERROR, "Failed to set pixel format properties.\n"); -+ ret = AVERROR_INVALIDDATA; -+ goto end; -+ } -+ -+ /* rav1e's colorspace enums match standard values. */ -+ rret = rav1e_config_set_color_description(cfg, (RaMatrixCoefficients) avctx->colorspace, -+ (RaColorPrimaries) avctx->color_primaries, -+ (RaTransferCharacteristics) avctx->color_trc); -+ if (rret < 0) { -+ av_log(avctx, AV_LOG_WARNING, "Failed to set color properties.\n"); -+ if (avctx->err_recognition & AV_EF_EXPLODE) { -+ ret = AVERROR_INVALIDDATA; -+ goto end; -+ } -+ } -+ -+ ctx->ctx = rav1e_context_new(cfg); -+ if (!ctx->ctx) { -+ av_log(avctx, AV_LOG_ERROR, "Failed to create rav1e encode context.\n"); -+ ret = AVERROR_EXTERNAL; -+ goto end; -+ } -+ -+ ret = 0; -+ -+end: -+ -+ rav1e_config_unref(cfg); -+ -+ return ret; -+} -+ -+static int librav1e_send_frame(AVCodecContext *avctx, const AVFrame *frame) -+{ -+ librav1eContext *ctx = avctx->priv_data; -+ RaFrame *rframe = NULL; -+ int ret; -+ -+ if (frame) { -+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format); -+ -+ rframe = rav1e_frame_new(ctx->ctx); -+ if (!rframe) { -+ av_log(avctx, AV_LOG_ERROR, "Could not allocate new rav1e frame.\n"); -+ return AVERROR(ENOMEM); -+ } -+ -+ for (int i = 0; i < desc->nb_components; i++) { -+ int shift = i ? desc->log2_chroma_h : 0; -+ int bytes = desc->comp[0].depth == 8 ? 1 : 2; -+ rav1e_frame_fill_plane(rframe, i, frame->data[i], -+ (frame->height >> shift) * frame->linesize[i], -+ frame->linesize[i], bytes); -+ } -+ } -+ -+ ret = rav1e_send_frame(ctx->ctx, rframe); -+ if (rframe) -+ rav1e_frame_unref(rframe); /* No need to unref if flushing. */ -+ -+ switch (ret) { -+ case RA_ENCODER_STATUS_SUCCESS: -+ break; -+ case RA_ENCODER_STATUS_ENOUGH_DATA: -+ return AVERROR(EAGAIN); -+ case RA_ENCODER_STATUS_FAILURE: -+ av_log(avctx, AV_LOG_ERROR, "Could not send frame: %s\n", rav1e_status_to_str(ret)); -+ return AVERROR_EXTERNAL; -+ default: -+ av_log(avctx, AV_LOG_ERROR, "Unknown return code %d from rav1e_send_frame: %s\n", ret, rav1e_status_to_str(ret)); -+ return AVERROR_UNKNOWN; -+ } -+ -+ return 0; -+} -+ -+static int librav1e_receive_packet(AVCodecContext *avctx, AVPacket *pkt) -+{ -+ librav1eContext *ctx = avctx->priv_data; -+ RaPacket *rpkt = NULL; -+ int ret; -+ -+retry: -+ -+ if (avctx->flags & AV_CODEC_FLAG_PASS1) { -+ int sret = get_stats(avctx, 0); -+ if (sret < 0) -+ return sret; -+ } else if (avctx->flags & AV_CODEC_FLAG_PASS2) { -+ int sret = set_stats(avctx); -+ if (sret < 0) -+ return sret; -+ } -+ -+ ret = rav1e_receive_packet(ctx->ctx, &rpkt); -+ switch (ret) { -+ case RA_ENCODER_STATUS_SUCCESS: -+ break; -+ case RA_ENCODER_STATUS_LIMIT_REACHED: -+ if (avctx->flags & AV_CODEC_FLAG_PASS1) { -+ int sret = get_stats(avctx, 1); -+ if (sret < 0) -+ return sret; -+ } -+ return AVERROR_EOF; -+ case RA_ENCODER_STATUS_ENCODED: -+ if (avctx->internal->draining) -+ goto retry; -+ return AVERROR(EAGAIN); -+ case RA_ENCODER_STATUS_NEED_MORE_DATA: -+ if (avctx->internal->draining) { -+ av_log(avctx, AV_LOG_ERROR, "Unexpected error when receiving packet after EOF.\n"); -+ return AVERROR_EXTERNAL; -+ } -+ return AVERROR(EAGAIN); -+ case RA_ENCODER_STATUS_FAILURE: -+ av_log(avctx, AV_LOG_ERROR, "Could not encode frame: %s\n", rav1e_status_to_str(ret)); -+ return AVERROR_EXTERNAL; -+ default: -+ av_log(avctx, AV_LOG_ERROR, "Unknown return code %d from rav1e_receive_packet: %s\n", ret, rav1e_status_to_str(ret)); -+ return AVERROR_UNKNOWN; -+ } -+ -+ ret = av_new_packet(pkt, rpkt->len); -+ if (ret < 0) { -+ av_log(avctx, AV_LOG_ERROR, "Could not allocate packet.\n"); -+ rav1e_packet_unref(rpkt); -+ return ret; -+ } -+ -+ memcpy(pkt->data, rpkt->data, rpkt->len); -+ -+ if (rpkt->frame_type == RA_FRAME_TYPE_KEY) -+ pkt->flags |= AV_PKT_FLAG_KEY; -+ -+ pkt->pts = pkt->dts = rpkt->input_frameno * avctx->ticks_per_frame; -+ rav1e_packet_unref(rpkt); -+ -+ if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) { -+ int ret = av_bsf_send_packet(ctx->bsf, pkt); -+ if (ret < 0) { -+ av_log(avctx, AV_LOG_ERROR, "extradata extraction send failed.\n"); -+ av_packet_unref(pkt); -+ return ret; -+ } -+ -+ ret = av_bsf_receive_packet(ctx->bsf, pkt); -+ if (ret < 0) { -+ av_log(avctx, AV_LOG_ERROR, "extradata extraction receive failed.\n"); -+ av_packet_unref(pkt); -+ return ret; -+ } -+ } -+ -+ return 0; -+} -+ -+#define OFFSET(x) offsetof(librav1eContext, x) -+#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM -+ -+static const AVOption options[] = { -+ { "qp", "use constant quantizer mode", OFFSET(quantizer), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 255, VE }, -+ { "speed", "what speed preset to use", OFFSET(speed), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 10, VE }, -+ { "tiles", "number of tiles encode with", OFFSET(tiles), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT64_MAX, VE }, -+ { "tile-rows", "number of tiles rows to encode with", OFFSET(tile_rows), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT64_MAX, VE }, -+ { "tile-columns", "number of tiles columns to encode with", OFFSET(tile_cols), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT64_MAX, VE }, -+ { "rav1e-params", "set the rav1e configuration using a :-separated list of key=value parameters", OFFSET(rav1e_opts), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, -+ { NULL } -+}; -+ -+static const AVCodecDefault librav1e_defaults[] = { -+ { "b", "0" }, -+ { "g", "0" }, -+ { "keyint_min", "0" }, -+ { "qmax", "-1" }, -+ { "qmin", "-1" }, -+ { NULL } -+}; -+ -+const enum AVPixelFormat librav1e_pix_fmts[] = { -+ AV_PIX_FMT_YUV420P, -+ AV_PIX_FMT_YUVJ420P, -+ AV_PIX_FMT_YUV420P10, -+ AV_PIX_FMT_YUV420P12, -+ AV_PIX_FMT_YUV422P, -+ AV_PIX_FMT_YUVJ422P, -+ AV_PIX_FMT_YUV422P10, -+ AV_PIX_FMT_YUV422P12, -+ AV_PIX_FMT_YUV444P, -+ AV_PIX_FMT_YUVJ444P, -+ AV_PIX_FMT_YUV444P10, -+ AV_PIX_FMT_YUV444P12, -+ AV_PIX_FMT_NONE -+}; -+ -+static const AVClass class = { -+ .class_name = "librav1e", -+ .item_name = av_default_item_name, -+ .option = options, -+ .version = LIBAVUTIL_VERSION_INT, -+}; -+ -+AVCodec ff_librav1e_encoder = { -+ .name = "librav1e", -+ .long_name = NULL_IF_CONFIG_SMALL("librav1e AV1"), -+ .type = AVMEDIA_TYPE_VIDEO, -+ .id = AV_CODEC_ID_AV1, -+ .init = librav1e_encode_init, -+ .send_frame = librav1e_send_frame, -+ .receive_packet = librav1e_receive_packet, -+ .close = librav1e_encode_close, -+ .priv_data_size = sizeof(librav1eContext), -+ .priv_class = &class, -+ .defaults = librav1e_defaults, -+ .pix_fmts = librav1e_pix_fmts, -+ .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS, -+ .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, -+ .wrapper_name = "librav1e", -+}; diff --git a/media/ffmpeg/files/patch-vdpau_vp9 b/media/ffmpeg/files/patch-vdpau_vp9 deleted file mode 100644 index cb473074..00000000 --- a/media/ffmpeg/files/patch-vdpau_vp9 +++ /dev/null @@ -1,330 +0,0 @@ -https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/1054752c563c - ---- configure.orig 2019-12-18 11:42:25 UTC -+++ configure -@@ -2976,6 +2976,8 @@ vp9_nvdec_hwaccel_deps="nvdec" - vp9_nvdec_hwaccel_select="vp9_decoder" - vp9_vaapi_hwaccel_deps="vaapi VADecPictureParameterBufferVP9_bit_depth" - vp9_vaapi_hwaccel_select="vp9_decoder" -+vp9_vdpau_hwaccel_deps="vdpau VdpPictureInfoVP9" -+vp9_vdpau_hwaccel_select="vp9_decoder" - wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel" - wmv3_d3d11va2_hwaccel_select="vc1_d3d11va2_hwaccel" - wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel" -@@ -6083,6 +6085,7 @@ check_type "windows.h d3d11.h" "ID3D11VideoContext" - check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602 - - check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC" -+check_type "vdpau/vdpau.h" "VdpPictureInfoVP9" - - if [ -z "$nvccflags" ]; then - nvccflags=$nvccflags_default ---- libavcodec/Makefile.orig 2019-12-18 11:42:25 UTC -+++ libavcodec/Makefile -@@ -910,6 +910,7 @@ OBJS-$(CONFIG_VP9_D3D11VA_HWACCEL) += dxva2_vp9 - OBJS-$(CONFIG_VP9_DXVA2_HWACCEL) += dxva2_vp9.o - OBJS-$(CONFIG_VP9_NVDEC_HWACCEL) += nvdec_vp9.o - OBJS-$(CONFIG_VP9_VAAPI_HWACCEL) += vaapi_vp9.o -+OBJS-$(CONFIG_VP9_VDPAU_HWACCEL) += vdpau_vp9.o - OBJS-$(CONFIG_VP8_QSV_HWACCEL) += qsvdec_other.o - - # libavformat dependencies ---- libavcodec/hwaccels.h.orig 2019-07-08 17:45:25 UTC -+++ libavcodec/hwaccels.h -@@ -68,6 +68,7 @@ extern const AVHWAccel ff_vp9_d3d11va2_hwaccel; - extern const AVHWAccel ff_vp9_dxva2_hwaccel; - extern const AVHWAccel ff_vp9_nvdec_hwaccel; - extern const AVHWAccel ff_vp9_vaapi_hwaccel; -+extern const AVHWAccel ff_vp9_vdpau_hwaccel; - extern const AVHWAccel ff_wmv3_d3d11va_hwaccel; - extern const AVHWAccel ff_wmv3_d3d11va2_hwaccel; - extern const AVHWAccel ff_wmv3_dxva2_hwaccel; ---- libavcodec/vdpau_internal.h.orig 2019-08-05 20:52:21 UTC -+++ libavcodec/vdpau_internal.h -@@ -54,6 +54,9 @@ union VDPAUPictureInfo { - #ifdef VDP_YCBCR_FORMAT_Y_U_V_444 - VdpPictureInfoHEVC444 hevc_444; - #endif -+#ifdef VDP_DECODER_PROFILE_VP9_PROFILE_0 -+ VdpPictureInfoVP9 vp9; -+#endif - }; - - typedef struct VDPAUHWContext { ---- libavcodec/vdpau_vp9.c.orig 2019-12-18 11:42:25 UTC -+++ libavcodec/vdpau_vp9.c -@@ -0,0 +1,242 @@ -+/* -+ * VP9 HW decode acceleration through VDPAU -+ * -+ * Copyright (c) 2019 Manoj Gupta Bonda -+ * -+ * 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 -+ */ -+ -+#include -+#include "libavutil/pixdesc.h" -+#include "avcodec.h" -+#include "internal.h" -+#include "vp9data.h" -+#include "vp9dec.h" -+#include "hwaccel.h" -+#include "vdpau.h" -+#include "vdpau_internal.h" -+ -+static int vdpau_vp9_start_frame(AVCodecContext *avctx, -+ const uint8_t *buffer, uint32_t size) -+{ -+ VP9Context *s = avctx->priv_data; -+ VP9SharedContext *h = &(s->s); -+ const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(avctx->sw_pix_fmt); -+ if (!pixdesc) { -+ return AV_PIX_FMT_NONE; -+ } -+ -+ VP9Frame pic = h->frames[CUR_FRAME]; -+ struct vdpau_picture_context *pic_ctx = pic.hwaccel_picture_private; -+ int i; -+ -+ VdpPictureInfoVP9 *info = &pic_ctx->info.vp9; -+ -+ info->width = avctx->width; -+ info->height = avctx->height; -+ /* fill LvPictureInfoVP9 struct */ -+ info->lastReference = VDP_INVALID_HANDLE; -+ info->goldenReference = VDP_INVALID_HANDLE; -+ info->altReference = VDP_INVALID_HANDLE; -+ -+ if (h->refs[h->h.refidx[0]].f && h->refs[h->h.refidx[0]].f->private_ref) { -+ info->lastReference = ff_vdpau_get_surface_id(h->refs[h->h.refidx[0]].f); -+ } -+ if (h->refs[h->h.refidx[1]].f && h->refs[h->h.refidx[1]].f->private_ref) { -+ info->goldenReference = ff_vdpau_get_surface_id(h->refs[h->h.refidx[1]].f); -+ } -+ if (h->refs[h->h.refidx[2]].f && h->refs[h->h.refidx[2]].f->private_ref) { -+ info->altReference = ff_vdpau_get_surface_id(h->refs[h->h.refidx[2]].f); -+ } -+ -+ info->profile = h->h.profile; -+ info->frameContextIdx = h->h.framectxid; -+ info->keyFrame = h->h.keyframe; -+ info->showFrame = !h->h.invisible; -+ info->errorResilient = h->h.errorres; -+ info->frameParallelDecoding = h->h.parallelmode; -+ -+ info->subSamplingX = pixdesc->log2_chroma_w; -+ info->subSamplingY = pixdesc->log2_chroma_h; -+ -+ info->intraOnly = h->h.intraonly; -+ info->allowHighPrecisionMv = h->h.keyframe ? 0 : h->h.highprecisionmvs; -+ info->refreshEntropyProbs = h->h.refreshctx; -+ -+ info->bitDepthMinus8Luma = pixdesc->comp[0].depth - 8; -+ info->bitDepthMinus8Chroma = pixdesc->comp[1].depth - 8; -+ -+ info->loopFilterLevel = h->h.filter.level; -+ info->loopFilterSharpness = h->h.filter.sharpness; -+ info->modeRefLfEnabled = h->h.lf_delta.enabled; -+ -+ info->log2TileColumns = h->h.tiling.log2_tile_cols; -+ info->log2TileRows = h->h.tiling.log2_tile_rows; -+ -+ info->segmentEnabled = h->h.segmentation.enabled; -+ info->segmentMapUpdate = h->h.segmentation.update_map; -+ info->segmentMapTemporalUpdate = h->h.segmentation.temporal; -+ info->segmentFeatureMode = h->h.segmentation.absolute_vals; -+ -+ info->qpYAc = h->h.yac_qi; -+ info->qpYDc = h->h.ydc_qdelta; -+ info->qpChDc = h->h.uvdc_qdelta; -+ info->qpChAc = h->h.uvac_qdelta; -+ -+ info->resetFrameContext = h->h.resetctx; -+ info->mcompFilterType = h->h.filtermode ^ (h->h.filtermode <= 1); -+ info->uncompressedHeaderSize = h->h.uncompressed_header_size; -+ info->compressedHeaderSize = h->h.compressed_header_size; -+ info->refFrameSignBias[0] = 0; -+ -+ -+ for (i = 0; i < FF_ARRAY_ELEMS(info->mbModeLfDelta); i++) -+ info->mbModeLfDelta[i] = h->h.lf_delta.mode[i]; -+ -+ for (i = 0; i < FF_ARRAY_ELEMS(info->mbRefLfDelta); i++) -+ info->mbRefLfDelta[i] = h->h.lf_delta.ref[i]; -+ -+ for (i = 0; i < FF_ARRAY_ELEMS(info->mbSegmentTreeProbs); i++) -+ info->mbSegmentTreeProbs[i] = h->h.segmentation.prob[i]; -+ -+ for (i = 0; i < FF_ARRAY_ELEMS(info->activeRefIdx); i++) { -+ info->activeRefIdx[i] = h->h.refidx[i]; -+ info->segmentPredProbs[i] = h->h.segmentation.pred_prob[i]; -+ info->refFrameSignBias[i + 1] = h->h.signbias[i]; -+ } -+ -+ for (i = 0; i < FF_ARRAY_ELEMS(info->segmentFeatureEnable); i++) { -+ info->segmentFeatureEnable[i][0] = h->h.segmentation.feat[i].q_enabled; -+ info->segmentFeatureEnable[i][1] = h->h.segmentation.feat[i].lf_enabled; -+ info->segmentFeatureEnable[i][2] = h->h.segmentation.feat[i].ref_enabled; -+ info->segmentFeatureEnable[i][3] = h->h.segmentation.feat[i].skip_enabled; -+ -+ info->segmentFeatureData[i][0] = h->h.segmentation.feat[i].q_val; -+ info->segmentFeatureData[i][1] = h->h.segmentation.feat[i].lf_val; -+ info->segmentFeatureData[i][2] = h->h.segmentation.feat[i].ref_val; -+ info->segmentFeatureData[i][3] = 0; -+ } -+ -+ switch (avctx->colorspace) { -+ default: -+ case AVCOL_SPC_UNSPECIFIED: -+ info->colorSpace = 0; -+ break; -+ case AVCOL_SPC_BT470BG: -+ info->colorSpace = 1; -+ break; -+ case AVCOL_SPC_BT709: -+ info->colorSpace = 2; -+ break; -+ case AVCOL_SPC_SMPTE170M: -+ info->colorSpace = 3; -+ break; -+ case AVCOL_SPC_SMPTE240M: -+ info->colorSpace = 4; -+ break; -+ case AVCOL_SPC_BT2020_NCL: -+ info->colorSpace = 5; -+ break; -+ case AVCOL_SPC_RESERVED: -+ info->colorSpace = 6; -+ break; -+ case AVCOL_SPC_RGB: -+ info->colorSpace = 7; -+ break; -+ } -+ -+ return ff_vdpau_common_start_frame(pic_ctx, buffer, size); -+ -+} -+ -+static const uint8_t start_code_prefix[3] = { 0x00, 0x00, 0x01 }; -+ -+static int vdpau_vp9_decode_slice(AVCodecContext *avctx, -+ const uint8_t *buffer, uint32_t size) -+{ -+ VP9SharedContext *h = avctx->priv_data; -+ VP9Frame pic = h->frames[CUR_FRAME]; -+ struct vdpau_picture_context *pic_ctx = pic.hwaccel_picture_private; -+ -+ int val; -+ -+ val = ff_vdpau_add_buffer(pic_ctx, start_code_prefix, 3); -+ if (val) -+ return val; -+ -+ val = ff_vdpau_add_buffer(pic_ctx, buffer, size); -+ if (val) -+ return val; -+ -+ return 0; -+} -+ -+static int vdpau_vp9_end_frame(AVCodecContext *avctx) -+{ -+ VP9SharedContext *h = avctx->priv_data; -+ VP9Frame pic = h->frames[CUR_FRAME]; -+ struct vdpau_picture_context *pic_ctx = pic.hwaccel_picture_private; -+ -+ int val; -+ -+ val = ff_vdpau_common_end_frame(avctx, pic.tf.f, pic_ctx); -+ if (val < 0) -+ return val; -+ -+ return 0; -+} -+ -+static int vdpau_vp9_init(AVCodecContext *avctx) -+{ -+ VdpDecoderProfile profile; -+ uint32_t level = avctx->level; -+ -+ switch (avctx->profile) { -+ case FF_PROFILE_VP9_0: -+ profile = VDP_DECODER_PROFILE_VP9_PROFILE_0; -+ break; -+ case FF_PROFILE_VP9_1: -+ profile = VDP_DECODER_PROFILE_VP9_PROFILE_1; -+ break; -+ case FF_PROFILE_VP9_2: -+ profile = VDP_DECODER_PROFILE_VP9_PROFILE_2; -+ break; -+ case FF_PROFILE_VP9_3: -+ profile = VDP_DECODER_PROFILE_VP9_PROFILE_3; -+ break; -+ default: -+ return AVERROR(ENOTSUP); -+ } -+ -+ return ff_vdpau_common_init(avctx, profile, level); -+} -+ -+const AVHWAccel ff_vp9_vdpau_hwaccel = { -+ .name = "vp9_vdpau", -+ .type = AVMEDIA_TYPE_VIDEO, -+ .id = AV_CODEC_ID_VP9, -+ .pix_fmt = AV_PIX_FMT_VDPAU, -+ .start_frame = vdpau_vp9_start_frame, -+ .end_frame = vdpau_vp9_end_frame, -+ .decode_slice = vdpau_vp9_decode_slice, -+ .frame_priv_data_size = sizeof(struct vdpau_picture_context), -+ .init = vdpau_vp9_init, -+ .uninit = ff_vdpau_common_uninit, -+ .frame_params = ff_vdpau_common_frame_params, -+ .priv_data_size = sizeof(VDPAUContext), -+ .caps_internal = HWACCEL_CAP_ASYNC_SAFE, -+}; ---- libavcodec/vp9.c.orig 2019-08-05 20:52:21 UTC -+++ libavcodec/vp9.c -@@ -173,7 +173,8 @@ static int update_size(AVCodecContext *avctx, int w, i - #define HWACCEL_MAX (CONFIG_VP9_DXVA2_HWACCEL + \ - CONFIG_VP9_D3D11VA_HWACCEL * 2 + \ - CONFIG_VP9_NVDEC_HWACCEL + \ -- CONFIG_VP9_VAAPI_HWACCEL) -+ CONFIG_VP9_VAAPI_HWACCEL + \ -+ CONFIG_VP9_VDPAU_HWACCEL) - enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts; - VP9Context *s = avctx->priv_data; - uint8_t *p; -@@ -188,6 +189,9 @@ static int update_size(AVCodecContext *avctx, int w, i - - switch (s->pix_fmt) { - case AV_PIX_FMT_YUV420P: -+#if CONFIG_VP9_VDPAU_HWACCEL -+ *fmtp++ = AV_PIX_FMT_VDPAU; -+#endif - case AV_PIX_FMT_YUV420P10: - #if CONFIG_VP9_DXVA2_HWACCEL - *fmtp++ = AV_PIX_FMT_DXVA2_VLD; -@@ -1816,6 +1820,9 @@ AVCodec ff_vp9_decoder = { - #endif - #if CONFIG_VP9_VAAPI_HWACCEL - HWACCEL_VAAPI(vp9), -+#endif -+#if CONFIG_VP9_VDPAU_HWACCEL -+ HWACCEL_VDPAU(vp9), - #endif - NULL - }, diff --git a/media/ffmpeg/pkg-plist b/media/ffmpeg/pkg-plist index e99fe21d..4a97d520 100644 --- a/media/ffmpeg/pkg-plist +++ b/media/ffmpeg/pkg-plist @@ -5,12 +5,18 @@ include/libavcodec/adts_parser.h include/libavcodec/avcodec.h include/libavcodec/avdct.h include/libavcodec/avfft.h +include/libavcodec/bsf.h +include/libavcodec/codec_desc.h +include/libavcodec/codec_id.h +include/libavcodec/codec_par.h +include/libavcodec/codec.h include/libavcodec/d3d11va.h include/libavcodec/dirac.h include/libavcodec/dv_profile.h include/libavcodec/dxva2.h include/libavcodec/jni.h include/libavcodec/mediacodec.h +include/libavcodec/packet.h include/libavcodec/qsv.h include/libavcodec/vaapi.h include/libavcodec/vdpau.h @@ -52,6 +58,7 @@ include/libavutil/crc.h include/libavutil/des.h include/libavutil/dict.h include/libavutil/display.h +include/libavutil/dovi_meta.h include/libavutil/downmix_info.h include/libavutil/encryption_info.h include/libavutil/error.h @@ -68,10 +75,12 @@ include/libavutil/hwcontext_d3d11va.h include/libavutil/hwcontext_drm.h include/libavutil/hwcontext_dxva2.h include/libavutil/hwcontext_mediacodec.h +include/libavutil/hwcontext_opencl.h include/libavutil/hwcontext_qsv.h include/libavutil/hwcontext_vaapi.h include/libavutil/hwcontext_vdpau.h include/libavutil/hwcontext_videotoolbox.h +include/libavutil/hwcontext_vulkan.h include/libavutil/hwcontext.h include/libavutil/imgutils.h include/libavutil/intfloat.h @@ -110,6 +119,7 @@ include/libavutil/tree.h include/libavutil/twofish.h include/libavutil/tx.h include/libavutil/version.h +include/libavutil/video_enc_params.h include/libavutil/xtea.h include/libpostproc/postprocess.h include/libpostproc/version.h diff --git a/media/libaom/Makefile b/media/libaom/Makefile new file mode 100644 index 00000000..91e8729f --- /dev/null +++ b/media/libaom/Makefile @@ -0,0 +1,34 @@ +# $FreeBSD: head/multimedia/aom/Makefile 556427 2020-11-27 03:20:57Z jbeich $ + +PORTNAME= aom +DISTVERSIONPREFIX= v +DISTVERSION= 2.0.1 +CATEGORIES= multimedia +PKGNAMEPREFIX= lib + +MAINTAINER= jbeich@FreeBSD.org +COMMENT= AV1 reference encoder/decoder + +BUILD_DEPENDS= ${BUILD_DEPENDS_${ARCH}} +BUILD_DEPENDS_amd64= nasm:devel/nasm +BUILD_DEPENDS_i386= nasm:devel/nasm + +USES= cmake compiler:c++11-lib perl5 +USE_GITHUB= yes +USE_PERL5= build +USE_LDCONFIG= yes +GH_ACCOUNT= jbeich # mirror +CMAKE_ARGS+= -DBUILD_SHARED_LIBS:BOOL=YES + + +#VMAF_DESC= Encoding tuning for VMAF +#VMAF_LIB_DEPENDS= libvmaf.so:multimedia/vmaf +#VMAF_USES= localbase:ldflags +#VMAF_CMAKE_ON= -DCONFIG_TUNE_VMAF:STRING=1 + +post-patch: +# Extract (snapshot) version from the port instead of CHANGELOG + ${REINPLACE_CMD} 's,$${AOM_ROOT}/CHANGELOG,${DISTVERSIONFULL:S/^v//},' \ + ${WRKSRC}/build/cmake/version.cmake + +.include diff --git a/media/libaom/distinfo b/media/libaom/distinfo new file mode 100644 index 00000000..b7bd9cca --- /dev/null +++ b/media/libaom/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1606336979 +SHA256 (jbeich-aom-v2.0.1_GH0.tar.gz) = 6d291ae8bd47cb9504644737c6f33ccddbf1ef5d83c4246cd76b622ba914fd5e +SIZE (jbeich-aom-v2.0.1_GH0.tar.gz) = 3507738 diff --git a/media/libaom/files/patch-aom__ports_arm__cpudetect.c b/media/libaom/files/patch-aom__ports_arm__cpudetect.c new file mode 100644 index 00000000..30509f0b --- /dev/null +++ b/media/libaom/files/patch-aom__ports_arm__cpudetect.c @@ -0,0 +1,73 @@ +- Assume NEON is enabled on aarch64 +- Implement NEON runtime detection on FreeBSD + +--- aom_ports/arm_cpudetect.c.orig 2018-11-16 20:24:20 UTC ++++ aom_ports/arm_cpudetect.c +@@ -38,7 +38,7 @@ static int arm_cpu_env_mask(void) { + return env && *env ? (int)strtol(env, NULL, 0) : ~0; + } + +-#if !CONFIG_RUNTIME_CPU_DETECT ++#if !CONFIG_RUNTIME_CPU_DETECT || defined(__ARM_NEON) + + int aom_arm_cpu_caps(void) { + /* This function should actually be a no-op. There is no way to adjust any of +@@ -143,7 +143,57 @@ int aom_arm_cpu_caps(void) { + } + return flags & mask; + } +-#else /* end __linux__ */ ++#elif defined(__FreeBSD__) ++ ++#if __FreeBSD__ < 12 ++#include ++#include ++#include ++#include ++#include ++ ++static unsigned long getauxval(unsigned long type) { ++ Elf_Auxinfo auxv[AT_COUNT]; ++ size_t len = sizeof(auxv); ++ int mib[] = { ++ CTL_KERN, ++ KERN_PROC, ++ KERN_PROC_AUXV, ++ getpid(), ++ }; ++ ++ if (sysctl(mib, nitems(mib), auxv, &len, NULL, 0) != -1) { ++ for (size_t i = 0; i < nitems(auxv); i++) ++ if ((unsigned long)auxv[i].a_type == type) ++ return auxv[i].a_un.a_val; ++ ++ errno = ENOENT; ++ } ++ return 0; ++} ++#else ++#include ++#endif ++ ++int aom_arm_cpu_caps(void) { ++ int flags; ++ int mask; ++ u_long hwcap = 0; ++ if (!arm_cpu_env_flags(&flags)) { ++ return flags; ++ } ++ mask = arm_cpu_env_mask(); ++#if __FreeBSD__ < 12 ++ hwcap = getauxval(AT_HWCAP); ++#else ++ elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap)); ++#endif ++#if HAVE_NEON ++ if (hwcap & HWCAP_NEON) flags |= HAS_NEON; ++#endif ++ return flags & mask; ++} ++#else /* end __FreeBSD__ */ + #error \ + "--enable-runtime-cpu-detect selected, but no CPU detection method " \ + "available for your platform. Reconfigure with --disable-runtime-cpu-detect." diff --git a/media/libaom/files/patch-aom__ports_ppc__cpudetect.c b/media/libaom/files/patch-aom__ports_ppc__cpudetect.c new file mode 100644 index 00000000..c30c2194 --- /dev/null +++ b/media/libaom/files/patch-aom__ports_ppc__cpudetect.c @@ -0,0 +1,76 @@ +- Implement VSX detection on FreeBSD + +--- aom_ports/ppc_cpudetect.c.orig 2018-06-25 14:54:59 UTC ++++ aom_ports/ppc_cpudetect.c +@@ -9,12 +9,6 @@ + * PATENTS file, you can obtain it at www.aomedia.org/license/patent. + */ + +-#include +-#include +-#include +-#include +-#include +- + #include "config/aom_config.h" + + #include "aom_ports/ppc.h" +@@ -37,6 +31,13 @@ static int cpu_env_mask(void) { + return env && *env ? (int)strtol(env, NULL, 0) : ~0; + } + ++#if defined(__linux__) ++#include ++#include ++#include ++#include ++#include ++ + int ppc_simd_caps(void) { + int flags; + int mask; +@@ -75,6 +76,44 @@ out_close: + close(fd); + return flags & mask; + } ++#elif defined(__FreeBSD__) ++#if __FreeBSD__ < 12 ++#include ++#include ++#else ++#include ++#endif ++#include ++ ++int ppc_simd_caps(void) { ++ int flags; ++ int mask; ++ u_long hwcap = 0; ++ ++ // If AOM_SIMD_CAPS is set then allow only those capabilities. ++ if (!cpu_env_flags(&flags)) { ++ return flags; ++ } ++ ++ mask = cpu_env_mask(); ++ ++#if __FreeBSD__ < 12 ++ size_t sz = sizeof(hwcap); ++ sysctlbyname("hw.cpu_features", &hwcap, &sz, NULL, 0); ++#else ++ elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap)); ++#endif ++#if HAVE_VSX ++ if (hwcap & PPC_FEATURE_HAS_VSX) flags |= HAS_VSX; ++#endif ++ ++ return flags & mask; ++} ++#else ++#error \ ++ "--enable-runtime-cpu-detect selected, but no CPU detection method " \ ++"available for your platform. Reconfigure with --disable-runtime-cpu-detect." ++#endif /* end __FreeBSD__ */ + #else + // If there is no RTCD the function pointers are not used and can not be + // changed. diff --git a/media/libaom/files/patch-build_cmake_aom__configure.cmake b/media/libaom/files/patch-build_cmake_aom__configure.cmake new file mode 100644 index 00000000..25d9467d --- /dev/null +++ b/media/libaom/files/patch-build_cmake_aom__configure.cmake @@ -0,0 +1,32 @@ +- FreeBSD and NetBSD powerpc* targets don't abbreviate to ppc* +- ARM uses compiler intrinsics, so don't require GNU as + +--- build/cmake/aom_configure.cmake.orig 2020-02-07 16:59:05 UTC ++++ build/cmake/aom_configure.cmake +@@ -74,7 +74,7 @@ if(NOT AOM_TARGET_CPU) + set(AOM_TARGET_CPU "${cpu_lowercase}") + elseif("${cpu_lowercase}" MATCHES "aarch64") + set(AOM_TARGET_CPU "arm64") +- elseif("${cpu_lowercase}" MATCHES "^ppc") ++ elseif("${cpu_lowercase}" MATCHES "^ppc|^powerpc") + set(AOM_TARGET_CPU "ppc") + else() + message(WARNING "The architecture ${CMAKE_SYSTEM_PROCESSOR} is not " +@@ -162,17 +162,6 @@ elseif("${AOM_TARGET_CPU}" MATCHES "arm") + set(AS_EXECUTABLE as) + endif() + endif() +- find_program(as_executable_found ${AS_EXECUTABLE}) +- if(NOT as_executable_found) +- message( +- FATAL_ERROR +- "Unable to find assembler and optimizations are enabled." +- "Searched for ${AS_EXECUTABLE}. Install it, add it to your path, or " +- "set the assembler directly by adding -DAS_EXECUTABLE= " +- "to your CMake command line." +- "To build without optimizations, add -DAOM_TARGET_CPU=generic to your " +- "cmake command line.") +- endif() + string(STRIP "${AOM_AS_FLAGS}" AOM_AS_FLAGS) + endif() + diff --git a/media/libaom/files/patch-build_cmake_cpu.cmake b/media/libaom/files/patch-build_cmake_cpu.cmake new file mode 100644 index 00000000..26fe6890 --- /dev/null +++ b/media/libaom/files/patch-build_cmake_cpu.cmake @@ -0,0 +1,13 @@ +- Don't enable NEON on armv6 similar to build/cmake/rtcd.pl + +--- build/cmake/cpu.cmake.orig 2018-11-16 20:24:20 UTC ++++ build/cmake/cpu.cmake +@@ -9,7 +9,7 @@ + # can obtain it at www.aomedia.org/license/patent. + # + +-if("${AOM_TARGET_CPU}" MATCHES "^arm") ++if("${AOM_TARGET_CPU}" MATCHES "^arm" AND NOT "${AOM_TARGET_CPU}" MATCHES "^armv6") + set(ARCH_ARM 1) + set(RTCD_ARCH_ARM "yes") + diff --git a/media/libaom/files/patch-x-CMakeLists.txt b/media/libaom/files/patch-x-CMakeLists.txt new file mode 100644 index 00000000..676fb004 --- /dev/null +++ b/media/libaom/files/patch-x-CMakeLists.txt @@ -0,0 +1,20 @@ +--- ./CMakeLists.txt.orig 2020-11-25 22:42:59.000000000 +0200 ++++ ./CMakeLists.txt 2020-12-07 10:36:29.971983000 +0200 +@@ -252,7 +252,7 @@ + # libaom.so.VERSION + # cmake-format: on + set_target_properties(aom PROPERTIES SOVERSION ${SO_VERSION}) +- set_target_properties(aom PROPERTIES VERSION ${SO_FILE_VERSION}) ++ set_target_properties(aom PROPERTIES VERSION ${SO_VERSION}) + endif() + endif() + +@@ -433,7 +433,7 @@ + ${AOM_ENCODER_TOOL_TARGETS}) + + if(CONFIG_TUNE_VMAF) +- find_library(VMAF libvmaf.a vmaf) ++ find_library(VMAF vmaf) + if(NOT VMAF) + message(FATAL_ERROR "VMAF library not found.") + endif() diff --git a/media/libaom/pkg-descr b/media/libaom/pkg-descr new file mode 100644 index 00000000..77aca114 --- /dev/null +++ b/media/libaom/pkg-descr @@ -0,0 +1,7 @@ +AOMedia Video 1 (AV1), is an open, royalty-free video coding format +designed for video transmissions over the Internet. It is being +developed by the Alliance for Open Media (AOMedia), a consortium of +firms from the semiconductor industry, video on demand providers, and +web browser developers, founded in 2015. + +WWW: https://aomedia.org/ diff --git a/media/libaom/pkg-plist b/media/libaom/pkg-plist new file mode 100644 index 00000000..9d65e94c --- /dev/null +++ b/media/libaom/pkg-plist @@ -0,0 +1,16 @@ +bin/aomdec +bin/aomenc +include/aom/aom_codec.h +include/aom/aom_decoder.h +include/aom/aom_encoder.h +include/aom/aom_frame_buffer.h +include/aom/aom_image.h +include/aom/aom_integer.h +include/aom/aom.h +include/aom/aomcx.h +include/aom/aomdx.h +lib/libaom.a +lib/libaom.so +lib/libaom.so.2 +lib/pkgconfig/aom.pc +@dir include/aom diff --git a/media/libopenh264/Makefile b/media/libopenh264/Makefile new file mode 100644 index 00000000..89204674 --- /dev/null +++ b/media/libopenh264/Makefile @@ -0,0 +1,34 @@ +# $FreeBSD: head/multimedia/openh264/Makefile 536182 2020-05-22 02:28:22Z jbeich $ + +PORTNAME= openh264 +DISTVERSIONPREFIX=v +DISTVERSION= 2.1.1 +CATEGORIES= multimedia +PKGNAMEPREFIX= lib + +MAINTAINER= gecko@FreeBSD.org +COMMENT= Cisco implementation of H.264 codec + +USE_GITHUB= yes +GH_ACCOUNT= cisco + +USES= gmake +USE_LDCONFIG= yes +MAKE_ARGS= PREFIX="${PREFIX}" +MAKE_ARGS+= OS=bsd ARCH="${ARCH:S/amd64/x86_64/}" +MAKE_ARGS+= CCASFLAGS='$$(CFLAGS) ${ASFLAGS}' +MAKE_ARGS+= CFLAGS_OPT="" CFLAGS_DEBUG="" +ALL_TARGET= all +LDFLAGS_i386= -Wl,-znotext + +post-patch: + ${REINPLACE_CMD} -e '/gtest-targets\.mk/d' \ + ${WRKSRC}/Makefile + +pre-build: + ${LN} -sf ${LOCALBASE}/lib/libgtest.so ${WRKSRC}/libgtest.a + +post-install: + ${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/lib${PORTNAME}.so.* + +.include diff --git a/media/libopenh264/distinfo b/media/libopenh264/distinfo new file mode 100644 index 00000000..293d6a28 --- /dev/null +++ b/media/libopenh264/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1590049824 +SHA256 (cisco-openh264-v2.1.1_GH0.tar.gz) = af173e90fce65f80722fa894e1af0d6b07572292e76de7b65273df4c0a8be678 +SIZE (cisco-openh264-v2.1.1_GH0.tar.gz) = 60239654 diff --git a/media/libopenh264/files/_patch-Makefile b/media/libopenh264/files/_patch-Makefile new file mode 100644 index 00000000..40cc9e5c --- /dev/null +++ b/media/libopenh264/files/_patch-Makefile @@ -0,0 +1,13 @@ +# Force gmp plugin to link dynamically against libopenh264 + +--- Makefile.orig 2017-06-16 04:20:14 UTC ++++ Makefile +@@ -263,7 +263,7 @@ endif + echo-plugin-name: + @echo $(MODULE) + +-$(LIBPREFIX)$(MODULE_NAME).$(SHAREDLIBSUFFIXFULLVER): $(MODULE_OBJS) $(ENCODER_OBJS) $(DECODER_OBJS) $(PROCESSING_OBJS) $(COMMON_OBJS) ++$(LIBPREFIX)$(MODULE_NAME).$(SHAREDLIBSUFFIXFULLVER): $(MODULE_OBJS) $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIX) + $(QUIET)rm -f $@ + $(QUIET_CXX)$(CXX) $(SHARED) $(CXX_LINK_O) $+ $(LDFLAGS) $(SHLDFLAGS) $(MODULE_LDFLAGS) + ifeq (True, $(PROCESS_FILES)) diff --git a/media/libopenh264/files/gmpopenh264.js.in b/media/libopenh264/files/gmpopenh264.js.in new file mode 100644 index 00000000..a2437410 --- /dev/null +++ b/media/libopenh264/files/gmpopenh264.js.in @@ -0,0 +1,3 @@ +pref("media.gmp-gmpopenh264.autoupdate", false); +pref("media.gmp-gmpopenh264.lastUpdate", %%TIMESTAMP%%); +pref("media.gmp-gmpopenh264.version", "%%PORTVERSION%%"); diff --git a/media/libopenh264/files/patch-codec_common_src_cpu.cpp b/media/libopenh264/files/patch-codec_common_src_cpu.cpp new file mode 100644 index 00000000..27a2e122 --- /dev/null +++ b/media/libopenh264/files/patch-codec_common_src_cpu.cpp @@ -0,0 +1,23 @@ +--- codec/common/src/cpu.cpp.orig 2015-03-25 07:43:00 UTC ++++ codec/common/src/cpu.cpp +@@ -276,9 +276,17 @@ uint32_t WelsCPUFeatureDetect (int32_t* + * that NEON and all associated features are available. */ + + uint32_t WelsCPUFeatureDetect (int32_t* pNumberOfLogicProcessors) { +- return WELS_CPU_ARMv7 | +- WELS_CPU_VFPv3 | +- WELS_CPU_NEON; ++ int flags = 0; ++# if __ARM_ARCH >= 7 ++ flags |= WELS_CPU_ARMv7; ++# endif ++# ifdef __ARM_VFPV3__ ++ flags |= WELS_CPU_VFPv3; ++# endif ++# ifdef __ARM_NEON ++ flags |= WELS_CPU_NEON; ++# endif ++ return flags; + } + #endif + #elif defined(HAVE_NEON_AARCH64) diff --git a/media/libopenh264/files/patch-x-Makefile b/media/libopenh264/files/patch-x-Makefile new file mode 100644 index 00000000..894aa0f9 --- /dev/null +++ b/media/libopenh264/files/patch-x-Makefile @@ -0,0 +1,54 @@ +--- ./Makefile.orig 2020-05-21 10:30:24.000000000 +0200 ++++ ./Makefile 2020-12-07 23:13:16.776123000 +0200 +@@ -246,10 +246,10 @@ + + ifneq ($(SHAREDLIBSUFFIXFULLVER),$(SHAREDLIBSUFFIX)) + $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIX): $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXFULLVER) +- $(QUIET)ln -sfn $+ $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXMAJORVER) ++# $(QUIET)ln -sfn $+ $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXMAJORVER) + $(QUIET)ln -sfn $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXMAJORVER) $@ + ifeq (True, $(PROCESS_FILES)) +- $(QUIET)ln -sfn $(LIBPREFIX)$(PROJECT_NAME)$(DEBUGSYMBOLS_TAG).$(SHAREDLIBSUFFIXFULLVER) $(LIBPREFIX)$(PROJECT_NAME)$(DEBUGSYMBOLS_TAG).$(SHAREDLIBSUFFIXMAJORVER) ++# $(QUIET)ln -sfn $(LIBPREFIX)$(PROJECT_NAME)$(DEBUGSYMBOLS_TAG).$(SHAREDLIBSUFFIXFULLVER) $(LIBPREFIX)$(PROJECT_NAME)$(DEBUGSYMBOLS_TAG).$(SHAREDLIBSUFFIXMAJORVER) + $(QUIET)ln -sfn $(LIBPREFIX)$(PROJECT_NAME)$(DEBUGSYMBOLS_TAG).$(SHAREDLIBSUFFIXMAJORVER) $(LIBPREFIX)$(PROJECT_NAME)$(DEBUGSYMBOLS_TAG).$(SHAREDLIBSUFFIX) + endif + endif +@@ -266,7 +266,7 @@ + echo-plugin-name: + @echo $(MODULE) + +-$(LIBPREFIX)$(MODULE_NAME).$(SHAREDLIBSUFFIXFULLVER): $(MODULE_OBJS) $(ENCODER_OBJS) $(DECODER_OBJS) $(PROCESSING_OBJS) $(COMMON_OBJS) ++$(LIBPREFIX)$(MODULE_NAME).$(SHAREDLIBSUFFIXFULLVER): $(MODULE_OBJS) $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIX) + $(QUIET)rm -f $@ + $(QUIET_CXX)$(CXX) $(SHARED) $(CXX_LINK_O) $+ $(LDFLAGS) $(SHLDFLAGS) $(MODULE_LDFLAGS) + ifeq (True, $(PROCESS_FILES)) +@@ -299,8 +299,8 @@ + install -m 644 $(LIBPREFIX)$(PROJECT_NAME).$(LIBSUFFIX) $(DESTDIR)$(PREFIX)/$(LIBDIR_NAME) + + install-static: install-static-lib $(PROJECT_NAME)-static.pc +- mkdir -p $(DESTDIR)$(PREFIX)/$(LIBDIR_NAME)/pkgconfig +- install -m 644 $(PROJECT_NAME)-static.pc $(DESTDIR)$(PREFIX)/$(LIBDIR_NAME)/pkgconfig/$(PROJECT_NAME).pc ++ mkdir -p $(DESTDIR)$(PREFIX)/lib/pkgconfig ++ install -m 644 $(PROJECT_NAME)-static.pc $(DESTDIR)$(PREFIX)/lib/pkgconfig/$(PROJECT_NAME).pc + + install-shared: $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIX) install-headers $(PROJECT_NAME).pc + mkdir -p $(DESTDIR)$(SHAREDLIB_DIR) +@@ -309,8 +309,8 @@ + cp -a $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXMAJORVER) $(DESTDIR)$(SHAREDLIB_DIR) ; \ + cp -a $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIX) $(DESTDIR)$(SHAREDLIB_DIR) ; \ + fi +- mkdir -p $(DESTDIR)$(PREFIX)/$(LIBDIR_NAME)/pkgconfig +- install -m 644 $(PROJECT_NAME).pc $(DESTDIR)$(PREFIX)/$(LIBDIR_NAME)/pkgconfig ++ mkdir -p $(DESTDIR)$(PREFIX)/lib/pkgconfig ++ install -m 644 $(PROJECT_NAME).pc $(DESTDIR)$(PREFIX)/lib/pkgconfig + ifneq ($(EXTRA_LIBRARY),) + install -m 644 $(EXTRA_LIBRARY) $(DESTDIR)$(PREFIX)/$(LIBDIR_NAME) + endif +@@ -322,7 +322,6 @@ + binaries: + @: + else +-include $(SRC_PATH)build/gtest-targets.mk + include $(SRC_PATH)test/api/targets.mk + include $(SRC_PATH)test/decoder/targets.mk + include $(SRC_PATH)test/encoder/targets.mk diff --git a/media/libopenh264/files/patch-x-build-platform-bsd.mk b/media/libopenh264/files/patch-x-build-platform-bsd.mk new file mode 100644 index 00000000..0630cfca --- /dev/null +++ b/media/libopenh264/files/patch-x-build-platform-bsd.mk @@ -0,0 +1,10 @@ +--- ./build/platform-bsd.mk.orig 2020-05-21 10:30:24.000000000 +0200 ++++ ./build/platform-bsd.mk 2020-12-07 23:10:41.407202000 +0200 +@@ -1,6 +1,6 @@ + include $(SRC_PATH)build/arch.mk + SHAREDLIBSUFFIX = so +-SHAREDLIBSUFFIXFULLVER=$(SHAREDLIBSUFFIX).$(FULL_VERSION) ++SHAREDLIBSUFFIXFULLVER=$(SHAREDLIBSUFFIX).$(SHAREDLIB_MAJORVERSION) + SHAREDLIBSUFFIXMAJORVER=$(SHAREDLIBSUFFIX).$(SHAREDLIB_MAJORVERSION) + SHLDFLAGS = -Wl,-soname,$(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXMAJORVER) + CFLAGS += -fPIC -fstack-protector-all diff --git a/media/libopenh264/pkg-descr b/media/libopenh264/pkg-descr new file mode 100644 index 00000000..b8ab318b --- /dev/null +++ b/media/libopenh264/pkg-descr @@ -0,0 +1,4 @@ +OpenH264 is a codec library which supports H.264 encoding and decoding. +It is suitable for use in real time applications such as WebRTC. + +WWW: http://www.openh264.org/ diff --git a/media/libopenh264/pkg-plist b/media/libopenh264/pkg-plist new file mode 100644 index 00000000..41f37819 --- /dev/null +++ b/media/libopenh264/pkg-plist @@ -0,0 +1,9 @@ +include/wels/codec_api.h +include/wels/codec_app_def.h +include/wels/codec_def.h +include/wels/codec_ver.h +lib/libopenh264.a +lib/libopenh264.so +lib/libopenh264.so.6 +lib/pkgconfig/openh264.pc +@dir include/wels diff --git a/media/libx264/Makefile b/media/libx264/Makefile index 5c646e61..07aaa95f 100644 --- a/media/libx264/Makefile +++ b/media/libx264/Makefile @@ -1,59 +1,45 @@ # # $Id$ # -PORTNAME= libx264 +PORTNAME= x264 PORTVERSION= 0.${X264_BUILD}.${X264_REV} CATEGORIES= multimedia -MASTER_SITES+= ftp://ftp.videolan.org/pub/videolan/x264/snapshots/ -#MASTER_SITES+= http://samples.mplayerhq.hu/yuv4mpeg2/:pgo -DISTNAME= x264-snapshot-${X264_SNAPSHOT}-2245-stable -DISTFILES= ${DISTNAME}${EXTRACT_SUFX} DIST_SUBDIR= libx264 EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX} +PKGNAMEPREFIX= lib MAINTAINER= onborodin@gmail.com COMMENT= Library for encoding H.264/MPEG-4 AVC video -#BUILD_DEPENDS+= yasm:devel/yasm +BUILD_DEPENDS+= yasm:devel/yasm BUILD_DEPENDS+= bash:lang/bash -#X264_BUILD= 142 -#X264_REV= 2455 -#X264_COMMIT= 021c0dc6c95c1bc239c9db78a80dd85fc856a4dd -#X264_GITVER= ${X264_COMMIT:C/^(.......).*$/\1/g} -#X264_SNAPSHOT= 20140827 +X264_BUILD= 161 +X264_REV= 3020 +X264_GITVER= ${GL_COMMIT:C/^(.{7}).*/\1/} +X264_COMMIT= d198931a63049db1f2c92d96c34904c69fde8117 -#X264_BUILD= 148 -#X264_REV= 2728 -#X264_COMMIT= 4d5c8b01a48f72f9c40651e92c39294326a0863f -#X264_GITVER= ${X264_COMMIT:C/^(.......).*$/\1/g} -#X264_SNAPSHOT= 20161202 -#X264_BUILD= 155 -#X264_REV= 2917 -#X264_COMMIT= 0a84d986e7020f8344f00752e3600b9769cc1e85 -#X264_GITVER= ${X264_COMMIT:C/^(.......).*$/\1/g} -#X264_SNAPSHOT= 20180807 - -X264_BUILD= 148 -X264_REV= 2795 -X264_COMMIT= aaa9aa83a111ed6f1db253d5afa91c5fc844583f -X264_GITVER= ${X264_COMMIT:C/^(.......).*$/\1/g} -X264_SNAPSHOT= 20170626 +USE_GITLAB= yes +GL_SITE= https://code.videolan.org +GL_ACCOUNT= videolan +GL_COMMIT= d198931a63049db1f2c92d96c34904c69fde8117 USES+= gmake -USES+= tar:bzip2 USE_LDCONFIG= yes HAS_CONFIGURE= yes CONFIGURE_ARGS+= --disable-asm #CONFIGURE_ARGS+= --enable-debug -CONFIGURE_ARGS+= --bit-depth=10 +#CONFIGURE_ARGS+= --bit-depth=10 CONFIGURE_ARGS+= --extra-cflags="-I${LOCALBASE}/include" CONFIGURE_ARGS+= --extra-ldflags="-L${LOCALBASE}/lib" CONFIGURE_ARGS+= --enable-static --enable-shared CONFIGURE_ARGS+= --disable-opencl +CFLAGS+= -pthread +LDFLAGS+= -pthread + post-patch: ${REINPLACE_CMD} -e 's|/usr/local|${PREFIX}|; \ @@ -66,6 +52,9 @@ post-patch: s|VERSION=""|VERSION=" r${X264_REV} ${X264_GITVER}"|' \ ${WRKSRC}/version.sh +post-configure: + ${REINPLACE_CMD} -e 's,X264_BUILD 142,X264_BUILD 161,' ${WRKSRC}/x264.h + #post-install: # ${RM} ${PREFIX}/bin/x264 # ${STRIP_CMD} ${PREFIX}/lib/libx264.so.* diff --git a/media/libx264/distinfo b/media/libx264/distinfo index 7d64126e..ae1a85a2 100644 --- a/media/libx264/distinfo +++ b/media/libx264/distinfo @@ -1,2 +1,3 @@ -SHA256 (libx264/x264-snapshot-20170626-2245-stable.tar.bz2) = 0fe3e49eb8861b8fc429436070fb2dd525d141904a44487c48d1c2d6ad778eae -SIZE (libx264/x264-snapshot-20170626-2245-stable.tar.bz2) = 736446 +TIMESTAMP = 1607373625 +SHA256 (libx264/videolan-x264-d198931a63049db1f2c92d96c34904c69fde8117_GL0.tar.gz) = 3474023542414706ed0620a5438ce5c700bdedede323831746384a971f0565fd +SIZE (libx264/videolan-x264-d198931a63049db1f2c92d96c34904c69fde8117_GL0.tar.gz) = 934108 diff --git a/media/libx264/files/patch-Makefile b/media/libx264/files/patch-Makefile new file mode 100644 index 00000000..4ddae76c --- /dev/null +++ b/media/libx264/files/patch-Makefile @@ -0,0 +1,13 @@ +-T (treat DEST as a normal file) is not supported by BSD install(1) + +--- Makefile.orig 2020-09-12 17:23:57 UTC ++++ Makefile +@@ -413,7 +413,7 @@ endif + install-bashcompletion: + ifneq ($(BASHCOMPLETIONSDIR),) + $(INSTALL) -d $(DESTDIR)$(BASHCOMPLETIONSDIR) +- $(INSTALL) -m 644 -T $(SRCPATH)/tools/bash-autocomplete.sh $(DESTDIR)$(BASHCOMPLETIONSDIR)/x264 ++ $(INSTALL) -m 644 $(SRCPATH)/tools/bash-autocomplete.sh $(DESTDIR)$(BASHCOMPLETIONSDIR)/x264 + endif + + uninstall: diff --git a/media/libx264/files/patch-configure b/media/libx264/files/patch-configure index 8234febf..1e13cfac 100644 --- a/media/libx264/files/patch-configure +++ b/media/libx264/files/patch-configure @@ -1,6 +1,6 @@ ---- configure.orig 2017-06-26 20:45:05 UTC +--- configure.orig 2020-09-12 17:23:57 UTC +++ configure -@@ -682,12 +682,6 @@ case $host_cpu in +@@ -743,12 +743,6 @@ case $host_cpu in AS_EXT=".asm" ASFLAGS="$ASFLAGS -DARCH_X86_64=0 -I\$(SRCPATH)/common/x86/" if [ $compiler = GNU ]; then @@ -13,16 +13,16 @@ CFLAGS="-m32 $CFLAGS" LDFLAGS="-m32 $LDFLAGS" fi -@@ -702,7 +696,7 @@ case $host_cpu in +@@ -763,7 +757,7 @@ case $host_cpu in ASFLAGS="$ASFLAGS -f elf32" fi ;; - x86_64) + amd64|x86_64) ARCH="X86_64" - AS="${AS-yasm}" + AS="${AS-nasm}" AS_EXT=".asm" -@@ -776,7 +770,7 @@ case $host_cpu in +@@ -839,7 +833,7 @@ case $host_cpu in AS="${AS-${CC}}" fi ;; @@ -30,17 +30,17 @@ + aarch64|arm64) ARCH="AARCH64" stack_alignment=16 - AS="${AS-${CC}}" -@@ -875,7 +869,7 @@ elif [ $compiler = ICC -a $ARCH = X86 ]; then + if [ "$SYS" = MACOSX ] ; then +@@ -952,7 +946,7 @@ if cc_check '' '' '' '__attribute__((force_align_arg_p fi fi -if [ $asm = auto -a \( $ARCH = X86 -o $ARCH = X86_64 \) ] ; then +if [ $cli_libx264 != system -a $asm = auto -a \( $ARCH = X86 -o $ARCH = X86_64 \) ] ; then - if ! as_check "vpmovzxwd ymm0, xmm0" ; then - VER=`($AS --version || echo no assembler) 2>/dev/null | head -n 1` + if ! as_check "vmovdqa32 [eax]{k1}{z}, zmm0" ; then + VER="$( ($AS --version || echo no assembler) 2>/dev/null | head -n 1 )" echo "Found $VER" -@@ -889,9 +883,6 @@ if [ $asm = auto -a \( $ARCH = X86 -o $ARCH = X86_64 \ +@@ -965,9 +959,6 @@ if [ $asm = auto -a \( $ARCH = X86 -o $ARCH = X86_64 \ fi if [ $asm = auto -a $ARCH = ARM ] ; then @@ -50,7 +50,7 @@ cc_check '' '' '__asm__("add r0, r1, r2");' && define HAVE_ARM_INLINE_ASM if [ $compiler = CL ] && cpp_check '' '' 'defined(_M_ARM) && _M_ARM >= 7' ; then define HAVE_ARMV6 -@@ -902,9 +893,8 @@ if [ $asm = auto -a $ARCH = ARM ] ; then +@@ -978,9 +969,8 @@ if [ $asm = auto -a $ARCH = ARM ] ; then cc_check '' '' '__asm__("vadd.i16 q0, q0, q0");' && define HAVE_NEON ASFLAGS="$ASFLAGS -c" else @@ -62,7 +62,7 @@ fi fi -@@ -931,9 +921,8 @@ if [ $asm = auto -a $ARCH = MIPS ] ; then +@@ -1012,9 +1002,8 @@ if [ $asm = auto -a $ARCH = MIPS ] ; then if cc_check '' '' '__asm__("addvi.b $w0, $w1, 1");' ; then define HAVE_MSA else @@ -74,7 +74,7 @@ fi fi -@@ -1245,10 +1234,6 @@ if cc_check '' -Wshadow ; then +@@ -1343,10 +1332,6 @@ if cc_check '' -Wshadow ; then CFLAGS="-Wshadow $CFLAGS" fi @@ -82,16 +82,16 @@ - CFLAGS="-Wno-maybe-uninitialized $CFLAGS" -fi - - if [ $compiler = ICC -o $compiler = ICL ] ; then - if cc_check 'extras/intel_dispatcher.h' '' 'x264_intel_dispatcher_override();' ; then - define HAVE_INTEL_DISPATCHER -@@ -1284,6 +1269,9 @@ if [ "$opencl" = "yes" ]; then + if [ $compiler = GNU ] && cc_check '' -fvisibility=hidden ; then + CFLAGS="$CFLAGS -fvisibility=hidden" + fi +@@ -1386,6 +1371,9 @@ if [ "$opencl" = "yes" ]; then opencl="yes" - define HAVE_OPENCL + define HAVE_OPENCL "(BIT_DEPTH==8)" libdl="-ldl" + else + opencl="yes" -+ define HAVE_OPENCL ++ define HAVE_OPENCL "(BIT_DEPTH==8)" fi LDFLAGS="$LDFLAGS $libdl" fi diff --git a/media/libx264/files/patch-x-x264.h b/media/libx264/files/patch-x-x264.h index f7af8339..0c0d7049 100644 --- a/media/libx264/files/patch-x-x264.h +++ b/media/libx264/files/patch-x-x264.h @@ -4,7 +4,7 @@ #include "x264_config.h" --#define X264_BUILD 148 +-#define X264_BUILD 161 +#define X264_BUILD 142 /* Application developers planning to link against a shared library version of