$ git diff --patch-with-stat --summary 482e150fdef227edcf1dd62a511c02ce14a134be..cd55c0a7b293c3e8396838cd82c9e1fb7da6a5b6
.abf.yml | 4 +-
.onedev-buildspec.yml | 4 +
078322f33ced4b2db6ac3e5002f98233d6fbf643.patch | 6 +-
ffmpeg-1.0.1-time.h.patch | 2 +-
...5-fix-build-with-flto-and-inline-assembly.patch | 59 +-
...open-faac-mp3lame-opencore-x264-x265-xvid.patch | 192 ++---
ffmpeg-4.4-add-accessors-for-AVStream.patch | 8 +-
ffmpeg-5.1.2-fix-vulkan.patch | 14 +
...-e06ce6d2b45edac4a2df04f304e18d4727417d24.patch | 110 +++
ffmpeg.spec | 159 +++--
libsvtav1_rename_aq_mode.patch | 27 +
...001-Add-ability-for-ffmpeg-to-run-svt-vp9.patch | 788 +++++++++++++++++++++
restricted-defines.macros | 4 +-
13 files changed, 1170 insertions(+), 207 deletions(-)
create mode 100644 .onedev-buildspec.yml
create mode 100644 ffmpeg-5.1.2-fix-vulkan.patch
create mode 100644 ffmpeg-e06ce6d2b45edac4a2df04f304e18d4727417d24.patch
create mode 100644 libsvtav1_rename_aq_mode.patch
create mode 100644 master-0001-Add-ability-for-ffmpeg-to-run-svt-vp9.patch
diff --git a/.abf.yml b/.abf.yml
index abfb9f0..3447a83 100644
--- a/.abf.yml
+++ b/.abf.yml
@@ -1,3 +1,3 @@
sources:
- restricted-multimedia-headers.tar.xz: c167eff71908c5491bd3bf301376946e31e89a00
- ffmpeg-5.1.2.tar.xz: eccccd3f66288993380816cf28a4b1f4c56b1aa5
+ restricted-multimedia-headers.tar.xz: 86530bb7f7d2a47cda6327168c86b68cd073eb2f
+ ffmpeg-7.1.3.tar.xz: 6e13fe059333cc077ecc1b83e2778bd500b9de9f
diff --git a/.onedev-buildspec.yml b/.onedev-buildspec.yml
new file mode 100644
index 0000000..b95f83a
--- /dev/null
+++ b/.onedev-buildspec.yml
@@ -0,0 +1,4 @@
+version: 40
+imports:
+- projectPath: OpenMandriva/Packages
+ revision: mirroring
diff --git a/078322f33ced4b2db6ac3e5002f98233d6fbf643.patch b/078322f33ced4b2db6ac3e5002f98233d6fbf643.patch
index 2193cd8..53f13b1 100644
--- a/078322f33ced4b2db6ac3e5002f98233d6fbf643.patch
+++ b/078322f33ced4b2db6ac3e5002f98233d6fbf643.patch
@@ -1,4 +1,4 @@
---- ffmpeg-3.3.4/configure.openjpeg22~ 2017-10-05 17:43:08.914891006 +0200
+--- ffmpeg-3.3.4/configure 2017-10-05 17:43:08.914891006 +0200
+++ ffmpeg-3.3.4/configure 2017-10-05 17:43:37.444816484 +0200
@@ -1889,6 +1889,7 @@ HEADERS_LIST="
machine_ioctl_meteor_h
@@ -19,7 +19,7 @@
{ check_lib openjpeg-2.0/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
{ check_lib openjpeg-1.5/openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
{ check_lib openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
---- ffmpeg-3.3.4/libavcodec/libopenjpegdec.c.openjpeg22~ 2017-09-12 02:51:33.000000000 +0200
+--- ffmpeg-3.3.4/libavcodec/libopenjpegdec.c 2017-09-12 02:51:33.000000000 +0200
+++ ffmpeg-3.3.4/libavcodec/libopenjpegdec.c 2017-10-05 17:43:08.924890980 +0200
@@ -34,7 +34,9 @@
#include "internal.h"
@@ -50,7 +50,7 @@
opj_stream_set_user_data(stream, &reader, NULL);
#elif HAVE_OPENJPEG_2_0_OPENJPEG_H
opj_stream_set_user_data(stream, &reader);
---- ffmpeg-3.3.4/libavcodec/libopenjpegenc.c.openjpeg22~ 2017-09-12 02:51:33.000000000 +0200
+--- ffmpeg-3.3.4/libavcodec/libopenjpegenc.c 2017-09-12 02:51:33.000000000 +0200
+++ ffmpeg-3.3.4/libavcodec/libopenjpegenc.c 2017-10-05 17:43:08.925890977 +0200
@@ -32,7 +32,9 @@
#include "avcodec.h"
diff --git a/ffmpeg-1.0.1-time.h.patch b/ffmpeg-1.0.1-time.h.patch
index 0c8e238..25ab062 100644
--- a/ffmpeg-1.0.1-time.h.patch
+++ b/ffmpeg-1.0.1-time.h.patch
@@ -1,4 +1,4 @@
---- ffmpeg-1.0.1/libavutil/time.h.bero 2012-12-04 17:58:13.659811039 +0100
+--- ffmpeg-1.0.1/libavutil/time.h 2012-12-04 17:58:13.659811039 +0100
+++ ffmpeg-1.0.1/libavutil/time.h 2012-12-04 17:58:45.039180838 +0100
@@ -39,3 +39,9 @@ int64_t av_gettime(void);
int av_usleep(unsigned usec);
diff --git a/ffmpeg-2.5-fix-build-with-flto-and-inline-assembly.patch b/ffmpeg-2.5-fix-build-with-flto-and-inline-assembly.patch
index 18823ca..25b9af0 100644
--- a/ffmpeg-2.5-fix-build-with-flto-and-inline-assembly.patch
+++ b/ffmpeg-2.5-fix-build-with-flto-and-inline-assembly.patch
@@ -1,5 +1,5 @@
-diff -up ffmpeg-5.1/libavcodec/cabac.c.flto_inline_asm~ ffmpeg-5.1/libavcodec/cabac.c
---- ffmpeg-5.1/libavcodec/cabac.c.flto_inline_asm~ 2022-08-09 16:19:59.546808285 +0200
+diff -up ffmpeg-5.1/libavcodec/cabac.c ffmpeg-5.1/libavcodec/cabac.c
+--- ffmpeg-5.1/libavcodec/cabac.c 2022-08-09 16:19:59.546808285 +0200
+++ ffmpeg-5.1/libavcodec/cabac.c 2022-08-09 16:21:59.096771559 +0200
@@ -29,7 +29,7 @@
@@ -10,51 +10,8 @@ diff -up ffmpeg-5.1/libavcodec/cabac.c.flto_inline_asm~ ffmpeg-5.1/libavcodec/ca
9,8,7,7,6,6,6,6,5,5,5,5,5,5,5,5,
4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
-diff -up ffmpeg-5.1/libavcodec/x86/lpc.c.flto_inline_asm~ ffmpeg-5.1/libavcodec/x86/lpc.c
---- ffmpeg-5.1/libavcodec/x86/lpc.c.flto_inline_asm~ 2022-07-22 19:58:39.000000000 +0200
-+++ ffmpeg-5.1/libavcodec/x86/lpc.c 2022-08-09 16:19:59.547808260 +0200
-@@ -26,8 +26,8 @@
- #include "libavutil/x86/cpu.h"
- #include "libavcodec/lpc.h"
-
--DECLARE_ASM_CONST(16, double, pd_1)[2] = { 1.0, 1.0 };
--DECLARE_ASM_CONST(16, double, pd_2)[2] = { 2.0, 2.0 };
-+DECLARE_ASM_CONST_VISIBLE(16, double, pd_1)[2] = { 1.0, 1.0 };
-+DECLARE_ASM_CONST_VISIBLE(16, double, pd_2)[2] = { 2.0, 2.0 };
-
- #if HAVE_SSE2_INLINE
-
-diff -up ffmpeg-5.1/libavutil/mem.h.flto_inline_asm~ ffmpeg-5.1/libavutil/mem.h
---- ffmpeg-5.1/libavutil/mem.h.flto_inline_asm~ 2022-07-22 19:58:39.000000000 +0200
-+++ ffmpeg-5.1/libavutil/mem.h 2022-08-09 16:19:59.547808260 +0200
-@@ -108,14 +108,16 @@
- #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
- #define DECLARE_ASM_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
- #define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v
-+ #define DECLARE_ASM_CONST_VISIBLE(n,t,v) __attribute__ ((externally_visible)) DECLARE_ASM_CONST(n,t,v)
- #elif defined(__DJGPP__)
- #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (FFMIN(n, 16)))) v
- #define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v
- #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v
- #elif defined(__GNUC__) || defined(__clang__)
-- #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
-+ #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) __attribute__((used)) __attribute__((visibility("default"))) v
- #define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (n))) v
- #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (n))) v
-+ #define DECLARE_ASM_CONST_VISIBLE(n,t,v) __attribute__ ((externally_visible)) const t av_used __attribute__ ((aligned (n))) v
- #elif defined(_MSC_VER)
- #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v
- #define DECLARE_ASM_ALIGNED(n,t,v) __declspec(align(n)) t v
-@@ -124,6 +126,7 @@
- #define DECLARE_ALIGNED(n,t,v) t v
- #define DECLARE_ASM_ALIGNED(n,t,v) t v
- #define DECLARE_ASM_CONST(n,t,v) static const t v
-+ #define DECLARE_ASM_CONST_VISIBLE(n,t,v) __attribute__((externally_visible)) const t v
- #endif
-
- /**
-diff -up ffmpeg-5.1/libpostproc/postprocess.c.flto_inline_asm~ ffmpeg-5.1/libpostproc/postprocess.c
---- ffmpeg-5.1/libpostproc/postprocess.c.flto_inline_asm~ 2022-07-22 19:58:39.000000000 +0200
+diff -up ffmpeg-5.1/libpostproc/postprocess.c ffmpeg-5.1/libpostproc/postprocess.c
+--- ffmpeg-5.1/libpostproc/postprocess.c 2022-07-22 19:58:39.000000000 +0200
+++ ffmpeg-5.1/libpostproc/postprocess.c 2022-08-09 16:19:59.547808260 +0200
@@ -99,17 +99,17 @@ try to unroll inner for(x=0 ... loop to
//#define NUM_BLOCKS_AT_ONCE 16 //not used yet
@@ -82,8 +39,8 @@ diff -up ffmpeg-5.1/libpostproc/postprocess.c.flto_inline_asm~ ffmpeg-5.1/libpos
static const struct PPFilter filters[]=
-diff -up ffmpeg-5.1/libswscale/x86/rgb2rgb.c.flto_inline_asm~ ffmpeg-5.1/libswscale/x86/rgb2rgb.c
---- ffmpeg-5.1/libswscale/x86/rgb2rgb.c.flto_inline_asm~ 2022-07-22 19:58:40.000000000 +0200
+diff -up ffmpeg-5.1/libswscale/x86/rgb2rgb.c ffmpeg-5.1/libswscale/x86/rgb2rgb.c
+--- ffmpeg-5.1/libswscale/x86/rgb2rgb.c 2022-07-22 19:58:40.000000000 +0200
+++ ffmpeg-5.1/libswscale/x86/rgb2rgb.c 2022-08-09 16:19:59.547808260 +0200
@@ -38,7 +38,7 @@
@@ -124,8 +81,8 @@ diff -up ffmpeg-5.1/libswscale/x86/rgb2rgb.c.flto_inline_asm~ ffmpeg-5.1/libswsc
DECLARE_ALIGNED(8, extern const uint64_t, ff_bgr2YOffset);
DECLARE_ALIGNED(8, extern const uint64_t, ff_w1111);
-diff -up ffmpeg-5.1/libswscale/x86/swscale.c.flto_inline_asm~ ffmpeg-5.1/libswscale/x86/swscale.c
---- ffmpeg-5.1/libswscale/x86/swscale.c.flto_inline_asm~ 2022-08-09 16:19:59.548808235 +0200
+diff -up ffmpeg-5.1/libswscale/x86/swscale.c ffmpeg-5.1/libswscale/x86/swscale.c
+--- ffmpeg-5.1/libswscale/x86/swscale.c 2022-08-09 16:19:59.548808235 +0200
+++ ffmpeg-5.1/libswscale/x86/swscale.c 2022-08-09 16:21:30.649494231 +0200
@@ -42,16 +42,16 @@ const DECLARE_ALIGNED(8, uint64_t, ff_di
diff --git a/ffmpeg-4.3-dlopen-faac-mp3lame-opencore-x264-x265-xvid.patch b/ffmpeg-4.3-dlopen-faac-mp3lame-opencore-x264-x265-xvid.patch
index b489cf2..7dbc043 100644
--- a/ffmpeg-4.3-dlopen-faac-mp3lame-opencore-x264-x265-xvid.patch
+++ b/ffmpeg-4.3-dlopen-faac-mp3lame-opencore-x264-x265-xvid.patch
@@ -1,15 +1,15 @@
-diff -up ffmpeg-5.1/configure.dlopen~ ffmpeg-5.1/configure
---- ffmpeg-5.1/configure.dlopen~ 2022-07-22 19:58:38.000000000 +0200
-+++ ffmpeg-5.1/configure 2022-08-09 16:18:46.755656830 +0200
+diff -up ffmpeg-7.1/configure.2~ ffmpeg-7.1/configure
+--- ffmpeg-7.1/configure.2~ 2024-09-30 01:31:47.000000000 +0200
++++ ffmpeg-7.1/configure 2024-10-01 13:03:01.706096311 +0200
@@ -231,6 +231,7 @@ External library support:
- --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
- and libraw1394 [no]
+ --enable-libdvdnav enable libdvdnav, needed for DVD demuxing [no]
+ --enable-libdvdread enable libdvdread, needed for DVD demuxing [no]
--enable-libfdk-aac enable AAC de/encoding via libfdk-aac [no]
+ --enable-libfdk-aac-dlopen enable AAC de/encoding via dlopen()'ed libfdk-aac [no]
--enable-libflite enable flite (voice synthesis) support via libflite [no]
--enable-libfontconfig enable libfontconfig, useful for drawtext filter [no]
--enable-libfreetype enable libfreetype, needed for drawtext filter [no]
-@@ -247,8 +248,11 @@ External library support:
+@@ -250,8 +251,11 @@ External library support:
--enable-liblensfun enable lensfun lens correction [no]
--enable-libmodplug enable ModPlug via libmodplug [no]
--enable-libmp3lame enable MP3 encoding via libmp3lame [no]
@@ -20,18 +20,18 @@ diff -up ffmpeg-5.1/configure.dlopen~ ffmpeg-5.1/configure
+ --enable-libopencore-amrwb-dlopen enable AMR-WB decoding via dlopen()'ed libopencore-amrwb [no]
--enable-libopencv enable video filtering via libopencv [no]
--enable-libopenh264 enable H.264 encoding via OpenH264 [no]
- --enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no]
-@@ -290,7 +294,9 @@ External library support:
- --enable-libvpx enable VP8 and VP9 de/encoding via libvpx [no]
+ --enable-libopenjpeg enable JPEG 2000 encoding via OpenJPEG [no]
+@@ -297,7 +301,9 @@ External library support:
+ --enable-libvvenc enable H.266/VVC encoding via vvenc [no]
--enable-libwebp enable WebP encoding via libwebp [no]
--enable-libx264 enable H.264 encoding via x264 [no]
+ --enable-libx264-dlopen enable H.264 encoding via dlopen()-ed x264 [no]
--enable-libx265 enable HEVC encoding via x265 [no]
+ --enable-libx265-dlopen enable HEVC encoding via dlopen()-ed x265 [no]
+ --enable-libxeve enable EVC encoding via libxeve [no]
+ --enable-libxevd enable EVC decoding via libxevd [no]
--enable-libxavs enable AVS encoding via xavs [no]
- --enable-libxavs2 enable AVS2 encoding via xavs2 [no]
- --enable-libxcb enable X11 grabbing using XCB [autodetect]
-@@ -299,6 +305,7 @@ External library support:
+@@ -308,6 +314,7 @@ 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]
@@ -39,7 +39,7 @@ diff -up ffmpeg-5.1/configure.dlopen~ ffmpeg-5.1/configure
--enable-libxml2 enable XML parsing using the C library libxml2, needed
for dash and imf demuxing support [no]
--enable-libzimg enable z.lib, needed for zscale filter [no]
-@@ -1778,15 +1785,19 @@ EXTERNAL_LIBRARY_GPL_LIST="
+@@ -1868,15 +1875,19 @@ EXTERNAL_LIBRARY_GPL_LIST="
librubberband
libvidstab
libx264
@@ -59,7 +59,7 @@ diff -up ffmpeg-5.1/configure.dlopen~ ffmpeg-5.1/configure
libtls
"
-@@ -1795,7 +1806,9 @@ EXTERNAL_LIBRARY_VERSION3_LIST="
+@@ -1885,7 +1896,9 @@ EXTERNAL_LIBRARY_VERSION3_LIST="
libaribb24
liblensfun
libopencore_amrnb
@@ -69,15 +69,15 @@ diff -up ffmpeg-5.1/configure.dlopen~ ffmpeg-5.1/configure
libvo_amrwbenc
mbedtls
rkmpp
-@@ -1841,6 +1854,7 @@ EXTERNAL_LIBRARY_LIST="
- libkvazaar
+@@ -1934,6 +1947,7 @@ EXTERNAL_LIBRARY_LIST="
+ liblcevc_dec
libmodplug
libmp3lame
+ libmp3lame_dlopen
libmysofa
libopencv
libopenh264
-@@ -6544,6 +6558,7 @@ enabled libdrm && require_pkg
+@@ -6889,6 +6903,7 @@ enabled libdvdread && require_pkg
enabled libfdk_aac && { check_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"; } }
@@ -85,7 +85,7 @@ diff -up ffmpeg-5.1/configure.dlopen~ ffmpeg-5.1/configure
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
-@@ -6584,13 +6599,16 @@ fi
+@@ -6951,13 +6966,16 @@ fi
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 $libm_extralibs
@@ -102,24 +102,26 @@ diff -up ffmpeg-5.1/configure.dlopen~ ffmpeg-5.1/configure
enabled libopencv && { check_headers opencv2/core/core_c.h &&
{ check_pkg_config libopencv opencv opencv2/core/core_c.h cvCreateImageHeader ||
require libopencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
-@@ -6671,11 +6689,14 @@ enabled libx264 && check_pkg_c
- [ "$toolchain" != "msvc" ] ||
+@@ -7046,13 +7064,16 @@ enabled libx264 && require_pkg
require_cpp_condition libx264 x264.h "X264_BUILD >= 158"; } &&
+ check_cpp_condition libx264_hdr10 x264.h "X264_BUILD >= 163" &&
check_cpp_condition libx262 x264.h "X264_MPEG2"
+enabled libx264_dlopen && enable libx264 && add_cppflags "-I$(dirname `readlink -f $0`)/localinc"
enabled libx265 && require_pkg_config libx265 x265 x265.h x265_api_get &&
- require_cpp_condition libx265 x265.h "X265_BUILD >= 70"
+ require_cpp_condition libx265 x265.h "X265_BUILD >= 89"
+enabled libx265_dlopen && enable libx265 && add_cppflags "-I$(dirname `readlink -f $0`)/localinc"
enabled libxavs && require libxavs "stdint.h xavs.h" xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs"
enabled libxavs2 && require_pkg_config libxavs2 "xavs2 >= 1.3.0" "stdint.h xavs2.h" xavs2_api_get
+ enabled libxevd && require_pkg_config libxevd "xevd >= 0.4.1" "xevd.h" xevd_decode
+ enabled libxeve && require_pkg_config libxeve "xeve >= 0.5.1" "xeve.h" xeve_encode
enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
+enabled libxvid_dlopen && enable libxvid && add_cppflags "-I$(dirname `readlink -f $0`)/localinc"
enabled libzimg && require_pkg_config libzimg "zimg >= 2.7.0" zimg.h zimg_get_api_version
enabled libzmq && require_pkg_config libzmq "libzmq >= 4.2.1" zmq.h zmq_ctx_new
enabled libzvbi && require_pkg_config libzvbi zvbi-0.2 libzvbi.h vbi_decoder_new &&
-diff -up ffmpeg-5.1/libavcodec/dlopen.h.dlopen~ ffmpeg-5.1/libavcodec/dlopen.h
---- ffmpeg-5.1/libavcodec/dlopen.h.dlopen~ 2022-08-08 01:05:35.843820054 +0200
-+++ ffmpeg-5.1/libavcodec/dlopen.h 2022-08-08 01:05:35.843820054 +0200
+diff -up ffmpeg-7.1/libavcodec/dlopen.h.2~ ffmpeg-7.1/libavcodec/dlopen.h
+--- ffmpeg-7.1/libavcodec/dlopen.h.2~ 2024-10-01 12:57:32.692715389 +0200
++++ ffmpeg-7.1/libavcodec/dlopen.h 2024-10-01 12:57:32.692715389 +0200
@@ -0,0 +1,13 @@
+#ifndef LOCALINC_DLOPEN_H
+#define LOCALINC_DLOPEN_H
@@ -134,10 +136,10 @@ diff -up ffmpeg-5.1/libavcodec/dlopen.h.dlopen~ ffmpeg-5.1/libavcodec/dlopen.h
+ goto error;
+
+#endif
-diff -up ffmpeg-5.1/libavcodec/libfdk-aacdec.c.dlopen~ ffmpeg-5.1/libavcodec/libfdk-aacdec.c
---- ffmpeg-5.1/libavcodec/libfdk-aacdec.c.dlopen~ 2022-07-22 19:58:39.000000000 +0200
-+++ ffmpeg-5.1/libavcodec/libfdk-aacdec.c 2022-08-08 01:05:35.843820054 +0200
-@@ -38,6 +38,54 @@
+diff -up ffmpeg-7.1/libavcodec/libfdk-aacdec.c.2~ ffmpeg-7.1/libavcodec/libfdk-aacdec.c
+--- ffmpeg-7.1/libavcodec/libfdk-aacdec.c.2~ 2024-09-30 01:31:48.000000000 +0200
++++ ffmpeg-7.1/libavcodec/libfdk-aacdec.c 2024-10-01 12:57:32.692715389 +0200
+@@ -39,6 +39,54 @@
#define AAC_PCM_MAX_OUTPUT_CHANNELS AAC_PCM_OUTPUT_CHANNELS
#endif
@@ -192,7 +194,7 @@ diff -up ffmpeg-5.1/libavcodec/libfdk-aacdec.c.dlopen~ ffmpeg-5.1/libavcodec/lib
enum ConcealMethod {
CONCEAL_METHOD_SPECTRAL_MUTING = 0,
CONCEAL_METHOD_NOISE_SUBSTITUTION = 1,
-@@ -244,6 +292,11 @@ static av_cold int fdk_aac_decode_init(A
+@@ -245,6 +293,11 @@ static av_cold int fdk_aac_decode_init(A
FDKAACDecContext *s = avctx->priv_data;
AAC_DECODER_ERROR err;
@@ -204,10 +206,10 @@ diff -up ffmpeg-5.1/libavcodec/libfdk-aacdec.c.dlopen~ ffmpeg-5.1/libavcodec/lib
s->handle = aacDecoder_Open(avctx->extradata_size ? TT_MP4_RAW : TT_MP4_ADTS, 1);
if (!s->handle) {
av_log(avctx, AV_LOG_ERROR, "Error opening decoder\n");
-diff -up ffmpeg-5.1/libavcodec/libfdk-aacenc.c.dlopen~ ffmpeg-5.1/libavcodec/libfdk-aacenc.c
---- ffmpeg-5.1/libavcodec/libfdk-aacenc.c.dlopen~ 2022-07-22 19:58:39.000000000 +0200
-+++ ffmpeg-5.1/libavcodec/libfdk-aacenc.c 2022-08-09 16:19:37.101378331 +0200
-@@ -36,6 +36,48 @@
+diff -up ffmpeg-7.1/libavcodec/libfdk-aacenc.c.2~ ffmpeg-7.1/libavcodec/libfdk-aacenc.c
+--- ffmpeg-7.1/libavcodec/libfdk-aacenc.c.2~ 2024-09-30 01:31:48.000000000 +0200
++++ ffmpeg-7.1/libavcodec/libfdk-aacenc.c 2024-10-01 12:57:32.692715389 +0200
+@@ -38,6 +38,48 @@
#define FDKENC_VER_AT_LEAST(vl0, vl1) 0
#endif
@@ -256,8 +258,8 @@ diff -up ffmpeg-5.1/libavcodec/libfdk-aacenc.c.dlopen~ ffmpeg-5.1/libavcodec/lib
typedef struct AACContext {
const AVClass *class;
HANDLE_AACENCODER handle;
-@@ -128,6 +170,11 @@ static av_cold int aac_encode_init(AVCod
- int aot = FF_PROFILE_AAC_LOW + 1;
+@@ -183,6 +225,11 @@ static av_cold int aac_encode_init(AVCod
+ int aot = AV_PROFILE_AAC_LOW + 1;
int sce = 0, cpe = 0;
+#ifdef CONFIG_LIBFDK_AAC_DLOPEN
@@ -268,10 +270,10 @@ diff -up ffmpeg-5.1/libavcodec/libfdk-aacenc.c.dlopen~ ffmpeg-5.1/libavcodec/lib
if ((err = aacEncOpen(&s->handle, 0, avctx->ch_layout.nb_channels)) != AACENC_OK) {
av_log(avctx, AV_LOG_ERROR, "Unable to open the encoder: %s\n",
aac_get_error(err));
-diff -up ffmpeg-5.1/libavcodec/libmp3lame.c.dlopen~ ffmpeg-5.1/libavcodec/libmp3lame.c
---- ffmpeg-5.1/libavcodec/libmp3lame.c.dlopen~ 2022-07-22 19:58:39.000000000 +0200
-+++ ffmpeg-5.1/libavcodec/libmp3lame.c 2022-08-08 01:05:35.843820054 +0200
-@@ -39,6 +39,145 @@
+diff -up ffmpeg-7.1/libavcodec/libmp3lame.c.2~ ffmpeg-7.1/libavcodec/libmp3lame.c
+--- ffmpeg-7.1/libavcodec/libmp3lame.c.2~ 2024-09-30 01:31:48.000000000 +0200
++++ ffmpeg-7.1/libavcodec/libmp3lame.c 2024-10-01 12:57:32.692715389 +0200
+@@ -40,6 +40,145 @@
#include "mpegaudio.h"
#include "mpegaudiodecheader.h"
@@ -417,7 +419,7 @@ diff -up ffmpeg-5.1/libavcodec/libmp3lame.c.dlopen~ ffmpeg-5.1/libavcodec/libmp3
#define BUFFER_SIZE (7200 + 2 * MPA_FRAME_SIZE + MPA_FRAME_SIZE / 4+1000) // FIXME: Buffer size to small? Adding 1000 to make up for it.
typedef struct LAMEContext {
-@@ -94,6 +233,11 @@ static av_cold int mp3lame_encode_init(A
+@@ -97,6 +236,11 @@ static av_cold int mp3lame_encode_init(A
LAMEContext *s = avctx->priv_data;
int ret;
@@ -429,12 +431,12 @@ diff -up ffmpeg-5.1/libavcodec/libmp3lame.c.dlopen~ ffmpeg-5.1/libavcodec/libmp3
s->avctx = avctx;
/* initialize LAME and get defaults */
-diff -up ffmpeg-5.1/libavcodec/libopencore-amr.c.dlopen~ ffmpeg-5.1/libavcodec/libopencore-amr.c
---- ffmpeg-5.1/libavcodec/libopencore-amr.c.dlopen~ 2022-07-22 19:58:39.000000000 +0200
-+++ ffmpeg-5.1/libavcodec/libopencore-amr.c 2022-08-08 01:05:35.843820054 +0200
-@@ -33,6 +33,107 @@
+diff -up ffmpeg-7.1/libavcodec/libopencore-amr.c.2~ ffmpeg-7.1/libavcodec/libopencore-amr.c
+--- ffmpeg-7.1/libavcodec/libopencore-amr.c.2~ 2024-09-30 01:31:48.000000000 +0200
++++ ffmpeg-7.1/libavcodec/libopencore-amr.c 2024-10-01 12:57:32.692715389 +0200
+@@ -34,6 +34,107 @@
+ #include "decode.h"
#include "encode.h"
- #include "internal.h"
+#if CONFIG_LIBOPENCORE_AMRWB_DECODER
+#include <opencore-amrwb/dec_if.h>
@@ -540,7 +542,7 @@ diff -up ffmpeg-5.1/libavcodec/libopencore-amr.c.dlopen~ ffmpeg-5.1/libavcodec/l
#if CONFIG_LIBOPENCORE_AMRNB_DECODER || CONFIG_LIBOPENCORE_AMRWB_DECODER
static int amr_decode_fix_avctx(AVCodecContext *avctx)
{
-@@ -55,9 +156,6 @@ static int amr_decode_fix_avctx(AVCodecC
+@@ -56,9 +157,6 @@ static int amr_decode_fix_avctx(AVCodecC
#if CONFIG_LIBOPENCORE_AMRNB
@@ -550,7 +552,7 @@ diff -up ffmpeg-5.1/libavcodec/libopencore-amr.c.dlopen~ ffmpeg-5.1/libavcodec/l
typedef struct AMRContext {
AVClass *av_class;
void *dec_state;
-@@ -198,6 +296,11 @@ static av_cold int amr_nb_encode_init(AV
+@@ -200,6 +298,11 @@ static av_cold int amr_nb_encode_init(AV
{
AMRContext *s = avctx->priv_data;
@@ -562,7 +564,7 @@ diff -up ffmpeg-5.1/libavcodec/libopencore-amr.c.dlopen~ ffmpeg-5.1/libavcodec/l
if (avctx->sample_rate != 8000 && avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) {
av_log(avctx, AV_LOG_ERROR, "Only 8000Hz sample rate supported\n");
return AVERROR(ENOSYS);
-@@ -308,10 +411,6 @@ const FFCodec ff_libopencore_amrnb_encod
+@@ -312,10 +415,6 @@ const FFCodec ff_libopencore_amrnb_encod
/* -----------AMR wideband ------------*/
#if CONFIG_LIBOPENCORE_AMRWB_DECODER
@@ -573,7 +575,7 @@ diff -up ffmpeg-5.1/libavcodec/libopencore-amr.c.dlopen~ ffmpeg-5.1/libavcodec/l
typedef struct AMRWBContext {
void *state;
} AMRWBContext;
-@@ -324,6 +423,11 @@ static av_cold int amr_wb_decode_init(AV
+@@ -328,6 +427,11 @@ static av_cold int amr_wb_decode_init(AV
if ((ret = amr_decode_fix_avctx(avctx)) < 0)
return ret;
@@ -585,10 +587,10 @@ diff -up ffmpeg-5.1/libavcodec/libopencore-amr.c.dlopen~ ffmpeg-5.1/libavcodec/l
s->state = D_IF_init();
return 0;
-diff -up ffmpeg-5.1/libavcodec/libx264.c.dlopen~ ffmpeg-5.1/libavcodec/libx264.c
---- ffmpeg-5.1/libavcodec/libx264.c.dlopen~ 2022-07-22 19:58:39.000000000 +0200
-+++ ffmpeg-5.1/libavcodec/libx264.c 2022-08-08 01:05:35.844820028 +0200
-@@ -44,6 +44,128 @@
+diff -up ffmpeg-7.1/libavcodec/libx264.c.2~ ffmpeg-7.1/libavcodec/libx264.c
+--- ffmpeg-7.1/libavcodec/libx264.c.2~ 2024-09-30 01:31:48.000000000 +0200
++++ ffmpeg-7.1/libavcodec/libx264.c 2024-10-01 12:57:32.692715389 +0200
+@@ -48,6 +48,128 @@
#include <stdlib.h>
#include <string.h>
@@ -717,7 +719,7 @@ diff -up ffmpeg-5.1/libavcodec/libx264.c.dlopen~ ffmpeg-5.1/libavcodec/libx264.c
// from x264.h, for quant_offsets, Macroblocks are 16x16
// blocks of pixels (with respect to the luma plane)
#define MB_SIZE 16
-@@ -641,6 +763,11 @@ static av_cold int X264_init(AVCodecCont
+@@ -1072,6 +1194,11 @@ static av_cold int X264_init(AVCodecCont
if (avctx->global_quality > 0)
av_log(avctx, AV_LOG_WARNING, "-qscale is ignored, -crf is recommended.\n");
@@ -729,11 +731,11 @@ diff -up ffmpeg-5.1/libavcodec/libx264.c.dlopen~ ffmpeg-5.1/libavcodec/libx264.c
#if CONFIG_LIBX262_ENCODER
if (avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
x4->params.b_mpeg2 = 1;
-diff -up ffmpeg-5.1/libavcodec/libx265.c.dlopen~ ffmpeg-5.1/libavcodec/libx265.c
---- ffmpeg-5.1/libavcodec/libx265.c.dlopen~ 2022-07-22 19:58:39.000000000 +0200
-+++ ffmpeg-5.1/libavcodec/libx265.c 2022-08-09 16:19:10.495054005 +0200
-@@ -38,6 +38,39 @@
- #include "packet_internal.h"
+diff -up ffmpeg-7.1/libavcodec/libx265.c.2~ ffmpeg-7.1/libavcodec/libx265.c
+--- ffmpeg-7.1/libavcodec/libx265.c.2~ 2024-09-30 01:31:48.000000000 +0200
++++ ffmpeg-7.1/libavcodec/libx265.c 2024-10-01 13:00:36.494603327 +0200
+@@ -42,6 +42,42 @@
+ #include "atsc_a53.h"
#include "sei.h"
+#ifdef CONFIG_LIBX265_DLOPEN
@@ -747,45 +749,61 @@ diff -up ffmpeg-5.1/libavcodec/libx265.c.dlopen~ ffmpeg-5.1/libavcodec/libx265.c
+
+static int loadLibX265();
+static int loadLibX265() {
-+ const char *err = NULL;
-+ void *libx265 = NULL;
-+ int *ptr;
-+
-+ libx265 = dlopen(X265_LIB, RTLD_LAZY);
-+ if ((err = dlerror())) {
-+ fprintf(stderr, "%s\n%s is missing, x265 support will be disabled\n", err, X265_LIB);
-+ if(libx265)
-+ dlclose(libx265);
-+ return 1;
-+ }
++ if (dl_x265_api_get)
++ return 0;
+
-+ x265_api_get=(x265_api_func)dlsym(libx265, "x265_api_get_" num2str(X265_BUILD));
-+ if(!x265_api_get) {
-+ fprintf(stderr, "No x265_api_get_" num2str(X265_BUILD) " in " X265_LIB "\n");
-+ return 1;
-+ }
++ const char *err = NULL;
++ void *libx265 = NULL;
++ int *ptr;
+
-+ return 0;
++ libx265 = dlopen(X265_LIB, RTLD_LAZY);
++ if ((err = dlerror())) {
++ fprintf(stderr, "%s\n%s is missing, x265 support will be disabled\n", err, X265_LIB);
++ if(libx265)
++ dlclose(libx265);
++ return 1;
++ }
++
++ x265_api_get=(x265_api_func)dlsym(libx265, "x265_api_get_" num2str(X265_BUILD));
++ if(!x265_api_get) {
++ fprintf(stderr, "No x265_api_get_" num2str(X265_BUILD) " in " X265_LIB "\n");
++ return 1;
++ }
++
++ return 0;
+}
+#endif
+
- typedef struct libx265Context {
- const AVClass *class;
+ typedef struct ReorderedData {
+ int64_t duration;
-@@ -696,6 +729,10 @@ static const enum AVPixelFormat x265_csp
+@@ -245,6 +281,11 @@ static int handle_side_data(AVCodecConte
- static av_cold void libx265_encode_init_csp(FFCodec *codec)
+ static av_cold int libx265_encode_init(AVCodecContext *avctx)
+ {
++#ifdef CONFIG_LIBX265_DLOPEN
++ if (loadLibX265())
++ return 0;
++#endif
++
+ libx265Context *ctx = avctx->priv_data;
+ AVCPBProperties *cpb_props = NULL;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
+@@ -955,6 +996,11 @@ static int libx265_get_supported_config(
+ unsigned flags, const void **out,
+ int *out_num)
{
+#ifdef CONFIG_LIBX265_DLOPEN
+ if (loadLibX265())
-+ return;
++ return 0;
+#endif
- if (x265_api_get(12))
- codec->p.pix_fmts = x265_csp_twelve;
- else if (x265_api_get(10))
-diff -up ffmpeg-5.1/libavcodec/libxvid.c.dlopen~ ffmpeg-5.1/libavcodec/libxvid.c
---- ffmpeg-5.1/libavcodec/libxvid.c.dlopen~ 2022-07-22 19:58:39.000000000 +0200
-+++ ffmpeg-5.1/libavcodec/libxvid.c 2022-08-08 01:05:35.844820028 +0200
++
+ if (config == AV_CODEC_CONFIG_PIX_FORMAT) {
+ if (x265_api_get(12)) {
+ *out = x265_csp_twelve;
+diff -up ffmpeg-7.1/libavcodec/libxvid.c.2~ ffmpeg-7.1/libavcodec/libxvid.c
+--- ffmpeg-7.1/libavcodec/libxvid.c.2~ 2024-09-30 01:31:48.000000000 +0200
++++ ffmpeg-7.1/libavcodec/libxvid.c 2024-10-01 12:57:32.712715595 +0200
@@ -51,6 +51,61 @@
#include <io.h>
#endif
diff --git a/ffmpeg-4.4-add-accessors-for-AVStream.patch b/ffmpeg-4.4-add-accessors-for-AVStream.patch
index f4d142c..fdd1093 100644
--- a/ffmpeg-4.4-add-accessors-for-AVStream.patch
+++ b/ffmpeg-4.4-add-accessors-for-AVStream.patch
@@ -1,5 +1,5 @@
-diff -up ffmpeg-5.1/libavformat/avformat.h.accessor~ ffmpeg-5.1/libavformat/avformat.h
---- ffmpeg-5.1/libavformat/avformat.h.accessor~ 2022-07-22 19:58:39.000000000 +0200
+diff -up ffmpeg-5.1/libavformat/avformat.h ffmpeg-5.1/libavformat/avformat.h
+--- ffmpeg-5.1/libavformat/avformat.h 2022-07-22 19:58:39.000000000 +0200
+++ ffmpeg-5.1/libavformat/avformat.h 2022-08-09 16:22:27.150058854 +0200
@@ -2904,4 +2904,9 @@ AVRational av_stream_get_codec_timebase(
* @}
@@ -11,8 +11,8 @@ diff -up ffmpeg-5.1/libavformat/avformat.h.accessor~ ffmpeg-5.1/libavformat/avfo
+int av_stream_get_pts_wrap_bits(AVStream *s);
+int64_t av_stream_get_codec_info_nb_frames(AVStream *s);
#endif /* AVFORMAT_AVFORMAT_H */
-diff -up ffmpeg-5.1/libavformat/utils.c.accessor~ ffmpeg-5.1/libavformat/utils.c
---- ffmpeg-5.1/libavformat/utils.c.accessor~ 2022-08-09 16:22:27.150058854 +0200
+diff -up ffmpeg-5.1/libavformat/utils.c ffmpeg-5.1/libavformat/utils.c
+--- ffmpeg-5.1/libavformat/utils.c 2022-08-09 16:22:27.150058854 +0200
+++ ffmpeg-5.1/libavformat/utils.c 2022-08-09 16:23:07.479034213 +0200
@@ -602,3 +602,23 @@ int ff_bprint_to_codecpar_extradata(AVCo
par->extradata_size = buf->len;
diff --git a/ffmpeg-5.1.2-fix-vulkan.patch b/ffmpeg-5.1.2-fix-vulkan.patch
new file mode 100644
index 0000000..1e4fba2
--- /dev/null
+++ b/ffmpeg-5.1.2-fix-vulkan.patch
@@ -0,0 +1,14 @@
+diff -up ffmpeg-5.1.2/libavutil/hwcontext_vulkan.c ffmpeg-5.1.2/libavutil/hwcontext_vulkan.c
+--- ffmpeg-5.1.2/libavutil/hwcontext_vulkan.c 2023-02-01 13:11:01.052204236 +0100
++++ ffmpeg-5.1.2/libavutil/hwcontext_vulkan.c 2023-02-01 13:13:52.694812256 +0100
+@@ -360,8 +360,8 @@ static const VulkanOptExtension optional
+ { VK_KHR_VIDEO_DECODE_QUEUE_EXTENSION_NAME, FF_VK_EXT_NO_FLAG },
+ { VK_KHR_VIDEO_ENCODE_QUEUE_EXTENSION_NAME, FF_VK_EXT_NO_FLAG },
+ { VK_EXT_VIDEO_ENCODE_H264_EXTENSION_NAME, FF_VK_EXT_NO_FLAG },
+- { VK_EXT_VIDEO_DECODE_H264_EXTENSION_NAME, FF_VK_EXT_NO_FLAG },
+- { VK_EXT_VIDEO_DECODE_H265_EXTENSION_NAME, FF_VK_EXT_NO_FLAG },
++ { VK_KHR_VIDEO_DECODE_H264_EXTENSION_NAME, FF_VK_EXT_NO_FLAG },
++ { VK_KHR_VIDEO_DECODE_H265_EXTENSION_NAME, FF_VK_EXT_NO_FLAG },
+ };
+
+ /* Converts return values to strings */
diff --git a/ffmpeg-e06ce6d2b45edac4a2df04f304e18d4727417d24.patch b/ffmpeg-e06ce6d2b45edac4a2df04f304e18d4727417d24.patch
new file mode 100644
index 0000000..21971d4
--- /dev/null
+++ b/ffmpeg-e06ce6d2b45edac4a2df04f304e18d4727417d24.patch
@@ -0,0 +1,110 @@
+commit e06ce6d2b45edac4a2df04f304e18d4727417d24
+Author: Jan Ekström <jeebjp@gmail.com>
+Date: Wed Feb 14 22:40:54 2024 +0200
+
+ {avcodec,tests}: rename the bundled Mesa AV1 vulkan video headers
+
+ This together with adjusting the inclusion define allows for the
+ build to not fail with latest Vulkan-Headers that contain the
+ stabilized Vulkan AV1 decoding definitions.
+
+ Compilation fails currently as the AV1 header is getting included
+ via hwcontext_vulkan.h -> <vulkan/vulkan.h> -> vulkan_core.h, which
+ finally includes vk_video/vulkan_video_codec_av1std.h and the decode
+ header, leading to the bundled header to never defining anything
+ due to the inclusion define being the same.
+
+ This fix is imperfect, as it leads to additional re-definition
+ warnings for things such as
+ VK_STD_VULKAN_VIDEO_CODEC_AV1_DECODE_SPEC_VERSION. , but it is
+ not clear how to otherwise have the bundled version trump the
+ actually standardized one for a short-term compilation fix.
+
+diff --git a/libavcodec/Makefile b/libavcodec/Makefile
+index 470d7cb9b1..09ae5270b3 100644
+--- a/libavcodec/Makefile
++++ b/libavcodec/Makefile
+@@ -1262,7 +1262,7 @@ SKIPHEADERS += %_tablegen.h \
+ aacenc_quantization.h \
+ aacenc_quantization_misc.h \
+ bitstream_template.h \
+- vulkan_video_codec_av1std.h \
++ vulkan_video_codec_av1std_mesa.h \
+ $(ARCH)/vpx_arith.h \
+
+ SKIPHEADERS-$(CONFIG_AMF) += amfenc.h
+@@ -1285,7 +1285,7 @@ SKIPHEADERS-$(CONFIG_XVMC) += xvmc.h
+ SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_decode.h vaapi_hevc.h vaapi_encode.h
+ SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h vdpau_internal.h
+ SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX) += videotoolbox.h vt_internal.h
+-SKIPHEADERS-$(CONFIG_VULKAN) += vulkan.h vulkan_video.h vulkan_decode.h vulkan_video_codec_av1std_decode.h
++SKIPHEADERS-$(CONFIG_VULKAN) += vulkan.h vulkan_video.h vulkan_decode.h vulkan_video_codec_av1std_decode_mesa.h
+ SKIPHEADERS-$(CONFIG_V4L2_M2M) += v4l2_buffers.h v4l2_context.h v4l2_m2m.h
+ SKIPHEADERS-$(CONFIG_ZLIB) += zlib_wrapper.h
+
+diff --git a/libavcodec/vulkan_video.h b/libavcodec/vulkan_video.h
+index b28e3fe0bd..51f44dd543 100644
+--- a/libavcodec/vulkan_video.h
++++ b/libavcodec/vulkan_video.h
+@@ -23,8 +23,8 @@
+ #include "vulkan.h"
+
+ #include <vk_video/vulkan_video_codecs_common.h>
+-#include "vulkan_video_codec_av1std.h"
+-#include "vulkan_video_codec_av1std_decode.h"
++#include "vulkan_video_codec_av1std_mesa.h"
++#include "vulkan_video_codec_av1std_decode_mesa.h"
+
+ #define CODEC_VER_MAJ(ver) (ver >> 22)
+ #define CODEC_VER_MIN(ver) ((ver >> 12) & ((1 << 10) - 1))
+diff --git a/libavcodec/vulkan_video_codec_av1std_decode.h b/libavcodec/vulkan_video_codec_av1std_decode_mesa.h
+similarity index 89%
+rename from libavcodec/vulkan_video_codec_av1std_decode.h
+rename to libavcodec/vulkan_video_codec_av1std_decode_mesa.h
+index a697c00593..e2f37b4e6e 100644
+--- a/libavcodec/vulkan_video_codec_av1std_decode.h
++++ b/libavcodec/vulkan_video_codec_av1std_decode_mesa.h
+@@ -14,8 +14,8 @@
+ * limitations under the License.
+ */
+
+-#ifndef VULKAN_VIDEO_CODEC_AV1STD_DECODE_H_
+-#define VULKAN_VIDEO_CODEC_AV1STD_DECODE_H_ 1
++#ifndef VULKAN_VIDEO_CODEC_AV1STD_DECODE_MESA_H_
++#define VULKAN_VIDEO_CODEC_AV1STD_DECODE_MESA_H_ 1
+
+ /*
+ ** This header is NOT YET generated from the Khronos Vulkan XML API Registry.
+diff --git a/libavcodec/vulkan_video_codec_av1std.h b/libavcodec/vulkan_video_codec_av1std_mesa.h
+similarity index 99%
+rename from libavcodec/vulkan_video_codec_av1std.h
+rename to libavcodec/vulkan_video_codec_av1std_mesa.h
+index c46236c457..c91589eee2 100644
+--- a/libavcodec/vulkan_video_codec_av1std.h
++++ b/libavcodec/vulkan_video_codec_av1std_mesa.h
+@@ -14,8 +14,8 @@
+ * limitations under the License.
+ */
+
+-#ifndef VULKAN_VIDEO_CODEC_AV1STD_H_
+-#define VULKAN_VIDEO_CODEC_AV1STD_H_ 1
++#ifndef VULKAN_VIDEO_CODEC_AV1STD_MESA_H_
++#define VULKAN_VIDEO_CODEC_AV1STD_MESA_H_ 1
+
+ /*
+ ** This header is NOT YET generated from the Khronos Vulkan XML API Registry.
+diff --git a/tests/ref/fate/source b/tests/ref/fate/source
+index c575789dd5..8bb58b61f1 100644
+--- a/tests/ref/fate/source
++++ b/tests/ref/fate/source
+@@ -23,8 +23,8 @@ compat/djgpp/math.h
+ compat/float/float.h
+ compat/float/limits.h
+ libavcodec/bitstream_template.h
+-libavcodec/vulkan_video_codec_av1std.h
+-libavcodec/vulkan_video_codec_av1std_decode.h
++libavcodec/vulkan_video_codec_av1std_decode_mesa.h
++libavcodec/vulkan_video_codec_av1std_mesa.h
+ tools/decode_simple.h
+ Use of av_clip() where av_clip_uintp2() could be used:
+ Use of av_clip() where av_clip_intp2() could be used:
diff --git a/ffmpeg.spec b/ffmpeg.spec
index f055ea0..d011198 100644
--- a/ffmpeg.spec
+++ b/ffmpeg.spec
@@ -3,31 +3,46 @@
%bcond_without compat32
%endif
-%define major 59
-%define ppmajor 56
-%define avumajor 57
-%define swsmajor 6
-%define filtermajor 8
-%define swrmajor 4
-%define libavcodec %mklibname avcodec %{major}
-%define libavdevice %mklibname avdevice %{major}
-%define libavfilter %mklibname avfilter %{filtermajor}
-%define libavformat %mklibname avformat %{major}
-%define libavutil %mklibname avutil %{avumajor}
-%define libpostproc %mklibname postproc %{ppmajor}
-%define libswresample %mklibname swresample %{swrmajor}
-%define libswscale %mklibname swscale %{swsmajor}
-%define lib32avcodec %mklib32name avcodec %{major}
-%define lib32avdevice %mklib32name avdevice %{major}
-%define lib32avfilter %mklib32name avfilter %{filtermajor}
-%define lib32avformat %mklib32name avformat %{major}
-%define lib32avutil %mklib32name avutil %{avumajor}
-%define lib32postproc %mklib32name postproc %{ppmajor}
-%define lib32swresample %mklib32name swresample %{swrmajor}
-%define lib32swscale %mklib32name swscale %{swsmajor}
-# Workaround for incorrect naming in previous version.
-# Can be dropped on next soname bump.
-%define oldlibswscale %mklibname swscaler %{swsmajor}
+%define major 61
+%define ppmajor 58
+%define avumajor 59
+%define swsmajor 8
+%define filtermajor 10
+%define swrmajor 5
+%define libavcodec %mklibname avcodec
+%define libavdevice %mklibname avdevice
+%define libavfilter %mklibname avfilter
+%define libavformat %mklibname avformat
+%define libavutil %mklibname avutil
+%define libpostproc %mklibname postproc
+%define libswresample %mklibname swresample
+%define libswscale %mklibname swscale
+%define lib32avcodec %mklib32name avcodec
+%define lib32avdevice %mklib32name avdevice
+%define lib32avfilter %mklib32name avfilter
+%define lib32avformat %mklib32name avformat
+%define lib32avutil %mklib32name avutil
+%define lib32postproc %mklib32name postproc
+%define lib32swresample %mklib32name swresample
+%define lib32swscale %mklib32name swscale
+# Last versions with versioned names
+%define oldlibavcodec %mklibname avcodec 60
+%define oldlibavdevice %mklibname avdevice 60
+%define oldlibavfilter %mklibname avfilter 9
+%define oldlibavformat %mklibname avformat 60
+%define oldlibavutil %mklibname avutil 58
+%define oldlibpostproc %mklibname postproc 57
+%define oldlibswresample %mklibname swresample 4
+%define oldlibswscale %mklibname swscale 7
+%define oldlib32avcodec %mklib32name avcodec 60
+%define oldlib32avdevice %mklib32name avdevice 60
+%define oldlib32avfilter %mklib32name avfilter 9
+%define oldlib32avformat %mklib32name avformat 60
+%define oldlib32avutil %mklib32name avutil 58
+%define oldlib32postproc %mklib32name postproc 57
+%define oldlib32swresample %mklib32name swresample 4
+%define oldlib32swscale %mklib32name swscale 7
+
%define devname %mklibname %{name} -d
%define statname %mklibname %{name} -s -d
%define dev32name %mklib32name %{name} -d
@@ -73,17 +88,17 @@
%bcond_without swscaler
# (tpg) use OpenMP
-%global optflags %{optflags} -O3 -fopenmp
-%global ldflags %{ldflags} -O3 -fopenmp
+%global optflags %{optflags} -O3 -fopenmp -fno-strict-aliasing
+%global build_ldflags %{build_ldflags} -O3 -fopenmp -fno-strict-aliasing
Summary: Hyper fast MPEG1/MPEG4/H263/H264/H265/RV and AC3/MPEG audio encoder
Name: ffmpeg
# (tpg) BIG FAT WARNING !!!
# ALWAYS RUN package-restricted-headers.sh
# AND UPLOAD output file as SOURCE1
-%define x264_major 163
-%define x265_major 199
-Version: 5.1.2
+%define x264_major 164
+%define x265_major 215
+Version: 7.1.3
Release: 1
# BIG FAT WARNING !!!
%if %{build_plf}
@@ -92,27 +107,42 @@ License: GPLv3+
License: GPLv2+
%endif
Group: Video
-Url: http://ffmpeg.org/
+Url: https://ffmpeg.org/
Source0: http://ffmpeg.org/releases/%{name}-%{version}.tar.xz
Source1: restricted-multimedia-headers.tar.xz
Source2: restricted-defines.macros
# Creates Source1
Source10: package-restricted-headers.sh
-Patch1: ffmpeg-4.3-dlopen-faac-mp3lame-opencore-x264-x265-xvid.patch
-Patch2: ffmpeg-1.0.1-time.h.patch
-Patch3: ffmpeg-2.5-fix-build-with-flto-and-inline-assembly.patch
+Patch1: ffmpeg-1.0.1-time.h.patch
+%if %{with dlopen}
+Patch2: ffmpeg-4.3-dlopen-faac-mp3lame-opencore-x264-x265-xvid.patch
+%endif
+#Patch3: ffmpeg-2.5-fix-build-with-flto-and-inline-assembly.patch
# https://ffmpeg-devel.ffmpeg.narkive.com/qPHDqDaR/patch-1-5-avformat-adding-accessors-for-externally-used-avstream-fields-which-are-after-the-public#post8
# Generally useless but harmless, but seems to be needed by some versions of Opera, so let's keep it here for now
Patch4: ffmpeg-4.4-add-accessors-for-AVStream.patch
+#Patch5: ffmpeg-5.1.2-fix-vulkan.patch
+%ifarch %{x86_64}
+# https://github.com/OpenVisualCloud/SVT-VP9/blob/master/ffmpeg_plugin/master-0001-Add-ability-for-ffmpeg-to-run-svt-vp9.patch
+Patch7: master-0001-Add-ability-for-ffmpeg-to-run-svt-vp9.patch
+%endif
+Patch9: libsvtav1_rename_aq_mode.patch
+# From upstream git:
+# (currently nothing backported)
+BuildRequires: make
BuildRequires: AMF-devel
BuildRequires: texi2html
-BuildRequires: yasm
+%ifarch %{ix86} %{x86_64}
+BuildRequires: nasm
+%endif
BuildRequires: pkgconfig(bzip2)
BuildRequires: flite-devel
BuildRequires: gsm-devel
BuildRequires: pkgconfig(libjpeg)
BuildRequires: ladspa-devel
BuildRequires: pkgconfig(libgme)
+BuildRequires: pkgconfig(libjxl)
+BuildRequires: vulkan-headers
BuildRequires: gomp-devel
%ifnarch %{riscv}
BuildRequires: pkgconfig(caca)
@@ -124,7 +154,10 @@ BuildRequires: pkgconfig(fdk-aac)
%endif
BuildRequires: pkgconfig(dav1d)
BuildRequires: pkgconfig(SvtAv1Enc)
-%ifnarch %{ix86} %{riscv} aarch64
+%ifarch %{x86_64}
+BuildRequires: pkgconfig(SvtVp9Enc)
+%endif
+%ifnarch %{ix86} %{riscv}
BuildRequires: pkgconfig(rav1e)
%endif
%ifnarch %{riscv}
@@ -158,10 +191,12 @@ BuildRequires: pkgconfig(libva)
BuildRequires: pkgconfig(libv4l2)
BuildRequires: pkgconfig(libwebp)
BuildRequires: pkgconfig(libzmq)
-%ifarch x86_64
+%ifarch %{x86_64}
# intel-mediasdk -- for now, useless on anything but x86_64
-# (yes, even znver1 -- AMD CPUs don't have builtin Intel GPUs)
-BuildRequires: pkgconfig(libmfx)
+# but vpl can be used on Intel ARC GPU which also works on AMD Znver
+#BuildRequires: pkgconfig(libmfx)
+# Media-sdk is deprecated and replaced by vpl. FFmpeg support both but can be compiled wih only one. Pick up new vpl.
+BuildRequires: pkgconfig(vpl)
%endif
%ifnarch %{riscv}
BuildRequires: pkgconfig(openal)
@@ -286,8 +321,7 @@ Suggests: libxvidcore.so.4%{_arch_tag_suffix}
Suggests: libfdk-aac.so.2%{_arch_tag_suffix}
%endif
%endif
-Requires: vdpau-drivers
-Obsoletes: %{_lib}ffmpeg54 < 1.1-3
+%rename %{oldlibavcodec}
%description -n %{libavcodec}
This package contains a shared library for %{name}.
@@ -295,7 +329,7 @@ This package contains a shared library for %{name}.
%package -n %{libavdevice}
Summary: Shared library part of ffmpeg
Group: System/Libraries
-Conflicts: %{_lib}avformats54 < 1.1-3
+%rename %{oldlibavdevice}
%description -n %{libavdevice}
This package contains a shared library for %{name}.
@@ -303,6 +337,7 @@ This package contains a shared library for %{name}.
%package -n %{libavfilter}
Summary: Shared library part of ffmpeg
Group: System/Libraries
+%rename %{oldlibavfilter}
%description -n %{libavfilter}
This package contains a shared library for %{name}.
@@ -310,7 +345,7 @@ This package contains a shared library for %{name}.
%package -n %{libavformat}
Summary: Shared library part of ffmpeg
Group: System/Libraries
-Obsoletes: %{_lib}avformats54 < 1.1-3
+%rename %{oldlibavformat}
%description -n %{libavformat}
This package contains a shared library for %{name}.
@@ -318,7 +353,7 @@ This package contains a shared library for %{name}.
%package -n %{libavutil}
Summary: Shared library part of ffmpeg
Group: System/Libraries
-Obsoletes: %{mklibname avutil 51} < 1.1
+%rename %{oldlibavutil}
%description -n %{libavutil}
This package contains a shared library for %{name}.
@@ -326,6 +361,7 @@ This package contains a shared library for %{name}.
%package -n %{libpostproc}
Summary: Shared library part of ffmpeg
Group: System/Libraries
+%rename %{oldlibpostproc}
%description -n %{libpostproc}
This package contains a shared library for %{name}.
@@ -333,6 +369,7 @@ This package contains a shared library for %{name}.
%package -n %{libswresample}
Summary: Shared library part of ffmpeg
Group: System/Libraries
+%rename %{oldlibswresample}
%description -n %{libswresample}
This package contains a shared library for %{name}.
@@ -388,7 +425,7 @@ Suggests: libopencore-amrwb.so.0
Suggests: libmp3lame.so.0
Suggests: libxvidcore.so.4
Suggests: libfdk-aac.so.2
-Requires: libvdpau-drivers
+%rename %{oldlib32avcodec}
%description -n %{lib32avcodec}
This package contains a shared library for %{name}.
@@ -396,6 +433,7 @@ This package contains a shared library for %{name}.
%package -n %{lib32avdevice}
Summary: Shared library part of ffmpeg (32-bit)
Group: System/Libraries
+%rename %{oldlib32avdevice}
%description -n %{lib32avdevice}
This package contains a shared library for %{name}.
@@ -403,6 +441,7 @@ This package contains a shared library for %{name}.
%package -n %{lib32avfilter}
Summary: Shared library part of ffmpeg (32-bit)
Group: System/Libraries
+%rename %{oldlib32avfilter}
%description -n %{lib32avfilter}
This package contains a shared library for %{name}.
@@ -410,6 +449,7 @@ This package contains a shared library for %{name}.
%package -n %{lib32avformat}
Summary: Shared library part of ffmpeg (32-bit)
Group: System/Libraries
+%rename %{oldlib32avformat}
%description -n %{lib32avformat}
This package contains a shared library for %{name}.
@@ -417,6 +457,7 @@ This package contains a shared library for %{name}.
%package -n %{lib32avutil}
Summary: Shared library part of ffmpeg (32-bit)
Group: System/Libraries
+%rename %{oldlib32avutil}
%description -n %{lib32avutil}
This package contains a shared library for %{name}.
@@ -424,6 +465,7 @@ This package contains a shared library for %{name}.
%package -n %{lib32postproc}
Summary: Shared library part of ffmpeg (32-bit)
Group: System/Libraries
+%rename %{oldlib32postproc}
%description -n %{lib32postproc}
This package contains a shared library for %{name}.
@@ -431,6 +473,7 @@ This package contains a shared library for %{name}.
%package -n %{lib32swresample}
Summary: Shared library part of ffmpeg (32-bit)
Group: System/Libraries
+%rename %{oldlib32swresample}
%description -n %{lib32swresample}
This package contains a shared library for %{name}.
@@ -439,6 +482,7 @@ This package contains a shared library for %{name}.
%package -n %{lib32swscale}
Summary: Shared library part of ffmpeg (32-bit)
Group: System/Libraries
+%rename %{oldlib32swscale}
%description -n %{lib32swscale}
This package contains a shared library for %{name}.
@@ -472,13 +516,8 @@ This package contains the static libraries for %{name}.
%endif
%prep
-%setup -q -a 1
-%patch2 -p1 -b .timeh~
-%if %{with dlopen}
-%patch1 -p1 -b .dlopen~
-%endif
-%patch3 -p1 -b .flto_inline_asm~
-%patch4 -p1 -b .accessor~
+%autosetup -p 1
+%setup -T -D -a 1 -q
# The debuginfo generator doesn't like non-world readable files
find . -name "*.c" -o -name "*.h" -o -name "*.asm" |xargs chmod 0644
@@ -488,7 +527,7 @@ find . -name "*.c" -o -name "*.h" -o -name "*.asm" |xargs chmod 0644
%ifarch %{ix86}
%global ldflags %{build_ldflags} -Wl,-z,notext
%endif
-export CFLAGS="%{optflags} -fPIC -I/usr/include/openjpeg-2.2"
+export CFLAGS="%{optflags} -fPIC -I/usr/include/openjpeg-2.5"
export LDFLAGS="%{build_ldflags}"
%ifarch %{ix86}
@@ -523,7 +562,7 @@ if ! CFLAGS="$(echo $CFLAGS |sed -e 's,-m64,,g;s,-mx32,,g') -fomit-frame-pointer
--enable-gpl \
--enable-version3 \
--enable-nonfree \
-%ifnarch %{armx} %{arm} %{riscv}
+%ifarch %{ix86} %{x86_64}
--enable-nvenc \
%endif
--enable-ffplay \
@@ -621,6 +660,8 @@ fi
cd ..
%endif
+# FIXME forcing gcc on aarch64 for now (ffmpeg 6.0, clang 16.0.1)
+# because of a link time failure
if ! ./configure \
--cc=%{__cc} \
--cxx=%{__cxx} \
@@ -631,17 +672,21 @@ if ! ./configure \
--incdir=%{_includedir} \
--disable-stripping \
--enable-amf \
+ --enable-libjxl \
--enable-postproc \
--enable-gpl \
--enable-version3 \
--enable-nonfree \
-%ifnarch %{armx} %{arm} %{riscv}
+%ifarch %{ix86} %{x86_64} aarch64
--enable-nvenc \
%endif
--enable-ffplay \
--enable-libdav1d \
--enable-libsvtav1 \
-%ifnarch %{ix86} aarch64
+%ifarch %{x86_64}
+ --enable-libsvtvp9 \
+%endif
+%ifnarch %{ix86}
--enable-librav1e \
%endif
--enable-libaom \
@@ -665,7 +710,7 @@ if ! ./configure \
--enable-libgsm \
--enable-libcelt \
%ifarch x86_64
- --enable-libmfx \
+ --enable-libvpl \
%endif
%if %{with opencv}
--enable-libopencv \
diff --git a/libsvtav1_rename_aq_mode.patch b/libsvtav1_rename_aq_mode.patch
new file mode 100644
index 0000000..efa0e33
--- /dev/null
+++ b/libsvtav1_rename_aq_mode.patch
@@ -0,0 +1,27 @@
+From a5d4c398b411a00ac09d8fe3b66117222323844c Mon Sep 17 00:00:00 2001
+From: Christopher Degawa <ccom@randomderp.com>
+Date: Wed, 21 Jan 2026 00:12:59 -0600
+Subject: [PATCH] avcodec/libsvtav1: rename aq_mode for v4.0.0
+
+Signed-off-by: Christopher Degawa <ccom@randomderp.com>
+Signed-off-by: James Almer <jamrial@gmail.com>
+---
+ libavcodec/libsvtav1.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
+index 7047b72422fb3..90c61b98a1bf3 100644
+--- a/libavcodec/libsvtav1.c
++++ b/libavcodec/libsvtav1.c
+@@ -237,7 +237,11 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param,
+ } else if (svt_enc->qp > 0) {
+ param->qp = svt_enc->qp;
+ param->rate_control_mode = 0;
++#if SVT_AV1_CHECK_VERSION(4, 0, 0)
++ param->aq_mode = 0;
++#else
+ param->enable_adaptive_quantization = 0;
++#endif
+ }
+
+ desc = av_pix_fmt_desc_get(avctx->pix_fmt);
diff --git a/master-0001-Add-ability-for-ffmpeg-to-run-svt-vp9.patch b/master-0001-Add-ability-for-ffmpeg-to-run-svt-vp9.patch
new file mode 100644
index 0000000..c7cf628
--- /dev/null
+++ b/master-0001-Add-ability-for-ffmpeg-to-run-svt-vp9.patch
@@ -0,0 +1,788 @@
+From 38eb54ccd1f624e2ab700c1b10a0e6980df9c0b2 Mon Sep 17 00:00:00 2001
+From: hassene <hassene.tmar@intel.com>
+Date: Fri, 15 Feb 2019 17:43:54 -0800
+Subject: [PATCH] Add ability for ffmpeg to run svt vp9
+
+Signed-off-by: hassene <hassene.tmar@intel.com>
+Signed-off-by: Jing Sun <jing.a.sun@intel.com>
+Signed-off-by: Austin Hu <austin.hu@intel.com>
+Signed-off-by: Andrei Bich <dronimal@yandex-team.ru>
+Signed-off-by: Guo Jiansheng <jiansheng.guo@intel.com>
+---
+ configure | 4 +
+ libavcodec/Makefile | 1 +
+ libavcodec/allcodecs.c | 1 +
+ libavcodec/libsvt_vp9.c | 701 ++++++++++++++++++++++++++++++++++++++++
+ 4 files changed, 707 insertions(+)
+ create mode 100644 libavcodec/libsvt_vp9.c
+
+diff --git a/configure b/configure
+index 9f508a2527..a73e1f73c1 100755
+--- a/configure
++++ b/configure
+@@ -278,6 +278,7 @@ External library support:
+ --enable-libsrt enable Haivision SRT protocol via libsrt [no]
+ --enable-libssh enable SFTP protocol via libssh [no]
+ --enable-libsvtav1 enable AV1 encoding via SVT [no]
++ --enable-libsvtvp9 enable VP9 encoding via svt [no]
+ --enable-libtensorflow enable TensorFlow as a DNN module backend
+ for DNN based filters like sr [no]
+ --enable-libtesseract enable Tesseract, needed for ocr filter [no]
+@@ -1955,6 +1956,7 @@ EXTERNAL_LIBRARY_LIST="
+ libshaderc
+ libshine
+ libsmbclient
++ libsvtvp9
+ libsnappy
+ libsoxr
+ libspeex
+@@ -3587,6 +3589,7 @@ libvpx_vp8_decoder_deps="libvpx"
+ libvpx_vp8_encoder_deps="libvpx"
+ libvpx_vp9_decoder_deps="libvpx"
+ libvpx_vp9_encoder_deps="libvpx"
++libsvt_vp9_encoder_deps="libsvtvp9"
+ libvvenc_encoder_deps="libvvenc"
+ libwebp_encoder_deps="libwebp"
+ libwebp_anim_encoder_deps="libwebp"
+@@ -7008,6 +7011,7 @@ enabled libssh && require_pkg_config libssh "libssh >= 0.6.0" libssh/
+ enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
+ enabled libsrt && require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket
+ enabled libsvtav1 && require_pkg_config libsvtav1 "SvtAv1Enc >= 0.9.0" EbSvtAv1Enc.h svt_av1_enc_init_handle
++enabled libsvtvp9 && require_pkg_config libsvtvp9 SvtVp9Enc EbSvtVp9Enc.h eb_vp9_svt_init_handle
+ enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow
+ enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate
+ enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
+diff --git a/libavcodec/Makefile b/libavcodec/Makefile
+index dd5d0de898..5d2c74e95d 100644
+--- a/libavcodec/Makefile
++++ b/libavcodec/Makefile
+@@ -1160,6 +1160,7 @@ OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o
+ OBJS-$(CONFIG_LIBVORBIS_DECODER) += libvorbisdec.o
+ OBJS-$(CONFIG_LIBVORBIS_ENCODER) += libvorbisenc.o \
+ vorbis_data.o
++OBJS-$(CONFIG_LIBSVT_VP9_ENCODER) += libsvt_vp9.o
+ OBJS-$(CONFIG_LIBVPX_VP8_DECODER) += libvpxdec.o
+ OBJS-$(CONFIG_LIBVPX_VP8_ENCODER) += libvpxenc.o
+ OBJS-$(CONFIG_LIBVPX_VP9_DECODER) += libvpxdec.o
+diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
+index c7e5f9910c..acb332fb08 100644
+--- a/libavcodec/allcodecs.c
++++ b/libavcodec/allcodecs.c
+@@ -798,6 +798,7 @@ extern const FFCodec ff_libuavs3d_decoder;
+ extern const FFCodec ff_libvo_amrwbenc_encoder;
+ extern const FFCodec ff_libvorbis_encoder;
+ extern const FFCodec ff_libvorbis_decoder;
++extern const FFCodec ff_libsvt_vp9_encoder;
+ extern const FFCodec ff_libvpx_vp8_encoder;
+ extern const FFCodec ff_libvpx_vp8_decoder;
+ extern FFCodec ff_libvpx_vp9_encoder;
+diff --git a/libavcodec/libsvt_vp9.c b/libavcodec/libsvt_vp9.c
+new file mode 100644
+index 0000000000..05d2a95e99
+--- /dev/null
++++ b/libavcodec/libsvt_vp9.c
+@@ -0,0 +1,701 @@
++/*
++* Scalable Video Technology for VP9 encoder library plugin
++*
++* Copyright (c) 2018 Intel Corporation
++*
++* 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 this program; if not, write to the Free Software
++* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
++*/
++
++#include <stdint.h>
++#include "EbSvtVp9ErrorCodes.h"
++#include "EbSvtVp9Enc.h"
++
++#include "libavutil/common.h"
++#include "libavutil/frame.h"
++#include "libavutil/mem.h"
++#include "libavutil/opt.h"
++#include "libavcodec/get_bits.h"
++
++#include "codec_internal.h"
++#include "internal.h"
++#include "encode.h"
++#include "avcodec.h"
++
++#define SUPERFRAME_INDEX_MAX_SIZE 128
++
++#define RECIVED_FRAMES_MAX_SIZE 32
++#define MAX_VP9_SUPERFRAME_SIZE 8
++
++typedef enum eos_status {
++ EOS_NOT_REACHED = 0,
++ EOS_REACHED,
++ EOS_TOTRIGGER
++}EOS_STATUS;
++
++typedef struct SvtReceivedFrameStruct {
++ // fields for AVPacket
++ AVBufferRef *buf;
++ int64_t pts;
++ int64_t dts;
++ int size;
++ int flags;
++
++ // svt fields:
++ int ready_flag; // frame or superframe in data is visible
++ int frames_count;
++ int frames_sizes[MAX_VP9_SUPERFRAME_SIZE];
++} SvtReceivedFrameStruct;
++
++typedef struct SvtContext {
++ AVClass *class;
++
++ EbSvtVp9EncConfiguration enc_params;
++ EbComponentType *svt_handle;
++
++ EbBufferHeaderType *in_buf;
++ int raw_size;
++
++ AVFrame *frame;
++
++ AVBufferPool* pool;
++
++ EOS_STATUS eos_flag;
++
++ // User options.
++ int enc_mode;
++ int rc_mode;
++ int tune;
++ int qp;
++
++ int target_socket;
++
++ int forced_idr;
++
++ int level;
++
++ int base_layer_switch_mode;
++
++
++ int64_t last_ready_dts;
++ SvtReceivedFrameStruct received_frames[RECIVED_FRAMES_MAX_SIZE];
++ int received_frames_size;
++} SvtContext;
++
++static int error_mapping(EbErrorType svt_ret)
++{
++ int err;
++
++ switch (svt_ret) {
++ case EB_ErrorInsufficientResources:
++ err = AVERROR(ENOMEM);
++ break;
++
++ case EB_ErrorUndefined:
++ case EB_ErrorInvalidComponent:
++ case EB_ErrorBadParameter:
++ err = AVERROR(EINVAL);
++ break;
++
++ case EB_ErrorDestroyThreadFailed:
++ case EB_ErrorSemaphoreUnresponsive:
++ case EB_ErrorDestroySemaphoreFailed:
++ case EB_ErrorCreateMutexFailed:
++ case EB_ErrorMutexUnresponsive:
++ case EB_ErrorDestroyMutexFailed:
++ err = AVERROR_EXTERNAL;
++ break;
++
++ case EB_NoErrorEmptyQueue:
++ err = AVERROR(EAGAIN);
++
++ case EB_ErrorNone:
++ err = 0;
++ break;
++
++ default:
++ err = AVERROR_UNKNOWN;
++ }
++
++ return err;
++}
++
++static void free_buffer(SvtContext *svt_enc)
++{
++ if (svt_enc->in_buf) {
++ EbSvtEncInput *in_data = (EbSvtEncInput *)svt_enc->in_buf->p_buffer;
++ av_freep(&in_data);
++ av_freep(&svt_enc->in_buf);
++ }
++ av_buffer_pool_uninit(&svt_enc->pool);
++}
++
++static int alloc_buffer(EbSvtVp9EncConfiguration *config, SvtContext *svt_enc)
++{
++ const size_t luma_size_8bit =
++ config->source_width * config->source_height;
++ const size_t luma_size_10bit =
++ (config->encoder_bit_depth > 8) ? luma_size_8bit : 0;
++
++ EbSvtEncInput *in_data;
++
++ svt_enc->raw_size = ((luma_size_8bit + luma_size_10bit) * 3 / 2) * MAX_VP9_SUPERFRAME_SIZE + SUPERFRAME_INDEX_MAX_SIZE;
++
++ // allocate buffer for in and out
++ svt_enc->in_buf = av_mallocz(sizeof(*svt_enc->in_buf));
++ if (!svt_enc->in_buf)
++ goto failed;
++
++
++ svt_enc->in_buf->p_buffer = (unsigned char *)av_mallocz(sizeof(*in_data));
++ if (!svt_enc->in_buf->p_buffer)
++ goto failed;
++
++ svt_enc->in_buf->size = sizeof(*svt_enc->in_buf);
++ svt_enc->in_buf->p_app_private = NULL;
++
++ svt_enc->pool = av_buffer_pool_init(svt_enc->raw_size, NULL);
++ if (!svt_enc->pool)
++ goto failed;
++
++ svt_enc->received_frames_size = 0;
++ svt_enc->last_ready_dts = -1e9;
++
++ return 0;
++
++failed:
++ free_buffer(svt_enc);
++ return AVERROR(ENOMEM);
++}
++
++static int config_enc_params(EbSvtVp9EncConfiguration *param,
++ AVCodecContext *avctx)
++{
++ SvtContext *svt_enc = avctx->priv_data;
++ int ret;
++ int ten_bits = 0;
++
++ param->source_width = avctx->width;
++ param->source_height = avctx->height;
++
++ if (avctx->pix_fmt == AV_PIX_FMT_YUV420P10LE) {
++ av_log(avctx, AV_LOG_DEBUG , "Encoder 10 bits depth input\n");
++ // Disable Compressed 10-bit format default
++ ten_bits = 1;
++ }
++
++ // Update param from options
++ param->enc_mode = svt_enc->enc_mode;
++ param->level = svt_enc->level;
++ param->rate_control_mode = svt_enc->rc_mode;
++ param->tune = svt_enc->tune;
++ param->base_layer_switch_mode = svt_enc->base_layer_switch_mode;
++ param->qp = svt_enc->qp;
++ param->target_socket = svt_enc->target_socket;
++ param->target_bit_rate = avctx->bit_rate;
++ if (avctx->gop_size > 0)
++ param->intra_period = avctx->gop_size - 1;
++
++ if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
++ param->frame_rate_numerator = avctx->framerate.num;
++ param->frame_rate_denominator = avctx->framerate.den * avctx->ticks_per_frame;
++ } else {
++ param->frame_rate_numerator = avctx->time_base.den;
++ param->frame_rate_denominator = avctx->time_base.num * avctx->ticks_per_frame;
++ }
++
++ if (param->rate_control_mode) {
++ param->max_qp_allowed = avctx->qmax;
++ param->min_qp_allowed = avctx->qmin;
++ }
++
++ if (ten_bits) {
++ param->encoder_bit_depth = 10;
++ }
++
++ ret = alloc_buffer(param, svt_enc);
++
++ return ret;
++}
++
++static void read_in_data(EbSvtVp9EncConfiguration *config,
++ const AVFrame *frame,
++ EbBufferHeaderType *headerPtr)
++{
++ uint8_t is16bit = config->encoder_bit_depth > 8;
++ uint64_t luma_size =
++ (uint64_t)config->source_width * config->source_height<< is16bit;
++ EbSvtEncInput *in_data = (EbSvtEncInput *)headerPtr->p_buffer;
++
++ // support yuv420p and yuv420p010
++ in_data->luma = frame->data[0];
++ in_data->cb = frame->data[1];
++ in_data->cr = frame->data[2];
++
++ // stride info
++ in_data->y_stride = frame->linesize[0] >> is16bit;
++ in_data->cb_stride = frame->linesize[1] >> is16bit;
++ in_data->cr_stride = frame->linesize[2] >> is16bit;
++
++ headerPtr->n_filled_len += luma_size * 3/2u;
++}
++
++static av_cold int eb_enc_init(AVCodecContext *avctx)
++{
++ SvtContext *svt_enc = avctx->priv_data;
++ EbErrorType svt_ret;
++
++ svt_enc->eos_flag = EOS_NOT_REACHED;
++
++ svt_ret = eb_vp9_svt_init_handle(&svt_enc->svt_handle, svt_enc, &svt_enc->enc_params);
++ if (svt_ret != EB_ErrorNone) {
++ av_log(avctx, AV_LOG_ERROR, "Error init encoder handle\n");
++ goto failed;
++ }
++
++ svt_ret = config_enc_params(&svt_enc->enc_params, avctx);
++ if (svt_ret != EB_ErrorNone) {
++ av_log(avctx, AV_LOG_ERROR, "Error configure encoder parameters\n");
++ goto failed_init_handle;
++ }
++
++ svt_ret = eb_vp9_svt_enc_set_parameter(svt_enc->svt_handle, &svt_enc->enc_params);
++ if (svt_ret != EB_ErrorNone) {
++ av_log(avctx, AV_LOG_ERROR, "Error setting encoder parameters\n");
++ goto failed_init_handle;
++ }
++
++ svt_ret = eb_vp9_init_encoder(svt_enc->svt_handle);
++ if (svt_ret != EB_ErrorNone) {
++ av_log(avctx, AV_LOG_ERROR, "Error init encoder\n");
++ goto failed_init_handle;
++ }
++
++ svt_enc->frame = av_frame_alloc();
++ if (!svt_enc->frame)
++ return AVERROR(ENOMEM);
++
++ // if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
++ // EbBufferHeaderType* headerPtr;
++ // headerPtr->size = sizeof(headerPtr);
++ // headerPtr->n_filled_len = 0; /* in/out */
++ // headerPtr->p_buffer = av_malloc(10 * 1024 * 1024);
++ // headerPtr->n_alloc_len = (10 * 1024 * 1024);
++ //
++ // if (!headerPtr->p_buffer) {
++ // av_log(avctx, AV_LOG_ERROR,
++ // "Cannot allocate buffer size %d.\n", headerPtr->n_alloc_len);
++ // svt_ret = EB_ErrorInsufficientResources;
++ // goto failed_init_enc;
++ // }
++ //
++ // svt_ret = eb_svt_enc_stream_header(svt_enc->svt_handle, &headerPtr);
++ // if (svt_ret != EB_ErrorNone) {
++ // av_log(avctx, AV_LOG_ERROR, "Error when build stream header.\n");
++ // av_freep(&headerPtr->p_buffer);
++ // goto failed_init_enc;
++ // }
++ //
++ // avctx->extradata_size = headerPtr->n_filled_len;
++ // avctx->extradata = av_mallocz(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
++ // if (!avctx->extradata) {
++ // av_log(avctx, AV_LOG_ERROR,
++ // "Cannot allocate VP9 header of size %d.\n", avctx->extradata_size);
++ // av_freep(&headerPtr->p_buffer);
++ // svt_ret = EB_ErrorInsufficientResources;
++ // goto failed_init_enc;
++ // }
++ // memcpy(avctx->extradata, headerPtr->p_buffer, avctx->extradata_size);
++ //
++ // av_freep(&headerPtr->p_buffer);
++ // }
++ return 0;
++
++//failed_init_enc:
++// eb_deinit_encoder(svt_enc->svt_handle);
++failed_init_handle:
++ eb_vp9_deinit_handle(svt_enc->svt_handle);
++failed:
++ free_buffer(svt_enc);
++ return error_mapping(svt_ret);
++}
++
++static int eb_send_frame(AVCodecContext *avctx, const AVFrame *frame)
++{
++ SvtContext *svt_enc = avctx->priv_data;
++ EbBufferHeaderType *headerPtr = svt_enc->in_buf;
++
++ if (!frame) {
++ if (svt_enc->eos_flag == EOS_REACHED)
++ return 0;
++
++ EbBufferHeaderType headerPtrLast;
++ headerPtrLast.n_alloc_len = 0;
++ headerPtrLast.n_filled_len = 0;
++ headerPtrLast.n_tick_count = 0;
++ headerPtrLast.p_app_private = NULL;
++ headerPtrLast.p_buffer = NULL;
++ headerPtrLast.flags = EB_BUFFERFLAG_EOS;
++
++ eb_vp9_svt_enc_send_picture(svt_enc->svt_handle, &headerPtrLast);
++ svt_enc->eos_flag = EOS_REACHED;
++ av_log(avctx, AV_LOG_DEBUG, "Finish sending frames!!!\n");
++ return 0;
++ }
++
++ read_in_data(&svt_enc->enc_params, frame, headerPtr);
++
++ headerPtr->flags = 0;
++ headerPtr->p_app_private = NULL;
++ headerPtr->pts = frame->pts;
++ switch (frame->pict_type) {
++ case AV_PICTURE_TYPE_I:
++ headerPtr->pic_type = svt_enc->forced_idr > 0 ? EB_IDR_PICTURE : EB_I_PICTURE;
++ break;
++ case AV_PICTURE_TYPE_P:
++ headerPtr->pic_type = EB_P_PICTURE;
++ break;
++ case AV_PICTURE_TYPE_B:
++ headerPtr->pic_type = EB_B_PICTURE;
++ break;
++ default:
++ headerPtr->pic_type = EB_INVALID_PICTURE;
++ break;
++ }
++ eb_vp9_svt_enc_send_picture(svt_enc->svt_handle, headerPtr);
++
++ return 0;
++}
++
++static int is_frame_visible(uint8_t const* ptr, int size) {
++ GetBitContext gb;
++ int ret, visible, profile;
++ if ((ret = init_get_bits8(&gb, ptr, size)) < 0) {
++ return ret;
++ }
++
++ // frame marker
++ get_bits(&gb, 2);
++ profile = get_bits1(&gb);
++ profile |= get_bits1(&gb) << 1;
++
++ // reserved_zero
++ if (profile == 3) profile += get_bits1(&gb); // reserved_zero
++
++ // read show_existing_frame
++ if (get_bits1(&gb)) {
++ // show_existing_frame == 1
++ visible = 1;
++ } else {
++ // show_existing_frame == 0
++ // keyframe (frame_type actually)
++ get_bits1(&gb);
++ // read show_frame
++ visible = get_bits1(&gb) ? 2 : 0;
++ }
++
++ return visible;
++}
++
++static int get_received_frame(SvtContext *svt_enc, AVPacket *pkt) {
++ SvtReceivedFrameStruct* rfs = &svt_enc->received_frames[0];
++
++ if (svt_enc->received_frames_size == 0 || !rfs->ready_flag) {
++ return AVERROR(EAGAIN);
++ }
++
++ pkt->buf = rfs->buf;
++ pkt->data = rfs->buf->data;
++ pkt->dts = rfs->dts;
++ pkt->pts = rfs->pts;
++ pkt->flags = rfs->flags;
++ pkt->size = rfs->size;
++
++ --svt_enc->received_frames_size;
++ for (int i = 0; i < svt_enc->received_frames_size; ++i) {
++ svt_enc->received_frames[i] = svt_enc->received_frames[i + 1];
++ }
++
++ return 0;
++}
++
++static int put_received_frame(AVCodecContext *avctx, uint8_t* data, int size, int keyframe, int64_t dts, int64_t pts) {
++ SvtContext *svt_enc = avctx->priv_data;
++ SvtReceivedFrameStruct* rfs;
++
++ if (svt_enc->received_frames_size == 0 || svt_enc->received_frames[svt_enc->received_frames_size - 1].ready_flag) {
++ ++svt_enc->received_frames_size;
++ if (svt_enc->received_frames_size > RECIVED_FRAMES_MAX_SIZE) {
++ av_log(avctx, AV_LOG_ERROR, "Fail: svt_enc->received_frames_size > RECIVED_FRAMES_MAX_SIZE \n");
++ return AVERROR_BUG;
++ }
++
++ rfs = &svt_enc->received_frames[svt_enc->received_frames_size - 1];
++
++ rfs->buf = av_buffer_pool_get(svt_enc->pool);
++ if (!rfs->buf) {
++ av_log(avctx, AV_LOG_ERROR, "Failed to allocate output packet.\n");
++ return AVERROR(ENOMEM);
++ }
++
++ rfs->size = 0;
++ rfs->flags = 0;
++ rfs->ready_flag = 0;
++ rfs->frames_count = 0;
++ } else {
++ rfs = &svt_enc->received_frames[svt_enc->received_frames_size - 1];
++ }
++
++ rfs->pts = pts;
++ rfs->dts = dts;
++ rfs->flags = (keyframe ? AV_PKT_FLAG_KEY : 0);
++
++ ++rfs->frames_count;
++ if (rfs->frames_count > MAX_VP9_SUPERFRAME_SIZE) {
++ av_log(avctx, AV_LOG_ERROR, "Fail: rfs->frames_count > MAX_VP9_SUPERFRAME_SIZE \n");
++ return AVERROR_BUG;
++ }
++
++ rfs->frames_sizes[rfs->frames_count - 1] = size;
++
++ memcpy(rfs->buf->data + rfs->size, data, size);
++ rfs->size += size;
++
++ int visible = is_frame_visible(data, size);
++ if (visible < 0) {
++ av_log(avctx, AV_LOG_ERROR, "Fail: is_frame_visible \n");
++ return visible;
++ }
++
++
++ rfs->ready_flag = visible;
++
++ if (rfs->ready_flag) {
++ if (rfs->dts <= svt_enc->last_ready_dts) {
++ rfs->dts = svt_enc->last_ready_dts + 1;
++ }
++ svt_enc->last_ready_dts = rfs->dts;
++
++ }
++
++ // add superframe_index if needed
++ if (rfs->ready_flag && rfs->frames_count > 1) {
++ // superframe_header:
++ // 110 - superframe_marker
++ // 11 = 3 = bytes_per_framesize_minus_1 - use 4-bytes size
++ // xxx = frames_in_superframe_minus_1
++ uint8_t header = 0b11011000;
++ header |= (rfs->frames_count - 1) & 0b111;
++
++ uint8_t* ptr = rfs->buf->data + rfs->size;
++
++ ptr[0] = header;
++ ++ptr;
++
++ for (int i = 0; i < rfs->frames_count; ++i) {
++ ptr[0] = (rfs->frames_sizes[i] >> 0) & 0xff;
++ ptr[1] = (rfs->frames_sizes[i] >> 8) & 0xff;
++ ptr[2] = (rfs->frames_sizes[i] >> 16) & 0xff;
++ ptr[3] = (rfs->frames_sizes[i] >> 24) & 0xff;
++
++ ptr += 4;
++ }
++
++ ptr[0] = header;
++ ++ptr;
++
++ rfs->size = ptr - rfs->buf->data;
++ }
++
++ return 0;
++}
++
++static int eb_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
++{
++ SvtContext *svt_enc = avctx->priv_data;
++ EbBufferHeaderType *headerPtr;
++ EbErrorType svt_ret;
++ AVBufferRef *ref;
++ int ret = 0;
++
++ if (get_received_frame(svt_enc, pkt) == 0) {
++ return 0;
++ }
++
++ if (EOS_TOTRIGGER == svt_enc->eos_flag) {
++ pkt = NULL;
++ return AVERROR_EOF;
++ }
++
++ AVFrame *frame = svt_enc->frame;
++ ret = ff_encode_get_frame(avctx, frame);
++ if (ret < 0 && ret != AVERROR_EOF) {
++ return ret;
++ }
++ if (ret == AVERROR_EOF)
++ frame = NULL;
++
++ ret = eb_send_frame(avctx, frame);
++ if (ret < 0)
++ return ret;
++ av_frame_unref(svt_enc->frame);
++
++ for (;;) {
++ svt_ret = eb_vp9_svt_get_packet(svt_enc->svt_handle, &headerPtr, svt_enc->eos_flag);
++ if (svt_ret == EB_NoErrorEmptyQueue) {
++ return AVERROR(EAGAIN);
++ }
++
++ if (EB_BUFFERFLAG_EOS & headerPtr->flags)
++ svt_enc->eos_flag = EOS_TOTRIGGER;
++
++ ret = 0;
++
++ // ignore headerPtr->dts on purpose
++
++ if (headerPtr->flags & EB_BUFFERFLAG_SHOW_EXT) {
++ ret = put_received_frame(avctx, headerPtr->p_buffer, headerPtr->n_filled_len - 4, 0, headerPtr->pts - 3, headerPtr->pts - 3);
++ if (ret != 0) goto end;
++ ret = put_received_frame(avctx, headerPtr->p_buffer + headerPtr->n_filled_len - 4, 1, 0, headerPtr->pts - 2, headerPtr->pts - 2);
++ if (ret != 0) goto end;
++ ret = put_received_frame(avctx, headerPtr->p_buffer + headerPtr->n_filled_len - 3, 1, 0, headerPtr->pts - 1, headerPtr->pts - 1);
++ if (ret != 0) goto end;
++ ret = put_received_frame(avctx, headerPtr->p_buffer + headerPtr->n_filled_len - 2, 1, 0, headerPtr->pts + 0, headerPtr->pts + 0);
++ if (ret != 0) goto end;
++ ret = put_received_frame(avctx, headerPtr->p_buffer + headerPtr->n_filled_len - 1, 1, 0, headerPtr->pts + 1, headerPtr->pts + 1);
++ if (ret != 0) goto end;
++ } else {
++ ret = put_received_frame(avctx, headerPtr->p_buffer, headerPtr->n_filled_len, headerPtr->pic_type == EB_IDR_PICTURE, headerPtr->pts, headerPtr->pts);
++ if (ret != 0) goto end;
++ }
++
++ ret = get_received_frame(svt_enc, pkt);
++
++ end:
++ eb_vp9_svt_release_out_buffer(&headerPtr);
++
++ if (ret == AVERROR(EAGAIN)) {
++ continue;
++ }
++
++ break;
++ }
++
++
++
++ return ret;
++}
++
++static av_cold int eb_enc_close(AVCodecContext *avctx)
++{
++ SvtContext *svt_enc = avctx->priv_data;
++
++ eb_vp9_deinit_encoder(svt_enc->svt_handle);
++ eb_vp9_deinit_handle(svt_enc->svt_handle);
++
++ av_frame_free(&svt_enc->frame);
++
++ free_buffer(svt_enc);
++
++ return 0;
++}
++
++#define OFFSET(x) offsetof(SvtContext, x)
++#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
++static const AVOption options[] = {
++ { "preset", "Encoding preset [1, 1]",
++ OFFSET(enc_mode), AV_OPT_TYPE_INT, { .i64 = 9 }, 0, 9, VE },
++
++ { "level", "Set level (level_idc)", OFFSET(level),
++ AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 0xff, VE, "level" },
++
++#define LEVEL(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, \
++ { .i64 = value }, 0, 0, VE, "level"
++ { LEVEL("1", 10) },
++ { LEVEL("2", 20) },
++ { LEVEL("2.1", 21) },
++ { LEVEL("3", 30) },
++ { LEVEL("3.1", 31) },
++ { LEVEL("4", 40) },
++ { LEVEL("4.1", 41) },
++ { LEVEL("5", 50) },
++ { LEVEL("5.1", 51) },
++ { LEVEL("5.2", 52) },
++ { LEVEL("6", 60) },
++ { LEVEL("6.1", 61) },
++ { LEVEL("6.2", 62) },
++#undef LEVEL
++
++ { "tune", "Tune mode", OFFSET(tune),
++ AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, VE , "tune"},
++ { "vq", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, "tune" },
++ { "ssim", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, VE, "tune" },
++ { "vmaf", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, INT_MIN, INT_MAX, VE, "tune" },
++
++ { "rc", "Bit rate control mode", OFFSET(rc_mode),
++ AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, VE , "rc"},
++ { "cqp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, "rc" },
++ { "vbr", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, VE, "rc" },
++ { "cbr", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, INT_MIN, INT_MAX, VE, "rc" },
++
++ { "qp", "QP value for intra frames", OFFSET(qp),
++ AV_OPT_TYPE_INT, { .i64 = 32 }, 0, 51, VE },
++
++ { "socket", "Target CPU socket to use. -1 use all available", OFFSET(target_socket),
++ AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE },
++
++ { "bl_mode", "Random Access Prediction Structure type setting", OFFSET(base_layer_switch_mode),
++ AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
++
++ { "forced-idr", "If forcing keyframes, force them as IDR frames.", OFFSET(forced_idr),
++ AV_OPT_TYPE_BOOL, { .i64 = 0 }, -1, 1, VE },
++
++ {NULL},
++};
++
++static const AVClass class = {
++ .class_name = "libsvt_vp9",
++ .item_name = av_default_item_name,
++ .option = options,
++ .version = LIBAVUTIL_VERSION_INT,
++};
++
++static const FFCodecDefault eb_enc_defaults[] = {
++ { "b", "7M" },
++ { "flags", "-cgop" },
++ { "qmin", "10" },
++ { "qmax", "48" },
++ { NULL },
++};
++
++const FFCodec ff_libsvt_vp9_encoder = {
++ .p.name = "libsvt_vp9",
++ .p.long_name = NULL_IF_CONFIG_SMALL("SVT-VP9(Scalable Video Technology for VP9) encoder"),
++ .priv_data_size = sizeof(SvtContext),
++ .p.type = AVMEDIA_TYPE_VIDEO,
++ .p.id = AV_CODEC_ID_VP9,
++ .init = eb_enc_init,
++ FF_CODEC_RECEIVE_PACKET_CB(eb_receive_packet),
++ .close = eb_enc_close,
++ .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS,
++ .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
++ FF_CODEC_CAP_AUTO_THREADS | FF_CODEC_CAP_INIT_CLEANUP,
++ .p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P,
++ AV_PIX_FMT_NONE },
++ .p.priv_class = &class,
++ .defaults = eb_enc_defaults,
++ .p.wrapper_name = "libsvt_vp9",
++};
+--
+2.46.1
+
diff --git a/restricted-defines.macros b/restricted-defines.macros
index 3a5c841..72c775c 100644
--- a/restricted-defines.macros
+++ b/restricted-defines.macros
@@ -1,2 +1,2 @@
-%define x264_major 163
-%define x265_major 199
+%define x264_major 164
+%define x265_major 215