This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit e1ce2624383b741c1ac24a4d529d43fe52b48a96 Author: Romain Beauxis <[email protected]> AuthorDate: Thu Oct 15 15:30:11 2026 +0200 Commit: Romain Beauxis <[email protected]> CommitDate: Fri Oct 23 14:04:24 2026 +0000 avcodec/packet_internal: add a handle for each side data type Add a list that gives each side data type a short handle made of lower case letters, digits and underscores, so that a filter can let its user name a type in an option. The side_data_prefer_packet option of decoders now takes its constants from this list, which gives the list the names that option has already released. The option thus accepts every type, with the flags of the option itself rather than audio only. A decoder warns about a type that has no frame side data counterpart, as it ignores it. Each handle is written out rather than derived from the name that av_packet_side_data_name() returns, as that one is meant for people and may be reworded. --- libavcodec/decode.c | 8 +++++++ libavcodec/options_table.h | 15 +++++------- libavcodec/packet_internal.h | 55 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 9 deletions(-) diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 6584c5b5ca..b378715932 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -2118,6 +2118,7 @@ av_cold int ff_decode_preinit(AVCodecContext *avctx) else { for (unsigned i = 0; i < avctx->nb_side_data_prefer_packet; i++) { int val = avctx->side_data_prefer_packet[i]; + int mapped = 0; if (val < 0 || val >= AV_PKT_DATA_NB) { av_log(avctx, AV_LOG_ERROR, "Invalid side data type: %d\n", val); @@ -2126,6 +2127,7 @@ av_cold int ff_decode_preinit(AVCodecContext *avctx) for (unsigned j = 0; ff_sd_global_map[j].packet < AV_PKT_DATA_NB; j++) { if (ff_sd_global_map[j].packet == val) { + mapped = 1; val = ff_sd_global_map[j].frame; // this code will need to be changed when we have more than @@ -2138,6 +2140,12 @@ av_cold int ff_decode_preinit(AVCodecContext *avctx) dc->side_data_pref_mask |= 1ULL << val; } } + + if (!mapped) + av_log(avctx, AV_LOG_WARNING, + "Side data type %s has no frame side data counterpart, " + "ignoring it in side_data_prefer_packet\n", + av_packet_side_data_name(val)); } } diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index 83f362a556..862b4505f4 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -31,6 +31,7 @@ #include "libavutil/opt.h" #include "avcodec.h" #include "avcodec_internal.h" +#include "packet_internal.h" #include "version_major.h" #define FFOFFSET(x) offsetof(FFCodecContext,x) @@ -46,6 +47,9 @@ #define AR AV_OPT_TYPE_FLAG_ARRAY +#define SIDE_DATA_PKT_CONST(pkt_type, handle) \ + { handle, .default_val.i64 = AV_PKT_DATA_ ## pkt_type, .type = AV_OPT_TYPE_CONST, .flags = V|A|S|D, .unit = "side_data_pkt" }, + #define AV_CODEC_DEFAULT_BITRATE 200*1000 static const AVOption avcodec_options[] = { @@ -413,15 +417,7 @@ static const AVOption avcodec_options[] = { {"discard_damaged_percentage", "Percentage of damaged samples to discard a frame", OFFSET(discard_damaged_percentage), AV_OPT_TYPE_INT, {.i64 = 95 }, 0, 100, V|D }, {"side_data_prefer_packet", "Comma-separated list of side data types for which user-supplied (container) data is preferred over coded bytestream", OFFSET(side_data_prefer_packet), AV_OPT_TYPE_INT | AR, .min = -1, .max = INT_MAX, .flags = V|A|S|D, .unit = "side_data_pkt" }, - {"replaygain", .default_val.i64 = AV_PKT_DATA_REPLAYGAIN, .type = AV_OPT_TYPE_CONST, .flags = A|D, .unit = "side_data_pkt" }, - {"displaymatrix", .default_val.i64 = AV_PKT_DATA_DISPLAYMATRIX, .type = AV_OPT_TYPE_CONST, .flags = A|D, .unit = "side_data_pkt" }, - {"spherical", .default_val.i64 = AV_PKT_DATA_SPHERICAL, .type = AV_OPT_TYPE_CONST, .flags = A|D, .unit = "side_data_pkt" }, - {"stereo3d", .default_val.i64 = AV_PKT_DATA_STEREO3D, .type = AV_OPT_TYPE_CONST, .flags = A|D, .unit = "side_data_pkt" }, - {"audio_service_type", .default_val.i64 = AV_PKT_DATA_AUDIO_SERVICE_TYPE, .type = AV_OPT_TYPE_CONST, .flags = A|D, .unit = "side_data_pkt" }, - {"mastering_display_metadata", .default_val.i64 = AV_PKT_DATA_MASTERING_DISPLAY_METADATA, .type = AV_OPT_TYPE_CONST, .flags = A|D, .unit = "side_data_pkt" }, - {"content_light_level", .default_val.i64 = AV_PKT_DATA_CONTENT_LIGHT_LEVEL, .type = AV_OPT_TYPE_CONST, .flags = A|D, .unit = "side_data_pkt" }, - {"icc_profile", .default_val.i64 = AV_PKT_DATA_ICC_PROFILE, .type = AV_OPT_TYPE_CONST, .flags = A|D, .unit = "side_data_pkt" }, - {"exif", .default_val.i64 = AV_PKT_DATA_EXIF, .type = AV_OPT_TYPE_CONST, .flags = A|D, .unit = "side_data_pkt" }, + FF_PACKET_SIDE_DATA_HANDLES(SIDE_DATA_PKT_CONST) // FFCodecContext options {"lcevc-dec-params", "Configure liblcevc-dec using a :-separated list of key=value parameters", FFOFFSET(lcevc_params), AV_OPT_TYPE_DICT, { 0 }, 0, 0, V|D }, @@ -433,6 +429,7 @@ static const AVOption avcodec_options[] = { #undef S #undef E #undef D +#undef SIDE_DATA_PKT_CONST #undef CC #undef DEFAULT #undef OFFSET diff --git a/libavcodec/packet_internal.h b/libavcodec/packet_internal.h index dbaf744ee9..ba4efbb14d 100644 --- a/libavcodec/packet_internal.h +++ b/libavcodec/packet_internal.h @@ -27,4 +27,59 @@ int ff_side_data_set_prft(AVPacket *pkt, int64_t timestamp); +/** + * The handle of each side data type: a short, stable name made of lower case + * letters, digits and underscores, for use where a name has to be typed, such + * as in the options of a filter. HANDLE(type, handle) is called with the type + * without its AV_PKT_DATA_ prefix. + * + * Every type below AV_PKT_DATA_NB has one, which the packet_side_data_handle + * test checks. A handle that has been released must not change. + */ +#define FF_PACKET_SIDE_DATA_HANDLES(HANDLE) \ + HANDLE(PALETTE, "palette") \ + HANDLE(NEW_EXTRADATA, "new_extradata") \ + HANDLE(PARAM_CHANGE, "param_change") \ + HANDLE(H263_MB_INFO, "h263_mb_info") \ + HANDLE(REPLAYGAIN, "replaygain") \ + HANDLE(DISPLAYMATRIX, "displaymatrix") \ + HANDLE(STEREO3D, "stereo3d") \ + HANDLE(AUDIO_SERVICE_TYPE, "audio_service_type") \ + HANDLE(QUALITY_STATS, "quality_stats") \ + HANDLE(FALLBACK_TRACK, "fallback_track") \ + HANDLE(CPB_PROPERTIES, "cpb_properties") \ + HANDLE(SKIP_SAMPLES, "skip_samples") \ + HANDLE(JP_DUALMONO, "jp_dualmono") \ + HANDLE(STRINGS_METADATA, "strings_metadata") \ + HANDLE(SUBTITLE_POSITION, "subtitle_position") \ + HANDLE(MATROSKA_BLOCKADDITIONAL, "matroska_blockadditional") \ + HANDLE(WEBVTT_IDENTIFIER, "webvtt_identifier") \ + HANDLE(WEBVTT_SETTINGS, "webvtt_settings") \ + HANDLE(METADATA_UPDATE, "metadata_update") \ + HANDLE(MPEGTS_STREAM_ID, "mpegts_stream_id") \ + HANDLE(MASTERING_DISPLAY_METADATA, "mastering_display_metadata") \ + HANDLE(CONTENT_LIGHT_LEVEL, "content_light_level") \ + HANDLE(SPHERICAL, "spherical") \ + HANDLE(A53_CC, "a53_cc") \ + HANDLE(ENCRYPTION_INIT_INFO, "encryption_init_info") \ + HANDLE(ENCRYPTION_INFO, "encryption_info") \ + HANDLE(AFD, "afd") \ + HANDLE(PRFT, "prft") \ + HANDLE(ICC_PROFILE, "icc_profile") \ + HANDLE(DOVI_CONF, "dovi_conf") \ + HANDLE(S12M_TIMECODE, "s12m_timecode") \ + HANDLE(DYNAMIC_HDR10_PLUS, "hdr10_plus") \ + HANDLE(DYNAMIC_HDR_SMPTE_2094_APP5, "hdr_smpte_2094_app5") \ + HANDLE(AMBIENT_VIEWING_ENVIRONMENT, "ambient_viewing_environment") \ + HANDLE(IAMF_MIX_GAIN_PARAM, "iamf_mix_gain_param") \ + HANDLE(IAMF_DEMIXING_INFO_PARAM, "iamf_demixing_info_param") \ + HANDLE(IAMF_RECON_GAIN_INFO_PARAM, "iamf_recon_gain_info_param") \ + HANDLE(FRAME_CROPPING, "frame_cropping") \ + HANDLE(LCEVC, "lcevc") \ + HANDLE(3D_REFERENCE_DISPLAYS, "3d_reference_displays") \ + HANDLE(RTCP_SR, "rtcp_sr") \ + HANDLE(EXIF, "exif") \ + HANDLE(HEVC_CONF, "hevc_conf") \ + HANDLE(GAIN_MAP_PARAMS, "gain_map_params") + #endif // AVCODEC_PACKET_INTERNAL_H -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
