From 4e353ea00e07dc72e291b17a3f15f7f2c4a78f1e Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 28 Mar 2026 12:53:38 +1000 Subject: [PATCH] Deps: Update bundled ffmpeg headers to 8.1.0 --- dep/ffmpeg/VERSION | 2 +- dep/ffmpeg/include/libavcodec/avcodec.h | 48 ++++ dep/ffmpeg/include/libavcodec/codec_desc.h | 8 + dep/ffmpeg/include/libavcodec/codec_id.h | 10 + dep/ffmpeg/include/libavcodec/codec_par.h | 5 + dep/ffmpeg/include/libavcodec/exif.h | 229 ++++++++++++++++++ dep/ffmpeg/include/libavcodec/packet.h | 36 +++ dep/ffmpeg/include/libavcodec/version.h | 2 +- dep/ffmpeg/include/libavcodec/version_major.h | 4 + dep/ffmpeg/include/libavformat/avformat.h | 122 +++++++++- dep/ffmpeg/include/libavformat/avio.h | 6 +- dep/ffmpeg/include/libavformat/version.h | 2 +- dep/ffmpeg/include/libavutil/attributes.h | 68 +++++- dep/ffmpeg/include/libavutil/avassert.h | 18 +- dep/ffmpeg/include/libavutil/common.h | 8 +- .../container_fifo.h | 0 dep/ffmpeg/include/libavutil/cpu.h | 9 +- dep/ffmpeg/include/libavutil/csp.h | 16 ++ dep/ffmpeg/include/libavutil/dovi_meta.h | 12 + dep/ffmpeg/include/libavutil/ffversion.h | 2 +- dep/ffmpeg/include/libavutil/frame.h | 19 +- .../{libavcodec => libavutil}/hwcontext_amf.h | 4 + .../include/libavutil/hwcontext_d3d11va.h | 14 ++ .../include/libavutil/hwcontext_d3d12va.h | 69 +++++- .../{libavcodec => libavutil}/hwcontext_oh.h | 0 .../include/libavutil/hwcontext_vaapi.h | 2 +- .../include/libavutil/hwcontext_vulkan.h | 29 ++- dep/ffmpeg/include/libavutil/iamf.h | 11 +- dep/ffmpeg/include/libavutil/pixdesc.h | 10 + dep/ffmpeg/include/libavutil/pixfmt.h | 24 +- .../{libavcodec => libavutil}/refstruct.h | 0 .../include/{libavcodec => libavutil}/tdrdi.h | 0 dep/ffmpeg/include/libavutil/version.h | 6 +- dep/ffmpeg/include/libswresample/version.h | 2 +- dep/ffmpeg/include/libswscale/swscale.h | 35 ++- dep/ffmpeg/include/libswscale/version.h | 2 +- 36 files changed, 778 insertions(+), 56 deletions(-) create mode 100644 dep/ffmpeg/include/libavcodec/exif.h rename dep/ffmpeg/include/{libavcodec => libavutil}/container_fifo.h (100%) rename dep/ffmpeg/include/{libavcodec => libavutil}/hwcontext_amf.h (94%) rename dep/ffmpeg/include/{libavcodec => libavutil}/hwcontext_oh.h (100%) rename dep/ffmpeg/include/{libavcodec => libavutil}/refstruct.h (100%) rename dep/ffmpeg/include/{libavcodec => libavutil}/tdrdi.h (100%) diff --git a/dep/ffmpeg/VERSION b/dep/ffmpeg/VERSION index cc40bca69..b8eb02635 100644 --- a/dep/ffmpeg/VERSION +++ b/dep/ffmpeg/VERSION @@ -1 +1 @@ -8.0 +8.1 diff --git a/dep/ffmpeg/include/libavcodec/avcodec.h b/dep/ffmpeg/include/libavcodec/avcodec.h index 108df5a24..6824bfc9a 100644 --- a/dep/ffmpeg/include/libavcodec/avcodec.h +++ b/dep/ffmpeg/include/libavcodec/avcodec.h @@ -415,6 +415,14 @@ typedef struct RcOverride{ */ #define AV_GET_ENCODE_BUFFER_FLAG_REF (1 << 0) +/** + * The decoder will bypass frame threading and return the next frame as soon as + * possible. Note that this may deliver frames earlier than the advertised + * `AVCodecContext.delay`. No effect when frame threading is disabled, or on + * encoding. + */ +#define AV_CODEC_RECEIVE_FRAME_FLAG_SYNCHRONOUS (1 << 0) + /** * main external API structure. * New fields can be added to the end with minor version bumps. @@ -963,12 +971,16 @@ typedef struct AVCodecContext { */ uint16_t *chroma_intra_matrix; +#if FF_API_INTRA_DC_PRECISION /** * precision of the intra DC coefficient - 8 * - encoding: Set by user. * - decoding: Set by libavcodec + * @deprecated Use the MPEG-2 encoder's private option "intra_dc_precision" instead. */ + attribute_deprecated int intra_dc_precision; +#endif /** * minimum MB Lagrange multiplier @@ -1923,6 +1935,13 @@ typedef struct AVCodecContext { */ AVFrameSideData **decoded_side_data; int nb_decoded_side_data; + + /** + * Indicates how the alpha channel of the video is represented. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVAlphaMode alpha_mode; } AVCodecContext; /** @@ -2353,6 +2372,7 @@ int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt); * frame (depending on the decoder type) allocated by the * codec. Note that the function will always call * av_frame_unref(frame) before doing anything else. + * @param flags Combination of AV_CODEC_RECEIVE_FRAME_FLAG_* flags. * * @retval 0 success, a frame was returned * @retval AVERROR(EAGAIN) output is not available in this state - user must @@ -2363,6 +2383,11 @@ int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt); * @ref AV_CODEC_FLAG_RECON_FRAME flag enabled * @retval "other negative error code" legitimate decoding errors */ +int avcodec_receive_frame_flags(AVCodecContext *avctx, AVFrame *frame, unsigned flags); + +/** + * Alias for `avcodec_receive_frame_flags(avctx, frame, 0)`. + */ int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame); /** @@ -2528,6 +2553,7 @@ enum AVCodecConfig { AV_CODEC_CONFIG_CHANNEL_LAYOUT, ///< AVChannelLayout, terminated by {0} AV_CODEC_CONFIG_COLOR_RANGE, ///< AVColorRange, terminated by AVCOL_RANGE_UNSPECIFIED AV_CODEC_CONFIG_COLOR_SPACE, ///< AVColorSpace, terminated by AVCOL_SPC_UNSPECIFIED + AV_CODEC_CONFIG_ALPHA_MODE, ///< AVAlphaMode, terminated by AVALPHA_MODE_UNSPECIFIED }; /** @@ -2724,17 +2750,35 @@ typedef struct AVCodecParserContext { } AVCodecParserContext; typedef struct AVCodecParser { +#if FF_API_PARSER_CODECID int codec_ids[7]; /* several codec IDs are permitted */ +#else + enum AVCodecID codec_ids[7]; /* several codec IDs are permitted */ +#endif +#if FF_API_PARSER_PRIVATE + /***************************************************************** + * All fields below this line are not part of the public API. They + * may not be used outside of libavcodec and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + attribute_deprecated int priv_data_size; + attribute_deprecated int (*parser_init)(AVCodecParserContext *s); /* This callback never returns an error, a negative value means that * the frame start was in a previous packet. */ + attribute_deprecated int (*parser_parse)(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size); + attribute_deprecated void (*parser_close)(AVCodecParserContext *s); + attribute_deprecated int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size); +#endif } AVCodecParser; /** @@ -2748,7 +2792,11 @@ typedef struct AVCodecParser { */ const AVCodecParser *av_parser_iterate(void **opaque); +#if FF_API_PARSER_CODECID AVCodecParserContext *av_parser_init(int codec_id); +#else +AVCodecParserContext *av_parser_init(enum AVCodecID codec_id); +#endif /** * Parse a packet. diff --git a/dep/ffmpeg/include/libavcodec/codec_desc.h b/dep/ffmpeg/include/libavcodec/codec_desc.h index 96afd2020..1186433c9 100644 --- a/dep/ffmpeg/include/libavcodec/codec_desc.h +++ b/dep/ffmpeg/include/libavcodec/codec_desc.h @@ -96,6 +96,14 @@ typedef struct AVCodecDescriptor { */ #define AV_CODEC_PROP_FIELDS (1 << 4) +/** + * Video codec contains enhancement information meant to be applied to other + * existing frames, and can't generate usable image data on its own. + * A standalone decoder is unlikely to be available for it and should not + * be expected. + */ +#define AV_CODEC_PROP_ENHANCEMENT (1 << 5) + /** * Subtitle codec is bitmap based * Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field. diff --git a/dep/ffmpeg/include/libavcodec/codec_id.h b/dep/ffmpeg/include/libavcodec/codec_id.h index c4842e61f..6529f0a6b 100644 --- a/dep/ffmpeg/include/libavcodec/codec_id.h +++ b/dep/ffmpeg/include/libavcodec/codec_id.h @@ -331,6 +331,7 @@ enum AVCodecID { AV_CODEC_ID_JPEGXL_ANIM, AV_CODEC_ID_APV, AV_CODEC_ID_PRORES_RAW, + AV_CODEC_ID_JPEGXS, /* various PCM "codecs" */ AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs @@ -427,6 +428,14 @@ enum AVCodecID { AV_CODEC_ID_ADPCM_XMD, AV_CODEC_ID_ADPCM_IMA_XBOX, AV_CODEC_ID_ADPCM_SANYO, + AV_CODEC_ID_ADPCM_IMA_HVQM4, + AV_CODEC_ID_ADPCM_IMA_PDA, + AV_CODEC_ID_ADPCM_N64, + AV_CODEC_ID_ADPCM_IMA_HVQM2, + AV_CODEC_ID_ADPCM_IMA_MAGIX, + AV_CODEC_ID_ADPCM_PSXC, + AV_CODEC_ID_ADPCM_CIRCUS, + AV_CODEC_ID_ADPCM_IMA_ESCAPE, /* AMR */ AV_CODEC_ID_AMR_NB = 0x12000, @@ -556,6 +565,7 @@ enum AVCodecID { AV_CODEC_ID_QOA, AV_CODEC_ID_LC3, AV_CODEC_ID_G728, + AV_CODEC_ID_AHX, /* subtitle codecs */ AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. diff --git a/dep/ffmpeg/include/libavcodec/codec_par.h b/dep/ffmpeg/include/libavcodec/codec_par.h index 64b01f7e0..2697605d4 100644 --- a/dep/ffmpeg/include/libavcodec/codec_par.h +++ b/dep/ffmpeg/include/libavcodec/codec_par.h @@ -212,6 +212,11 @@ typedef struct AVCodecParameters { * Audio only. Number of samples to skip after a discontinuity. */ int seek_preroll; + + /** + * Video with alpha channel only. Alpha channel handling + */ + enum AVAlphaMode alpha_mode; } AVCodecParameters; /** diff --git a/dep/ffmpeg/include/libavcodec/exif.h b/dep/ffmpeg/include/libavcodec/exif.h new file mode 100644 index 000000000..1824a38d1 --- /dev/null +++ b/dep/ffmpeg/include/libavcodec/exif.h @@ -0,0 +1,229 @@ +/* + * EXIF metadata parser + * Copyright (c) 2013 Thilo Borgmann + * Copyright (c) 2024-2025 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 + */ + +/** + * @file + * EXIF metadata parser + * @author Thilo Borgmann + * @author Leo Izen + */ + +#ifndef AVCODEC_EXIF_H +#define AVCODEC_EXIF_H + +#include +#include + +#include "libavutil/buffer.h" +#include "libavutil/dict.h" +#include "libavutil/rational.h" +#include "version_major.h" + +/** Data type identifiers for TIFF tags */ +enum AVTiffDataType { + AV_TIFF_BYTE = 1, + AV_TIFF_STRING, + AV_TIFF_SHORT, + AV_TIFF_LONG, + AV_TIFF_RATIONAL, + AV_TIFF_SBYTE, + AV_TIFF_UNDEFINED, + AV_TIFF_SSHORT, + AV_TIFF_SLONG, + AV_TIFF_SRATIONAL, + AV_TIFF_FLOAT, + AV_TIFF_DOUBLE, + AV_TIFF_IFD, +}; + +enum AVExifHeaderMode { + /** + * The TIFF header starts with 0x49492a00, or 0x4d4d002a. + * This one is used internally by FFmpeg. + */ + AV_EXIF_TIFF_HEADER, + /** skip the TIFF header, assume little endian */ + AV_EXIF_ASSUME_LE, + /** skip the TIFF header, assume big endian */ + AV_EXIF_ASSUME_BE, + /** The first four bytes point to the actual start, then it's AV_EXIF_TIFF_HEADER */ + AV_EXIF_T_OFF, + /** The first six bytes contain "Exif\0\0", then it's AV_EXIF_TIFF_HEADER */ + AV_EXIF_EXIF00, +}; + +typedef struct AVExifEntry AVExifEntry; + +typedef struct AVExifMetadata { + /* array of EXIF metadata entries */ + AVExifEntry *entries; + /* number of entries in this array */ + unsigned int count; + /* size of the buffer, used for av_fast_realloc */ + unsigned int size; +} AVExifMetadata; + +struct AVExifEntry { + uint16_t id; + enum AVTiffDataType type; + uint32_t count; + + /* + * These are for IFD-style MakerNote + * entries which occur after a fixed + * offset rather than at the start of + * the entry. The ifd_lead field contains + * the leading bytes which typically + * identify the type of MakerNote. + */ + uint32_t ifd_offset; + uint8_t *ifd_lead; + + /* + * An array of entries of size count + * Unless it's an IFD, in which case + * it's not an array and count = 1 + */ + union { + void *ptr; + int64_t *sint; + uint64_t *uint; + double *dbl; + char *str; + uint8_t *ubytes; + int8_t *sbytes; + AVRational *rat; + AVExifMetadata ifd; + } value; +}; + +/** + * Retrieves the tag name associated with the provided tag ID. + * If the tag ID is unknown, NULL is returned. + * + * For example, av_exif_get_tag_name(0x112) returns "Orientation". + */ +const char *av_exif_get_tag_name(uint16_t id); + +/** + * Retrieves the tag ID associated with the provided tag string name. + * If the tag name is unknown, a negative number is returned. Otherwise + * it always fits inside a uint16_t integer. + * + * For example, av_exif_get_tag_id("Orientation") returns 274 (0x0112). + */ +int32_t av_exif_get_tag_id(const char *name); + +/** + * Add an entry to the provided EXIF metadata struct. If one already exists with the provided + * ID, it will set the existing one to have the other information provided. Otherwise, it + * will allocate a new entry. + * + * This function reallocates ifd->entries using av_realloc and allocates (using av_malloc) + * a new value member of the entry, then copies the contents of value into that buffer. + */ +int av_exif_set_entry(void *logctx, AVExifMetadata *ifd, uint16_t id, enum AVTiffDataType type, + uint32_t count, const uint8_t *ifd_lead, uint32_t ifd_offset, const void *value); + +/** + * Also check subdirectories. + */ +#define AV_EXIF_FLAG_RECURSIVE (1 << 0) + +/** + * Get an entry with the tagged ID from the EXIF metadata struct. A pointer to the entry + * will be written into *value. + * + * If the entry was present and returned successfully, a positive number is returned. + * If the entry was not found, *value is left untouched and zero is returned. + * If an error occurred, a negative number is returned. + */ +int av_exif_get_entry(void *logctx, AVExifMetadata *ifd, uint16_t id, int flags, AVExifEntry **value); + +/** + * Remove an entry from the provided EXIF metadata struct. + * + * If the entry was present and removed successfully, a positive number is returned. + * If the entry was not found, zero is returned. + * If an error occurred, a negative number is returned. + */ +int av_exif_remove_entry(void *logctx, AVExifMetadata *ifd, uint16_t id, int flags); + +/** + * Decodes the EXIF data provided in the buffer and writes it into the + * struct *ifd. If this function succeeds, the IFD is owned by the caller + * and must be cleared after use by calling av_exif_free(); If this function + * fails and returns a negative value, it will call av_exif_free(ifd) before + * returning. + */ +int av_exif_parse_buffer(void *logctx, const uint8_t *data, size_t size, + AVExifMetadata *ifd, enum AVExifHeaderMode header_mode); + +/** + * Allocates a buffer using av_malloc of an appropriate size and writes the + * EXIF data represented by ifd into that buffer. + * + * Upon error, *buffer will be NULL. The buffer becomes owned by the caller upon + * success. The *buffer argument must be NULL before calling. + */ +int av_exif_write(void *logctx, const AVExifMetadata *ifd, AVBufferRef **buffer, enum AVExifHeaderMode header_mode); + +/** + * Frees all resources associated with the given EXIF metadata struct. + * Does not free the pointer passed itself, in case it is stack-allocated. + * The pointer passed to this function must be freed by the caller, + * if it is heap-allocated. Passing NULL is permitted. + */ +void av_exif_free(AVExifMetadata *ifd); + +/** + * Recursively reads all tags from the IFD and stores them in the + * provided metadata dictionary. + */ +int av_exif_ifd_to_dict(void *logctx, const AVExifMetadata *ifd, AVDictionary **metadata); + +/** + * Allocates a duplicate of the provided EXIF metadata struct. The caller owns + * the duplicate and must free it with av_exif_free. Returns NULL if the duplication + * process failed. + */ +AVExifMetadata *av_exif_clone_ifd(const AVExifMetadata *ifd); + +/** + * Convert a display matrix used by AV_FRAME_DATA_DISPLAYMATRIX + * into an orientation constant used by EXIF's orientation tag. + * + * Returns an EXIF orientation between 1 and 8 (inclusive) depending + * on the rotation and flip factors. Returns 0 if the matrix is singular. + */ +int av_exif_matrix_to_orientation(const int32_t *matrix); + +/** + * Convert an orientation constant used by EXIF's orientation tag + * into a display matrix used by AV_FRAME_DATA_DISPLAYMATRIX. + * + * Returns 0 on success and negative if the orientation is invalid, + * i.e. not between 1 and 8 (inclusive). + */ +int av_exif_orientation_to_matrix(int32_t *matrix, int orientation); + +#endif /* AVCODEC_EXIF_H */ diff --git a/dep/ffmpeg/include/libavcodec/packet.h b/dep/ffmpeg/include/libavcodec/packet.h index 55389a957..59bfddf4c 100644 --- a/dep/ffmpeg/include/libavcodec/packet.h +++ b/dep/ffmpeg/include/libavcodec/packet.h @@ -362,6 +362,12 @@ enum AVPacketSideDataType { */ AV_PKT_DATA_RTCP_SR, + /** + * Extensible image file format metadata. The payload is a buffer containing + * EXIF metadata, starting with either 49 49 2a 00, or 4d 4d 00 2a. + */ + AV_PKT_DATA_EXIF, + /** * The number of side data types. * This is not part of the public API/ABI in the sense that it may @@ -483,6 +489,36 @@ void av_packet_side_data_remove(AVPacketSideData *sd, int *nb_sd, */ void av_packet_side_data_free(AVPacketSideData **sd, int *nb_sd); +struct AVFrameSideData; + +/** + * Add a new packet side data entry to an array based on existing frame + * side data, if a matching type exists for packet side data. + * + * @param flags Currently unused. Must be 0. + * @retval >= 0 Success + * @retval AVERROR(EINVAL) The frame side data type does not have a matching + * packet side data type. + * @retval AVERROR(ENOMEM) Failed to add a side data entry to the array, or + * similar. + */ +int av_packet_side_data_from_frame(AVPacketSideData **sd, int *nb_sd, + const struct AVFrameSideData *src, unsigned int flags); +/** + * Add a new frame side data entry to an array based on existing packet + * side data, if a matching type exists for frame side data. + * + * @param flags Some combination of AV_FRAME_SIDE_DATA_FLAG_* flags, + * or 0. + * @retval >= 0 Success + * @retval AVERROR(EINVAL) The packet side data type does not have a matching + * frame side data type. + * @retval AVERROR(ENOMEM) Failed to add a side data entry to the array, or + * similar. + */ +int av_packet_side_data_to_frame(struct AVFrameSideData ***sd, int *nb_sd, + const AVPacketSideData *src, unsigned int flags); + const char *av_packet_side_data_name(enum AVPacketSideDataType type); /** diff --git a/dep/ffmpeg/include/libavcodec/version.h b/dep/ffmpeg/include/libavcodec/version.h index 8b53586be..87b7284a9 100644 --- a/dep/ffmpeg/include/libavcodec/version.h +++ b/dep/ffmpeg/include/libavcodec/version.h @@ -29,7 +29,7 @@ #include "version_major.h" -#define LIBAVCODEC_VERSION_MINOR 11 +#define LIBAVCODEC_VERSION_MINOR 28 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ diff --git a/dep/ffmpeg/include/libavcodec/version_major.h b/dep/ffmpeg/include/libavcodec/version_major.h index 97e4e1206..6c652374d 100644 --- a/dep/ffmpeg/include/libavcodec/version_major.h +++ b/dep/ffmpeg/include/libavcodec/version_major.h @@ -42,9 +42,13 @@ #define FF_API_V408_CODECID (LIBAVCODEC_VERSION_MAJOR < 63) #define FF_API_CODEC_PROPS (LIBAVCODEC_VERSION_MAJOR < 63) #define FF_API_EXR_GAMMA (LIBAVCODEC_VERSION_MAJOR < 63) +#define FF_API_INTRA_DC_PRECISION (LIBAVCODEC_VERSION_MAJOR < 63) #define FF_API_NVDEC_OLD_PIX_FMTS (LIBAVCODEC_VERSION_MAJOR < 63) +#define FF_API_PARSER_PRIVATE (LIBAVCODEC_VERSION_MAJOR < 63) +#define FF_API_PARSER_CODECID (LIBAVCODEC_VERSION_MAJOR < 63) + // reminder to remove the OMX encoder on next major bump #define FF_CODEC_OMX (LIBAVCODEC_VERSION_MAJOR < 63) // reminder to remove Sonic Lossy/Lossless encoders on next major bump diff --git a/dep/ffmpeg/include/libavformat/avformat.h b/dep/ffmpeg/include/libavformat/avformat.h index be6e53238..ee0ddddf8 100644 --- a/dep/ffmpeg/include/libavformat/avformat.h +++ b/dep/ffmpeg/include/libavformat/avformat.h @@ -1065,9 +1065,8 @@ typedef struct AVStreamGroupTileGrid { * AVStreamGroupLCEVC is meant to define the relation between video streams * and a data stream containing LCEVC enhancement layer NALUs. * - * No more than one stream of @ref AVCodecParameters.codec_type "codec_type" - * AVMEDIA_TYPE_DATA shall be present, and it must be of - * @ref AVCodecParameters.codec_id "codec_id" AV_CODEC_ID_LCEVC. + * No more than one stream of + * @ref AVCodecParameters.codec_id "codec_id" AV_CODEC_ID_LCEVC shall be present. */ typedef struct AVStreamGroupLCEVC { const AVClass *av_class; @@ -1884,6 +1883,11 @@ typedef struct AVFormatContext { * @see skip_estimate_duration_from_pts */ int64_t duration_probesize; + + /** + * Name of this format context, only used for logging purposes. + */ + char *name; } AVFormatContext; /** @@ -2364,6 +2368,101 @@ int av_read_play(AVFormatContext *s); */ int av_read_pause(AVFormatContext *s); +/** + * Command IDs that can be sent to the demuxer + * + * The following commands can be sent to a demuxer + * using ::avformat_send_command. + */ +enum AVFormatCommandID { + /** + * Send a RTSP `SET_PARAMETER` request to the server + * + * Sends an SET_PARAMETER RTSP command to the server, + * with a data payload of type ::AVRTSPCommandRequest, + * ownership of it and its data remains with the caller. + * + * A reply retrieved is of type ::AVRTSPResponse and it + * and its contents must be freed by the caller. + */ + AVFORMAT_COMMAND_RTSP_SET_PARAMETER, +}; + +typedef struct AVRTSPCommandRequest { + /** + * Headers sent in the request to the server + */ + AVDictionary *headers; + + /** + * Body payload size + */ + size_t body_len; + + /** + * Body payload + */ + char *body; +} AVRTSPCommandRequest; + +typedef struct AVRTSPResponse { + /** + * Response status code from server + */ + int status_code; + + /** + * Reason phrase from the server, describing the + * status in a human-readable way. + */ + char *reason; + + /** + * Body payload size + */ + size_t body_len; + + /** + * Body payload + */ + unsigned char *body; +} AVRTSPResponse; + +/** + * Send a command to the demuxer + * + * Sends the specified command and (depending on the command) + * optionally a command-specific payload to the demuxer to handle. + * + * @param s Format context, must be allocated with + * ::avformat_alloc_context. + * @param id Identifier of type ::AVFormatCommandID, + * indicating the command to send. + * @param data Command-specific data, allocated by the caller + * and ownership remains with the caller. + * For details what is expected here, consult the + * documentation of the respective ::AVFormatCommandID. + */ +int avformat_send_command(AVFormatContext *s, enum AVFormatCommandID id, void *data); + +/** + * Receive a command reply from the demuxer + * + * Retrieves a reply for a previously sent command from the muxer. + * + * @param s Format context, must be allocated with + * ::avformat_alloc_context. + * @param id Identifier of type ::AVFormatCommandID, + * indicating the command for which to retrieve + * the reply. + * @param data_out Pointee is set to the command reply, the actual + * type depends on the command. This is allocated by + * the muxer and must be freed with ::av_free. + * For details on the actual data set here, consult the + * documentation of the respective ::AVFormatCommandID. + */ +int avformat_receive_command_reply(AVFormatContext *s, enum AVFormatCommandID id, void **data_out); + /** * Close an opened input AVFormatContext. Free it and all its contents * and set *s to NULL. @@ -2819,7 +2918,8 @@ void av_dump_format(AVFormatContext *ic, int is_output); -#define AV_FRAME_FILENAME_FLAGS_MULTIPLE 1 ///< Allow multiple %d +#define AV_FRAME_FILENAME_FLAGS_MULTIPLE 1 ///< Allow multiple %d +#define AV_FRAME_FILENAME_FLAGS_IGNORE_TRUNCATION 2 ///< Ignore truncated output instead of returning an error /** * Return in 'buf' the path with '%d' replaced by a number. @@ -2889,6 +2989,20 @@ int av_match_ext(const char *filename, const char *extensions); int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id, int std_compliance); +struct AVBPrint; +/** + * Make a RFC 4281/6381 like string describing a codec for MIME types. + * + * @param par pointer to an AVCodecParameters struct describing the codec + * @param frame_rate an AVRational for the frame rate, for deciding the + * right profile for video codecs. Pass an invalid + * AVRational (1/0) to indicate that it is unknown. + * @param out the AVBPrint to write the output to + * @return <0 on error + */ +int av_mime_codec_str(const AVCodecParameters *par, + AVRational frame_rate, struct AVBPrint *out); + /** * @defgroup riff_fourcc RIFF FourCCs * @{ diff --git a/dep/ffmpeg/include/libavformat/avio.h b/dep/ffmpeg/include/libavformat/avio.h index ebf611187..fbcb7dbfc 100644 --- a/dep/ffmpeg/include/libavformat/avio.h +++ b/dep/ffmpeg/include/libavformat/avio.h @@ -461,17 +461,17 @@ int avio_put_str16be(AVIOContext *s, const char *str); void avio_write_marker(AVIOContext *s, int64_t time, enum AVIODataMarkerType type); /** - * ORing this as the "whence" parameter to a seek function causes it to + * Passing this as the "whence" parameter to a seek function causes it to * return the filesize without seeking anywhere. Supporting this is optional. * If it is not supported then the seek function will return <0. */ #define AVSEEK_SIZE 0x10000 /** - * Passing this flag as the "whence" parameter to a seek function causes it to + * OR'ing this flag into the "whence" parameter to a seek function causes it to * seek by any means (like reopening and linear reading) or other normally unreasonable * means that can be extremely slow. - * This may be ignored by the seek code. + * This is the default and therefore ignored by the seek code since 2010. */ #define AVSEEK_FORCE 0x20000 diff --git a/dep/ffmpeg/include/libavformat/version.h b/dep/ffmpeg/include/libavformat/version.h index 7ff148391..cb67e0a1f 100644 --- a/dep/ffmpeg/include/libavformat/version.h +++ b/dep/ffmpeg/include/libavformat/version.h @@ -31,7 +31,7 @@ #include "version_major.h" -#define LIBAVFORMAT_VERSION_MINOR 3 +#define LIBAVFORMAT_VERSION_MINOR 12 #define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ diff --git a/dep/ffmpeg/include/libavutil/attributes.h b/dep/ffmpeg/include/libavutil/attributes.h index d15ede128..0e49b22b9 100644 --- a/dep/ffmpeg/include/libavutil/attributes.h +++ b/dep/ffmpeg/include/libavutil/attributes.h @@ -40,8 +40,27 @@ # define AV_HAS_BUILTIN(x) 0 #endif +#ifdef __has_attribute +# define AV_HAS_ATTRIBUTE(x) __has_attribute(x) +#else +# define AV_HAS_ATTRIBUTE(x) 0 +#endif + +#if defined(__cplusplus) && \ + defined(__has_cpp_attribute) && \ + __cplusplus >= 201103L +# define AV_HAS_STD_ATTRIBUTE(x) __has_cpp_attribute(x) +#elif !defined(__cplusplus) && \ + defined(__has_c_attribute) && \ + defined(__STDC_VERSION__) && \ + __STDC_VERSION__ >= 202311L +# define AV_HAS_STD_ATTRIBUTE(x) __has_c_attribute(x) +#else +# define AV_HAS_STD_ATTRIBUTE(x) 0 +#endif + #ifndef av_always_inline -#if AV_GCC_VERSION_AT_LEAST(3,1) +#if AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__) # define av_always_inline __attribute__((always_inline)) inline #elif defined(_MSC_VER) # define av_always_inline __forceinline @@ -58,13 +77,15 @@ #endif #endif -#if AV_GCC_VERSION_AT_LEAST(3,4) +#if AV_HAS_STD_ATTRIBUTE(nodiscard) +# define av_warn_unused_result [[nodiscard]] +#elif AV_GCC_VERSION_AT_LEAST(3,4) || defined(__clang__) # define av_warn_unused_result __attribute__((warn_unused_result)) #else # define av_warn_unused_result #endif -#if AV_GCC_VERSION_AT_LEAST(3,1) +#if AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__) # define av_noinline __attribute__((noinline)) #elif defined(_MSC_VER) # define av_noinline __declspec(noinline) @@ -96,7 +117,9 @@ # define av_flatten #endif -#if AV_GCC_VERSION_AT_LEAST(3,1) +#if AV_HAS_STD_ATTRIBUTE(deprecated) +# define attribute_deprecated [[deprecated]] +#elif AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__) # define attribute_deprecated __attribute__((deprecated)) #elif defined(_MSC_VER) # define attribute_deprecated __declspec(deprecated) @@ -127,7 +150,9 @@ #endif #endif -#if defined(__GNUC__) || defined(__clang__) +#if AV_HAS_STD_ATTRIBUTE(maybe_unused) +# define av_unused [[maybe_unused]] +#elif defined(__GNUC__) || defined(__clang__) # define av_unused __attribute__((unused)) #else # define av_unused @@ -158,15 +183,42 @@ #if defined(__GNUC__) || defined(__clang__) # define av_builtin_constant_p __builtin_constant_p -# define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos))) -# define av_scanf_format(fmtpos, attrpos) __attribute__((__format__(__scanf__, fmtpos, attrpos))) #else # define av_builtin_constant_p(x) 0 +#endif + +// for __MINGW_PRINTF_FORMAT and __MINGW_SCANF_FORMAT +#ifdef __MINGW32__ +# include +#endif + +#ifdef __MINGW_PRINTF_FORMAT +# define AV_PRINTF_FMT __MINGW_PRINTF_FORMAT +#elif AV_HAS_ATTRIBUTE(format) +# define AV_PRINTF_FMT __printf__ +#endif + +#ifdef __MINGW_SCANF_FORMAT +# define AV_SCANF_FMT __MINGW_SCANF_FORMAT +#elif AV_HAS_ATTRIBUTE(format) +# define AV_SCANF_FMT __scanf__ +#endif + +#ifdef AV_PRINTF_FMT +# define av_printf_format(fmtpos, attrpos) __attribute__((format(AV_PRINTF_FMT, fmtpos, attrpos))) +#else # define av_printf_format(fmtpos, attrpos) +#endif + +#ifdef AV_SCANF_FMT +# define av_scanf_format(fmtpos, attrpos) __attribute__((format(AV_SCANF_FMT, fmtpos, attrpos))) +#else # define av_scanf_format(fmtpos, attrpos) #endif -#if AV_GCC_VERSION_AT_LEAST(2,5) || defined(__clang__) +#if AV_HAS_STD_ATTRIBUTE(noreturn) +# define av_noreturn [[noreturn]] +#elif AV_GCC_VERSION_AT_LEAST(2,5) || defined(__clang__) # define av_noreturn __attribute__((noreturn)) #else # define av_noreturn diff --git a/dep/ffmpeg/include/libavutil/avassert.h b/dep/ffmpeg/include/libavutil/avassert.h index f4f039dfb..e316a3c90 100644 --- a/dep/ffmpeg/include/libavutil/avassert.h +++ b/dep/ffmpeg/include/libavutil/avassert.h @@ -34,6 +34,7 @@ #include "attributes.h" #include "log.h" #include "macros.h" +#include "version.h" /** * assert() equivalent, that is always enabled. @@ -63,18 +64,25 @@ */ #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 #define av_assert2(cond) av_assert0(cond) -#define av_assert2_fpu() av_assert0_fpu() #else #define av_assert2(cond) ((void)0) -#define av_assert2_fpu() ((void)0) #endif +#if FF_API_ASSERT_FPU +#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 +#define av_assert2_fpu() av_assert0_fpu() +#else +#define av_assert2_fpu() ((void)0) +#endif /** * Assert that floating point operations can be executed. * * This will av_assert0() that the cpu is not in MMX state on X86 + * @deprecated without replacement */ +attribute_deprecated void av_assert0_fpu(void); +#endif /** * Asserts that are used as compiler optimization hints depending @@ -108,16 +116,10 @@ do { \ #define av_unreachable(msg) ((void)0) #endif -#if AV_HAS_BUILTIN(__builtin_assume) -#define av_assume(cond) __builtin_assume(cond) -#elif defined(_MSC_VER) -#define av_assume(cond) __assume(cond) -#else #define av_assume(cond) do { \ if (!(cond)) \ av_unreachable(); \ } while (0) #endif -#endif #endif /* AVUTIL_AVASSERT_H */ diff --git a/dep/ffmpeg/include/libavutil/common.h b/dep/ffmpeg/include/libavutil/common.h index 3b830daf3..bf23aa50b 100644 --- a/dep/ffmpeg/include/libavutil/common.h +++ b/dep/ffmpeg/include/libavutil/common.h @@ -486,13 +486,13 @@ static av_always_inline av_const int av_parity_c(uint32_t v) * to prevent undefined results. */ #define GET_UTF8(val, GET_BYTE, ERROR)\ - val= (GET_BYTE);\ + val= (uint8_t)(GET_BYTE);\ {\ uint32_t top = (val & 128) >> 1;\ if ((val & 0xc0) == 0x80 || val >= 0xFE)\ {ERROR}\ while (val & top) {\ - unsigned int tmp = (GET_BYTE) - 128;\ + unsigned int tmp = (uint8_t)(GET_BYTE) - 128;\ if(tmp>>6)\ {ERROR}\ val= (val<<6) + tmp;\ @@ -511,11 +511,11 @@ 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 = (uint16_t)(GET_16BIT);\ {\ unsigned int hi = val - 0xD800;\ if (hi < 0x800) {\ - val = (GET_16BIT) - 0xDC00;\ + val = (uint16_t)(GET_16BIT) - 0xDC00;\ if (val > 0x3FFU || hi > 0x3FFU)\ {ERROR}\ val += (hi<<10) + 0x10000;\ diff --git a/dep/ffmpeg/include/libavcodec/container_fifo.h b/dep/ffmpeg/include/libavutil/container_fifo.h similarity index 100% rename from dep/ffmpeg/include/libavcodec/container_fifo.h rename to dep/ffmpeg/include/libavutil/container_fifo.h diff --git a/dep/ffmpeg/include/libavutil/cpu.h b/dep/ffmpeg/include/libavutil/cpu.h index 5ef5da58e..464d4cd5d 100644 --- a/dep/ffmpeg/include/libavutil/cpu.h +++ b/dep/ffmpeg/include/libavutil/cpu.h @@ -24,7 +24,9 @@ #include #include "version.h" -#define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */ +#if FF_API_CPU_FLAG_FORCE +#define AV_CPU_FLAG_FORCE 0x80000000 /* @deprecated, should not be used */ +#endif /* lower 16 bits - CPU features */ #define AV_CPU_FLAG_MMX 0x0001 ///< standard MMX @@ -45,6 +47,7 @@ #define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions #define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions #define AV_CPU_FLAG_AESNI 0x80000 ///< Advanced Encryption Standard functions +#define AV_CPU_FLAG_CLMUL 0x400000 ///< Carry-less Multiplication instruction #define AV_CPU_FLAG_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used #define AV_CPU_FLAG_AVXSLOW 0x8000000 ///< AVX supported, but slow when using YMM registers (e.g. Bulldozer) #define AV_CPU_FLAG_XOP 0x0400 ///< Bulldozer XOP functions @@ -74,6 +77,10 @@ #define AV_CPU_FLAG_I8MM (1 << 9) #define AV_CPU_FLAG_SVE (1 <<10) #define AV_CPU_FLAG_SVE2 (1 <<11) +#define AV_CPU_FLAG_SME (1 <<12) +#define AV_CPU_FLAG_ARM_CRC (1 <<13) +#define AV_CPU_FLAG_SME2 (1 <<14) +#define AV_CPU_FLAG_SME_I16I64 (1 <<15) #define AV_CPU_FLAG_SETEND (1 <<16) #define AV_CPU_FLAG_MMI (1 << 0) diff --git a/dep/ffmpeg/include/libavutil/csp.h b/dep/ffmpeg/include/libavutil/csp.h index 9871b1c9b..9d75ccbb6 100644 --- a/dep/ffmpeg/include/libavutil/csp.h +++ b/dep/ffmpeg/include/libavutil/csp.h @@ -133,6 +133,22 @@ enum AVColorPrimaries av_csp_primaries_id_from_desc(const AVColorPrimariesDesc * */ double av_csp_approximate_trc_gamma(enum AVColorTransferCharacteristic trc); +/** + * Determine a suitable EOTF 'gamma' value to match the supplied + * AVColorTransferCharacteristic. + * + * This function returns the gamma value (exponent) for a simple pure power + * function approximation of the supplied AVColorTransferCharacteristic, or 0. + * if no reasonable approximation exists. + * + * EOTF(v) = (L_w - L_b) * v^gamma + L_b + * + * @return Will return an approximation to the simple gamma function matching + * the supplied Transfer Characteristic EOTF, Will return 0.0 for any + * we cannot reasonably match against. + */ +double av_csp_approximate_eotf_gamma(enum AVColorTransferCharacteristic trc); + /** * Determine the function needed to apply the given * AVColorTransferCharacteristic to linear input. diff --git a/dep/ffmpeg/include/libavutil/dovi_meta.h b/dep/ffmpeg/include/libavutil/dovi_meta.h index 5e8a1e43d..c102bf384 100644 --- a/dep/ffmpeg/include/libavutil/dovi_meta.h +++ b/dep/ffmpeg/include/libavutil/dovi_meta.h @@ -279,12 +279,20 @@ typedef struct AVDOVIDmLevel11 { uint8_t content_type; uint8_t whitepoint; uint8_t reference_mode_flag; +#if FF_API_DOVI_L11_INVALID_PROPS + attribute_deprecated uint8_t sharpness; + attribute_deprecated uint8_t noise_reduction; + attribute_deprecated uint8_t mpeg_noise_reduction; + attribute_deprecated uint8_t frame_rate_conversion; + attribute_deprecated uint8_t brightness; + attribute_deprecated uint8_t color; +#endif } AVDOVIDmLevel11; typedef struct AVDOVIDmLevel254 { @@ -369,6 +377,10 @@ av_dovi_get_color(const AVDOVIMetadata *data) return (AVDOVIColorMetadata *)((uint8_t *) data + data->color_offset); } +/** + * Gets the specified Dolby Vision Display Management (DM) metadata + * @param index must be non negative and below data->num_ext_blocks + */ static av_always_inline AVDOVIDmData * av_dovi_get_ext(const AVDOVIMetadata *data, int index) { diff --git a/dep/ffmpeg/include/libavutil/ffversion.h b/dep/ffmpeg/include/libavutil/ffversion.h index 06062fb6f..428764fc3 100644 --- a/dep/ffmpeg/include/libavutil/ffversion.h +++ b/dep/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 "8.0" +#define FFMPEG_VERSION "8.1" #endif /* AVUTIL_FFVERSION_H */ diff --git a/dep/ffmpeg/include/libavutil/frame.h b/dep/ffmpeg/include/libavutil/frame.h index d440cfba2..771c9ce45 100644 --- a/dep/ffmpeg/include/libavutil/frame.h +++ b/dep/ffmpeg/include/libavutil/frame.h @@ -254,6 +254,12 @@ enum AVFrameSideDataType { * libavutil/tdrdi.h. */ AV_FRAME_DATA_3D_REFERENCE_DISPLAYS, + + /** + * Extensible image file format metadata. The payload is a buffer containing + * EXIF metadata, starting with either 49 49 2a 00, or 4d 4d 00 2a. + */ + AV_FRAME_DATA_EXIF, }; enum AVActiveFormatDescription { @@ -652,7 +658,7 @@ typedef struct AVFrame { * * For coding bitstream formats which support both lossless and lossy * encoding, it is sometimes possible for a decoder to determine which method - * was used when the bitsream was encoded. + * was used when the bitstream was encoded. */ #define AV_FRAME_FLAG_LOSSLESS (1 << 5) /** @@ -736,7 +742,7 @@ typedef struct AVFrame { /** * @anchor cropping * @name Cropping - * Video frames only. The number of pixels to discard from the the + * Video frames only. The number of pixels to discard from the * top/bottom/left/right border of the frame to obtain the sub-rectangle of * the frame intended for presentation. * @{ @@ -767,6 +773,13 @@ typedef struct AVFrame { * Duration of the frame, in the same units as pts. 0 if unknown. */ int64_t duration; + + /** + * Indicates how the alpha channel of the video is to be handled. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVAlphaMode alpha_mode; } AVFrame; @@ -812,7 +825,7 @@ 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. + * src is not reference counted, or by unreferencing it if src is empty. * * Frame properties on dst will be replaced by those from src. * diff --git a/dep/ffmpeg/include/libavcodec/hwcontext_amf.h b/dep/ffmpeg/include/libavutil/hwcontext_amf.h similarity index 94% rename from dep/ffmpeg/include/libavcodec/hwcontext_amf.h rename to dep/ffmpeg/include/libavutil/hwcontext_amf.h index 882319069..6f2cabc87 100644 --- a/dep/ffmpeg/include/libavcodec/hwcontext_amf.h +++ b/dep/ffmpeg/include/libavutil/hwcontext_amf.h @@ -38,6 +38,10 @@ typedef struct AVAMFDeviceContext { int64_t version; ///< version of AMF runtime AMFContext *context; AMF_MEMORY_TYPE memory_type; + + void (*lock)(void *lock_ctx); + void (*unlock)(void *lock_ctx); + void *lock_ctx; } AVAMFDeviceContext; enum AMF_SURFACE_FORMAT av_av_to_amf_format(enum AVPixelFormat fmt); diff --git a/dep/ffmpeg/include/libavutil/hwcontext_d3d11va.h b/dep/ffmpeg/include/libavutil/hwcontext_d3d11va.h index 77d2d72f1..b87b1e8fa 100644 --- a/dep/ffmpeg/include/libavutil/hwcontext_d3d11va.h +++ b/dep/ffmpeg/include/libavutil/hwcontext_d3d11va.h @@ -94,6 +94,20 @@ typedef struct AVD3D11VADeviceContext { void (*lock)(void *lock_ctx); void (*unlock)(void *lock_ctx); void *lock_ctx; + /** + * D3D11_TEXTURE2D_DESC.BindFlags to be applied to D3D11 resources allocated + * for frames using this device context. + * + * It applies globally to all AVD3D11VAFramesContext allocated from this device context. + */ + UINT BindFlags; + /** + * D3D11_TEXTURE2D_DESC.MiscFlags to be applied to D3D11 resources allocated + * for frames using this device context. + * + * It applies globally to all AVD3D11VAFramesContext allocated from this device context. + */ + UINT MiscFlags; } AVD3D11VADeviceContext; /** diff --git a/dep/ffmpeg/include/libavutil/hwcontext_d3d12va.h b/dep/ffmpeg/include/libavutil/hwcontext_d3d12va.h index 212a6a614..adbec8817 100644 --- a/dep/ffmpeg/include/libavutil/hwcontext_d3d12va.h +++ b/dep/ffmpeg/include/libavutil/hwcontext_d3d12va.h @@ -75,6 +75,26 @@ typedef struct AVD3D12VADeviceContext { void (*lock)(void *lock_ctx); void (*unlock)(void *lock_ctx); void *lock_ctx; + + /** + * Resource flags to be applied to D3D12 resources allocated + * for frames using this device context. + * + * If unset, this will be D3D12_RESOURCE_FLAG_NONE. + * + * It applies globally to all AVD3D12VAFramesContext allocated from this device context. + */ + D3D12_RESOURCE_FLAGS resource_flags; + + /** + * Heap flags to be applied to D3D12 resources allocated + * for frames using this device context. + * + * If unset, this will be D3D12_HEAP_FLAG_NONE. + * + * It applies globally to all AVD3D12VAFramesContext allocated from this device context. + */ + D3D12_HEAP_FLAGS heap_flags; } AVD3D12VADeviceContext; /** @@ -99,6 +119,18 @@ typedef struct AVD3D12VASyncContext { uint64_t fence_value; } AVD3D12VASyncContext; +/** + * Define the behaviours of frame allocation. + */ +typedef enum AVD3D12VAFrameFlags { + AV_D3D12VA_FRAME_FLAG_NONE = 0, + + /** + * Indicates that frame data should be allocated using a texture array resource. + */ + AV_D3D12VA_FRAME_FLAG_TEXTURE_ARRAY = (1 << 1), +} AVD3D12VAFrameFlags; + /** * @brief D3D12VA frame descriptor for pool allocation. * @@ -111,12 +143,26 @@ typedef struct AVD3D12VAFrame { */ ID3D12Resource *texture; + /** + * Index of the subresource within the texture. + * + * In texture array mode, this specifies the array slice index. + * When texture array mode is not used, this value is always 0. + */ + int subresource_index; + /** * 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; + + /** + * A combination of AVD3D12VAFrameFlags. + * Set by AVD3D12VAFramesContext. + */ + AVD3D12VAFrameFlags flags; } AVD3D12VAFrame; /** @@ -136,7 +182,28 @@ typedef struct AVD3D12VAFramesContext { * * @see https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ne-d3d12-d3d12_resource_flags */ - D3D12_RESOURCE_FLAGS flags; + D3D12_RESOURCE_FLAGS resource_flags; + + /** + * Options for working with heaps allocation when creating resources. + * If unset, this will be D3D12_HEAP_FLAG_NONE. + * + * @see https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ne-d3d12-d3d12_heap_flags + */ + D3D12_HEAP_FLAGS heap_flags; + + /** + * In texture array mode, the D3D12 uses the same texture array (resource)for all + * pictures. + */ + ID3D12Resource *texture_array; + + /** + * A combination of AVD3D12VAFrameFlags. Unless AV_D3D12VA_FRAME_FLAG_NONE is set, + * autodetected flags will be OR'd based on the device and frame features during + * av_hwframe_ctx_init(). + */ + AVD3D12VAFrameFlags flags; } AVD3D12VAFramesContext; #endif /* AVUTIL_HWCONTEXT_D3D12VA_H */ diff --git a/dep/ffmpeg/include/libavcodec/hwcontext_oh.h b/dep/ffmpeg/include/libavutil/hwcontext_oh.h similarity index 100% rename from dep/ffmpeg/include/libavcodec/hwcontext_oh.h rename to dep/ffmpeg/include/libavutil/hwcontext_oh.h diff --git a/dep/ffmpeg/include/libavutil/hwcontext_vaapi.h b/dep/ffmpeg/include/libavutil/hwcontext_vaapi.h index 0b2e071cb..82e4194a9 100644 --- a/dep/ffmpeg/include/libavutil/hwcontext_vaapi.h +++ b/dep/ffmpeg/include/libavutil/hwcontext_vaapi.h @@ -26,7 +26,7 @@ * API-specific header for AV_HWDEVICE_TYPE_VAAPI. * * Dynamic frame pools are supported, but note that any pool used as a render - * target is required to be of fixed size in order to be be usable as an + * target is required to be of fixed size in order to be usable as an * argument to vaCreateContext(). * * For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs diff --git a/dep/ffmpeg/include/libavutil/hwcontext_vulkan.h b/dep/ffmpeg/include/libavutil/hwcontext_vulkan.h index 15cf51566..b9a841a19 100644 --- a/dep/ffmpeg/include/libavutil/hwcontext_vulkan.h +++ b/dep/ffmpeg/include/libavutil/hwcontext_vulkan.h @@ -97,6 +97,8 @@ typedef struct AVVulkanDeviceContext { * 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. + * av_vk_get_optional_instance_extensions() can be used to enumerate extensions + * that FFmpeg may use if enabled. */ const char * const *enabled_inst_extensions; int nb_enabled_inst_extensions; @@ -108,6 +110,8 @@ typedef struct AVVulkanDeviceContext { * 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. + * av_vk_get_optional_device_extensions() can be used to enumerate extensions + * that FFmpeg may use if enabled. */ const char * const *enabled_dev_extensions; int nb_enabled_dev_extensions; @@ -164,18 +168,26 @@ typedef struct AVVulkanDeviceContext { int nb_decode_queues; #endif +#if FF_API_VULKAN_SYNC_QUEUES /** * 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. + * + * Deprecated: use VK_KHR_internally_synchronized_queues. */ + attribute_deprecated 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. + * + * Deprecated: use VK_KHR_internally_synchronized_queues. */ + attribute_deprecated void (*unlock_queue)(struct AVHWDeviceContext *ctx, uint32_t queue_family, uint32_t index); +#endif /** * Queue families used. Must be preferentially ordered. List may contain @@ -218,7 +230,8 @@ typedef struct AVVulkanFramesContext { /** * Defines extra usage of output frames. If non-zero, all flags MUST be - * supported by the VkFormat. Otherwise, will use supported flags amongst: + * supported by the VkFormat. Regardless, frames will always have the + * following usage flags enabled, if supported by the format: * - VK_IMAGE_USAGE_SAMPLED_BIT * - VK_IMAGE_USAGE_STORAGE_BIT * - VK_IMAGE_USAGE_TRANSFER_SRC_BIT @@ -374,4 +387,18 @@ AVVkFrame *av_vk_frame_alloc(void); */ const VkFormat *av_vkfmt_from_pixfmt(enum AVPixelFormat p); +/** + * Returns an array of optional Vulkan instance extensions that FFmpeg + * may use if enabled. + * @note Must be freed via av_free() + */ +const char **av_vk_get_optional_instance_extensions(int *count); + +/** + * Returns an array of optional Vulkan device extensions that FFmpeg + * may use if enabled. + * @note Must be freed via av_free() + */ +const char **av_vk_get_optional_device_extensions(int *count); + #endif /* AVUTIL_HWCONTEXT_VULKAN_H */ diff --git a/dep/ffmpeg/include/libavutil/iamf.h b/dep/ffmpeg/include/libavutil/iamf.h index 855f64280..a755e7d68 100644 --- a/dep/ffmpeg/include/libavutil/iamf.h +++ b/dep/ffmpeg/include/libavutil/iamf.h @@ -330,14 +330,17 @@ typedef struct AVIAMFLayer { /** * 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; + + /** + * The length of the Demixing matrix array. Must be 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. + */ + unsigned int nb_demixing_matrix; } AVIAMFLayer; diff --git a/dep/ffmpeg/include/libavutil/pixdesc.h b/dep/ffmpeg/include/libavutil/pixdesc.h index ba2f63281..0cc70eb64 100644 --- a/dep/ffmpeg/include/libavutil/pixdesc.h +++ b/dep/ffmpeg/include/libavutil/pixdesc.h @@ -291,6 +291,16 @@ int av_chroma_location_enum_to_pos(int *xpos, int *ypos, enum AVChromaLocation p */ enum AVChromaLocation av_chroma_location_pos_to_enum(int xpos, int ypos); +/** + * @return the name for provided alpha mode or NULL if unknown. + */ +const char *av_alpha_mode_name(enum AVAlphaMode mode); + +/** + * @return the AVAlphaMode value for name or an AVError if not found. + */ +enum AVAlphaMode av_alpha_mode_from_name(const char *name); + /** * Return the pixel format corresponding to name. * diff --git a/dep/ffmpeg/include/libavutil/pixfmt.h b/dep/ffmpeg/include/libavutil/pixfmt.h index 823ea8eda..2e7b6457e 100644 --- a/dep/ffmpeg/include/libavutil/pixfmt.h +++ b/dep/ffmpeg/include/libavutil/pixfmt.h @@ -651,7 +651,12 @@ enum AVColorPrimaries { AVCOL_PRI_SMPTE432 = 12, ///< SMPTE ST 432-1 (2010) / P3 D65 / Display P3 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 + AVCOL_PRI_NB, ///< Not part of ABI + + /* The following entries are not part of H.273, but custom extensions */ + AVCOL_PRI_EXT_BASE = 256, + AVCOL_PRI_V_GAMUT = AVCOL_PRI_EXT_BASE, + AVCOL_PRI_EXT_NB ///< Not part of ABI }; /** @@ -680,7 +685,12 @@ enum AVColorTransferCharacteristic { AVCOL_TRC_SMPTE428 = 17, ///< SMPTE ST 428-1 AVCOL_TRC_SMPTEST428_1 = AVCOL_TRC_SMPTE428, AVCOL_TRC_ARIB_STD_B67 = 18, ///< ARIB STD-B67, known as "Hybrid log-gamma" - AVCOL_TRC_NB ///< Not part of ABI + AVCOL_TRC_NB, ///< Not part of ABI + + /* The following entries are not part of H.273, but custom extensions */ + AVCOL_TRC_EXT_BASE = 256, + AVCOL_TRC_V_LOG = AVCOL_TRC_EXT_BASE, + AVCOL_TRC_EXT_NB ///< Not part of ABI }; /** @@ -794,4 +804,14 @@ enum AVChromaLocation { AVCHROMA_LOC_NB ///< Not part of ABI }; +/** + * Correlation between the alpha channel and color values. + */ +enum AVAlphaMode { + AVALPHA_MODE_UNSPECIFIED = 0, ///< Unknown alpha handling, or no alpha channel + AVALPHA_MODE_PREMULTIPLIED = 1, ///< Alpha channel is multiplied into color values + AVALPHA_MODE_STRAIGHT = 2, ///< Alpha channel is independent of color values + AVALPHA_MODE_NB ///< Not part of ABI +}; + #endif /* AVUTIL_PIXFMT_H */ diff --git a/dep/ffmpeg/include/libavcodec/refstruct.h b/dep/ffmpeg/include/libavutil/refstruct.h similarity index 100% rename from dep/ffmpeg/include/libavcodec/refstruct.h rename to dep/ffmpeg/include/libavutil/refstruct.h diff --git a/dep/ffmpeg/include/libavcodec/tdrdi.h b/dep/ffmpeg/include/libavutil/tdrdi.h similarity index 100% rename from dep/ffmpeg/include/libavcodec/tdrdi.h rename to dep/ffmpeg/include/libavutil/tdrdi.h diff --git a/dep/ffmpeg/include/libavutil/version.h b/dep/ffmpeg/include/libavutil/version.h index 6ce66075b..5d69f4451 100644 --- a/dep/ffmpeg/include/libavutil/version.h +++ b/dep/ffmpeg/include/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 60 -#define LIBAVUTIL_VERSION_MINOR 8 +#define LIBAVUTIL_VERSION_MINOR 26 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ @@ -110,6 +110,10 @@ #define FF_API_VULKAN_FIXED_QUEUES (LIBAVUTIL_VERSION_MAJOR < 61) #define FF_API_OPT_INT_LIST (LIBAVUTIL_VERSION_MAJOR < 61) #define FF_API_OPT_PTR (LIBAVUTIL_VERSION_MAJOR < 61) +#define FF_API_CPU_FLAG_FORCE (LIBAVUTIL_VERSION_MAJOR < 61) +#define FF_API_DOVI_L11_INVALID_PROPS (LIBAVUTIL_VERSION_MAJOR < 61) +#define FF_API_ASSERT_FPU (LIBAVUTIL_VERSION_MAJOR < 61) +#define FF_API_VULKAN_SYNC_QUEUES (LIBAVUTIL_VERSION_MAJOR < 62) /** * @} diff --git a/dep/ffmpeg/include/libswresample/version.h b/dep/ffmpeg/include/libswresample/version.h index 9c223e142..d1795b554 100644 --- a/dep/ffmpeg/include/libswresample/version.h +++ b/dep/ffmpeg/include/libswresample/version.h @@ -30,7 +30,7 @@ #include "version_major.h" -#define LIBSWRESAMPLE_VERSION_MINOR 1 +#define LIBSWRESAMPLE_VERSION_MINOR 3 #define LIBSWRESAMPLE_VERSION_MICRO 100 #define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \ diff --git a/dep/ffmpeg/include/libswscale/swscale.h b/dep/ffmpeg/include/libswscale/swscale.h index 39e23075a..1cfd4068f 100644 --- a/dep/ffmpeg/include/libswscale/swscale.h +++ b/dep/ffmpeg/include/libswscale/swscale.h @@ -82,6 +82,7 @@ typedef enum SwsDither { SWS_DITHER_A_DITHER, /* arithmetic addition */ SWS_DITHER_X_DITHER, /* arithmetic xor */ SWS_DITHER_NB, /* not part of the ABI */ + SWS_DITHER_MAX_ENUM = 0x7FFFFFFF, /* force size to 32 bits, not a valid dither type */ } SwsDither; typedef enum SwsAlphaBlend { @@ -89,6 +90,7 @@ typedef enum SwsAlphaBlend { SWS_ALPHA_BLEND_UNIFORM, SWS_ALPHA_BLEND_CHECKERBOARD, SWS_ALPHA_BLEND_NB, /* not part of the ABI */ + SWS_ALPHA_BLEND_MAX_ENUM = 0x7FFFFFFF, /* force size to 32 bits, not a valid blend mode */ } SwsAlphaBlend; typedef enum SwsFlags { @@ -155,6 +157,13 @@ typedef enum SwsFlags { SWS_ACCURATE_RND = 1 << 18, SWS_BITEXACT = 1 << 19, + /** + * Allow using experimental new code paths. This may be faster, slower, + * or produce different output, with semantics subject to change at any + * point in time. For testing and debugging purposes only. + */ + SWS_UNSTABLE = 1 << 20, + /** * Deprecated flags. */ @@ -258,7 +267,7 @@ void sws_free_context(SwsContext **ctx); ***************************/ /** - * Test if a given pixel format is supported. + * Test if a given (software) pixel format is supported. * * @param output If 0, test if compatible with the source/input frame; * otherwise, with the destination/output frame. @@ -268,6 +277,15 @@ void sws_free_context(SwsContext **ctx); */ int sws_test_format(enum AVPixelFormat format, int output); +/** + * Test if a given hardware pixel format is supported. + * + * @param format The hardware format to check, or AV_PIX_FMT_NONE. + * + * @return A positive integer if supported or AV_PIX_FMT_NONE, 0 otherwise. + */ +int sws_test_hw_format(enum AVPixelFormat format); + /** * Test if a given color space is supported. * @@ -422,7 +440,7 @@ int sws_isSupportedEndiannessConversion(enum AVPixelFormat pix_fmt); * Initialize the swscaler context sws_context. * * This function is considered deprecated, and provided only for backwards - * compatibility with sws_scale() and sws_start_frame(). The preferred way to + * compatibility with sws_scale() and sws_frame_start(). The preferred way to * use libswscale is to set all frame properties correctly and call * sws_scale_frame() directly, without explicitly initializing the context. * @@ -467,8 +485,8 @@ SwsContext *sws_getContext(int srcW, int srcH, enum AVPixelFormat srcFormat, /** * Scale the image slice in srcSlice and put the resulting scaled * slice in the image in dst. A slice is a sequence of consecutive - * rows in an image. Requires a context that has been previously - * been initialized with sws_init_context(). + * rows in an image. Requires a context that has previously been + * initialized with sws_init_context(). * * Slices have to be provided in sequential order, either in * top-bottom or bottom-top order. If slices are provided in @@ -498,8 +516,7 @@ int sws_scale(SwsContext *c, const uint8_t *const srcSlice[], /** * 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(). - * Requires a context that has been previously been initialized with - * sws_init_context(). + * Requires a context that has previously been initialized with sws_init_context(). * * 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). @@ -570,7 +587,7 @@ int sws_receive_slice(SwsContext *c, unsigned int slice_start, unsigned int slice_height); /** - * Get the alignment required for slices. Requires a context that has been + * Get the alignment required for slices. Requires a context that has * previously been initialized with sws_init_context(). * * @param c The scaling context @@ -582,8 +599,8 @@ unsigned int sws_receive_slice_alignment(const 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 dstRange flag indicating the white-black range of the output (1=jpeg / 0=mpeg) + * @param srcRange flag indicating the white-black range of the input (1=jpeg / 0=mpeg) * @param table the yuv2rgb coefficients describing the output yuv space, normally ff_yuv2rgb_coeffs[x] * @param inv_table the yuv2rgb coefficients describing the input yuv space, normally ff_yuv2rgb_coeffs[x] * @param brightness 16.16 fixed point brightness correction diff --git a/dep/ffmpeg/include/libswscale/version.h b/dep/ffmpeg/include/libswscale/version.h index 4e54701ab..c13db31c4 100644 --- a/dep/ffmpeg/include/libswscale/version.h +++ b/dep/ffmpeg/include/libswscale/version.h @@ -28,7 +28,7 @@ #include "version_major.h" -#define LIBSWSCALE_VERSION_MINOR 1 +#define LIBSWSCALE_VERSION_MINOR 5 #define LIBSWSCALE_VERSION_MICRO 100 #define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \