[FFmpeg-devel] [PATCH v2 5/7] avcodec/cbs_sei: refactor to use avutil/uuid

Mark Thompson sw at jkqxz.net
Sat Apr 30 20:31:21 EEST 2022


On 24/04/2022 11:14, Zane van Iperen wrote:
> From: Pierre-Anthony Lemieux <pal at palemieux.com>
> 
> ---
>   libavcodec/cbs_sei.h           | 3 ++-
>   libavcodec/vaapi_encode_h264.c | 8 ++++----
>   2 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/libavcodec/cbs_sei.h b/libavcodec/cbs_sei.h
> index c7a7a95be0..67c6e6cbbd 100644
> --- a/libavcodec/cbs_sei.h
> +++ b/libavcodec/cbs_sei.h
> @@ -23,6 +23,7 @@
>   #include <stdint.h>
>   
>   #include "libavutil/buffer.h"
> +#include "libavutil/uuid.h"
>   
>   #include "cbs.h"
>   #include "sei.h"
> @@ -41,7 +42,7 @@ typedef struct SEIRawUserDataRegistered {
>   } SEIRawUserDataRegistered;
>   
>   typedef struct SEIRawUserDataUnregistered {
> -    uint8_t      uuid_iso_iec_11578[16];
> +    AVUUID      uuid_iso_iec_11578;
>       uint8_t     *data;
>       AVBufferRef *data_ref;
>       size_t       data_length;

This feels like a step backwards?  The syntax template files are explicitly relying on this being uint8_t[16], so giving it a different name is confusing.

> diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
> index 7a6b54ab6f..b3105d6ccc 100644
> --- a/libavcodec/vaapi_encode_h264.c
> +++ b/libavcodec/vaapi_encode_h264.c
> @@ -25,6 +25,7 @@
>   #include "libavutil/common.h"
>   #include "libavutil/internal.h"
>   #include "libavutil/opt.h"
> +#include "libavutil/uuid.h"
>   
>   #include "avcodec.h"
>   #include "cbs.h"
> @@ -43,7 +44,7 @@ enum {
>   };
>   
>   // Random (version 4) ISO 11578 UUID.
> -static const uint8_t vaapi_encode_h264_sei_identifier_uuid[16] = {
> +static const AVUUID vaapi_encode_h264_sei_identifier_uuid = {
>       0x59, 0x94, 0x8b, 0x28, 0x11, 0xec, 0x45, 0xaf,
>       0x96, 0x75, 0x19, 0xd4, 0x1f, 0xea, 0xa9, 0x4d,
>   };
> @@ -1089,9 +1090,8 @@ static av_cold int vaapi_encode_h264_configure(AVCodecContext *avctx)
>           const char *driver;
>           int len;
>   
> -        memcpy(priv->sei_identifier.uuid_iso_iec_11578,
> -               vaapi_encode_h264_sei_identifier_uuid,
> -               sizeof(priv->sei_identifier.uuid_iso_iec_11578));
> +        av_uuid_copy(priv->sei_identifier.uuid_iso_iec_11578,
> +                     vaapi_encode_h264_sei_identifier_uuid);
>   
>           driver = vaQueryVendorString(ctx->hwctx->display);
>           if (!driver)

This is fair.

- Mark


More information about the ffmpeg-devel mailing list