diff --git a/Plugins/FFMPEG/FFMPEGDecoder.h b/Plugins/FFMPEG/FFMPEGDecoder.h index 82d43cf79..c4891d206 100644 --- a/Plugins/FFMPEG/FFMPEGDecoder.h +++ b/Plugins/FFMPEG/FFMPEGDecoder.h @@ -34,6 +34,7 @@ int64_t ffmpeg_seek(void *opaque, int64_t offset, int whence); @interface FFMPEGDecoder : NSObject { id source; FFMPEGReader *reader; + BOOL isHLS; BOOL seekable; int channels; uint32_t channelConfig; diff --git a/Plugins/FFMPEG/FFMPEGDecoder.m b/Plugins/FFMPEG/FFMPEGDecoder.m index 6ebf59318..3d86ac46d 100644 --- a/Plugins/FFMPEG/FFMPEGDecoder.m +++ b/Plugins/FFMPEG/FFMPEGDecoder.m @@ -121,7 +121,7 @@ static uint8_t reverse_bits[0x100]; rawDSD = NO; - BOOL isStream = NO; + isHLS = NO; // register all available codecs @@ -131,13 +131,16 @@ static uint8_t reverse_bits[0x100]; subsong = [[source.url fragment] intValue]; NSURL *url = [s url]; - if(([[url scheme] isEqualToString:@"http"] || - [[url scheme] isEqualToString:@"https"]) && - [[url pathExtension] isEqualToString:@"m3u8"]) { + + BOOL isHTTP = [[url scheme] isEqualToString:@"http"] || + [[url scheme] isEqualToString:@"https"]; + BOOL isM3U = [[url pathExtension] isEqualToString:@"m3u8"]; + + if(isHTTP && isM3U) { source = nil; [s close]; - isStream = YES; + isHLS = YES; formatCtx = avformat_alloc_context(); if(!formatCtx) { @@ -151,7 +154,7 @@ static uint8_t reverse_bits[0x100]; ALog(@"Error opening file, errcode = %d, error = %s", errcode, errDescr); return NO; } - } else { + } else if(!isM3U) { buffer = av_malloc(32 * 1024); if(!buffer) { ALog(@"Out of memory!"); @@ -179,6 +182,8 @@ static uint8_t reverse_bits[0x100]; ALog(@"Error opening file, errcode = %d, error = %s", errcode, errDescr); return NO; } + } else { + return NO; } if((errcode = avformat_find_stream_info(formatCtx, NULL)) < 0) { @@ -481,7 +486,7 @@ static uint8_t reverse_bits[0x100]; // totalFrames = codecCtx->sample_rate * ((float)formatCtx->duration/AV_TIME_BASE); AVRational tb = { .num = 1, .den = codecCtx->sample_rate }; - totalFrames = isStream ? 0 : av_rescale_q(formatCtx->duration, AV_TIME_BASE_Q, tb); + totalFrames = isHLS ? 0 : av_rescale_q(formatCtx->duration, AV_TIME_BASE_Q, tb); bitrate = (int)((codecCtx->bit_rate) / 1000); framesRead = 0; endOfStream = NO; @@ -502,7 +507,7 @@ static uint8_t reverse_bits[0x100]; totalFrames *= 8; } - if(!isStream) { + if(!isHLS) { if(stream->start_time && stream->start_time != AV_NOPTS_VALUE) skipSamples = av_rescale_q(stream->start_time, stream->time_base, tb); if(skipSamples < 0) @@ -524,7 +529,7 @@ static uint8_t reverse_bits[0x100]; if(totalFrames < 0) totalFrames = 0; - seekable = [s seekable]; + seekable = !isHLS && [s seekable]; seekedToStart = !seekable; @@ -592,11 +597,24 @@ static void setDictionary(NSMutableDictionary *dict, NSString *tag, NSString *va - (void)updateMetadata { NSMutableDictionary *_metaDict = [[NSMutableDictionary alloc] init]; const AVDictionaryEntry *tag = NULL; - for(size_t i = 0; i < 2; ++i) { + for(size_t i = 0; i < 4; ++i) { AVDictionary *metadata; if(i == 0) { metadata = formatCtx->metadata; if(!metadata) continue; + } else if(i == 1) { + if(formatCtx->nb_programs > 0) { + AVProgram *program = formatCtx->programs[0]; + if(!program) continue; + metadata = program->metadata; + if(!metadata) continue; + } else { + continue; + } + } else if(i == 2) { + AVStream *stream = formatCtx->streams[streamIndex]; + metadata = stream->metadata; + if(!metadata) continue; } else { if(subsong < formatCtx->nb_chapters) { metadata = formatCtx->chapters[subsong]->metadata; @@ -606,7 +624,7 @@ static void setDictionary(NSMutableDictionary *dict, NSString *tag, NSString *va } } tag = NULL; - while((tag = av_dict_get(metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) { + while((tag = av_dict_iterate(metadata, tag))) { @autoreleasepool { if(!strcasecmp(tag->key, "streamtitle")) { NSString *artistTitle = guess_encoding_of_string(tag->value); @@ -635,6 +653,10 @@ static void setDictionary(NSMutableDictionary *dict, NSString *tag, NSString *va } else { setDictionary(_metaDict, @"title", _tag); } + } else if(!strcasecmp(tag->key, "variant_bitrate")) { + NSString *bitrate = guess_encoding_of_string(tag->value); + long nbitrate = [bitrate integerValue]; + setDictionary(_metaDict, @"bitrate", [@(nbitrate / 1000) stringValue]); } else if(!strcasecmp(tag->key, "date_recorded")) { setDictionary(_metaDict, @"date", guess_encoding_of_string(tag->value)); } else if(!strcasecmp(tag->key, "replaygain_gain")) { @@ -713,7 +735,7 @@ static void setDictionary(NSMutableDictionary *dict, NSString *tag, NSString *va @autoreleasepool { metaDict = _metaDict; } - if(![source seekable]) { + if(!seekable) { [self willChangeValueForKey:@"metadata"]; [self didChangeValueForKey:@"metadata"]; } else { @@ -739,7 +761,7 @@ static void setDictionary(NSMutableDictionary *dict, NSString *tag, NSString *va NSData *_albumArt = [NSData dataWithBytes:lastReadPacket->data length:lastReadPacket->size]; if(![_albumArt isEqualToData:albumArt]) { albumArt = _albumArt; - if(![source seekable]) { + if(!seekable) { [self willChangeValueForKey:@"metadata"]; [self didChangeValueForKey:@"metadata"]; } else { @@ -1056,7 +1078,7 @@ static void setDictionary(NSMutableDictionary *dict, NSString *tag, NSString *va } + (NSArray *)mimeTypes { - return @[@"application/wma", @"application/x-wma", @"audio/x-wma", @"audio/x-ms-wma", @"audio/x-tak", @"application/ogg", @"audio/aac", @"audio/aacp", @"audio/mpeg", @"audio/mp4", @"audio/x-mp3", @"audio/x-mp2", @"audio/x-matroska", @"audio/x-ape", @"audio/x-ac3", @"audio/x-dts", @"audio/x-dtshd", @"audio/x-at3", @"audio/wav", @"audio/tta", @"audio/x-tta", @"audio/x-twinvq", @"application/vnd.apple.mpegurl"]; + return @[@"application/wma", @"application/x-wma", @"audio/x-wma", @"audio/x-ms-wma", @"audio/x-tak", @"application/ogg", @"audio/aac", @"audio/aacp", @"audio/mpeg", @"audio/mp4", @"audio/x-mp3", @"audio/x-mp2", @"audio/x-matroska", @"audio/x-ape", @"audio/x-ac3", @"audio/x-dts", @"audio/x-dtshd", @"audio/x-at3", @"audio/wav", @"audio/tta", @"audio/x-tta", @"audio/x-twinvq", @"application/vnd.apple.mpegurl", @"audio/mpegurl"]; } + (NSArray *)fileTypeAssociations { diff --git a/ThirdParty/ffmpeg/include/libavcodec/avcodec.h b/ThirdParty/ffmpeg/include/libavcodec/avcodec.h index 83dc48725..77ca8dee1 100644 --- a/ThirdParty/ffmpeg/include/libavcodec/avcodec.h +++ b/ThirdParty/ffmpeg/include/libavcodec/avcodec.h @@ -419,6 +419,12 @@ typedef struct RcOverride{ */ #define AV_CODEC_EXPORT_DATA_FILM_GRAIN (1 << 3) +/** + * Decoding only. + * Do not apply picture enhancement layers, export them instead. + */ +#define AV_CODEC_EXPORT_DATA_ENHANCEMENTS (1 << 4) + /** * The decoder will keep a reference to the frame and may reuse it later. */ @@ -1175,6 +1181,10 @@ typedef struct AVCodecContext { * this callback and filled with the extra buffers if there are more * buffers than buf[] can hold. extended_buf will be freed in * av_frame_unref(). + * Decoders will generally initialize the whole buffer before it is output + * but it can in rare error conditions happen that uninitialized data is passed + * through. \important The buffers returned by get_buffer* should thus not contain sensitive + * data. * * If AV_CODEC_CAP_DR1 is not set then get_buffer2() must call * avcodec_default_get_buffer2() instead of providing buffers allocated by @@ -1538,6 +1548,7 @@ typedef struct AVCodecContext { #define FF_DCT_MMX 3 #define FF_DCT_ALTIVEC 5 #define FF_DCT_FAAN 6 +#define FF_DCT_NEON 7 /** * IDCT algorithm, see FF_IDCT_* below. @@ -2071,7 +2082,7 @@ typedef struct AVCodecContext { * - encoding: may be set by user before calling avcodec_open2() for * encoder configuration. Afterwards owned and freed by the * encoder. - * - decoding: unused + * - decoding: may be set by libavcodec in avcodec_open2(). */ AVFrameSideData **decoded_side_data; int nb_decoded_side_data; @@ -2690,6 +2701,36 @@ int avcodec_get_hw_frames_parameters(AVCodecContext *avctx, enum AVPixelFormat hw_pix_fmt, AVBufferRef **out_frames_ref); +enum AVCodecConfig { + AV_CODEC_CONFIG_PIX_FORMAT, ///< AVPixelFormat, terminated by AV_PIX_FMT_NONE + AV_CODEC_CONFIG_FRAME_RATE, ///< AVRational, terminated by {0, 0} + AV_CODEC_CONFIG_SAMPLE_RATE, ///< int, terminated by 0 + AV_CODEC_CONFIG_SAMPLE_FORMAT, ///< AVSampleFormat, terminated by AV_SAMPLE_FMT_NONE + 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 +}; + +/** + * Retrieve a list of all supported values for a given configuration type. + * + * @param avctx An optional context to use. Values such as + * `strict_std_compliance` may affect the result. If NULL, + * default values are used. + * @param codec The codec to query, or NULL to use avctx->codec. + * @param config The configuration to query. + * @param flags Currently unused; should be set to zero. + * @param out_configs On success, set to a list of configurations, terminated + * by a config-specific terminator, or NULL if all + * possible values are supported. + * @param out_num_configs On success, set to the number of elements in + *out_configs, excluding the terminator. Optional. + */ +int avcodec_get_supported_config(const AVCodecContext *avctx, + const AVCodec *codec, enum AVCodecConfig config, + unsigned flags, const void **out_configs, + int *out_num_configs); + /** diff --git a/ThirdParty/ffmpeg/include/libavcodec/codec.h b/ThirdParty/ffmpeg/include/libavcodec/codec.h index 6f9b42760..f7541ffc4 100644 --- a/ThirdParty/ffmpeg/include/libavcodec/codec.h +++ b/ThirdParty/ffmpeg/include/libavcodec/codec.h @@ -205,10 +205,19 @@ typedef struct AVCodec { */ int capabilities; uint8_t max_lowres; ///< maximum value for lowres supported by the decoder - const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0} - const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1 - const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 - const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 + + /** + * Deprecated codec capabilities. + */ + attribute_deprecated + const AVRational *supported_framerates; ///< @deprecated use avcodec_get_supported_config() + attribute_deprecated + const enum AVPixelFormat *pix_fmts; ///< @deprecated use avcodec_get_supported_config() + attribute_deprecated + const int *supported_samplerates; ///< @deprecated use avcodec_get_supported_config() + attribute_deprecated + const enum AVSampleFormat *sample_fmts; ///< @deprecated use avcodec_get_supported_config() + const AVClass *priv_class; ///< AVClass for the private context const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {AV_PROFILE_UNKNOWN} @@ -226,7 +235,9 @@ typedef struct AVCodec { /** * Array of supported channel layouts, terminated with a zeroed layout. + * @deprecated use avcodec_get_supported_config() */ + attribute_deprecated const AVChannelLayout *ch_layouts; } AVCodec; diff --git a/ThirdParty/ffmpeg/include/libavcodec/codec_id.h b/ThirdParty/ffmpeg/include/libavcodec/codec_id.h index c8dc21da7..0a8d3bed1 100644 --- a/ThirdParty/ffmpeg/include/libavcodec/codec_id.h +++ b/ThirdParty/ffmpeg/include/libavcodec/codec_id.h @@ -543,6 +543,7 @@ enum AVCodecID { AV_CODEC_ID_AC4, AV_CODEC_ID_OSQ, AV_CODEC_ID_QOA, + AV_CODEC_ID_LC3, /* subtitle codecs */ AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. @@ -588,6 +589,7 @@ enum AVCodecID { AV_CODEC_ID_TIMED_ID3, AV_CODEC_ID_BIN_DATA, AV_CODEC_ID_SMPTE_2038, + AV_CODEC_ID_LCEVC, AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it diff --git a/ThirdParty/ffmpeg/include/libavcodec/defs.h b/ThirdParty/ffmpeg/include/libavcodec/defs.h index 00d840ec1..24250f8af 100644 --- a/ThirdParty/ffmpeg/include/libavcodec/defs.h +++ b/ThirdParty/ffmpeg/include/libavcodec/defs.h @@ -73,6 +73,7 @@ #define AV_PROFILE_AAC_HE_V2 28 #define AV_PROFILE_AAC_LD 22 #define AV_PROFILE_AAC_ELD 38 +#define AV_PROFILE_AAC_USAC 41 #define AV_PROFILE_MPEG2_AAC_LOW 128 #define AV_PROFILE_MPEG2_AAC_HE 131 @@ -159,6 +160,7 @@ #define AV_PROFILE_HEVC_MAIN_10 2 #define AV_PROFILE_HEVC_MAIN_STILL_PICTURE 3 #define AV_PROFILE_HEVC_REXT 4 +#define AV_PROFILE_HEVC_MULTIVIEW_MAIN 6 #define AV_PROFILE_HEVC_SCC 9 #define AV_PROFILE_VVC_MAIN_10 1 diff --git a/ThirdParty/ffmpeg/include/libavcodec/packet.h b/ThirdParty/ffmpeg/include/libavcodec/packet.h index b0ba3baea..0a2801054 100644 --- a/ThirdParty/ffmpeg/include/libavcodec/packet.h +++ b/ThirdParty/ffmpeg/include/libavcodec/packet.h @@ -59,10 +59,6 @@ enum AVPacketSideDataType { * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows: * @code * u32le param_flags - * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) - * s32le channel_count - * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) - * u64le channel_layout * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) * s32le sample_rate * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS) @@ -330,6 +326,25 @@ enum AVPacketSideDataType { */ AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT, + /** + * The number of pixels to discard from the top/bottom/left/right border of the + * decoded frame to obtain the sub-rectangle intended for presentation. + * + * @code + * u32le crop_top + * u32le crop_bottom + * u32le crop_left + * u32le crop_right + * @endcode + */ + AV_PKT_DATA_FRAME_CROPPING, + + /** + * Raw LCEVC payload data, as a uint8_t array, with NAL emulation + * bytes intact. + */ + AV_PKT_DATA_LCEVC, + /** * The number of side data types. * This is not part of the public API/ABI in the sense that it may @@ -341,7 +356,9 @@ enum AVPacketSideDataType { AV_PKT_DATA_NB }; +#if FF_API_QUALITY_FACTOR #define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS //DEPRECATED +#endif /** * This structure stores auxiliary information for decoding, presenting, or diff --git a/ThirdParty/ffmpeg/include/libavcodec/version.h b/ThirdParty/ffmpeg/include/libavcodec/version.h index 43794ea58..b6ca025fa 100644 --- a/ThirdParty/ffmpeg/include/libavcodec/version.h +++ b/ThirdParty/ffmpeg/include/libavcodec/version.h @@ -29,8 +29,8 @@ #include "version_major.h" -#define LIBAVCODEC_VERSION_MINOR 3 -#define LIBAVCODEC_VERSION_MICRO 100 +#define LIBAVCODEC_VERSION_MINOR 19 +#define LIBAVCODEC_VERSION_MICRO 101 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ diff --git a/ThirdParty/ffmpeg/include/libavcodec/version_major.h b/ThirdParty/ffmpeg/include/libavcodec/version_major.h index ab1f4511b..63df40e9d 100644 --- a/ThirdParty/ffmpeg/include/libavcodec/version_major.h +++ b/ThirdParty/ffmpeg/include/libavcodec/version_major.h @@ -47,5 +47,6 @@ #define FF_API_AVCODEC_CLOSE (LIBAVCODEC_VERSION_MAJOR < 62) #define FF_API_BUFFER_MIN_SIZE (LIBAVCODEC_VERSION_MAJOR < 62) #define FF_API_VDPAU_ALLOC_GET_SET (LIBAVCODEC_VERSION_MAJOR < 62) +#define FF_API_QUALITY_FACTOR (LIBAVCODEC_VERSION_MAJOR < 62) #endif /* AVCODEC_VERSION_MAJOR_H */ diff --git a/ThirdParty/ffmpeg/include/libavformat/avformat.h b/ThirdParty/ffmpeg/include/libavformat/avformat.h index de4039767..56c1c8028 100644 --- a/ThirdParty/ffmpeg/include/libavformat/avformat.h +++ b/ThirdParty/ffmpeg/include/libavformat/avformat.h @@ -713,6 +713,11 @@ typedef struct AVIndexEntry { * The video stream contains still images. */ #define AV_DISPOSITION_STILL_IMAGE (1 << 20) +/** + * The video stream contains multiple layers, e.g. stereoscopic views (cf. H.264 + * Annex G/H, or HEVC Annex F). + */ +#define AV_DISPOSITION_MULTILAYER (1 << 21) /** * @return The AV_DISPOSITION_* flag corresponding to disp or a negative error @@ -1079,11 +1084,37 @@ typedef struct AVStreamGroupTileGrid { int height; } 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. + */ +typedef struct AVStreamGroupLCEVC { + const AVClass *av_class; + + /** + * Index of the LCEVC data stream in AVStreamGroup. + */ + unsigned int lcevc_index; + /** + * Width of the final stream for presentation. + */ + int width; + /** + * Height of the final image for presentation. + */ + int height; +} AVStreamGroupLCEVC; + enum AVStreamGroupParamsType { AV_STREAM_GROUP_PARAMS_NONE, AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT, AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION, AV_STREAM_GROUP_PARAMS_TILE_GRID, + AV_STREAM_GROUP_PARAMS_LCEVC, }; struct AVIAMFAudioElement; @@ -1125,6 +1156,7 @@ typedef struct AVStreamGroup { struct AVIAMFAudioElement *iamf_audio_element; struct AVIAMFMixPresentation *iamf_mix_presentation; struct AVStreamGroupTileGrid *tile_grid; + struct AVStreamGroupLCEVC *lcevc; } params; /** @@ -1439,7 +1471,7 @@ typedef struct AVFormatContext { * * @note this is \e not used for determining the \ref AVInputFormat * "input format" - * @sa format_probesize + * @see format_probesize */ int64_t probesize; @@ -1667,6 +1699,8 @@ typedef struct AVFormatContext { * Skip duration calcuation in estimate_timings_from_pts. * - encoding: unused * - decoding: set by user + * + * @see duration_probesize */ int skip_estimate_duration_from_pts; @@ -1729,7 +1763,7 @@ typedef struct AVFormatContext { * * Demuxing only, set by the caller before avformat_open_input(). * - * @sa probesize + * @see probesize */ int format_probesize; @@ -1870,6 +1904,16 @@ typedef struct AVFormatContext { * @return 0 on success, a negative AVERROR code on failure */ int (*io_close2)(struct AVFormatContext *s, AVIOContext *pb); + + /** + * Maximum number of bytes read from input in order to determine stream durations + * when using estimate_timings_from_pts in avformat_find_stream_info(). + * Demuxing only, set by the caller before avformat_find_stream_info(). + * Can be set to 0 to let avformat choose using a heuristic. + * + * @see skip_estimate_duration_from_pts + */ + int64_t duration_probesize; } AVFormatContext; /** @@ -3030,6 +3074,7 @@ int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st, int avformat_queue_attached_pictures(AVFormatContext *s); +#if FF_API_INTERNAL_TIMING enum AVTimebaseSource { AVFMT_TBCF_AUTO = -1, AVFMT_TBCF_DECODER, @@ -3040,25 +3085,20 @@ enum AVTimebaseSource { }; /** - * Transfer internal timing information from one stream to another. - * - * This function is useful when doing stream copy. - * - * @param ofmt target output format for ost - * @param ost output stream which needs timings copy and adjustments - * @param ist reference input stream to copy timings from - * @param copy_tb define from where the stream codec timebase needs to be imported + * @deprecated do not call this function */ +attribute_deprecated int avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt, AVStream *ost, const AVStream *ist, enum AVTimebaseSource copy_tb); /** - * Get the internal codec timebase from a stream. - * - * @param st input stream to extract the timebase from + * @deprecated do not call this function */ +attribute_deprecated AVRational av_stream_get_codec_timebase(const AVStream *st); +#endif + /** * @} diff --git a/ThirdParty/ffmpeg/include/libavformat/version.h b/ThirdParty/ffmpeg/include/libavformat/version.h index a7c80dc56..70c554c19 100644 --- a/ThirdParty/ffmpeg/include/libavformat/version.h +++ b/ThirdParty/ffmpeg/include/libavformat/version.h @@ -31,7 +31,7 @@ #include "version_major.h" -#define LIBAVFORMAT_VERSION_MINOR 1 +#define LIBAVFORMAT_VERSION_MINOR 7 #define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ diff --git a/ThirdParty/ffmpeg/include/libavformat/version_major.h b/ThirdParty/ffmpeg/include/libavformat/version_major.h index 44ad23c6b..7a9b06703 100644 --- a/ThirdParty/ffmpeg/include/libavformat/version_major.h +++ b/ThirdParty/ffmpeg/include/libavformat/version_major.h @@ -47,6 +47,7 @@ #define FF_API_AVSTREAM_SIDE_DATA (LIBAVFORMAT_VERSION_MAJOR < 62) #define FF_API_GET_DUR_ESTIMATE_METHOD (LIBAVFORMAT_VERSION_MAJOR < 62) +#define FF_API_INTERNAL_TIMING (LIBAVFORMAT_VERSION_MAJOR < 62) #define FF_API_R_FRAME_RATE 1 diff --git a/ThirdParty/ffmpeg/include/libavutil/bswap.h b/ThirdParty/ffmpeg/include/libavutil/bswap.h index 4840ab433..f53e5768a 100644 --- a/ThirdParty/ffmpeg/include/libavutil/bswap.h +++ b/ThirdParty/ffmpeg/include/libavutil/bswap.h @@ -34,16 +34,10 @@ #include "config.h" -#if ARCH_AARCH64 -# include "aarch64/bswap.h" -#elif ARCH_ARM +#if ARCH_ARM # include "arm/bswap.h" -#elif ARCH_AVR32 -# include "avr32/bswap.h" #elif ARCH_RISCV # include "riscv/bswap.h" -#elif ARCH_SH4 -# include "sh4/bswap.h" #elif ARCH_X86 # include "x86/bswap.h" #endif diff --git a/ThirdParty/ffmpeg/include/libavutil/channel_layout.h b/ThirdParty/ffmpeg/include/libavutil/channel_layout.h index 8a078d160..3a96c2d9b 100644 --- a/ThirdParty/ffmpeg/include/libavutil/channel_layout.h +++ b/ThirdParty/ffmpeg/include/libavutil/channel_layout.h @@ -79,6 +79,10 @@ enum AVChannel { AV_CHAN_BOTTOM_FRONT_CENTER, AV_CHAN_BOTTOM_FRONT_LEFT, AV_CHAN_BOTTOM_FRONT_RIGHT, + AV_CHAN_SIDE_SURROUND_LEFT, ///< +90 degrees, Lss, SiL + AV_CHAN_SIDE_SURROUND_RIGHT, ///< -90 degrees, Rss, SiR + AV_CHAN_TOP_SURROUND_LEFT, ///< +110 degrees, Lvs, TpLS + AV_CHAN_TOP_SURROUND_RIGHT, ///< -110 degrees, Rvs, TpRS /** Channel is empty can be safely skipped. */ AV_CHAN_UNUSED = 0x200, @@ -195,6 +199,10 @@ enum AVChannelOrder { #define AV_CH_BOTTOM_FRONT_CENTER (1ULL << AV_CHAN_BOTTOM_FRONT_CENTER ) #define AV_CH_BOTTOM_FRONT_LEFT (1ULL << AV_CHAN_BOTTOM_FRONT_LEFT ) #define AV_CH_BOTTOM_FRONT_RIGHT (1ULL << AV_CHAN_BOTTOM_FRONT_RIGHT ) +#define AV_CH_SIDE_SURROUND_LEFT (1ULL << AV_CHAN_SIDE_SURROUND_LEFT ) +#define AV_CH_SIDE_SURROUND_RIGHT (1ULL << AV_CHAN_SIDE_SURROUND_RIGHT ) +#define AV_CH_TOP_SURROUND_LEFT (1ULL << AV_CHAN_TOP_SURROUND_LEFT ) +#define AV_CH_TOP_SURROUND_RIGHT (1ULL << AV_CHAN_TOP_SURROUND_RIGHT ) /** * @} @@ -679,6 +687,16 @@ int av_channel_layout_check(const AVChannelLayout *channel_layout); */ int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1); +/** + * Return the order if the layout is n-th order standard-order ambisonic. + * The presence of optional extra non-diegetic channels at the end is not taken + * into account. + * + * @param channel_layout input channel layout + * @return the order of the layout, a negative error code otherwise. + */ +int av_channel_layout_ambisonic_order(const AVChannelLayout *channel_layout); + /** * The conversion must be lossless. */ diff --git a/ThirdParty/ffmpeg/include/libavutil/common.h b/ThirdParty/ffmpeg/include/libavutil/common.h index 57c87f191..3b830daf3 100644 --- a/ThirdParty/ffmpeg/include/libavutil/common.h +++ b/ThirdParty/ffmpeg/include/libavutil/common.h @@ -42,12 +42,14 @@ #include "attributes.h" #include "error.h" #include "macros.h" -#include "mem.h" +#include "version.h" #ifdef HAVE_AV_CONFIG_H # include "config.h" # include "intmath.h" # include "internal.h" +#else +# include "mem.h" #endif /* HAVE_AV_CONFIG_H */ //rounded division & shift @@ -121,9 +123,6 @@ #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 @@ -148,6 +147,9 @@ #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 @@ -251,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; } /** @@ -263,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; @@ -277,21 +279,35 @@ 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 av_zero_extend_c(a, p); +} +#endif + /** * Add two signed 32-bit values with saturation. * diff --git a/ThirdParty/ffmpeg/include/libavutil/cpu.h b/ThirdParty/ffmpeg/include/libavutil/cpu.h index 8dff34188..ba6c234e0 100644 --- a/ThirdParty/ffmpeg/include/libavutil/cpu.h +++ b/ThirdParty/ffmpeg/include/libavutil/cpu.h @@ -22,6 +22,7 @@ #define AVUTIL_CPU_H #include +#include "version.h" #define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */ @@ -82,14 +83,21 @@ // 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. diff --git a/ThirdParty/ffmpeg/include/libavutil/dovi_meta.h b/ThirdParty/ffmpeg/include/libavutil/dovi_meta.h index 3d11e02bf..5e8a1e43d 100644 --- a/ThirdParty/ffmpeg/include/libavutil/dovi_meta.h +++ b/ThirdParty/ffmpeg/include/libavutil/dovi_meta.h @@ -29,7 +29,9 @@ #include #include + #include "rational.h" +#include "csp.h" /* * DOVI configuration @@ -44,6 +46,7 @@ * 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 @@ -58,8 +61,16 @@ typedef struct AVDOVIDecoderConfigurationRecord { 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. @@ -89,6 +100,8 @@ typedef struct AVDOVIRpuDataHeader { 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 { @@ -147,6 +160,7 @@ typedef struct AVDOVIDataMapping { uint32_t num_x_partitions; uint32_t num_y_partitions; AVDOVINLQParams nlq[3]; /* per component */ + uint16_t nlq_pivots[2]; } AVDOVIDataMapping; /** @@ -186,6 +200,132 @@ typedef struct AVDOVIColorMetadata { 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. @@ -202,6 +342,13 @@ typedef struct AVDOVIMetadata { 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 * @@ -222,6 +369,19 @@ 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. diff --git a/ThirdParty/ffmpeg/include/libavutil/error.h b/ThirdParty/ffmpeg/include/libavutil/error.h index 0d3269aa6..1efa86c4c 100644 --- a/ThirdParty/ffmpeg/include/libavutil/error.h +++ b/ThirdParty/ffmpeg/include/libavutil/error.h @@ -79,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/ThirdParty/ffmpeg/include/libavutil/executor.h b/ThirdParty/ffmpeg/include/libavutil/executor.h index c602bcb61..0eb21c10c 100644 --- a/ThirdParty/ffmpeg/include/libavutil/executor.h +++ b/ThirdParty/ffmpeg/include/libavutil/executor.h @@ -46,7 +46,7 @@ typedef struct AVTaskCallbacks { /** * Alloc executor * @param callbacks callback structure for executor - * @param thread_count worker thread number + * @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); diff --git a/ThirdParty/ffmpeg/include/libavutil/ffversion.h b/ThirdParty/ffmpeg/include/libavutil/ffversion.h index 296dc9117..48f04a6aa 100644 --- a/ThirdParty/ffmpeg/include/libavutil/ffversion.h +++ b/ThirdParty/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 "7.0" +#define FFMPEG_VERSION "7.1.1" #endif /* AVUTIL_FFVERSION_H */ diff --git a/ThirdParty/ffmpeg/include/libavutil/fifo.h b/ThirdParty/ffmpeg/include/libavutil/fifo.h index 048298214..f2206c35f 100644 --- a/ThirdParty/ffmpeg/include/libavutil/fifo.h +++ b/ThirdParty/ffmpeg/include/libavutil/fifo.h @@ -26,10 +26,6 @@ #define AVUTIL_FIFO_H #include -#include - -#include "attributes.h" -#include "version.h" /** * @defgroup lavu_fifo AVFifo diff --git a/ThirdParty/ffmpeg/include/libavutil/file.h b/ThirdParty/ffmpeg/include/libavutil/file.h index b5a762c28..fced17010 100644 --- a/ThirdParty/ffmpeg/include/libavutil/file.h +++ b/ThirdParty/ffmpeg/include/libavutil/file.h @@ -22,7 +22,6 @@ #include #include -#include "version.h" #include "attributes.h" /** diff --git a/ThirdParty/ffmpeg/include/libavutil/frame.h b/ThirdParty/ffmpeg/include/libavutil/frame.h index 8aa05ec12..f7806566d 100644 --- a/ThirdParty/ffmpeg/include/libavutil/frame.h +++ b/ThirdParty/ffmpeg/include/libavutil/frame.h @@ -228,6 +228,21 @@ enum AVFrameSideDataType { * 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 { @@ -255,6 +270,37 @@ typedef struct AVFrameSideData { 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. * @@ -338,8 +384,7 @@ typedef struct AVRegionOfInterest { * 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 @@ -992,6 +1037,12 @@ 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. @@ -1003,7 +1054,15 @@ const char *av_frame_side_data_name(enum AVFrameSideDataType type); */ 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. @@ -1016,15 +1075,43 @@ void av_frame_side_data_free(AVFrameSideData ***sd, int *nb_sd); * @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. In case of - * AV_FRAME_SIDE_DATA_FLAG_UNIQUE being set, entries of matching - * AVFrameSideDataType will be removed before the addition is - * attempted. + * @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. @@ -1037,10 +1124,12 @@ AVFrameSideData *av_frame_side_data_new(AVFrameSideData ***sd, int *nb_sd, * 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. In case of - * AV_FRAME_SIDE_DATA_FLAG_UNIQUE being set, entries of matching - * AVFrameSideDataType will be removed before the addition is - * attempted. + * @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); @@ -1074,6 +1163,11 @@ const AVFrameSideData *av_frame_side_data_get(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/ThirdParty/ffmpeg/include/libavutil/hwcontext_d3d12va.h b/ThirdParty/ffmpeg/include/libavutil/hwcontext_d3d12va.h index ff06e6f2e..212a6a614 100644 --- a/ThirdParty/ffmpeg/include/libavutil/hwcontext_d3d12va.h +++ b/ThirdParty/ffmpeg/include/libavutil/hwcontext_d3d12va.h @@ -129,6 +129,14 @@ typedef struct AVD3D12VAFramesContext { * 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/ThirdParty/ffmpeg/include/libavutil/hwcontext_qsv.h b/ThirdParty/ffmpeg/include/libavutil/hwcontext_qsv.h index e2dba8ad8..35530e4e9 100644 --- a/ThirdParty/ffmpeg/include/libavutil/hwcontext_qsv.h +++ b/ThirdParty/ffmpeg/include/libavutil/hwcontext_qsv.h @@ -25,8 +25,8 @@ * @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. */ /** @@ -51,13 +51,36 @@ typedef struct 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/ThirdParty/ffmpeg/include/libavutil/hwcontext_videotoolbox.h b/ThirdParty/ffmpeg/include/libavutil/hwcontext_videotoolbox.h index 600e9f2c8..d35cfbb6c 100644 --- a/ThirdParty/ffmpeg/include/libavutil/hwcontext_videotoolbox.h +++ b/ThirdParty/ffmpeg/include/libavutil/hwcontext_videotoolbox.h @@ -90,8 +90,15 @@ CFStringRef av_map_videotoolbox_color_primaries_from_av(enum AVColorPrimaries pr CFStringRef av_map_videotoolbox_color_trc_from_av(enum AVColorTransferCharacteristic trc); /** - * Update a CVPixelBufferRef's metadata to based on an AVFrame. - * Returns 0 if no known equivalent was found. + * 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); diff --git a/ThirdParty/ffmpeg/include/libavutil/hwcontext_vulkan.h b/ThirdParty/ffmpeg/include/libavutil/hwcontext_vulkan.h index 895794c86..2688a4757 100644 --- a/ThirdParty/ffmpeg/include/libavutil/hwcontext_vulkan.h +++ b/ThirdParty/ffmpeg/include/libavutil/hwcontext_vulkan.h @@ -26,9 +26,24 @@ #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. @@ -48,9 +63,8 @@ typedef struct AVVulkanDeviceContext { const VkAllocationCallbacks *alloc; /** - * Pointer to the instance-provided vkGetInstanceProcAddr loading function. - * If NULL, will pick either libvulkan or libvolk, depending on libavutil's - * compilation settings, and set this field. + * Pointer to a vkGetInstanceProcAddr loading function. + * If unset, will dynamically load and use libvulkan. */ PFN_vkGetInstanceProcAddr get_proc_addr; @@ -98,6 +112,7 @@ typedef struct AVVulkanDeviceContext { 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. @@ -105,21 +120,27 @@ typedef struct AVVulkanDeviceContext { * 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; /** @@ -127,7 +148,9 @@ typedef struct AVVulkanDeviceContext { * 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; /** @@ -135,8 +158,11 @@ typedef struct AVVulkanDeviceContext { * 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 @@ -150,6 +176,17 @@ typedef struct AVVulkanDeviceContext { * 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; /** diff --git a/ThirdParty/ffmpeg/include/libavutil/iamf.h b/ThirdParty/ffmpeg/include/libavutil/iamf.h index 93785d9fe..1fa73893c 100644 --- a/ThirdParty/ffmpeg/include/libavutil/iamf.h +++ b/ThirdParty/ffmpeg/include/libavutil/iamf.h @@ -37,20 +37,29 @@ #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 * @{ */ @@ -673,6 +682,7 @@ AVIAMFSubmixLayout *av_iamf_submix_add_layout(AVIAMFSubmix *submix); * upon return, *mix_presentation will be set to NULL. */ void av_iamf_mix_presentation_free(AVIAMFMixPresentation **mix_presentation); + /** * @} */ diff --git a/ThirdParty/ffmpeg/include/libavutil/intreadwrite.h b/ThirdParty/ffmpeg/include/libavutil/intreadwrite.h index d0a5773b5..ffd15a150 100644 --- a/ThirdParty/ffmpeg/include/libavutil/intreadwrite.h +++ b/ThirdParty/ffmpeg/include/libavutil/intreadwrite.h @@ -64,10 +64,8 @@ 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 @@ -543,9 +541,41 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias; #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 @@ -555,6 +585,13 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias; # 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. diff --git a/ThirdParty/ffmpeg/include/libavutil/mastering_display_metadata.h b/ThirdParty/ffmpeg/include/libavutil/mastering_display_metadata.h index c23b07c3c..52fcef9e3 100644 --- a/ThirdParty/ffmpeg/include/libavutil/mastering_display_metadata.h +++ b/ThirdParty/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/ThirdParty/ffmpeg/include/libavutil/opt.h b/ThirdParty/ffmpeg/include/libavutil/opt.h index e6013662f..be189f765 100644 --- a/ThirdParty/ffmpeg/include/libavutil/opt.h +++ b/ThirdParty/ffmpeg/include/libavutil/opt.h @@ -53,6 +53,16 @@ * 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. * @@ -230,26 +240,99 @@ * 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{ + /** + * 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, + /** + * 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 @@ -535,6 +618,12 @@ const AVClass *av_opt_child_class_iterate(const AVClass *parent, void **iter); */ #define AV_OPT_ALLOW_NULL (1 << 2) +/** + * May be used with av_opt_set_array() to signal that new elements should + * replace the existing ones in the indicated range. + */ +#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. @@ -786,6 +875,10 @@ 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); +/** + * @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 @@ -809,6 +902,56 @@ 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); + /** * @} * @} @@ -847,12 +990,56 @@ 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); +/** + * @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); + +/** + * 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. + */ +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); /** * @} */ @@ -873,6 +1060,7 @@ int av_opt_get_dict_val(void *obj, const char *name, int search_flags, AVDiction */ 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); @@ -929,6 +1117,7 @@ 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. diff --git a/ThirdParty/ffmpeg/include/libavutil/pixfmt.h b/ThirdParty/ffmpeg/include/libavutil/pixfmt.h index 4aa20e4e5..a7f50e169 100644 --- a/ThirdParty/ffmpeg/include/libavutil/pixfmt.h +++ b/ThirdParty/ffmpeg/include/libavutil/pixfmt.h @@ -623,6 +623,9 @@ 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 }; diff --git a/ThirdParty/ffmpeg/include/libavutil/spherical.h b/ThirdParty/ffmpeg/include/libavutil/spherical.h index 828ac836d..2e90f7752 100644 --- a/ThirdParty/ffmpeg/include/libavutil/spherical.h +++ b/ThirdParty/ffmpeg/include/libavutil/spherical.h @@ -66,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, }; /** diff --git a/ThirdParty/ffmpeg/include/libavutil/stereo3d.h b/ThirdParty/ffmpeg/include/libavutil/stereo3d.h index 3aab959b7..c0a4ab3f2 100644 --- a/ThirdParty/ffmpeg/include/libavutil/stereo3d.h +++ b/ThirdParty/ffmpeg/include/libavutil/stereo3d.h @@ -136,6 +136,11 @@ enum AVStereo3DType { * @endcode */ AV_STEREO3D_COLUMNS, + + /** + * Video is stereoscopic but the packing is unspecified. + */ + AV_STEREO3D_UNSPEC, }; /** @@ -156,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, }; /** @@ -185,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; /** @@ -195,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. * @@ -222,6 +282,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/ThirdParty/ffmpeg/include/libavutil/version.h b/ThirdParty/ffmpeg/include/libavutil/version.h index 0a3f5dd0c..753f85b91 100644 --- a/ThirdParty/ffmpeg/include/libavutil/version.h +++ b/ThirdParty/ffmpeg/include/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 59 -#define LIBAVUTIL_VERSION_MINOR 8 +#define LIBAVUTIL_VERSION_MINOR 39 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ @@ -112,6 +112,9 @@ #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/ThirdParty/ffmpeg/include/libswresample/swresample.h b/ThirdParty/ffmpeg/include/libswresample/swresample.h index 217e5461b..0e1929b3e 100644 --- a/ThirdParty/ffmpeg/include/libswresample/swresample.h +++ b/ThirdParty/ffmpeg/include/libswresample/swresample.h @@ -49,8 +49,8 @@ * 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); diff --git a/ThirdParty/ffmpeg/include/libswresample/version.h b/ThirdParty/ffmpeg/include/libswresample/version.h index 9c223e142..d1795b554 100644 --- a/ThirdParty/ffmpeg/include/libswresample/version.h +++ b/ThirdParty/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/ThirdParty/ffmpeg/patches/0006-hls-live-id3-metadata.patch b/ThirdParty/ffmpeg/patches/0006-hls-live-id3-metadata.patch new file mode 100644 index 000000000..3f12b0880 --- /dev/null +++ b/ThirdParty/ffmpeg/patches/0006-hls-live-id3-metadata.patch @@ -0,0 +1,27 @@ +diff -ur ffmpeg-7.1.1.orig/libavformat/hls.c ffmpeg-7.1.1/libavformat/hls.c +--- ffmpeg-7.1.1.orig/libavformat/hls.c 2025-03-02 13:08:21.000000000 -0800 ++++ ffmpeg-7.1.1/libavformat/hls.c 2025-03-24 04:38:04.672676124 -0700 +@@ -153,7 +153,6 @@ + unsigned int id3_buf_size; + AVDictionary *id3_initial; /* data from first id3 tag */ + int id3_found; /* ID3 tag found at some point */ +- int id3_changed; /* ID3 tag data has changed at some point */ + ID3v2ExtraMeta *id3_deferred_extra; /* stored here until subdemuxer is opened */ + + HLSAudioSetupInfo audio_setup_info; +@@ -1218,9 +1217,12 @@ + pls->id3_initial = metadata; + + } else { +- if (!pls->id3_changed && id3_has_changed_values(pls, metadata, apic)) { +- avpriv_report_missing_feature(pls->parent, "Changing ID3 metadata in HLS audio elementary stream"); +- pls->id3_changed = 1; ++ if (id3_has_changed_values(pls, metadata, apic)) { ++ AVDictionary *old = pls->id3_initial; ++ av_dict_copy(&pls->ctx->metadata, metadata, 0); ++ pls->id3_initial = metadata; ++ metadata = old; ++ pls->ctx->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED; + } + av_dict_free(&metadata); + } diff --git a/ThirdParty/libraries.tar.xz b/ThirdParty/libraries.tar.xz index a7efb59a6..8376b0b45 100644 Binary files a/ThirdParty/libraries.tar.xz and b/ThirdParty/libraries.tar.xz differ