[FFmpeg-devel] [PATCH v7 09/14] avcodec: add frame side data array to AVCodecContext
James Almer
jamrial at gmail.com
Fri Mar 1 18:10:53 EET 2024
On 3/1/2024 1:03 PM, James Almer wrote:
> On 2/29/2024 1:42 PM, Jan Ekström wrote:
>> This allows configuring an encoder by using AVFrameSideData.
>
> Maybe mention that in the doxy for the field. Explain that it needs to
> be set before avcodec_open2() and is used to initialize an encoder.
And that it must be allocated with av_frame_side_data_new(),
av_frame_side_data_from_sd() or av_frame_side_data_from_buf().
>
>> ---
>> libavcodec/avcodec.h | 8 ++++++++
>> libavcodec/options.c | 2 ++
>> 2 files changed, 10 insertions(+)
>>
>> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
>> index 43859251cc..411f4caad3 100644
>> --- a/libavcodec/avcodec.h
>> +++ b/libavcodec/avcodec.h
>> @@ -2120,6 +2120,14 @@ typedef struct AVCodecContext {
>> * an error.
>> */
>> int64_t frame_num;
>> +
>> + /**
>> + * Set containing static side data, such as HDR10 CLL / MDCV
>> structures.
>> + * - encoding: set by user
>> + * - decoding: unused
>> + */
>> + AVFrameSideData **frame_side_data;
>> + int nb_frame_side_data;
>> } AVCodecContext;
>> /**
>> diff --git a/libavcodec/options.c b/libavcodec/options.c
>> index 928e430ce9..7e39b49b7e 100644
>> --- a/libavcodec/options.c
>> +++ b/libavcodec/options.c
>> @@ -181,6 +181,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->frame_side_data, &avctx->nb_frame_side_data);
>> av_freep(pavctx);
>> }
More information about the ffmpeg-devel
mailing list