[FFmpeg-devel] [PATCH v2 3/7] avcodec/avframe: add new side data types for Bar Data

Anton Khirnov anton at khirnov.net
Sat Jul 1 11:11:53 EEST 2023


Quoting Devin Heitmueller (2023-06-30 23:38:51)
> Add new side data types for both AVPacket and AVFrame to support
> "bar data" as defined in SMPTE 2016-1, ATSC A/53, and SCTE 128-1.
> 
> Signed-off-by: Devin Heitmueller <dheitmueller at ltnglobal.com>
> ---
>  libavcodec/decode.c |  1 +
>  libavcodec/defs.h   | 12 ++++++++++++
>  libavcodec/packet.h |  6 ++++++
>  libavutil/frame.h   |  6 ++++++
>  4 files changed, 25 insertions(+)
> 
> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> index 6ee2c85..5aafce7 100644
> --- a/libavcodec/decode.c
> +++ b/libavcodec/decode.c
> @@ -1332,6 +1332,7 @@ int ff_decode_frame_props_from_pkt(const AVCodecContext *avctx,
>          { AV_PKT_DATA_CONTENT_LIGHT_LEVEL,        AV_FRAME_DATA_CONTENT_LIGHT_LEVEL },
>          { AV_PKT_DATA_A53_CC,                     AV_FRAME_DATA_A53_CC },
>          { AV_PKT_DATA_AFD,                        AV_FRAME_DATA_AFD },
> +        { AV_PKT_DATA_BARDATA,                    AV_FRAME_DATA_BARDATA },
>          { AV_PKT_DATA_ICC_PROFILE,                AV_FRAME_DATA_ICC_PROFILE },
>          { AV_PKT_DATA_S12M_TIMECODE,              AV_FRAME_DATA_S12M_TIMECODE },
>          { AV_PKT_DATA_DYNAMIC_HDR10_PLUS,         AV_FRAME_DATA_DYNAMIC_HDR_PLUS },
> diff --git a/libavcodec/defs.h b/libavcodec/defs.h
> index fbe3254..deadfe7 100644
> --- a/libavcodec/defs.h
> +++ b/libavcodec/defs.h
> @@ -119,6 +119,18 @@ typedef struct AVPanScan {
>  } AVPanScan;
>  
>  /**
> + * Bar data - used by side data for avcodec and avframe.  Defines the location
> + * of horizontal or vertical black bars (i.e. letterbox/pillar bars)
> + */
> +typedef struct AVBarData {
> +    int top_bottom; /* 0=top/bottom 1=left/right */
> +    int top;
> +    int left;
> +    int bottom;
> +    int right;

Am I understanding correctly that half of these are never used for a
given AVBarData instance? Seems wasteful. Could make it a generic
bound0, bound1 or a union instead.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list