diff mbox series

[FFmpeg-devel,v8,09/14] avcodec: add frame side data array to AVCodecContext

Message ID 20240311205844.3569895-10-jeebjp@gmail.com
State New
Headers show
Series [FFmpeg-devel,v8,01/14] avutil/frame: split side data list wiping out to non-AVFrame function | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Jan Ekström March 11, 2024, 8:58 p.m. UTC
This allows configuring an encoder by using AVFrameSideData.
---
 libavcodec/avcodec.h | 8 ++++++++
 libavcodec/options.c | 2 ++
 2 files changed, 10 insertions(+)

Comments

James Almer March 12, 2024, 9:26 p.m. UTC | #1
On 3/11/2024 5:58 PM, Jan Ekström wrote:
> This allows configuring an encoder by using AVFrameSideData.
> ---
>   libavcodec/avcodec.h | 8 ++++++++
>   libavcodec/options.c | 2 ++
>   2 files changed, 10 insertions(+)
> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 21fc74707f..432a3fd153 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -2062,6 +2062,14 @@ typedef struct AVCodecContext {
>        * Number of entries in side_data_prefer_packet.
>        */
>       unsigned nb_side_data_prefer_packet;
> +
> +    /**
> +     * Set containing static side data, such as HDR10 CLL / MDCV structures.
> +     * - encoding: set by user
> +     * - decoding: unused

This is not taking into account the requests from the last review round.

> +     */
> +    AVFrameSideData  **frame_side_data;
> +    int             nb_frame_side_data;
>   } AVCodecContext;
>   
>   /**
> diff --git a/libavcodec/options.c b/libavcodec/options.c
> index dcc67e497a..29b961411e 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->frame_side_data, &avctx->nb_frame_side_data);
>   
>       av_freep(pavctx);
>   }
diff mbox series

Patch

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 21fc74707f..432a3fd153 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2062,6 +2062,14 @@  typedef struct AVCodecContext {
      * Number of entries in side_data_prefer_packet.
      */
     unsigned nb_side_data_prefer_packet;
+
+    /**
+     * 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 dcc67e497a..29b961411e 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->frame_side_data, &avctx->nb_frame_side_data);
 
     av_freep(pavctx);
 }