Skip to content

Commit

Permalink
avcodec: add frame side data array to AVCodecContext
Browse files Browse the repository at this point in the history
This allows configuring an encoder by using AVFrameSideData.
  • Loading branch information
jeeb committed Mar 17, 2024
1 parent f4224b0 commit 2cba6c0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions libavcodec/avcodec.h
Original file line number Diff line number Diff line change
Expand Up @@ -2062,6 +2062,18 @@ 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.
* - decoding: unused
*/
AVFrameSideData **encoder_side_data;
int nb_encoder_side_data;
} AVCodecContext;

/**
Expand Down
2 changes: 2 additions & 0 deletions libavcodec/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -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->encoder_side_data, &avctx->nb_encoder_side_data);

av_freep(pavctx);
}
Expand Down

0 comments on commit 2cba6c0

Please sign in to comment.