#include "attributes.h"
+#include "error.h"
#include "macros.h"
#include "version.h"
-#include "libavutil/avconfig.h"
-#if AV_HAVE_BIGENDIAN
-# define AV_NE(be, le) (be)
+#ifdef HAVE_AV_CONFIG_H
+# include "config.h"
+# include "intmath.h"
+# include "internal.h"
#else
-# define AV_NE(be, le) (le)
-#endif
+# include "mem.h"
+#endif /* HAVE_AV_CONFIG_H */
//rounded division & shift
#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))
/* assume b>0 */
-#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
+#define ROUNDED_DIV(a,b) (((a)>=0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
/* Fast a/(1<=0 and b>=0 */
#define AV_CEIL_RSHIFT(a,b) (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) \
: ((a) + (1<<(b)) - 1) >> (b))
@@ -81,33 +83,82 @@
#define FFNABS(a) ((a) <= 0 ? (a) : (-(a)))
/**
- * Comparator.
- * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0
- * if x == y. This is useful for instance in a qsort comparator callback.
- * Furthermore, compilers are able to optimize this to branchless code, and
- * there is no risk of overflow with signed types.
- * As with many macros, this evaluates its argument multiple times, it thus
- * must not have a side-effect.
+ * Unsigned Absolute value.
+ * This takes the absolute value of a signed int and returns it as a unsigned.
+ * This also works with INT_MIN which would otherwise not be representable
+ * As with many macros, this evaluates its argument twice.
*/
-#define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y)))
-
-#define FFMAX(a,b) ((a) > (b) ? (a) : (b))
-#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c)
-#define FFMIN(a,b) ((a) > (b) ? (b) : (a))
-#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c)
-
-#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)
-#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
+#define FFABSU(a) ((a) <= 0 ? -(unsigned)(a) : (unsigned)(a))
+#define FFABS64U(a) ((a) <= 0 ? -(uint64_t)(a) : (uint64_t)(a))
/* misc math functions */
-#ifdef HAVE_AV_CONFIG_H
-# include "config.h"
-# include "intmath.h"
+#ifndef av_ceil_log2
+# define av_ceil_log2 av_ceil_log2_c
+#endif
+#ifndef av_clip
+# define av_clip av_clip_c
+#endif
+#ifndef av_clip64
+# define av_clip64 av_clip64_c
+#endif
+#ifndef av_clip_uint8
+# define av_clip_uint8 av_clip_uint8_c
+#endif
+#ifndef av_clip_int8
+# define av_clip_int8 av_clip_int8_c
+#endif
+#ifndef av_clip_uint16
+# define av_clip_uint16 av_clip_uint16_c
+#endif
+#ifndef av_clip_int16
+# define av_clip_int16 av_clip_int16_c
+#endif
+#ifndef av_clipl_int32
+# define av_clipl_int32 av_clipl_int32_c
+#endif
+#ifndef av_clip_intp2
+# define av_clip_intp2 av_clip_intp2_c
+#endif
+#ifndef av_clip_uintp2
+# define av_clip_uintp2 av_clip_uintp2_c
+#endif
+#ifndef av_sat_add32
+# define av_sat_add32 av_sat_add32_c
+#endif
+#ifndef av_sat_dadd32
+# define av_sat_dadd32 av_sat_dadd32_c
+#endif
+#ifndef av_sat_sub32
+# define av_sat_sub32 av_sat_sub32_c
+#endif
+#ifndef av_sat_dsub32
+# define av_sat_dsub32 av_sat_dsub32_c
+#endif
+#ifndef av_sat_add64
+# define av_sat_add64 av_sat_add64_c
+#endif
+#ifndef av_sat_sub64
+# define av_sat_sub64 av_sat_sub64_c
+#endif
+#ifndef av_clipf
+# define av_clipf av_clipf_c
+#endif
+#ifndef av_clipd
+# define av_clipd av_clipd_c
+#endif
+#ifndef av_zero_extend
+# define av_zero_extend av_zero_extend_c
+#endif
+#ifndef av_popcount
+# define av_popcount av_popcount_c
+#endif
+#ifndef av_popcount64
+# define av_popcount64 av_popcount64_c
+#endif
+#ifndef av_parity
+# define av_parity av_parity_c
#endif
-
-/* Pull in unguarded fallback defines at the end of this file. */
-#include "common.h"
#ifndef av_log2
av_const int av_log2(unsigned v);
@@ -202,8 +253,8 @@ static av_always_inline av_const int16_t av_clip_int16_c(int a)
*/
static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a)
{
- if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (int32_t)((a>>63) ^ 0x7FFFFFFF);
- else return (int32_t)a;
+ if ((a+UINT64_C(0x80000000)) & ~UINT64_C(0xFFFFFFFF)) return (int32_t)((a>>63) ^ 0x7FFFFFFF);
+ else return (int32_t)a;
}
/**
@@ -214,7 +265,7 @@ static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a)
*/
static av_always_inline av_const int av_clip_intp2_c(int a, int p)
{
- if (((unsigned)a + (1 << p)) & ~((2 << p) - 1))
+ if (((unsigned)a + (1U << p)) & ~((2U << p) - 1))
return (a >> 31) ^ ((1 << p) - 1);
else
return a;
@@ -228,20 +279,34 @@ static av_always_inline av_const int av_clip_intp2_c(int a, int p)
*/
static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
{
- if (a & ~((1<> 31 & ((1<
> 31 & ((1U<
= 2
+ if (p > 31) abort();
+#endif
+ return a & ((1U << p) - 1);
+}
+
+#if FF_API_MOD_UINTP2
+#ifndef av_mod_uintp2
+# define av_mod_uintp2 av_mod_uintp2_c
+#endif
+attribute_deprecated
static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p)
{
- return a & ((1 << p) - 1);
+ return av_zero_extend_c(a, p);
}
+#endif
/**
* Add two signed 32-bit values with saturation.
@@ -291,8 +356,49 @@ static av_always_inline int av_sat_dsub32_c(int a, int b)
return av_sat_sub32(a, av_sat_add32(b, b));
}
+/**
+ * Add two signed 64-bit values with saturation.
+ *
+ * @param a one value
+ * @param b another value
+ * @return sum with signed saturation
+ */
+static av_always_inline int64_t av_sat_add64_c(int64_t a, int64_t b) {
+#if (!defined(__INTEL_COMPILER) && AV_GCC_VERSION_AT_LEAST(5,1)) || AV_HAS_BUILTIN(__builtin_add_overflow)
+ int64_t tmp;
+ return !__builtin_add_overflow(a, b, &tmp) ? tmp : (tmp < 0 ? INT64_MAX : INT64_MIN);
+#else
+ int64_t s = a+(uint64_t)b;
+ if ((int64_t)(a^b | ~s^b) >= 0)
+ return INT64_MAX ^ (b >> 63);
+ return s;
+#endif
+}
+
+/**
+ * Subtract two signed 64-bit values with saturation.
+ *
+ * @param a one value
+ * @param b another value
+ * @return difference with signed saturation
+ */
+static av_always_inline int64_t av_sat_sub64_c(int64_t a, int64_t b) {
+#if (!defined(__INTEL_COMPILER) && AV_GCC_VERSION_AT_LEAST(5,1)) || AV_HAS_BUILTIN(__builtin_sub_overflow)
+ int64_t tmp;
+ return !__builtin_sub_overflow(a, b, &tmp) ? tmp : (tmp < 0 ? INT64_MAX : INT64_MIN);
+#else
+ if (b <= 0 && a >= INT64_MAX + b)
+ return INT64_MAX;
+ if (b >= 0 && a <= INT64_MIN + b)
+ return INT64_MIN;
+ return a - b;
+#endif
+}
+
/**
* Clip a float value into the amin-amax range.
+ * If a is nan or -inf amin will be returned.
+ * If a is +inf amax will be returned.
* @param a value to clip
* @param amin minimum value of the clip range
* @param amax maximum value of the clip range
@@ -303,13 +409,13 @@ static av_always_inline av_const float av_clipf_c(float a, float amin, float ama
#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
if (amin > amax) abort();
#endif
- if (a < amin) return amin;
- else if (a > amax) return amax;
- else return a;
+ return FFMIN(FFMAX(a, amin), amax);
}
/**
* Clip a double value into the amin-amax range.
+ * If a is nan or -inf amin will be returned.
+ * If a is +inf amax will be returned.
* @param a value to clip
* @param amin minimum value of the clip range
* @param amax maximum value of the clip range
@@ -320,9 +426,7 @@ static av_always_inline av_const double av_clipd_c(double a, double amin, double
#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
if (amin > amax) abort();
#endif
- if (a < amin) return amin;
- else if (a > amax) return amax;
- else return a;
+ return FFMIN(FFMAX(a, amin), amax);
}
/** Compute ceil(log2(x)).
@@ -331,7 +435,7 @@ static av_always_inline av_const double av_clipd_c(double a, double amin, double
*/
static av_always_inline av_const int av_ceil_log2_c(int x)
{
- return av_log2((x - 1) << 1);
+ return av_log2((x - 1U) << 1);
}
/**
@@ -363,9 +467,6 @@ static av_always_inline av_const int av_parity_c(uint32_t v)
return av_popcount(v) & 1;
}
-#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24))
-#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24))
-
/**
* Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form.
*
@@ -373,7 +474,9 @@ static av_always_inline av_const int av_parity_c(uint32_t v)
* @param GET_BYTE Expression reading one byte from the input.
* Evaluated up to 7 times (4 for the currently
* assigned Unicode range). With a memory buffer
- * input, this could be *ptr++.
+ * input, this could be *ptr++, or if you want to make sure
+ * that *ptr stops at the end of a NULL terminated string then
+ * *ptr ? *ptr++ : 0
* @param ERROR Expression to be evaluated on invalid input,
* typically a goto statement.
*
@@ -387,11 +490,11 @@ static av_always_inline av_const int av_parity_c(uint32_t v)
{\
uint32_t top = (val & 128) >> 1;\
if ((val & 0xc0) == 0x80 || val >= 0xFE)\
- ERROR\
+ {ERROR}\
while (val & top) {\
- int tmp= (GET_BYTE) - 128;\
+ unsigned int tmp = (GET_BYTE) - 128;\
if(tmp>>6)\
- ERROR\
+ {ERROR}\
val= (val<<6) + tmp;\
top <<= 5;\
}\
@@ -408,13 +511,13 @@ static av_always_inline av_const int av_parity_c(uint32_t v)
* typically a goto statement.
*/
#define GET_UTF16(val, GET_16BIT, ERROR)\
- val = GET_16BIT;\
+ val = (GET_16BIT);\
{\
unsigned int hi = val - 0xD800;\
if (hi < 0x800) {\
- val = GET_16BIT - 0xDC00;\
+ val = (GET_16BIT) - 0xDC00;\
if (val > 0x3FFU || hi > 0x3FFU)\
- ERROR\
+ {ERROR}\
val += (hi<<10) + 0x10000;\
}\
}\
@@ -483,78 +586,4 @@ static av_always_inline av_const int av_parity_c(uint32_t v)
}\
}\
-
-
-#include "mem.h"
-
-#ifdef HAVE_AV_CONFIG_H
-# include "internal.h"
-#endif /* HAVE_AV_CONFIG_H */
-
#endif /* AVUTIL_COMMON_H */
-
-/*
- * The following definitions are outside the multiple inclusion guard
- * to ensure they are immediately available in intmath.h.
- */
-
-#ifndef av_ceil_log2
-# define av_ceil_log2 av_ceil_log2_c
-#endif
-#ifndef av_clip
-# define av_clip av_clip_c
-#endif
-#ifndef av_clip64
-# define av_clip64 av_clip64_c
-#endif
-#ifndef av_clip_uint8
-# define av_clip_uint8 av_clip_uint8_c
-#endif
-#ifndef av_clip_int8
-# define av_clip_int8 av_clip_int8_c
-#endif
-#ifndef av_clip_uint16
-# define av_clip_uint16 av_clip_uint16_c
-#endif
-#ifndef av_clip_int16
-# define av_clip_int16 av_clip_int16_c
-#endif
-#ifndef av_clipl_int32
-# define av_clipl_int32 av_clipl_int32_c
-#endif
-#ifndef av_clip_intp2
-# define av_clip_intp2 av_clip_intp2_c
-#endif
-#ifndef av_clip_uintp2
-# define av_clip_uintp2 av_clip_uintp2_c
-#endif
-#ifndef av_mod_uintp2
-# define av_mod_uintp2 av_mod_uintp2_c
-#endif
-#ifndef av_sat_add32
-# define av_sat_add32 av_sat_add32_c
-#endif
-#ifndef av_sat_dadd32
-# define av_sat_dadd32 av_sat_dadd32_c
-#endif
-#ifndef av_sat_sub32
-# define av_sat_sub32 av_sat_sub32_c
-#endif
-#ifndef av_sat_dsub32
-# define av_sat_dsub32 av_sat_dsub32_c
-#endif
-#ifndef av_clipf
-# define av_clipf av_clipf_c
-#endif
-#ifndef av_clipd
-# define av_clipd av_clipd_c
-#endif
-#ifndef av_popcount
-# define av_popcount av_popcount_c
-#endif
-#ifndef av_popcount64
-# define av_popcount64 av_popcount64_c
-#endif
-#ifndef av_parity
-# define av_parity av_parity_c
-#endif
diff --git a/ffmpeg/include/libavutil/cpu.h b/ffmpeg/include/libavutil/cpu.h
index 8bb9eb60..ba6c234e 100644
--- a/ffmpeg/include/libavutil/cpu.h
+++ b/ffmpeg/include/libavutil/cpu.h
@@ -22,8 +22,7 @@
#define AVUTIL_CPU_H
#include
-
-#include "attributes.h"
+#include "version.h"
#define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */
@@ -56,6 +55,8 @@
#define AV_CPU_FLAG_BMI1 0x20000 ///< Bit Manipulation Instruction Set 1
#define AV_CPU_FLAG_BMI2 0x40000 ///< Bit Manipulation Instruction Set 2
#define AV_CPU_FLAG_AVX512 0x100000 ///< AVX-512 functions: requires OS support even if YMM/ZMM registers aren't used
+#define AV_CPU_FLAG_AVX512ICL 0x200000 ///< F/CD/BW/DQ/VL/VNNI/IFMA/VBMI/VBMI2/VPOPCNTDQ/BITALG/GFNI/VAES/VPCLMULQDQ
+#define AV_CPU_FLAG_SLOW_GATHER 0x2000000 ///< CPU has slow gathers.
#define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard
#define AV_CPU_FLAG_VSX 0x0002 ///< ISA 2.06
@@ -69,8 +70,35 @@
#define AV_CPU_FLAG_NEON (1 << 5)
#define AV_CPU_FLAG_ARMV8 (1 << 6)
#define AV_CPU_FLAG_VFP_VM (1 << 7) ///< VFPv2 vector mode, deprecated in ARMv7-A and unavailable in various CPUs implementations
+#define AV_CPU_FLAG_DOTPROD (1 << 8)
+#define AV_CPU_FLAG_I8MM (1 << 9)
#define AV_CPU_FLAG_SETEND (1 <<16)
+#define AV_CPU_FLAG_MMI (1 << 0)
+#define AV_CPU_FLAG_MSA (1 << 1)
+
+//Loongarch SIMD extension.
+#define AV_CPU_FLAG_LSX (1 << 0)
+#define AV_CPU_FLAG_LASX (1 << 1)
+
+// RISC-V extensions
+#define AV_CPU_FLAG_RVI (1 << 0) ///< I (full GPR bank)
+#if FF_API_RISCV_FD_ZBA
+#define AV_CPU_FLAG_RVF (1 << 1) ///< F (single precision FP)
+#define AV_CPU_FLAG_RVD (1 << 2) ///< D (double precision FP)
+#endif
+#define AV_CPU_FLAG_RVV_I32 (1 << 3) ///< Vectors of 8/16/32-bit int's */
+#define AV_CPU_FLAG_RVV_F32 (1 << 4) ///< Vectors of float's */
+#define AV_CPU_FLAG_RVV_I64 (1 << 5) ///< Vectors of 64-bit int's */
+#define AV_CPU_FLAG_RVV_F64 (1 << 6) ///< Vectors of double's
+#define AV_CPU_FLAG_RVB_BASIC (1 << 7) ///< Basic bit-manipulations
+#if FF_API_RISCV_FD_ZBA
+#define AV_CPU_FLAG_RVB_ADDR (1 << 8) ///< Address bit-manipulations
+#endif
+#define AV_CPU_FLAG_RV_ZVBB (1 << 9) ///< Vector basic bit-manipulations
+#define AV_CPU_FLAG_RV_MISALIGNED (1 <<10) ///< Fast misaligned accesses
+#define AV_CPU_FLAG_RVB (1 <<11) ///< B (bit manipulations)
+
/**
* Return the flags which specify extensions supported by the CPU.
* The returned value is affected by av_force_cpu_flags() if that was used
@@ -85,25 +113,6 @@ int av_get_cpu_flags(void);
*/
void av_force_cpu_flags(int flags);
-/**
- * Set a mask on flags returned by av_get_cpu_flags().
- * This function is mainly useful for testing.
- * Please use av_force_cpu_flags() and av_get_cpu_flags() instead which are more flexible
- */
-attribute_deprecated void av_set_cpu_flags_mask(int mask);
-
-/**
- * Parse CPU flags from a string.
- *
- * The returned flags contain the specified flags as well as related unspecified flags.
- *
- * This function exists only for compatibility with libav.
- * Please use av_parse_cpu_caps() when possible.
- * @return a combination of AV_CPU_* flags, negative on error.
- */
-attribute_deprecated
-int av_parse_cpu_flags(const char *s);
-
/**
* Parse CPU caps from a string and update the given AV_CPU_* flags based on that.
*
@@ -116,6 +125,12 @@ int av_parse_cpu_caps(unsigned *flags, const char *s);
*/
int av_cpu_count(void);
+/**
+ * Overrides cpu count detection and forces the specified count.
+ * Count < 1 disables forcing of specific count.
+ */
+void av_cpu_force_count(int count);
+
/**
* Get the maximum data alignment that may be required by FFmpeg.
*
diff --git a/ffmpeg/include/libavutil/crc.h b/ffmpeg/include/libavutil/crc.h
index 47e22b4c..7f59812a 100644
--- a/ffmpeg/include/libavutil/crc.h
+++ b/ffmpeg/include/libavutil/crc.h
@@ -30,7 +30,6 @@
#include
#include
#include "attributes.h"
-#include "version.h"
/**
* @defgroup lavu_crc32 CRC
@@ -85,7 +84,10 @@ const AVCRC *av_crc_get_table(AVCRCId crc_id);
/**
* Calculate the CRC of a block.
+ * @param ctx initialized AVCRC array (see av_crc_init())
* @param crc CRC of previous blocks if any or initial value for CRC
+ * @param buffer buffer whose CRC to calculate
+ * @param length length of the buffer
* @return CRC updated with the data from the given block
*
* @see av_crc_init() "le" parameter
diff --git a/ffmpeg/include/libavutil/csp.h b/ffmpeg/include/libavutil/csp.h
new file mode 100644
index 00000000..73bce52b
--- /dev/null
+++ b/ffmpeg/include/libavutil/csp.h
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2015 Kevin Wheatley
+ * Copyright (c) 2016 Ronald S. Bultje
+ * Copyright (c) 2023 Leo Izen
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_CSP_H
+#define AVUTIL_CSP_H
+
+#include "pixfmt.h"
+#include "rational.h"
+
+/**
+ * @file
+ * Colorspace value utility functions for libavutil.
+ * @ingroup lavu_math_csp
+ * @author Ronald S. Bultje
+ * @author Leo Izen
+ * @author Kevin Wheatley
+ */
+
+/**
+ * @defgroup lavu_math_csp Colorspace Utility
+ * @ingroup lavu_math
+ * @{
+ */
+
+/**
+ * Struct containing luma coefficients to be used for RGB to YUV/YCoCg, or similar
+ * calculations.
+ */
+typedef struct AVLumaCoefficients {
+ AVRational cr, cg, cb;
+} AVLumaCoefficients;
+
+/**
+ * Struct containing chromaticity x and y values for the standard CIE 1931
+ * chromaticity definition.
+ */
+typedef struct AVCIExy {
+ AVRational x, y;
+} AVCIExy;
+
+/**
+ * Struct defining the red, green, and blue primary locations in terms of CIE
+ * 1931 chromaticity x and y.
+ */
+typedef struct AVPrimaryCoefficients {
+ AVCIExy r, g, b;
+} AVPrimaryCoefficients;
+
+/**
+ * Struct defining white point location in terms of CIE 1931 chromaticity x
+ * and y.
+ */
+typedef AVCIExy AVWhitepointCoefficients;
+
+/**
+ * Struct that contains both white point location and primaries location, providing
+ * the complete description of a color gamut.
+ */
+typedef struct AVColorPrimariesDesc {
+ AVWhitepointCoefficients wp;
+ AVPrimaryCoefficients prim;
+} AVColorPrimariesDesc;
+
+/**
+ * Function pointer representing a double -> double transfer function that performs
+ * an EOTF transfer inversion. This function outputs linear light.
+ */
+typedef double (*av_csp_trc_function)(double);
+
+/**
+ * Retrieves the Luma coefficients necessary to construct a conversion matrix
+ * from an enum constant describing the colorspace.
+ * @param csp An enum constant indicating YUV or similar colorspace.
+ * @return The Luma coefficients associated with that colorspace, or NULL
+ * if the constant is unknown to libavutil.
+ */
+const AVLumaCoefficients *av_csp_luma_coeffs_from_avcsp(enum AVColorSpace csp);
+
+/**
+ * Retrieves a complete gamut description from an enum constant describing the
+ * color primaries.
+ * @param prm An enum constant indicating primaries
+ * @return A description of the colorspace gamut associated with that enum
+ * constant, or NULL if the constant is unknown to libavutil.
+ */
+const AVColorPrimariesDesc *av_csp_primaries_desc_from_id(enum AVColorPrimaries prm);
+
+/**
+ * Detects which enum AVColorPrimaries constant corresponds to the given complete
+ * gamut description.
+ * @see enum AVColorPrimaries
+ * @param prm A description of the colorspace gamut
+ * @return The enum constant associated with this gamut, or
+ * AVCOL_PRI_UNSPECIFIED if no clear match can be idenitified.
+ */
+enum AVColorPrimaries av_csp_primaries_id_from_desc(const AVColorPrimariesDesc *prm);
+
+/**
+ * Determine a suitable 'gamma' value to match the supplied
+ * AVColorTransferCharacteristic.
+ *
+ * See Apple Technical Note TN2257 (https://developer.apple.com/library/mac/technotes/tn2257/_index.html)
+ *
+ * This function returns the gamma exponent for the OETF. For example, sRGB is approximated
+ * by gamma 2.2, not by gamma 0.45455.
+ *
+ * @return Will return an approximation to the simple gamma function matching
+ * the supplied Transfer Characteristic, Will return 0.0 for any
+ * we cannot reasonably match against.
+ */
+double av_csp_approximate_trc_gamma(enum AVColorTransferCharacteristic trc);
+
+/**
+ * Determine the function needed to apply the given
+ * AVColorTransferCharacteristic to linear input.
+ *
+ * The function returned should expect a nominal domain and range of [0.0-1.0]
+ * values outside of this range maybe valid depending on the chosen
+ * characteristic function.
+ *
+ * @return Will return pointer to the function matching the
+ * supplied Transfer Characteristic. If unspecified will
+ * return NULL:
+ */
+av_csp_trc_function av_csp_trc_func_from_id(enum AVColorTransferCharacteristic trc);
+
+/**
+ * @}
+ */
+
+#endif /* AVUTIL_CSP_H */
diff --git a/ffmpeg/include/libavutil/des.h b/ffmpeg/include/libavutil/des.h
index 4cf11f5b..3a3e6fa4 100644
--- a/ffmpeg/include/libavutil/des.h
+++ b/ffmpeg/include/libavutil/des.h
@@ -43,6 +43,8 @@ AVDES *av_des_alloc(void);
/**
* @brief Initializes an AVDES context.
*
+ * @param d pointer to a AVDES structure to initialize
+ * @param key pointer to the key to use
* @param key_bits must be 64 or 192
* @param decrypt 0 for encryption/CBC-MAC, 1 for decryption
* @return zero on success, negative value otherwise
@@ -52,9 +54,10 @@ int av_des_init(struct AVDES *d, const uint8_t *key, int key_bits, int decrypt);
/**
* @brief Encrypts / decrypts using the DES algorithm.
*
- * @param count number of 8 byte blocks
+ * @param d pointer to the AVDES structure
* @param dst destination array, can be equal to src, must be 8-byte aligned
* @param src source array, can be equal to dst, must be 8-byte aligned, may be NULL
+ * @param count number of 8 byte blocks
* @param iv initialization vector for CBC mode, if NULL then ECB will be used,
* must be 8-byte aligned
* @param decrypt 0 for encryption, 1 for decryption
@@ -64,9 +67,10 @@ void av_des_crypt(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count,
/**
* @brief Calculates CBC-MAC using the DES algorithm.
*
- * @param count number of 8 byte blocks
+ * @param d pointer to the AVDES structure
* @param dst destination array, can be equal to src, must be 8-byte aligned
* @param src source array, can be equal to dst, must be 8-byte aligned, may be NULL
+ * @param count number of 8 byte blocks
*/
void av_des_mac(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count);
diff --git a/ffmpeg/include/libavutil/detection_bbox.h b/ffmpeg/include/libavutil/detection_bbox.h
new file mode 100644
index 00000000..01198805
--- /dev/null
+++ b/ffmpeg/include/libavutil/detection_bbox.h
@@ -0,0 +1,108 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_DETECTION_BBOX_H
+#define AVUTIL_DETECTION_BBOX_H
+
+#include "rational.h"
+#include "avassert.h"
+#include "frame.h"
+
+typedef struct AVDetectionBBox {
+ /**
+ * Distance in pixels from the left/top edge of the frame,
+ * together with width and height, defining the bounding box.
+ */
+ int x;
+ int y;
+ int w;
+ int h;
+
+#define AV_DETECTION_BBOX_LABEL_NAME_MAX_SIZE 64
+
+ /**
+ * Detect result with confidence
+ */
+ char detect_label[AV_DETECTION_BBOX_LABEL_NAME_MAX_SIZE];
+ AVRational detect_confidence;
+
+ /**
+ * At most 4 classifications based on the detected bounding box.
+ * For example, we can get max 4 different attributes with 4 different
+ * DNN models on one bounding box.
+ * classify_count is zero if no classification.
+ */
+#define AV_NUM_DETECTION_BBOX_CLASSIFY 4
+ uint32_t classify_count;
+ char classify_labels[AV_NUM_DETECTION_BBOX_CLASSIFY][AV_DETECTION_BBOX_LABEL_NAME_MAX_SIZE];
+ AVRational classify_confidences[AV_NUM_DETECTION_BBOX_CLASSIFY];
+} AVDetectionBBox;
+
+typedef struct AVDetectionBBoxHeader {
+ /**
+ * Information about how the bounding box is generated.
+ * for example, the DNN model name.
+ */
+ char source[256];
+
+ /**
+ * Number of bounding boxes in the array.
+ */
+ uint32_t nb_bboxes;
+
+ /**
+ * Offset in bytes from the beginning of this structure at which
+ * the array of bounding boxes starts.
+ */
+ size_t bboxes_offset;
+
+ /**
+ * Size of each bounding box in bytes.
+ */
+ size_t bbox_size;
+} AVDetectionBBoxHeader;
+
+/*
+ * Get the bounding box at the specified {@code idx}. Must be between 0 and nb_bboxes.
+ */
+static av_always_inline AVDetectionBBox *
+av_get_detection_bbox(const AVDetectionBBoxHeader *header, unsigned int idx)
+{
+ av_assert0(idx < header->nb_bboxes);
+ return (AVDetectionBBox *)((uint8_t *)header + header->bboxes_offset +
+ idx * header->bbox_size);
+}
+
+/**
+ * Allocates memory for AVDetectionBBoxHeader, plus an array of {@code nb_bboxes}
+ * AVDetectionBBox, and initializes the variables.
+ * Can be freed with a normal av_free() call.
+ *
+ * @param nb_bboxes number of AVDetectionBBox structures to allocate
+ * @param out_size if non-NULL, the size in bytes of the resulting data array is
+ * written here.
+ */
+AVDetectionBBoxHeader *av_detection_bbox_alloc(uint32_t nb_bboxes, size_t *out_size);
+
+/**
+ * Allocates memory for AVDetectionBBoxHeader, plus an array of {@code nb_bboxes}
+ * AVDetectionBBox, in the given AVFrame {@code frame} as AVFrameSideData of type
+ * AV_FRAME_DATA_DETECTION_BBOXES and initializes the variables.
+ */
+AVDetectionBBoxHeader *av_detection_bbox_create_side_data(AVFrame *frame, uint32_t nb_bboxes);
+#endif
diff --git a/ffmpeg/include/libavutil/dict.h b/ffmpeg/include/libavutil/dict.h
index 118f1f00..713c9e36 100644
--- a/ffmpeg/include/libavutil/dict.h
+++ b/ffmpeg/include/libavutil/dict.h
@@ -32,8 +32,6 @@
#include
-#include "version.h"
-
/**
* @addtogroup lavu_dict AVDictionary
* @ingroup lavu_data
@@ -41,13 +39,15 @@
* @brief Simple key:value store
*
* @{
- * Dictionaries are used for storing key:value pairs. To create
- * an AVDictionary, simply pass an address of a NULL pointer to
- * av_dict_set(). NULL can be used as an empty dictionary wherever
- * a pointer to an AVDictionary is required.
- * Use av_dict_get() to retrieve an entry or iterate over all
- * entries and finally av_dict_free() to free the dictionary
- * and all its contents.
+ * Dictionaries are used for storing key-value pairs.
+ *
+ * - To **create an AVDictionary**, simply pass an address of a NULL
+ * pointer to av_dict_set(). NULL can be used as an empty dictionary
+ * wherever a pointer to an AVDictionary is required.
+ * - To **insert an entry**, use av_dict_set().
+ * - Use av_dict_get() to **retrieve an entry**.
+ * - To **iterate over all entries**, use av_dict_iterate().
+ * - In order to **free the dictionary and all its contents**, use av_dict_free().
*
@code
AVDictionary *d = NULL; // "create" an empty dictionary
@@ -59,13 +59,18 @@
char *v = av_strdup("value"); // you can avoid copying them like this
av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL);
- while (t = av_dict_get(d, "", t, AV_DICT_IGNORE_SUFFIX)) {
- <....> // iterate over all entries in d
+ while ((t = av_dict_iterate(d, t))) {
+ <....> // iterate over all entries in d
}
av_dict_free(&d);
@endcode
*/
+/**
+ * @name AVDictionary Flags
+ * Flags that influence behavior of the matching of keys or insertion to the dictionary.
+ * @{
+ */
#define AV_DICT_MATCH_CASE 1 /**< Only get an entry with exact-case key match. Only relevant in av_dict_get(). */
#define AV_DICT_IGNORE_SUFFIX 2 /**< Return first entry in a dictionary whose first part corresponds to the search key,
ignoring the suffix of the found key string. Only relevant in av_dict_get(). */
@@ -73,10 +78,13 @@
allocated with av_malloc() or another memory allocation function. */
#define AV_DICT_DONT_STRDUP_VAL 8 /**< Take ownership of a value that's been
allocated with av_malloc() or another memory allocation function. */
-#define AV_DICT_DONT_OVERWRITE 16 ///< Don't overwrite existing entries.
+#define AV_DICT_DONT_OVERWRITE 16 /**< Don't overwrite existing entries. */
#define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no
- delimiter is added, the strings are simply concatenated. */
+ delimiter is added, the strings are simply concatenated. */
#define AV_DICT_MULTIKEY 64 /**< Allow to store several equal keys in the dictionary */
+/**
+ * @}
+ */
typedef struct AVDictionaryEntry {
char *key;
@@ -91,18 +99,44 @@ typedef struct AVDictionary AVDictionary;
* The returned entry key or value must not be changed, or it will
* cause undefined behavior.
*
- * To iterate through all the dictionary entries, you can set the matching key
- * to the null string "" and set the AV_DICT_IGNORE_SUFFIX flag.
+ * @param prev Set to the previous matching element to find the next.
+ * If set to NULL the first matching element is returned.
+ * @param key Matching key
+ * @param flags A collection of AV_DICT_* flags controlling how the
+ * entry is retrieved
*
- * @param prev Set to the previous matching element to find the next.
- * If set to NULL the first matching element is returned.
- * @param key matching key
- * @param flags a collection of AV_DICT_* flags controlling how the entry is retrieved
- * @return found entry or NULL in case no matching entry was found in the dictionary
+ * @return Found entry or NULL in case no matching entry was found in the dictionary
*/
AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key,
const AVDictionaryEntry *prev, int flags);
+/**
+ * Iterate over a dictionary
+ *
+ * Iterates through all entries in the dictionary.
+ *
+ * @warning The returned AVDictionaryEntry key/value must not be changed.
+ *
+ * @warning As av_dict_set() invalidates all previous entries returned
+ * by this function, it must not be called while iterating over the dict.
+ *
+ * Typical usage:
+ * @code
+ * const AVDictionaryEntry *e = NULL;
+ * while ((e = av_dict_iterate(m, e))) {
+ * // ...
+ * }
+ * @endcode
+ *
+ * @param m The dictionary to iterate over
+ * @param prev Pointer to the previous AVDictionaryEntry, NULL initially
+ *
+ * @retval AVDictionaryEntry* The next element in the dictionary
+ * @retval NULL No more elements in the dictionary
+ */
+const AVDictionaryEntry *av_dict_iterate(const AVDictionary *m,
+ const AVDictionaryEntry *prev);
+
/**
* Get number of entries in dictionary.
*
@@ -117,23 +151,24 @@ int av_dict_count(const AVDictionary *m);
* Note: If AV_DICT_DONT_STRDUP_KEY or AV_DICT_DONT_STRDUP_VAL is set,
* these arguments will be freed on error.
*
- * Warning: Adding a new entry to a dictionary invalidates all existing entries
- * previously returned with av_dict_get.
+ * @warning Adding a new entry to a dictionary invalidates all existing entries
+ * previously returned with av_dict_get() or av_dict_iterate().
*
- * @param pm pointer to a pointer to a dictionary struct. If *pm is NULL
- * a dictionary struct is allocated and put in *pm.
- * @param key entry key to add to *pm (will either be av_strduped or added as a new key depending on flags)
- * @param value entry value to add to *pm (will be av_strduped or added as a new key depending on flags).
- * Passing a NULL value will cause an existing entry to be deleted.
- * @return >= 0 on success otherwise an error code <0
+ * @param pm Pointer to a pointer to a dictionary struct. If *pm is NULL
+ * a dictionary struct is allocated and put in *pm.
+ * @param key Entry key to add to *pm (will either be av_strduped or added as a new key depending on flags)
+ * @param value Entry value to add to *pm (will be av_strduped or added as a new key depending on flags).
+ * Passing a NULL value will cause an existing entry to be deleted.
+ *
+ * @return >= 0 on success otherwise an error code <0
*/
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags);
/**
- * Convenience wrapper for av_dict_set that converts the value to a string
+ * Convenience wrapper for av_dict_set() that converts the value to a string
* and stores it.
*
- * Note: If AV_DICT_DONT_STRDUP_KEY is set, key will be freed on error.
+ * Note: If ::AV_DICT_DONT_STRDUP_KEY is set, key will be freed on error.
*/
int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags);
@@ -143,14 +178,15 @@ int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags
* In case of failure, all the successfully set entries are stored in
* *pm. You may need to manually free the created dictionary.
*
- * @param key_val_sep a 0-terminated list of characters used to separate
+ * @param key_val_sep A 0-terminated list of characters used to separate
* key from value
- * @param pairs_sep a 0-terminated list of characters used to separate
+ * @param pairs_sep A 0-terminated list of characters used to separate
* two pairs from each other
- * @param flags flags to use when adding to dictionary.
- * AV_DICT_DONT_STRDUP_KEY and AV_DICT_DONT_STRDUP_VAL
+ * @param flags Flags to use when adding to the dictionary.
+ * ::AV_DICT_DONT_STRDUP_KEY and ::AV_DICT_DONT_STRDUP_VAL
* are ignored since the key/value tokens will always
* be duplicated.
+ *
* @return 0 on success, negative AVERROR code on failure
*/
int av_dict_parse_string(AVDictionary **pm, const char *str,
@@ -159,11 +195,14 @@ int av_dict_parse_string(AVDictionary **pm, const char *str,
/**
* Copy entries from one AVDictionary struct into another.
- * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL,
- * this function will allocate a struct for you and put it in *dst
- * @param src pointer to source AVDictionary struct
- * @param flags flags to use when setting entries in *dst
- * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag
+ *
+ * @note Metadata is read using the ::AV_DICT_IGNORE_SUFFIX flag
+ *
+ * @param dst Pointer to a pointer to a AVDictionary struct to copy into. If *dst is NULL,
+ * this function will allocate a struct for you and put it in *dst
+ * @param src Pointer to the source AVDictionary struct to copy items from.
+ * @param flags Flags to use when setting entries in *dst
+ *
* @return 0 on success, negative AVERROR code on failure. If dst was allocated
* by this function, callers should free the associated memory.
*/
@@ -182,13 +221,15 @@ void av_dict_free(AVDictionary **m);
* Such string may be passed back to av_dict_parse_string().
* @note String is escaped with backslashes ('\').
*
- * @param[in] m dictionary
+ * @warning Separators cannot be neither '\\' nor '\0'. They also cannot be the same.
+ *
+ * @param[in] m The dictionary
* @param[out] buffer Pointer to buffer that will be allocated with string containg entries.
* Buffer must be freed by the caller when is no longer needed.
- * @param[in] key_val_sep character used to separate key from value
- * @param[in] pairs_sep character used to separate two pairs from each other
+ * @param[in] key_val_sep Character used to separate key from value
+ * @param[in] pairs_sep Character used to separate two pairs from each other
+ *
* @return >= 0 on success, negative on error
- * @warning Separators cannot be neither '\\' nor '\0'. They also cannot be the same.
*/
int av_dict_get_string(const AVDictionary *m, char **buffer,
const char key_val_sep, const char pairs_sep);
diff --git a/ffmpeg/include/libavutil/display.h b/ffmpeg/include/libavutil/display.h
index 515adad7..50f2b44c 100644
--- a/ffmpeg/include/libavutil/display.h
+++ b/ffmpeg/include/libavutil/display.h
@@ -20,6 +20,7 @@
/**
* @file
+ * @ingroup lavu_video_display
* Display matrix
*/
@@ -27,18 +28,11 @@
#define AVUTIL_DISPLAY_H
#include
-#include "common.h"
/**
- * @addtogroup lavu_video
- * @{
- *
* @defgroup lavu_video_display Display transformation matrix functions
- * @{
- */
-
-/**
- * @addtogroup lavu_video_display
+ * @ingroup lavu_video
+ *
* The display transformation matrix specifies an affine transformation that
* should be applied to video frames for correct presentation. It is compatible
* with the matrices stored in the ISO/IEC 14496-12 container format.
@@ -72,6 +66,8 @@
* q' = (b * p + d * q + y) / z;
* z = u * p + v * q + w
* @endcode
+ *
+ * @{
*/
/**
@@ -88,11 +84,11 @@
double av_display_rotation_get(const int32_t matrix[9]);
/**
- * Initialize a transformation matrix describing a pure counterclockwise
+ * Initialize a transformation matrix describing a pure clockwise
* rotation by the specified angle (in degrees).
*
- * @param matrix an allocated transformation matrix (will be fully overwritten
- * by this function)
+ * @param[out] matrix a transformation matrix (will be fully overwritten
+ * by this function)
* @param angle rotation angle in degrees.
*/
void av_display_rotation_set(int32_t matrix[9], double angle);
@@ -100,14 +96,13 @@ void av_display_rotation_set(int32_t matrix[9], double angle);
/**
* Flip the input matrix horizontally and/or vertically.
*
- * @param matrix an allocated transformation matrix
+ * @param[in,out] matrix a transformation matrix
* @param hflip whether the matrix should be flipped horizontally
* @param vflip whether the matrix should be flipped vertically
*/
void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip);
/**
- * @}
* @}
*/
diff --git a/ffmpeg/include/libavutil/dovi_meta.h b/ffmpeg/include/libavutil/dovi_meta.h
new file mode 100644
index 00000000..5e8a1e43
--- /dev/null
+++ b/ffmpeg/include/libavutil/dovi_meta.h
@@ -0,0 +1,396 @@
+/*
+ * Copyright (c) 2020 Vacing Fang
+ *
+ * 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
+ */
+
+/**
+ * @file
+ * DOVI configuration
+ */
+
+
+#ifndef AVUTIL_DOVI_META_H
+#define AVUTIL_DOVI_META_H
+
+#include
+#include
+
+#include "rational.h"
+#include "csp.h"
+
+/*
+ * DOVI configuration
+ * ref: dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2.1.2
+ dolby-vision-bitstreams-in-mpeg-2-transport-stream-multiplex-v1.2
+ * @code
+ * uint8_t dv_version_major, the major version number that the stream complies with
+ * uint8_t dv_version_minor, the minor version number that the stream complies with
+ * uint8_t dv_profile, the Dolby Vision profile
+ * uint8_t dv_level, the Dolby Vision level
+ * uint8_t rpu_present_flag
+ * uint8_t el_present_flag
+ * uint8_t bl_present_flag
+ * uint8_t dv_bl_signal_compatibility_id
+ * uint8_t dv_md_compression, the compression method in use
+ * @endcode
+ *
+ * @note The struct must be allocated with av_dovi_alloc() and
+ * its size is not a part of the public ABI.
+ */
+typedef struct AVDOVIDecoderConfigurationRecord {
+ uint8_t dv_version_major;
+ uint8_t dv_version_minor;
+ uint8_t dv_profile;
+ uint8_t dv_level;
+ uint8_t rpu_present_flag;
+ uint8_t el_present_flag;
+ uint8_t bl_present_flag;
+ uint8_t dv_bl_signal_compatibility_id;
+ uint8_t dv_md_compression;
+} AVDOVIDecoderConfigurationRecord;
+
+enum AVDOVICompression {
+ AV_DOVI_COMPRESSION_NONE = 0,
+ AV_DOVI_COMPRESSION_LIMITED = 1,
+ AV_DOVI_COMPRESSION_RESERVED = 2,
+ AV_DOVI_COMPRESSION_EXTENDED = 3,
+};
+
+/**
+ * Allocate a AVDOVIDecoderConfigurationRecord structure and initialize its
+ * fields to default values.
+ *
+ * @return the newly allocated struct or NULL on failure
+ */
+AVDOVIDecoderConfigurationRecord *av_dovi_alloc(size_t *size);
+
+/**
+ * Dolby Vision RPU data header.
+ *
+ * @note sizeof(AVDOVIRpuDataHeader) is not part of the public ABI.
+ */
+typedef struct AVDOVIRpuDataHeader {
+ uint8_t rpu_type;
+ uint16_t rpu_format;
+ uint8_t vdr_rpu_profile;
+ uint8_t vdr_rpu_level;
+ uint8_t chroma_resampling_explicit_filter_flag;
+ uint8_t coef_data_type; /* informative, lavc always converts to fixed */
+ uint8_t coef_log2_denom;
+ uint8_t vdr_rpu_normalized_idc;
+ uint8_t bl_video_full_range_flag;
+ uint8_t bl_bit_depth; /* [8, 16] */
+ uint8_t el_bit_depth; /* [8, 16] */
+ uint8_t vdr_bit_depth; /* [8, 16] */
+ uint8_t spatial_resampling_filter_flag;
+ uint8_t el_spatial_resampling_filter_flag;
+ uint8_t disable_residual_flag;
+ uint8_t ext_mapping_idc_0_4; /* extended base layer inverse mapping indicator */
+ uint8_t ext_mapping_idc_5_7; /* reserved */
+} AVDOVIRpuDataHeader;
+
+enum AVDOVIMappingMethod {
+ AV_DOVI_MAPPING_POLYNOMIAL = 0,
+ AV_DOVI_MAPPING_MMR = 1,
+};
+
+/**
+ * Coefficients of a piece-wise function. The pieces of the function span the
+ * value ranges between two adjacent pivot values.
+ */
+#define AV_DOVI_MAX_PIECES 8
+typedef struct AVDOVIReshapingCurve {
+ uint8_t num_pivots; /* [2, 9] */
+ uint16_t pivots[AV_DOVI_MAX_PIECES + 1]; /* sorted ascending */
+ enum AVDOVIMappingMethod mapping_idc[AV_DOVI_MAX_PIECES];
+ /* AV_DOVI_MAPPING_POLYNOMIAL */
+ uint8_t poly_order[AV_DOVI_MAX_PIECES]; /* [1, 2] */
+ int64_t poly_coef[AV_DOVI_MAX_PIECES][3]; /* x^0, x^1, x^2 */
+ /* AV_DOVI_MAPPING_MMR */
+ uint8_t mmr_order[AV_DOVI_MAX_PIECES]; /* [1, 3] */
+ int64_t mmr_constant[AV_DOVI_MAX_PIECES];
+ int64_t mmr_coef[AV_DOVI_MAX_PIECES][3/* order - 1 */][7];
+} AVDOVIReshapingCurve;
+
+enum AVDOVINLQMethod {
+ AV_DOVI_NLQ_NONE = -1,
+ AV_DOVI_NLQ_LINEAR_DZ = 0,
+};
+
+/**
+ * Coefficients of the non-linear inverse quantization. For the interpretation
+ * of these, see ETSI GS CCM 001.
+ */
+typedef struct AVDOVINLQParams {
+ uint16_t nlq_offset;
+ uint64_t vdr_in_max;
+ /* AV_DOVI_NLQ_LINEAR_DZ */
+ uint64_t linear_deadzone_slope;
+ uint64_t linear_deadzone_threshold;
+} AVDOVINLQParams;
+
+/**
+ * Dolby Vision RPU data mapping parameters.
+ *
+ * @note sizeof(AVDOVIDataMapping) is not part of the public ABI.
+ */
+typedef struct AVDOVIDataMapping {
+ uint8_t vdr_rpu_id;
+ uint8_t mapping_color_space;
+ uint8_t mapping_chroma_format_idc;
+ AVDOVIReshapingCurve curves[3]; /* per component */
+
+ /* Non-linear inverse quantization */
+ enum AVDOVINLQMethod nlq_method_idc;
+ uint32_t num_x_partitions;
+ uint32_t num_y_partitions;
+ AVDOVINLQParams nlq[3]; /* per component */
+ uint16_t nlq_pivots[2];
+} AVDOVIDataMapping;
+
+/**
+ * Dolby Vision RPU colorspace metadata parameters.
+ *
+ * @note sizeof(AVDOVIColorMetadata) is not part of the public ABI.
+ */
+typedef struct AVDOVIColorMetadata {
+ uint8_t dm_metadata_id;
+ uint8_t scene_refresh_flag;
+
+ /**
+ * Coefficients of the custom Dolby Vision IPT-PQ matrices. These are to be
+ * used instead of the matrices indicated by the frame's colorspace tags.
+ * The output of rgb_to_lms_matrix is to be fed into a BT.2020 LMS->RGB
+ * matrix based on a Hunt-Pointer-Estevez transform, but without any
+ * crosstalk. (See the definition of the ICtCp colorspace for more
+ * information.)
+ */
+ AVRational ycc_to_rgb_matrix[9]; /* before PQ linearization */
+ AVRational ycc_to_rgb_offset[3]; /* input offset of neutral value */
+ AVRational rgb_to_lms_matrix[9]; /* after PQ linearization */
+
+ /**
+ * Extra signal metadata (see Dolby patents for more info).
+ */
+ uint16_t signal_eotf;
+ uint16_t signal_eotf_param0;
+ uint16_t signal_eotf_param1;
+ uint32_t signal_eotf_param2;
+ uint8_t signal_bit_depth;
+ uint8_t signal_color_space;
+ uint8_t signal_chroma_format;
+ uint8_t signal_full_range_flag; /* [0, 3] */
+ uint16_t source_min_pq;
+ uint16_t source_max_pq;
+ uint16_t source_diagonal;
+} AVDOVIColorMetadata;
+
+typedef struct AVDOVIDmLevel1 {
+ /* Per-frame brightness metadata */
+ uint16_t min_pq;
+ uint16_t max_pq;
+ uint16_t avg_pq;
+} AVDOVIDmLevel1;
+
+typedef struct AVDOVIDmLevel2 {
+ /* Usually derived from level 8 (at different levels) */
+ uint16_t target_max_pq;
+ uint16_t trim_slope;
+ uint16_t trim_offset;
+ uint16_t trim_power;
+ uint16_t trim_chroma_weight;
+ uint16_t trim_saturation_gain;
+ int16_t ms_weight;
+} AVDOVIDmLevel2;
+
+typedef struct AVDOVIDmLevel3 {
+ uint16_t min_pq_offset;
+ uint16_t max_pq_offset;
+ uint16_t avg_pq_offset;
+} AVDOVIDmLevel3;
+
+typedef struct AVDOVIDmLevel4 {
+ uint16_t anchor_pq;
+ uint16_t anchor_power;
+} AVDOVIDmLevel4;
+
+typedef struct AVDOVIDmLevel5 {
+ /* Active area definition */
+ uint16_t left_offset;
+ uint16_t right_offset;
+ uint16_t top_offset;
+ uint16_t bottom_offset;
+} AVDOVIDmLevel5;
+
+typedef struct AVDOVIDmLevel6 {
+ /* Static HDR10 metadata */
+ uint16_t max_luminance;
+ uint16_t min_luminance;
+ uint16_t max_cll;
+ uint16_t max_fall;
+} AVDOVIDmLevel6;
+
+typedef struct AVDOVIDmLevel8 {
+ /* Extended version of level 2 */
+ uint8_t target_display_index;
+ uint16_t trim_slope;
+ uint16_t trim_offset;
+ uint16_t trim_power;
+ uint16_t trim_chroma_weight;
+ uint16_t trim_saturation_gain;
+ uint16_t ms_weight;
+ uint16_t target_mid_contrast;
+ uint16_t clip_trim;
+ uint8_t saturation_vector_field[6];
+ uint8_t hue_vector_field[6];
+} AVDOVIDmLevel8;
+
+typedef struct AVDOVIDmLevel9 {
+ /* Source display characteristics */
+ uint8_t source_primary_index;
+ AVColorPrimariesDesc source_display_primaries;
+} AVDOVIDmLevel9;
+
+typedef struct AVDOVIDmLevel10 {
+ /* Target display characteristics */
+ uint8_t target_display_index;
+ uint16_t target_max_pq;
+ uint16_t target_min_pq;
+ uint8_t target_primary_index;
+ AVColorPrimariesDesc target_display_primaries;
+} AVDOVIDmLevel10;
+
+typedef struct AVDOVIDmLevel11 {
+ uint8_t content_type;
+ uint8_t whitepoint;
+ uint8_t reference_mode_flag;
+ uint8_t sharpness;
+ uint8_t noise_reduction;
+ uint8_t mpeg_noise_reduction;
+ uint8_t frame_rate_conversion;
+ uint8_t brightness;
+ uint8_t color;
+} AVDOVIDmLevel11;
+
+typedef struct AVDOVIDmLevel254 {
+ /* DMv2 info block, always present in samples with DMv2 metadata */
+ uint8_t dm_mode;
+ uint8_t dm_version_index;
+} AVDOVIDmLevel254;
+
+typedef struct AVDOVIDmLevel255 {
+ /* Debug block, not really used in samples */
+ uint8_t dm_run_mode;
+ uint8_t dm_run_version;
+ uint8_t dm_debug[4];
+} AVDOVIDmLevel255;
+
+/**
+ * Dolby Vision metadata extension block. Dynamic extension blocks may change
+ * from frame to frame, while static blocks are constant throughout the entire
+ * sequence.
+ *
+ * @note sizeof(AVDOVIDmData) is not part of the public API.
+ */
+typedef struct AVDOVIDmData {
+ uint8_t level; /* [1, 255] */
+ union {
+ AVDOVIDmLevel1 l1; /* dynamic */
+ AVDOVIDmLevel2 l2; /* dynamic, may appear multiple times */
+ AVDOVIDmLevel3 l3; /* dynamic */
+ AVDOVIDmLevel4 l4; /* dynamic */
+ AVDOVIDmLevel5 l5; /* dynamic */
+ AVDOVIDmLevel6 l6; /* static */
+ /* level 7 is currently unused */
+ AVDOVIDmLevel8 l8; /* dynamic, may appear multiple times */
+ AVDOVIDmLevel9 l9; /* dynamic */
+ AVDOVIDmLevel10 l10; /* static, may appear multiple times */
+ AVDOVIDmLevel11 l11; /* dynamic */
+ AVDOVIDmLevel254 l254; /* static */
+ AVDOVIDmLevel255 l255; /* static */
+ };
+} AVDOVIDmData;
+
+/**
+ * Combined struct representing a combination of header, mapping and color
+ * metadata, for attaching to frames as side data.
+ *
+ * @note The struct must be allocated with av_dovi_metadata_alloc() and
+ * its size is not a part of the public ABI.
+ */
+
+typedef struct AVDOVIMetadata {
+ /**
+ * Offset in bytes from the beginning of this structure at which the
+ * respective structs start.
+ */
+ size_t header_offset; /* AVDOVIRpuDataHeader */
+ size_t mapping_offset; /* AVDOVIDataMapping */
+ size_t color_offset; /* AVDOVIColorMetadata */
+
+ size_t ext_block_offset; /* offset to start of ext blocks array */
+ size_t ext_block_size; /* size per element */
+ int num_ext_blocks; /* number of extension blocks */
+
+ /* static limit on num_ext_blocks, derived from bitstream limitations */
+#define AV_DOVI_MAX_EXT_BLOCKS 32
+} AVDOVIMetadata;
+
+static av_always_inline AVDOVIRpuDataHeader *
+av_dovi_get_header(const AVDOVIMetadata *data)
+{
+ return (AVDOVIRpuDataHeader *)((uint8_t *) data + data->header_offset);
+}
+
+static av_always_inline AVDOVIDataMapping *
+av_dovi_get_mapping(const AVDOVIMetadata *data)
+{
+ return (AVDOVIDataMapping *)((uint8_t *) data + data->mapping_offset);
+}
+
+static av_always_inline AVDOVIColorMetadata *
+av_dovi_get_color(const AVDOVIMetadata *data)
+{
+ return (AVDOVIColorMetadata *)((uint8_t *) data + data->color_offset);
+}
+
+static av_always_inline AVDOVIDmData *
+av_dovi_get_ext(const AVDOVIMetadata *data, int index)
+{
+ return (AVDOVIDmData *)((uint8_t *) data + data->ext_block_offset +
+ data->ext_block_size * index);
+}
+
+/**
+ * Find an extension block with a given level, or NULL. In the case of
+ * multiple extension blocks, only the first is returned.
+ */
+AVDOVIDmData *av_dovi_find_level(const AVDOVIMetadata *data, uint8_t level);
+
+/**
+ * Allocate an AVDOVIMetadata structure and initialize its
+ * fields to default values.
+ *
+ * @param size If this parameter is non-NULL, the size in bytes of the
+ * allocated struct will be written here on success
+ *
+ * @return the newly allocated struct or NULL on failure
+ */
+AVDOVIMetadata *av_dovi_metadata_alloc(size_t *size);
+
+#endif /* AVUTIL_DOVI_META_H */
diff --git a/ffmpeg/include/libavutil/error.h b/ffmpeg/include/libavutil/error.h
index 71df4da3..1efa86c4 100644
--- a/ffmpeg/include/libavutil/error.h
+++ b/ffmpeg/include/libavutil/error.h
@@ -27,6 +27,8 @@
#include
#include
+#include "macros.h"
+
/**
* @addtogroup lavu_error
*
@@ -77,6 +79,7 @@
#define AVERROR_HTTP_UNAUTHORIZED FFERRTAG(0xF8,'4','0','1')
#define AVERROR_HTTP_FORBIDDEN FFERRTAG(0xF8,'4','0','3')
#define AVERROR_HTTP_NOT_FOUND FFERRTAG(0xF8,'4','0','4')
+#define AVERROR_HTTP_TOO_MANY_REQUESTS FFERRTAG(0xF8,'4','2','9')
#define AVERROR_HTTP_OTHER_4XX FFERRTAG(0xF8,'4','X','X')
#define AVERROR_HTTP_SERVER_ERROR FFERRTAG(0xF8,'5','X','X')
diff --git a/ffmpeg/include/libavutil/eval.h b/ffmpeg/include/libavutil/eval.h
index dacd22b9..0d3eaeb3 100644
--- a/ffmpeg/include/libavutil/eval.h
+++ b/ffmpeg/include/libavutil/eval.h
@@ -26,8 +26,6 @@
#ifndef AVUTIL_EVAL_H
#define AVUTIL_EVAL_H
-#include "avutil.h"
-
typedef struct AVExpr AVExpr;
/**
@@ -44,6 +42,7 @@ typedef struct AVExpr AVExpr;
* @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers
* @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments
* @param opaque a pointer which will be passed to all functions from funcs1 and funcs2
+ * @param log_offset log level offset, can be used to silence error messages
* @param log_ctx parent logging context
* @return >= 0 in case of success, a negative value corresponding to an
* AVERROR code otherwise
@@ -67,6 +66,7 @@ int av_expr_parse_and_eval(double *res, const char *s,
* @param funcs1 NULL terminated array of function pointers for functions which take 1 argument
* @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers
* @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments
+ * @param log_offset log level offset, can be used to silence error messages
* @param log_ctx parent logging context
* @return >= 0 in case of success, a negative value corresponding to an
* AVERROR code otherwise
@@ -80,12 +80,39 @@ int av_expr_parse(AVExpr **expr, const char *s,
/**
* Evaluate a previously parsed expression.
*
+ * @param e the AVExpr to evaluate
* @param const_values a zero terminated array of values for the identifiers from av_expr_parse() const_names
* @param opaque a pointer which will be passed to all functions from funcs1 and funcs2
* @return the value of the expression
*/
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque);
+/**
+ * Track the presence of variables and their number of occurrences in a parsed expression
+ *
+ * @param e the AVExpr to track variables in
+ * @param counter a zero-initialized array where the count of each variable will be stored
+ * @param size size of array
+ * @return 0 on success, a negative value indicates that no expression or array was passed
+ * or size was zero
+ */
+int av_expr_count_vars(AVExpr *e, unsigned *counter, int size);
+
+/**
+ * Track the presence of user provided functions and their number of occurrences
+ * in a parsed expression.
+ *
+ * @param e the AVExpr to track user provided functions in
+ * @param counter a zero-initialized array where the count of each function will be stored
+ * if you passed 5 functions with 2 arguments to av_expr_parse()
+ * then for arg=2 this will use up to 5 entries.
+ * @param size size of array
+ * @param arg number of arguments the counted functions have
+ * @return 0 on success, a negative value indicates that no expression or array was passed
+ * or size was zero
+ */
+int av_expr_count_func(AVExpr *e, unsigned *counter, int size, int arg);
+
/**
* Free a parsed expression previously created with av_expr_parse().
*/
diff --git a/ffmpeg/include/libavutil/executor.h b/ffmpeg/include/libavutil/executor.h
new file mode 100644
index 00000000..0eb21c10
--- /dev/null
+++ b/ffmpeg/include/libavutil/executor.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2023 Nuo Mi
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_EXECUTOR_H
+#define AVUTIL_EXECUTOR_H
+
+typedef struct AVExecutor AVExecutor;
+typedef struct AVTask AVTask;
+
+struct AVTask {
+ AVTask *next;
+};
+
+typedef struct AVTaskCallbacks {
+ void *user_data;
+
+ int local_context_size;
+
+ // return 1 if a's priority > b's priority
+ int (*priority_higher)(const AVTask *a, const AVTask *b);
+
+ // task is ready for run
+ int (*ready)(const AVTask *t, void *user_data);
+
+ // run the task
+ int (*run)(AVTask *t, void *local_context, void *user_data);
+} AVTaskCallbacks;
+
+/**
+ * Alloc executor
+ * @param callbacks callback structure for executor
+ * @param thread_count worker thread number, 0 for run on caller's thread directly
+ * @return return the executor
+ */
+AVExecutor* av_executor_alloc(const AVTaskCallbacks *callbacks, int thread_count);
+
+/**
+ * Free executor
+ * @param e pointer to executor
+ */
+void av_executor_free(AVExecutor **e);
+
+/**
+ * Add task to executor
+ * @param e pointer to executor
+ * @param t pointer to task. If NULL, it will wakeup one work thread
+ */
+void av_executor_execute(AVExecutor *e, AVTask *t);
+
+#endif //AVUTIL_EXECUTOR_H
diff --git a/ffmpeg/include/libavutil/ffversion.h b/ffmpeg/include/libavutil/ffversion.h
index 73a4e9cd..8f249965 100644
--- a/ffmpeg/include/libavutil/ffversion.h
+++ b/ffmpeg/include/libavutil/ffversion.h
@@ -1,5 +1,5 @@
/* Automatically generated by version.sh, do not manually edit! */
#ifndef AVUTIL_FFVERSION_H
#define AVUTIL_FFVERSION_H
-#define FFMPEG_VERSION "4.1.3"
+#define FFMPEG_VERSION "7.1-full_build-www.gyan.dev"
#endif /* AVUTIL_FFVERSION_H */
diff --git a/ffmpeg/include/libavutil/fifo.h b/ffmpeg/include/libavutil/fifo.h
index dc7bc6f0..f2206c35 100644
--- a/ffmpeg/include/libavutil/fifo.h
+++ b/ffmpeg/include/libavutil/fifo.h
@@ -18,162 +18,225 @@
/**
* @file
- * a very simple circular buffer FIFO implementation
+ * @ingroup lavu_fifo
+ * A generic FIFO API
*/
#ifndef AVUTIL_FIFO_H
#define AVUTIL_FIFO_H
-#include
-#include "avutil.h"
-#include "attributes.h"
-
-typedef struct AVFifoBuffer {
- uint8_t *buffer;
- uint8_t *rptr, *wptr, *end;
- uint32_t rndx, wndx;
-} AVFifoBuffer;
+#include
/**
- * Initialize an AVFifoBuffer.
- * @param size of FIFO
- * @return AVFifoBuffer or NULL in case of memory allocation failure
+ * @defgroup lavu_fifo AVFifo
+ * @ingroup lavu_data
+ *
+ * @{
+ * A generic FIFO API
*/
-AVFifoBuffer *av_fifo_alloc(unsigned int size);
+
+typedef struct AVFifo AVFifo;
/**
- * Initialize an AVFifoBuffer.
- * @param nmemb number of elements
- * @param size size of the single element
- * @return AVFifoBuffer or NULL in case of memory allocation failure
+ * Callback for writing or reading from a FIFO, passed to (and invoked from) the
+ * av_fifo_*_cb() functions. It may be invoked multiple times from a single
+ * av_fifo_*_cb() call and may process less data than the maximum size indicated
+ * by nb_elems.
+ *
+ * @param opaque the opaque pointer provided to the av_fifo_*_cb() function
+ * @param buf the buffer for reading or writing the data, depending on which
+ * av_fifo_*_cb function is called
+ * @param nb_elems On entry contains the maximum number of elements that can be
+ * read from / written into buf. On success, the callback should
+ * update it to contain the number of elements actually written.
+ *
+ * @return 0 on success, a negative error code on failure (will be returned from
+ * the invoking av_fifo_*_cb() function)
*/
-AVFifoBuffer *av_fifo_alloc_array(size_t nmemb, size_t size);
+typedef int AVFifoCB(void *opaque, void *buf, size_t *nb_elems);
/**
- * Free an AVFifoBuffer.
- * @param f AVFifoBuffer to free
+ * Automatically resize the FIFO on writes, so that the data fits. This
+ * automatic resizing happens up to a limit that can be modified with
+ * av_fifo_auto_grow_limit().
*/
-void av_fifo_free(AVFifoBuffer *f);
+#define AV_FIFO_FLAG_AUTO_GROW (1 << 0)
/**
- * Free an AVFifoBuffer and reset pointer to NULL.
- * @param f AVFifoBuffer to free
+ * Allocate and initialize an AVFifo with a given element size.
+ *
+ * @param elems initial number of elements that can be stored in the FIFO
+ * @param elem_size Size in bytes of a single element. Further operations on
+ * the returned FIFO will implicitly use this element size.
+ * @param flags a combination of AV_FIFO_FLAG_*
+ *
+ * @return newly-allocated AVFifo on success, a negative error code on failure
*/
-void av_fifo_freep(AVFifoBuffer **f);
+AVFifo *av_fifo_alloc2(size_t elems, size_t elem_size,
+ unsigned int flags);
/**
- * Reset the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied.
- * @param f AVFifoBuffer to reset
+ * @return Element size for FIFO operations. This element size is set at
+ * FIFO allocation and remains constant during its lifetime
*/
-void av_fifo_reset(AVFifoBuffer *f);
+size_t av_fifo_elem_size(const AVFifo *f);
/**
- * Return the amount of data in bytes in the AVFifoBuffer, that is the
- * amount of data you can read from it.
- * @param f AVFifoBuffer to read from
- * @return size
+ * Set the maximum size (in elements) to which the FIFO can be resized
+ * automatically. Has no effect unless AV_FIFO_FLAG_AUTO_GROW is used.
*/
-int av_fifo_size(const AVFifoBuffer *f);
+void av_fifo_auto_grow_limit(AVFifo *f, size_t max_elems);
/**
- * Return the amount of space in bytes in the AVFifoBuffer, that is the
- * amount of data you can write into it.
- * @param f AVFifoBuffer to write into
- * @return size
+ * @return number of elements available for reading from the given FIFO.
*/
-int av_fifo_space(const AVFifoBuffer *f);
+size_t av_fifo_can_read(const AVFifo *f);
/**
- * Feed data at specific position from an AVFifoBuffer to a user-supplied callback.
- * Similar as av_fifo_gereric_read but without discarding data.
- * @param f AVFifoBuffer to read from
- * @param offset offset from current read position
- * @param buf_size number of bytes to read
- * @param func generic read function
- * @param dest data destination
+ * @return Number of elements that can be written into the given FIFO without
+ * growing it.
+ *
+ * In other words, this number of elements or less is guaranteed to fit
+ * into the FIFO. More data may be written when the
+ * AV_FIFO_FLAG_AUTO_GROW flag was specified at FIFO creation, but this
+ * may involve memory allocation, which can fail.
*/
-int av_fifo_generic_peek_at(AVFifoBuffer *f, void *dest, int offset, int buf_size, void (*func)(void*, void*, int));
+size_t av_fifo_can_write(const AVFifo *f);
/**
- * Feed data from an AVFifoBuffer to a user-supplied callback.
- * Similar as av_fifo_gereric_read but without discarding data.
- * @param f AVFifoBuffer to read from
- * @param buf_size number of bytes to read
- * @param func generic read function
- * @param dest data destination
+ * Enlarge an AVFifo.
+ *
+ * On success, the FIFO will be large enough to hold exactly
+ * inc + av_fifo_can_read() + av_fifo_can_write()
+ * elements. In case of failure, the old FIFO is kept unchanged.
+ *
+ * @param f AVFifo to resize
+ * @param inc number of elements to allocate for, in addition to the current
+ * allocated size
+ * @return a non-negative number on success, a negative error code on failure
*/
-int av_fifo_generic_peek(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int));
+int av_fifo_grow2(AVFifo *f, size_t inc);
/**
- * Feed data from an AVFifoBuffer to a user-supplied callback.
- * @param f AVFifoBuffer to read from
- * @param buf_size number of bytes to read
- * @param func generic read function
- * @param dest data destination
+ * Write data into a FIFO.
+ *
+ * In case nb_elems > av_fifo_can_write(f) and the AV_FIFO_FLAG_AUTO_GROW flag
+ * was not specified at FIFO creation, nothing is written and an error
+ * is returned.
+ *
+ * Calling function is guaranteed to succeed if nb_elems <= av_fifo_can_write(f).
+ *
+ * @param f the FIFO buffer
+ * @param buf Data to be written. nb_elems * av_fifo_elem_size(f) bytes will be
+ * read from buf on success.
+ * @param nb_elems number of elements to write into FIFO
+ *
+ * @return a non-negative number on success, a negative error code on failure
*/
-int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int));
+int av_fifo_write(AVFifo *f, const void *buf, size_t nb_elems);
/**
- * Feed data from a user-supplied callback to an AVFifoBuffer.
- * @param f AVFifoBuffer to write to
- * @param src data source; non-const since it may be used as a
- * modifiable context by the function defined in func
- * @param size number of bytes to write
- * @param func generic write function; the first parameter is src,
- * the second is dest_buf, the third is dest_buf_size.
- * func must return the number of bytes written to dest_buf, or <= 0 to
- * indicate no more data available to write.
- * If func is NULL, src is interpreted as a simple byte array for source data.
- * @return the number of bytes written to the FIFO
+ * Write data from a user-provided callback into a FIFO.
+ *
+ * @param f the FIFO buffer
+ * @param read_cb Callback supplying the data to the FIFO. May be called
+ * multiple times.
+ * @param opaque opaque user data to be provided to read_cb
+ * @param nb_elems Should point to the maximum number of elements that can be
+ * written. Will be updated to contain the number of elements
+ * actually written.
+ *
+ * @return non-negative number on success, a negative error code on failure
*/
-int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int));
+int av_fifo_write_from_cb(AVFifo *f, AVFifoCB read_cb,
+ void *opaque, size_t *nb_elems);
/**
- * Resize an AVFifoBuffer.
- * In case of reallocation failure, the old FIFO is kept unchanged.
+ * Read data from a FIFO.
+ *
+ * In case nb_elems > av_fifo_can_read(f), nothing is read and an error
+ * is returned.
+ *
+ * @param f the FIFO buffer
+ * @param buf Buffer to store the data. nb_elems * av_fifo_elem_size(f) bytes
+ * will be written into buf on success.
+ * @param nb_elems number of elements to read from FIFO
*
- * @param f AVFifoBuffer to resize
- * @param size new AVFifoBuffer size in bytes
- * @return <0 for failure, >=0 otherwise
+ * @return a non-negative number on success, a negative error code on failure
*/
-int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size);
+int av_fifo_read(AVFifo *f, void *buf, size_t nb_elems);
/**
- * Enlarge an AVFifoBuffer.
- * In case of reallocation failure, the old FIFO is kept unchanged.
- * The new fifo size may be larger than the requested size.
+ * Feed data from a FIFO into a user-provided callback.
*
- * @param f AVFifoBuffer to resize
- * @param additional_space the amount of space in bytes to allocate in addition to av_fifo_size()
- * @return <0 for failure, >=0 otherwise
+ * @param f the FIFO buffer
+ * @param write_cb Callback the data will be supplied to. May be called
+ * multiple times.
+ * @param opaque opaque user data to be provided to write_cb
+ * @param nb_elems Should point to the maximum number of elements that can be
+ * read. Will be updated to contain the total number of elements
+ * actually sent to the callback.
+ *
+ * @return non-negative number on success, a negative error code on failure
*/
-int av_fifo_grow(AVFifoBuffer *f, unsigned int additional_space);
+int av_fifo_read_to_cb(AVFifo *f, AVFifoCB write_cb,
+ void *opaque, size_t *nb_elems);
/**
- * Read and discard the specified amount of data from an AVFifoBuffer.
- * @param f AVFifoBuffer to read from
- * @param size amount of data to read in bytes
+ * Read data from a FIFO without modifying FIFO state.
+ *
+ * Returns an error if an attempt is made to peek to nonexistent elements
+ * (i.e. if offset + nb_elems is larger than av_fifo_can_read(f)).
+ *
+ * @param f the FIFO buffer
+ * @param buf Buffer to store the data. nb_elems * av_fifo_elem_size(f) bytes
+ * will be written into buf.
+ * @param nb_elems number of elements to read from FIFO
+ * @param offset number of initial elements to skip.
+ *
+ * @return a non-negative number on success, a negative error code on failure
*/
-void av_fifo_drain(AVFifoBuffer *f, int size);
+int av_fifo_peek(const AVFifo *f, void *buf, size_t nb_elems, size_t offset);
/**
- * Return a pointer to the data stored in a FIFO buffer at a certain offset.
- * The FIFO buffer is not modified.
+ * Feed data from a FIFO into a user-provided callback.
+ *
+ * @param f the FIFO buffer
+ * @param write_cb Callback the data will be supplied to. May be called
+ * multiple times.
+ * @param opaque opaque user data to be provided to write_cb
+ * @param nb_elems Should point to the maximum number of elements that can be
+ * read. Will be updated to contain the total number of elements
+ * actually sent to the callback.
+ * @param offset number of initial elements to skip; offset + *nb_elems must not
+ * be larger than av_fifo_can_read(f).
*
- * @param f AVFifoBuffer to peek at, f must be non-NULL
- * @param offs an offset in bytes, its absolute value must be less
- * than the used buffer size or the returned pointer will
- * point outside to the buffer data.
- * The used buffer size can be checked with av_fifo_size().
+ * @return a non-negative number on success, a negative error code on failure
+ */
+int av_fifo_peek_to_cb(const AVFifo *f, AVFifoCB write_cb, void *opaque,
+ size_t *nb_elems, size_t offset);
+
+/**
+ * Discard the specified amount of data from an AVFifo.
+ * @param size number of elements to discard, MUST NOT be larger than
+ * av_fifo_can_read(f)
+ */
+void av_fifo_drain2(AVFifo *f, size_t size);
+
+/*
+ * Empty the AVFifo.
+ * @param f AVFifo to reset
+ */
+void av_fifo_reset2(AVFifo *f);
+
+/**
+ * Free an AVFifo and reset pointer to NULL.
+ * @param f Pointer to an AVFifo to free. *f == NULL is allowed.
+ */
+void av_fifo_freep2(AVFifo **f);
+
+/**
+ * @}
*/
-static inline uint8_t *av_fifo_peek2(const AVFifoBuffer *f, int offs)
-{
- uint8_t *ptr = f->rptr + offs;
- if (ptr >= f->end)
- ptr = f->buffer + (ptr - f->end);
- else if (ptr < f->buffer)
- ptr = f->end - (f->buffer - ptr);
- return ptr;
-}
#endif /* AVUTIL_FIFO_H */
diff --git a/ffmpeg/include/libavutil/file.h b/ffmpeg/include/libavutil/file.h
index 3ef4a602..fced1701 100644
--- a/ffmpeg/include/libavutil/file.h
+++ b/ffmpeg/include/libavutil/file.h
@@ -19,9 +19,10 @@
#ifndef AVUTIL_FILE_H
#define AVUTIL_FILE_H
+#include
#include
-#include "avutil.h"
+#include "attributes.h"
/**
* @file
@@ -37,6 +38,9 @@
* case *bufptr will be set to NULL and *size will be set to 0.
* The returned buffer must be released with av_file_unmap().
*
+ * @param filename path to the file
+ * @param[out] bufptr pointee is set to the mapped or allocated buffer
+ * @param[out] size pointee is set to the size in bytes of the buffer
* @param log_offset loglevel offset used for logging
* @param log_ctx context used for logging
* @return a non negative number in case of success, a negative value
@@ -49,23 +53,10 @@ int av_file_map(const char *filename, uint8_t **bufptr, size_t *size,
/**
* Unmap or free the buffer bufptr created by av_file_map().
*
+ * @param bufptr the buffer previously created with av_file_map()
* @param size size in bytes of bufptr, must be the same as returned
* by av_file_map()
*/
void av_file_unmap(uint8_t *bufptr, size_t size);
-/**
- * Wrapper to work around the lack of mkstemp() on mingw.
- * Also, tries to create file in /tmp first, if possible.
- * *prefix can be a character constant; *filename will be allocated internally.
- * @return file descriptor of opened file (or negative value corresponding to an
- * AVERROR code on error)
- * and opened file name in **filename.
- * @note On very old libcs it is necessary to set a secure umask before
- * calling this, av_tempfile() can't call umask itself as it is used in
- * libraries and could interfere with the calling application.
- * @deprecated as fd numbers cannot be passed saftely between libs on some platforms
- */
-int av_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx);
-
#endif /* AVUTIL_FILE_H */
diff --git a/ffmpeg/include/libavutil/film_grain_params.h b/ffmpeg/include/libavutil/film_grain_params.h
new file mode 100644
index 00000000..ccacab88
--- /dev/null
+++ b/ffmpeg/include/libavutil/film_grain_params.h
@@ -0,0 +1,322 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_FILM_GRAIN_PARAMS_H
+#define AVUTIL_FILM_GRAIN_PARAMS_H
+
+#include "frame.h"
+
+enum AVFilmGrainParamsType {
+ AV_FILM_GRAIN_PARAMS_NONE = 0,
+
+ /**
+ * The union is valid when interpreted as AVFilmGrainAOMParams (codec.aom)
+ */
+ AV_FILM_GRAIN_PARAMS_AV1,
+
+ /**
+ * The union is valid when interpreted as AVFilmGrainH274Params (codec.h274)
+ */
+ AV_FILM_GRAIN_PARAMS_H274,
+};
+
+/**
+ * This structure describes how to handle film grain synthesis for AOM codecs.
+ *
+ * @note The struct must be allocated as part of AVFilmGrainParams using
+ * av_film_grain_params_alloc(). Its size is not a part of the public ABI.
+ */
+typedef struct AVFilmGrainAOMParams {
+ /**
+ * Number of points, and the scale and value for each point of the
+ * piecewise linear scaling function for the uma plane.
+ */
+ int num_y_points;
+ uint8_t y_points[14][2 /* value, scaling */];
+
+ /**
+ * Signals whether to derive the chroma scaling function from the luma.
+ * Not equivalent to copying the luma values and scales.
+ */
+ int chroma_scaling_from_luma;
+
+ /**
+ * If chroma_scaling_from_luma is set to 0, signals the chroma scaling
+ * function parameters.
+ */
+ int num_uv_points[2 /* cb, cr */];
+ uint8_t uv_points[2 /* cb, cr */][10][2 /* value, scaling */];
+
+ /**
+ * Specifies the shift applied to the chroma components. For AV1, its within
+ * [8; 11] and determines the range and quantization of the film grain.
+ */
+ int scaling_shift;
+
+ /**
+ * Specifies the auto-regression lag.
+ */
+ int ar_coeff_lag;
+
+ /**
+ * Luma auto-regression coefficients. The number of coefficients is given by
+ * 2 * ar_coeff_lag * (ar_coeff_lag + 1).
+ */
+ int8_t ar_coeffs_y[24];
+
+ /**
+ * Chroma auto-regression coefficients. The number of coefficients is given by
+ * 2 * ar_coeff_lag * (ar_coeff_lag + 1) + !!num_y_points.
+ */
+ int8_t ar_coeffs_uv[2 /* cb, cr */][25];
+
+ /**
+ * Specifies the range of the auto-regressive coefficients. Values of 6,
+ * 7, 8 and so on represent a range of [-2, 2), [-1, 1), [-0.5, 0.5) and
+ * so on. For AV1 must be between 6 and 9.
+ */
+ int ar_coeff_shift;
+
+ /**
+ * Signals the down shift applied to the generated gaussian numbers during
+ * synthesis.
+ */
+ int grain_scale_shift;
+
+ /**
+ * Specifies the luma/chroma multipliers for the index to the component
+ * scaling function.
+ */
+ int uv_mult[2 /* cb, cr */];
+ int uv_mult_luma[2 /* cb, cr */];
+
+ /**
+ * Offset used for component scaling function. For AV1 its a 9-bit value
+ * with a range [-256, 255]
+ */
+ int uv_offset[2 /* cb, cr */];
+
+ /**
+ * Signals whether to overlap film grain blocks.
+ */
+ int overlap_flag;
+
+ /**
+ * Signals to clip to limited color levels after film grain application.
+ */
+ int limit_output_range;
+} AVFilmGrainAOMParams;
+
+/**
+ * This structure describes how to handle film grain synthesis for codecs using
+ * the ITU-T H.274 Versatile suplemental enhancement information message.
+ *
+ * @note The struct must be allocated as part of AVFilmGrainParams using
+ * av_film_grain_params_alloc(). Its size is not a part of the public ABI.
+ */
+typedef struct AVFilmGrainH274Params {
+ /**
+ * Specifies the film grain simulation mode.
+ * 0 = Frequency filtering, 1 = Auto-regression
+ */
+ int model_id;
+
+#if FF_API_H274_FILM_GRAIN_VCS
+ /**
+ * TODO: On this ABI bump, please also re-order the fields in
+ * AVFilmGrainParams (see below)
+ */
+
+ /**
+ * Specifies the bit depth used for the luma component.
+ *
+ * @deprecated use AVFilmGrainParams.bit_depth_luma.
+ */
+ attribute_deprecated
+ int bit_depth_luma;
+
+ /**
+ * Specifies the bit depth used for the chroma components.
+ *
+ * @deprecated use AVFilmGrainParams.bit_depth_chroma.
+ */
+ attribute_deprecated
+ int bit_depth_chroma;
+
+ /**
+ * Specifies the video signal characteristics.
+ *
+ * @deprecated use AVFilmGrainParams.color_{range,primaries,trc,space}.
+ */
+ attribute_deprecated
+ enum AVColorRange color_range;
+ attribute_deprecated
+ enum AVColorPrimaries color_primaries;
+ attribute_deprecated
+ enum AVColorTransferCharacteristic color_trc;
+ attribute_deprecated
+ enum AVColorSpace color_space;
+#endif
+
+ /**
+ * Specifies the blending mode used to blend the simulated film grain
+ * with the decoded images.
+ *
+ * 0 = Additive, 1 = Multiplicative
+ */
+ int blending_mode_id;
+
+ /**
+ * Specifies a scale factor used in the film grain characterization equations.
+ */
+ int log2_scale_factor;
+
+ /**
+ * Indicates if the modelling of film grain for a given component is present.
+ */
+ int component_model_present[3 /* y, cb, cr */];
+
+ /**
+ * Specifies the number of intensity intervals for which a specific set of
+ * model values has been estimated, with a range of [1, 256].
+ */
+ uint16_t num_intensity_intervals[3 /* y, cb, cr */];
+
+ /**
+ * Specifies the number of model values present for each intensity interval
+ * in which the film grain has been modelled, with a range of [1, 6].
+ */
+ uint8_t num_model_values[3 /* y, cb, cr */];
+
+ /**
+ * Specifies the lower ounds of each intensity interval for whichthe set of
+ * model values applies for the component.
+ */
+ uint8_t intensity_interval_lower_bound[3 /* y, cb, cr */][256 /* intensity interval */];
+
+ /**
+ * Specifies the upper bound of each intensity interval for which the set of
+ * model values applies for the component.
+ */
+ uint8_t intensity_interval_upper_bound[3 /* y, cb, cr */][256 /* intensity interval */];
+
+ /**
+ * Specifies the model values for the component for each intensity interval.
+ * - When model_id == 0, the following applies:
+ * For comp_model_value[y], the range of values is [0, 2^bit_depth_luma - 1]
+ * For comp_model_value[cb..cr], the range of values is [0, 2^bit_depth_chroma - 1]
+ * - Otherwise, the following applies:
+ * For comp_model_value[y], the range of values is [-2^(bit_depth_luma - 1), 2^(bit_depth_luma - 1) - 1]
+ * For comp_model_value[cb..cr], the range of values is [-2^(bit_depth_chroma - 1), 2^(bit_depth_chroma - 1) - 1]
+ */
+ int16_t comp_model_value[3 /* y, cb, cr */][256 /* intensity interval */][6 /* model value */];
+} AVFilmGrainH274Params;
+
+/**
+ * This structure describes how to handle film grain synthesis in video
+ * for specific codecs. Must be present on every frame where film grain is
+ * meant to be synthesised for correct presentation.
+ *
+ * @note The struct must be allocated with av_film_grain_params_alloc() and
+ * its size is not a part of the public ABI.
+ */
+typedef struct AVFilmGrainParams {
+ /**
+ * Specifies the codec for which this structure is valid.
+ */
+ enum AVFilmGrainParamsType type;
+
+ /**
+ * Seed to use for the synthesis process, if the codec allows for it.
+ *
+ * @note For H.264, this refers to `pic_offset` as defined in
+ * SMPTE RDD 5-2006.
+ */
+ uint64_t seed;
+
+ /**
+ * Additional fields may be added both here and in any structure included.
+ * If a codec's film grain structure differs slightly over another
+ * codec's, fields within may change meaning depending on the type.
+ *
+ * TODO: Move this to the end of the structure, at the next ABI bump.
+ */
+ union {
+ AVFilmGrainAOMParams aom;
+ AVFilmGrainH274Params h274;
+ } codec;
+
+ /**
+ * Intended display resolution. May be 0 if the codec does not specify
+ * any restrictions.
+ */
+
+ int width, height;
+
+ /**
+ * Intended subsampling ratio, or 0 for luma-only streams.
+ */
+ int subsampling_x, subsampling_y;
+
+ /**
+ * Intended video signal characteristics.
+ */
+ enum AVColorRange color_range;
+ enum AVColorPrimaries color_primaries;
+ enum AVColorTransferCharacteristic color_trc;
+ enum AVColorSpace color_space;
+
+ /**
+ * Intended bit depth, or 0 for unknown/unspecified.
+ */
+ int bit_depth_luma;
+ int bit_depth_chroma;
+
+} AVFilmGrainParams;
+
+/**
+ * Allocate an AVFilmGrainParams structure and set its fields to
+ * default values. The resulting struct can be freed using av_freep().
+ * If size is not NULL it will be set to the number of bytes allocated.
+ *
+ * @return An AVFilmGrainParams filled with default values or NULL
+ * on failure.
+ */
+AVFilmGrainParams *av_film_grain_params_alloc(size_t *size);
+
+/**
+ * Allocate a complete AVFilmGrainParams and add it to the frame.
+ *
+ * @param frame The frame which side data is added to.
+ *
+ * @return The AVFilmGrainParams structure to be filled by caller.
+ */
+AVFilmGrainParams *av_film_grain_params_create_side_data(AVFrame *frame);
+
+/**
+ * Select the most appropriate film grain parameters set for the frame,
+ * taking into account the frame's format, resolution and video signal
+ * characteristics.
+ *
+ * @note, for H.274, this may select a film grain parameter set with
+ * greater chroma resolution than the frame. Users should take care to
+ * correctly adjust the chroma grain frequency to the frame.
+ */
+const AVFilmGrainParams *av_film_grain_params_select(const AVFrame *frame);
+
+#endif /* AVUTIL_FILM_GRAIN_PARAMS_H */
diff --git a/ffmpeg/include/libavutil/frame.h b/ffmpeg/include/libavutil/frame.h
index e2a29298..f7806566 100644
--- a/ffmpeg/include/libavutil/frame.h
+++ b/ffmpeg/include/libavutil/frame.h
@@ -30,6 +30,7 @@
#include "avutil.h"
#include "buffer.h"
+#include "channel_layout.h"
#include "dict.h"
#include "rational.h"
#include "samplefmt.h"
@@ -142,30 +143,106 @@ enum AVFrameSideDataType {
*/
AV_FRAME_DATA_ICC_PROFILE,
-#if FF_API_FRAME_QP
/**
- * Implementation-specific description of the format of AV_FRAME_QP_TABLE_DATA.
- * The contents of this side data are undocumented and internal; use
- * av_frame_set_qp_table() and av_frame_get_qp_table() to access this in a
- * meaningful way instead.
+ * Timecode which conforms to SMPTE ST 12-1. The data is an array of 4 uint32_t
+ * where the first uint32_t describes how many (1-3) of the other timecodes are used.
+ * The timecode format is described in the documentation of av_timecode_get_smpte_from_framenum()
+ * function in libavutil/timecode.h.
*/
- AV_FRAME_DATA_QP_TABLE_PROPERTIES,
+ AV_FRAME_DATA_S12M_TIMECODE,
/**
- * Raw QP table data. Its format is described by
- * AV_FRAME_DATA_QP_TABLE_PROPERTIES. Use av_frame_set_qp_table() and
- * av_frame_get_qp_table() to access this instead.
+ * HDR dynamic metadata associated with a video frame. The payload is
+ * an AVDynamicHDRPlus type and contains information for color
+ * volume transform - application 4 of SMPTE 2094-40:2016 standard.
*/
- AV_FRAME_DATA_QP_TABLE_DATA,
-#endif
+ AV_FRAME_DATA_DYNAMIC_HDR_PLUS,
/**
- * Timecode which conforms to SMPTE ST 12-1. The data is an array of 4 uint32_t
- * where the first uint32_t describes how many (1-3) of the other timecodes are used.
- * The timecode format is described in the av_timecode_get_smpte_from_framenum()
- * function in libavutil/timecode.c.
+ * Regions Of Interest, the data is an array of AVRegionOfInterest type, the number of
+ * array element is implied by AVFrameSideData.size / AVRegionOfInterest.self_size.
*/
- AV_FRAME_DATA_S12M_TIMECODE,
+ AV_FRAME_DATA_REGIONS_OF_INTEREST,
+
+ /**
+ * Encoding parameters for a video frame, as described by AVVideoEncParams.
+ */
+ AV_FRAME_DATA_VIDEO_ENC_PARAMS,
+
+ /**
+ * User data unregistered metadata associated with a video frame.
+ * This is the H.26[45] UDU SEI message, and shouldn't be used for any other purpose
+ * The data is stored as uint8_t in AVFrameSideData.data which is 16 bytes of
+ * uuid_iso_iec_11578 followed by AVFrameSideData.size - 16 bytes of user_data_payload_byte.
+ */
+ AV_FRAME_DATA_SEI_UNREGISTERED,
+
+ /**
+ * Film grain parameters for a frame, described by AVFilmGrainParams.
+ * Must be present for every frame which should have film grain applied.
+ *
+ * May be present multiple times, for example when there are multiple
+ * alternative parameter sets for different video signal characteristics.
+ * The user should select the most appropriate set for the application.
+ */
+ AV_FRAME_DATA_FILM_GRAIN_PARAMS,
+
+ /**
+ * Bounding boxes for object detection and classification,
+ * as described by AVDetectionBBoxHeader.
+ */
+ AV_FRAME_DATA_DETECTION_BBOXES,
+
+ /**
+ * Dolby Vision RPU raw data, suitable for passing to x265
+ * or other libraries. Array of uint8_t, with NAL emulation
+ * bytes intact.
+ */
+ AV_FRAME_DATA_DOVI_RPU_BUFFER,
+
+ /**
+ * Parsed Dolby Vision metadata, suitable for passing to a software
+ * implementation. The payload is the AVDOVIMetadata struct defined in
+ * libavutil/dovi_meta.h.
+ */
+ AV_FRAME_DATA_DOVI_METADATA,
+
+ /**
+ * HDR Vivid dynamic metadata associated with a video frame. The payload is
+ * an AVDynamicHDRVivid type and contains information for color
+ * volume transform - CUVA 005.1-2021.
+ */
+ AV_FRAME_DATA_DYNAMIC_HDR_VIVID,
+
+ /**
+ * Ambient viewing environment metadata, as defined by H.274.
+ */
+ AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT,
+
+ /**
+ * Provide encoder-specific hinting information about changed/unchanged
+ * portions of a frame. It can be used to pass information about which
+ * macroblocks can be skipped because they didn't change from the
+ * corresponding ones in the previous frame. This could be useful for
+ * applications which know this information in advance to speed up
+ * encoding.
+ */
+ AV_FRAME_DATA_VIDEO_HINT,
+
+ /**
+ * Raw LCEVC payload data, as a uint8_t array, with NAL emulation
+ * bytes intact.
+ */
+ AV_FRAME_DATA_LCEVC,
+
+ /**
+ * This side data must be associated with a video frame.
+ * The presence of this side data indicates that the video stream is
+ * composed of multiple views (e.g. stereoscopic 3D content,
+ * cf. H.264 Annex H or H.265 Annex G).
+ * The data is an int storing the view ID.
+ */
+ AV_FRAME_DATA_VIEW_ID,
};
enum AVActiveFormatDescription {
@@ -188,11 +265,98 @@ enum AVActiveFormatDescription {
typedef struct AVFrameSideData {
enum AVFrameSideDataType type;
uint8_t *data;
- int size;
+ size_t size;
AVDictionary *metadata;
AVBufferRef *buf;
} AVFrameSideData;
+enum AVSideDataProps {
+ /**
+ * The side data type can be used in stream-global structures.
+ * Side data types without this property are only meaningful on per-frame
+ * basis.
+ */
+ AV_SIDE_DATA_PROP_GLOBAL = (1 << 0),
+
+ /**
+ * Multiple instances of this side data type can be meaningfully present in
+ * a single side data array.
+ */
+ AV_SIDE_DATA_PROP_MULTI = (1 << 1),
+};
+
+/**
+ * This struct describes the properties of a side data type. Its instance
+ * corresponding to a given type can be obtained from av_frame_side_data_desc().
+ */
+typedef struct AVSideDataDescriptor {
+ /**
+ * Human-readable side data description.
+ */
+ const char *name;
+
+ /**
+ * Side data property flags, a combination of AVSideDataProps values.
+ */
+ unsigned props;
+} AVSideDataDescriptor;
+
+/**
+ * Structure describing a single Region Of Interest.
+ *
+ * When multiple regions are defined in a single side-data block, they
+ * should be ordered from most to least important - some encoders are only
+ * capable of supporting a limited number of distinct regions, so will have
+ * to truncate the list.
+ *
+ * When overlapping regions are defined, the first region containing a given
+ * area of the frame applies.
+ */
+typedef struct AVRegionOfInterest {
+ /**
+ * Must be set to the size of this data structure (that is,
+ * sizeof(AVRegionOfInterest)).
+ */
+ uint32_t self_size;
+ /**
+ * Distance in pixels from the top edge of the frame to the top and
+ * bottom edges and from the left edge of the frame to the left and
+ * right edges of the rectangle defining this region of interest.
+ *
+ * The constraints on a region are encoder dependent, so the region
+ * actually affected may be slightly larger for alignment or other
+ * reasons.
+ */
+ int top;
+ int bottom;
+ int left;
+ int right;
+ /**
+ * Quantisation offset.
+ *
+ * Must be in the range -1 to +1. A value of zero indicates no quality
+ * change. A negative value asks for better quality (less quantisation),
+ * while a positive value asks for worse quality (greater quantisation).
+ *
+ * The range is calibrated so that the extreme values indicate the
+ * largest possible offset - if the rest of the frame is encoded with the
+ * worst possible quality, an offset of -1 indicates that this region
+ * should be encoded with the best possible quality anyway. Intermediate
+ * values are then interpolated in some codec-dependent way.
+ *
+ * For example, in 10-bit H.264 the quantisation parameter varies between
+ * -12 and 51. A typical qoffset value of -1/10 therefore indicates that
+ * this region should be encoded with a QP around one-tenth of the full
+ * range better than the rest of the frame. So, if most of the frame
+ * were to be encoded with a QP of around 30, this region would get a QP
+ * of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
+ * An extreme value of -1 would indicate that this region should be
+ * encoded with the best possible quality regardless of the treatment of
+ * the rest of the frame - that is, should be encoded at a QP of -12.
+ */
+ AVRational qoffset;
+} AVRegionOfInterest;
+
/**
* This structure describes decoded (raw) audio or video data.
*
@@ -220,28 +384,38 @@ typedef struct AVFrameSideData {
* to the end with a minor bump.
*
* Fields can be accessed through AVOptions, the name string used, matches the
- * C structure field name for fields accessible through AVOptions. The AVClass
- * for AVFrame can be obtained from avcodec_get_frame_class()
+ * C structure field name for fields accessible through AVOptions.
*/
typedef struct AVFrame {
#define AV_NUM_DATA_POINTERS 8
/**
* pointer to the picture/channel planes.
- * This might be different from the first allocated byte
+ * This might be different from the first allocated byte. For video,
+ * it could even point to the end of the image data.
+ *
+ * All pointers in data and extended_data must point into one of the
+ * AVBufferRef in buf or extended_buf.
*
* Some decoders access areas outside 0,0 - width,height, please
* see avcodec_align_dimensions2(). Some filters and swscale can read
* up to 16 bytes beyond the planes, if these filters are to be used,
* then 16 extra bytes must be allocated.
*
- * NOTE: Except for hwaccel formats, pointers not needed by the format
- * MUST be set to NULL.
+ * NOTE: Pointers not needed by the format MUST be set to NULL.
+ *
+ * @attention In case of video, the data[] pointers can point to the
+ * end of image data in order to reverse line order, when used in
+ * combination with negative values in the linesize[] array.
*/
uint8_t *data[AV_NUM_DATA_POINTERS];
/**
- * For video, size in bytes of each picture line.
- * For audio, size in bytes of each plane.
+ * For video, a positive or negative value, which is typically indicating
+ * the size in bytes of each picture line, but it can also be:
+ * - the negative byte size of lines for vertical flipping
+ * (with data[n] pointing to the end of the data
+ * - a positive or negative multiple of the byte size as for accessing
+ * even and odd fields of a frame (possibly flipped)
*
* For audio, only linesize[0] may be set. For planar audio, each channel
* plane must be the same size.
@@ -253,6 +427,9 @@ typedef struct AVFrame {
*
* @note The linesize may be larger than the size of usable data -- there
* may be extra padding present for performance reasons.
+ *
+ * @attention In case of video, line size values can be negative to achieve
+ * a vertically inverted iteration over image lines.
*/
int linesize[AV_NUM_DATA_POINTERS];
@@ -298,10 +475,15 @@ typedef struct AVFrame {
*/
int format;
+#if FF_API_FRAME_KEY
/**
* 1 -> keyframe, 0-> not
+ *
+ * @deprecated Use AV_FRAME_FLAG_KEY instead
*/
+ attribute_deprecated
int key_frame;
+#endif
/**
* Picture type of the frame.
@@ -318,15 +500,6 @@ typedef struct AVFrame {
*/
int64_t pts;
-#if FF_API_PKT_PTS
- /**
- * PTS copied from the AVPacket that was decoded to produce this frame.
- * @deprecated use the pts field instead
- */
- attribute_deprecated
- int64_t pkt_pts;
-#endif
-
/**
* DTS copied from the AVPacket that triggered returning this frame. (if frame threading isn't used)
* This is also the Presentation time of this AVFrame calculated from
@@ -335,13 +508,12 @@ typedef struct AVFrame {
int64_t pkt_dts;
/**
- * picture number in bitstream order
+ * Time base for the timestamps in this frame.
+ * In the future, this field may be set on frames output by decoders or
+ * filters, but its value will be by default ignored on input to encoders
+ * or filters.
*/
- int coded_picture_number;
- /**
- * picture number in display order
- */
- int display_picture_number;
+ AVRational time_base;
/**
* quality (between 1 (good) and FF_LAMBDA_MAX (bad))
@@ -349,49 +521,66 @@ typedef struct AVFrame {
int quality;
/**
- * for some private data of the user
+ * Frame owner's private data.
+ *
+ * This field may be set by the code that allocates/owns the frame data.
+ * It is then not touched by any library functions, except:
+ * - it is copied to other references by av_frame_copy_props() (and hence by
+ * av_frame_ref());
+ * - it is set to NULL when the frame is cleared by av_frame_unref()
+ * - on the caller's explicit request. E.g. libavcodec encoders/decoders
+ * will copy this field to/from @ref AVPacket "AVPackets" if the caller sets
+ * @ref AV_CODEC_FLAG_COPY_OPAQUE.
+ *
+ * @see opaque_ref the reference-counted analogue
*/
void *opaque;
-#if FF_API_ERROR_FRAME
- /**
- * @deprecated unused
- */
- attribute_deprecated
- uint64_t error[AV_NUM_DATA_POINTERS];
-#endif
-
/**
- * When decoding, this signals how much the picture must be delayed.
- * extra_delay = repeat_pict / (2*fps)
+ * Number of fields in this frame which should be repeated, i.e. the total
+ * duration of this frame should be repeat_pict + 2 normal field durations.
+ *
+ * For interlaced frames this field may be set to 1, which signals that this
+ * frame should be presented as 3 fields: beginning with the first field (as
+ * determined by AV_FRAME_FLAG_TOP_FIELD_FIRST being set or not), followed
+ * by the second field, and then the first field again.
+ *
+ * For progressive frames this field may be set to a multiple of 2, which
+ * signals that this frame's duration should be (repeat_pict + 2) / 2
+ * normal frame durations.
+ *
+ * @note This field is computed from MPEG2 repeat_first_field flag and its
+ * associated flags, H.264 pic_struct from picture timing SEI, and
+ * their analogues in other codecs. Typically it should only be used when
+ * higher-layer timing information is not available.
*/
int repeat_pict;
+#if FF_API_INTERLACED_FRAME
/**
* The content of the picture is interlaced.
+ *
+ * @deprecated Use AV_FRAME_FLAG_INTERLACED instead
*/
+ attribute_deprecated
int interlaced_frame;
/**
* If the content is interlaced, is top field displayed first.
+ *
+ * @deprecated Use AV_FRAME_FLAG_TOP_FIELD_FIRST instead
*/
+ attribute_deprecated
int top_field_first;
+#endif
+#if FF_API_PALETTE_HAS_CHANGED
/**
* Tell user application that palette has changed from previous frame.
*/
+ attribute_deprecated
int palette_has_changed;
-
- /**
- * reordered opaque 64 bits (generally an integer or a double precision float
- * PTS but can be anything).
- * The user sets AVCodecContext.reordered_opaque to represent the input at
- * that time,
- * the decoder reorders values as needed and sets AVFrame.reordered_opaque
- * to exactly one of the values provided by the user through AVCodecContext.reordered_opaque
- * @deprecated in favor of pkt_pts
- */
- int64_t reordered_opaque;
+#endif
/**
* Sample rate of the audio data.
@@ -399,15 +588,10 @@ typedef struct AVFrame {
int sample_rate;
/**
- * Channel layout of the audio data.
- */
- uint64_t channel_layout;
-
- /**
- * AVBuffer references backing the data for this frame. If all elements of
- * this array are NULL, then this frame is not reference counted. This array
- * must be filled contiguously -- if buf[i] is non-NULL then buf[j] must
- * also be non-NULL for all j < i.
+ * AVBuffer references backing the data for this frame. All the pointers in
+ * data and extended_data must point inside one of the buffers in buf or
+ * extended_buf. This array must be filled contiguously -- if buf[i] is
+ * non-NULL then buf[j] must also be non-NULL for all j < i.
*
* There may be at most one AVBuffer per data plane, so for video this array
* always contains all the references. For planar audio with more than
@@ -450,10 +634,23 @@ typedef struct AVFrame {
* The frame data may be corrupted, e.g. due to decoding errors.
*/
#define AV_FRAME_FLAG_CORRUPT (1 << 0)
+/**
+ * A flag to mark frames that are keyframes.
+ */
+#define AV_FRAME_FLAG_KEY (1 << 1)
/**
* A flag to mark the frames which need to be decoded, but shouldn't be output.
*/
#define AV_FRAME_FLAG_DISCARD (1 << 2)
+/**
+ * A flag to mark frames whose content is interlaced.
+ */
+#define AV_FRAME_FLAG_INTERLACED (1 << 3)
+/**
+ * A flag to mark frames where the top field is displayed first if the content
+ * is interlaced.
+ */
+#define AV_FRAME_FLAG_TOP_FIELD_FIRST (1 << 4)
/**
* @}
*/
@@ -490,20 +687,17 @@ typedef struct AVFrame {
*/
int64_t best_effort_timestamp;
+#if FF_API_FRAME_PKT
/**
* reordered pos from the last AVPacket that has been input into the decoder
* - encoding: unused
* - decoding: Read by user.
+ * @deprecated use AV_CODEC_FLAG_COPY_OPAQUE to pass through arbitrary user
+ * data from packets to frames
*/
+ attribute_deprecated
int64_t pkt_pos;
-
- /**
- * duration of the corresponding packet, expressed in
- * AVStream->time_base units, 0 if unknown.
- * - encoding: unused
- * - decoding: Read by user.
- */
- int64_t pkt_duration;
+#endif
/**
* metadata.
@@ -522,41 +716,23 @@ typedef struct AVFrame {
int decode_error_flags;
#define FF_DECODE_ERROR_INVALID_BITSTREAM 1
#define FF_DECODE_ERROR_MISSING_REFERENCE 2
+#define FF_DECODE_ERROR_CONCEALMENT_ACTIVE 4
+#define FF_DECODE_ERROR_DECODE_SLICES 8
- /**
- * number of audio channels, only used for audio.
- * - encoding: unused
- * - decoding: Read by user.
- */
- int channels;
-
+#if FF_API_FRAME_PKT
/**
* size of the corresponding packet containing the compressed
* frame.
* It is set to a negative value if unknown.
* - encoding: unused
* - decoding: set by libavcodec, read by user.
+ * @deprecated use AV_CODEC_FLAG_COPY_OPAQUE to pass through arbitrary user
+ * data from packets to frames
*/
- int pkt_size;
-
-#if FF_API_FRAME_QP
- /**
- * QP table
- */
- attribute_deprecated
- int8_t *qscale_table;
- /**
- * QP store stride
- */
- attribute_deprecated
- int qstride;
-
- attribute_deprecated
- int qscale_type;
-
attribute_deprecated
- AVBufferRef *qp_table_buf;
+ int pkt_size;
#endif
+
/**
* For hwaccel-format frames, this should be a reference to the
* AVHWFramesContext describing the frame.
@@ -564,13 +740,18 @@ typedef struct AVFrame {
AVBufferRef *hw_frames_ctx;
/**
- * AVBufferRef for free use by the API user. FFmpeg will never check the
- * contents of the buffer ref. FFmpeg calls av_buffer_unref() on it when
- * the frame is unreferenced. av_frame_copy_props() calls create a new
- * reference with av_buffer_ref() for the target frame's opaque_ref field.
+ * Frame owner's private data.
+ *
+ * This field may be set by the code that allocates/owns the frame data.
+ * It is then not touched by any library functions, except:
+ * - a new reference to the underlying buffer is propagated by
+ * av_frame_copy_props() (and hence by av_frame_ref());
+ * - it is unreferenced in av_frame_unref();
+ * - on the caller's explicit request. E.g. libavcodec encoders/decoders
+ * will propagate a new reference to/from @ref AVPacket "AVPackets" if the
+ * caller sets @ref AV_CODEC_FLAG_COPY_OPAQUE.
*
- * This is unrelated to the opaque field, although it serves a similar
- * purpose.
+ * @see opaque the plain pointer analogue
*/
AVBufferRef *opaque_ref;
@@ -602,70 +783,18 @@ typedef struct AVFrame {
* for the target frame's private_ref field.
*/
AVBufferRef *private_ref;
-} AVFrame;
-#if FF_API_FRAME_GET_SET
-/**
- * Accessors for some AVFrame fields. These used to be provided for ABI
- * compatibility, and do not need to be used anymore.
- */
-attribute_deprecated
-int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame);
-attribute_deprecated
-void av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val);
-attribute_deprecated
-int64_t av_frame_get_pkt_duration (const AVFrame *frame);
-attribute_deprecated
-void av_frame_set_pkt_duration (AVFrame *frame, int64_t val);
-attribute_deprecated
-int64_t av_frame_get_pkt_pos (const AVFrame *frame);
-attribute_deprecated
-void av_frame_set_pkt_pos (AVFrame *frame, int64_t val);
-attribute_deprecated
-int64_t av_frame_get_channel_layout (const AVFrame *frame);
-attribute_deprecated
-void av_frame_set_channel_layout (AVFrame *frame, int64_t val);
-attribute_deprecated
-int av_frame_get_channels (const AVFrame *frame);
-attribute_deprecated
-void av_frame_set_channels (AVFrame *frame, int val);
-attribute_deprecated
-int av_frame_get_sample_rate (const AVFrame *frame);
-attribute_deprecated
-void av_frame_set_sample_rate (AVFrame *frame, int val);
-attribute_deprecated
-AVDictionary *av_frame_get_metadata (const AVFrame *frame);
-attribute_deprecated
-void av_frame_set_metadata (AVFrame *frame, AVDictionary *val);
-attribute_deprecated
-int av_frame_get_decode_error_flags (const AVFrame *frame);
-attribute_deprecated
-void av_frame_set_decode_error_flags (AVFrame *frame, int val);
-attribute_deprecated
-int av_frame_get_pkt_size(const AVFrame *frame);
-attribute_deprecated
-void av_frame_set_pkt_size(AVFrame *frame, int val);
-#if FF_API_FRAME_QP
-attribute_deprecated
-int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type);
-attribute_deprecated
-int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type);
-#endif
-attribute_deprecated
-enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame);
-attribute_deprecated
-void av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val);
-attribute_deprecated
-enum AVColorRange av_frame_get_color_range(const AVFrame *frame);
-attribute_deprecated
-void av_frame_set_color_range(AVFrame *frame, enum AVColorRange val);
-#endif
+ /**
+ * Channel layout of the audio data.
+ */
+ AVChannelLayout ch_layout;
+
+ /**
+ * Duration of the frame, in the same units as pts. 0 if unknown.
+ */
+ int64_t duration;
+} AVFrame;
-/**
- * Get the name of a colorspace.
- * @return a static string identifying the colorspace; can be NULL.
- */
-const char *av_get_colorspace_name(enum AVColorSpace val);
/**
* Allocate an AVFrame and set its fields to default values. The resulting
@@ -705,6 +834,19 @@ void av_frame_free(AVFrame **frame);
*/
int av_frame_ref(AVFrame *dst, const AVFrame *src);
+/**
+ * Ensure the destination frame refers to the same data described by the source
+ * frame, either by creating a new reference for each AVBufferRef from src if
+ * they differ from those in dst, by allocating new buffers and copying data if
+ * src is not reference counted, or by unrefencing it if src is empty.
+ *
+ * Frame properties on dst will be replaced by those from src.
+ *
+ * @return 0 on success, a negative AVERROR on error. On error, dst is
+ * unreferenced.
+ */
+int av_frame_replace(AVFrame *dst, const AVFrame *src);
+
/**
* Create a new frame that references the same data as src.
*
@@ -734,7 +876,7 @@ void av_frame_move_ref(AVFrame *dst, AVFrame *src);
* The following fields must be set on frame before calling this function:
* - format (pixel format for video, sample format for audio)
* - width and height for video
- * - nb_samples and channel_layout for audio
+ * - nb_samples and ch_layout for audio
*
* This function will fill AVFrame.data and AVFrame.buf arrays and, if
* necessary, allocate and fill AVFrame.extended_data and AVFrame.extended_buf.
@@ -771,7 +913,8 @@ int av_frame_is_writable(AVFrame *frame);
* Ensure that the frame data is writable, avoiding data copy if possible.
*
* Do nothing if the frame is writable, allocate new buffers and copy the data
- * if it is not.
+ * if it is not. Non-refcounted frames behave as non-writable, i.e. a copy
+ * is always made.
*
* @return 0 on success, a negative AVERROR on error.
*
@@ -806,12 +949,13 @@ int av_frame_copy_props(AVFrame *dst, const AVFrame *src);
/**
* Get the buffer reference a given data plane is stored in.
*
+ * @param frame the frame to get the plane's buffer from
* @param plane index of the data plane of interest in frame->extended_data.
*
* @return the buffer reference that contains the plane or NULL if the input
* frame is not valid.
*/
-AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane);
+AVBufferRef *av_frame_get_plane_buffer(const AVFrame *frame, int plane);
/**
* Add a new side data to a frame.
@@ -824,7 +968,7 @@ AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane);
*/
AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
enum AVFrameSideDataType type,
- int size);
+ size_t size);
/**
* Add a new side data to a frame from an existing AVBufferRef
@@ -850,8 +994,7 @@ AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
enum AVFrameSideDataType type);
/**
- * If side data of the supplied type exists in the frame, free it and remove it
- * from the frame.
+ * Remove and free all side data instances of the given type.
*/
void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type);
@@ -894,6 +1037,137 @@ int av_frame_apply_cropping(AVFrame *frame, int flags);
*/
const char *av_frame_side_data_name(enum AVFrameSideDataType type);
+/**
+ * @return side data descriptor corresponding to a given side data type, NULL
+ * when not available.
+ */
+const AVSideDataDescriptor *av_frame_side_data_desc(enum AVFrameSideDataType type);
+
+/**
+ * Free all side data entries and their contents, then zeroes out the
+ * values which the pointers are pointing to.
+ *
+ * @param sd pointer to array of side data to free. Will be set to NULL
+ * upon return.
+ * @param nb_sd pointer to an integer containing the number of entries in
+ * the array. Will be set to 0 upon return.
+ */
+void av_frame_side_data_free(AVFrameSideData ***sd, int *nb_sd);
+
+/**
+ * Remove existing entries before adding new ones.
+ */
+#define AV_FRAME_SIDE_DATA_FLAG_UNIQUE (1 << 0)
+/**
+ * Don't add a new entry if another of the same type exists.
+ * Applies only for side data types without the AV_SIDE_DATA_PROP_MULTI prop.
+ */
+#define AV_FRAME_SIDE_DATA_FLAG_REPLACE (1 << 1)
+
+/**
+ * Add new side data entry to an array.
+ *
+ * @param sd pointer to array of side data to which to add another entry,
+ * or to NULL in order to start a new array.
+ * @param nb_sd pointer to an integer containing the number of entries in
+ * the array.
+ * @param type type of the added side data
+ * @param size size of the side data
+ * @param flags Some combination of AV_FRAME_SIDE_DATA_FLAG_* flags, or 0.
+ *
+ * @return newly added side data on success, NULL on error.
+ * @note In case of AV_FRAME_SIDE_DATA_FLAG_UNIQUE being set, entries of
+ * matching AVFrameSideDataType will be removed before the addition
+ * is attempted.
+ * @note In case of AV_FRAME_SIDE_DATA_FLAG_REPLACE being set, if an
+ * entry of the same type already exists, it will be replaced instead.
+ */
+AVFrameSideData *av_frame_side_data_new(AVFrameSideData ***sd, int *nb_sd,
+ enum AVFrameSideDataType type,
+ size_t size, unsigned int flags);
+
+/**
+ * Add a new side data entry to an array from an existing AVBufferRef.
+ *
+ * @param sd pointer to array of side data to which to add another entry,
+ * or to NULL in order to start a new array.
+ * @param nb_sd pointer to an integer containing the number of entries in
+ * the array.
+ * @param type type of the added side data
+ * @param buf Pointer to AVBufferRef to add to the array. On success,
+ * the function takes ownership of the AVBufferRef and *buf is
+ * set to NULL, unless AV_FRAME_SIDE_DATA_FLAG_NEW_REF is set
+ * in which case the ownership will remain with the caller.
+ * @param flags Some combination of AV_FRAME_SIDE_DATA_FLAG_* flags, or 0.
+ *
+ * @return newly added side data on success, NULL on error.
+ * @note In case of AV_FRAME_SIDE_DATA_FLAG_UNIQUE being set, entries of
+ * matching AVFrameSideDataType will be removed before the addition
+ * is attempted.
+ * @note In case of AV_FRAME_SIDE_DATA_FLAG_REPLACE being set, if an
+ * entry of the same type already exists, it will be replaced instead.
+ *
+ */
+AVFrameSideData *av_frame_side_data_add(AVFrameSideData ***sd, int *nb_sd,
+ enum AVFrameSideDataType type,
+ AVBufferRef **buf, unsigned int flags);
+
+/**
+ * Add a new side data entry to an array based on existing side data, taking
+ * a reference towards the contained AVBufferRef.
+ *
+ * @param sd pointer to array of side data to which to add another entry,
+ * or to NULL in order to start a new array.
+ * @param nb_sd pointer to an integer containing the number of entries in
+ * the array.
+ * @param src side data to be cloned, with a new reference utilized
+ * for the buffer.
+ * @param flags Some combination of AV_FRAME_SIDE_DATA_FLAG_* flags, or 0.
+ *
+ * @return negative error code on failure, >=0 on success.
+ * @note In case of AV_FRAME_SIDE_DATA_FLAG_UNIQUE being set, entries of
+ * matching AVFrameSideDataType will be removed before the addition
+ * is attempted.
+ * @note In case of AV_FRAME_SIDE_DATA_FLAG_REPLACE being set, if an
+ * entry of the same type already exists, it will be replaced instead.
+ */
+int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd,
+ const AVFrameSideData *src, unsigned int flags);
+
+/**
+ * Get a side data entry of a specific type from an array.
+ *
+ * @param sd array of side data.
+ * @param nb_sd integer containing the number of entries in the array.
+ * @param type type of side data to be queried
+ *
+ * @return a pointer to the side data of a given type on success, NULL if there
+ * is no side data with such type in this set.
+ */
+const AVFrameSideData *av_frame_side_data_get_c(const AVFrameSideData * const *sd,
+ const int nb_sd,
+ enum AVFrameSideDataType type);
+
+/**
+ * Wrapper around av_frame_side_data_get_c() to workaround the limitation
+ * that for any type T the conversion from T * const * to const T * const *
+ * is not performed automatically in C.
+ * @see av_frame_side_data_get_c()
+ */
+static inline
+const AVFrameSideData *av_frame_side_data_get(AVFrameSideData * const *sd,
+ const int nb_sd,
+ enum AVFrameSideDataType type)
+{
+ return av_frame_side_data_get_c((const AVFrameSideData * const *)sd,
+ nb_sd, type);
+}
+
+/**
+ * Remove and free all side data instances of the given type from an array.
+ */
+void av_frame_side_data_remove(AVFrameSideData ***sd, int *nb_sd,
+ enum AVFrameSideDataType type);
/**
* @}
*/
diff --git a/ffmpeg/include/libavutil/hash.h b/ffmpeg/include/libavutil/hash.h
index 7693e6bf..94151ded 100644
--- a/ffmpeg/include/libavutil/hash.h
+++ b/ffmpeg/include/libavutil/hash.h
@@ -27,10 +27,9 @@
#ifndef AVUTIL_HASH_H
#define AVUTIL_HASH_H
+#include
#include
-#include "version.h"
-
/**
* @defgroup lavu_hash Hash Functions
* @ingroup lavu_crypto
@@ -181,11 +180,7 @@ void av_hash_init(struct AVHashContext *ctx);
* @param[in] src Data to be added to the hash context
* @param[in] len Size of the additional data
*/
-#if FF_API_CRYPTO_SIZE_T
-void av_hash_update(struct AVHashContext *ctx, const uint8_t *src, int len);
-#else
void av_hash_update(struct AVHashContext *ctx, const uint8_t *src, size_t len);
-#endif
/**
* Finalize a hash context and compute the actual hash value.
diff --git a/ffmpeg/include/libavutil/hdr_dynamic_metadata.h b/ffmpeg/include/libavutil/hdr_dynamic_metadata.h
new file mode 100644
index 00000000..5100ed6f
--- /dev/null
+++ b/ffmpeg/include/libavutil/hdr_dynamic_metadata.h
@@ -0,0 +1,376 @@
+/*
+ * Copyright (c) 2018 Mohammad Izadi
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_HDR_DYNAMIC_METADATA_H
+#define AVUTIL_HDR_DYNAMIC_METADATA_H
+
+#include "frame.h"
+#include "rational.h"
+
+/**
+ * Option for overlapping elliptical pixel selectors in an image.
+ */
+enum AVHDRPlusOverlapProcessOption {
+ AV_HDR_PLUS_OVERLAP_PROCESS_WEIGHTED_AVERAGING = 0,
+ AV_HDR_PLUS_OVERLAP_PROCESS_LAYERING = 1,
+};
+
+/**
+ * Represents the percentile at a specific percentage in
+ * a distribution.
+ */
+typedef struct AVHDRPlusPercentile {
+ /**
+ * The percentage value corresponding to a specific percentile linearized
+ * RGB value in the processing window in the scene. The value shall be in
+ * the range of 0 to100, inclusive.
+ */
+ uint8_t percentage;
+
+ /**
+ * The linearized maxRGB value at a specific percentile in the processing
+ * window in the scene. The value shall be in the range of 0 to 1, inclusive
+ * and in multiples of 0.00001.
+ */
+ AVRational percentile;
+} AVHDRPlusPercentile;
+
+/**
+ * Color transform parameters at a processing window in a dynamic metadata for
+ * SMPTE 2094-40.
+ */
+typedef struct AVHDRPlusColorTransformParams {
+ /**
+ * The relative x coordinate of the top left pixel of the processing
+ * window. The value shall be in the range of 0 and 1, inclusive and
+ * in multiples of 1/(width of Picture - 1). The value 1 corresponds
+ * to the absolute coordinate of width of Picture - 1. The value for
+ * first processing window shall be 0.
+ */
+ AVRational window_upper_left_corner_x;
+
+ /**
+ * The relative y coordinate of the top left pixel of the processing
+ * window. The value shall be in the range of 0 and 1, inclusive and
+ * in multiples of 1/(height of Picture - 1). The value 1 corresponds
+ * to the absolute coordinate of height of Picture - 1. The value for
+ * first processing window shall be 0.
+ */
+ AVRational window_upper_left_corner_y;
+
+ /**
+ * The relative x coordinate of the bottom right pixel of the processing
+ * window. The value shall be in the range of 0 and 1, inclusive and
+ * in multiples of 1/(width of Picture - 1). The value 1 corresponds
+ * to the absolute coordinate of width of Picture - 1. The value for
+ * first processing window shall be 1.
+ */
+ AVRational window_lower_right_corner_x;
+
+ /**
+ * The relative y coordinate of the bottom right pixel of the processing
+ * window. The value shall be in the range of 0 and 1, inclusive and
+ * in multiples of 1/(height of Picture - 1). The value 1 corresponds
+ * to the absolute coordinate of height of Picture - 1. The value for
+ * first processing window shall be 1.
+ */
+ AVRational window_lower_right_corner_y;
+
+ /**
+ * The x coordinate of the center position of the concentric internal and
+ * external ellipses of the elliptical pixel selector in the processing
+ * window. The value shall be in the range of 0 to (width of Picture - 1),
+ * inclusive and in multiples of 1 pixel.
+ */
+ uint16_t center_of_ellipse_x;
+
+ /**
+ * The y coordinate of the center position of the concentric internal and
+ * external ellipses of the elliptical pixel selector in the processing
+ * window. The value shall be in the range of 0 to (height of Picture - 1),
+ * inclusive and in multiples of 1 pixel.
+ */
+ uint16_t center_of_ellipse_y;
+
+ /**
+ * The clockwise rotation angle in degree of arc with respect to the
+ * positive direction of the x-axis of the concentric internal and external
+ * ellipses of the elliptical pixel selector in the processing window. The
+ * value shall be in the range of 0 to 180, inclusive and in multiples of 1.
+ */
+ uint8_t rotation_angle;
+
+ /**
+ * The semi-major axis value of the internal ellipse of the elliptical pixel
+ * selector in amount of pixels in the processing window. The value shall be
+ * in the range of 1 to 65535, inclusive and in multiples of 1 pixel.
+ */
+ uint16_t semimajor_axis_internal_ellipse;
+
+ /**
+ * The semi-major axis value of the external ellipse of the elliptical pixel
+ * selector in amount of pixels in the processing window. The value
+ * shall not be less than semimajor_axis_internal_ellipse of the current
+ * processing window. The value shall be in the range of 1 to 65535,
+ * inclusive and in multiples of 1 pixel.
+ */
+ uint16_t semimajor_axis_external_ellipse;
+
+ /**
+ * The semi-minor axis value of the external ellipse of the elliptical pixel
+ * selector in amount of pixels in the processing window. The value shall be
+ * in the range of 1 to 65535, inclusive and in multiples of 1 pixel.
+ */
+ uint16_t semiminor_axis_external_ellipse;
+
+ /**
+ * Overlap process option indicates one of the two methods of combining
+ * rendered pixels in the processing window in an image with at least one
+ * elliptical pixel selector. For overlapping elliptical pixel selectors
+ * in an image, overlap_process_option shall have the same value.
+ */
+ enum AVHDRPlusOverlapProcessOption overlap_process_option;
+
+ /**
+ * The maximum of the color components of linearized RGB values in the
+ * processing window in the scene. The values should be in the range of 0 to
+ * 1, inclusive and in multiples of 0.00001. maxscl[ 0 ], maxscl[ 1 ], and
+ * maxscl[ 2 ] are corresponding to R, G, B color components respectively.
+ */
+ AVRational maxscl[3];
+
+ /**
+ * The average of linearized maxRGB values in the processing window in the
+ * scene. The value should be in the range of 0 to 1, inclusive and in
+ * multiples of 0.00001.
+ */
+ AVRational average_maxrgb;
+
+ /**
+ * The number of linearized maxRGB values at given percentiles in the
+ * processing window in the scene. The maximum value shall be 15.
+ */
+ uint8_t num_distribution_maxrgb_percentiles;
+
+ /**
+ * The linearized maxRGB values at given percentiles in the
+ * processing window in the scene.
+ */
+ AVHDRPlusPercentile distribution_maxrgb[15];
+
+ /**
+ * The fraction of selected pixels in the image that contains the brightest
+ * pixel in the scene. The value shall be in the range of 0 to 1, inclusive
+ * and in multiples of 0.001.
+ */
+ AVRational fraction_bright_pixels;
+
+ /**
+ * This flag indicates that the metadata for the tone mapping function in
+ * the processing window is present (for value of 1).
+ */
+ uint8_t tone_mapping_flag;
+
+ /**
+ * The x coordinate of the separation point between the linear part and the
+ * curved part of the tone mapping function. The value shall be in the range
+ * of 0 to 1, excluding 0 and in multiples of 1/4095.
+ */
+ AVRational knee_point_x;
+
+ /**
+ * The y coordinate of the separation point between the linear part and the
+ * curved part of the tone mapping function. The value shall be in the range
+ * of 0 to 1, excluding 0 and in multiples of 1/4095.
+ */
+ AVRational knee_point_y;
+
+ /**
+ * The number of the intermediate anchor parameters of the tone mapping
+ * function in the processing window. The maximum value shall be 15.
+ */
+ uint8_t num_bezier_curve_anchors;
+
+ /**
+ * The intermediate anchor parameters of the tone mapping function in the
+ * processing window in the scene. The values should be in the range of 0
+ * to 1, inclusive and in multiples of 1/1023.
+ */
+ AVRational bezier_curve_anchors[15];
+
+ /**
+ * This flag shall be equal to 0 in bitstreams conforming to this version of
+ * this Specification. Other values are reserved for future use.
+ */
+ uint8_t color_saturation_mapping_flag;
+
+ /**
+ * The color saturation gain in the processing window in the scene. The
+ * value shall be in the range of 0 to 63/8, inclusive and in multiples of
+ * 1/8. The default value shall be 1.
+ */
+ AVRational color_saturation_weight;
+} AVHDRPlusColorTransformParams;
+
+/**
+ * This struct represents dynamic metadata for color volume transform -
+ * application 4 of SMPTE 2094-40:2016 standard.
+ *
+ * To be used as payload of a AVFrameSideData or AVPacketSideData with the
+ * appropriate type.
+ *
+ * @note The struct should be allocated with
+ * av_dynamic_hdr_plus_alloc() and its size is not a part of
+ * the public ABI.
+ */
+typedef struct AVDynamicHDRPlus {
+ /**
+ * Country code by Rec. ITU-T T.35 Annex A. The value shall be 0xB5.
+ */
+ uint8_t itu_t_t35_country_code;
+
+ /**
+ * Application version in the application defining document in ST-2094
+ * suite. The value shall be set to 0.
+ */
+ uint8_t application_version;
+
+ /**
+ * The number of processing windows. The value shall be in the range
+ * of 1 to 3, inclusive.
+ */
+ uint8_t num_windows;
+
+ /**
+ * The color transform parameters for every processing window.
+ */
+ AVHDRPlusColorTransformParams params[3];
+
+ /**
+ * The nominal maximum display luminance of the targeted system display,
+ * in units of 0.0001 candelas per square metre. The value shall be in
+ * the range of 0 to 10000, inclusive.
+ */
+ AVRational targeted_system_display_maximum_luminance;
+
+ /**
+ * This flag shall be equal to 0 in bit streams conforming to this version
+ * of this Specification. The value 1 is reserved for future use.
+ */
+ uint8_t targeted_system_display_actual_peak_luminance_flag;
+
+ /**
+ * The number of rows in the targeted system_display_actual_peak_luminance
+ * array. The value shall be in the range of 2 to 25, inclusive.
+ */
+ uint8_t num_rows_targeted_system_display_actual_peak_luminance;
+
+ /**
+ * The number of columns in the
+ * targeted_system_display_actual_peak_luminance array. The value shall be
+ * in the range of 2 to 25, inclusive.
+ */
+ uint8_t num_cols_targeted_system_display_actual_peak_luminance;
+
+ /**
+ * The normalized actual peak luminance of the targeted system display. The
+ * values should be in the range of 0 to 1, inclusive and in multiples of
+ * 1/15.
+ */
+ AVRational targeted_system_display_actual_peak_luminance[25][25];
+
+ /**
+ * This flag shall be equal to 0 in bitstreams conforming to this version of
+ * this Specification. The value 1 is reserved for future use.
+ */
+ uint8_t mastering_display_actual_peak_luminance_flag;
+
+ /**
+ * The number of rows in the mastering_display_actual_peak_luminance array.
+ * The value shall be in the range of 2 to 25, inclusive.
+ */
+ uint8_t num_rows_mastering_display_actual_peak_luminance;
+
+ /**
+ * The number of columns in the mastering_display_actual_peak_luminance
+ * array. The value shall be in the range of 2 to 25, inclusive.
+ */
+ uint8_t num_cols_mastering_display_actual_peak_luminance;
+
+ /**
+ * The normalized actual peak luminance of the mastering display used for
+ * mastering the image essence. The values should be in the range of 0 to 1,
+ * inclusive and in multiples of 1/15.
+ */
+ AVRational mastering_display_actual_peak_luminance[25][25];
+} AVDynamicHDRPlus;
+
+/**
+ * Allocate an AVDynamicHDRPlus structure and set its fields to
+ * default values. The resulting struct can be freed using av_freep().
+ *
+ * @return An AVDynamicHDRPlus filled with default values or NULL
+ * on failure.
+ */
+AVDynamicHDRPlus *av_dynamic_hdr_plus_alloc(size_t *size);
+
+/**
+ * Allocate a complete AVDynamicHDRPlus and add it to the frame.
+ * @param frame The frame which side data is added to.
+ *
+ * @return The AVDynamicHDRPlus structure to be filled by caller or NULL
+ * on failure.
+ */
+AVDynamicHDRPlus *av_dynamic_hdr_plus_create_side_data(AVFrame *frame);
+
+/**
+ * Parse the user data registered ITU-T T.35 to AVbuffer (AVDynamicHDRPlus).
+ * The T.35 buffer must begin with the application mode, skipping the
+ * country code, terminal provider codes, and application identifier.
+ * @param s A pointer containing the decoded AVDynamicHDRPlus structure.
+ * @param data The byte array containing the raw ITU-T T.35 data.
+ * @param size Size of the data array in bytes.
+ *
+ * @return >= 0 on success. Otherwise, returns the appropriate AVERROR.
+ */
+int av_dynamic_hdr_plus_from_t35(AVDynamicHDRPlus *s, const uint8_t *data,
+ size_t size);
+
+#define AV_HDR_PLUS_MAX_PAYLOAD_SIZE 907
+
+/**
+ * Serialize dynamic HDR10+ metadata to a user data registered ITU-T T.35 buffer,
+ * excluding the first 48 bytes of the header, and beginning with the application mode.
+ * @param s A pointer containing the decoded AVDynamicHDRPlus structure.
+ * @param[in,out] data A pointer to pointer to a byte buffer to be filled with the
+ * serialized metadata.
+ * If *data is NULL, a buffer be will be allocated and a pointer to
+ * it stored in its place. The caller assumes ownership of the buffer.
+ * May be NULL, in which case the function will only store the
+ * required buffer size in *size.
+ * @param[in,out] size A pointer to a size to be set to the returned buffer's size.
+ * If *data is not NULL, *size must contain the size of the input
+ * buffer. May be NULL only if *data is NULL.
+ *
+ * @return >= 0 on success. Otherwise, returns the appropriate AVERROR.
+ */
+int av_dynamic_hdr_plus_to_t35(const AVDynamicHDRPlus *s, uint8_t **data, size_t *size);
+
+#endif /* AVUTIL_HDR_DYNAMIC_METADATA_H */
diff --git a/ffmpeg/include/libavutil/hdr_dynamic_vivid_metadata.h b/ffmpeg/include/libavutil/hdr_dynamic_vivid_metadata.h
new file mode 100644
index 00000000..4524a815
--- /dev/null
+++ b/ffmpeg/include/libavutil/hdr_dynamic_vivid_metadata.h
@@ -0,0 +1,346 @@
+/*
+ * Copyright (c) 2021 Limin Wang
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_HDR_DYNAMIC_VIVID_METADATA_H
+#define AVUTIL_HDR_DYNAMIC_VIVID_METADATA_H
+
+#include "frame.h"
+#include "rational.h"
+
+/**
+ * HDR Vivid three spline params.
+ */
+typedef struct AVHDRVivid3SplineParams {
+ /**
+ * The mode of three Spline. the value shall be in the range
+ * of 0 to 3, inclusive.
+ */
+ int th_mode;
+
+ /**
+ * three_Spline_TH_enable_MB is in the range of 0.0 to 1.0, inclusive
+ * and in multiples of 1.0/255.
+ *
+ */
+ AVRational th_enable_mb;
+
+ /**
+ * 3Spline_TH_enable of three Spline.
+ * The value shall be in the range of 0.0 to 1.0, inclusive.
+ * and in multiples of 1.0/4095.
+ */
+ AVRational th_enable;
+
+ /**
+ * 3Spline_TH_Delta1 of three Spline.
+ * The value shall be in the range of 0.0 to 0.25, inclusive,
+ * and in multiples of 0.25/1023.
+ */
+ AVRational th_delta1;
+
+ /**
+ * 3Spline_TH_Delta2 of three Spline.
+ * The value shall be in the range of 0.0 to 0.25, inclusive,
+ * and in multiples of 0.25/1023.
+ */
+ AVRational th_delta2;
+
+ /**
+ * 3Spline_enable_Strength of three Spline.
+ * The value shall be in the range of 0.0 to 1.0, inclusive,
+ * and in multiples of 1.0/255.
+ */
+ AVRational enable_strength;
+} AVHDRVivid3SplineParams;
+
+/**
+ * Color tone mapping parameters at a processing window in a dynamic metadata for
+ * CUVA 005.1:2021.
+ */
+typedef struct AVHDRVividColorToneMappingParams {
+ /**
+ * The nominal maximum display luminance of the targeted system display,
+ * in multiples of 1.0/4095 candelas per square metre. The value shall be in
+ * the range of 0.0 to 1.0, inclusive.
+ */
+ AVRational targeted_system_display_maximum_luminance;
+
+ /**
+ * This flag indicates that transfer the base paramter(for value of 1)
+ */
+ int base_enable_flag;
+
+ /**
+ * base_param_m_p in the base parameter,
+ * in multiples of 1.0/16383. The value shall be in
+ * the range of 0.0 to 1.0, inclusive.
+ */
+ AVRational base_param_m_p;
+
+ /**
+ * base_param_m_m in the base parameter,
+ * in multiples of 1.0/10. The value shall be in
+ * the range of 0.0 to 6.3, inclusive.
+ */
+ AVRational base_param_m_m;
+
+ /**
+ * base_param_m_a in the base parameter,
+ * in multiples of 1.0/1023. The value shall be in
+ * the range of 0.0 to 1.0 inclusive.
+ */
+ AVRational base_param_m_a;
+
+ /**
+ * base_param_m_b in the base parameter,
+ * in multiples of 1/1023. The value shall be in
+ * the range of 0.0 to 1.0, inclusive.
+ */
+ AVRational base_param_m_b;
+
+ /**
+ * base_param_m_n in the base parameter,
+ * in multiples of 1.0/10. The value shall be in
+ * the range of 0.0 to 6.3, inclusive.
+ */
+ AVRational base_param_m_n;
+
+ /**
+ * indicates k1_0 in the base parameter,
+ * base_param_k1 <= 1: k1_0 = base_param_k1
+ * base_param_k1 > 1: reserved
+ */
+ int base_param_k1;
+
+ /**
+ * indicates k2_0 in the base parameter,
+ * base_param_k2 <= 1: k2_0 = base_param_k2
+ * base_param_k2 > 1: reserved
+ */
+ int base_param_k2;
+
+ /**
+ * indicates k3_0 in the base parameter,
+ * base_param_k3 == 1: k3_0 = base_param_k3
+ * base_param_k3 == 2: k3_0 = maximum_maxrgb
+ * base_param_k3 > 2: reserved
+ */
+ int base_param_k3;
+
+ /**
+ * This flag indicates that delta mode of base paramter(for value of 1)
+ */
+ int base_param_Delta_enable_mode;
+
+ /**
+ * base_param_Delta in the base parameter,
+ * in multiples of 1.0/127. The value shall be in
+ * the range of 0.0 to 1.0, inclusive.
+ */
+ AVRational base_param_Delta;
+
+ /**
+ * indicates 3Spline_enable_flag in the base parameter,
+ * This flag indicates that transfer three Spline of base paramter(for value of 1)
+ */
+ int three_Spline_enable_flag;
+
+ /**
+ * The number of three Spline. The value shall be in the range
+ * of 1 to 2, inclusive.
+ */
+ int three_Spline_num;
+
+#if FF_API_HDR_VIVID_THREE_SPLINE
+ /**
+ * The mode of three Spline. the value shall be in the range
+ * of 0 to 3, inclusive.
+ * @deprecated Use three_spline instead
+ */
+ attribute_deprecated
+ int three_Spline_TH_mode;
+
+ /**
+ * three_Spline_TH_enable_MB is in the range of 0.0 to 1.0, inclusive
+ * and in multiples of 1.0/255.
+ * @deprecated Use three_spline instead
+ */
+ attribute_deprecated
+ AVRational three_Spline_TH_enable_MB;
+
+ /**
+ * 3Spline_TH_enable of three Spline.
+ * The value shall be in the range of 0.0 to 1.0, inclusive.
+ * and in multiples of 1.0/4095.
+ * @deprecated Use three_spline instead
+ */
+ attribute_deprecated
+ AVRational three_Spline_TH_enable;
+
+ /**
+ * 3Spline_TH_Delta1 of three Spline.
+ * The value shall be in the range of 0.0 to 0.25, inclusive,
+ * and in multiples of 0.25/1023.
+ * @deprecated Use three_spline instead
+ */
+ attribute_deprecated
+ AVRational three_Spline_TH_Delta1;
+
+ /**
+ * 3Spline_TH_Delta2 of three Spline.
+ * The value shall be in the range of 0.0 to 0.25, inclusive,
+ * and in multiples of 0.25/1023.
+ * @deprecated Use three_spline instead
+ */
+ attribute_deprecated
+ AVRational three_Spline_TH_Delta2;
+
+ /**
+ * 3Spline_enable_Strength of three Spline.
+ * The value shall be in the range of 0.0 to 1.0, inclusive,
+ * and in multiples of 1.0/255.
+ * @deprecated Use three_spline instead
+ */
+ attribute_deprecated
+ AVRational three_Spline_enable_Strength;
+#endif
+
+ AVHDRVivid3SplineParams three_spline[2];
+} AVHDRVividColorToneMappingParams;
+
+
+/**
+ * Color transform parameters at a processing window in a dynamic metadata for
+ * CUVA 005.1:2021.
+ */
+typedef struct AVHDRVividColorTransformParams {
+ /**
+ * Indicates the minimum brightness of the displayed content.
+ * The values should be in the range of 0.0 to 1.0,
+ * inclusive and in multiples of 1/4095.
+ */
+ AVRational minimum_maxrgb;
+
+ /**
+ * Indicates the average brightness of the displayed content.
+ * The values should be in the range of 0.0 to 1.0,
+ * inclusive and in multiples of 1/4095.
+ */
+ AVRational average_maxrgb;
+
+ /**
+ * Indicates the variance brightness of the displayed content.
+ * The values should be in the range of 0.0 to 1.0,
+ * inclusive and in multiples of 1/4095.
+ */
+ AVRational variance_maxrgb;
+
+ /**
+ * Indicates the maximum brightness of the displayed content.
+ * The values should be in the range of 0.0 to 1.0, inclusive
+ * and in multiples of 1/4095.
+ */
+ AVRational maximum_maxrgb;
+
+ /**
+ * This flag indicates that the metadata for the tone mapping function in
+ * the processing window is present (for value of 1).
+ */
+ int tone_mapping_mode_flag;
+
+ /**
+ * The number of tone mapping param. The value shall be in the range
+ * of 1 to 2, inclusive.
+ */
+ int tone_mapping_param_num;
+
+ /**
+ * The color tone mapping parameters.
+ */
+ AVHDRVividColorToneMappingParams tm_params[2];
+
+ /**
+ * This flag indicates that the metadata for the color saturation mapping in
+ * the processing window is present (for value of 1).
+ */
+ int color_saturation_mapping_flag;
+
+ /**
+ * The number of color saturation param. The value shall be in the range
+ * of 0 to 7, inclusive.
+ */
+ int color_saturation_num;
+
+ /**
+ * Indicates the color correction strength parameter.
+ * The values should be in the range of 0.0 to 2.0, inclusive
+ * and in multiples of 1/128.
+ */
+ AVRational color_saturation_gain[8];
+} AVHDRVividColorTransformParams;
+
+/**
+ * This struct represents dynamic metadata for color volume transform -
+ * CUVA 005.1:2021 standard
+ *
+ * To be used as payload of a AVFrameSideData or AVPacketSideData with the
+ * appropriate type.
+ *
+ * @note The struct should be allocated with
+ * av_dynamic_hdr_vivid_alloc() and its size is not a part of
+ * the public ABI.
+ */
+typedef struct AVDynamicHDRVivid {
+ /**
+ * The system start code. The value shall be set to 0x01.
+ */
+ uint8_t system_start_code;
+
+ /**
+ * The number of processing windows. The value shall be set to 0x01
+ * if the system_start_code is 0x01.
+ */
+ uint8_t num_windows;
+
+ /**
+ * The color transform parameters for every processing window.
+ */
+ AVHDRVividColorTransformParams params[3];
+} AVDynamicHDRVivid;
+
+/**
+ * Allocate an AVDynamicHDRVivid structure and set its fields to
+ * default values. The resulting struct can be freed using av_freep().
+ *
+ * @return An AVDynamicHDRVivid filled with default values or NULL
+ * on failure.
+ */
+AVDynamicHDRVivid *av_dynamic_hdr_vivid_alloc(size_t *size);
+
+/**
+ * Allocate a complete AVDynamicHDRVivid and add it to the frame.
+ * @param frame The frame which side data is added to.
+ *
+ * @return The AVDynamicHDRVivid structure to be filled by caller or NULL
+ * on failure.
+ */
+AVDynamicHDRVivid *av_dynamic_hdr_vivid_create_side_data(AVFrame *frame);
+
+#endif /* AVUTIL_HDR_DYNAMIC_VIVID_METADATA_H */
diff --git a/ffmpeg/include/libavutil/hmac.h b/ffmpeg/include/libavutil/hmac.h
index 412e9507..ca4da6a6 100644
--- a/ffmpeg/include/libavutil/hmac.h
+++ b/ffmpeg/include/libavutil/hmac.h
@@ -23,7 +23,6 @@
#include
-#include "version.h"
/**
* @defgroup lavu_hmac HMAC
* @ingroup lavu_crypto
diff --git a/ffmpeg/include/libavutil/hwcontext.h b/ffmpeg/include/libavutil/hwcontext.h
index f5a4b623..bac30deb 100644
--- a/ffmpeg/include/libavutil/hwcontext.h
+++ b/ffmpeg/include/libavutil/hwcontext.h
@@ -36,10 +36,10 @@ enum AVHWDeviceType {
AV_HWDEVICE_TYPE_DRM,
AV_HWDEVICE_TYPE_OPENCL,
AV_HWDEVICE_TYPE_MEDIACODEC,
+ AV_HWDEVICE_TYPE_VULKAN,
+ AV_HWDEVICE_TYPE_D3D12VA,
};
-typedef struct AVHWDeviceInternal AVHWDeviceInternal;
-
/**
* This struct aggregates all the (hardware/vendor-specific) "high-level" state,
* i.e. state that is not tied to a concrete processing configuration.
@@ -63,12 +63,6 @@ typedef struct AVHWDeviceContext {
*/
const AVClass *av_class;
- /**
- * Private data used internally by libavutil. Must not be accessed in any
- * way by the caller.
- */
- AVHWDeviceInternal *internal;
-
/**
* This field identifies the underlying API used for hardware access.
*
@@ -108,8 +102,6 @@ typedef struct AVHWDeviceContext {
void *user_opaque;
} AVHWDeviceContext;
-typedef struct AVHWFramesInternal AVHWFramesInternal;
-
/**
* This struct describes a set or pool of "hardware" frames (i.e. those with
* data not located in normal system memory). All the frames in the pool are
@@ -126,12 +118,6 @@ typedef struct AVHWFramesContext {
*/
const AVClass *av_class;
- /**
- * Private data used internally by libavutil. Must not be accessed in any
- * way by the caller.
- */
- AVHWFramesInternal *internal;
-
/**
* A reference to the parent AVHWDeviceContext. This reference is owned and
* managed by the enclosing AVHWFramesContext, but the caller may derive
@@ -151,9 +137,12 @@ typedef struct AVHWFramesContext {
* The format-specific data, allocated and freed automatically along with
* this context.
*
- * Should be cast by the user to the format-specific context defined in the
- * corresponding header (hwframe_*.h) and filled as described in the
- * documentation before calling av_hwframe_ctx_init().
+ * The user shall ignore this field if the corresponding format-specific
+ * header (hwcontext_*.h) does not define a context to be used as
+ * AVHWFramesContext.hwctx.
+ *
+ * Otherwise, it should be cast by the user to said context and filled
+ * as described in the documentation before calling av_hwframe_ctx_init().
*
* After any frames using this context are created, the contents of this
* struct should not be modified by the caller.
@@ -248,7 +237,7 @@ const char *av_hwdevice_get_type_name(enum AVHWDeviceType type);
/**
* Iterate over supported device types.
*
- * @param type AV_HWDEVICE_TYPE_NONE initially, then the previous type
+ * @param prev AV_HWDEVICE_TYPE_NONE initially, then the previous type
* returned by this function in subsequent iterations.
* @return The next usable device type from enum AVHWDeviceType, or
* AV_HWDEVICE_TYPE_NONE if there are no more.
@@ -327,6 +316,26 @@ int av_hwdevice_ctx_create_derived(AVBufferRef **dst_ctx,
enum AVHWDeviceType type,
AVBufferRef *src_ctx, int flags);
+/**
+ * Create a new device of the specified type from an existing device.
+ *
+ * This function performs the same action as av_hwdevice_ctx_create_derived,
+ * however, it is able to set options for the new device to be derived.
+ *
+ * @param dst_ctx On success, a reference to the newly-created
+ * AVHWDeviceContext.
+ * @param type The type of the new device to create.
+ * @param src_ctx A reference to an existing AVHWDeviceContext which will be
+ * used to create the new device.
+ * @param options Options for the new device to create, same format as in
+ * av_hwdevice_ctx_create.
+ * @param flags Currently unused; should be set to zero.
+ * @return Zero on success, a negative AVERROR code on failure.
+ */
+int av_hwdevice_ctx_create_derived_opts(AVBufferRef **dst_ctx,
+ enum AVHWDeviceType type,
+ AVBufferRef *src_ctx,
+ AVDictionary *options, int flags);
/**
* Allocate an AVHWFramesContext tied to a given device context.
@@ -550,6 +559,10 @@ enum {
* possible with the given arguments and hwframe setup, while other return
* values indicate that it failed somehow.
*
+ * On failure, the destination frame will be left blank, except for the
+ * hw_frames_ctx/format fields thay may have been set by the caller - those will
+ * be preserved as they were.
+ *
* @param dst Destination frame, to contain the mapping.
* @param src Source frame, to be mapped.
* @param flags Some combination of AV_HWFRAME_MAP_* flags.
@@ -566,6 +579,7 @@ int av_hwframe_map(AVFrame *dst, const AVFrame *src, int flags);
*
* @param derived_frame_ctx On success, a reference to the newly created
* AVHWFramesContext.
+ * @param format The AVPixelFormat for the derived context.
* @param derived_device_ctx A reference to the device to create the new
* AVHWFramesContext on.
* @param source_frame_ctx A reference to an existing AVHWFramesContext
diff --git a/ffmpeg/include/libavutil/hwcontext_cuda.h b/ffmpeg/include/libavutil/hwcontext_cuda.h
index 81a0552c..cbad434f 100644
--- a/ffmpeg/include/libavutil/hwcontext_cuda.h
+++ b/ffmpeg/include/libavutil/hwcontext_cuda.h
@@ -49,4 +49,26 @@ typedef struct AVCUDADeviceContext {
* AVHWFramesContext.hwctx is currently not used
*/
+/**
+ * @defgroup hwcontext_cuda Device context creation flags
+ *
+ * Flags for av_hwdevice_ctx_create.
+ *
+ * @{
+ */
+
+/**
+ * Use primary device context instead of creating a new one.
+ */
+#define AV_CUDA_USE_PRIMARY_CONTEXT (1 << 0)
+
+/**
+ * Use current device context instead of creating a new one.
+ */
+#define AV_CUDA_USE_CURRENT_CONTEXT (1 << 1)
+
+/**
+ * @}
+ */
+
#endif /* AVUTIL_HWCONTEXT_CUDA_H */
diff --git a/ffmpeg/include/libavutil/hwcontext_d3d11va.h b/ffmpeg/include/libavutil/hwcontext_d3d11va.h
index 9f91e9b1..77d2d72f 100644
--- a/ffmpeg/include/libavutil/hwcontext_d3d11va.h
+++ b/ffmpeg/include/libavutil/hwcontext_d3d11va.h
@@ -164,6 +164,15 @@ typedef struct AVD3D11VAFramesContext {
* This field is ignored/invalid if a user-allocated texture is provided.
*/
UINT MiscFlags;
+
+ /**
+ * In case if texture structure member above is not NULL contains the same texture
+ * pointer for all elements and different indexes into the array texture.
+ * In case if texture structure member above is NULL, all elements contains
+ * pointers to separate non-array textures and 0 indexes.
+ * This field is ignored/invalid if a user-allocated texture is provided.
+ */
+ AVD3D11FrameDescriptor *texture_infos;
} AVD3D11VAFramesContext;
#endif /* AVUTIL_HWCONTEXT_D3D11VA_H */
diff --git a/ffmpeg/include/libavutil/hwcontext_d3d12va.h b/ffmpeg/include/libavutil/hwcontext_d3d12va.h
new file mode 100644
index 00000000..212a6a61
--- /dev/null
+++ b/ffmpeg/include/libavutil/hwcontext_d3d12va.h
@@ -0,0 +1,142 @@
+/*
+ * Direct3D 12 HW acceleration.
+ *
+ * copyright (c) 2022-2023 Wu Jianhua
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_HWCONTEXT_D3D12VA_H
+#define AVUTIL_HWCONTEXT_D3D12VA_H
+
+/**
+ * @file
+ * An API-specific header for AV_HWDEVICE_TYPE_D3D12VA.
+ *
+ * AVHWFramesContext.pool must contain AVBufferRefs whose
+ * data pointer points to an AVD3D12VAFrame struct.
+ */
+#include
+#include
+#include
+#include
+#include
+
+/**
+ * @brief This struct is allocated as AVHWDeviceContext.hwctx
+ *
+ */
+typedef struct AVD3D12VADeviceContext {
+ /**
+ * Device used for objects creation and access. This can also be
+ * used to set the libavcodec decoding device.
+ *
+ * Can be set by the user. This is the only mandatory field - the other
+ * device context fields are set from this and are available for convenience.
+ *
+ * Deallocating the AVHWDeviceContext will always release this interface,
+ * and it does not matter whether it was user-allocated.
+ */
+ ID3D12Device *device;
+
+ /**
+ * If unset, this will be set from the device field on init.
+ *
+ * Deallocating the AVHWDeviceContext will always release this interface,
+ * and it does not matter whether it was user-allocated.
+ */
+ ID3D12VideoDevice *video_device;
+
+ /**
+ * Callbacks for locking. They protect access to the internal staging
+ * texture (for av_hwframe_transfer_data() calls). They do NOT protect
+ * access to hwcontext or decoder state in general.
+ *
+ * If unset on init, the hwcontext implementation will set them to use an
+ * internal mutex.
+ *
+ * The underlying lock must be recursive. lock_ctx is for free use by the
+ * locking implementation.
+ */
+ void (*lock)(void *lock_ctx);
+ void (*unlock)(void *lock_ctx);
+ void *lock_ctx;
+} AVD3D12VADeviceContext;
+
+/**
+ * @brief This struct is used to sync d3d12 execution
+ *
+ */
+typedef struct AVD3D12VASyncContext {
+ /**
+ * D3D12 fence object
+ */
+ ID3D12Fence *fence;
+
+ /**
+ * A handle to the event object that's raised when the fence
+ * reaches a certain value.
+ */
+ HANDLE event;
+
+ /**
+ * The fence value used for sync
+ */
+ uint64_t fence_value;
+} AVD3D12VASyncContext;
+
+/**
+ * @brief D3D12VA frame descriptor for pool allocation.
+ *
+ */
+typedef struct AVD3D12VAFrame {
+ /**
+ * The texture in which the frame is located. The reference count is
+ * managed by the AVBufferRef, and destroying the reference will release
+ * the interface.
+ */
+ ID3D12Resource *texture;
+
+ /**
+ * The sync context for the texture
+ *
+ * @see: https://learn.microsoft.com/en-us/windows/win32/medfound/direct3d-12-video-overview#directx-12-fences
+ */
+ AVD3D12VASyncContext sync_ctx;
+} AVD3D12VAFrame;
+
+/**
+ * @brief This struct is allocated as AVHWFramesContext.hwctx
+ *
+ */
+typedef struct AVD3D12VAFramesContext {
+ /**
+ * DXGI_FORMAT format. MUST be compatible with the pixel format.
+ * If unset, will be automatically set.
+ */
+ DXGI_FORMAT format;
+
+ /**
+ * Options for working with resources.
+ * If unset, this will be D3D12_RESOURCE_FLAG_NONE.
+ *
+ * @see https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ne-d3d12-d3d12_resource_flags
+ */
+ D3D12_RESOURCE_FLAGS flags;
+} AVD3D12VAFramesContext;
+
+#endif /* AVUTIL_HWCONTEXT_D3D12VA_H */
diff --git a/ffmpeg/include/libavutil/hwcontext_mediacodec.h b/ffmpeg/include/libavutil/hwcontext_mediacodec.h
index 101a9806..fc0263ca 100644
--- a/ffmpeg/include/libavutil/hwcontext_mediacodec.h
+++ b/ffmpeg/include/libavutil/hwcontext_mediacodec.h
@@ -31,6 +31,31 @@ typedef struct AVMediaCodecDeviceContext {
* This is the default surface used by decoders on this device.
*/
void *surface;
+
+ /**
+ * Pointer to ANativeWindow.
+ *
+ * It both surface and native_window is NULL, try to create it
+ * automatically if create_window is true and OS support
+ * createPersistentInputSurface.
+ *
+ * It can be used as output surface for decoder and input surface for
+ * encoder.
+ */
+ void *native_window;
+
+ /**
+ * Enable createPersistentInputSurface automatically.
+ *
+ * Disabled by default.
+ *
+ * It can be enabled by setting this flag directly, or by setting
+ * AVDictionary of av_hwdevice_ctx_create(), with "create_window" as key.
+ * The second method is useful for ffmpeg cmdline, e.g., we can enable it
+ * via:
+ * -init_hw_device mediacodec=mediacodec,create_window=1
+ */
+ int create_window;
} AVMediaCodecDeviceContext;
#endif /* AVUTIL_HWCONTEXT_MEDIACODEC_H */
diff --git a/ffmpeg/include/libavutil/hwcontext_opencl.h b/ffmpeg/include/libavutil/hwcontext_opencl.h
new file mode 100644
index 00000000..ef54486c
--- /dev/null
+++ b/ffmpeg/include/libavutil/hwcontext_opencl.h
@@ -0,0 +1,100 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_HWCONTEXT_OPENCL_H
+#define AVUTIL_HWCONTEXT_OPENCL_H
+
+#ifdef __APPLE__
+#include
+#else
+#include
+#endif
+
+#include "frame.h"
+
+/**
+ * @file
+ * API-specific header for AV_HWDEVICE_TYPE_OPENCL.
+ *
+ * Pools allocated internally are always dynamic, and are primarily intended
+ * to be used in OpenCL-only cases. If interoperation is required, it is
+ * typically required to allocate frames in the other API and then map the
+ * frames context to OpenCL with av_hwframe_ctx_create_derived().
+ */
+
+/**
+ * OpenCL frame descriptor for pool allocation.
+ *
+ * In user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs
+ * with the data pointer pointing at an object of this type describing the
+ * planes of the frame.
+ */
+typedef struct AVOpenCLFrameDescriptor {
+ /**
+ * Number of planes in the frame.
+ */
+ int nb_planes;
+ /**
+ * OpenCL image2d objects for each plane of the frame.
+ */
+ cl_mem planes[AV_NUM_DATA_POINTERS];
+} AVOpenCLFrameDescriptor;
+
+/**
+ * OpenCL device details.
+ *
+ * Allocated as AVHWDeviceContext.hwctx
+ */
+typedef struct AVOpenCLDeviceContext {
+ /**
+ * The primary device ID of the device. If multiple OpenCL devices
+ * are associated with the context then this is the one which will
+ * be used for all operations internal to FFmpeg.
+ */
+ cl_device_id device_id;
+ /**
+ * The OpenCL context which will contain all operations and frames on
+ * this device.
+ */
+ cl_context context;
+ /**
+ * The default command queue for this device, which will be used by all
+ * frames contexts which do not have their own command queue. If not
+ * intialised by the user, a default queue will be created on the
+ * primary device.
+ */
+ cl_command_queue command_queue;
+} AVOpenCLDeviceContext;
+
+/**
+ * OpenCL-specific data associated with a frame pool.
+ *
+ * Allocated as AVHWFramesContext.hwctx.
+ */
+typedef struct AVOpenCLFramesContext {
+ /**
+ * The command queue used for internal asynchronous operations on this
+ * device (av_hwframe_transfer_data(), av_hwframe_map()).
+ *
+ * If this is not set, the command queue from the associated device is
+ * used instead.
+ */
+ cl_command_queue command_queue;
+} AVOpenCLFramesContext;
+
+#endif /* AVUTIL_HWCONTEXT_OPENCL_H */
diff --git a/ffmpeg/include/libavutil/hwcontext_qsv.h b/ffmpeg/include/libavutil/hwcontext_qsv.h
index b98d611c..35530e4e 100644
--- a/ffmpeg/include/libavutil/hwcontext_qsv.h
+++ b/ffmpeg/include/libavutil/hwcontext_qsv.h
@@ -19,14 +19,14 @@
#ifndef AVUTIL_HWCONTEXT_QSV_H
#define AVUTIL_HWCONTEXT_QSV_H
-#include
+#include
/**
* @file
* An API-specific header for AV_HWDEVICE_TYPE_QSV.
*
- * This API does not support dynamic frame pools. AVHWFramesContext.pool must
- * contain AVBufferRefs whose data pointer points to an mfxFrameSurface1 struct.
+ * AVHWFramesContext.pool must contain AVBufferRefs whose data pointer points
+ * to a mfxFrameSurface1 struct.
*/
/**
@@ -34,19 +34,53 @@
*/
typedef struct AVQSVDeviceContext {
mfxSession session;
+ /**
+ * The mfxLoader handle used for mfxSession creation
+ *
+ * This field is only available for oneVPL user. For non-oneVPL user, this
+ * field must be set to NULL.
+ *
+ * Filled by the user before calling av_hwdevice_ctx_init() and should be
+ * cast to mfxLoader handle. Deallocating the AVHWDeviceContext will always
+ * release this interface.
+ */
+ void *loader;
} AVQSVDeviceContext;
/**
* This struct is allocated as AVHWFramesContext.hwctx
*/
typedef struct AVQSVFramesContext {
+ /**
+ * A pointer to a mfxFrameSurface1 struct
+ *
+ * It is available when nb_surfaces is non-zero.
+ */
mfxFrameSurface1 *surfaces;
+
+ /**
+ * Number of frames in the pool
+ *
+ * It is 0 for dynamic frame pools or AVHWFramesContext.initial_pool_size
+ * for fixed frame pools.
+ *
+ * Note only oneVPL GPU runtime 2.9+ can support dynamic frame pools
+ * on d3d11va or vaapi
+ */
int nb_surfaces;
/**
* A combination of MFX_MEMTYPE_* describing the frame pool.
*/
int frame_type;
+
+ /**
+ * A pointer to a mfxFrameInfo struct
+ *
+ * It is available when nb_surfaces is 0, all buffers allocated from the
+ * pool have the same mfxFrameInfo.
+ */
+ mfxFrameInfo *info;
} AVQSVFramesContext;
#endif /* AVUTIL_HWCONTEXT_QSV_H */
diff --git a/ffmpeg/include/libavutil/hwcontext_videotoolbox.h b/ffmpeg/include/libavutil/hwcontext_videotoolbox.h
index 380918d9..d35cfbb6 100644
--- a/ffmpeg/include/libavutil/hwcontext_videotoolbox.h
+++ b/ffmpeg/include/libavutil/hwcontext_videotoolbox.h
@@ -23,22 +23,29 @@
#include
+#include "frame.h"
#include "pixfmt.h"
/**
* @file
* An API-specific header for AV_HWDEVICE_TYPE_VIDEOTOOLBOX.
*
- * This API currently does not support frame allocation, as the raw VideoToolbox
- * API does allocation, and FFmpeg itself never has the need to allocate frames.
+ * This API supports frame allocation using a native CVPixelBufferPool
+ * instead of an AVBufferPool.
*
* If the API user sets a custom pool, AVHWFramesContext.pool must return
* AVBufferRefs whose data pointer is a CVImageBufferRef or CVPixelBufferRef.
+ * Note that the underlying CVPixelBuffer could be retained by OS frameworks
+ * depending on application usage, so it is preferable to let CoreVideo manage
+ * the pool using the default implementation.
*
- * Currently AVHWDeviceContext.hwctx and AVHWFramesContext.hwctx are always
- * NULL.
+ * Currently AVHWDeviceContext.hwctx are always NULL.
*/
+typedef struct AVVTFramesContext {
+ enum AVColorRange color_range;
+} AVVTFramesContext;
+
/**
* Convert a VideoToolbox (actually CoreVideo) format to AVPixelFormat.
* Returns AV_PIX_FMT_NONE if no known equivalent was found.
@@ -51,4 +58,49 @@ enum AVPixelFormat av_map_videotoolbox_format_to_pixfmt(uint32_t cv_fmt);
*/
uint32_t av_map_videotoolbox_format_from_pixfmt(enum AVPixelFormat pix_fmt);
+/**
+ * Same as av_map_videotoolbox_format_from_pixfmt function, but can map and
+ * return full range pixel formats via a flag.
+ */
+uint32_t av_map_videotoolbox_format_from_pixfmt2(enum AVPixelFormat pix_fmt, bool full_range);
+
+/**
+ * Convert an AVChromaLocation to a VideoToolbox/CoreVideo chroma location string.
+ * Returns 0 if no known equivalent was found.
+ */
+CFStringRef av_map_videotoolbox_chroma_loc_from_av(enum AVChromaLocation loc);
+
+/**
+ * Convert an AVColorSpace to a VideoToolbox/CoreVideo color matrix string.
+ * Returns 0 if no known equivalent was found.
+ */
+CFStringRef av_map_videotoolbox_color_matrix_from_av(enum AVColorSpace space);
+
+/**
+ * Convert an AVColorPrimaries to a VideoToolbox/CoreVideo color primaries string.
+ * Returns 0 if no known equivalent was found.
+ */
+CFStringRef av_map_videotoolbox_color_primaries_from_av(enum AVColorPrimaries pri);
+
+/**
+ * Convert an AVColorTransferCharacteristic to a VideoToolbox/CoreVideo color transfer
+ * function string.
+ * Returns 0 if no known equivalent was found.
+ */
+CFStringRef av_map_videotoolbox_color_trc_from_av(enum AVColorTransferCharacteristic trc);
+
+/**
+ * Set CVPixelBufferRef's metadata based on an AVFrame.
+ *
+ * Sets/unsets the CVPixelBuffer attachments to match as closely as possible the
+ * AVFrame metadata. To prevent inconsistent attachments, the attachments for properties
+ * that could not be matched or are unspecified in the given AVFrame are unset. So if
+ * any attachments already covered by AVFrame metadata need to be set to a specific
+ * value, this should happen after calling this function.
+ *
+ * Returns < 0 in case of an error.
+ */
+int av_vt_pixbuf_set_attachments(void *log_ctx,
+ CVPixelBufferRef pixbuf, const struct AVFrame *src);
+
#endif /* AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H */
diff --git a/ffmpeg/include/libavutil/hwcontext_vulkan.h b/ffmpeg/include/libavutil/hwcontext_vulkan.h
new file mode 100644
index 00000000..2688a475
--- /dev/null
+++ b/ffmpeg/include/libavutil/hwcontext_vulkan.h
@@ -0,0 +1,382 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_HWCONTEXT_VULKAN_H
+#define AVUTIL_HWCONTEXT_VULKAN_H
+
+#if defined(_WIN32) && !defined(VK_USE_PLATFORM_WIN32_KHR)
+#define VK_USE_PLATFORM_WIN32_KHR
+#endif
+#include
+
+#include "pixfmt.h"
+#include "frame.h"
+#include "hwcontext.h"
+
+typedef struct AVVkFrame AVVkFrame;
+
+typedef struct AVVulkanDeviceQueueFamily {
+ /* Queue family index */
+ int idx;
+ /* Number of queues in the queue family in use */
+ int num;
+ /* Queue family capabilities. Must be non-zero.
+ * Flags may be removed to indicate the queue family may not be used
+ * for a given purpose. */
+ VkQueueFlagBits flags;
+ /* Vulkan implementations are allowed to list multiple video queues
+ * which differ in what they can encode or decode. */
+ VkVideoCodecOperationFlagBitsKHR video_caps;
+} AVVulkanDeviceQueueFamily;
+
+/**
+ * @file
+ * API-specific header for AV_HWDEVICE_TYPE_VULKAN.
+ *
+ * For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs
+ * with the data pointer set to an AVVkFrame.
+ */
+
+/**
+ * Main Vulkan context, allocated as AVHWDeviceContext.hwctx.
+ * All of these can be set before init to change what the context uses
+ */
+typedef struct AVVulkanDeviceContext {
+ /**
+ * Custom memory allocator, else NULL
+ */
+ const VkAllocationCallbacks *alloc;
+
+ /**
+ * Pointer to a vkGetInstanceProcAddr loading function.
+ * If unset, will dynamically load and use libvulkan.
+ */
+ PFN_vkGetInstanceProcAddr get_proc_addr;
+
+ /**
+ * Vulkan instance. Must be at least version 1.3.
+ */
+ VkInstance inst;
+
+ /**
+ * Physical device
+ */
+ VkPhysicalDevice phys_dev;
+
+ /**
+ * Active device
+ */
+ VkDevice act_dev;
+
+ /**
+ * This structure should be set to the set of features that present and enabled
+ * during device creation. When a device is created by FFmpeg, it will default to
+ * enabling all that are present of the shaderImageGatherExtended,
+ * fragmentStoresAndAtomics, shaderInt64 and vertexPipelineStoresAndAtomics features.
+ */
+ VkPhysicalDeviceFeatures2 device_features;
+
+ /**
+ * Enabled instance extensions.
+ * If supplying your own device context, set this to an array of strings, with
+ * each entry containing the specified Vulkan extension string to enable.
+ * Duplicates are possible and accepted.
+ * If no extensions are enabled, set these fields to NULL, and 0 respectively.
+ */
+ const char * const *enabled_inst_extensions;
+ int nb_enabled_inst_extensions;
+
+ /**
+ * Enabled device extensions. By default, VK_KHR_external_memory_fd,
+ * VK_EXT_external_memory_dma_buf, VK_EXT_image_drm_format_modifier,
+ * VK_KHR_external_semaphore_fd and VK_EXT_external_memory_host are enabled if found.
+ * If supplying your own device context, these fields takes the same format as
+ * the above fields, with the same conditions that duplicates are possible
+ * and accepted, and that NULL and 0 respectively means no extensions are enabled.
+ */
+ const char * const *enabled_dev_extensions;
+ int nb_enabled_dev_extensions;
+
+#if FF_API_VULKAN_FIXED_QUEUES
+ /**
+ * Queue family index for graphics operations, and the number of queues
+ * enabled for it. If unavaiable, will be set to -1. Not required.
+ * av_hwdevice_create() will attempt to find a dedicated queue for each
+ * queue family, or pick the one with the least unrelated flags set.
+ * Queue indices here may overlap if a queue has to share capabilities.
+ */
+ attribute_deprecated
+ int queue_family_index;
+ attribute_deprecated
+ int nb_graphics_queues;
+
+ /**
+ * Queue family index for transfer operations and the number of queues
+ * enabled. Required.
+ */
+ attribute_deprecated
+ int queue_family_tx_index;
+ attribute_deprecated
+ int nb_tx_queues;
+
+ /**
+ * Queue family index for compute operations and the number of queues
+ * enabled. Required.
+ */
+ attribute_deprecated
+ int queue_family_comp_index;
+ attribute_deprecated
+ int nb_comp_queues;
+
+ /**
+ * Queue family index for video encode ops, and the amount of queues enabled.
+ * If the device doesn't support such, queue_family_encode_index will be -1.
+ * Not required.
+ */
+ attribute_deprecated
+ int queue_family_encode_index;
+ attribute_deprecated
+ int nb_encode_queues;
+
+ /**
+ * Queue family index for video decode ops, and the amount of queues enabled.
+ * If the device doesn't support such, queue_family_decode_index will be -1.
+ * Not required.
+ */
+ attribute_deprecated
+ int queue_family_decode_index;
+ attribute_deprecated
+ int nb_decode_queues;
+#endif
+
+ /**
+ * Locks a queue, preventing other threads from submitting any command
+ * buffers to this queue.
+ * If set to NULL, will be set to lavu-internal functions that utilize a
+ * mutex.
+ */
+ void (*lock_queue)(struct AVHWDeviceContext *ctx, uint32_t queue_family, uint32_t index);
+
+ /**
+ * Similar to lock_queue(), unlocks a queue. Must only be called after locking.
+ */
+ void (*unlock_queue)(struct AVHWDeviceContext *ctx, uint32_t queue_family, uint32_t index);
+
+ /**
+ * Queue families used. Must be preferentially ordered. List may contain
+ * duplicates.
+ *
+ * For compatibility reasons, all the enabled queue families listed above
+ * (queue_family_(tx/comp/encode/decode)_index) must also be included in
+ * this list until they're removed after deprecation.
+ */
+ AVVulkanDeviceQueueFamily qf[64];
+ int nb_qf;
+} AVVulkanDeviceContext;
+
+/**
+ * Defines the behaviour of frame allocation.
+ */
+typedef enum AVVkFrameFlags {
+ /* Unless this flag is set, autodetected flags will be OR'd based on the
+ * device and tiling during av_hwframe_ctx_init(). */
+ AV_VK_FRAME_FLAG_NONE = (1ULL << 0),
+
+#if FF_API_VULKAN_CONTIGUOUS_MEMORY
+ /* DEPRECATED: does nothing. Replaced by multiplane images. */
+ AV_VK_FRAME_FLAG_CONTIGUOUS_MEMORY = (1ULL << 1),
+#endif
+
+ /* Disables multiplane images.
+ * This is required to export/import images from CUDA. */
+ AV_VK_FRAME_FLAG_DISABLE_MULTIPLANE = (1ULL << 2),
+} AVVkFrameFlags;
+
+/**
+ * Allocated as AVHWFramesContext.hwctx, used to set pool-specific options
+ */
+typedef struct AVVulkanFramesContext {
+ /**
+ * Controls the tiling of allocated frames.
+ * If left as VK_IMAGE_TILING_OPTIMAL (0), will use optimal tiling.
+ * Can be set to VK_IMAGE_TILING_LINEAR to force linear images,
+ * or VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT to force DMABUF-backed
+ * images.
+ * @note Imported frames from other APIs ignore this.
+ */
+ VkImageTiling tiling;
+
+ /**
+ * Defines extra usage of output frames. If non-zero, all flags MUST be
+ * supported by the VkFormat. Otherwise, will use supported flags amongst:
+ * - VK_IMAGE_USAGE_SAMPLED_BIT
+ * - VK_IMAGE_USAGE_STORAGE_BIT
+ * - VK_IMAGE_USAGE_TRANSFER_SRC_BIT
+ * - VK_IMAGE_USAGE_TRANSFER_DST_BIT
+ */
+ VkImageUsageFlagBits usage;
+
+ /**
+ * Extension data for image creation.
+ * If DRM tiling is used, a VkImageDrmFormatModifierListCreateInfoEXT structure
+ * can be added to specify the exact modifier to use.
+ *
+ * Additional structures may be added at av_hwframe_ctx_init() time,
+ * which will be freed automatically on uninit(), so users must only free
+ * any structures they've allocated themselves.
+ */
+ void *create_pnext;
+
+ /**
+ * Extension data for memory allocation. Must have as many entries as
+ * the number of planes of the sw_format.
+ * This will be chained to VkExportMemoryAllocateInfo, which is used
+ * to make all pool images exportable to other APIs if the necessary
+ * extensions are present in enabled_dev_extensions.
+ */
+ void *alloc_pnext[AV_NUM_DATA_POINTERS];
+
+ /**
+ * A combination of AVVkFrameFlags. Unless AV_VK_FRAME_FLAG_NONE is set,
+ * autodetected flags will be OR'd based on the device and tiling during
+ * av_hwframe_ctx_init().
+ */
+ AVVkFrameFlags flags;
+
+ /**
+ * Flags to set during image creation. If unset, defaults to
+ * VK_IMAGE_CREATE_ALIAS_BIT.
+ */
+ VkImageCreateFlags img_flags;
+
+ /**
+ * Vulkan format for each image. MUST be compatible with the pixel format.
+ * If unset, will be automatically set.
+ * There are at most two compatible formats for a frame - a multiplane
+ * format, and a single-plane multi-image format.
+ */
+ VkFormat format[AV_NUM_DATA_POINTERS];
+
+ /**
+ * Number of layers each image will have.
+ */
+ int nb_layers;
+
+ /**
+ * Locks a frame, preventing other threads from changing frame properties.
+ * Users SHOULD only ever lock just before command submission in order
+ * to get accurate frame properties, and unlock immediately after command
+ * submission without waiting for it to finish.
+ *
+ * If unset, will be set to lavu-internal functions that utilize a mutex.
+ */
+ void (*lock_frame)(struct AVHWFramesContext *fc, AVVkFrame *vkf);
+
+ /**
+ * Similar to lock_frame(), unlocks a frame. Must only be called after locking.
+ */
+ void (*unlock_frame)(struct AVHWFramesContext *fc, AVVkFrame *vkf);
+} AVVulkanFramesContext;
+
+/*
+ * Frame structure.
+ *
+ * @note the size of this structure is not part of the ABI, to allocate
+ * you must use @av_vk_frame_alloc().
+ */
+struct AVVkFrame {
+ /**
+ * Vulkan images to which the memory is bound to.
+ * May be one for multiplane formats, or multiple.
+ */
+ VkImage img[AV_NUM_DATA_POINTERS];
+
+ /**
+ * Tiling for the frame.
+ */
+ VkImageTiling tiling;
+
+ /**
+ * Memory backing the images. Either one, or as many as there are planes
+ * in the sw_format.
+ * In case of having multiple VkImages, but one memory, the offset field
+ * will indicate the bound offset for each image.
+ */
+ VkDeviceMemory mem[AV_NUM_DATA_POINTERS];
+ size_t size[AV_NUM_DATA_POINTERS];
+
+ /**
+ * OR'd flags for all memory allocated
+ */
+ VkMemoryPropertyFlagBits flags;
+
+ /**
+ * Updated after every barrier. One per VkImage.
+ */
+ VkAccessFlagBits access[AV_NUM_DATA_POINTERS];
+ VkImageLayout layout[AV_NUM_DATA_POINTERS];
+
+ /**
+ * Synchronization timeline semaphores, one for each VkImage.
+ * Must not be freed manually. Must be waited on at every submission using
+ * the value in sem_value, and must be signalled at every submission,
+ * using an incremented value.
+ */
+ VkSemaphore sem[AV_NUM_DATA_POINTERS];
+
+ /**
+ * Up to date semaphore value at which each image becomes accessible.
+ * One per VkImage.
+ * Clients must wait on this value when submitting a command queue,
+ * and increment it when signalling.
+ */
+ uint64_t sem_value[AV_NUM_DATA_POINTERS];
+
+ /**
+ * Internal data.
+ */
+ struct AVVkFrameInternal *internal;
+
+ /**
+ * Describes the binding offset of each image to the VkDeviceMemory.
+ * One per VkImage.
+ */
+ ptrdiff_t offset[AV_NUM_DATA_POINTERS];
+
+ /**
+ * Queue family of the images. Must be VK_QUEUE_FAMILY_IGNORED if
+ * the image was allocated with the CONCURRENT concurrency option.
+ * One per VkImage.
+ */
+ uint32_t queue_family[AV_NUM_DATA_POINTERS];
+};
+
+/**
+ * Allocates a single AVVkFrame and initializes everything as 0.
+ * @note Must be freed via av_free()
+ */
+AVVkFrame *av_vk_frame_alloc(void);
+
+/**
+ * Returns the optimal per-plane Vulkan format for a given sw_format,
+ * one for each plane.
+ * Returns NULL on unsupported formats.
+ */
+const VkFormat *av_vkfmt_from_pixfmt(enum AVPixelFormat p);
+
+#endif /* AVUTIL_HWCONTEXT_VULKAN_H */
diff --git a/ffmpeg/include/libavutil/iamf.h b/ffmpeg/include/libavutil/iamf.h
new file mode 100644
index 00000000..1fa73893
--- /dev/null
+++ b/ffmpeg/include/libavutil/iamf.h
@@ -0,0 +1,690 @@
+/*
+ * Immersive Audio Model and Formats helper functions and defines
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_IAMF_H
+#define AVUTIL_IAMF_H
+
+/**
+ * @file
+ * Immersive Audio Model and Formats API header
+ * @see Immersive Audio Model and Formats
+ */
+
+#include
+#include
+
+#include "attributes.h"
+#include "avassert.h"
+#include "channel_layout.h"
+#include "dict.h"
+#include "rational.h"
+
+/**
+ * @defgroup lavu_iamf Immersive Audio Model and Formats
+ * @ingroup lavu_audio
+ *
+ * Immersive Audio Model and Formats related functions and defines
+ *
+ * @defgroup lavu_iamf_params Parameter Definition
+ * @ingroup lavu_iamf
+ * @{
+ * Parameters as defined in section 3.6.1 and 3.8 of IAMF.
+ * @}
+ *
+ * @defgroup lavu_iamf_audio Audio Element
+ * @ingroup lavu_iamf
+ * @{
+ * Audio Elements as defined in section 3.6 of IAMF.
+ * @}
+ *
+ * @defgroup lavu_iamf_mix Mix Presentation
+ * @ingroup lavu_iamf
+ * @{
+ * Mix Presentations as defined in section 3.7 of IAMF.
+ * @}
+ *
+ * @addtogroup lavu_iamf_params
+ * @{
+ */
+enum AVIAMFAnimationType {
+ AV_IAMF_ANIMATION_TYPE_STEP,
+ AV_IAMF_ANIMATION_TYPE_LINEAR,
+ AV_IAMF_ANIMATION_TYPE_BEZIER,
+};
+
+/**
+ * Mix Gain Parameter Data as defined in section 3.8.1 of IAMF.
+ *
+ * @note This struct's size is not a part of the public ABI.
+ */
+typedef struct AVIAMFMixGain {
+ const AVClass *av_class;
+
+ /**
+ * Duration for the given subblock, in units of
+ * 1 / @ref AVIAMFParamDefinition.parameter_rate "parameter_rate".
+ * It must not be 0.
+ */
+ unsigned int subblock_duration;
+ /**
+ * The type of animation applied to the parameter values.
+ */
+ enum AVIAMFAnimationType animation_type;
+ /**
+ * Parameter value that is applied at the start of the subblock.
+ * Applies to all defined Animation Types.
+ *
+ * Valid range of values is -128.0 to 128.0
+ */
+ AVRational start_point_value;
+ /**
+ * Parameter value that is applied at the end of the subblock.
+ * Applies only to AV_IAMF_ANIMATION_TYPE_LINEAR and
+ * AV_IAMF_ANIMATION_TYPE_BEZIER Animation Types.
+ *
+ * Valid range of values is -128.0 to 128.0
+ */
+ AVRational end_point_value;
+ /**
+ * Parameter value of the middle control point of a quadratic Bezier
+ * curve, i.e., its y-axis value.
+ * Applies only to AV_IAMF_ANIMATION_TYPE_BEZIER Animation Type.
+ *
+ * Valid range of values is -128.0 to 128.0
+ */
+ AVRational control_point_value;
+ /**
+ * Parameter value of the time of the middle control point of a
+ * quadratic Bezier curve, i.e., its x-axis value.
+ * Applies only to AV_IAMF_ANIMATION_TYPE_BEZIER Animation Type.
+ *
+ * Valid range of values is 0.0 to 1.0
+ */
+ AVRational control_point_relative_time;
+} AVIAMFMixGain;
+
+/**
+ * Demixing Info Parameter Data as defined in section 3.8.2 of IAMF.
+ *
+ * @note This struct's size is not a part of the public ABI.
+ */
+typedef struct AVIAMFDemixingInfo {
+ const AVClass *av_class;
+
+ /**
+ * Duration for the given subblock, in units of
+ * 1 / @ref AVIAMFParamDefinition.parameter_rate "parameter_rate".
+ * It must not be 0.
+ */
+ unsigned int subblock_duration;
+ /**
+ * Pre-defined combination of demixing parameters.
+ */
+ unsigned int dmixp_mode;
+} AVIAMFDemixingInfo;
+
+/**
+ * Recon Gain Info Parameter Data as defined in section 3.8.3 of IAMF.
+ *
+ * @note This struct's size is not a part of the public ABI.
+ */
+typedef struct AVIAMFReconGain {
+ const AVClass *av_class;
+
+ /**
+ * Duration for the given subblock, in units of
+ * 1 / @ref AVIAMFParamDefinition.parameter_rate "parameter_rate".
+ * It must not be 0.
+ */
+ unsigned int subblock_duration;
+
+ /**
+ * Array of gain values to be applied to each channel for each layer
+ * defined in the Audio Element referencing the parent Parameter Definition.
+ * Values for layers where the AV_IAMF_LAYER_FLAG_RECON_GAIN flag is not set
+ * are undefined.
+ *
+ * Channel order is: FL, C, FR, SL, SR, TFL, TFR, BL, BR, TBL, TBR, LFE
+ */
+ uint8_t recon_gain[6][12];
+} AVIAMFReconGain;
+
+enum AVIAMFParamDefinitionType {
+ /**
+ * Subblocks are of struct type AVIAMFMixGain
+ */
+ AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN,
+ /**
+ * Subblocks are of struct type AVIAMFDemixingInfo
+ */
+ AV_IAMF_PARAMETER_DEFINITION_DEMIXING,
+ /**
+ * Subblocks are of struct type AVIAMFReconGain
+ */
+ AV_IAMF_PARAMETER_DEFINITION_RECON_GAIN,
+};
+
+/**
+ * Parameters as defined in section 3.6.1 of IAMF.
+ *
+ * The struct is allocated by av_iamf_param_definition_alloc() along with an
+ * array of subblocks, its type depending on the value of type.
+ * This array is placed subblocks_offset bytes after the start of this struct.
+ *
+ * @note This struct's size is not a part of the public ABI.
+ */
+typedef struct AVIAMFParamDefinition {
+ const AVClass *av_class;
+
+ /**
+ * Offset in bytes from the start of this struct, at which the subblocks
+ * array is located.
+ */
+ size_t subblocks_offset;
+ /**
+ * Size in bytes of each element in the subblocks array.
+ */
+ size_t subblock_size;
+ /**
+ * Number of subblocks in the array.
+ */
+ unsigned int nb_subblocks;
+
+ /**
+ * Parameters type. Determines the type of the subblock elements.
+ */
+ enum AVIAMFParamDefinitionType type;
+
+ /**
+ * Identifier for the paremeter substream.
+ */
+ unsigned int parameter_id;
+ /**
+ * Sample rate for the paremeter substream. It must not be 0.
+ */
+ unsigned int parameter_rate;
+
+ /**
+ * The accumulated duration of all blocks in this parameter definition,
+ * in units of 1 / @ref parameter_rate.
+ *
+ * May be 0, in which case all duration values should be specified in
+ * another parameter definition referencing the same parameter_id.
+ */
+ unsigned int duration;
+ /**
+ * The duration of every subblock in the case where all subblocks, with
+ * the optional exception of the last subblock, have equal durations.
+ *
+ * Must be 0 if subblocks have different durations.
+ */
+ unsigned int constant_subblock_duration;
+} AVIAMFParamDefinition;
+
+const AVClass *av_iamf_param_definition_get_class(void);
+
+/**
+ * Allocates memory for AVIAMFParamDefinition, plus an array of {@code nb_subblocks}
+ * amount of subblocks of the given type and initializes the variables. Can be
+ * freed with a normal av_free() call.
+ *
+ * @param size if non-NULL, the size in bytes of the resulting data array is written here.
+ */
+AVIAMFParamDefinition *av_iamf_param_definition_alloc(enum AVIAMFParamDefinitionType type,
+ unsigned int nb_subblocks, size_t *size);
+
+/**
+ * Get the subblock at the specified {@code idx}. Must be between 0 and nb_subblocks - 1.
+ *
+ * The @ref AVIAMFParamDefinition.type "param definition type" defines
+ * the struct type of the returned pointer.
+ */
+static av_always_inline void*
+av_iamf_param_definition_get_subblock(const AVIAMFParamDefinition *par, unsigned int idx)
+{
+ av_assert0(idx < par->nb_subblocks);
+ return (void *)((uint8_t *)par + par->subblocks_offset + idx * par->subblock_size);
+}
+
+/**
+ * @}
+ * @addtogroup lavu_iamf_audio
+ * @{
+ */
+
+enum AVIAMFAmbisonicsMode {
+ AV_IAMF_AMBISONICS_MODE_MONO,
+ AV_IAMF_AMBISONICS_MODE_PROJECTION,
+};
+
+/**
+ * Recon gain information for the layer is present in AVIAMFReconGain
+ */
+#define AV_IAMF_LAYER_FLAG_RECON_GAIN (1 << 0)
+
+/**
+ * A layer defining a Channel Layout in the Audio Element.
+ *
+ * When @ref AVIAMFAudioElement.audio_element_type "the parent's Audio Element type"
+ * is AV_IAMF_AUDIO_ELEMENT_TYPE_CHANNEL, this corresponds to an Scalable Channel
+ * Layout layer as defined in section 3.6.2 of IAMF.
+ * For AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE, it is an Ambisonics channel
+ * layout as defined in section 3.6.3 of IAMF.
+ *
+ * @note The struct should be allocated with av_iamf_audio_element_add_layer()
+ * and its size is not a part of the public ABI.
+ */
+typedef struct AVIAMFLayer {
+ const AVClass *av_class;
+
+ AVChannelLayout ch_layout;
+
+ /**
+ * A bitmask which may contain a combination of AV_IAMF_LAYER_FLAG_* flags.
+ */
+ unsigned int flags;
+ /**
+ * Output gain channel flags as defined in section 3.6.2 of IAMF.
+ *
+ * This field is defined only if @ref AVIAMFAudioElement.audio_element_type
+ * "the parent's Audio Element type" is AV_IAMF_AUDIO_ELEMENT_TYPE_CHANNEL,
+ * must be 0 otherwise.
+ */
+ unsigned int output_gain_flags;
+ /**
+ * Output gain as defined in section 3.6.2 of IAMF.
+ *
+ * Must be 0 if @ref output_gain_flags is 0.
+ */
+ AVRational output_gain;
+ /**
+ * Ambisonics mode as defined in section 3.6.3 of IAMF.
+ *
+ * This field is defined only if @ref AVIAMFAudioElement.audio_element_type
+ * "the parent's Audio Element type" is AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE.
+ *
+ * If AV_IAMF_AMBISONICS_MODE_MONO, channel_mapping is defined implicitly
+ * (Ambisonic Order) or explicitly (Custom Order with ambi channels) in
+ * @ref ch_layout.
+ * If AV_IAMF_AMBISONICS_MODE_PROJECTION, @ref demixing_matrix must be set.
+ */
+ enum AVIAMFAmbisonicsMode ambisonics_mode;
+
+ /**
+ * Demixing matrix as defined in section 3.6.3 of IAMF.
+ *
+ * The length of the array is ch_layout.nb_channels multiplied by the sum of
+ * the amount of streams in the group plus the amount of streams in the group
+ * that are stereo.
+ *
+ * May be set only if @ref ambisonics_mode == AV_IAMF_AMBISONICS_MODE_PROJECTION,
+ * must be NULL otherwise.
+ */
+ AVRational *demixing_matrix;
+} AVIAMFLayer;
+
+
+enum AVIAMFAudioElementType {
+ AV_IAMF_AUDIO_ELEMENT_TYPE_CHANNEL,
+ AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE,
+};
+
+/**
+ * Information on how to combine one or more audio streams, as defined in
+ * section 3.6 of IAMF.
+ *
+ * @note The struct should be allocated with av_iamf_audio_element_alloc()
+ * and its size is not a part of the public ABI.
+ */
+typedef struct AVIAMFAudioElement {
+ const AVClass *av_class;
+
+ AVIAMFLayer **layers;
+ /**
+ * Number of layers, or channel groups, in the Audio Element.
+ * There may be 6 layers at most, and for @ref audio_element_type
+ * AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE, there may be exactly 1.
+ *
+ * Set by av_iamf_audio_element_add_layer(), must not be
+ * modified by any other code.
+ */
+ unsigned int nb_layers;
+
+ /**
+ * Demixing information used to reconstruct a scalable channel audio
+ * representation.
+ * The @ref AVIAMFParamDefinition.type "type" must be
+ * AV_IAMF_PARAMETER_DEFINITION_DEMIXING.
+ */
+ AVIAMFParamDefinition *demixing_info;
+ /**
+ * Recon gain information used to reconstruct a scalable channel audio
+ * representation.
+ * The @ref AVIAMFParamDefinition.type "type" must be
+ * AV_IAMF_PARAMETER_DEFINITION_RECON_GAIN.
+ */
+ AVIAMFParamDefinition *recon_gain_info;
+
+ /**
+ * Audio element type as defined in section 3.6 of IAMF.
+ */
+ enum AVIAMFAudioElementType audio_element_type;
+
+ /**
+ * Default weight value as defined in section 3.6 of IAMF.
+ */
+ unsigned int default_w;
+} AVIAMFAudioElement;
+
+const AVClass *av_iamf_audio_element_get_class(void);
+
+/**
+ * Allocates a AVIAMFAudioElement, and initializes its fields with default values.
+ * No layers are allocated. Must be freed with av_iamf_audio_element_free().
+ *
+ * @see av_iamf_audio_element_add_layer()
+ */
+AVIAMFAudioElement *av_iamf_audio_element_alloc(void);
+
+/**
+ * Allocate a layer and add it to a given AVIAMFAudioElement.
+ * It is freed by av_iamf_audio_element_free() alongside the rest of the parent
+ * AVIAMFAudioElement.
+ *
+ * @return a pointer to the allocated layer.
+ */
+AVIAMFLayer *av_iamf_audio_element_add_layer(AVIAMFAudioElement *audio_element);
+
+/**
+ * Free an AVIAMFAudioElement and all its contents.
+ *
+ * @param audio_element pointer to pointer to an allocated AVIAMFAudioElement.
+ * upon return, *audio_element will be set to NULL.
+ */
+void av_iamf_audio_element_free(AVIAMFAudioElement **audio_element);
+
+/**
+ * @}
+ * @addtogroup lavu_iamf_mix
+ * @{
+ */
+
+enum AVIAMFHeadphonesMode {
+ /**
+ * The referenced Audio Element shall be rendered to stereo loudspeakers.
+ */
+ AV_IAMF_HEADPHONES_MODE_STEREO,
+ /**
+ * The referenced Audio Element shall be rendered with a binaural renderer.
+ */
+ AV_IAMF_HEADPHONES_MODE_BINAURAL,
+};
+
+/**
+ * Submix element as defined in section 3.7 of IAMF.
+ *
+ * @note The struct should be allocated with av_iamf_submix_add_element()
+ * and its size is not a part of the public ABI.
+ */
+typedef struct AVIAMFSubmixElement {
+ const AVClass *av_class;
+
+ /**
+ * The id of the Audio Element this submix element references.
+ */
+ unsigned int audio_element_id;
+
+ /**
+ * Information required required for applying any processing to the
+ * referenced and rendered Audio Element before being summed with other
+ * processed Audio Elements.
+ * The @ref AVIAMFParamDefinition.type "type" must be
+ * AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN.
+ */
+ AVIAMFParamDefinition *element_mix_config;
+
+ /**
+ * Default mix gain value to apply when there are no AVIAMFParamDefinition
+ * with @ref element_mix_config "element_mix_config's"
+ * @ref AVIAMFParamDefinition.parameter_id "parameter_id" available for a
+ * given audio frame.
+ */
+ AVRational default_mix_gain;
+
+ /**
+ * A value that indicates whether the referenced channel-based Audio Element
+ * shall be rendered to stereo loudspeakers or spatialized with a binaural
+ * renderer when played back on headphones.
+ * If the Audio Element is not of @ref AVIAMFAudioElement.audio_element_type
+ * "type" AV_IAMF_AUDIO_ELEMENT_TYPE_CHANNEL, then this field is undefined.
+ */
+ enum AVIAMFHeadphonesMode headphones_rendering_mode;
+
+ /**
+ * A dictionary of strings describing the submix in different languages.
+ * Must have the same amount of entries as
+ * @ref AVIAMFMixPresentation.annotations "the mix's annotations", stored
+ * in the same order, and with the same key strings.
+ *
+ * @ref AVDictionaryEntry.key "key" is a string conforming to BCP-47 that
+ * specifies the language for the string stored in
+ * @ref AVDictionaryEntry.value "value".
+ */
+ AVDictionary *annotations;
+} AVIAMFSubmixElement;
+
+enum AVIAMFSubmixLayoutType {
+ /**
+ * The layout follows the loudspeaker sound system convention of ITU-2051-3.
+ */
+ AV_IAMF_SUBMIX_LAYOUT_TYPE_LOUDSPEAKERS = 2,
+ /**
+ * The layout is binaural.
+ */
+ AV_IAMF_SUBMIX_LAYOUT_TYPE_BINAURAL = 3,
+};
+
+/**
+ * Submix layout as defined in section 3.7.6 of IAMF.
+ *
+ * @note The struct should be allocated with av_iamf_submix_add_layout()
+ * and its size is not a part of the public ABI.
+ */
+typedef struct AVIAMFSubmixLayout {
+ const AVClass *av_class;
+
+ enum AVIAMFSubmixLayoutType layout_type;
+
+ /**
+ * Channel layout matching one of Sound Systems A to J of ITU-2051-3, plus
+ * 7.1.2ch and 3.1.2ch
+ * If layout_type is not AV_IAMF_SUBMIX_LAYOUT_TYPE_LOUDSPEAKERS, this field
+ * is undefined.
+ */
+ AVChannelLayout sound_system;
+ /**
+ * The program integrated loudness information, as defined in
+ * ITU-1770-4.
+ */
+ AVRational integrated_loudness;
+ /**
+ * The digital (sampled) peak value of the audio signal, as defined
+ * in ITU-1770-4.
+ */
+ AVRational digital_peak;
+ /**
+ * The true peak of the audio signal, as defined in ITU-1770-4.
+ */
+ AVRational true_peak;
+ /**
+ * The Dialogue loudness information, as defined in ITU-1770-4.
+ */
+ AVRational dialogue_anchored_loudness;
+ /**
+ * The Album loudness information, as defined in ITU-1770-4.
+ */
+ AVRational album_anchored_loudness;
+} AVIAMFSubmixLayout;
+
+/**
+ * Submix layout as defined in section 3.7 of IAMF.
+ *
+ * @note The struct should be allocated with av_iamf_mix_presentation_add_submix()
+ * and its size is not a part of the public ABI.
+ */
+typedef struct AVIAMFSubmix {
+ const AVClass *av_class;
+
+ /**
+ * Array of submix elements.
+ *
+ * Set by av_iamf_submix_add_element(), must not be modified by any
+ * other code.
+ */
+ AVIAMFSubmixElement **elements;
+ /**
+ * Number of elements in the submix.
+ *
+ * Set by av_iamf_submix_add_element(), must not be modified by any
+ * other code.
+ */
+ unsigned int nb_elements;
+
+ /**
+ * Array of submix layouts.
+ *
+ * Set by av_iamf_submix_add_layout(), must not be modified by any
+ * other code.
+ */
+ AVIAMFSubmixLayout **layouts;
+ /**
+ * Number of layouts in the submix.
+ *
+ * Set by av_iamf_submix_add_layout(), must not be modified by any
+ * other code.
+ */
+ unsigned int nb_layouts;
+
+ /**
+ * Information required for post-processing the mixed audio signal to
+ * generate the audio signal for playback.
+ * The @ref AVIAMFParamDefinition.type "type" must be
+ * AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN.
+ */
+ AVIAMFParamDefinition *output_mix_config;
+
+ /**
+ * Default mix gain value to apply when there are no AVIAMFParamDefinition
+ * with @ref output_mix_config "output_mix_config's"
+ * @ref AVIAMFParamDefinition.parameter_id "parameter_id" available for a
+ * given audio frame.
+ */
+ AVRational default_mix_gain;
+} AVIAMFSubmix;
+
+/**
+ * Information on how to render and mix one or more AVIAMFAudioElement to generate
+ * the final audio output, as defined in section 3.7 of IAMF.
+ *
+ * @note The struct should be allocated with av_iamf_mix_presentation_alloc()
+ * and its size is not a part of the public ABI.
+ */
+typedef struct AVIAMFMixPresentation {
+ const AVClass *av_class;
+
+ /**
+ * Array of submixes.
+ *
+ * Set by av_iamf_mix_presentation_add_submix(), must not be modified
+ * by any other code.
+ */
+ AVIAMFSubmix **submixes;
+ /**
+ * Number of submixes in the presentation.
+ *
+ * Set by av_iamf_mix_presentation_add_submix(), must not be modified
+ * by any other code.
+ */
+ unsigned int nb_submixes;
+
+ /**
+ * A dictionary of strings describing the mix in different languages.
+ * Must have the same amount of entries as every
+ * @ref AVIAMFSubmixElement.annotations "Submix element annotations",
+ * stored in the same order, and with the same key strings.
+ *
+ * @ref AVDictionaryEntry.key "key" is a string conforming to BCP-47
+ * that specifies the language for the string stored in
+ * @ref AVDictionaryEntry.value "value".
+ */
+ AVDictionary *annotations;
+} AVIAMFMixPresentation;
+
+const AVClass *av_iamf_mix_presentation_get_class(void);
+
+/**
+ * Allocates a AVIAMFMixPresentation, and initializes its fields with default
+ * values. No submixes are allocated.
+ * Must be freed with av_iamf_mix_presentation_free().
+ *
+ * @see av_iamf_mix_presentation_add_submix()
+ */
+AVIAMFMixPresentation *av_iamf_mix_presentation_alloc(void);
+
+/**
+ * Allocate a submix and add it to a given AVIAMFMixPresentation.
+ * It is freed by av_iamf_mix_presentation_free() alongside the rest of the
+ * parent AVIAMFMixPresentation.
+ *
+ * @return a pointer to the allocated submix.
+ */
+AVIAMFSubmix *av_iamf_mix_presentation_add_submix(AVIAMFMixPresentation *mix_presentation);
+
+/**
+ * Allocate a submix element and add it to a given AVIAMFSubmix.
+ * It is freed by av_iamf_mix_presentation_free() alongside the rest of the
+ * parent AVIAMFSubmix.
+ *
+ * @return a pointer to the allocated submix.
+ */
+AVIAMFSubmixElement *av_iamf_submix_add_element(AVIAMFSubmix *submix);
+
+/**
+ * Allocate a submix layout and add it to a given AVIAMFSubmix.
+ * It is freed by av_iamf_mix_presentation_free() alongside the rest of the
+ * parent AVIAMFSubmix.
+ *
+ * @return a pointer to the allocated submix.
+ */
+AVIAMFSubmixLayout *av_iamf_submix_add_layout(AVIAMFSubmix *submix);
+
+/**
+ * Free an AVIAMFMixPresentation and all its contents.
+ *
+ * @param mix_presentation pointer to pointer to an allocated AVIAMFMixPresentation.
+ * upon return, *mix_presentation will be set to NULL.
+ */
+void av_iamf_mix_presentation_free(AVIAMFMixPresentation **mix_presentation);
+
+/**
+ * @}
+ */
+
+#endif /* AVUTIL_IAMF_H */
diff --git a/ffmpeg/include/libavutil/imgutils.h b/ffmpeg/include/libavutil/imgutils.h
index 5b790ecf..123a9e5c 100644
--- a/ffmpeg/include/libavutil/imgutils.h
+++ b/ffmpeg/include/libavutil/imgutils.h
@@ -27,8 +27,10 @@
* @{
*/
-#include "avutil.h"
+#include
+#include
#include "pixdesc.h"
+#include "pixfmt.h"
#include "rational.h"
/**
@@ -46,6 +48,7 @@
* component in the plane with the max pixel step.
* @param max_pixstep_comps an array which is filled with the component
* for each plane which has the max pixel step. May be NULL.
+ * @param pixdesc the AVPixFmtDescriptor for the image, describing its format
*/
void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
const AVPixFmtDescriptor *pixdesc);
@@ -63,15 +66,35 @@ int av_image_get_linesize(enum AVPixelFormat pix_fmt, int width, int plane);
* width width.
*
* @param linesizes array to be filled with the linesize for each plane
+ * @param pix_fmt the AVPixelFormat of the image
+ * @param width width of the image in pixels
* @return >= 0 in case of success, a negative error code otherwise
*/
int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width);
+/**
+ * Fill plane sizes for an image with pixel format pix_fmt and height height.
+ *
+ * @param size the array to be filled with the size of each image plane
+ * @param pix_fmt the AVPixelFormat of the image
+ * @param height height of the image in pixels
+ * @param linesizes the array containing the linesize for each
+ * plane, should be filled by av_image_fill_linesizes()
+ * @return >= 0 in case of success, a negative error code otherwise
+ *
+ * @note The linesize parameters have the type ptrdiff_t here, while they are
+ * int for av_image_fill_linesizes().
+ */
+int av_image_fill_plane_sizes(size_t size[4], enum AVPixelFormat pix_fmt,
+ int height, const ptrdiff_t linesizes[4]);
+
/**
* Fill plane data pointers for an image with pixel format pix_fmt and
* height height.
*
* @param data pointers array to be filled with the pointer for each image plane
+ * @param pix_fmt the AVPixelFormat of the image
+ * @param height height of the image in pixels
* @param ptr the pointer to a buffer which will contain the image
* @param linesizes the array containing the linesize for each
* plane, should be filled by av_image_fill_linesizes()
@@ -87,6 +110,11 @@ int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int hei
* The allocated image buffer has to be freed by using
* av_freep(&pointers[0]).
*
+ * @param pointers array to be filled with the pointer for each image plane
+ * @param linesizes the array filled with the linesize for each plane
+ * @param w width of the image in pixels
+ * @param h height of the image in pixels
+ * @param pix_fmt the AVPixelFormat of the image
* @param align the value to use for buffer size alignment
* @return the size in bytes required for the image buffer, a negative
* error code in case of failure
@@ -103,23 +131,65 @@ int av_image_alloc(uint8_t *pointers[4], int linesizes[4],
* bytewidth must be contained by both absolute values of dst_linesize
* and src_linesize, otherwise the function behavior is undefined.
*
+ * @param dst destination plane to copy to
* @param dst_linesize linesize for the image plane in dst
+ * @param src source plane to copy from
* @param src_linesize linesize for the image plane in src
+ * @param height height (number of lines) of the plane
*/
void av_image_copy_plane(uint8_t *dst, int dst_linesize,
const uint8_t *src, int src_linesize,
int bytewidth, int height);
+/**
+ * Copy image data located in uncacheable (e.g. GPU mapped) memory. Where
+ * available, this function will use special functionality for reading from such
+ * memory, which may result in greatly improved performance compared to plain
+ * av_image_copy_plane().
+ *
+ * bytewidth must be contained by both absolute values of dst_linesize
+ * and src_linesize, otherwise the function behavior is undefined.
+ *
+ * @note The linesize parameters have the type ptrdiff_t here, while they are
+ * int for av_image_copy_plane().
+ * @note On x86, the linesizes currently need to be aligned to the cacheline
+ * size (i.e. 64) to get improved performance.
+ */
+void av_image_copy_plane_uc_from(uint8_t *dst, ptrdiff_t dst_linesize,
+ const uint8_t *src, ptrdiff_t src_linesize,
+ ptrdiff_t bytewidth, int height);
+
/**
* Copy image in src_data to dst_data.
*
+ * @param dst_data destination image data buffer to copy to
* @param dst_linesizes linesizes for the image in dst_data
+ * @param src_data source image data buffer to copy from
* @param src_linesizes linesizes for the image in src_data
+ * @param pix_fmt the AVPixelFormat of the image
+ * @param width width of the image in pixels
+ * @param height height of the image in pixels
*/
-void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
- const uint8_t *src_data[4], const int src_linesizes[4],
+void av_image_copy(uint8_t * const dst_data[4], const int dst_linesizes[4],
+ const uint8_t * const src_data[4], const int src_linesizes[4],
enum AVPixelFormat pix_fmt, int width, int height);
+/**
+ * Wrapper around av_image_copy() to workaround the limitation
+ * that the conversion from uint8_t * const * to const uint8_t * const *
+ * is not performed automatically in C.
+ * @see av_image_copy()
+ */
+static inline
+void av_image_copy2(uint8_t * const dst_data[4], const int dst_linesizes[4],
+ uint8_t * const src_data[4], const int src_linesizes[4],
+ enum AVPixelFormat pix_fmt, int width, int height)
+{
+ av_image_copy(dst_data, dst_linesizes,
+ (const uint8_t * const *)src_data, src_linesizes,
+ pix_fmt, width, height);
+}
+
/**
* Copy image data located in uncacheable (e.g. GPU mapped) memory. Where
* available, this function will use special functionality for reading from such
@@ -134,8 +204,8 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
* @note On x86, the linesizes currently need to be aligned to the cacheline
* size (i.e. 64) to get improved performance.
*/
-void av_image_copy_uc_from(uint8_t *dst_data[4], const ptrdiff_t dst_linesizes[4],
- const uint8_t *src_data[4], const ptrdiff_t src_linesizes[4],
+void av_image_copy_uc_from(uint8_t * const dst_data[4], const ptrdiff_t dst_linesizes[4],
+ const uint8_t * const src_data[4], const ptrdiff_t src_linesizes[4],
enum AVPixelFormat pix_fmt, int width, int height);
/**
@@ -265,10 +335,40 @@ int av_image_check_sar(unsigned int w, unsigned int h, AVRational sar);
* @param height the height of the image in pixels
* @return 0 if the image data was cleared, a negative AVERROR code otherwise
*/
-int av_image_fill_black(uint8_t *dst_data[4], const ptrdiff_t dst_linesize[4],
+int av_image_fill_black(uint8_t * const dst_data[4], const ptrdiff_t dst_linesize[4],
enum AVPixelFormat pix_fmt, enum AVColorRange range,
int width, int height);
+/**
+ * Overwrite the image data with a color. This is suitable for filling a
+ * sub-rectangle of an image, meaning the padding between the right most pixel
+ * and the left most pixel on the next line will not be overwritten. For some
+ * formats, the image size might be rounded up due to inherent alignment.
+ *
+ * If the pixel format has alpha, it is also replaced. Color component values
+ * are interpreted as native integers (or intfloats) regardless of actual pixel
+ * format endianness.
+ *
+ * This can return an error if the pixel format is not supported. Normally, all
+ * non-hwaccel pixel formats should be supported.
+ *
+ * Passing NULL for dst_data is allowed. Then the function returns whether the
+ * operation would have succeeded. (It can return an error if the pix_fmt is
+ * not supported.)
+ *
+ * @param dst_data data pointers to destination image
+ * @param dst_linesize linesizes for the destination image
+ * @param pix_fmt the pixel format of the image
+ * @param color the color components to be used for the fill
+ * @param width the width of the image in pixels
+ * @param height the height of the image in pixels
+ * @param flags currently unused
+ * @return 0 if the image data was filled, a negative AVERROR code otherwise
+ */
+int av_image_fill_color(uint8_t * const dst_data[4], const ptrdiff_t dst_linesize[4],
+ enum AVPixelFormat pix_fmt, const uint32_t color[4],
+ int width, int height, int flags);
+
/**
* @}
*/
diff --git a/ffmpeg/include/libavutil/intreadwrite.h b/ffmpeg/include/libavutil/intreadwrite.h
index 67c763b1..ffd15a15 100644
--- a/ffmpeg/include/libavutil/intreadwrite.h
+++ b/ffmpeg/include/libavutil/intreadwrite.h
@@ -64,16 +64,12 @@ typedef union {
#include "config.h"
-#if ARCH_ARM
-# include "arm/intreadwrite.h"
-#elif ARCH_AVR32
-# include "avr32/intreadwrite.h"
+#if ARCH_AARCH64
+# include "aarch64/intreadwrite.h"
#elif ARCH_MIPS
# include "mips/intreadwrite.h"
#elif ARCH_PPC
# include "ppc/intreadwrite.h"
-#elif ARCH_TOMI
-# include "tomi/intreadwrite.h"
#elif ARCH_X86
# include "x86/intreadwrite.h"
#endif
@@ -215,7 +211,7 @@ typedef union {
* by per-arch headers.
*/
-#if defined(__GNUC__)
+#if defined(__GNUC__) || defined(__clang__)
union unaligned_64 { uint64_t l; } __attribute__((packed)) av_alias;
union unaligned_32 { uint32_t l; } __attribute__((packed)) av_alias;
@@ -542,6 +538,60 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
# define AV_WN64A(p, v) AV_WNA(64, p, v)
#endif
+#if AV_HAVE_BIGENDIAN
+# define AV_RLA(s, p) av_bswap##s(AV_RN##s##A(p))
+# define AV_WLA(s, p, v) AV_WN##s##A(p, av_bswap##s(v))
+# define AV_RBA(s, p) AV_RN##s##A(p)
+# define AV_WBA(s, p, v) AV_WN##s##A(p, v)
+#else
+# define AV_RLA(s, p) AV_RN##s##A(p)
+# define AV_WLA(s, p, v) AV_WN##s##A(p, v)
+# define AV_RBA(s, p) av_bswap##s(AV_RN##s##A(p))
+# define AV_WBA(s, p, v) AV_WN##s##A(p, av_bswap##s(v))
+#endif
+
+#ifndef AV_RL16A
+# define AV_RL16A(p) AV_RLA(16, p)
+#endif
+#ifndef AV_WL16A
+# define AV_WL16A(p, v) AV_WLA(16, p, v)
+#endif
+
+#ifndef AV_RB16A
+# define AV_RB16A(p) AV_RBA(16, p)
+#endif
+#ifndef AV_WB16A
+# define AV_WB16A(p, v) AV_WBA(16, p, v)
+#endif
+
+#ifndef AV_RL32A
+# define AV_RL32A(p) AV_RLA(32, p)
+#endif
+#ifndef AV_WL32A
+# define AV_WL32A(p, v) AV_WLA(32, p, v)
+#endif
+
+#ifndef AV_RB32A
+# define AV_RB32A(p) AV_RBA(32, p)
+#endif
+#ifndef AV_WB32A
+# define AV_WB32A(p, v) AV_WBA(32, p, v)
+#endif
+
+#ifndef AV_RL64A
+# define AV_RL64A(p) AV_RLA(64, p)
+#endif
+#ifndef AV_WL64A
+# define AV_WL64A(p, v) AV_WLA(64, p, v)
+#endif
+
+#ifndef AV_RB64A
+# define AV_RB64A(p) AV_RBA(64, p)
+#endif
+#ifndef AV_WB64A
+# define AV_WB64A(p, v) AV_WBA(64, p, v)
+#endif
+
/*
* The AV_COPYxxU macros are suitable for copying data to/from unaligned
* memory locations.
@@ -570,9 +620,7 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
#endif
/* Parameters for AV_COPY*, AV_SWAP*, AV_ZERO* must be
- * naturally aligned. They may be implemented using MMX,
- * so emms_c() must be called before using any float code
- * afterwards.
+ * naturally aligned.
*/
#define AV_COPY(n, d, s) \
diff --git a/ffmpeg/include/libavutil/lfg.h b/ffmpeg/include/libavutil/lfg.h
index 03f779ad..e75a986f 100644
--- a/ffmpeg/include/libavutil/lfg.h
+++ b/ffmpeg/include/libavutil/lfg.h
@@ -24,6 +24,12 @@
#include
+/**
+ * Context structure for the Lagged Fibonacci PRNG.
+ * The exact layout, types and content of this struct may change and should
+ * not be accessed directly. Only its `sizeof()` is guaranteed to stay the same
+ * to allow easy instanciation.
+ */
typedef struct AVLFG {
unsigned int state[64];
int index;
@@ -34,7 +40,7 @@ void av_lfg_init(AVLFG *c, unsigned int seed);
/**
* Seed the state of the ALFG using binary data.
*
- * Return value: 0 on success, negative value (AVERROR) on failure.
+ * @return 0 on success, negative value (AVERROR) on failure.
*/
int av_lfg_init_from_data(AVLFG *c, const uint8_t *data, unsigned int length);
@@ -45,8 +51,9 @@ int av_lfg_init_from_data(AVLFG *c, const uint8_t *data, unsigned int length);
* it may be good enough and faster for your specific use case.
*/
static inline unsigned int av_lfg_get(AVLFG *c){
- c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63];
- return c->state[c->index++ & 63];
+ unsigned a = c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63];
+ c->index += 1U;
+ return a;
}
/**
@@ -57,13 +64,16 @@ static inline unsigned int av_lfg_get(AVLFG *c){
static inline unsigned int av_mlfg_get(AVLFG *c){
unsigned int a= c->state[(c->index-55) & 63];
unsigned int b= c->state[(c->index-24) & 63];
- return c->state[c->index++ & 63] = 2*a*b+a+b;
+ a = c->state[c->index & 63] = 2*a*b+a+b;
+ c->index += 1U;
+ return a;
}
/**
* Get the next two numbers generated by a Box-Muller Gaussian
* generator using the random numbers issued by lfg.
*
+ * @param lfg pointer to the contex structure
* @param out array where the two generated numbers are placed
*/
void av_bmg_get(AVLFG *lfg, double out[2]);
diff --git a/ffmpeg/include/libavutil/log.h b/ffmpeg/include/libavutil/log.h
index d9554e60..ab7ceabe 100644
--- a/ffmpeg/include/libavutil/log.h
+++ b/ffmpeg/include/libavutil/log.h
@@ -22,7 +22,6 @@
#define AVUTIL_LOG_H
#include
-#include "avutil.h"
#include "attributes.h"
#include "version.h"
@@ -107,21 +106,6 @@ typedef struct AVClass {
*/
int parent_log_context_offset;
- /**
- * Return next AVOptions-enabled child or NULL
- */
- void* (*child_next)(void *obj, void *prev);
-
- /**
- * Return an AVClass corresponding to the next potential
- * AVOptions-enabled child.
- *
- * The difference between child_next and this is that
- * child_next iterates over _already existing_ objects, while
- * child_class_next iterates over _all possible_ children.
- */
- const struct AVClass* (*child_class_next)(const struct AVClass *prev);
-
/**
* Category used for visualization (like color)
* This is only set if the category is equal for all objects using this class.
@@ -140,6 +124,26 @@ typedef struct AVClass {
* available since version (52.12)
*/
int (*query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags);
+
+ /**
+ * Return next AVOptions-enabled child or NULL
+ */
+ void* (*child_next)(void *obj, void *prev);
+
+ /**
+ * Iterate over the AVClasses corresponding to potential AVOptions-enabled
+ * children.
+ *
+ * @param iter pointer to opaque iteration state. The caller must initialize
+ * *iter to NULL before the first call.
+ * @return AVClass for the next AVOptions-enabled child or NULL if there are
+ * no more such children.
+ *
+ * @note The difference between child_next and this is that child_next
+ * iterates over _already existing_ objects, while child_class_iterate
+ * iterates over _all possible_ children.
+ */
+ const struct AVClass* (*child_class_iterate)(void **iter);
} AVClass;
/**
@@ -233,6 +237,27 @@ typedef struct AVClass {
*/
void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4);
+/**
+ * Send the specified message to the log once with the initial_level and then with
+ * the subsequent_level. By default, all logging messages are sent to
+ * stderr. This behavior can be altered by setting a different logging callback
+ * function.
+ * @see av_log
+ *
+ * @param avcl A pointer to an arbitrary struct of which the first field is a
+ * pointer to an AVClass struct or NULL if general log.
+ * @param initial_level importance level of the message expressed using a @ref
+ * lavu_log_constants "Logging Constant" for the first occurance.
+ * @param subsequent_level importance level of the message expressed using a @ref
+ * lavu_log_constants "Logging Constant" after the first occurance.
+ * @param fmt The format string (printf-compatible) that specifies how
+ * subsequent arguments are converted to output.
+ * @param state a variable to keep trak of if a message has already been printed
+ * this must be initialized to 0 before the first use. The same state
+ * must not be accessed by 2 Threads simultaneously.
+ */
+void av_log_once(void* avcl, int initial_level, int subsequent_level, int *state, const char *fmt, ...) av_printf_format(5, 6);
+
/**
* Send the specified message to the log if the level is less than or equal
diff --git a/ffmpeg/include/libavutil/macros.h b/ffmpeg/include/libavutil/macros.h
index 2007ee56..2a7567c3 100644
--- a/ffmpeg/include/libavutil/macros.h
+++ b/ffmpeg/include/libavutil/macros.h
@@ -25,6 +25,36 @@
#ifndef AVUTIL_MACROS_H
#define AVUTIL_MACROS_H
+#include "libavutil/avconfig.h"
+
+#if AV_HAVE_BIGENDIAN
+# define AV_NE(be, le) (be)
+#else
+# define AV_NE(be, le) (le)
+#endif
+
+/**
+ * Comparator.
+ * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0
+ * if x == y. This is useful for instance in a qsort comparator callback.
+ * Furthermore, compilers are able to optimize this to branchless code, and
+ * there is no risk of overflow with signed types.
+ * As with many macros, this evaluates its argument multiple times, it thus
+ * must not have a side-effect.
+ */
+#define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y)))
+
+#define FFMAX(a,b) ((a) > (b) ? (a) : (b))
+#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c)
+#define FFMIN(a,b) ((a) > (b) ? (b) : (a))
+#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c)
+
+#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)
+#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
+
+#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24))
+#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24))
+
/**
* @addtogroup preproc_misc Preprocessor String Macros
*
diff --git a/ffmpeg/include/libavutil/mastering_display_metadata.h b/ffmpeg/include/libavutil/mastering_display_metadata.h
index c23b07c3..52fcef9e 100644
--- a/ffmpeg/include/libavutil/mastering_display_metadata.h
+++ b/ffmpeg/include/libavutil/mastering_display_metadata.h
@@ -77,6 +77,15 @@ typedef struct AVMasteringDisplayMetadata {
*/
AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc(void);
+/**
+ * Allocate an AVMasteringDisplayMetadata structure and set its fields to
+ * default values. The resulting struct can be freed using av_freep().
+ *
+ * @return An AVMasteringDisplayMetadata filled with default values or NULL
+ * on failure.
+ */
+AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc_size(size_t *size);
+
/**
* Allocate a complete AVMasteringDisplayMetadata and add it to the frame.
*
diff --git a/ffmpeg/include/libavutil/mathematics.h b/ffmpeg/include/libavutil/mathematics.h
index 54901800..e213bab6 100644
--- a/ffmpeg/include/libavutil/mathematics.h
+++ b/ffmpeg/include/libavutil/mathematics.h
@@ -36,30 +36,81 @@
#ifndef M_E
#define M_E 2.7182818284590452354 /* e */
#endif
+#ifndef M_Ef
+#define M_Ef 2.7182818284590452354f /* e */
+#endif
#ifndef M_LN2
#define M_LN2 0.69314718055994530942 /* log_e 2 */
#endif
+#ifndef M_LN2f
+#define M_LN2f 0.69314718055994530942f /* log_e 2 */
+#endif
#ifndef M_LN10
#define M_LN10 2.30258509299404568402 /* log_e 10 */
#endif
+#ifndef M_LN10f
+#define M_LN10f 2.30258509299404568402f /* log_e 10 */
+#endif
#ifndef M_LOG2_10
#define M_LOG2_10 3.32192809488736234787 /* log_2 10 */
#endif
+#ifndef M_LOG2_10f
+#define M_LOG2_10f 3.32192809488736234787f /* log_2 10 */
+#endif
#ifndef M_PHI
#define M_PHI 1.61803398874989484820 /* phi / golden ratio */
#endif
+#ifndef M_PHIf
+#define M_PHIf 1.61803398874989484820f /* phi / golden ratio */
+#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846 /* pi */
#endif
+#ifndef M_PIf
+#define M_PIf 3.14159265358979323846f /* pi */
+#endif
#ifndef M_PI_2
#define M_PI_2 1.57079632679489661923 /* pi/2 */
#endif
+#ifndef M_PI_2f
+#define M_PI_2f 1.57079632679489661923f /* pi/2 */
+#endif
+#ifndef M_PI_4
+#define M_PI_4 0.78539816339744830962 /* pi/4 */
+#endif
+#ifndef M_PI_4f
+#define M_PI_4f 0.78539816339744830962f /* pi/4 */
+#endif
+#ifndef M_1_PI
+#define M_1_PI 0.31830988618379067154 /* 1/pi */
+#endif
+#ifndef M_1_PIf
+#define M_1_PIf 0.31830988618379067154f /* 1/pi */
+#endif
+#ifndef M_2_PI
+#define M_2_PI 0.63661977236758134308 /* 2/pi */
+#endif
+#ifndef M_2_PIf
+#define M_2_PIf 0.63661977236758134308f /* 2/pi */
+#endif
+#ifndef M_2_SQRTPI
+#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
+#endif
+#ifndef M_2_SQRTPIf
+#define M_2_SQRTPIf 1.12837916709551257390f /* 2/sqrt(pi) */
+#endif
#ifndef M_SQRT1_2
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
#endif
+#ifndef M_SQRT1_2f
+#define M_SQRT1_2f 0.70710678118654752440f /* 1/sqrt(2) */
+#endif
#ifndef M_SQRT2
#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
#endif
+#ifndef M_SQRT2f
+#define M_SQRT2f 1.41421356237309504880f /* sqrt(2) */
+#endif
#ifndef NAN
#define NAN av_int2float(0x7fc00000)
#endif
@@ -111,7 +162,8 @@ enum AVRounding {
/**
* Compute the greatest common divisor of two integer operands.
*
- * @param a,b Operands
+ * @param a Operand
+ * @param b Operand
* @return GCD of a and b up to sign; if a >= 0 and b >= 0, return value is >= 0;
* if a == 0 and b == 0, returns 0.
*/
@@ -134,6 +186,7 @@ int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const;
*
* The operation is mathematically equivalent to `a * b / c`, but writing that
* directly can overflow, and does not support different rounding methods.
+ * If the result is not representable then INT64_MIN is returned.
*
* @see av_rescale(), av_rescale_q(), av_rescale_q_rnd()
*/
@@ -185,7 +238,8 @@ int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b);
* av_compare_mod(0x11, 0x02, 0x20) > 0 // since 0x11 % 0x20 (0x11) > 0x02 % 0x20 (0x02)
* @endcode
*
- * @param a,b Operands
+ * @param a Operand
+ * @param b Operand
* @param mod Divisor; must be a power of 2
* @return
* - a negative value if `a % mod < b % mod`
@@ -234,6 +288,10 @@ int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts, AVRational fs_tb, int
*/
int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t inc);
+/**
+ * 0th order modified bessel function of the first kind.
+ */
+double av_bessel_i0(double x);
/**
* @}
diff --git a/ffmpeg/include/libavutil/md5.h b/ffmpeg/include/libavutil/md5.h
index ca72ccbf..fc2eabdb 100644
--- a/ffmpeg/include/libavutil/md5.h
+++ b/ffmpeg/include/libavutil/md5.h
@@ -31,7 +31,6 @@
#include
#include "attributes.h"
-#include "version.h"
/**
* @defgroup lavu_md5 MD5
@@ -64,11 +63,7 @@ void av_md5_init(struct AVMD5 *ctx);
* @param src input data to update hash with
* @param len input data length
*/
-#if FF_API_CRYPTO_SIZE_T
-void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, int len);
-#else
void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, size_t len);
-#endif
/**
* Finish hashing and output digest value.
@@ -85,11 +80,7 @@ void av_md5_final(struct AVMD5 *ctx, uint8_t *dst);
* @param src The data to hash
* @param len The length of the data, in bytes
*/
-#if FF_API_CRYPTO_SIZE_T
-void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len);
-#else
void av_md5_sum(uint8_t *dst, const uint8_t *src, size_t len);
-#endif
/**
* @}
diff --git a/ffmpeg/include/libavutil/mem.h b/ffmpeg/include/libavutil/mem.h
index 7e0b12a8..ab7648ac 100644
--- a/ffmpeg/include/libavutil/mem.h
+++ b/ffmpeg/include/libavutil/mem.h
@@ -27,12 +27,10 @@
#ifndef AVUTIL_MEM_H
#define AVUTIL_MEM_H
-#include
+#include
#include
#include "attributes.h"
-#include "error.h"
-#include "avutil.h"
/**
* @addtogroup lavu_mem
@@ -49,81 +47,6 @@
* dealing with memory consistently possible on all platforms.
*
* @{
- *
- * @defgroup lavu_mem_macros Alignment Macros
- * Helper macros for declaring aligned variables.
- * @{
- */
-
-/**
- * @def DECLARE_ALIGNED(n,t,v)
- * Declare a variable that is aligned in memory.
- *
- * @code{.c}
- * DECLARE_ALIGNED(16, uint16_t, aligned_int) = 42;
- * DECLARE_ALIGNED(32, uint8_t, aligned_array)[128];
- *
- * // The default-alignment equivalent would be
- * uint16_t aligned_int = 42;
- * uint8_t aligned_array[128];
- * @endcode
- *
- * @param n Minimum alignment in bytes
- * @param t Type of the variable (or array element)
- * @param v Name of the variable
- */
-
-/**
- * @def DECLARE_ASM_ALIGNED(n,t,v)
- * Declare an aligned variable appropriate for use in inline assembly code.
- *
- * @code{.c}
- * DECLARE_ASM_ALIGNED(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008);
- * @endcode
- *
- * @param n Minimum alignment in bytes
- * @param t Type of the variable (or array element)
- * @param v Name of the variable
- */
-
-/**
- * @def DECLARE_ASM_CONST(n,t,v)
- * Declare a static constant aligned variable appropriate for use in inline
- * assembly code.
- *
- * @code{.c}
- * DECLARE_ASM_CONST(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008);
- * @endcode
- *
- * @param n Minimum alignment in bytes
- * @param t Type of the variable (or array element)
- * @param v Name of the variable
- */
-
-#if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C)
- #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
-#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_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
-#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
- #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v
-#else
- #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
-#endif
-
-/**
- * @}
*/
/**
@@ -232,20 +155,12 @@ av_alloc_size(1, 2) void *av_malloc_array(size_t nmemb, size_t size);
* @see av_mallocz()
* @see av_malloc_array()
*/
-av_alloc_size(1, 2) void *av_mallocz_array(size_t nmemb, size_t size);
-
-/**
- * Non-inlined equivalent of av_mallocz_array().
- *
- * Created for symmetry with the calloc() C function.
- */
-void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib;
+void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib av_alloc_size(1, 2);
/**
* Allocate, reallocate, or free a block of memory.
*
- * If `ptr` is `NULL` and `size` > 0, allocate a new block. If `size` is
- * zero, free the memory block pointed to by `ptr`. Otherwise, expand or
+ * If `ptr` is `NULL` and `size` > 0, allocate a new block. Otherwise, expand or
* shrink that block of memory according to `size`.
*
* @param ptr Pointer to a memory block already allocated with
@@ -254,10 +169,11 @@ void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib;
* reallocated
*
* @return Pointer to a newly-reallocated block or `NULL` if the block
- * cannot be reallocated or the function is used to free the memory block
+ * cannot be reallocated
*
* @warning Unlike av_malloc(), the returned pointer is not guaranteed to be
- * correctly aligned.
+ * correctly aligned. The returned pointer must be freed after even
+ * if size is zero.
* @see av_fast_realloc()
* @see av_reallocp()
*/
@@ -305,8 +221,7 @@ void *av_realloc_f(void *ptr, size_t nelem, size_t elsize);
/**
* Allocate, reallocate, or free an array.
*
- * If `ptr` is `NULL` and `nmemb` > 0, allocate a new block. If
- * `nmemb` is zero, free the memory block pointed to by `ptr`.
+ * If `ptr` is `NULL` and `nmemb` > 0, allocate a new block.
*
* @param ptr Pointer to a memory block already allocated with
* av_realloc() or `NULL`
@@ -314,19 +229,19 @@ void *av_realloc_f(void *ptr, size_t nelem, size_t elsize);
* @param size Size of the single element of the array
*
* @return Pointer to a newly-reallocated block or NULL if the block
- * cannot be reallocated or the function is used to free the memory block
+ * cannot be reallocated
*
* @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
- * correctly aligned.
+ * correctly aligned. The returned pointer must be freed after even if
+ * nmemb is zero.
* @see av_reallocp_array()
*/
av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size);
/**
- * Allocate, reallocate, or free an array through a pointer to a pointer.
+ * Allocate, reallocate an array through a pointer to a pointer.
*
- * If `*ptr` is `NULL` and `nmemb` > 0, allocate a new block. If `nmemb` is
- * zero, free the memory block pointed to by `*ptr`.
+ * If `*ptr` is `NULL` and `nmemb` > 0, allocate a new block.
*
* @param[in,out] ptr Pointer to a pointer to a memory block already
* allocated with av_realloc(), or a pointer to `NULL`.
@@ -337,9 +252,9 @@ av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size)
* @return Zero on success, an AVERROR error code on failure
*
* @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
- * correctly aligned.
+ * correctly aligned. *ptr must be freed after even if nmemb is zero.
*/
-av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
+int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
/**
* Reallocate the given buffer if it is not large enough, otherwise do nothing.
@@ -363,10 +278,10 @@ av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
* @endcode
*
* @param[in,out] ptr Already allocated buffer, or `NULL`
- * @param[in,out] size Pointer to current size of buffer `ptr`. `*size` is
- * changed to `min_size` in case of success or 0 in
- * case of failure
- * @param[in] min_size New size of buffer `ptr`
+ * @param[in,out] size Pointer to the size of buffer `ptr`. `*size` is
+ * updated to the new allocated size, in particular 0
+ * in case of failure.
+ * @param[in] min_size Desired minimal size of buffer `ptr`
* @return `ptr` if the buffer is large enough, a pointer to newly reallocated
* buffer if the buffer was not large enough, or `NULL` in case of
* error
@@ -397,10 +312,10 @@ void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
* @param[in,out] ptr Pointer to pointer to an already allocated buffer.
* `*ptr` will be overwritten with pointer to new
* buffer on success or `NULL` on failure
- * @param[in,out] size Pointer to current size of buffer `*ptr`. `*size` is
- * changed to `min_size` in case of success or 0 in
- * case of failure
- * @param[in] min_size New size of buffer `*ptr`
+ * @param[in,out] size Pointer to the size of buffer `*ptr`. `*size` is
+ * updated to the new allocated size, in particular 0
+ * in case of failure.
+ * @param[in] min_size Desired minimal size of buffer `*ptr`
* @see av_realloc()
* @see av_fast_mallocz()
*/
@@ -418,10 +333,10 @@ void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);
* @param[in,out] ptr Pointer to pointer to an already allocated buffer.
* `*ptr` will be overwritten with pointer to new
* buffer on success or `NULL` on failure
- * @param[in,out] size Pointer to current size of buffer `*ptr`. `*size` is
- * changed to `min_size` in case of success or 0 in
- * case of failure
- * @param[in] min_size New size of buffer `*ptr`
+ * @param[in,out] size Pointer to the size of buffer `*ptr`. `*size` is
+ * updated to the new allocated size, in particular 0
+ * in case of failure.
+ * @param[in] min_size Desired minimal size of buffer `*ptr`
* @see av_fast_malloc()
*/
void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size);
@@ -662,20 +577,12 @@ void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size,
/**
* Multiply two `size_t` values checking for overflow.
*
- * @param[in] a,b Operands of multiplication
+ * @param[in] a Operand of multiplication
+ * @param[in] b Operand of multiplication
* @param[out] r Pointer to the result of the operation
* @return 0 on success, AVERROR(EINVAL) on overflow
*/
-static inline int av_size_mult(size_t a, size_t b, size_t *r)
-{
- size_t t = a * b;
- /* Hack inspired from glibc: don't try the division if nelem and elsize
- * are both less than sqrt(SIZE_MAX). */
- if ((a | b) >= ((size_t)1 << (sizeof(size_t) * 4)) && a && t / a != b)
- return AVERROR(EINVAL);
- *r = t;
- return 0;
-}
+int av_size_mult(size_t a, size_t b, size_t *r);
/**
* Set the maximum size that may be allocated in one block.
diff --git a/ffmpeg/include/libavutil/murmur3.h b/ffmpeg/include/libavutil/murmur3.h
index 1b09175c..d90bc2fc 100644
--- a/ffmpeg/include/libavutil/murmur3.h
+++ b/ffmpeg/include/libavutil/murmur3.h
@@ -27,10 +27,9 @@
#ifndef AVUTIL_MURMUR3_H
#define AVUTIL_MURMUR3_H
+#include
#include
-#include "version.h"
-
/**
* @defgroup lavu_murmur3 Murmur3
* @ingroup lavu_hash
@@ -99,11 +98,7 @@ void av_murmur3_init(struct AVMurMur3 *c);
* @param[in] src Input data to update hash with
* @param[in] len Number of bytes to read from `src`
*/
-#if FF_API_CRYPTO_SIZE_T
-void av_murmur3_update(struct AVMurMur3 *c, const uint8_t *src, int len);
-#else
void av_murmur3_update(struct AVMurMur3 *c, const uint8_t *src, size_t len);
-#endif
/**
* Finish hashing and output digest value.
diff --git a/ffmpeg/include/libavutil/opt.h b/ffmpeg/include/libavutil/opt.h
index 39f4a8dd..be189f76 100644
--- a/ffmpeg/include/libavutil/opt.h
+++ b/ffmpeg/include/libavutil/opt.h
@@ -29,11 +29,11 @@
#include "rational.h"
#include "avutil.h"
+#include "channel_layout.h"
#include "dict.h"
#include "log.h"
#include "pixfmt.h"
#include "samplefmt.h"
-#include "version.h"
/**
* @defgroup avoptions AVOptions
@@ -43,6 +43,26 @@
* ("objects"). An option can have a help text, a type and a range of possible
* values. Options may then be enumerated, read and written to.
*
+ * There are two modes of access to members of AVOption and its child structs.
+ * One is called 'native access', and refers to access from the code that
+ * declares the AVOption in question. The other is 'foreign access', and refers
+ * to access from other code.
+ *
+ * Certain struct members in this header are documented as 'native access only'
+ * or similar - it means that only the code that declared the AVOption in
+ * question is allowed to access the field. This allows us to extend the
+ * semantics of those fields without breaking API compatibility.
+ *
+ * @section avoptions_scope Scope of AVOptions
+ *
+ * AVOptions is designed to support any set of multimedia configuration options
+ * that can be defined at compile-time. Although it is mainly used to expose
+ * FFmpeg options, you are welcome to adapt it to your own use case.
+ *
+ * No single approach can ever fully solve the problem of configuration,
+ * but please submit a patch if you believe you have found a problem
+ * that is best solved by extending AVOptions.
+ *
* @section avoptions_implement Implementing AVOptions
* This section describes how to add AVOptions capabilities to a struct.
*
@@ -114,7 +134,7 @@
* libavcodec exports generic options, while its priv_data field exports
* codec-specific options). In such a case, it is possible to set up the
* parent struct to export a child's options. To do that, simply
- * implement AVClass.child_next() and AVClass.child_class_next() in the
+ * implement AVClass.child_next() and AVClass.child_class_iterate() in the
* parent struct's AVClass.
* Assuming that the test_struct from above now also contains a
* child_struct field:
@@ -143,23 +163,25 @@
* return t->child_struct;
* return NULL
* }
- * const AVClass child_class_next(const AVClass *prev)
+ * const AVClass child_class_iterate(void **iter)
* {
- * return prev ? NULL : &child_class;
+ * const AVClass *c = *iter ? NULL : &child_class;
+ * *iter = (void*)(uintptr_t)c;
+ * return c;
* }
* @endcode
- * Putting child_next() and child_class_next() as defined above into
+ * Putting child_next() and child_class_iterate() as defined above into
* test_class will now make child_struct's options accessible through
* test_struct (again, proper setup as described above needs to be done on
* child_struct right after it is created).
*
* From the above example it might not be clear why both child_next()
- * and child_class_next() are needed. The distinction is that child_next()
- * iterates over actually existing objects, while child_class_next()
+ * and child_class_iterate() are needed. The distinction is that child_next()
+ * iterates over actually existing objects, while child_class_iterate()
* iterates over all possible child classes. E.g. if an AVCodecContext
* was initialized to use a codec which has private options, then its
* child_next() will return AVCodecContext.priv_data and finish
- * iterating. OTOH child_class_next() on AVCodecContext.av_class will
+ * iterating. OTOH child_class_iterate() on AVCodecContext.av_class will
* iterate over all available codecs with private options.
*
* @subsection avoptions_implement_named_constants Named constants
@@ -194,7 +216,7 @@
* For enumerating there are basically two cases. The first is when you want to
* get all options that may potentially exist on the struct and its children
* (e.g. when constructing documentation). In that case you should call
- * av_opt_child_class_next() recursively on the parent struct's AVClass. The
+ * av_opt_child_class_iterate() recursively on the parent struct's AVClass. The
* second case is when you have an already initialized struct with all its
* children and you want to get all options that can be actually written or read
* from it. In that case you should call av_opt_child_next() recursively (and
@@ -218,28 +240,189 @@
* before the file is actually opened.
*/
+/**
+ * An option type determines:
+ * - for native access, the underlying C type of the field that an AVOption
+ * refers to;
+ * - for foreign access, the semantics of accessing the option through this API,
+ * e.g. which av_opt_get_*() and av_opt_set_*() functions can be called, or
+ * what format will av_opt_get()/av_opt_set() expect/produce.
+ */
enum AVOptionType{
- AV_OPT_TYPE_FLAGS,
+ /**
+ * Underlying C type is unsigned int.
+ */
+ AV_OPT_TYPE_FLAGS = 1,
+ /**
+ * Underlying C type is int.
+ */
AV_OPT_TYPE_INT,
+ /**
+ * Underlying C type is int64_t.
+ */
AV_OPT_TYPE_INT64,
+ /**
+ * Underlying C type is double.
+ */
AV_OPT_TYPE_DOUBLE,
+ /**
+ * Underlying C type is float.
+ */
AV_OPT_TYPE_FLOAT,
+ /**
+ * Underlying C type is a uint8_t* that is either NULL or points to a C
+ * string allocated with the av_malloc() family of functions.
+ */
AV_OPT_TYPE_STRING,
+ /**
+ * Underlying C type is AVRational.
+ */
AV_OPT_TYPE_RATIONAL,
- AV_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length
+ /**
+ * Underlying C type is a uint8_t* that is either NULL or points to an array
+ * allocated with the av_malloc() family of functions. The pointer is
+ * immediately followed by an int containing the array length in bytes.
+ */
+ AV_OPT_TYPE_BINARY,
+ /**
+ * Underlying C type is AVDictionary*.
+ */
AV_OPT_TYPE_DICT,
+ /**
+ * Underlying C type is uint64_t.
+ */
AV_OPT_TYPE_UINT64,
+ /**
+ * Special option type for declaring named constants. Does not correspond to
+ * an actual field in the object, offset must be 0.
+ */
AV_OPT_TYPE_CONST,
- AV_OPT_TYPE_IMAGE_SIZE, ///< offset must point to two consecutive integers
+ /**
+ * Underlying C type is two consecutive integers.
+ */
+ AV_OPT_TYPE_IMAGE_SIZE,
+ /**
+ * Underlying C type is enum AVPixelFormat.
+ */
AV_OPT_TYPE_PIXEL_FMT,
+ /**
+ * Underlying C type is enum AVSampleFormat.
+ */
AV_OPT_TYPE_SAMPLE_FMT,
- AV_OPT_TYPE_VIDEO_RATE, ///< offset must point to AVRational
+ /**
+ * Underlying C type is AVRational.
+ */
+ AV_OPT_TYPE_VIDEO_RATE,
+ /**
+ * Underlying C type is int64_t.
+ */
AV_OPT_TYPE_DURATION,
+ /**
+ * Underlying C type is uint8_t[4].
+ */
AV_OPT_TYPE_COLOR,
- AV_OPT_TYPE_CHANNEL_LAYOUT,
+ /**
+ * Underlying C type is int.
+ */
AV_OPT_TYPE_BOOL,
+ /**
+ * Underlying C type is AVChannelLayout.
+ */
+ AV_OPT_TYPE_CHLAYOUT,
+ /**
+ * Underlying C type is unsigned int.
+ */
+ AV_OPT_TYPE_UINT,
+
+ /**
+ * May be combined with another regular option type to declare an array
+ * option.
+ *
+ * For array options, @ref AVOption.offset should refer to a pointer
+ * corresponding to the option type. The pointer should be immediately
+ * followed by an unsigned int that will store the number of elements in the
+ * array.
+ */
+ AV_OPT_TYPE_FLAG_ARRAY = (1 << 16),
};
+/**
+ * A generic parameter which can be set by the user for muxing or encoding.
+ */
+#define AV_OPT_FLAG_ENCODING_PARAM (1 << 0)
+/**
+ * A generic parameter which can be set by the user for demuxing or decoding.
+ */
+#define AV_OPT_FLAG_DECODING_PARAM (1 << 1)
+#define AV_OPT_FLAG_AUDIO_PARAM (1 << 3)
+#define AV_OPT_FLAG_VIDEO_PARAM (1 << 4)
+#define AV_OPT_FLAG_SUBTITLE_PARAM (1 << 5)
+/**
+ * The option is intended for exporting values to the caller.
+ */
+#define AV_OPT_FLAG_EXPORT (1 << 6)
+/**
+ * The option may not be set through the AVOptions API, only read.
+ * This flag only makes sense when AV_OPT_FLAG_EXPORT is also set.
+ */
+#define AV_OPT_FLAG_READONLY (1 << 7)
+/**
+ * A generic parameter which can be set by the user for bit stream filtering.
+ */
+#define AV_OPT_FLAG_BSF_PARAM (1 << 8)
+
+/**
+ * A generic parameter which can be set by the user at runtime.
+ */
+#define AV_OPT_FLAG_RUNTIME_PARAM (1 << 15)
+/**
+ * A generic parameter which can be set by the user for filtering.
+ */
+#define AV_OPT_FLAG_FILTERING_PARAM (1 << 16)
+/**
+ * Set if option is deprecated, users should refer to AVOption.help text for
+ * more information.
+ */
+#define AV_OPT_FLAG_DEPRECATED (1 << 17)
+/**
+ * Set if option constants can also reside in child objects.
+ */
+#define AV_OPT_FLAG_CHILD_CONSTS (1 << 18)
+
+/**
+ * May be set as default_val for AV_OPT_TYPE_FLAG_ARRAY options.
+ */
+typedef struct AVOptionArrayDef {
+ /**
+ * Native access only.
+ *
+ * Default value of the option, as would be serialized by av_opt_get() (i.e.
+ * using the value of sep as the separator).
+ */
+ const char *def;
+
+ /**
+ * Minimum number of elements in the array. When this field is non-zero, def
+ * must be non-NULL and contain at least this number of elements.
+ */
+ unsigned size_min;
+ /**
+ * Maximum number of elements in the array, 0 when unlimited.
+ */
+ unsigned size_max;
+
+ /**
+ * Separator between array elements in string representations of this
+ * option, used by av_opt_set() and av_opt_get(). It must be a printable
+ * ASCII character, excluding alphanumeric and the backslash. A comma is
+ * used when sep=0.
+ *
+ * The separator and the backslash must be backslash-escaped in order to
+ * appear in string representations of the option value.
+ */
+ char sep;
+} AVOptionArrayDef;
+
/**
* AVOption
*/
@@ -253,6 +436,8 @@ typedef struct AVOption {
const char *help;
/**
+ * Native access only.
+ *
* The offset relative to the context structure where the option
* value is stored. It should be 0 for named constants.
*/
@@ -260,6 +445,7 @@ typedef struct AVOption {
enum AVOptionType type;
/**
+ * Native access only, except when documented otherwise.
* the default value for scalar options
*/
union {
@@ -268,29 +454,22 @@ typedef struct AVOption {
const char *str;
/* TODO those are unused now */
AVRational q;
+
+ /**
+ * Used for AV_OPT_TYPE_FLAG_ARRAY options. May be NULL.
+ *
+ * Foreign access to some members allowed, as noted in AVOptionArrayDef
+ * documentation.
+ */
+ const AVOptionArrayDef *arr;
} default_val;
double min; ///< minimum valid value for the option
double max; ///< maximum valid value for the option
+ /**
+ * A combination of AV_OPT_FLAG_*.
+ */
int flags;
-#define AV_OPT_FLAG_ENCODING_PARAM 1 ///< a generic parameter which can be set by the user for muxing or encoding
-#define AV_OPT_FLAG_DECODING_PARAM 2 ///< a generic parameter which can be set by the user for demuxing or decoding
-#define AV_OPT_FLAG_AUDIO_PARAM 8
-#define AV_OPT_FLAG_VIDEO_PARAM 16
-#define AV_OPT_FLAG_SUBTITLE_PARAM 32
-/**
- * The option is intended for exporting values to the caller.
- */
-#define AV_OPT_FLAG_EXPORT 64
-/**
- * The option may not be set through the AVOptions API, only read.
- * This flag only makes sense when AV_OPT_FLAG_EXPORT is also set.
- */
-#define AV_OPT_FLAG_READONLY 128
-#define AV_OPT_FLAG_BSF_PARAM (1<<8) ///< a generic parameter which can be set by the user for bit stream filtering
-#define AV_OPT_FLAG_FILTERING_PARAM (1<<16) ///< a generic parameter which can be set by the user for filtering
-#define AV_OPT_FLAG_DEPRECATED (1<<17) ///< set if option is deprecated, users should refer to AVOption.help text for more information
-//FIXME think about enc-audio, ... style flags
/**
* The logical unit to which the option belongs. Non-constant
@@ -369,15 +548,9 @@ typedef struct AVOptionRanges {
} AVOptionRanges;
/**
- * Show the obj options.
- *
- * @param req_flags requested flags for the options to show. Show only the
- * options for which it is opt->flags & req_flags.
- * @param rej_flags rejected flags for the options to show. Show only the
- * options for which it is !(opt->flags & req_flags).
- * @param av_log_obj log context to use for showing the options
+ * @defgroup opt_mng AVOption (un)initialization and inspection.
+ * @{
*/
-int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags);
/**
* Set the values of all AVOption fields to their default values.
@@ -398,121 +571,143 @@ void av_opt_set_defaults(void *s);
void av_opt_set_defaults2(void *s, int mask, int flags);
/**
- * Parse the key/value pairs list in opts. For each key/value pair
- * found, stores the value in the field in ctx that is named like the
- * key. ctx must be an AVClass context, storing is done using
- * AVOptions.
+ * Free all allocated objects in obj.
+ */
+void av_opt_free(void *obj);
+
+/**
+ * Iterate over all AVOptions belonging to obj.
*
- * @param opts options string to parse, may be NULL
- * @param key_val_sep a 0-terminated list of characters used to
- * separate key from value
- * @param pairs_sep a 0-terminated list of characters used to separate
- * two pairs from each other
- * @return the number of successfully set key/value pairs, or a negative
- * value corresponding to an AVERROR code in case of error:
- * AVERROR(EINVAL) if opts cannot be parsed,
- * the error code issued by av_opt_set() if a key/value pair
- * cannot be set
+ * @param obj an AVOptions-enabled struct or a double pointer to an
+ * AVClass describing it.
+ * @param prev result of the previous call to av_opt_next() on this object
+ * or NULL
+ * @return next AVOption or NULL
*/
-int av_set_options_string(void *ctx, const char *opts,
- const char *key_val_sep, const char *pairs_sep);
+const AVOption *av_opt_next(const void *obj, const AVOption *prev);
/**
- * Parse the key-value pairs list in opts. For each key=value pair found,
- * set the value of the corresponding option in ctx.
+ * Iterate over AVOptions-enabled children of obj.
*
- * @param ctx the AVClass object to set options on
- * @param opts the options string, key-value pairs separated by a
- * delimiter
- * @param shorthand a NULL-terminated array of options names for shorthand
- * notation: if the first field in opts has no key part,
- * the key is taken from the first element of shorthand;
- * then again for the second, etc., until either opts is
- * finished, shorthand is finished or a named option is
- * found; after that, all options must be named
- * @param key_val_sep a 0-terminated list of characters used to separate
- * key from value, for example '='
- * @param pairs_sep a 0-terminated list of characters used to separate
- * two pairs from each other, for example ':' or ','
- * @return the number of successfully set key=value pairs, or a negative
- * value corresponding to an AVERROR code in case of error:
- * AVERROR(EINVAL) if opts cannot be parsed,
- * the error code issued by av_set_string3() if a key/value pair
- * cannot be set
+ * @param prev result of a previous call to this function or NULL
+ * @return next AVOptions-enabled child or NULL
+ */
+void *av_opt_child_next(void *obj, void *prev);
+
+/**
+ * Iterate over potential AVOptions-enabled children of parent.
*
- * Options names must use only the following characters: a-z A-Z 0-9 - . / _
- * Separators must use characters distinct from option names and from each
- * other.
+ * @param iter a pointer where iteration state is stored.
+ * @return AVClass corresponding to next potential child or NULL
*/
-int av_opt_set_from_string(void *ctx, const char *opts,
- const char *const *shorthand,
- const char *key_val_sep, const char *pairs_sep);
+const AVClass *av_opt_child_class_iterate(const AVClass *parent, void **iter);
+
+#define AV_OPT_SEARCH_CHILDREN (1 << 0) /**< Search in possible children of the
+ given object first. */
/**
- * Free all allocated objects in obj.
+ * The obj passed to av_opt_find() is fake -- only a double pointer to AVClass
+ * instead of a required pointer to a struct containing AVClass. This is
+ * useful for searching for options without needing to allocate the corresponding
+ * object.
*/
-void av_opt_free(void *obj);
+#define AV_OPT_SEARCH_FAKE_OBJ (1 << 1)
/**
- * Check whether a particular flag is set in a flags field.
- *
- * @param field_name the name of the flag field option
- * @param flag_name the name of the flag to check
- * @return non-zero if the flag is set, zero if the flag isn't set,
- * isn't of the right type, or the flags field doesn't exist.
+ * In av_opt_get, return NULL if the option has a pointer type and is set to NULL,
+ * rather than returning an empty string.
*/
-int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name);
+#define AV_OPT_ALLOW_NULL (1 << 2)
/**
- * Set all the options from a given dictionary on an object.
- *
- * @param obj a struct whose first element is a pointer to AVClass
- * @param options options to process. This dictionary will be freed and replaced
- * by a new one containing all options not found in obj.
- * Of course this new dictionary needs to be freed by caller
- * with av_dict_free().
- *
- * @return 0 on success, a negative AVERROR if some option was found in obj,
- * but could not be set.
- *
- * @see av_dict_copy()
+ * May be used with av_opt_set_array() to signal that new elements should
+ * replace the existing ones in the indicated range.
*/
-int av_opt_set_dict(void *obj, struct AVDictionary **options);
+#define AV_OPT_ARRAY_REPLACE (1 << 3)
+/**
+ * Allows av_opt_query_ranges and av_opt_query_ranges_default to return more than
+ * one component for certain option types.
+ * @see AVOptionRanges for details.
+ */
+#define AV_OPT_MULTI_COMPONENT_RANGE (1 << 12)
/**
- * Set all the options from a given dictionary on an object.
+ * Look for an option in an object. Consider only options which
+ * have all the specified flags set.
*
- * @param obj a struct whose first element is a pointer to AVClass
- * @param options options to process. This dictionary will be freed and replaced
- * by a new one containing all options not found in obj.
- * Of course this new dictionary needs to be freed by caller
- * with av_dict_free().
+ * @param[in] obj A pointer to a struct whose first element is a
+ * pointer to an AVClass.
+ * Alternatively a double pointer to an AVClass, if
+ * AV_OPT_SEARCH_FAKE_OBJ search flag is set.
+ * @param[in] name The name of the option to look for.
+ * @param[in] unit When searching for named constants, name of the unit
+ * it belongs to.
+ * @param opt_flags Find only options with all the specified flags set (AV_OPT_FLAG).
* @param search_flags A combination of AV_OPT_SEARCH_*.
*
- * @return 0 on success, a negative AVERROR if some option was found in obj,
- * but could not be set.
+ * @return A pointer to the option found, or NULL if no option
+ * was found.
*
- * @see av_dict_copy()
+ * @note Options found with AV_OPT_SEARCH_CHILDREN flag may not be settable
+ * directly with av_opt_set(). Use special calls which take an options
+ * AVDictionary (e.g. avformat_open_input()) to set options found with this
+ * flag.
*/
-int av_opt_set_dict2(void *obj, struct AVDictionary **options, int search_flags);
+const AVOption *av_opt_find(void *obj, const char *name, const char *unit,
+ int opt_flags, int search_flags);
/**
- * Extract a key-value pair from the beginning of a string.
- *
- * @param ropts pointer to the options string, will be updated to
- * point to the rest of the string (one of the pairs_sep
- * or the final NUL)
- * @param key_val_sep a 0-terminated list of characters used to separate
- * key from value, for example '='
- * @param pairs_sep a 0-terminated list of characters used to separate
- * two pairs from each other, for example ':' or ','
- * @param flags flags; see the AV_OPT_FLAG_* values below
- * @param rkey parsed key; must be freed using av_free()
- * @param rval parsed value; must be freed using av_free()
+ * Look for an option in an object. Consider only options which
+ * have all the specified flags set.
*
- * @return >=0 for success, or a negative value corresponding to an
- * AVERROR code in case of error; in particular:
- * AVERROR(EINVAL) if no key is present
+ * @param[in] obj A pointer to a struct whose first element is a
+ * pointer to an AVClass.
+ * Alternatively a double pointer to an AVClass, if
+ * AV_OPT_SEARCH_FAKE_OBJ search flag is set.
+ * @param[in] name The name of the option to look for.
+ * @param[in] unit When searching for named constants, name of the unit
+ * it belongs to.
+ * @param opt_flags Find only options with all the specified flags set (AV_OPT_FLAG).
+ * @param search_flags A combination of AV_OPT_SEARCH_*.
+ * @param[out] target_obj if non-NULL, an object to which the option belongs will be
+ * written here. It may be different from obj if AV_OPT_SEARCH_CHILDREN is present
+ * in search_flags. This parameter is ignored if search_flags contain
+ * AV_OPT_SEARCH_FAKE_OBJ.
+ *
+ * @return A pointer to the option found, or NULL if no option
+ * was found.
+ */
+const AVOption *av_opt_find2(void *obj, const char *name, const char *unit,
+ int opt_flags, int search_flags, void **target_obj);
+
+/**
+ * Show the obj options.
+ *
+ * @param req_flags requested flags for the options to show. Show only the
+ * options for which it is opt->flags & req_flags.
+ * @param rej_flags rejected flags for the options to show. Show only the
+ * options for which it is !(opt->flags & req_flags).
+ * @param av_log_obj log context to use for showing the options
+ */
+int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags);
+
+/**
+ * Extract a key-value pair from the beginning of a string.
+ *
+ * @param ropts pointer to the options string, will be updated to
+ * point to the rest of the string (one of the pairs_sep
+ * or the final NUL)
+ * @param key_val_sep a 0-terminated list of characters used to separate
+ * key from value, for example '='
+ * @param pairs_sep a 0-terminated list of characters used to separate
+ * two pairs from each other, for example ':' or ','
+ * @param flags flags; see the AV_OPT_FLAG_* values below
+ * @param rkey parsed key; must be freed using av_free()
+ * @param rval parsed value; must be freed using av_free()
+ *
+ * @return >=0 for success, or a negative value corresponding to an
+ * AVERROR code in case of error; in particular:
+ * AVERROR(EINVAL) if no key is present
*
*/
int av_opt_get_key_value(const char **ropts,
@@ -529,128 +724,118 @@ enum {
AV_OPT_FLAG_IMPLICIT_KEY = 1,
};
-/**
- * @defgroup opt_eval_funcs Evaluating option strings
- * @{
- * This group of functions can be used to evaluate option strings
- * and get numbers out of them. They do the same thing as av_opt_set(),
- * except the result is written into the caller-supplied pointer.
- *
- * @param obj a struct whose first element is a pointer to AVClass.
- * @param o an option for which the string is to be evaluated.
- * @param val string to be evaluated.
- * @param *_out value of the string will be written here.
- *
- * @return 0 on success, a negative number on failure.
- */
-int av_opt_eval_flags (void *obj, const AVOption *o, const char *val, int *flags_out);
-int av_opt_eval_int (void *obj, const AVOption *o, const char *val, int *int_out);
-int av_opt_eval_int64 (void *obj, const AVOption *o, const char *val, int64_t *int64_out);
-int av_opt_eval_float (void *obj, const AVOption *o, const char *val, float *float_out);
-int av_opt_eval_double(void *obj, const AVOption *o, const char *val, double *double_out);
-int av_opt_eval_q (void *obj, const AVOption *o, const char *val, AVRational *q_out);
/**
* @}
*/
-#define AV_OPT_SEARCH_CHILDREN (1 << 0) /**< Search in possible children of the
- given object first. */
/**
- * The obj passed to av_opt_find() is fake -- only a double pointer to AVClass
- * instead of a required pointer to a struct containing AVClass. This is
- * useful for searching for options without needing to allocate the corresponding
- * object.
+ * @defgroup opt_write Setting and modifying option values
+ * @{
*/
-#define AV_OPT_SEARCH_FAKE_OBJ (1 << 1)
/**
- * In av_opt_get, return NULL if the option has a pointer type and is set to NULL,
- * rather than returning an empty string.
+ * Parse the key/value pairs list in opts. For each key/value pair
+ * found, stores the value in the field in ctx that is named like the
+ * key. ctx must be an AVClass context, storing is done using
+ * AVOptions.
+ *
+ * @param opts options string to parse, may be NULL
+ * @param key_val_sep a 0-terminated list of characters used to
+ * separate key from value
+ * @param pairs_sep a 0-terminated list of characters used to separate
+ * two pairs from each other
+ * @return the number of successfully set key/value pairs, or a negative
+ * value corresponding to an AVERROR code in case of error:
+ * AVERROR(EINVAL) if opts cannot be parsed,
+ * the error code issued by av_opt_set() if a key/value pair
+ * cannot be set
*/
-#define AV_OPT_ALLOW_NULL (1 << 2)
+int av_set_options_string(void *ctx, const char *opts,
+ const char *key_val_sep, const char *pairs_sep);
/**
- * Allows av_opt_query_ranges and av_opt_query_ranges_default to return more than
- * one component for certain option types.
- * @see AVOptionRanges for details.
+ * Parse the key-value pairs list in opts. For each key=value pair found,
+ * set the value of the corresponding option in ctx.
+ *
+ * @param ctx the AVClass object to set options on
+ * @param opts the options string, key-value pairs separated by a
+ * delimiter
+ * @param shorthand a NULL-terminated array of options names for shorthand
+ * notation: if the first field in opts has no key part,
+ * the key is taken from the first element of shorthand;
+ * then again for the second, etc., until either opts is
+ * finished, shorthand is finished or a named option is
+ * found; after that, all options must be named
+ * @param key_val_sep a 0-terminated list of characters used to separate
+ * key from value, for example '='
+ * @param pairs_sep a 0-terminated list of characters used to separate
+ * two pairs from each other, for example ':' or ','
+ * @return the number of successfully set key=value pairs, or a negative
+ * value corresponding to an AVERROR code in case of error:
+ * AVERROR(EINVAL) if opts cannot be parsed,
+ * the error code issued by av_set_string3() if a key/value pair
+ * cannot be set
+ *
+ * Options names must use only the following characters: a-z A-Z 0-9 - . / _
+ * Separators must use characters distinct from option names and from each
+ * other.
*/
-#define AV_OPT_MULTI_COMPONENT_RANGE (1 << 12)
+int av_opt_set_from_string(void *ctx, const char *opts,
+ const char *const *shorthand,
+ const char *key_val_sep, const char *pairs_sep);
/**
- * Look for an option in an object. Consider only options which
- * have all the specified flags set.
+ * Set all the options from a given dictionary on an object.
*
- * @param[in] obj A pointer to a struct whose first element is a
- * pointer to an AVClass.
- * Alternatively a double pointer to an AVClass, if
- * AV_OPT_SEARCH_FAKE_OBJ search flag is set.
- * @param[in] name The name of the option to look for.
- * @param[in] unit When searching for named constants, name of the unit
- * it belongs to.
- * @param opt_flags Find only options with all the specified flags set (AV_OPT_FLAG).
- * @param search_flags A combination of AV_OPT_SEARCH_*.
+ * @param obj a struct whose first element is a pointer to AVClass
+ * @param options options to process. This dictionary will be freed and replaced
+ * by a new one containing all options not found in obj.
+ * Of course this new dictionary needs to be freed by caller
+ * with av_dict_free().
*
- * @return A pointer to the option found, or NULL if no option
- * was found.
+ * @return 0 on success, a negative AVERROR if some option was found in obj,
+ * but could not be set.
*
- * @note Options found with AV_OPT_SEARCH_CHILDREN flag may not be settable
- * directly with av_opt_set(). Use special calls which take an options
- * AVDictionary (e.g. avformat_open_input()) to set options found with this
- * flag.
+ * @see av_dict_copy()
*/
-const AVOption *av_opt_find(void *obj, const char *name, const char *unit,
- int opt_flags, int search_flags);
+int av_opt_set_dict(void *obj, struct AVDictionary **options);
+
/**
- * Look for an option in an object. Consider only options which
- * have all the specified flags set.
+ * Set all the options from a given dictionary on an object.
*
- * @param[in] obj A pointer to a struct whose first element is a
- * pointer to an AVClass.
- * Alternatively a double pointer to an AVClass, if
- * AV_OPT_SEARCH_FAKE_OBJ search flag is set.
- * @param[in] name The name of the option to look for.
- * @param[in] unit When searching for named constants, name of the unit
- * it belongs to.
- * @param opt_flags Find only options with all the specified flags set (AV_OPT_FLAG).
+ * @param obj a struct whose first element is a pointer to AVClass
+ * @param options options to process. This dictionary will be freed and replaced
+ * by a new one containing all options not found in obj.
+ * Of course this new dictionary needs to be freed by caller
+ * with av_dict_free().
* @param search_flags A combination of AV_OPT_SEARCH_*.
- * @param[out] target_obj if non-NULL, an object to which the option belongs will be
- * written here. It may be different from obj if AV_OPT_SEARCH_CHILDREN is present
- * in search_flags. This parameter is ignored if search_flags contain
- * AV_OPT_SEARCH_FAKE_OBJ.
*
- * @return A pointer to the option found, or NULL if no option
- * was found.
- */
-const AVOption *av_opt_find2(void *obj, const char *name, const char *unit,
- int opt_flags, int search_flags, void **target_obj);
-
-/**
- * Iterate over all AVOptions belonging to obj.
+ * @return 0 on success, a negative AVERROR if some option was found in obj,
+ * but could not be set.
*
- * @param obj an AVOptions-enabled struct or a double pointer to an
- * AVClass describing it.
- * @param prev result of the previous call to av_opt_next() on this object
- * or NULL
- * @return next AVOption or NULL
+ * @see av_dict_copy()
*/
-const AVOption *av_opt_next(const void *obj, const AVOption *prev);
+int av_opt_set_dict2(void *obj, struct AVDictionary **options, int search_flags);
/**
- * Iterate over AVOptions-enabled children of obj.
+ * Copy options from src object into dest object.
*
- * @param prev result of a previous call to this function or NULL
- * @return next AVOptions-enabled child or NULL
- */
-void *av_opt_child_next(void *obj, void *prev);
-
-/**
- * Iterate over potential AVOptions-enabled children of parent.
+ * The underlying AVClass of both src and dest must coincide. The guarantee
+ * below does not apply if this is not fulfilled.
*
- * @param prev result of a previous call to this function or NULL
- * @return AVClass corresponding to next potential child or NULL
+ * Options that require memory allocation (e.g. string or binary) are malloc'ed in dest object.
+ * Original memory allocated for such options is freed unless both src and dest options points to the same memory.
+ *
+ * Even on error it is guaranteed that allocated options from src and dest
+ * no longer alias each other afterwards; in particular calling av_opt_free()
+ * on both src and dest is safe afterwards if dest has been memdup'ed from src.
+ *
+ * @param dest Object to copy from
+ * @param src Object to copy into
+ * @return 0 on success, negative on error
*/
-const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev);
+int av_opt_copy(void *dest, const void *src);
/**
* @defgroup opt_set_funcs Option setting functions
@@ -669,6 +854,9 @@ const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *pre
* scalars or named flags separated by '+' or '-'. Prefixing a flag
* with '+' causes it to be set without affecting the other flags;
* similarly, '-' unsets a flag.
+ * If the field is of a dictionary type, it has to be a ':' separated list of
+ * key=value parameters. Values containing ':' special characters must be
+ * escaped.
* @param search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN
* is passed here, then the option may be set on a child of obj.
*
@@ -687,7 +875,11 @@ int av_opt_set_image_size(void *obj, const char *name, int w, int h, int search_
int av_opt_set_pixel_fmt (void *obj, const char *name, enum AVPixelFormat fmt, int search_flags);
int av_opt_set_sample_fmt(void *obj, const char *name, enum AVSampleFormat fmt, int search_flags);
int av_opt_set_video_rate(void *obj, const char *name, AVRational val, int search_flags);
-int av_opt_set_channel_layout(void *obj, const char *name, int64_t ch_layout, int search_flags);
+/**
+ * @note Any old chlayout present is discarded and replaced with a copy of the new one. The
+ * caller still owns layout and is responsible for uninitializing it.
+ */
+int av_opt_set_chlayout(void *obj, const char *name, const AVChannelLayout *layout, int search_flags);
/**
* @note Any old dictionary present is discarded and replaced with a copy of the new one. The
* caller still owns val is and responsible for freeing it.
@@ -710,10 +902,66 @@ int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, in
av_opt_set_bin(obj, name, (const uint8_t *)(val), \
av_int_list_length(val, term) * sizeof(*(val)), flags))
+/**
+ * Add, replace, or remove elements for an array option. Which of these
+ * operations is performed depends on the values of val and search_flags.
+ *
+ * @param start_elem Index of the first array element to modify; must not be
+ * larger than array size as returned by
+ * av_opt_get_array_size().
+ * @param nb_elems number of array elements to modify; when val is NULL,
+ * start_elem+nb_elems must not be larger than array size as
+ * returned by av_opt_get_array_size()
+ *
+ * @param val_type Option type corresponding to the type of val, ignored when val is
+ * NULL.
+ *
+ * The effect of this function will will be as if av_opt_setX()
+ * was called for each element, where X is specified by type.
+ * E.g. AV_OPT_TYPE_STRING corresponds to av_opt_set().
+ *
+ * Typically this should be the same as the scalarized type of
+ * the AVOption being set, but certain conversions are also
+ * possible - the same as those done by the corresponding
+ * av_opt_set*() function. E.g. any option type can be set from
+ * a string, numeric types can be set from int64, double, or
+ * rational, etc.
+ *
+ * @param val Array with nb_elems elements or NULL.
+ *
+ * When NULL, nb_elems array elements starting at start_elem are
+ * removed from the array. Any array elements remaining at the end
+ * are shifted by nb_elems towards the first element in order to keep
+ * the array contiguous.
+ *
+ * Otherwise (val is non-NULL), the type of val must match the
+ * underlying C type as documented for val_type.
+ *
+ * When AV_OPT_ARRAY_REPLACE is not set in search_flags, the array is
+ * enlarged by nb_elems, and the contents of val are inserted at
+ * start_elem. Previously existing array elements from start_elem
+ * onwards (if present) are shifted by nb_elems away from the first
+ * element in order to make space for the new elements.
+ *
+ * When AV_OPT_ARRAY_REPLACE is set in search_flags, the contents
+ * of val replace existing array elements from start_elem to
+ * start_elem+nb_elems (if present). New array size is
+ * max(start_elem + nb_elems, old array size).
+ */
+int av_opt_set_array(void *obj, const char *name, int search_flags,
+ unsigned int start_elem, unsigned int nb_elems,
+ enum AVOptionType val_type, const void *val);
+
/**
+ * @}
* @}
*/
+/**
+ * @defgroup opt_read Reading option values
+ * @{
+ */
+
/**
* @defgroup opt_get_funcs Option getting functions
* @{
@@ -729,9 +977,10 @@ int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, in
/**
* @note the returned string will be av_malloc()ed and must be av_free()ed by the caller
*
- * @note if AV_OPT_ALLOW_NULL is set in search_flags in av_opt_get, and the option has
- * AV_OPT_TYPE_STRING or AV_OPT_TYPE_BINARY and is set to NULL, *out_val will be set
- * to NULL instead of an allocated empty string.
+ * @note if AV_OPT_ALLOW_NULL is set in search_flags in av_opt_get, and the
+ * option is of type AV_OPT_TYPE_STRING, AV_OPT_TYPE_BINARY or AV_OPT_TYPE_DICT
+ * and is set to NULL, *out_val will be set to NULL instead of an allocated
+ * empty string.
*/
int av_opt_get (void *obj, const char *name, int search_flags, uint8_t **out_val);
int av_opt_get_int (void *obj, const char *name, int search_flags, int64_t *out_val);
@@ -741,72 +990,94 @@ int av_opt_get_image_size(void *obj, const char *name, int search_flags, int *w_
int av_opt_get_pixel_fmt (void *obj, const char *name, int search_flags, enum AVPixelFormat *out_fmt);
int av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AVSampleFormat *out_fmt);
int av_opt_get_video_rate(void *obj, const char *name, int search_flags, AVRational *out_val);
-int av_opt_get_channel_layout(void *obj, const char *name, int search_flags, int64_t *ch_layout);
+/**
+ * @param[out] layout The returned layout is a copy of the actual value and must
+ * be freed with av_channel_layout_uninit() by the caller
+ */
+int av_opt_get_chlayout(void *obj, const char *name, int search_flags, AVChannelLayout *layout);
/**
* @param[out] out_val The returned dictionary is a copy of the actual value and must
* be freed with av_dict_free() by the caller
*/
int av_opt_get_dict_val(void *obj, const char *name, int search_flags, AVDictionary **out_val);
+
/**
- * @}
+ * For an array-type option, get the number of elements in the array.
*/
+int av_opt_get_array_size(void *obj, const char *name, int search_flags,
+ unsigned int *out_val);
+
/**
- * Gets a pointer to the requested field in a struct.
- * This function allows accessing a struct even when its fields are moved or
- * renamed since the application making the access has been compiled,
- *
- * @returns a pointer to the field, it can be cast to the correct type and read
- * or written to.
+ * For an array-type option, retrieve the values of one or more array elements.
+ *
+ * @param start_elem index of the first array element to retrieve
+ * @param nb_elems number of array elements to retrieve; start_elem+nb_elems
+ * must not be larger than array size as returned by
+ * av_opt_get_array_size()
+ *
+ * @param out_type Option type corresponding to the desired output.
+ *
+ * The array elements produced by this function will
+ * will be as if av_opt_getX() was called for each element,
+ * where X is specified by out_type. E.g. AV_OPT_TYPE_STRING
+ * corresponds to av_opt_get().
+ *
+ * Typically this should be the same as the scalarized type of
+ * the AVOption being retrieved, but certain conversions are
+ * also possible - the same as those done by the corresponding
+ * av_opt_get*() function. E.g. any option type can be retrieved
+ * as a string, numeric types can be retrieved as int64, double,
+ * or rational, etc.
+ *
+ * @param out_val Array with nb_elems members into which the output will be
+ * written. The array type must match the underlying C type as
+ * documented for out_type, and be zeroed on entry to this
+ * function.
+ *
+ * For dynamically allocated types (strings, binary, dicts,
+ * etc.), the result is owned and freed by the caller.
*/
-void *av_opt_ptr(const AVClass *avclass, void *obj, const char *name);
-
+int av_opt_get_array(void *obj, const char *name, int search_flags,
+ unsigned int start_elem, unsigned int nb_elems,
+ enum AVOptionType out_type, void *out_val);
/**
- * Free an AVOptionRanges struct and set it to NULL.
+ * @}
*/
-void av_opt_freep_ranges(AVOptionRanges **ranges);
/**
- * Get a list of allowed ranges for the given option.
- *
- * The returned list may depend on other fields in obj like for example profile.
- *
- * @param flags is a bitmask of flags, undefined flags should not be set and should be ignored
- * AV_OPT_SEARCH_FAKE_OBJ indicates that the obj is a double pointer to a AVClass instead of a full instance
- * AV_OPT_MULTI_COMPONENT_RANGE indicates that function may return more than one component, @see AVOptionRanges
+ * @defgroup opt_eval_funcs Evaluating option strings
+ * @{
+ * This group of functions can be used to evaluate option strings
+ * and get numbers out of them. They do the same thing as av_opt_set(),
+ * except the result is written into the caller-supplied pointer.
*
- * The result must be freed with av_opt_freep_ranges.
+ * @param obj a struct whose first element is a pointer to AVClass.
+ * @param o an option for which the string is to be evaluated.
+ * @param val string to be evaluated.
+ * @param *_out value of the string will be written here.
*
- * @return number of compontents returned on success, a negative errro code otherwise
+ * @return 0 on success, a negative number on failure.
*/
-int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags);
-
+int av_opt_eval_flags (void *obj, const AVOption *o, const char *val, int *flags_out);
+int av_opt_eval_int (void *obj, const AVOption *o, const char *val, int *int_out);
+int av_opt_eval_uint (void *obj, const AVOption *o, const char *val, unsigned *uint_out);
+int av_opt_eval_int64 (void *obj, const AVOption *o, const char *val, int64_t *int64_out);
+int av_opt_eval_float (void *obj, const AVOption *o, const char *val, float *float_out);
+int av_opt_eval_double(void *obj, const AVOption *o, const char *val, double *double_out);
+int av_opt_eval_q (void *obj, const AVOption *o, const char *val, AVRational *q_out);
/**
- * Copy options from src object into dest object.
- *
- * Options that require memory allocation (e.g. string or binary) are malloc'ed in dest object.
- * Original memory allocated for such options is freed unless both src and dest options points to the same memory.
- *
- * @param dest Object to copy from
- * @param src Object to copy into
- * @return 0 on success, negative on error
+ * @}
*/
-int av_opt_copy(void *dest, const void *src);
/**
- * Get a default list of allowed ranges for the given option.
- *
- * This list is constructed without using the AVClass.query_ranges() callback
- * and can be used as fallback from within the callback.
- *
- * @param flags is a bitmask of flags, undefined flags should not be set and should be ignored
- * AV_OPT_SEARCH_FAKE_OBJ indicates that the obj is a double pointer to a AVClass instead of a full instance
- * AV_OPT_MULTI_COMPONENT_RANGE indicates that function may return more than one component, @see AVOptionRanges
- *
- * The result must be freed with av_opt_free_ranges.
+ * Gets a pointer to the requested field in a struct.
+ * This function allows accessing a struct even when its fields are moved or
+ * renamed since the application making the access has been compiled,
*
- * @return number of compontents returned on success, a negative errro code otherwise
+ * @returns a pointer to the field, it can be cast to the correct type and read
+ * or written to.
*/
-int av_opt_query_ranges_default(AVOptionRanges **, void *obj, const char *key, int flags);
+void *av_opt_ptr(const AVClass *avclass, void *obj, const char *name);
/**
* Check if given option is set to its default value.
@@ -834,9 +1105,19 @@ int av_opt_is_set_to_default(void *obj, const AVOption *o);
*/
int av_opt_is_set_to_default_by_name(void *obj, const char *name, int search_flags);
+/**
+ * Check whether a particular flag is set in a flags field.
+ *
+ * @param field_name the name of the flag field option
+ * @param flag_name the name of the flag to check
+ * @return non-zero if the flag is set, zero if the flag isn't set,
+ * isn't of the right type, or the flags field doesn't exist.
+ */
+int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name);
#define AV_OPT_SERIALIZE_SKIP_DEFAULTS 0x00000001 ///< Serialize options that are not set to default values only.
#define AV_OPT_SERIALIZE_OPT_FLAGS_EXACT 0x00000002 ///< Serialize options that exactly match opt_flags only.
+#define AV_OPT_SERIALIZE_SEARCH_CHILDREN 0x00000004 ///< Serialize options in possible children of the given object.
/**
* Serialize object's options.
@@ -858,6 +1139,47 @@ int av_opt_is_set_to_default_by_name(void *obj, const char *name, int search_fla
*/
int av_opt_serialize(void *obj, int opt_flags, int flags, char **buffer,
const char key_val_sep, const char pairs_sep);
+
+/**
+ * @}
+ */
+
+/**
+ * Free an AVOptionRanges struct and set it to NULL.
+ */
+void av_opt_freep_ranges(AVOptionRanges **ranges);
+
+/**
+ * Get a list of allowed ranges for the given option.
+ *
+ * The returned list may depend on other fields in obj like for example profile.
+ *
+ * @param flags is a bitmask of flags, undefined flags should not be set and should be ignored
+ * AV_OPT_SEARCH_FAKE_OBJ indicates that the obj is a double pointer to a AVClass instead of a full instance
+ * AV_OPT_MULTI_COMPONENT_RANGE indicates that function may return more than one component, @see AVOptionRanges
+ *
+ * The result must be freed with av_opt_freep_ranges.
+ *
+ * @return number of compontents returned on success, a negative errro code otherwise
+ */
+int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags);
+
+/**
+ * Get a default list of allowed ranges for the given option.
+ *
+ * This list is constructed without using the AVClass.query_ranges() callback
+ * and can be used as fallback from within the callback.
+ *
+ * @param flags is a bitmask of flags, undefined flags should not be set and should be ignored
+ * AV_OPT_SEARCH_FAKE_OBJ indicates that the obj is a double pointer to a AVClass instead of a full instance
+ * AV_OPT_MULTI_COMPONENT_RANGE indicates that function may return more than one component, @see AVOptionRanges
+ *
+ * The result must be freed with av_opt_free_ranges.
+ *
+ * @return number of compontents returned on success, a negative errro code otherwise
+ */
+int av_opt_query_ranges_default(AVOptionRanges **, void *obj, const char *key, int flags);
+
/**
* @}
*/
diff --git a/ffmpeg/include/libavutil/parseutils.h b/ffmpeg/include/libavutil/parseutils.h
index e66d24b7..dad5c277 100644
--- a/ffmpeg/include/libavutil/parseutils.h
+++ b/ffmpeg/include/libavutil/parseutils.h
@@ -79,6 +79,8 @@ int av_parse_video_rate(AVRational *rate, const char *str);
/**
* Put the RGBA values that correspond to color_string in rgba_color.
*
+ * @param rgba_color 4-elements array of uint8_t values, where the respective
+ * red, green, blue and alpha component values are written.
* @param color_string a string specifying a color. It can be the name of
* a color (case insensitive match) or a [0x|#]RRGGBB[AA] sequence,
* possibly followed by "@" and a string representing the alpha
@@ -92,6 +94,8 @@ int av_parse_video_rate(AVRational *rate, const char *str);
* @param slen length of the initial part of color_string containing the
* color. It can be set to -1 if color_string is a null terminated string
* containing nothing else than the color.
+ * @param log_ctx a pointer to an arbitrary struct of which the first field
+ * is a pointer to an AVClass struct (used for av_log()). Can be NULL.
* @return >= 0 in case of success, a negative value in case of
* failure (for example if color_string cannot be parsed).
*/
@@ -106,7 +110,7 @@ int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen,
* av_parse_color().
*
* @param color_idx index of the requested color, starting from 0
- * @param rgbp if not NULL, will point to a 3-elements array with the color value in RGB
+ * @param rgb if not NULL, will point to a 3-elements array with the color value in RGB
* @return the color name string or NULL if color_idx is not in the array
*/
const char *av_get_known_color_name(int color_idx, const uint8_t **rgb);
@@ -162,19 +166,19 @@ int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info
* by the standard strptime().
*
* The supported input field descriptors are listed below.
- * - %H: the hour as a decimal number, using a 24-hour clock, in the
+ * - `%%H`: the hour as a decimal number, using a 24-hour clock, in the
* range '00' through '23'
- * - %J: hours as a decimal number, in the range '0' through INT_MAX
- * - %M: the minute as a decimal number, using a 24-hour clock, in the
+ * - `%%J`: hours as a decimal number, in the range '0' through INT_MAX
+ * - `%%M`: the minute as a decimal number, using a 24-hour clock, in the
* range '00' through '59'
- * - %S: the second as a decimal number, using a 24-hour clock, in the
+ * - `%%S`: the second as a decimal number, using a 24-hour clock, in the
* range '00' through '59'
- * - %Y: the year as a decimal number, using the Gregorian calendar
- * - %m: the month as a decimal number, in the range '1' through '12'
- * - %d: the day of the month as a decimal number, in the range '1'
+ * - `%%Y`: the year as a decimal number, using the Gregorian calendar
+ * - `%%m`: the month as a decimal number, in the range '1' through '12'
+ * - `%%d`: the day of the month as a decimal number, in the range '1'
* through '31'
- * - %T: alias for '%H:%M:%S'
- * - %%: a literal '%'
+ * - `%%T`: alias for `%%H:%%M:%%S`
+ * - `%%`: a literal `%`
*
* @return a pointer to the first character not processed in this function
* call. In case the input string contains more characters than
diff --git a/ffmpeg/include/libavutil/pixdesc.h b/ffmpeg/include/libavutil/pixdesc.h
index c055810a..ba2f6328 100644
--- a/ffmpeg/include/libavutil/pixdesc.h
+++ b/ffmpeg/include/libavutil/pixdesc.h
@@ -26,7 +26,6 @@
#include "attributes.h"
#include "pixfmt.h"
-#include "version.h"
typedef struct AVComponentDescriptor {
/**
@@ -56,17 +55,6 @@ typedef struct AVComponentDescriptor {
* Number of bits in the component.
*/
int depth;
-
-#if FF_API_PLUS1_MINUS1
- /** deprecated, use step instead */
- attribute_deprecated int step_minus1;
-
- /** deprecated, use depth instead */
- attribute_deprecated int depth_minus1;
-
- /** deprecated, use offset instead */
- attribute_deprecated int offset_plus1;
-#endif
} AVComponentDescriptor;
/**
@@ -147,24 +135,6 @@ typedef struct AVPixFmtDescriptor {
*/
#define AV_PIX_FMT_FLAG_RGB (1 << 5)
-/**
- * The pixel format is "pseudo-paletted". This means that it contains a
- * fixed palette in the 2nd plane but the palette is fixed/constant for each
- * PIX_FMT. This allows interpreting the data as if it was PAL8, which can
- * in some cases be simpler. Or the data can be interpreted purely based on
- * the pixel format without using the palette.
- * An example of a pseudo-paletted format is AV_PIX_FMT_GRAY8
- *
- * @deprecated This flag is deprecated, and will be removed. When it is removed,
- * the extra palette allocation in AVFrame.data[1] is removed as well. Only
- * actual paletted formats (as indicated by AV_PIX_FMT_FLAG_PAL) will have a
- * palette. Starting with FFmpeg versions which have this flag deprecated, the
- * extra "pseudo" palette is already ignored, and API users are not required to
- * allocate a palette for AV_PIX_FMT_FLAG_PSEUDOPAL formats (it was required
- * before the deprecation, though).
- */
-#define AV_PIX_FMT_FLAG_PSEUDOPAL (1 << 6)
-
/**
* The pixel format has an alpha channel. This is set on all formats that
* support alpha in some way, including AV_PIX_FMT_PAL8. The alpha is always
@@ -187,6 +157,11 @@ typedef struct AVPixFmtDescriptor {
*/
#define AV_PIX_FMT_FLAG_FLOAT (1 << 9)
+/**
+ * The pixel format contains XYZ-like data (as opposed to YUV/RGB/grayscale).
+ */
+#define AV_PIX_FMT_FLAG_XYZ (1 << 10)
+
/**
* Return the number of bits per pixel used by the pixel format
* described by pixdesc. Note that this is not the same as the number
@@ -294,6 +269,28 @@ const char *av_chroma_location_name(enum AVChromaLocation location);
*/
int av_chroma_location_from_name(const char *name);
+/**
+ * Converts AVChromaLocation to swscale x/y chroma position.
+ *
+ * The positions represent the chroma (0,0) position in a coordinates system
+ * with luma (0,0) representing the origin and luma(1,1) representing 256,256
+ *
+ * @param xpos horizontal chroma sample position
+ * @param ypos vertical chroma sample position
+ */
+int av_chroma_location_enum_to_pos(int *xpos, int *ypos, enum AVChromaLocation pos);
+
+/**
+ * Converts swscale x/y chroma position to AVChromaLocation.
+ *
+ * The positions represent the chroma (0,0) position in a coordinates system
+ * with luma (0,0) representing the origin and luma(1,1) representing 256,256
+ *
+ * @param xpos horizontal chroma sample position
+ * @param ypos vertical chroma sample position
+ */
+enum AVChromaLocation av_chroma_location_pos_to_enum(int xpos, int ypos);
+
/**
* Return the pixel format corresponding to name.
*
@@ -387,12 +384,15 @@ void av_write_image_line(const uint16_t *src, uint8_t *data[4],
*/
enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt);
-#define FF_LOSS_RESOLUTION 0x0001 /**< loss due to resolution change */
-#define FF_LOSS_DEPTH 0x0002 /**< loss due to color depth change */
-#define FF_LOSS_COLORSPACE 0x0004 /**< loss due to color space conversion */
-#define FF_LOSS_ALPHA 0x0008 /**< loss of alpha bits */
-#define FF_LOSS_COLORQUANT 0x0010 /**< loss due to color quantization */
-#define FF_LOSS_CHROMA 0x0020 /**< loss of chroma (e.g. RGB to gray conversion) */
+#define FF_LOSS_RESOLUTION 0x0001 /**< loss due to resolution change */
+#define FF_LOSS_DEPTH 0x0002 /**< loss due to color depth change */
+#define FF_LOSS_COLORSPACE 0x0004 /**< loss due to color space conversion */
+#define FF_LOSS_ALPHA 0x0008 /**< loss of alpha bits */
+#define FF_LOSS_COLORQUANT 0x0010 /**< loss due to color quantization */
+#define FF_LOSS_CHROMA 0x0020 /**< loss of chroma (e.g. RGB to gray conversion) */
+#define FF_LOSS_EXCESS_RESOLUTION 0x0040 /**< loss due to unneeded extra resolution */
+#define FF_LOSS_EXCESS_DEPTH 0x0080 /**< loss due to unneeded extra color depth */
+
/**
* Compute what kind of losses will occur when converting from one specific
diff --git a/ffmpeg/include/libavutil/pixelutils.h b/ffmpeg/include/libavutil/pixelutils.h
index a8dbc157..7a997cde 100644
--- a/ffmpeg/include/libavutil/pixelutils.h
+++ b/ffmpeg/include/libavutil/pixelutils.h
@@ -21,7 +21,6 @@
#include
#include
-#include "common.h"
/**
* Sum of abs(src1[x] - src2[x])
diff --git a/ffmpeg/include/libavutil/pixfmt.h b/ffmpeg/include/libavutil/pixfmt.h
index 6815f8dc..a7f50e16 100644
--- a/ffmpeg/include/libavutil/pixfmt.h
+++ b/ffmpeg/include/libavutil/pixfmt.h
@@ -32,6 +32,13 @@
#define AVPALETTE_SIZE 1024
#define AVPALETTE_COUNT 256
+/**
+ * Maximum number of planes in any pixel format.
+ * This should be used when a maximum is needed, but code should not
+ * be written to require a maximum for no good reason.
+ */
+#define AV_VIDEO_MAX_PLANES 4
+
/**
* Pixel format.
*
@@ -83,7 +90,7 @@ enum AVPixelFormat {
AV_PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
AV_PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
AV_PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
- AV_PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
+ AV_PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)3R 3G 2B(lsb)
AV_PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
AV_PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
AV_PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V)
@@ -112,21 +119,11 @@ enum AVPixelFormat {
AV_PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined
AV_PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined
-#if FF_API_VAAPI
- /** @name Deprecated pixel formats */
- /**@{*/
- AV_PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers
- AV_PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers
- AV_PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a VASurfaceID
- /**@}*/
- AV_PIX_FMT_VAAPI = AV_PIX_FMT_VAAPI_VLD,
-#else
/**
* Hardware acceleration through VA-API, data[3] contains a
* VASurfaceID.
*/
AV_PIX_FMT_VAAPI,
-#endif
AV_PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
AV_PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
@@ -216,8 +213,36 @@ enum AVPixelFormat {
AV_PIX_FMT_GBRAP16BE, ///< planar GBRA 4:4:4:4 64bpp, big-endian
AV_PIX_FMT_GBRAP16LE, ///< planar GBRA 4:4:4:4 64bpp, little-endian
/**
- * HW acceleration through QSV, data[3] contains a pointer to the
- * mfxFrameSurface1 structure.
+ * HW acceleration through QSV, data[3] contains a pointer to the
+ * mfxFrameSurface1 structure.
+ *
+ * Before FFmpeg 5.0:
+ * mfxFrameSurface1.Data.MemId contains a pointer when importing
+ * the following frames as QSV frames:
+ *
+ * VAAPI:
+ * mfxFrameSurface1.Data.MemId contains a pointer to VASurfaceID
+ *
+ * DXVA2:
+ * mfxFrameSurface1.Data.MemId contains a pointer to IDirect3DSurface9
+ *
+ * FFmpeg 5.0 and above:
+ * mfxFrameSurface1.Data.MemId contains a pointer to the mfxHDLPair
+ * structure when importing the following frames as QSV frames:
+ *
+ * VAAPI:
+ * mfxHDLPair.first contains a VASurfaceID pointer.
+ * mfxHDLPair.second is always MFX_INFINITE.
+ *
+ * DXVA2:
+ * mfxHDLPair.first contains IDirect3DSurface9 pointer.
+ * mfxHDLPair.second is always MFX_INFINITE.
+ *
+ * D3D11:
+ * mfxHDLPair.first contains a ID3D11Texture2D pointer.
+ * mfxHDLPair.second contains the texture array index of the frame if the
+ * ID3D11Texture2D is an array texture, or always MFX_INFINITE if it is a
+ * normal texture.
*/
AV_PIX_FMT_QSV,
/**
@@ -257,20 +282,18 @@ enum AVPixelFormat {
AV_PIX_FMT_GBRP14LE, ///< planar GBR 4:4:4 42bpp, little-endian
AV_PIX_FMT_YUVJ411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV411P and setting color_range
- AV_PIX_FMT_BAYER_BGGR8, ///< bayer, BGBG..(odd line), GRGR..(even line), 8-bit samples */
- AV_PIX_FMT_BAYER_RGGB8, ///< bayer, RGRG..(odd line), GBGB..(even line), 8-bit samples */
- AV_PIX_FMT_BAYER_GBRG8, ///< bayer, GBGB..(odd line), RGRG..(even line), 8-bit samples */
- AV_PIX_FMT_BAYER_GRBG8, ///< bayer, GRGR..(odd line), BGBG..(even line), 8-bit samples */
- AV_PIX_FMT_BAYER_BGGR16LE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, little-endian */
- AV_PIX_FMT_BAYER_BGGR16BE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, big-endian */
- AV_PIX_FMT_BAYER_RGGB16LE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, little-endian */
- AV_PIX_FMT_BAYER_RGGB16BE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, big-endian */
- AV_PIX_FMT_BAYER_GBRG16LE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, little-endian */
- AV_PIX_FMT_BAYER_GBRG16BE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, big-endian */
- AV_PIX_FMT_BAYER_GRBG16LE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, little-endian */
- AV_PIX_FMT_BAYER_GRBG16BE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian */
-
- AV_PIX_FMT_XVMC,///< XVideo Motion Acceleration via common packet passing
+ AV_PIX_FMT_BAYER_BGGR8, ///< bayer, BGBG..(odd line), GRGR..(even line), 8-bit samples
+ AV_PIX_FMT_BAYER_RGGB8, ///< bayer, RGRG..(odd line), GBGB..(even line), 8-bit samples
+ AV_PIX_FMT_BAYER_GBRG8, ///< bayer, GBGB..(odd line), RGRG..(even line), 8-bit samples
+ AV_PIX_FMT_BAYER_GRBG8, ///< bayer, GRGR..(odd line), BGBG..(even line), 8-bit samples
+ AV_PIX_FMT_BAYER_BGGR16LE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, little-endian
+ AV_PIX_FMT_BAYER_BGGR16BE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, big-endian
+ AV_PIX_FMT_BAYER_RGGB16LE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, little-endian
+ AV_PIX_FMT_BAYER_RGGB16BE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, big-endian
+ AV_PIX_FMT_BAYER_GBRG16LE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, little-endian
+ AV_PIX_FMT_BAYER_GBRG16BE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, big-endian
+ AV_PIX_FMT_BAYER_GRBG16LE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, little-endian
+ AV_PIX_FMT_BAYER_GRBG16BE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian
AV_PIX_FMT_YUV440P10LE, ///< planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
AV_PIX_FMT_YUV440P10BE, ///< planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
@@ -340,6 +363,82 @@ enum AVPixelFormat {
AV_PIX_FMT_GRAYF32BE, ///< IEEE-754 single precision Y, 32bpp, big-endian
AV_PIX_FMT_GRAYF32LE, ///< IEEE-754 single precision Y, 32bpp, little-endian
+ AV_PIX_FMT_YUVA422P12BE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, big-endian
+ AV_PIX_FMT_YUVA422P12LE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, little-endian
+ AV_PIX_FMT_YUVA444P12BE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, big-endian
+ AV_PIX_FMT_YUVA444P12LE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, little-endian
+
+ AV_PIX_FMT_NV24, ///< planar YUV 4:4:4, 24bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V)
+ AV_PIX_FMT_NV42, ///< as above, but U and V bytes are swapped
+
+ /**
+ * Vulkan hardware images.
+ *
+ * data[0] points to an AVVkFrame
+ */
+ AV_PIX_FMT_VULKAN,
+
+ AV_PIX_FMT_Y210BE, ///< packed YUV 4:2:2 like YUYV422, 20bpp, data in the high bits, big-endian
+ AV_PIX_FMT_Y210LE, ///< packed YUV 4:2:2 like YUYV422, 20bpp, data in the high bits, little-endian
+
+ AV_PIX_FMT_X2RGB10LE, ///< packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), little-endian, X=unused/undefined
+ AV_PIX_FMT_X2RGB10BE, ///< packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), big-endian, X=unused/undefined
+ AV_PIX_FMT_X2BGR10LE, ///< packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 10R(lsb), little-endian, X=unused/undefined
+ AV_PIX_FMT_X2BGR10BE, ///< packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 10R(lsb), big-endian, X=unused/undefined
+
+ AV_PIX_FMT_P210BE, ///< interleaved chroma YUV 4:2:2, 20bpp, data in the high bits, big-endian
+ AV_PIX_FMT_P210LE, ///< interleaved chroma YUV 4:2:2, 20bpp, data in the high bits, little-endian
+
+ AV_PIX_FMT_P410BE, ///< interleaved chroma YUV 4:4:4, 30bpp, data in the high bits, big-endian
+ AV_PIX_FMT_P410LE, ///< interleaved chroma YUV 4:4:4, 30bpp, data in the high bits, little-endian
+
+ AV_PIX_FMT_P216BE, ///< interleaved chroma YUV 4:2:2, 32bpp, big-endian
+ AV_PIX_FMT_P216LE, ///< interleaved chroma YUV 4:2:2, 32bpp, little-endian
+
+ AV_PIX_FMT_P416BE, ///< interleaved chroma YUV 4:4:4, 48bpp, big-endian
+ AV_PIX_FMT_P416LE, ///< interleaved chroma YUV 4:4:4, 48bpp, little-endian
+
+ AV_PIX_FMT_VUYA, ///< packed VUYA 4:4:4, 32bpp, VUYAVUYA...
+
+ AV_PIX_FMT_RGBAF16BE, ///< IEEE-754 half precision packed RGBA 16:16:16:16, 64bpp, RGBARGBA..., big-endian
+ AV_PIX_FMT_RGBAF16LE, ///< IEEE-754 half precision packed RGBA 16:16:16:16, 64bpp, RGBARGBA..., little-endian
+
+ AV_PIX_FMT_VUYX, ///< packed VUYX 4:4:4, 32bpp, Variant of VUYA where alpha channel is left undefined
+
+ AV_PIX_FMT_P012LE, ///< like NV12, with 12bpp per component, data in the high bits, zeros in the low bits, little-endian
+ AV_PIX_FMT_P012BE, ///< like NV12, with 12bpp per component, data in the high bits, zeros in the low bits, big-endian
+
+ AV_PIX_FMT_Y212BE, ///< packed YUV 4:2:2 like YUYV422, 24bpp, data in the high bits, zeros in the low bits, big-endian
+ AV_PIX_FMT_Y212LE, ///< packed YUV 4:2:2 like YUYV422, 24bpp, data in the high bits, zeros in the low bits, little-endian
+
+ AV_PIX_FMT_XV30BE, ///< packed XVYU 4:4:4, 32bpp, (msb)2X 10V 10Y 10U(lsb), big-endian, variant of Y410 where alpha channel is left undefined
+ AV_PIX_FMT_XV30LE, ///< packed XVYU 4:4:4, 32bpp, (msb)2X 10V 10Y 10U(lsb), little-endian, variant of Y410 where alpha channel is left undefined
+
+ AV_PIX_FMT_XV36BE, ///< packed XVYU 4:4:4, 48bpp, data in the high bits, zeros in the low bits, big-endian, variant of Y412 where alpha channel is left undefined
+ AV_PIX_FMT_XV36LE, ///< packed XVYU 4:4:4, 48bpp, data in the high bits, zeros in the low bits, little-endian, variant of Y412 where alpha channel is left undefined
+
+ AV_PIX_FMT_RGBF32BE, ///< IEEE-754 single precision packed RGB 32:32:32, 96bpp, RGBRGB..., big-endian
+ AV_PIX_FMT_RGBF32LE, ///< IEEE-754 single precision packed RGB 32:32:32, 96bpp, RGBRGB..., little-endian
+
+ AV_PIX_FMT_RGBAF32BE, ///< IEEE-754 single precision packed RGBA 32:32:32:32, 128bpp, RGBARGBA..., big-endian
+ AV_PIX_FMT_RGBAF32LE, ///< IEEE-754 single precision packed RGBA 32:32:32:32, 128bpp, RGBARGBA..., little-endian
+
+ AV_PIX_FMT_P212BE, ///< interleaved chroma YUV 4:2:2, 24bpp, data in the high bits, big-endian
+ AV_PIX_FMT_P212LE, ///< interleaved chroma YUV 4:2:2, 24bpp, data in the high bits, little-endian
+
+ AV_PIX_FMT_P412BE, ///< interleaved chroma YUV 4:4:4, 36bpp, data in the high bits, big-endian
+ AV_PIX_FMT_P412LE, ///< interleaved chroma YUV 4:4:4, 36bpp, data in the high bits, little-endian
+
+ AV_PIX_FMT_GBRAP14BE, ///< planar GBR 4:4:4:4 56bpp, big-endian
+ AV_PIX_FMT_GBRAP14LE, ///< planar GBR 4:4:4:4 56bpp, little-endian
+
+ /**
+ * Hardware surfaces for Direct3D 12.
+ *
+ * data[0] points to an AVD3D12VAFrame
+ */
+ AV_PIX_FMT_D3D12,
+
AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
};
@@ -398,6 +497,7 @@ enum AVPixelFormat {
#define AV_PIX_FMT_GBRP16 AV_PIX_FMT_NE(GBRP16BE, GBRP16LE)
#define AV_PIX_FMT_GBRAP10 AV_PIX_FMT_NE(GBRAP10BE, GBRAP10LE)
#define AV_PIX_FMT_GBRAP12 AV_PIX_FMT_NE(GBRAP12BE, GBRAP12LE)
+#define AV_PIX_FMT_GBRAP14 AV_PIX_FMT_NE(GBRAP14BE, GBRAP14LE)
#define AV_PIX_FMT_GBRAP16 AV_PIX_FMT_NE(GBRAP16BE, GBRAP16LE)
#define AV_PIX_FMT_BAYER_BGGR16 AV_PIX_FMT_NE(BAYER_BGGR16BE, BAYER_BGGR16LE)
@@ -416,6 +516,8 @@ enum AVPixelFormat {
#define AV_PIX_FMT_YUVA420P10 AV_PIX_FMT_NE(YUVA420P10BE, YUVA420P10LE)
#define AV_PIX_FMT_YUVA422P10 AV_PIX_FMT_NE(YUVA422P10BE, YUVA422P10LE)
#define AV_PIX_FMT_YUVA444P10 AV_PIX_FMT_NE(YUVA444P10BE, YUVA444P10LE)
+#define AV_PIX_FMT_YUVA422P12 AV_PIX_FMT_NE(YUVA422P12BE, YUVA422P12LE)
+#define AV_PIX_FMT_YUVA444P12 AV_PIX_FMT_NE(YUVA444P12BE, YUVA444P12LE)
#define AV_PIX_FMT_YUVA420P16 AV_PIX_FMT_NE(YUVA420P16BE, YUVA420P16LE)
#define AV_PIX_FMT_YUVA422P16 AV_PIX_FMT_NE(YUVA422P16BE, YUVA422P16LE)
#define AV_PIX_FMT_YUVA444P16 AV_PIX_FMT_NE(YUVA444P16BE, YUVA444P16LE)
@@ -424,35 +526,56 @@ enum AVPixelFormat {
#define AV_PIX_FMT_NV20 AV_PIX_FMT_NE(NV20BE, NV20LE)
#define AV_PIX_FMT_AYUV64 AV_PIX_FMT_NE(AYUV64BE, AYUV64LE)
#define AV_PIX_FMT_P010 AV_PIX_FMT_NE(P010BE, P010LE)
+#define AV_PIX_FMT_P012 AV_PIX_FMT_NE(P012BE, P012LE)
#define AV_PIX_FMT_P016 AV_PIX_FMT_NE(P016BE, P016LE)
+#define AV_PIX_FMT_Y210 AV_PIX_FMT_NE(Y210BE, Y210LE)
+#define AV_PIX_FMT_Y212 AV_PIX_FMT_NE(Y212BE, Y212LE)
+#define AV_PIX_FMT_XV30 AV_PIX_FMT_NE(XV30BE, XV30LE)
+#define AV_PIX_FMT_XV36 AV_PIX_FMT_NE(XV36BE, XV36LE)
+#define AV_PIX_FMT_X2RGB10 AV_PIX_FMT_NE(X2RGB10BE, X2RGB10LE)
+#define AV_PIX_FMT_X2BGR10 AV_PIX_FMT_NE(X2BGR10BE, X2BGR10LE)
+
+#define AV_PIX_FMT_P210 AV_PIX_FMT_NE(P210BE, P210LE)
+#define AV_PIX_FMT_P410 AV_PIX_FMT_NE(P410BE, P410LE)
+#define AV_PIX_FMT_P212 AV_PIX_FMT_NE(P212BE, P212LE)
+#define AV_PIX_FMT_P412 AV_PIX_FMT_NE(P412BE, P412LE)
+#define AV_PIX_FMT_P216 AV_PIX_FMT_NE(P216BE, P216LE)
+#define AV_PIX_FMT_P416 AV_PIX_FMT_NE(P416BE, P416LE)
+
+#define AV_PIX_FMT_RGBAF16 AV_PIX_FMT_NE(RGBAF16BE, RGBAF16LE)
+
+#define AV_PIX_FMT_RGBF32 AV_PIX_FMT_NE(RGBF32BE, RGBF32LE)
+#define AV_PIX_FMT_RGBAF32 AV_PIX_FMT_NE(RGBAF32BE, RGBAF32LE)
+
/**
* Chromaticity coordinates of the source primaries.
- * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.1.
+ * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.1 and ITU-T H.273.
*/
enum AVColorPrimaries {
AVCOL_PRI_RESERVED0 = 0,
- AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
+ AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP 177 Annex B
AVCOL_PRI_UNSPECIFIED = 2,
AVCOL_PRI_RESERVED = 3,
AVCOL_PRI_BT470M = 4, ///< also FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
- AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above
+ AVCOL_PRI_SMPTE240M = 7, ///< identical to above, also called "SMPTE C" even though it uses D65
AVCOL_PRI_FILM = 8, ///< colour filters using Illuminant C
AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020
AVCOL_PRI_SMPTE428 = 10, ///< SMPTE ST 428-1 (CIE 1931 XYZ)
AVCOL_PRI_SMPTEST428_1 = AVCOL_PRI_SMPTE428,
AVCOL_PRI_SMPTE431 = 11, ///< SMPTE ST 431-2 (2011) / DCI P3
AVCOL_PRI_SMPTE432 = 12, ///< SMPTE ST 432-1 (2010) / P3 D65 / Display P3
- AVCOL_PRI_JEDEC_P22 = 22, ///< JEDEC P22 phosphors
+ AVCOL_PRI_EBU3213 = 22, ///< EBU Tech. 3213-E (nothing there) / one of JEDEC P22 group phosphors
+ AVCOL_PRI_JEDEC_P22 = AVCOL_PRI_EBU3213,
AVCOL_PRI_NB ///< Not part of ABI
};
/**
* Color Transfer Characteristic.
- * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.2.
+ * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.2.
*/
enum AVColorTransferCharacteristic {
AVCOL_TRC_RESERVED0 = 0,
@@ -481,18 +604,18 @@ enum AVColorTransferCharacteristic {
/**
* YUV colorspace type.
- * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.3.
+ * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.3.
*/
enum AVColorSpace {
- AVCOL_SPC_RGB = 0, ///< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
- AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
+ AVCOL_SPC_RGB = 0, ///< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB), YZX and ST 428-1
+ AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / derived in SMPTE RP 177 Annex B
AVCOL_SPC_UNSPECIFIED = 2,
- AVCOL_SPC_RESERVED = 3,
+ AVCOL_SPC_RESERVED = 3, ///< reserved for future use by ITU-T and ISO/IEC just like 15-255 are
AVCOL_SPC_FCC = 4, ///< FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
- AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
- AVCOL_SPC_SMPTE240M = 7, ///< functionally identical to above
- AVCOL_SPC_YCGCO = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
+ AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
+ AVCOL_SPC_SMPTE240M = 7, ///< derived from 170M primaries and D65 white point, 170M is derived from BT470 System M's primaries
+ AVCOL_SPC_YCGCO = 8, ///< used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
AVCOL_SPC_YCOCG = AVCOL_SPC_YCGCO,
AVCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system
AVCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system
@@ -500,16 +623,67 @@ enum AVColorSpace {
AVCOL_SPC_CHROMA_DERIVED_NCL = 12, ///< Chromaticity-derived non-constant luminance system
AVCOL_SPC_CHROMA_DERIVED_CL = 13, ///< Chromaticity-derived constant luminance system
AVCOL_SPC_ICTCP = 14, ///< ITU-R BT.2100-0, ICtCp
+ AVCOL_SPC_IPT_C2 = 15, ///< SMPTE ST 2128, IPT-C2
+ AVCOL_SPC_YCGCO_RE = 16, ///< YCgCo-R, even addition of bits
+ AVCOL_SPC_YCGCO_RO = 17, ///< YCgCo-R, odd addition of bits
AVCOL_SPC_NB ///< Not part of ABI
};
/**
- * MPEG vs JPEG YUV range.
+ * Visual content value range.
+ *
+ * These values are based on definitions that can be found in multiple
+ * specifications, such as ITU-T BT.709 (3.4 - Quantization of RGB, luminance
+ * and colour-difference signals), ITU-T BT.2020 (Table 5 - Digital
+ * Representation) as well as ITU-T BT.2100 (Table 9 - Digital 10- and 12-bit
+ * integer representation). At the time of writing, the BT.2100 one is
+ * recommended, as it also defines the full range representation.
+ *
+ * Common definitions:
+ * - For RGB and luma planes such as Y in YCbCr and I in ICtCp,
+ * 'E' is the original value in range of 0.0 to 1.0.
+ * - For chroma planes such as Cb,Cr and Ct,Cp, 'E' is the original
+ * value in range of -0.5 to 0.5.
+ * - 'n' is the output bit depth.
+ * - For additional definitions such as rounding and clipping to valid n
+ * bit unsigned integer range, please refer to BT.2100 (Table 9).
*/
enum AVColorRange {
AVCOL_RANGE_UNSPECIFIED = 0,
- AVCOL_RANGE_MPEG = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges
- AVCOL_RANGE_JPEG = 2, ///< the normal 2^n-1 "JPEG" YUV ranges
+
+ /**
+ * Narrow or limited range content.
+ *
+ * - For luma planes:
+ *
+ * (219 * E + 16) * 2^(n-8)
+ *
+ * F.ex. the range of 16-235 for 8 bits
+ *
+ * - For chroma planes:
+ *
+ * (224 * E + 128) * 2^(n-8)
+ *
+ * F.ex. the range of 16-240 for 8 bits
+ */
+ AVCOL_RANGE_MPEG = 1,
+
+ /**
+ * Full range content.
+ *
+ * - For RGB and luma planes:
+ *
+ * (2^n - 1) * E
+ *
+ * F.ex. the range of 0-255 for 8 bits
+ *
+ * - For chroma planes:
+ *
+ * (2^n - 1) * E + 2^(n - 1)
+ *
+ * F.ex. the range of 1-255 for 8 bits
+ */
+ AVCOL_RANGE_JPEG = 2,
AVCOL_RANGE_NB ///< Not part of ABI
};
diff --git a/ffmpeg/include/libavutil/random_seed.h b/ffmpeg/include/libavutil/random_seed.h
index 0462a048..8a47be96 100644
--- a/ffmpeg/include/libavutil/random_seed.h
+++ b/ffmpeg/include/libavutil/random_seed.h
@@ -21,6 +21,7 @@
#ifndef AVUTIL_RANDOM_SEED_H
#define AVUTIL_RANDOM_SEED_H
+#include
#include
/**
* @addtogroup lavu_crypto
@@ -36,6 +37,19 @@
*/
uint32_t av_get_random_seed(void);
+/**
+ * Generate cryptographically secure random data, i.e. suitable for use as
+ * encryption keys and similar.
+ *
+ * @param buf buffer into which the random data will be written
+ * @param len size of buf in bytes
+ *
+ * @retval 0 success, len bytes of random data was written
+ * into buf
+ * @retval "a negative AVERROR code" random data could not be generated
+ */
+int av_random_bytes(uint8_t *buf, size_t len);
+
/**
* @}
*/
diff --git a/ffmpeg/include/libavutil/rational.h b/ffmpeg/include/libavutil/rational.h
index 5c6b67b4..849f47f3 100644
--- a/ffmpeg/include/libavutil/rational.h
+++ b/ffmpeg/include/libavutil/rational.h
@@ -168,6 +168,10 @@ static av_always_inline AVRational av_inv_q(AVRational q)
* In case of infinity, the returned value is expressed as `{1, 0}` or
* `{-1, 0}` depending on the sign.
*
+ * In general rational numbers with |num| <= 1<<26 && |den| <= 1<<26
+ * can be recovered exactly from their double representation.
+ * (no exceptions were found within 1B random ones)
+ *
* @param d `double` to convert
* @param max Maximum allowed numerator and denominator
* @return `d` in AVRational form
@@ -179,7 +183,8 @@ AVRational av_d2q(double d, int max) av_const;
* Find which of the two rationals is closer to another rational.
*
* @param q Rational to be compared against
- * @param q1,q2 Rationals to be tested
+ * @param q1 Rational to be tested
+ * @param q2 Rational to be tested
* @return One of the following values:
* - 1 if `q1` is nearer to `q` than `q2`
* - -1 if `q2` is nearer to `q` than `q1`
@@ -207,6 +212,12 @@ int av_find_nearest_q_idx(AVRational q, const AVRational* q_list);
*/
uint32_t av_q2intfloat(AVRational q);
+/**
+ * Return the best rational so that a and b are multiple of it.
+ * If the resulting denominator is larger than max_den, return def.
+ */
+AVRational av_gcd_q(AVRational a, AVRational b, int max_den, AVRational def);
+
/**
* @}
*/
diff --git a/ffmpeg/include/libavutil/rc4.h b/ffmpeg/include/libavutil/rc4.h
index 029cd2ad..bf0ca6e9 100644
--- a/ffmpeg/include/libavutil/rc4.h
+++ b/ffmpeg/include/libavutil/rc4.h
@@ -42,6 +42,8 @@ AVRC4 *av_rc4_alloc(void);
/**
* @brief Initializes an AVRC4 context.
*
+ * @param d pointer to the AVRC4 context
+ * @param key buffer containig the key
* @param key_bits must be a multiple of 8
* @param decrypt 0 for encryption, 1 for decryption, currently has no effect
* @return zero on success, negative value otherwise
@@ -51,6 +53,7 @@ int av_rc4_init(struct AVRC4 *d, const uint8_t *key, int key_bits, int decrypt);
/**
* @brief Encrypts / decrypts using the RC4 algorithm.
*
+ * @param d pointer to the AVRC4 context
* @param count number of bytes
* @param dst destination array, can be equal to src
* @param src source array, can be equal to dst, may be NULL
diff --git a/ffmpeg/include/libavutil/ripemd.h b/ffmpeg/include/libavutil/ripemd.h
index 0db6858f..9df9f905 100644
--- a/ffmpeg/include/libavutil/ripemd.h
+++ b/ffmpeg/include/libavutil/ripemd.h
@@ -28,10 +28,10 @@
#ifndef AVUTIL_RIPEMD_H
#define AVUTIL_RIPEMD_H
+#include
#include
#include "attributes.h"
-#include "version.h"
/**
* @defgroup lavu_ripemd RIPEMD
@@ -66,11 +66,7 @@ int av_ripemd_init(struct AVRIPEMD* context, int bits);
* @param data input data to update hash with
* @param len input data length
*/
-#if FF_API_CRYPTO_SIZE_T
-void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, unsigned int len);
-#else
void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, size_t len);
-#endif
/**
* Finish hashing and output digest value.
diff --git a/ffmpeg/include/libavutil/samplefmt.h b/ffmpeg/include/libavutil/samplefmt.h
index 8cd43ae8..43a57a42 100644
--- a/ffmpeg/include/libavutil/samplefmt.h
+++ b/ffmpeg/include/libavutil/samplefmt.h
@@ -21,9 +21,6 @@
#include
-#include "avutil.h"
-#include "attributes.h"
-
/**
* @addtogroup lavu_audio
* @{
@@ -195,9 +192,8 @@ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
* @param nb_samples the number of samples in a single channel
* @param sample_fmt the sample format
* @param align buffer size alignment (0 = default, 1 = no alignment)
- * @return >=0 on success or a negative error code on failure
- * @todo return minimum size in bytes required for the buffer in case
- * of success at the next bump
+ * @return minimum size in bytes required for the buffer on success,
+ * or a negative error code on failure
*/
int av_samples_fill_arrays(uint8_t **audio_data, int *linesize,
const uint8_t *buf,
@@ -217,6 +213,7 @@ int av_samples_fill_arrays(uint8_t **audio_data, int *linesize,
* @param[out] linesize aligned size for audio buffer(s), may be NULL
* @param nb_channels number of audio channels
* @param nb_samples number of samples per channel
+ * @param sample_fmt the sample format
* @param align buffer size alignment (0 = default, 1 = no alignment)
* @return >=0 on success or a negative error code on failure
* @todo return the size of the allocated buffer in case of success at the next bump
@@ -249,7 +246,7 @@ int av_samples_alloc_array_and_samples(uint8_t ***audio_data, int *linesize, int
* @param nb_channels number of audio channels
* @param sample_fmt audio sample format
*/
-int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset,
+int av_samples_copy(uint8_t * const *dst, uint8_t * const *src, int dst_offset,
int src_offset, int nb_samples, int nb_channels,
enum AVSampleFormat sample_fmt);
@@ -262,7 +259,7 @@ int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset,
* @param nb_channels number of audio channels
* @param sample_fmt audio sample format
*/
-int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples,
+int av_samples_set_silence(uint8_t * const *audio_data, int offset, int nb_samples,
int nb_channels, enum AVSampleFormat sample_fmt);
/**
diff --git a/ffmpeg/include/libavutil/sha.h b/ffmpeg/include/libavutil/sha.h
index c0180e57..2e1220ab 100644
--- a/ffmpeg/include/libavutil/sha.h
+++ b/ffmpeg/include/libavutil/sha.h
@@ -31,7 +31,6 @@
#include
#include "attributes.h"
-#include "version.h"
/**
* @defgroup lavu_sha SHA
@@ -74,11 +73,7 @@ int av_sha_init(struct AVSHA* context, int bits);
* @param data input data to update hash with
* @param len input data length
*/
-#if FF_API_CRYPTO_SIZE_T
-void av_sha_update(struct AVSHA *ctx, const uint8_t *data, unsigned int len);
-#else
void av_sha_update(struct AVSHA *ctx, const uint8_t *data, size_t len);
-#endif
/**
* Finish hashing and output digest value.
diff --git a/ffmpeg/include/libavutil/sha512.h b/ffmpeg/include/libavutil/sha512.h
index bef714b4..a4a3f23d 100644
--- a/ffmpeg/include/libavutil/sha512.h
+++ b/ffmpeg/include/libavutil/sha512.h
@@ -32,7 +32,6 @@
#include
#include "attributes.h"
-#include "version.h"
/**
* @defgroup lavu_sha512 SHA-512
@@ -76,11 +75,7 @@ int av_sha512_init(struct AVSHA512* context, int bits);
* @param data input data to update hash with
* @param len input data length
*/
-#if FF_API_CRYPTO_SIZE_T
-void av_sha512_update(struct AVSHA512* context, const uint8_t* data, unsigned int len);
-#else
void av_sha512_update(struct AVSHA512* context, const uint8_t* data, size_t len);
-#endif
/**
* Finish hashing and output digest value.
diff --git a/ffmpeg/include/libavutil/spherical.h b/ffmpeg/include/libavutil/spherical.h
index cef759cf..2e90f775 100644
--- a/ffmpeg/include/libavutil/spherical.h
+++ b/ffmpeg/include/libavutil/spherical.h
@@ -20,6 +20,7 @@
/**
* @file
+ * @ingroup lavu_video_spherical
* Spherical video
*/
@@ -30,19 +31,14 @@
#include
/**
- * @addtogroup lavu_video
- * @{
- *
* @defgroup lavu_video_spherical Spherical video mapping
- * @{
- */
-
-/**
- * @addtogroup lavu_video_spherical
+ * @ingroup lavu_video
+ *
* A spherical video file contains surfaces that need to be mapped onto a
* sphere. Depending on how the frame was converted, a different distortion
* transformation or surface recomposition function needs to be applied before
* the video should be mapped and displayed.
+ * @{
*/
/**
@@ -70,6 +66,22 @@ enum AVSphericalProjection {
* the position of the current video in a larger surface.
*/
AV_SPHERICAL_EQUIRECTANGULAR_TILE,
+
+ /**
+ * Video frame displays as a 180 degree equirectangular projection.
+ */
+ AV_SPHERICAL_HALF_EQUIRECTANGULAR,
+
+ /**
+ * Video frame displays on a flat, rectangular 2D surface.
+ */
+ AV_SPHERICAL_RECTILINEAR,
+
+ /**
+ * Fisheye projection (Apple).
+ * See: https://developer.apple.com/documentation/coremedia/cmprojectiontype/fisheye
+ */
+ AV_SPHERICAL_FISHEYE,
};
/**
@@ -225,7 +237,6 @@ const char *av_spherical_projection_name(enum AVSphericalProjection projection);
*/
int av_spherical_from_name(const char *name);
/**
- * @}
* @}
*/
diff --git a/ffmpeg/include/libavutil/stereo3d.h b/ffmpeg/include/libavutil/stereo3d.h
index d421aac2..c0a4ab3f 100644
--- a/ffmpeg/include/libavutil/stereo3d.h
+++ b/ffmpeg/include/libavutil/stereo3d.h
@@ -20,6 +20,7 @@
/**
* @file
+ * @ingroup lavu_video_stereo3d
* Stereoscopic video
*/
@@ -31,19 +32,15 @@
#include "frame.h"
/**
- * @addtogroup lavu_video
- * @{
- *
* @defgroup lavu_video_stereo3d Stereo3D types and functions
- * @{
- */
-
-/**
- * @addtogroup lavu_video_stereo3d
+ * @ingroup lavu_video
+ *
* A stereoscopic video file consists in multiple views embedded in a single
* frame, usually describing two views of a scene. This file describes all
* possible codec-independent view arrangements.
- * */
+ *
+ * @{
+ */
/**
* List of possible 3D Types
@@ -139,6 +136,11 @@ enum AVStereo3DType {
* @endcode
*/
AV_STEREO3D_COLUMNS,
+
+ /**
+ * Video is stereoscopic but the packing is unspecified.
+ */
+ AV_STEREO3D_UNSPEC,
};
/**
@@ -159,6 +161,31 @@ enum AVStereo3DView {
* Frame contains only the right view.
*/
AV_STEREO3D_VIEW_RIGHT,
+
+ /**
+ * Content is unspecified.
+ */
+ AV_STEREO3D_VIEW_UNSPEC,
+};
+
+/**
+ * List of possible primary eyes.
+ */
+enum AVStereo3DPrimaryEye {
+ /**
+ * Neither eye.
+ */
+ AV_PRIMARY_EYE_NONE,
+
+ /**
+ * Left eye.
+ */
+ AV_PRIMARY_EYE_LEFT,
+
+ /**
+ * Right eye
+ */
+ AV_PRIMARY_EYE_RIGHT,
};
/**
@@ -188,6 +215,28 @@ typedef struct AVStereo3D {
* Determines which views are packed.
*/
enum AVStereo3DView view;
+
+ /**
+ * Which eye is the primary eye when rendering in 2D.
+ */
+ enum AVStereo3DPrimaryEye primary_eye;
+
+ /**
+ * The distance between the centres of the lenses of the camera system,
+ * in micrometers. Zero if unset.
+ */
+ uint32_t baseline;
+
+ /**
+ * Relative shift of the left and right images, which changes the zero parallax plane.
+ * Range is -1.0 to 1.0. Zero if unset.
+ */
+ AVRational horizontal_disparity_adjustment;
+
+ /**
+ * Horizontal field of view, in degrees. Zero if unset.
+ */
+ AVRational horizontal_field_of_view;
} AVStereo3D;
/**
@@ -198,6 +247,14 @@ typedef struct AVStereo3D {
*/
AVStereo3D *av_stereo3d_alloc(void);
+/**
+ * Allocate an AVStereo3D structure and set its fields to default values.
+ * The resulting struct can be freed using av_freep().
+ *
+ * @return An AVStereo3D filled with default values or NULL on failure.
+ */
+AVStereo3D *av_stereo3d_alloc_size(size_t *size);
+
/**
* Allocate a complete AVFrameSideData and add it to the frame.
*
@@ -226,7 +283,42 @@ const char *av_stereo3d_type_name(unsigned int type);
int av_stereo3d_from_name(const char *name);
/**
- * @}
+ * Provide a human-readable name of a given stereo3d view.
+ *
+ * @param type The input stereo3d view value.
+ *
+ * @return The name of the stereo3d view value, or "unknown".
+ */
+const char *av_stereo3d_view_name(unsigned int view);
+
+/**
+ * Get the AVStereo3DView form a human-readable name.
+ *
+ * @param name The input string.
+ *
+ * @return The AVStereo3DView value, or -1 if not found.
+ */
+int av_stereo3d_view_from_name(const char *name);
+
+/**
+ * Provide a human-readable name of a given stereo3d primary eye.
+ *
+ * @param type The input stereo3d primary eye value.
+ *
+ * @return The name of the stereo3d primary eye value, or "unknown".
+ */
+const char *av_stereo3d_primary_eye_name(unsigned int eye);
+
+/**
+ * Get the AVStereo3DPrimaryEye form a human-readable name.
+ *
+ * @param name The input string.
+ *
+ * @return The AVStereo3DPrimaryEye value, or -1 if not found.
+ */
+int av_stereo3d_primary_eye_from_name(const char *name);
+
+/**
* @}
*/
diff --git a/ffmpeg/include/libavutil/timecode.h b/ffmpeg/include/libavutil/timecode.h
index 37c1361b..fe0fc835 100644
--- a/ffmpeg/include/libavutil/timecode.h
+++ b/ffmpeg/include/libavutil/timecode.h
@@ -49,9 +49,9 @@ typedef struct {
* Adjust frame number for NTSC drop frame time code.
*
* @param framenum frame number to adjust
- * @param fps frame per second, 30 or 60
+ * @param fps frame per second, multiples of 30
* @return adjusted frame number
- * @warning adjustment is only valid in NTSC 29.97 and 59.94
+ * @warning adjustment is only valid for multiples of NTSC 29.97
*/
int av_timecode_adjust_ntsc_framenum2(int framenum, int fps);
@@ -62,19 +62,44 @@ int av_timecode_adjust_ntsc_framenum2(int framenum, int fps);
* @param framenum frame number
* @return the SMPTE binary representation
*
+ * See SMPTE ST 314M-2005 Sec 4.4.2.2.1 "Time code pack (TC)"
+ * the format description as follows:
+ * bits 0-5: hours, in BCD(6bits)
+ * bits 6: BGF1
+ * bits 7: BGF2 (NTSC) or FIELD (PAL)
+ * bits 8-14: minutes, in BCD(7bits)
+ * bits 15: BGF0 (NTSC) or BGF2 (PAL)
+ * bits 16-22: seconds, in BCD(7bits)
+ * bits 23: FIELD (NTSC) or BGF0 (PAL)
+ * bits 24-29: frames, in BCD(6bits)
+ * bits 30: drop frame flag (0: non drop, 1: drop)
+ * bits 31: color frame flag (0: unsync mode, 1: sync mode)
+ * @note BCD numbers (6 or 7 bits): 4 or 5 lower bits for units, 2 higher bits for tens.
* @note Frame number adjustment is automatically done in case of drop timecode,
* you do NOT have to call av_timecode_adjust_ntsc_framenum2().
* @note The frame number is relative to tc->start.
- * @note Color frame (CF), binary group flags (BGF) and biphase mark polarity
- * correction (PC) bits are set to zero.
+ * @note Color frame (CF) and binary group flags (BGF) bits are set to zero.
*/
uint32_t av_timecode_get_smpte_from_framenum(const AVTimecode *tc, int framenum);
+/**
+ * Convert sei info to SMPTE 12M binary representation.
+ *
+ * @param rate frame rate in rational form
+ * @param drop drop flag
+ * @param hh hour
+ * @param mm minute
+ * @param ss second
+ * @param ff frame number
+ * @return the SMPTE binary representation
+ */
+uint32_t av_timecode_get_smpte(AVRational rate, int drop, int hh, int mm, int ss, int ff);
+
/**
* Load timecode string in buf.
*
- * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long
* @param tc timecode data correctly initialized
+ * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long
* @param framenum frame number
* @return the buf parameter
*
@@ -84,6 +109,23 @@ uint32_t av_timecode_get_smpte_from_framenum(const AVTimecode *tc, int framenum)
*/
char *av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum);
+/**
+ * Get the timecode string from the SMPTE timecode format.
+ *
+ * In contrast to av_timecode_make_smpte_tc_string this function supports 50/60
+ * fps timecodes by using the field bit.
+ *
+ * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long
+ * @param rate frame rate of the timecode
+ * @param tcsmpte the 32-bit SMPTE timecode
+ * @param prevent_df prevent the use of a drop flag when it is known the DF bit
+ * is arbitrary
+ * @param skip_field prevent the use of a field flag when it is known the field
+ * bit is arbitrary (e.g. because it is used as PC flag)
+ * @return the buf parameter
+ */
+char *av_timecode_make_smpte_tc_string2(char *buf, AVRational rate, uint32_t tcsmpte, int prevent_df, int skip_field);
+
/**
* Get the timecode string from the SMPTE timecode format.
*
@@ -107,25 +149,42 @@ char *av_timecode_make_mpeg_tc_string(char *buf, uint32_t tc25bit);
/**
* Init a timecode struct with the passed parameters.
*
- * @param log_ctx a pointer to an arbitrary struct of which the first field
- * is a pointer to an AVClass struct (used for av_log)
* @param tc pointer to an allocated AVTimecode
* @param rate frame rate in rational form
* @param flags miscellaneous flags such as drop frame, +24 hours, ...
* (see AVTimecodeFlag)
* @param frame_start the first frame number
+ * @param log_ctx a pointer to an arbitrary struct of which the first field
+ * is a pointer to an AVClass struct (used for av_log)
* @return 0 on success, AVERROR otherwise
*/
int av_timecode_init(AVTimecode *tc, AVRational rate, int flags, int frame_start, void *log_ctx);
+/**
+ * Init a timecode struct from the passed timecode components.
+ *
+ * @param tc pointer to an allocated AVTimecode
+ * @param rate frame rate in rational form
+ * @param flags miscellaneous flags such as drop frame, +24 hours, ...
+ * (see AVTimecodeFlag)
+ * @param hh hours
+ * @param mm minutes
+ * @param ss seconds
+ * @param ff frames
+ * @param log_ctx a pointer to an arbitrary struct of which the first field
+ * is a pointer to an AVClass struct (used for av_log)
+ * @return 0 on success, AVERROR otherwise
+ */
+int av_timecode_init_from_components(AVTimecode *tc, AVRational rate, int flags, int hh, int mm, int ss, int ff, void *log_ctx);
+
/**
* Parse timecode representation (hh:mm:ss[:;.]ff).
*
- * @param log_ctx a pointer to an arbitrary struct of which the first field is a
- * pointer to an AVClass struct (used for av_log).
* @param tc pointer to an allocated AVTimecode
* @param rate frame rate in rational form
* @param str timecode string which will determine the frame start
+ * @param log_ctx a pointer to an arbitrary struct of which the first field is a
+ * pointer to an AVClass struct (used for av_log).
* @return 0 on success, AVERROR otherwise
*/
int av_timecode_init_from_string(AVTimecode *tc, AVRational rate, const char *str, void *log_ctx);
diff --git a/ffmpeg/include/libavutil/timestamp.h b/ffmpeg/include/libavutil/timestamp.h
index e082f01b..fa53a46b 100644
--- a/ffmpeg/include/libavutil/timestamp.h
+++ b/ffmpeg/include/libavutil/timestamp.h
@@ -24,7 +24,7 @@
#ifndef AVUTIL_TIMESTAMP_H
#define AVUTIL_TIMESTAMP_H
-#include "common.h"
+#include "avutil.h"
#if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) && !defined(PRId64)
#error missing -D__STDC_FORMAT_MACROS / #define __STDC_FORMAT_MACROS
@@ -62,11 +62,18 @@ static inline char *av_ts_make_string(char *buf, int64_t ts)
* @param tb the timebase of the timestamp
* @return the buffer in input
*/
-static inline char *av_ts_make_time_string(char *buf, int64_t ts, AVRational *tb)
+char *av_ts_make_time_string2(char *buf, int64_t ts, AVRational tb);
+
+/**
+ * Fill the provided buffer with a string containing a timestamp
+ * representation.
+ *
+ * @see av_ts_make_time_string2
+ */
+static inline char *av_ts_make_time_string(char *buf, int64_t ts,
+ const AVRational *tb)
{
- if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS");
- else snprintf(buf, AV_TS_MAX_STRING_SIZE, "%.6g", av_q2d(*tb) * ts);
- return buf;
+ return av_ts_make_time_string2(buf, ts, *tb);
}
/**
diff --git a/ffmpeg/include/libavutil/tree.h b/ffmpeg/include/libavutil/tree.h
index d5e0aebf..bbb8fbb1 100644
--- a/ffmpeg/include/libavutil/tree.h
+++ b/ffmpeg/include/libavutil/tree.h
@@ -28,7 +28,6 @@
#define AVUTIL_TREE_H
#include "attributes.h"
-#include "version.h"
/**
* @addtogroup lavu_tree AVTree
diff --git a/ffmpeg/include/libavutil/twofish.h b/ffmpeg/include/libavutil/twofish.h
index 813cfecd..67f359e8 100644
--- a/ffmpeg/include/libavutil/twofish.h
+++ b/ffmpeg/include/libavutil/twofish.h
@@ -59,7 +59,7 @@ int av_twofish_init(struct AVTWOFISH *ctx, const uint8_t *key, int key_bits);
* @param dst destination array, can be equal to src
* @param src source array, can be equal to dst
* @param count number of 16 byte blocks
- * @paran iv initialization vector for CBC mode, NULL for ECB mode
+ * @param iv initialization vector for CBC mode, NULL for ECB mode
* @param decrypt 0 for encryption, 1 for decryption
*/
void av_twofish_crypt(struct AVTWOFISH *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t* iv, int decrypt);
diff --git a/ffmpeg/include/libavutil/tx.h b/ffmpeg/include/libavutil/tx.h
new file mode 100644
index 00000000..4696988c
--- /dev/null
+++ b/ffmpeg/include/libavutil/tx.h
@@ -0,0 +1,210 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_TX_H
+#define AVUTIL_TX_H
+
+#include
+#include
+
+typedef struct AVTXContext AVTXContext;
+
+typedef struct AVComplexFloat {
+ float re, im;
+} AVComplexFloat;
+
+typedef struct AVComplexDouble {
+ double re, im;
+} AVComplexDouble;
+
+typedef struct AVComplexInt32 {
+ int32_t re, im;
+} AVComplexInt32;
+
+enum AVTXType {
+ /**
+ * Standard complex to complex FFT with sample data type of AVComplexFloat,
+ * AVComplexDouble or AVComplexInt32, for each respective variant.
+ *
+ * Output is not 1/len normalized. Scaling currently unsupported.
+ * The stride parameter must be set to the size of a single sample in bytes.
+ */
+ AV_TX_FLOAT_FFT = 0,
+ AV_TX_DOUBLE_FFT = 2,
+ AV_TX_INT32_FFT = 4,
+
+ /**
+ * Standard MDCT with a sample data type of float, double or int32_t,
+ * respecively. For the float and int32 variants, the scale type is
+ * 'float', while for the double variant, it's 'double'.
+ * If scale is NULL, 1.0 will be used as a default.
+ *
+ * Length is the frame size, not the window size (which is 2x frame).
+ * For forward transforms, the stride specifies the spacing between each
+ * sample in the output array in bytes. The input must be a flat array.
+ *
+ * For inverse transforms, the stride specifies the spacing between each
+ * sample in the input array in bytes. The output must be a flat array.
+ *
+ * NOTE: the inverse transform is half-length, meaning the output will not
+ * contain redundant data. This is what most codecs work with. To do a full
+ * inverse transform, set the AV_TX_FULL_IMDCT flag on init.
+ */
+ AV_TX_FLOAT_MDCT = 1,
+ AV_TX_DOUBLE_MDCT = 3,
+ AV_TX_INT32_MDCT = 5,
+
+ /**
+ * Real to complex and complex to real DFTs.
+ * For the float and int32 variants, the scale type is 'float', while for
+ * the double variant, it's a 'double'. If scale is NULL, 1.0 will be used
+ * as a default.
+ *
+ * For forward transforms (R2C), stride must be the spacing between two
+ * samples in bytes. For inverse transforms, the stride must be set
+ * to the spacing between two complex values in bytes.
+ *
+ * The forward transform performs a real-to-complex DFT of N samples to
+ * N/2+1 complex values.
+ *
+ * The inverse transform performs a complex-to-real DFT of N/2+1 complex
+ * values to N real samples. The output is not normalized, but can be
+ * made so by setting the scale value to 1.0/len.
+ * NOTE: the inverse transform always overwrites the input.
+ */
+ AV_TX_FLOAT_RDFT = 6,
+ AV_TX_DOUBLE_RDFT = 7,
+ AV_TX_INT32_RDFT = 8,
+
+ /**
+ * Real to real (DCT) transforms.
+ *
+ * The forward transform is a DCT-II.
+ * The inverse transform is a DCT-III.
+ *
+ * The input array is always overwritten. DCT-III requires that the
+ * input be padded with 2 extra samples. Stride must be set to the
+ * spacing between two samples in bytes.
+ */
+ AV_TX_FLOAT_DCT = 9,
+ AV_TX_DOUBLE_DCT = 10,
+ AV_TX_INT32_DCT = 11,
+
+ /**
+ * Discrete Cosine Transform I
+ *
+ * The forward transform is a DCT-I.
+ * The inverse transform is a DCT-I multiplied by 2/(N + 1).
+ *
+ * The input array is always overwritten.
+ */
+ AV_TX_FLOAT_DCT_I = 12,
+ AV_TX_DOUBLE_DCT_I = 13,
+ AV_TX_INT32_DCT_I = 14,
+
+ /**
+ * Discrete Sine Transform I
+ *
+ * The forward transform is a DST-I.
+ * The inverse transform is a DST-I multiplied by 2/(N + 1).
+ *
+ * The input array is always overwritten.
+ */
+ AV_TX_FLOAT_DST_I = 15,
+ AV_TX_DOUBLE_DST_I = 16,
+ AV_TX_INT32_DST_I = 17,
+
+ /* Not part of the API, do not use */
+ AV_TX_NB,
+};
+
+/**
+ * Function pointer to a function to perform the transform.
+ *
+ * @note Using a different context than the one allocated during av_tx_init()
+ * is not allowed.
+ *
+ * @param s the transform context
+ * @param out the output array
+ * @param in the input array
+ * @param stride the input or output stride in bytes
+ *
+ * The out and in arrays must be aligned to the maximum required by the CPU
+ * architecture unless the AV_TX_UNALIGNED flag was set in av_tx_init().
+ * The stride must follow the constraints the transform type has specified.
+ */
+typedef void (*av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride);
+
+/**
+ * Flags for av_tx_init()
+ */
+enum AVTXFlags {
+ /**
+ * Allows for in-place transformations, where input == output.
+ * May be unsupported or slower for some transform types.
+ */
+ AV_TX_INPLACE = 1ULL << 0,
+
+ /**
+ * Relaxes alignment requirement for the in and out arrays of av_tx_fn().
+ * May be slower with certain transform types.
+ */
+ AV_TX_UNALIGNED = 1ULL << 1,
+
+ /**
+ * Performs a full inverse MDCT rather than leaving out samples that can be
+ * derived through symmetry. Requires an output array of 'len' floats,
+ * rather than the usual 'len/2' floats.
+ * Ignored for all transforms but inverse MDCTs.
+ */
+ AV_TX_FULL_IMDCT = 1ULL << 2,
+
+ /**
+ * Perform a real to half-complex RDFT.
+ * Only the real, or imaginary coefficients will
+ * be output, depending on the flag used. Only available for forward RDFTs.
+ * Output array must have enough space to hold N complex values
+ * (regular size for a real to complex transform).
+ */
+ AV_TX_REAL_TO_REAL = 1ULL << 3,
+ AV_TX_REAL_TO_IMAGINARY = 1ULL << 4,
+};
+
+/**
+ * Initialize a transform context with the given configuration
+ * (i)MDCTs with an odd length are currently not supported.
+ *
+ * @param ctx the context to allocate, will be NULL on error
+ * @param tx pointer to the transform function pointer to set
+ * @param type type the type of transform
+ * @param inv whether to do an inverse or a forward transform
+ * @param len the size of the transform in samples
+ * @param scale pointer to the value to scale the output if supported by type
+ * @param flags a bitmask of AVTXFlags or 0
+ *
+ * @return 0 on success, negative error code on failure
+ */
+int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, enum AVTXType type,
+ int inv, int len, const void *scale, uint64_t flags);
+
+/**
+ * Frees a context and sets *ctx to NULL, does nothing when *ctx == NULL.
+ */
+void av_tx_uninit(AVTXContext **ctx);
+
+#endif /* AVUTIL_TX_H */
diff --git a/ffmpeg/include/libavutil/uuid.h b/ffmpeg/include/libavutil/uuid.h
new file mode 100644
index 00000000..748b7ed3
--- /dev/null
+++ b/ffmpeg/include/libavutil/uuid.h
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2022 Pierre-Anthony Lemieux
+ * Zane van Iperen
+ *
+ * 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
+ */
+
+/**
+ * @file
+ * UUID parsing and serialization utilities.
+ * The library treats the UUID as an opaque sequence of 16 unsigned bytes,
+ * i.e. ignoring the internal layout of the UUID, which depends on the type
+ * of the UUID.
+ *
+ * @author Pierre-Anthony Lemieux
+ * @author Zane van Iperen
+ */
+
+#ifndef AVUTIL_UUID_H
+#define AVUTIL_UUID_H
+
+#include
+#include
+
+#define AV_PRI_UUID \
+ "%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-" \
+ "%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
+
+#define AV_PRI_URN_UUID \
+ "urn:uuid:%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-" \
+ "%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
+
+/* AV_UUID_ARG() is used together with AV_PRI_UUID() or AV_PRI_URN_UUID
+ * to print UUIDs, e.g.
+ * av_log(NULL, AV_LOG_DEBUG, "UUID: " AV_PRI_UUID, AV_UUID_ARG(uuid));
+ */
+#define AV_UUID_ARG(x) \
+ (x)[ 0], (x)[ 1], (x)[ 2], (x)[ 3], \
+ (x)[ 4], (x)[ 5], (x)[ 6], (x)[ 7], \
+ (x)[ 8], (x)[ 9], (x)[10], (x)[11], \
+ (x)[12], (x)[13], (x)[14], (x)[15]
+
+#define AV_UUID_LEN 16
+
+/* Binary representation of a UUID */
+typedef uint8_t AVUUID[AV_UUID_LEN];
+
+/**
+ * Parses a string representation of a UUID formatted according to IETF RFC 4122
+ * into an AVUUID. The parsing is case-insensitive. The string must be 37
+ * characters long, including the terminating NUL character.
+ *
+ * Example string representation: "2fceebd0-7017-433d-bafb-d073a7116696"
+ *
+ * @param[in] in String representation of a UUID,
+ * e.g. 2fceebd0-7017-433d-bafb-d073a7116696
+ * @param[out] uu AVUUID
+ * @return A non-zero value in case of an error.
+ */
+int av_uuid_parse(const char *in, AVUUID uu);
+
+/**
+ * Parses a URN representation of a UUID, as specified at IETF RFC 4122,
+ * into an AVUUID. The parsing is case-insensitive. The string must be 46
+ * characters long, including the terminating NUL character.
+ *
+ * Example string representation: "urn:uuid:2fceebd0-7017-433d-bafb-d073a7116696"
+ *
+ * @param[in] in URN UUID
+ * @param[out] uu AVUUID
+ * @return A non-zero value in case of an error.
+ */
+int av_uuid_urn_parse(const char *in, AVUUID uu);
+
+/**
+ * Parses a string representation of a UUID formatted according to IETF RFC 4122
+ * into an AVUUID. The parsing is case-insensitive.
+ *
+ * @param[in] in_start Pointer to the first character of the string representation
+ * @param[in] in_end Pointer to the character after the last character of the
+ * string representation. That memory location is never
+ * accessed. It is an error if `in_end - in_start != 36`.
+ * @param[out] uu AVUUID
+ * @return A non-zero value in case of an error.
+ */
+int av_uuid_parse_range(const char *in_start, const char *in_end, AVUUID uu);
+
+/**
+ * Serializes a AVUUID into a string representation according to IETF RFC 4122.
+ * The string is lowercase and always 37 characters long, including the
+ * terminating NUL character.
+ *
+ * @param[in] uu AVUUID
+ * @param[out] out Pointer to an array of no less than 37 characters.
+ */
+void av_uuid_unparse(const AVUUID uu, char *out);
+
+/**
+ * Compares two UUIDs for equality.
+ *
+ * @param[in] uu1 AVUUID
+ * @param[in] uu2 AVUUID
+ * @return Nonzero if uu1 and uu2 are identical, 0 otherwise
+ */
+static inline int av_uuid_equal(const AVUUID uu1, const AVUUID uu2)
+{
+ return memcmp(uu1, uu2, AV_UUID_LEN) == 0;
+}
+
+/**
+ * Copies the bytes of src into dest.
+ *
+ * @param[out] dest AVUUID
+ * @param[in] src AVUUID
+ */
+static inline void av_uuid_copy(AVUUID dest, const AVUUID src)
+{
+ memcpy(dest, src, AV_UUID_LEN);
+}
+
+/**
+ * Sets a UUID to the nil UUID, i.e. a UUID with have all
+ * its 128 bits set to zero.
+ *
+ * @param[in,out] uu UUID to be set to the nil UUID
+ */
+static inline void av_uuid_nil(AVUUID uu)
+{
+ memset(uu, 0, AV_UUID_LEN);
+}
+
+#endif /* AVUTIL_UUID_H */
diff --git a/ffmpeg/include/libavutil/version.h b/ffmpeg/include/libavutil/version.h
index 8f6da6ae..753f85b9 100644
--- a/ffmpeg/include/libavutil/version.h
+++ b/ffmpeg/include/libavutil/version.h
@@ -78,8 +78,8 @@
* @{
*/
-#define LIBAVUTIL_VERSION_MAJOR 56
-#define LIBAVUTIL_VERSION_MINOR 22
+#define LIBAVUTIL_VERSION_MAJOR 59
+#define LIBAVUTIL_VERSION_MINOR 39
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
@@ -105,31 +105,16 @@
* @{
*/
-#ifndef FF_API_VAAPI
-#define FF_API_VAAPI (LIBAVUTIL_VERSION_MAJOR < 57)
-#endif
-#ifndef FF_API_FRAME_QP
-#define FF_API_FRAME_QP (LIBAVUTIL_VERSION_MAJOR < 57)
-#endif
-#ifndef FF_API_PLUS1_MINUS1
-#define FF_API_PLUS1_MINUS1 (LIBAVUTIL_VERSION_MAJOR < 57)
-#endif
-#ifndef FF_API_ERROR_FRAME
-#define FF_API_ERROR_FRAME (LIBAVUTIL_VERSION_MAJOR < 57)
-#endif
-#ifndef FF_API_PKT_PTS
-#define FF_API_PKT_PTS (LIBAVUTIL_VERSION_MAJOR < 57)
-#endif
-#ifndef FF_API_CRYPTO_SIZE_T
-#define FF_API_CRYPTO_SIZE_T (LIBAVUTIL_VERSION_MAJOR < 57)
-#endif
-#ifndef FF_API_FRAME_GET_SET
-#define FF_API_FRAME_GET_SET (LIBAVUTIL_VERSION_MAJOR < 57)
-#endif
-#ifndef FF_API_PSEUDOPAL
-#define FF_API_PSEUDOPAL (LIBAVUTIL_VERSION_MAJOR < 57)
-#endif
-
+#define FF_API_HDR_VIVID_THREE_SPLINE (LIBAVUTIL_VERSION_MAJOR < 60)
+#define FF_API_FRAME_PKT (LIBAVUTIL_VERSION_MAJOR < 60)
+#define FF_API_INTERLACED_FRAME (LIBAVUTIL_VERSION_MAJOR < 60)
+#define FF_API_FRAME_KEY (LIBAVUTIL_VERSION_MAJOR < 60)
+#define FF_API_PALETTE_HAS_CHANGED (LIBAVUTIL_VERSION_MAJOR < 60)
+#define FF_API_VULKAN_CONTIGUOUS_MEMORY (LIBAVUTIL_VERSION_MAJOR < 60)
+#define FF_API_H274_FILM_GRAIN_VCS (LIBAVUTIL_VERSION_MAJOR < 60)
+#define FF_API_MOD_UINTP2 (LIBAVUTIL_VERSION_MAJOR < 60)
+#define FF_API_RISCV_FD_ZBA (LIBAVUTIL_VERSION_MAJOR < 60)
+#define FF_API_VULKAN_FIXED_QUEUES (LIBAVUTIL_VERSION_MAJOR < 60)
/**
* @}
diff --git a/ffmpeg/include/libavutil/video_enc_params.h b/ffmpeg/include/libavutil/video_enc_params.h
new file mode 100644
index 00000000..62265a5c
--- /dev/null
+++ b/ffmpeg/include/libavutil/video_enc_params.h
@@ -0,0 +1,171 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_VIDEO_ENC_PARAMS_H
+#define AVUTIL_VIDEO_ENC_PARAMS_H
+
+#include
+#include
+
+#include "libavutil/avassert.h"
+#include "libavutil/frame.h"
+
+enum AVVideoEncParamsType {
+ AV_VIDEO_ENC_PARAMS_NONE = -1,
+ /**
+ * VP9 stores:
+ * - per-frame base (luma AC) quantizer index, exported as AVVideoEncParams.qp
+ * - deltas for luma DC, chroma AC and chroma DC, exported in the
+ * corresponding entries in AVVideoEncParams.delta_qp
+ * - per-segment delta, exported as for each block as AVVideoBlockParams.delta_qp
+ *
+ * To compute the resulting quantizer index for a block:
+ * - for luma AC, add the base qp and the per-block delta_qp, saturating to
+ * unsigned 8-bit.
+ * - for luma DC and chroma AC/DC, add the corresponding
+ * AVVideoBlockParams.delta_qp to the luma AC index, again saturating to
+ * unsigned 8-bit.
+ */
+ AV_VIDEO_ENC_PARAMS_VP9,
+
+ /**
+ * H.264 stores:
+ * - in PPS (per-picture):
+ * * initial QP_Y (luma) value, exported as AVVideoEncParams.qp
+ * * delta(s) for chroma QP values (same for both, or each separately),
+ * exported as in the corresponding entries in AVVideoEncParams.delta_qp
+ * - per-slice QP delta, not exported directly, added to the per-MB value
+ * - per-MB delta; not exported directly; the final per-MB quantizer
+ * parameter - QP_Y - minus the value in AVVideoEncParams.qp is exported
+ * as AVVideoBlockParams.qp_delta.
+ */
+ AV_VIDEO_ENC_PARAMS_H264,
+
+ /*
+ * MPEG-2-compatible quantizer.
+ *
+ * Summing the frame-level qp with the per-block delta_qp gives the
+ * resulting quantizer for the block.
+ */
+ AV_VIDEO_ENC_PARAMS_MPEG2,
+};
+
+/**
+ * Video encoding parameters for a given frame. This struct is allocated along
+ * with an optional array of per-block AVVideoBlockParams descriptors.
+ * Must be allocated with av_video_enc_params_alloc().
+ */
+typedef struct AVVideoEncParams {
+ /**
+ * Number of blocks in the array.
+ *
+ * May be 0, in which case no per-block information is present. In this case
+ * the values of blocks_offset / block_size are unspecified and should not
+ * be accessed.
+ */
+ unsigned int nb_blocks;
+ /**
+ * Offset in bytes from the beginning of this structure at which the array
+ * of blocks starts.
+ */
+ size_t blocks_offset;
+ /*
+ * Size of each block in bytes. May not match sizeof(AVVideoBlockParams).
+ */
+ size_t block_size;
+
+ /**
+ * Type of the parameters (the codec they are used with).
+ */
+ enum AVVideoEncParamsType type;
+
+ /**
+ * Base quantisation parameter for the frame. The final quantiser for a
+ * given block in a given plane is obtained from this value, possibly
+ * combined with {@code delta_qp} and the per-block delta in a manner
+ * documented for each type.
+ */
+ int32_t qp;
+
+ /**
+ * Quantisation parameter offset from the base (per-frame) qp for a given
+ * plane (first index) and AC/DC coefficients (second index).
+ */
+ int32_t delta_qp[4][2];
+} AVVideoEncParams;
+
+/**
+ * Data structure for storing block-level encoding information.
+ * It is allocated as a part of AVVideoEncParams and should be retrieved with
+ * av_video_enc_params_block().
+ *
+ * sizeof(AVVideoBlockParams) is not a part of the ABI and new fields may be
+ * added to it.
+ */
+typedef struct AVVideoBlockParams {
+ /**
+ * Distance in luma pixels from the top-left corner of the visible frame
+ * to the top-left corner of the block.
+ * Can be negative if top/right padding is present on the coded frame.
+ */
+ int src_x, src_y;
+ /**
+ * Width and height of the block in luma pixels.
+ */
+ int w, h;
+
+ /**
+ * Difference between this block's final quantization parameter and the
+ * corresponding per-frame value.
+ */
+ int32_t delta_qp;
+} AVVideoBlockParams;
+
+/**
+ * Get the block at the specified {@code idx}. Must be between 0 and nb_blocks - 1.
+ */
+static av_always_inline AVVideoBlockParams*
+av_video_enc_params_block(AVVideoEncParams *par, unsigned int idx)
+{
+ av_assert0(idx < par->nb_blocks);
+ return (AVVideoBlockParams *)((uint8_t *)par + par->blocks_offset +
+ idx * par->block_size);
+}
+
+/**
+ * Allocates memory for AVVideoEncParams of the given type, plus an array of
+ * {@code nb_blocks} AVVideoBlockParams and initializes the variables. Can be
+ * freed with a normal av_free() call.
+ *
+ * @param out_size if non-NULL, the size in bytes of the resulting data array is
+ * written here.
+ */
+AVVideoEncParams *av_video_enc_params_alloc(enum AVVideoEncParamsType type,
+ unsigned int nb_blocks, size_t *out_size);
+
+/**
+ * Allocates memory for AVEncodeInfoFrame plus an array of
+ * {@code nb_blocks} AVEncodeInfoBlock in the given AVFrame {@code frame}
+ * as AVFrameSideData of type AV_FRAME_DATA_VIDEO_ENC_PARAMS
+ * and initializes the variables.
+ */
+AVVideoEncParams*
+av_video_enc_params_create_side_data(AVFrame *frame, enum AVVideoEncParamsType type,
+ unsigned int nb_blocks);
+
+#endif /* AVUTIL_VIDEO_ENC_PARAMS_H */
diff --git a/ffmpeg/include/libavutil/video_hint.h b/ffmpeg/include/libavutil/video_hint.h
new file mode 100644
index 00000000..1b219609
--- /dev/null
+++ b/ffmpeg/include/libavutil/video_hint.h
@@ -0,0 +1,107 @@
+/**
+ * Copyright 2023 Elias Carotti
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_VIDEO_HINT_H
+#define AVUTIL_VIDEO_HINT_H
+
+#include
+#include
+#include "libavutil/avassert.h"
+#include "libavutil/frame.h"
+
+typedef struct AVVideoRect {
+ uint32_t x, y;
+ uint32_t width, height;
+} AVVideoRect;
+
+typedef enum AVVideoHintType {
+ /* rectangled delimit the constant areas (unchanged), default is changed */
+ AV_VIDEO_HINT_TYPE_CONSTANT,
+
+ /* rectangled delimit the constant areas (changed), default is not changed */
+ AV_VIDEO_HINT_TYPE_CHANGED,
+} AVVideoHintType;
+
+typedef struct AVVideoHint {
+ /**
+ * Number of AVVideoRect present.
+ *
+ * May be 0, in which case no per-rectangle information is present. In this
+ * case the values of rect_offset / rect_size are unspecified and should
+ * not be accessed.
+ */
+ size_t nb_rects;
+
+ /**
+ * Offset in bytes from the beginning of this structure at which the array
+ * of AVVideoRect starts.
+ */
+ size_t rect_offset;
+
+ /**
+ * Size in bytes of AVVideoRect.
+ */
+ size_t rect_size;
+
+ AVVideoHintType type;
+} AVVideoHint;
+
+static av_always_inline AVVideoRect *
+av_video_hint_rects(const AVVideoHint *hints) {
+ return (AVVideoRect *)((uint8_t *)hints + hints->rect_offset);
+}
+
+static av_always_inline AVVideoRect *
+av_video_hint_get_rect(const AVVideoHint *hints, size_t idx) {
+ return (AVVideoRect *)((uint8_t *)hints + hints->rect_offset + idx * hints->rect_size);
+}
+
+/**
+ * Allocate memory for the AVVideoHint struct along with an nb_rects-sized
+ * arrays of AVVideoRect.
+ *
+ * The side data contains a list of rectangles for the portions of the frame
+ * which changed from the last encoded one (and the remainder are assumed to be
+ * changed), or, alternately (depending on the type parameter) the unchanged
+ * ones (and the remanining ones are those which changed).
+ * Macroblocks will thus be hinted either to be P_SKIP-ped or go through the
+ * regular encoding procedure.
+ *
+ * It's responsibility of the caller to fill the AVRects accordingly, and to set
+ * the proper AVVideoHintType field.
+ *
+ * @param out_size if non-NULL, the size in bytes of the resulting data array is
+ * written here
+ *
+ * @return newly allocated AVVideoHint struct (must be freed by the caller using
+ * av_free()) on success, NULL on memory allocation failure
+ */
+AVVideoHint *av_video_hint_alloc(size_t nb_rects,
+ size_t *out_size);
+
+/**
+ * Same as av_video_hint_alloc(), except newly-allocated AVVideoHint is attached
+ * as side data of type AV_FRAME_DATA_VIDEO_HINT_INFO to frame.
+ */
+AVVideoHint *av_video_hint_create_side_data(AVFrame *frame,
+ size_t nb_rects);
+
+
+#endif /* AVUTIL_VIDEO_HINT_H */
diff --git a/ffmpeg/include/libpostproc/postprocess.h b/ffmpeg/include/libpostproc/postprocess.h
index 348ee7cc..5decb7e8 100644
--- a/ffmpeg/include/libpostproc/postprocess.h
+++ b/ffmpeg/include/libpostproc/postprocess.h
@@ -34,7 +34,13 @@
* @{
*/
+#include "libpostproc/version_major.h"
+#ifndef HAVE_AV_CONFIG_H
+/* When included as part of the ffmpeg build, only include the major version
+ * to avoid unnecessary rebuilds. When included externally, keep including
+ * the full version information. */
#include "libpostproc/version.h"
+#endif
/**
* Return the LIBPOSTPROC_VERSION_INT constant.
@@ -58,13 +64,7 @@ const char *postproc_license(void);
typedef void pp_context;
typedef void pp_mode;
-#if LIBPOSTPROC_VERSION_INT < (52<<16)
-typedef pp_context pp_context_t;
-typedef pp_mode pp_mode_t;
-extern const char *const pp_help; ///< a simple help text
-#else
extern const char pp_help[]; ///< a simple help text
-#endif
void pp_postprocess(const uint8_t * src[3], const int srcStride[3],
uint8_t * dst[3], const int dstStride[3],
diff --git a/ffmpeg/include/libpostproc/version.h b/ffmpeg/include/libpostproc/version.h
index 16c1d974..e77dff98 100644
--- a/ffmpeg/include/libpostproc/version.h
+++ b/ffmpeg/include/libpostproc/version.h
@@ -26,9 +26,10 @@
* Libpostproc version macros
*/
-#include "libavutil/avutil.h"
+#include "libavutil/version.h"
+
+#include "version_major.h"
-#define LIBPOSTPROC_VERSION_MAJOR 55
#define LIBPOSTPROC_VERSION_MINOR 3
#define LIBPOSTPROC_VERSION_MICRO 100
diff --git a/ffmpeg/include/libpostproc/version_major.h b/ffmpeg/include/libpostproc/version_major.h
new file mode 100644
index 00000000..8136ee91
--- /dev/null
+++ b/ffmpeg/include/libpostproc/version_major.h
@@ -0,0 +1,31 @@
+/*
+ * Version macros.
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef POSTPROC_VERSION_MAJOR_H
+#define POSTPROC_VERSION_MAJOR_H
+
+/**
+ * @file
+ * Libpostproc version macros
+ */
+
+#define LIBPOSTPROC_VERSION_MAJOR 58
+
+#endif /* POSTPROC_VERSION_MAJOR_H */
diff --git a/ffmpeg/include/libswresample/swresample.h b/ffmpeg/include/libswresample/swresample.h
index c7b84fbc..0e1929b3 100644
--- a/ffmpeg/include/libswresample/swresample.h
+++ b/ffmpeg/include/libswresample/swresample.h
@@ -34,11 +34,11 @@
* Audio resampling, sample format conversion and mixing library.
*
* Interaction with lswr is done through SwrContext, which is
- * allocated with swr_alloc() or swr_alloc_set_opts(). It is opaque, so all parameters
+ * allocated with swr_alloc() or swr_alloc_set_opts2(). It is opaque, so all parameters
* must be set with the @ref avoptions API.
*
* The first thing you will need to do in order to use lswr is to allocate
- * SwrContext. This can be done with swr_alloc() or swr_alloc_set_opts(). If you
+ * SwrContext. This can be done with swr_alloc() or swr_alloc_set_opts2(). If you
* are using the former, you must set options through the @ref avoptions API.
* The latter function provides the same feature, but it allows you to set some
* common options in the same statement.
@@ -49,21 +49,22 @@
* matrix). This is using the swr_alloc() function.
* @code
* SwrContext *swr = swr_alloc();
- * av_opt_set_channel_layout(swr, "in_channel_layout", AV_CH_LAYOUT_5POINT1, 0);
- * av_opt_set_channel_layout(swr, "out_channel_layout", AV_CH_LAYOUT_STEREO, 0);
+ * av_opt_set_chlayout(swr, "in_chlayout", &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1, 0);
+ * av_opt_set_chlayout(swr, "out_chlayout", &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO, 0);
* av_opt_set_int(swr, "in_sample_rate", 48000, 0);
* av_opt_set_int(swr, "out_sample_rate", 44100, 0);
* av_opt_set_sample_fmt(swr, "in_sample_fmt", AV_SAMPLE_FMT_FLTP, 0);
* av_opt_set_sample_fmt(swr, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0);
* @endcode
*
- * The same job can be done using swr_alloc_set_opts() as well:
+ * The same job can be done using swr_alloc_set_opts2() as well:
* @code
- * SwrContext *swr = swr_alloc_set_opts(NULL, // we're allocating a new context
- * AV_CH_LAYOUT_STEREO, // out_ch_layout
+ * SwrContext *swr = NULL;
+ * int ret = swr_alloc_set_opts2(&swr, // we're allocating a new context
+ * &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO, // out_ch_layout
* AV_SAMPLE_FMT_S16, // out_sample_fmt
* 44100, // out_sample_rate
- * AV_CH_LAYOUT_5POINT1, // in_ch_layout
+ * &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1, // in_ch_layout
* AV_SAMPLE_FMT_FLTP, // in_sample_fmt
* 48000, // in_sample_rate
* 0, // log_offset
@@ -72,8 +73,8 @@
*
* Once all values have been set, it must be initialized with swr_init(). If
* you need to change the conversion parameters, you can change the parameters
- * using @ref AVOptions, as described above in the first example; or by using
- * swr_alloc_set_opts(), but with the first argument the allocated context.
+ * using @ref avoptions, as described above in the first example; or by using
+ * swr_alloc_set_opts2(), but with the first argument the allocated context.
* You must then call swr_init() again.
*
* The conversion itself is done by repeatedly calling swr_convert().
@@ -124,7 +125,13 @@
#include "libavutil/frame.h"
#include "libavutil/samplefmt.h"
+#include "libswresample/version_major.h"
+#ifndef HAVE_AV_CONFIG_H
+/* When included as part of the ffmpeg build, only include the major version
+ * to avoid unnecessary rebuilds. When included externally, keep including
+ * the full version information. */
#include "libswresample/version.h"
+#endif
/**
* @name Option constants
@@ -199,9 +206,9 @@ const AVClass *swr_get_class(void);
* Allocate SwrContext.
*
* If you use this function you will need to set the parameters (manually or
- * with swr_alloc_set_opts()) before calling swr_init().
+ * with swr_alloc_set_opts2()) before calling swr_init().
*
- * @see swr_alloc_set_opts(), swr_init(), swr_free()
+ * @see swr_alloc_set_opts2(), swr_init(), swr_free()
* @return NULL on error, allocated context otherwise
*/
struct SwrContext *swr_alloc(void);
@@ -230,28 +237,29 @@ int swr_is_initialized(struct SwrContext *s);
/**
* Allocate SwrContext if needed and set/reset common parameters.
*
- * This function does not require s to be allocated with swr_alloc(). On the
- * other hand, swr_alloc() can use swr_alloc_set_opts() to set the parameters
+ * This function does not require *ps to be allocated with swr_alloc(). On the
+ * other hand, swr_alloc() can use swr_alloc_set_opts2() to set the parameters
* on the allocated context.
*
- * @param s existing Swr context if available, or NULL if not
- * @param out_ch_layout output channel layout (AV_CH_LAYOUT_*)
+ * @param ps Pointer to an existing Swr context if available, or to NULL if not.
+ * On success, *ps will be set to the allocated context.
+ * @param out_ch_layout output channel layout (e.g. AV_CHANNEL_LAYOUT_*)
* @param out_sample_fmt output sample format (AV_SAMPLE_FMT_*).
* @param out_sample_rate output sample rate (frequency in Hz)
- * @param in_ch_layout input channel layout (AV_CH_LAYOUT_*)
+ * @param in_ch_layout input channel layout (e.g. AV_CHANNEL_LAYOUT_*)
* @param in_sample_fmt input sample format (AV_SAMPLE_FMT_*).
* @param in_sample_rate input sample rate (frequency in Hz)
* @param log_offset logging level offset
* @param log_ctx parent logging context, can be NULL
*
* @see swr_init(), swr_free()
- * @return NULL on error, allocated context otherwise
+ * @return 0 on success, a negative AVERROR code on error.
+ * On error, the Swr context is freed and *ps set to NULL.
*/
-struct SwrContext *swr_alloc_set_opts(struct SwrContext *s,
- int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate,
- int64_t in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate,
- int log_offset, void *log_ctx);
-
+int swr_alloc_set_opts2(struct SwrContext **ps,
+ const AVChannelLayout *out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate,
+ const AVChannelLayout *in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate,
+ int log_offset, void *log_ctx);
/**
* @}
*
@@ -303,8 +311,8 @@ void swr_close(struct SwrContext *s);
*
* @return number of samples output per channel, negative value on error
*/
-int swr_convert(struct SwrContext *s, uint8_t **out, int out_count,
- const uint8_t **in , int in_count);
+int swr_convert(struct SwrContext *s, uint8_t * const *out, int out_count,
+ const uint8_t * const *in , int in_count);
/**
* Convert the next timestamp from input to output
@@ -317,8 +325,8 @@ int swr_convert(struct SwrContext *s, uint8_t **out, int out_count,
* in this case the output timestamps will match output sample numbers.
* See ffmpeg-resampler(1) for the two modes of compensation.
*
- * @param s[in] initialized Swr context
- * @param pts[in] timestamp for the next input sample, INT64_MIN if unknown
+ * @param[in] s initialized Swr context
+ * @param[in] pts timestamp for the next input sample, INT64_MIN if unknown
* @see swr_set_compensation(), swr_drop_output(), and swr_inject_silence() are
* function used internally for timestamp compensation.
* @return the output timestamp for the next output sample
@@ -385,12 +393,12 @@ int swr_set_channel_mapping(struct SwrContext *s, const int *channel_map);
* @param log_ctx parent logging context, can be NULL
* @return 0 on success, negative AVERROR code on failure
*/
-int swr_build_matrix(uint64_t in_layout, uint64_t out_layout,
- double center_mix_level, double surround_mix_level,
- double lfe_mix_level, double rematrix_maxval,
- double rematrix_volume, double *matrix,
- int stride, enum AVMatrixEncoding matrix_encoding,
- void *log_ctx);
+int swr_build_matrix2(const AVChannelLayout *in_layout, const AVChannelLayout *out_layout,
+ double center_mix_level, double surround_mix_level,
+ double lfe_mix_level, double maxval,
+ double rematrix_volume, double *matrix,
+ ptrdiff_t stride, enum AVMatrixEncoding matrix_encoding,
+ void *log_context);
/**
* Set a customized remix matrix.
@@ -565,8 +573,8 @@ int swr_convert_frame(SwrContext *swr,
* @see swr_close();
*
* @param swr audio resample context
- * @param output output AVFrame
- * @param input input AVFrame
+ * @param out output AVFrame
+ * @param in input AVFrame
* @return 0 on success, AVERROR on failure.
*/
int swr_config_frame(SwrContext *swr, const AVFrame *out, const AVFrame *in);
diff --git a/ffmpeg/include/libswresample/version.h b/ffmpeg/include/libswresample/version.h
index 8555d550..d1795b55 100644
--- a/ffmpeg/include/libswresample/version.h
+++ b/ffmpeg/include/libswresample/version.h
@@ -26,9 +26,10 @@
* Libswresample version macros
*/
-#include "libavutil/avutil.h"
+#include "libavutil/version.h"
+
+#include "version_major.h"
-#define LIBSWRESAMPLE_VERSION_MAJOR 3
#define LIBSWRESAMPLE_VERSION_MINOR 3
#define LIBSWRESAMPLE_VERSION_MICRO 100
diff --git a/ffmpeg/include/libswresample/version_major.h b/ffmpeg/include/libswresample/version_major.h
new file mode 100644
index 00000000..dd13f2bb
--- /dev/null
+++ b/ffmpeg/include/libswresample/version_major.h
@@ -0,0 +1,31 @@
+/*
+ * Version macros.
+ *
+ * This file is part of libswresample
+ *
+ * libswresample 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.
+ *
+ * libswresample 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 libswresample; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef SWRESAMPLE_VERSION_MAJOR_H
+#define SWRESAMPLE_VERSION_MAJOR_H
+
+/**
+ * @file
+ * Libswresample version macros
+ */
+
+#define LIBSWRESAMPLE_VERSION_MAJOR 5
+
+#endif /* SWRESAMPLE_VERSION_MAJOR_H */
diff --git a/ffmpeg/include/libswscale/swscale.h b/ffmpeg/include/libswscale/swscale.h
index 7713f51e..e575695c 100644
--- a/ffmpeg/include/libswscale/swscale.h
+++ b/ffmpeg/include/libswscale/swscale.h
@@ -30,9 +30,16 @@
#include
#include "libavutil/avutil.h"
+#include "libavutil/frame.h"
#include "libavutil/log.h"
#include "libavutil/pixfmt.h"
+#include "version_major.h"
+#ifndef HAVE_AV_CONFIG_H
+/* When included as part of the ffmpeg build, only include the major version
+ * to avoid unnecessary rebuilds. When included externally, keep including
+ * the full version information. */
#include "version.h"
+#endif
/**
* @defgroup libsws libswscale
@@ -75,11 +82,35 @@ const char *swscale_license(void);
#define SWS_PRINT_INFO 0x1000
//the following 3 flags are not completely implemented
-//internal chrominance subsampling info
+
+/**
+ * Perform full chroma upsampling when upscaling to RGB.
+ *
+ * For example, when converting 50x50 yuv420p to 100x100 rgba, setting this flag
+ * will scale the chroma plane from 25x25 to 100x100 (4:4:4), and then convert
+ * the 100x100 yuv444p image to rgba in the final output step.
+ *
+ * Without this flag, the chroma plane is instead scaled to 50x100 (4:2:2),
+ * with a single chroma sample being re-used for both of the horizontally
+ * adjacent RGBA output pixels.
+ */
#define SWS_FULL_CHR_H_INT 0x2000
-//input subsampling info
+
+/**
+ * Perform full chroma interpolation when downscaling RGB sources.
+ *
+ * For example, when converting a 100x100 rgba source to 50x50 yuv444p, setting
+ * this flag will generate a 100x100 (4:4:4) chroma plane, which is then
+ * downscaled to the required 50x50.
+ *
+ * Without this flag, the chroma plane is instead generated at 50x100 (dropping
+ * every other pixel), before then being downscaled to the required 50x50
+ * resolution.
+ */
#define SWS_FULL_CHR_H_INP 0x4000
+
#define SWS_DIRECT_BGR 0x8000
+
#define SWS_ACCURATE_RND 0x40000
#define SWS_BITEXACT 0x80000
#define SWS_ERROR_DIFFUSION 0x800000
@@ -219,6 +250,107 @@ int sws_scale(struct SwsContext *c, const uint8_t *const srcSlice[],
uint8_t *const dst[], const int dstStride[]);
/**
+ * Scale source data from src and write the output to dst.
+ *
+ * This is merely a convenience wrapper around
+ * - sws_frame_start()
+ * - sws_send_slice(0, src->height)
+ * - sws_receive_slice(0, dst->height)
+ * - sws_frame_end()
+ *
+ * @param c The scaling context
+ * @param dst The destination frame. See documentation for sws_frame_start() for
+ * more details.
+ * @param src The source frame.
+ *
+ * @return 0 on success, a negative AVERROR code on failure
+ */
+int sws_scale_frame(struct SwsContext *c, AVFrame *dst, const AVFrame *src);
+
+/**
+ * Initialize the scaling process for a given pair of source/destination frames.
+ * Must be called before any calls to sws_send_slice() and sws_receive_slice().
+ *
+ * This function will retain references to src and dst, so they must both use
+ * refcounted buffers (if allocated by the caller, in case of dst).
+ *
+ * @param c The scaling context
+ * @param dst The destination frame.
+ *
+ * The data buffers may either be already allocated by the caller or
+ * left clear, in which case they will be allocated by the scaler.
+ * The latter may have performance advantages - e.g. in certain cases
+ * some output planes may be references to input planes, rather than
+ * copies.
+ *
+ * Output data will be written into this frame in successful
+ * sws_receive_slice() calls.
+ * @param src The source frame. The data buffers must be allocated, but the
+ * frame data does not have to be ready at this point. Data
+ * availability is then signalled by sws_send_slice().
+ * @return 0 on success, a negative AVERROR code on failure
+ *
+ * @see sws_frame_end()
+ */
+int sws_frame_start(struct SwsContext *c, AVFrame *dst, const AVFrame *src);
+
+/**
+ * Finish the scaling process for a pair of source/destination frames previously
+ * submitted with sws_frame_start(). Must be called after all sws_send_slice()
+ * and sws_receive_slice() calls are done, before any new sws_frame_start()
+ * calls.
+ *
+ * @param c The scaling context
+ */
+void sws_frame_end(struct SwsContext *c);
+
+/**
+ * Indicate that a horizontal slice of input data is available in the source
+ * frame previously provided to sws_frame_start(). The slices may be provided in
+ * any order, but may not overlap. For vertically subsampled pixel formats, the
+ * slices must be aligned according to subsampling.
+ *
+ * @param c The scaling context
+ * @param slice_start first row of the slice
+ * @param slice_height number of rows in the slice
+ *
+ * @return a non-negative number on success, a negative AVERROR code on failure.
+ */
+int sws_send_slice(struct SwsContext *c, unsigned int slice_start,
+ unsigned int slice_height);
+
+/**
+ * Request a horizontal slice of the output data to be written into the frame
+ * previously provided to sws_frame_start().
+ *
+ * @param c The scaling context
+ * @param slice_start first row of the slice; must be a multiple of
+ * sws_receive_slice_alignment()
+ * @param slice_height number of rows in the slice; must be a multiple of
+ * sws_receive_slice_alignment(), except for the last slice
+ * (i.e. when slice_start+slice_height is equal to output
+ * frame height)
+ *
+ * @return a non-negative number if the data was successfully written into the output
+ * AVERROR(EAGAIN) if more input data needs to be provided before the
+ * output can be produced
+ * another negative AVERROR code on other kinds of scaling failure
+ */
+int sws_receive_slice(struct SwsContext *c, unsigned int slice_start,
+ unsigned int slice_height);
+
+/**
+ * Get the alignment required for slices
+ *
+ * @param c The scaling context
+ * @return alignment required for output slices requested with sws_receive_slice().
+ * Slice offsets and sizes passed to sws_receive_slice() must be
+ * multiples of the value returned from this function.
+ */
+unsigned int sws_receive_slice_alignment(const struct SwsContext *c);
+
+/**
+ * @param c the scaling context
* @param dstRange flag indicating the while-black range of the output (1=jpeg / 0=mpeg)
* @param srcRange flag indicating the while-black range of the input (1=jpeg / 0=mpeg)
* @param table the yuv2rgb coefficients describing the output yuv space, normally ff_yuv2rgb_coeffs[x]
@@ -226,14 +358,17 @@ int sws_scale(struct SwsContext *c, const uint8_t *const srcSlice[],
* @param brightness 16.16 fixed point brightness correction
* @param contrast 16.16 fixed point contrast correction
* @param saturation 16.16 fixed point saturation correction
- * @return -1 if not supported
+ *
+ * @return A negative error code on error, non negative otherwise.
+ * If `LIBSWSCALE_VERSION_MAJOR < 7`, returns -1 if not supported.
*/
int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
int srcRange, const int table[4], int dstRange,
int brightness, int contrast, int saturation);
/**
- * @return -1 if not supported
+ * @return A negative error code on error, non negative otherwise.
+ * If `LIBSWSCALE_VERSION_MAJOR < 7`, returns -1 if not supported.
*/
int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table,
int *srcRange, int **table, int *dstRange,
@@ -260,17 +395,6 @@ void sws_scaleVec(SwsVector *a, double scalar);
*/
void sws_normalizeVec(SwsVector *a, double height);
-#if FF_API_SWS_VECTOR
-attribute_deprecated SwsVector *sws_getConstVec(double c, int length);
-attribute_deprecated SwsVector *sws_getIdentityVec(void);
-attribute_deprecated void sws_convVec(SwsVector *a, SwsVector *b);
-attribute_deprecated void sws_addVec(SwsVector *a, SwsVector *b);
-attribute_deprecated void sws_subVec(SwsVector *a, SwsVector *b);
-attribute_deprecated void sws_shiftVec(SwsVector *a, int shift);
-attribute_deprecated SwsVector *sws_cloneVec(SwsVector *a);
-attribute_deprecated void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level);
-#endif
-
void sws_freeVec(SwsVector *a);
SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
diff --git a/ffmpeg/include/libswscale/version.h b/ffmpeg/include/libswscale/version.h
index f1bed092..51eb013a 100644
--- a/ffmpeg/include/libswscale/version.h
+++ b/ffmpeg/include/libswscale/version.h
@@ -26,7 +26,8 @@
#include "libavutil/version.h"
-#define LIBSWSCALE_VERSION_MAJOR 5
+#include "version_major.h"
+
#define LIBSWSCALE_VERSION_MINOR 3
#define LIBSWSCALE_VERSION_MICRO 100
@@ -40,14 +41,4 @@
#define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION)
-/**
- * FF_API_* defines may be placed below to indicate public API that will be
- * dropped at a future version bump. The defines themselves are not part of
- * the public API and may change, break or disappear at any time.
- */
-
-#ifndef FF_API_SWS_VECTOR
-#define FF_API_SWS_VECTOR (LIBSWSCALE_VERSION_MAJOR < 6)
-#endif
-
#endif /* SWSCALE_VERSION_H */
diff --git a/ffmpeg/include/libswscale/version_major.h b/ffmpeg/include/libswscale/version_major.h
new file mode 100644
index 00000000..fd259f95
--- /dev/null
+++ b/ffmpeg/include/libswscale/version_major.h
@@ -0,0 +1,35 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef SWSCALE_VERSION_MAJOR_H
+#define SWSCALE_VERSION_MAJOR_H
+
+/**
+ * @file
+ * swscale version macros
+ */
+
+#define LIBSWSCALE_VERSION_MAJOR 8
+
+/**
+ * FF_API_* defines may be placed below to indicate public API that will be
+ * dropped at a future version bump. The defines themselves are not part of
+ * the public API and may change, break or disappear at any time.
+ */
+
+#endif /* SWSCALE_VERSION_MAJOR_H */
diff --git a/ffmpeg/lib/avcodec-58.def b/ffmpeg/lib/avcodec-61.def
similarity index 62%
rename from ffmpeg/lib/avcodec-58.def
rename to ffmpeg/lib/avcodec-61.def
index afc6144a..af4e7960 100644
--- a/ffmpeg/lib/avcodec-58.def
+++ b/ffmpeg/lib/avcodec-61.def
@@ -1,10 +1,6 @@
EXPORTS
av_ac3_parse_header
av_adts_header_parse
- av_bitstream_filter_close
- av_bitstream_filter_filter
- av_bitstream_filter_init
- av_bitstream_filter_next
av_bsf_alloc
av_bsf_flush
av_bsf_free
@@ -19,35 +15,18 @@ EXPORTS
av_bsf_list_finalize
av_bsf_list_free
av_bsf_list_parse_str
- av_bsf_next
av_bsf_receive_packet
av_bsf_send_packet
av_codec_ffversion
- av_codec_get_chroma_intra_matrix
- av_codec_get_codec_descriptor
- av_codec_get_codec_properties
- av_codec_get_lowres
- av_codec_get_max_lowres
- av_codec_get_pkt_timebase
- av_codec_get_seek_preroll
av_codec_is_decoder
av_codec_is_encoder
av_codec_iterate
- av_codec_next
- av_codec_set_chroma_intra_matrix
- av_codec_set_codec_descriptor
- av_codec_set_lowres
- av_codec_set_pkt_timebase
- av_codec_set_seek_preroll
- av_copy_packet
- av_copy_packet_side_data
av_cpb_properties_alloc
av_d3d11va_alloc_context
av_dct_calc
av_dct_end
av_dct_init
av_dirac_parse_sequence_header
- av_dup_packet
av_dv_codec_profile
av_dv_codec_profile2
av_dv_frame_profile
@@ -57,22 +36,18 @@ EXPORTS
av_fft_end
av_fft_init
av_fft_permute
- av_free_packet
av_get_audio_frame_duration
av_get_audio_frame_duration2
av_get_bits_per_sample
- av_get_codec_tag_string
av_get_exact_bits_per_sample
av_get_pcm_codec
av_get_profile_name
av_grow_packet
- av_hwaccel_next
av_imdct_calc
av_imdct_half
av_init_packet
av_jni_get_java_vm
av_jni_set_java_vm
- av_lockmgr_register
av_mdct_calc
av_mdct_end
av_mdct_init
@@ -92,33 +67,28 @@ EXPORTS
av_packet_get_side_data
av_packet_make_refcounted
av_packet_make_writable
- av_packet_merge_side_data
av_packet_move_ref
av_packet_new_side_data
av_packet_pack_dictionary
av_packet_ref
av_packet_rescale_ts
av_packet_shrink_side_data
+ av_packet_side_data_add
+ av_packet_side_data_free
+ av_packet_side_data_get
av_packet_side_data_name
- av_packet_split_side_data
+ av_packet_side_data_new
+ av_packet_side_data_remove
av_packet_unpack_dictionary
av_packet_unref
- av_parser_change
av_parser_close
av_parser_init
av_parser_iterate
- av_parser_next
av_parser_parse2
- av_picture_copy
- av_picture_crop
- av_picture_pad
av_qsv_alloc_context
av_rdft_calc
av_rdft_end
av_rdft_init
- av_register_bitstream_filter
- av_register_codec_parser
- av_register_hwaccel
av_shrink_packet
av_vorbis_parse_frame
av_vorbis_parse_frame_flags
@@ -129,30 +99,22 @@ EXPORTS
avcodec_align_dimensions
avcodec_align_dimensions2
avcodec_alloc_context3
- avcodec_chroma_pos_to_enum
avcodec_close
avcodec_configuration
- avcodec_copy_context
avcodec_dct_alloc
avcodec_dct_get_class
avcodec_dct_init
- avcodec_decode_audio4
avcodec_decode_subtitle2
- avcodec_decode_video2
avcodec_default_execute
avcodec_default_execute2
avcodec_default_get_buffer2
+ avcodec_default_get_encode_buffer
avcodec_default_get_format
avcodec_descriptor_get
avcodec_descriptor_get_by_name
avcodec_descriptor_next
- avcodec_encode_audio2
avcodec_encode_subtitle
- avcodec_encode_video2
- avcodec_enum_to_chroma_pos
avcodec_fill_audio_frame
- avcodec_find_best_pix_fmt2
- avcodec_find_best_pix_fmt_of_2
avcodec_find_best_pix_fmt_of_list
avcodec_find_decoder
avcodec_find_decoder_by_name
@@ -160,15 +122,12 @@ EXPORTS
avcodec_find_encoder_by_name
avcodec_flush_buffers
avcodec_free_context
- avcodec_get_chroma_sub_sample
avcodec_get_class
- avcodec_get_context_defaults3
- avcodec_get_frame_class
avcodec_get_hw_config
avcodec_get_hw_frames_parameters
avcodec_get_name
- avcodec_get_pix_fmt_loss
avcodec_get_subtitle_rect_class
+ avcodec_get_supported_config
avcodec_get_type
avcodec_is_open
avcodec_license
@@ -182,57 +141,29 @@ EXPORTS
avcodec_profile_name
avcodec_receive_frame
avcodec_receive_packet
- avcodec_register
- avcodec_register_all
avcodec_send_frame
avcodec_send_packet
avcodec_string
avcodec_version
- avpicture_alloc
- avpicture_fill
- avpicture_free
- avpicture_get_size
- avpicture_layout
- avpriv_ac3_channel_layout_tab
avpriv_ac3_parse_header
- avpriv_align_put_bits
- avpriv_bprint_to_extradata
- avpriv_codec2_mode_bit_rate
- avpriv_codec2_mode_block_align
- avpriv_codec2_mode_frame_size
+ avpriv_adts_header_parse
avpriv_codec_get_cap_skip_frame_fill_param
- avpriv_copy_bits
avpriv_dca_convert_bitstream
avpriv_dca_parse_core_frame_header
- avpriv_dca_sample_rates
- avpriv_dnxhd_get_frame_size
- avpriv_dnxhd_get_hr_frame_size
- avpriv_dnxhd_get_interlaced
- avpriv_do_elbg
+ avpriv_elbg_do
+ avpriv_elbg_free
avpriv_exif_decode_ifd
- avpriv_find_pix_fmt
avpriv_find_start_code
avpriv_fits_header_init
avpriv_fits_header_parse_line
avpriv_get_raw_pix_fmt_tags
avpriv_h264_has_num_reorder_frames
- avpriv_init_elbg
- avpriv_mjpeg_bits_ac_chrominance
- avpriv_mjpeg_bits_ac_luminance
- avpriv_mjpeg_bits_dc_chrominance
- avpriv_mjpeg_bits_dc_luminance
- avpriv_mjpeg_val_ac_chrominance
- avpriv_mjpeg_val_ac_luminance
- avpriv_mjpeg_val_dc
- avpriv_mpa_bitrate_tab
- avpriv_mpa_freq_tab
- avpriv_mpeg4audio_get_config
- avpriv_mpeg4audio_sample_rates
+ avpriv_mpeg4audio_get_config2
avpriv_mpegaudio_decode_header
- avpriv_pix_fmt_bps_avi
- avpriv_pix_fmt_bps_mov
- avpriv_put_string
+ avpriv_packet_list_free
+ avpriv_packet_list_get
+ avpriv_packet_list_put
+ avpriv_pix_fmt_find
avpriv_split_xiph_headers
avpriv_tak_parse_streaminfo
- avpriv_toupper4
avsubtitle_free
diff --git a/ffmpeg/lib/avcodec.lib b/ffmpeg/lib/avcodec.lib
index c920e61d..e3417d57 100644
Binary files a/ffmpeg/lib/avcodec.lib and b/ffmpeg/lib/avcodec.lib differ
diff --git a/ffmpeg/lib/avdevice-58.def b/ffmpeg/lib/avdevice-61.def
similarity index 83%
rename from ffmpeg/lib/avdevice-58.def
rename to ffmpeg/lib/avdevice-61.def
index 01682fc5..4aa5db22 100644
--- a/ffmpeg/lib/avdevice-58.def
+++ b/ffmpeg/lib/avdevice-61.def
@@ -1,13 +1,10 @@
EXPORTS
- av_device_capabilities
av_device_ffversion
av_input_audio_device_next
av_input_video_device_next
av_output_audio_device_next
av_output_video_device_next
avdevice_app_to_dev_control_message
- avdevice_capabilities_create
- avdevice_capabilities_free
avdevice_configuration
avdevice_dev_to_app_control_message
avdevice_free_list_devices
diff --git a/ffmpeg/lib/avdevice.lib b/ffmpeg/lib/avdevice.lib
index 480a5699..19847a1c 100644
Binary files a/ffmpeg/lib/avdevice.lib and b/ffmpeg/lib/avdevice.lib differ
diff --git a/ffmpeg/lib/avfilter-7.def b/ffmpeg/lib/avfilter-10.def
similarity index 77%
rename from ffmpeg/lib/avfilter-7.def
rename to ffmpeg/lib/avfilter-10.def
index db3fe973..dc011fe3 100644
--- a/ffmpeg/lib/avfilter-7.def
+++ b/ffmpeg/lib/avfilter-10.def
@@ -1,7 +1,8 @@
EXPORTS
- av_abuffersink_params_alloc
- av_buffersink_get_channel_layout
+ av_buffersink_get_ch_layout
av_buffersink_get_channels
+ av_buffersink_get_color_range
+ av_buffersink_get_colorspace
av_buffersink_get_format
av_buffersink_get_frame
av_buffersink_get_frame_flags
@@ -14,7 +15,6 @@ EXPORTS
av_buffersink_get_time_base
av_buffersink_get_type
av_buffersink_get_w
- av_buffersink_params_alloc
av_buffersink_set_frame_size
av_buffersrc_add_frame
av_buffersrc_add_frame_flags
@@ -25,14 +25,12 @@ EXPORTS
av_buffersrc_write_frame
av_filter_ffversion
av_filter_iterate
- avfilter_add_matrix
- avfilter_all_channel_layouts
avfilter_config_links
avfilter_configuration
+ avfilter_filter_pad_count
avfilter_free
avfilter_get_by_name
avfilter_get_class
- avfilter_get_matrix
avfilter_graph_alloc
avfilter_graph_alloc_filter
avfilter_graph_config
@@ -41,10 +39,17 @@ EXPORTS
avfilter_graph_free
avfilter_graph_get_filter
avfilter_graph_parse
- avfilter_graph_parse2
avfilter_graph_parse_ptr
+ avfilter_graph_parse2
avfilter_graph_queue_command
avfilter_graph_request_oldest
+ avfilter_graph_segment_apply
+ avfilter_graph_segment_apply_opts
+ avfilter_graph_segment_create_filters
+ avfilter_graph_segment_free
+ avfilter_graph_segment_init
+ avfilter_graph_segment_link
+ avfilter_graph_segment_parse
avfilter_graph_send_command
avfilter_graph_set_auto_convert
avfilter_init_dict
@@ -55,17 +60,7 @@ EXPORTS
avfilter_license
avfilter_link
avfilter_link_free
- avfilter_link_get_channels
- avfilter_link_set_closed
- avfilter_make_format64_list
- avfilter_mul_matrix
- avfilter_next
- avfilter_pad_count
avfilter_pad_get_name
avfilter_pad_get_type
avfilter_process_command
- avfilter_register
- avfilter_register_all
- avfilter_sub_matrix
- avfilter_transform
avfilter_version
diff --git a/ffmpeg/lib/avfilter.lib b/ffmpeg/lib/avfilter.lib
index 8e61261c..5383a914 100644
Binary files a/ffmpeg/lib/avfilter.lib and b/ffmpeg/lib/avfilter.lib differ
diff --git a/ffmpeg/lib/avformat-58.def b/ffmpeg/lib/avformat-61.def
similarity index 77%
rename from ffmpeg/lib/avformat-58.def
rename to ffmpeg/lib/avformat-61.def
index b00793e9..5089be79 100644
--- a/ffmpeg/lib/avformat-58.def
+++ b/ffmpeg/lib/avformat-61.def
@@ -1,12 +1,12 @@
EXPORTS
av_add_index_entry
av_append_packet
- av_apply_bitstream_filters
av_codec_get_id
av_codec_get_tag
av_codec_get_tag2
av_demuxer_iterate
- av_demuxer_open
+ av_disposition_from_string
+ av_disposition_to_string
av_dump_format
av_filename_number_test
av_find_best_stream
@@ -15,24 +15,7 @@ EXPORTS
av_find_program_from_stream
av_fmt_ctx_get_duration_estimation_method
av_format_ffversion
- av_format_get_audio_codec
- av_format_get_control_message_cb
- av_format_get_data_codec
- av_format_get_metadata_header_padding
- av_format_get_opaque
- av_format_get_open_cb
- av_format_get_probe_score
- av_format_get_subtitle_codec
- av_format_get_video_codec
av_format_inject_global_side_data
- av_format_set_audio_codec
- av_format_set_control_message_cb
- av_format_set_data_codec
- av_format_set_metadata_header_padding
- av_format_set_opaque
- av_format_set_open_cb
- av_format_set_subtitle_codec
- av_format_set_video_codec
av_get_frame_filename
av_get_frame_filename2
av_get_output_timestamp
@@ -43,16 +26,14 @@ EXPORTS
av_guess_sample_aspect_ratio
av_hex_dump
av_hex_dump_log
- av_iformat_next
av_index_search_timestamp
av_interleaved_write_frame
av_interleaved_write_uncoded_frame
av_match_ext
av_muxer_iterate
av_new_program
- av_oformat_next
- av_pkt_dump2
av_pkt_dump_log2
+ av_pkt_dump2
av_probe_input_buffer
av_probe_input_buffer2
av_probe_input_format
@@ -62,21 +43,15 @@ EXPORTS
av_read_frame
av_read_pause
av_read_play
- av_register_all
- av_register_input_format
- av_register_output_format
av_sdp_create
av_seek_frame
av_stream_add_side_data
+ av_stream_get_class
av_stream_get_codec_timebase
- av_stream_get_end_pts
av_stream_get_parser
- av_stream_get_r_frame_rate
- av_stream_get_recommended_encoder_configuration
av_stream_get_side_data
+ av_stream_group_get_class
av_stream_new_side_data
- av_stream_set_r_frame_rate
- av_stream_set_recommended_encoder_configuration
av_url_split
av_write_frame
av_write_trailer
@@ -94,6 +69,9 @@ EXPORTS
avformat_get_mov_video_tags
avformat_get_riff_audio_tags
avformat_get_riff_video_tags
+ avformat_index_get_entries_count
+ avformat_index_get_entry
+ avformat_index_get_entry_from_timestamp
avformat_init_output
avformat_license
avformat_match_stream_specifier
@@ -104,6 +82,9 @@ EXPORTS
avformat_query_codec
avformat_queue_attached_pictures
avformat_seek_file
+ avformat_stream_group_add_stream
+ avformat_stream_group_create
+ avformat_stream_group_name
avformat_transfer_internal_stream_timing_info
avformat_version
avformat_write_header
@@ -126,11 +107,13 @@ EXPORTS
avio_get_str16le
avio_handshake
avio_open
- avio_open2
avio_open_dir
avio_open_dyn_buf
+ avio_open2
avio_pause
+ avio_print_string_array
avio_printf
+ avio_protocol_get_class
avio_put_str
avio_put_str16be
avio_put_str16le
@@ -151,6 +134,7 @@ EXPORTS
avio_seek_time
avio_size
avio_skip
+ avio_vprintf
avio_w8
avio_wb16
avio_wb24
@@ -165,11 +149,11 @@ EXPORTS
avpriv_dv_get_packet
avpriv_dv_init_demux
avpriv_dv_produce_packet
- avpriv_io_delete
- avpriv_io_move
avpriv_mpegts_parse_close
avpriv_mpegts_parse_open
avpriv_mpegts_parse_packet
avpriv_new_chapter
avpriv_register_devices
avpriv_set_pts_info
+ avpriv_stream_set_need_parsing
+ avpriv_update_cur_dts
diff --git a/ffmpeg/lib/avformat.lib b/ffmpeg/lib/avformat.lib
index 694f7748..c735676f 100644
Binary files a/ffmpeg/lib/avformat.lib and b/ffmpeg/lib/avformat.lib differ
diff --git a/ffmpeg/lib/avutil-56.def b/ffmpeg/lib/avutil-59.def
similarity index 74%
rename from ffmpeg/lib/avutil-56.def
rename to ffmpeg/lib/avutil-59.def
index 2ab8e460..989c8f15 100644
--- a/ffmpeg/lib/avutil-56.def
+++ b/ffmpeg/lib/avutil-59.def
@@ -16,6 +16,8 @@ EXPORTS
av_aes_ctr_set_random_iv
av_aes_init
av_aes_size
+ av_ambient_viewing_environment_alloc
+ av_ambient_viewing_environment_create_side_data
av_append_path_component
av_asprintf
av_assert0_fpu
@@ -33,13 +35,13 @@ EXPORTS
av_base64_decode
av_base64_encode
av_basename
+ av_bessel_i0
av_blowfish_alloc
av_blowfish_crypt
av_blowfish_crypt_ecb
av_blowfish_init
av_bmg_get
av_bprint_append_data
- av_bprint_channel_layout
av_bprint_chars
av_bprint_clear
av_bprint_escape
@@ -57,12 +59,14 @@ EXPORTS
av_buffer_get_ref_count
av_buffer_is_writable
av_buffer_make_writable
+ av_buffer_pool_buffer_get_opaque
av_buffer_pool_get
av_buffer_pool_init
av_buffer_pool_init2
av_buffer_pool_uninit
av_buffer_realloc
av_buffer_ref
+ av_buffer_replace
av_buffer_unref
av_calloc
av_camellia_alloc
@@ -74,9 +78,33 @@ EXPORTS
av_cast5_crypt2
av_cast5_init
av_cast5_size
- av_channel_layout_extract_channel
+ av_channel_description
+ av_channel_description_bprint
+ av_channel_from_string
+ av_channel_layout_ambisonic_order
+ av_channel_layout_channel_from_index
+ av_channel_layout_channel_from_string
+ av_channel_layout_check
+ av_channel_layout_compare
+ av_channel_layout_copy
+ av_channel_layout_custom_init
+ av_channel_layout_default
+ av_channel_layout_describe
+ av_channel_layout_describe_bprint
+ av_channel_layout_from_mask
+ av_channel_layout_from_string
+ av_channel_layout_index_from_channel
+ av_channel_layout_index_from_string
+ av_channel_layout_retype
+ av_channel_layout_standard
+ av_channel_layout_subset
+ av_channel_layout_uninit
+ av_channel_name
+ av_channel_name_bprint
+ av_chroma_location_enum_to_pos
av_chroma_location_from_name
av_chroma_location_name
+ av_chroma_location_pos_to_enum
av_cmp_i
av_color_primaries_from_name
av_color_primaries_name
@@ -91,23 +119,31 @@ EXPORTS
av_content_light_metadata_alloc
av_content_light_metadata_create_side_data
av_cpu_count
+ av_cpu_force_count
av_cpu_max_align
av_crc
av_crc_get_table
av_crc_init
+ av_csp_approximate_trc_gamma
+ av_csp_luma_coeffs_from_avcsp
+ av_csp_primaries_desc_from_id
+ av_csp_primaries_id_from_desc
+ av_csp_trc_func_from_id
av_d2q
- av_d2str
av_default_get_category
av_default_item_name
av_des_alloc
av_des_crypt
av_des_init
av_des_mac
+ av_detection_bbox_alloc
+ av_detection_bbox_create_side_data
av_dict_copy
av_dict_count
av_dict_free
av_dict_get
av_dict_get_string
+ av_dict_iterate
av_dict_parse_string
av_dict_set
av_dict_set_int
@@ -117,10 +153,19 @@ EXPORTS
av_display_rotation_set
av_div_i
av_div_q
+ av_dovi_alloc
+ av_dovi_find_level
+ av_dovi_metadata_alloc
av_downmix_info_update_side_data
- av_dynarray2_add
+ av_dynamic_hdr_plus_alloc
+ av_dynamic_hdr_plus_create_side_data
+ av_dynamic_hdr_plus_from_t35
+ av_dynamic_hdr_plus_to_t35
+ av_dynamic_hdr_vivid_alloc
+ av_dynamic_hdr_vivid_create_side_data
av_dynarray_add
av_dynarray_add_nofree
+ av_dynarray2_add
av_encryption_info_add_side_data
av_encryption_info_alloc
av_encryption_info_clone
@@ -131,6 +176,11 @@ EXPORTS
av_encryption_init_info_free
av_encryption_init_info_get_side_data
av_escape
+ av_executor_alloc
+ av_executor_execute
+ av_executor_free
+ av_expr_count_func
+ av_expr_count_vars
av_expr_eval
av_expr_free
av_expr_parse
@@ -138,26 +188,29 @@ EXPORTS
av_fast_malloc
av_fast_mallocz
av_fast_realloc
- av_fifo_alloc
- av_fifo_alloc_array
- av_fifo_drain
- av_fifo_free
- av_fifo_freep
- av_fifo_generic_peek
- av_fifo_generic_peek_at
- av_fifo_generic_read
- av_fifo_generic_write
- av_fifo_grow
- av_fifo_realloc2
- av_fifo_reset
- av_fifo_size
- av_fifo_space
+ av_fifo_alloc2
+ av_fifo_auto_grow_limit
+ av_fifo_can_read
+ av_fifo_can_write
+ av_fifo_drain2
+ av_fifo_elem_size
+ av_fifo_freep2
+ av_fifo_grow2
+ av_fifo_peek
+ av_fifo_peek_to_cb
+ av_fifo_read
+ av_fifo_read_to_cb
+ av_fifo_reset2
+ av_fifo_write
+ av_fifo_write_from_cb
av_file_map
av_file_unmap
+ av_film_grain_params_alloc
+ av_film_grain_params_create_side_data
+ av_film_grain_params_select
av_find_best_pix_fmt_of_2
av_find_info_tag
av_find_nearest_q_idx
- av_fopen_utf8
av_force_cpu_flags
av_fourcc_make_string
av_frame_alloc
@@ -166,20 +219,8 @@ EXPORTS
av_frame_copy
av_frame_copy_props
av_frame_free
- av_frame_get_best_effort_timestamp
av_frame_get_buffer
- av_frame_get_channel_layout
- av_frame_get_channels
- av_frame_get_color_range
- av_frame_get_colorspace
- av_frame_get_decode_error_flags
- av_frame_get_metadata
- av_frame_get_pkt_duration
- av_frame_get_pkt_pos
- av_frame_get_pkt_size
av_frame_get_plane_buffer
- av_frame_get_qp_table
- av_frame_get_sample_rate
av_frame_get_side_data
av_frame_is_writable
av_frame_make_writable
@@ -188,36 +229,24 @@ EXPORTS
av_frame_new_side_data_from_buf
av_frame_ref
av_frame_remove_side_data
- av_frame_set_best_effort_timestamp
- av_frame_set_channel_layout
- av_frame_set_channels
- av_frame_set_color_range
- av_frame_set_colorspace
- av_frame_set_decode_error_flags
- av_frame_set_metadata
- av_frame_set_pkt_duration
- av_frame_set_pkt_pos
- av_frame_set_pkt_size
- av_frame_set_qp_table
- av_frame_set_sample_rate
+ av_frame_replace
+ av_frame_side_data_add
+ av_frame_side_data_clone
+ av_frame_side_data_desc
+ av_frame_side_data_free
+ av_frame_side_data_get_c
av_frame_side_data_name
+ av_frame_side_data_new
+ av_frame_side_data_remove
av_frame_unref
av_free
av_freep
av_gcd
+ av_gcd_q
av_get_alt_sample_fmt
av_get_bits_per_pixel
av_get_bytes_per_sample
- av_get_channel_description
- av_get_channel_layout
- av_get_channel_layout_channel_index
- av_get_channel_layout_nb_channels
- av_get_channel_layout_string
- av_get_channel_name
- av_get_colorspace_name
av_get_cpu_flags
- av_get_default_channel_layout
- av_get_extended_channel_layout
av_get_known_color_name
av_get_media_type_string
av_get_packed_sample_fmt
@@ -232,7 +261,6 @@ EXPORTS
av_get_sample_fmt
av_get_sample_fmt_name
av_get_sample_fmt_string
- av_get_standard_channel_layout
av_get_time_base_q
av_get_token
av_gettime
@@ -258,6 +286,7 @@ EXPORTS
av_hwdevice_ctx_alloc
av_hwdevice_ctx_create
av_hwdevice_ctx_create_derived
+ av_hwdevice_ctx_create_derived_opts
av_hwdevice_ctx_init
av_hwdevice_find_type_by_name
av_hwdevice_get_hwframe_constraints
@@ -273,43 +302,59 @@ EXPORTS
av_hwframe_transfer_data
av_hwframe_transfer_get_formats
av_i2int
+ av_iamf_audio_element_add_layer
+ av_iamf_audio_element_alloc
+ av_iamf_audio_element_free
+ av_iamf_audio_element_get_class
+ av_iamf_mix_presentation_add_submix
+ av_iamf_mix_presentation_alloc
+ av_iamf_mix_presentation_free
+ av_iamf_mix_presentation_get_class
+ av_iamf_param_definition_alloc
+ av_iamf_param_definition_get_class
+ av_iamf_submix_add_element
+ av_iamf_submix_add_layout
av_image_alloc
av_image_check_sar
av_image_check_size
av_image_check_size2
av_image_copy
av_image_copy_plane
+ av_image_copy_plane_uc_from
av_image_copy_to_buffer
av_image_copy_uc_from
av_image_fill_arrays
av_image_fill_black
+ av_image_fill_color
av_image_fill_linesizes
av_image_fill_max_pixsteps
+ av_image_fill_plane_sizes
av_image_fill_pointers
av_image_get_buffer_size
av_image_get_linesize
- av_int2i
av_int_list_length_for_size
+ av_int2i
av_lfg_init
av_lfg_init_from_data
av_log
- av_log2
- av_log2_16bit
- av_log2_i
av_log_default_callback
av_log_format_line
av_log_format_line2
av_log_get_flags
av_log_get_level
+ av_log_once
av_log_set_callback
av_log_set_flags
av_log_set_level
+ av_log2
+ av_log2_16bit
+ av_log2_i
av_lzo1x_decode
av_malloc
av_malloc_array
av_mallocz
- av_mallocz_array
av_mastering_display_metadata_alloc
+ av_mastering_display_metadata_alloc_size
av_mastering_display_metadata_create_side_data
av_match_list
av_match_name
@@ -331,7 +376,7 @@ EXPORTS
av_murmur3_init_seeded
av_murmur3_update
av_nearer_q
- av_opt_child_class_next
+ av_opt_child_class_iterate
av_opt_child_next
av_opt_copy
av_opt_eval_double
@@ -340,13 +385,16 @@ EXPORTS
av_opt_eval_int
av_opt_eval_int64
av_opt_eval_q
+ av_opt_eval_uint
av_opt_find
av_opt_find2
av_opt_flag_is_set
av_opt_free
av_opt_freep_ranges
av_opt_get
- av_opt_get_channel_layout
+ av_opt_get_array
+ av_opt_get_array_size
+ av_opt_get_chlayout
av_opt_get_dict_val
av_opt_get_double
av_opt_get_image_size
@@ -364,13 +412,14 @@ EXPORTS
av_opt_query_ranges_default
av_opt_serialize
av_opt_set
+ av_opt_set_array
av_opt_set_bin
- av_opt_set_channel_layout
+ av_opt_set_chlayout
av_opt_set_defaults
av_opt_set_defaults2
av_opt_set_dict
- av_opt_set_dict2
av_opt_set_dict_val
+ av_opt_set_dict2
av_opt_set_double
av_opt_set_from_string
av_opt_set_image_size
@@ -382,7 +431,6 @@ EXPORTS
av_opt_show2
av_parse_color
av_parse_cpu_caps
- av_parse_cpu_flags
av_parse_ratio
av_parse_time
av_parse_video_rate
@@ -395,6 +443,7 @@ EXPORTS
av_pix_fmt_swap_endianness
av_pixelutils_get_sad_fn
av_q2intfloat
+ av_random_bytes
av_rc4_alloc
av_rc4_crypt
av_rc4_init
@@ -423,28 +472,34 @@ EXPORTS
av_samples_fill_arrays
av_samples_get_buffer_size
av_samples_set_silence
- av_set_cpu_flags_mask
av_set_options_string
- av_sha512_alloc
- av_sha512_final
- av_sha512_init
- av_sha512_size
- av_sha512_update
av_sha_alloc
av_sha_final
av_sha_init
av_sha_size
av_sha_update
+ av_sha512_alloc
+ av_sha512_final
+ av_sha512_init
+ av_sha512_size
+ av_sha512_update
av_shr_i
+ av_size_mult
av_small_strptime
av_spherical_alloc
av_spherical_from_name
av_spherical_projection_name
av_spherical_tile_bounds
+ av_sscanf
av_stereo3d_alloc
+ av_stereo3d_alloc_size
av_stereo3d_create_side_data
av_stereo3d_from_name
+ av_stereo3d_primary_eye_from_name
+ av_stereo3d_primary_eye_name
av_stereo3d_type_name
+ av_stereo3d_view_from_name
+ av_stereo3d_view_name
av_strcasecmp
av_strdup
av_strerror
@@ -466,7 +521,6 @@ EXPORTS
av_tea_crypt
av_tea_init
av_tea_size
- av_tempfile
av_thread_message_flush
av_thread_message_queue_alloc
av_thread_message_queue_free
@@ -478,11 +532,14 @@ EXPORTS
av_thread_message_queue_set_free_func
av_timecode_adjust_ntsc_framenum2
av_timecode_check_frame_rate
+ av_timecode_get_smpte
av_timecode_get_smpte_from_framenum
av_timecode_init
+ av_timecode_init_from_components
av_timecode_init_from_string
av_timecode_make_mpeg_tc_string
av_timecode_make_smpte_tc_string
+ av_timecode_make_smpte_tc_string2
av_timecode_make_string
av_timegm
av_tree_destroy
@@ -491,15 +548,28 @@ EXPORTS
av_tree_insert
av_tree_node_alloc
av_tree_node_size
+ av_ts_make_time_string2
av_twofish_alloc
av_twofish_crypt
av_twofish_init
av_twofish_size
+ av_tx_init
+ av_tx_uninit
av_usleep
av_utf8_decode
av_util_ffversion
+ av_uuid_parse
+ av_uuid_parse_range
+ av_uuid_unparse
+ av_uuid_urn_parse
av_vbprintf
av_version_info
+ av_video_enc_params_alloc
+ av_video_enc_params_create_side_data
+ av_video_hint_alloc
+ av_video_hint_create_side_data
+ av_vk_frame_alloc
+ av_vkfmt_from_pixfmt
av_vlog
av_write_image_line
av_write_image_line2
@@ -512,8 +582,7 @@ EXPORTS
avpriv_cga_font
avpriv_dict_set_timestamp
avpriv_float_dsp_alloc
- avpriv_get_gamma_from_trc
- avpriv_get_trc_function_from_trc
+ avpriv_fopen_utf8
avpriv_init_lls
avpriv_open
avpriv_report_missing_feature
diff --git a/ffmpeg/lib/avutil.lib b/ffmpeg/lib/avutil.lib
index 6f4af85d..915fcda9 100644
Binary files a/ffmpeg/lib/avutil.lib and b/ffmpeg/lib/avutil.lib differ
diff --git a/ffmpeg/lib/libavcodec.dll.a b/ffmpeg/lib/libavcodec.dll.a
index de19750f..b9d62ef4 100644
Binary files a/ffmpeg/lib/libavcodec.dll.a and b/ffmpeg/lib/libavcodec.dll.a differ
diff --git a/ffmpeg/lib/libavdevice.dll.a b/ffmpeg/lib/libavdevice.dll.a
index dd387ad9..e8d53446 100644
Binary files a/ffmpeg/lib/libavdevice.dll.a and b/ffmpeg/lib/libavdevice.dll.a differ
diff --git a/ffmpeg/lib/libavfilter.dll.a b/ffmpeg/lib/libavfilter.dll.a
index cbd8350b..bbc5f130 100644
Binary files a/ffmpeg/lib/libavfilter.dll.a and b/ffmpeg/lib/libavfilter.dll.a differ
diff --git a/ffmpeg/lib/libavformat.dll.a b/ffmpeg/lib/libavformat.dll.a
index 8e978f08..19a6f7be 100644
Binary files a/ffmpeg/lib/libavformat.dll.a and b/ffmpeg/lib/libavformat.dll.a differ
diff --git a/ffmpeg/lib/libavutil.dll.a b/ffmpeg/lib/libavutil.dll.a
index 417fe8fb..40467c1e 100644
Binary files a/ffmpeg/lib/libavutil.dll.a and b/ffmpeg/lib/libavutil.dll.a differ
diff --git a/ffmpeg/lib/libpostproc.dll.a b/ffmpeg/lib/libpostproc.dll.a
index d288e595..51fb828e 100644
Binary files a/ffmpeg/lib/libpostproc.dll.a and b/ffmpeg/lib/libpostproc.dll.a differ
diff --git a/ffmpeg/lib/libswresample.dll.a b/ffmpeg/lib/libswresample.dll.a
index 0724334d..0e3523ac 100644
Binary files a/ffmpeg/lib/libswresample.dll.a and b/ffmpeg/lib/libswresample.dll.a differ
diff --git a/ffmpeg/lib/libswscale.dll.a b/ffmpeg/lib/libswscale.dll.a
index 594e86f5..f582c202 100644
Binary files a/ffmpeg/lib/libswscale.dll.a and b/ffmpeg/lib/libswscale.dll.a differ
diff --git a/ffmpeg/lib/postproc-55.def b/ffmpeg/lib/postproc-58.def
similarity index 100%
rename from ffmpeg/lib/postproc-55.def
rename to ffmpeg/lib/postproc-58.def
diff --git a/ffmpeg/lib/postproc.lib b/ffmpeg/lib/postproc.lib
index f89eb99b..7e5da8a9 100644
Binary files a/ffmpeg/lib/postproc.lib and b/ffmpeg/lib/postproc.lib differ
diff --git a/ffmpeg/lib/swresample-3.def b/ffmpeg/lib/swresample-5.def
similarity index 90%
rename from ffmpeg/lib/swresample-3.def
rename to ffmpeg/lib/swresample-5.def
index 4ca6d903..ee713195 100644
--- a/ffmpeg/lib/swresample-3.def
+++ b/ffmpeg/lib/swresample-5.def
@@ -1,7 +1,7 @@
EXPORTS
swr_alloc
- swr_alloc_set_opts
- swr_build_matrix
+ swr_alloc_set_opts2
+ swr_build_matrix2
swr_close
swr_config_frame
swr_convert
diff --git a/ffmpeg/lib/swresample.lib b/ffmpeg/lib/swresample.lib
index 4e88d5eb..93efa0f9 100644
Binary files a/ffmpeg/lib/swresample.lib and b/ffmpeg/lib/swresample.lib differ
diff --git a/ffmpeg/lib/swscale-5.def b/ffmpeg/lib/swscale-8.def
similarity index 78%
rename from ffmpeg/lib/swscale-5.def
rename to ffmpeg/lib/swscale-8.def
index ce3dc0da..38f8ca46 100644
--- a/ffmpeg/lib/swscale-5.def
+++ b/ffmpeg/lib/swscale-8.def
@@ -1,35 +1,32 @@
EXPORTS
- sws_addVec
- sws_allocVec
sws_alloc_context
- sws_alloc_set_opts
- sws_cloneVec
- sws_convVec
+ sws_allocVec
sws_convertPalette8ToPacked24
sws_convertPalette8ToPacked32
+ sws_frame_end
+ sws_frame_start
sws_freeContext
sws_freeFilter
sws_freeVec
+ sws_get_class
sws_getCachedContext
sws_getCoefficients
sws_getColorspaceDetails
- sws_getConstVec
sws_getContext
sws_getDefaultFilter
sws_getGaussianVec
- sws_getIdentityVec
- sws_get_class
sws_init_context
sws_isSupportedEndiannessConversion
sws_isSupportedInput
sws_isSupportedOutput
sws_normalizeVec
- sws_printVec2
+ sws_receive_slice
+ sws_receive_slice_alignment
sws_scale
+ sws_scale_frame
sws_scaleVec
+ sws_send_slice
sws_setColorspaceDetails
- sws_shiftVec
- sws_subVec
swscale_configuration
swscale_license
swscale_version
diff --git a/ffmpeg/lib/swscale.lib b/ffmpeg/lib/swscale.lib
index ca240495..9a016b8b 100644
Binary files a/ffmpeg/lib/swscale.lib and b/ffmpeg/lib/swscale.lib differ