From 0d36844ddf90bcd8ca4ba7625918d384a5d808ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Ekstr=C3=B6m?= Date: Thu, 3 Nov 2022 22:04:50 +0200 Subject: [PATCH] avcodec: add frame side data array to AVCodecContext This allows configuring an encoder by using AVFrameSideData. --- doc/APIchanges | 3 +++ libavcodec/avcodec.h | 13 +++++++++++++ libavcodec/options.c | 2 ++ libavcodec/version.h | 4 ++-- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 4f906432d5..a025f1df14 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07 API changes, most recent first: +2024-03-xx - xxxxxxxxxx - lavc 61.2.100 - avcodec.h + Add AVCodecContext.[nb_]decoded_side_data. + 2024-03-xx - xxxxxxxxxx - lavu 59.3.100 - frame.h Add av_frame_side_data_free(), av_frame_side_data_new(), av_frame_side_data_clone(), av_frame_side_data_get() as well diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 554501aa44..83dc487251 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2062,6 +2062,19 @@ typedef struct AVCodecContext { * Number of entries in side_data_prefer_packet. */ unsigned nb_side_data_prefer_packet; + + /** + * Array containing static side data, such as HDR10 CLL / MDCV structures. + * Side data entries should be allocated by usage of helpers defined in + * libavutil/frame.h. + * + * - encoding: may be set by user before calling avcodec_open2() for + * encoder configuration. Afterwards owned and freed by the + * encoder. + * - decoding: unused + */ + AVFrameSideData **decoded_side_data; + int nb_decoded_side_data; } AVCodecContext; /** diff --git a/libavcodec/options.c b/libavcodec/options.c index dcc67e497a..5169f2e476 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -176,6 +176,8 @@ void avcodec_free_context(AVCodecContext **pavctx) av_freep(&avctx->inter_matrix); av_freep(&avctx->rc_override); av_channel_layout_uninit(&avctx->ch_layout); + av_frame_side_data_free( + &avctx->decoded_side_data, &avctx->nb_decoded_side_data); av_freep(pavctx); } diff --git a/libavcodec/version.h b/libavcodec/version.h index b4616ccc27..0550d7b0d8 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,8 +29,8 @@ #include "version_major.h" -#define LIBAVCODEC_VERSION_MINOR 1 -#define LIBAVCODEC_VERSION_MICRO 101 +#define LIBAVCODEC_VERSION_MINOR 2 +#define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \