diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
index 1eb2cca4ed..e39ba05b3b 100644
--- a/fftools/ffmpeg_enc.c
+++ b/fftools/ffmpeg_enc.c
@@ -247,10 +247,7 @@ int enc_open(void *opaque, const AVFrame *frame)
 
         ret = avcodec_configure_side_data(
             enc_ctx,
-            &(const AVFrameSideDataSet){
-                .sd    = frame->side_data,
-                .nb_sd = frame->nb_side_data
-            },
+            (const AVFrameSideData **)frame->side_data, frame->nb_side_data,
             AV_FRAME_SIDE_DATA_SET_FLAG_NO_DUPLICATES);
         if (ret < 0) {
             av_log(NULL, AV_LOG_ERROR, "failed to configure video encoder: %s!\n",
diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index 923fac2c26..d3ec41b280 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -722,26 +722,28 @@ int attribute_align_arg avcodec_receive_frame(AVCodecContext *avctx, AVFrame *fr
 }
 
 int avcodec_configure_side_data(AVCodecContext *avctx,
-                                const AVFrameSideDataSet *set,
+                                const AVFrameSideData **sd, const int nb_sd,
                                 unsigned int flags)
 {
     if (!avctx)
         return AVERROR(EINVAL);
 
-    if (!set) {
-        av_frame_side_data_set_uninit(&avctx->frame_sd_set);
+    if (!sd) {
+        av_frame_side_data_free(
+            &avctx->frame_side_data, &avctx->nb_frame_side_data);
         return 0;
     }
 
-    if (set->nb_sd > 0 && set->nb_sd == avctx->frame_sd_set.nb_sd &&
-        set->sd == avctx->frame_sd_set.sd)
+    if (nb_sd > 0 && nb_sd == avctx->nb_frame_side_data &&
+        sd == (const AVFrameSideData **)avctx->frame_side_data)
         return AVERROR(EINVAL);
 
-    for (int i = 0; i < set->nb_sd; i++) {
-        int ret = av_frame_side_data_set_entry_from_sd(
-            &avctx->frame_sd_set, set->sd[i], flags);
+    for (int i = 0; i < nb_sd; i++) {
+        int ret = av_frame_side_data_from_sd(
+            &avctx->frame_side_data, &avctx->nb_frame_side_data, sd[i], flags);
         if (ret < 0) {
-            av_frame_side_data_set_uninit(&avctx->frame_sd_set);
+            av_frame_side_data_free(
+                &avctx->frame_side_data, &avctx->nb_frame_side_data);
             return ret;
         }
     }
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index e9ed88330c..3b5ca9c0ef 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2126,7 +2126,8 @@ typedef struct AVCodecContext {
      * - encoding: set by user
      * - decoding: unused
      */
-    AVFrameSideDataSet frame_sd_set;
+    AVFrameSideData  **frame_side_data;
+    int             nb_frame_side_data;
 } AVCodecContext;
 
 /**
@@ -3169,8 +3170,9 @@ int avcodec_is_open(AVCodecContext *s);
  * whole side data set.
  *
  * @param avctx context to which the side data should be added
- * @param set a set from which the side data should be added from.
- *            if null, clears out the side data for this context.
+ * @param sd    array of side data to use as input.
+ *              if null, clears out the side data for this context.
+ * @param nb_sd integer containing the number of entries in the array.
  * @param flags Some combination of AV_FRAME_SIDE_DATA_SET_FLAG_* flags, or 0.
  *
  * @return negative error code on failure, >=0 on success.
@@ -3178,9 +3180,8 @@ int avcodec_is_open(AVCodecContext *s);
  * @see av_frame_side_data_set_new_entry regarding the flags.
  */
 int avcodec_configure_side_data(AVCodecContext *avctx,
-                                const AVFrameSideDataSet *set,
+                                const AVFrameSideData **sd, const int nb_sd,
                                 unsigned int flags);
-
 /**
  * @}
  */
diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
index a108f46207..76f000fd64 100644
--- a/libavcodec/libsvtav1.c
+++ b/libavcodec/libsvtav1.c
@@ -189,13 +189,14 @@ static void handle_mdcv(struct EbSvtAv1MasteringDisplayInfo *dst,
 static void handle_side_data(AVCodecContext *avctx,
                              EbSvtAv1EncConfiguration *param)
 {
-    const AVFrameSideDataSet set = avctx->frame_sd_set;
     const AVFrameSideData *cll_sd =
-        av_frame_side_data_set_get_entry(
-            set, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL);
+        av_frame_side_data_get(
+            (const AVFrameSideData **)avctx->frame_side_data,
+            avctx->nb_frame_side_data, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL);
     const AVFrameSideData *mdcv_sd =
-        av_frame_side_data_set_get_entry(
-            set, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA);
+        av_frame_side_data_get(
+            (const AVFrameSideData **)avctx->frame_side_data,
+            avctx->nb_frame_side_data, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA);
 
     if (cll_sd) {
         const AVContentLightMetadata *cll =
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 683c0d1709..effdcfdb37 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -923,13 +923,14 @@ static void handle_mdcv(x264_param_t *params,
 static void handle_side_data(AVCodecContext *avctx, x264_param_t *params)
 {
 #if CONFIG_LIBX264_HDR10
-    const AVFrameSideDataSet set = avctx->frame_sd_set;
     const AVFrameSideData *cll_sd =
-        av_frame_side_data_set_get_entry(
-            set, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL);
+        av_frame_side_data_get(
+            (const AVFrameSideData **)avctx->frame_side_data,
+            avctx->nb_frame_side_data, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL);
     const AVFrameSideData *mdcv_sd =
-        av_frame_side_data_set_get_entry(
-            set, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA);
+        av_frame_side_data_get(
+            (const AVFrameSideData **)avctx->frame_side_data,
+            avctx->nb_frame_side_data, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA);
 
     if (cll_sd) {
         const AVContentLightMetadata *cll =
diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 96e50a6223..8d366f51ab 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -232,13 +232,14 @@ end:
 static int handle_side_data(AVCodecContext *avctx, const x265_api *api,
                             x265_param *params)
 {
-    const AVFrameSideDataSet set = avctx->frame_sd_set;
     const AVFrameSideData *cll_sd =
-        av_frame_side_data_set_get_entry(
-            set, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL);
+        av_frame_side_data_get(
+            (const AVFrameSideData **)avctx->frame_side_data,
+            avctx->nb_frame_side_data, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL);
     const AVFrameSideData *mdcv_sd =
-        av_frame_side_data_set_get_entry(
-            set, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA);
+        av_frame_side_data_get(
+            (const AVFrameSideData **)avctx->frame_side_data,
+            avctx->nb_frame_side_data, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA);
 
     if (cll_sd) {
         const AVContentLightMetadata *cll =
diff --git a/libavcodec/options.c b/libavcodec/options.c
index 8e16d598a7..7e39b49b7e 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -181,7 +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_set_uninit(&avctx->frame_sd_set);
+    av_frame_side_data_free(
+        &avctx->frame_side_data, &avctx->nb_frame_side_data);
 
     av_freep(pavctx);
 }
diff --git a/libavutil/frame.c b/libavutil/frame.c
index e4004daa4b..e7679bf34d 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -90,9 +90,9 @@ static void frame_side_data_wipe(AVFrame *frame)
     wipe_side_data(&frame->side_data, &frame->nb_side_data);
 }
 
-void av_frame_side_data_set_uninit(AVFrameSideDataSet *set)
+void av_frame_side_data_free(AVFrameSideData ***sd, int *nb_sd)
 {
-    wipe_side_data(&set->sd, &set->nb_sd);
+    wipe_side_data(sd, nb_sd);
 }
 
 static void remove_side_data(AVFrameSideData ***sd, int *nb_side_data,
@@ -110,19 +110,18 @@ static void remove_side_data(AVFrameSideData ***sd, int *nb_side_data,
     }
 }
 
-static void remove_side_data_by_entry(AVFrameSideData ***sd,
-                                      int *nb_side_data,
+static void remove_side_data_by_entry(AVFrameSideData ***sd, int *nb_sd,
                                       const AVFrameSideData *target)
 {
-    for (int i = *nb_side_data - 1; i >= 0; i--) {
+    for (int i = *nb_sd - 1; i >= 0; i--) {
         AVFrameSideData *entry = ((*sd)[i]);
         if (entry != target)
             continue;
 
         free_side_data(&entry);
 
-        ((*sd)[i]) = ((*sd)[*nb_side_data - 1]);
-        (*nb_side_data)--;
+        ((*sd)[i]) = ((*sd)[*nb_sd - 1]);
+        (*nb_sd)--;
 
         return;
     }
@@ -820,7 +819,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
     return NULL;
 }
 
-static AVFrameSideData *add_side_data_to_set_from_buf(AVFrameSideDataSet *set,
+static AVFrameSideData *add_side_data_to_set_from_buf(AVFrameSideData ***sd,
+                                                      int *nb_sd,
                                                       enum AVFrameSideDataType type,
                                                       AVBufferRef *buf)
 {
@@ -829,13 +829,13 @@ static AVFrameSideData *add_side_data_to_set_from_buf(AVFrameSideDataSet *set,
     if (!buf)
         return NULL;
 
-    if (set->nb_sd > INT_MAX / sizeof(*set->sd) - 1)
+    if (*nb_sd > INT_MAX / sizeof(*sd) - 1)
         return NULL;
 
-    tmp = av_realloc(set->sd, (set->nb_sd + 1) * sizeof(*set->sd));
+    tmp = av_realloc(*sd, (*nb_sd + 1) * sizeof(*sd));
     if (!tmp)
         return NULL;
-    set->sd = tmp;
+    *sd = tmp;
 
     ret = av_mallocz(sizeof(*ret));
     if (!ret)
@@ -846,7 +846,7 @@ static AVFrameSideData *add_side_data_to_set_from_buf(AVFrameSideDataSet *set,
     ret->size = buf->size;
     ret->type = type;
 
-    set->sd[set->nb_sd++] = ret;
+    (*sd)[(*nb_sd)++] = ret;
 
     return ret;
 }
@@ -855,16 +855,9 @@ AVFrameSideData *av_frame_new_side_data_from_buf(AVFrame *frame,
                                                  enum AVFrameSideDataType type,
                                                  AVBufferRef *buf)
 {
-    AVFrameSideDataSet set = {
-        .sd    = frame->side_data,
-        .nb_sd = frame->nb_side_data,
-    };
-    AVFrameSideData *ret = add_side_data_to_set_from_buf(&set, type, buf);
-
-    frame->side_data    = set.sd;
-    frame->nb_side_data = set.nb_sd;
-
-    return ret;
+    return
+        add_side_data_to_set_from_buf(&frame->side_data, &frame->nb_side_data,
+                                      type, buf);
 }
 
 AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
@@ -879,29 +872,28 @@ AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
     return ret;
 }
 
-AVFrameSideData *av_frame_side_data_set_new_entry(AVFrameSideDataSet *set,
-                                                  enum AVFrameSideDataType type,
-                                                  size_t size,
-                                                  unsigned int flags)
+AVFrameSideData *av_frame_side_data_new(AVFrameSideData ***sd, int *nb_sd,
+                                        enum AVFrameSideDataType type,
+                                        size_t size, unsigned int flags)
 {
     AVBufferRef     *buf = av_buffer_alloc(size);
     AVFrameSideData *ret = NULL;
 
     if (flags & AV_FRAME_SIDE_DATA_SET_FLAG_NO_DUPLICATES)
-        remove_side_data(&set->sd, &set->nb_sd, type);
+        remove_side_data(sd, nb_sd, type);
 
-    ret = add_side_data_to_set_from_buf(set, type, buf);
+    ret = add_side_data_to_set_from_buf(sd, nb_sd, type, buf);
     if (!ret)
         av_buffer_unref(&buf);
 
     return ret;
 }
 
-int av_frame_side_data_set_entry_from_sd(AVFrameSideDataSet *dst,
-                                         const AVFrameSideData *src,
-                                         unsigned int flags)
+int av_frame_side_data_from_sd(AVFrameSideData ***sd, int *nb_sd,
+                               const AVFrameSideData *src,
+                               unsigned int flags)
 {
-    if (!dst || !src)
+    if (!sd || !src || !nb_sd || (*nb_sd && !*sd))
         return AVERROR(EINVAL);
 
     {
@@ -909,9 +901,9 @@ int av_frame_side_data_set_entry_from_sd(AVFrameSideDataSet *dst,
         AVFrameSideData       *sd_dst = NULL;
 
         if (flags & AV_FRAME_SIDE_DATA_SET_FLAG_NO_DUPLICATES)
-            remove_side_data(&dst->sd, &dst->nb_sd, src->type);
+            remove_side_data(sd, nb_sd, src->type);
 
-        sd_dst = add_side_data_to_set_from_buf(dst, src->type, buf);
+        sd_dst = add_side_data_to_set_from_buf(sd, nb_sd, src->type, buf);
         if (!sd_dst) {
             av_buffer_unref(&buf);
             return AVERROR(ENOMEM);
@@ -920,7 +912,7 @@ int av_frame_side_data_set_entry_from_sd(AVFrameSideDataSet *dst,
         {
             int ret = av_dict_copy(&sd_dst->metadata, src->metadata, 0);
             if (ret < 0) {
-                remove_side_data_by_entry(&dst->sd, &dst->nb_sd, sd_dst);
+                remove_side_data_by_entry(sd, nb_sd, sd_dst);
                 return ret;
             }
         }
@@ -929,12 +921,13 @@ int av_frame_side_data_set_entry_from_sd(AVFrameSideDataSet *dst,
     }
 }
 
-AVFrameSideData *av_frame_side_data_set_get_entry(const AVFrameSideDataSet set,
-                                                  enum AVFrameSideDataType type)
+const AVFrameSideData *av_frame_side_data_get(const AVFrameSideData **sd,
+                                              const int nb_sd,
+                                              enum AVFrameSideDataType type)
 {
-    for (int i = 0; i < set.nb_sd; i++) {
-        if (set.sd[i]->type == type)
-            return set.sd[i];
+    for (int i = 0; i < nb_sd; i++) {
+        if (sd[i]->type == type)
+            return sd[i];
     }
     return NULL;
 }
@@ -942,11 +935,8 @@ AVFrameSideData *av_frame_side_data_set_get_entry(const AVFrameSideDataSet set,
 AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
                                         enum AVFrameSideDataType type)
 {
-    return av_frame_side_data_set_get_entry(
-        (const AVFrameSideDataSet){
-            .sd    = frame->side_data,
-            .nb_sd = frame->nb_side_data
-        },
+    return (AVFrameSideData *)av_frame_side_data_get(
+        (const AVFrameSideData **)frame->side_data, frame->nb_side_data,
         type
     );
 }
diff --git a/libavutil/frame.h b/libavutil/frame.h
index e8517bf6ad..751f7a67d6 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -251,14 +251,6 @@ typedef struct AVFrameSideData {
     AVBufferRef *buf;
 } AVFrameSideData;
 
-/**
- * Structure to hold a set of AVFrameSideData
- */
-typedef struct AVFrameSideDataSet {
-    AVFrameSideData **sd;
-    int            nb_sd;
-} AVFrameSideDataSet;
-
 /**
  * Structure describing a single Region Of Interest.
  *
@@ -1061,18 +1053,23 @@ const char *av_frame_side_data_name(enum AVFrameSideDataType type);
  * Free all side data entries and their contents, then zeroes out the
  * struct values.
  *
- * @param set the set which should be uninitialized
+ * @param sd    pointer to array of side data to free. Will be set to NULL
+ *              upon return.
+ * @param nb_sd pointer to an integer containing the number of entries in
+ *              the array. Will be set to 0 upon return.
  */
-void av_frame_side_data_set_uninit(AVFrameSideDataSet *set);
+void av_frame_side_data_free(AVFrameSideData ***sd, int *nb_sd);
 
 #define AV_FRAME_SIDE_DATA_SET_FLAG_NO_DUPLICATES (1 << 0)
 
 /**
  * Add a new side data entry to a set.
  *
- * @param set a set to which the side data should be added
- * @param type type of the added side data
- * @param size size of the side data
+ * @param sd    pointer to array of side data to which to add another entry.
+ * @param nb_sd pointer to an integer containing the number of entries in
+ *              the array.
+ * @param type  type of the added side data
+ * @param size  size of the side data
  * @param flags Some combination of AV_FRAME_SIDE_DATA_SET_FLAG_* flags, or 0.
  *
  * @return newly added side data on success, NULL on error. In case of
@@ -1080,16 +1077,18 @@ void av_frame_side_data_set_uninit(AVFrameSideDataSet *set);
  *         of matching AVFrameSideDataType will be removed before the
  *         addition is attempted.
  */
-AVFrameSideData *av_frame_side_data_set_new_entry(AVFrameSideDataSet *set,
-                                                  enum AVFrameSideDataType type,
-                                                  size_t size,
-                                                  unsigned int flags);
+AVFrameSideData *av_frame_side_data_new(AVFrameSideData ***sd, int *nb_sd,
+                                        enum AVFrameSideDataType type,
+                                        size_t size, unsigned int flags);
 
 /**
- * Add a new side data entry to a set based on existing side data.
+ * Add a new side data entry to a set based on existing side data, taking
+ * a reference towards the contained AVBufferRef.
  *
- * @param dst a set to which the side data should be added
- * @param src side data which should be added to the set
+ * @param sd    pointer to array of side data to which to add another entry.
+ * @param nb_sd pointer to an integer containing the number of entries in
+ *              the array.
+ * @param src   side data which should be added to the set
  * @param flags Some combination of AV_FRAME_SIDE_DATA_SET_FLAG_* flags, or 0.
  *
  * @return negative error code on failure, >=0 on success. In case of
@@ -1097,21 +1096,23 @@ AVFrameSideData *av_frame_side_data_set_new_entry(AVFrameSideDataSet *set,
  *         of matching AVFrameSideDataType will be removed before the
  *         addition is attempted.
  */
-int av_frame_side_data_set_entry_from_sd(AVFrameSideDataSet *dst,
-                                         const AVFrameSideData *src,
-                                         unsigned int flags);
+int av_frame_side_data_from_sd(AVFrameSideData ***sd, int *nb_sd,
+                               const AVFrameSideData *src,
+                               unsigned int flags);
 
 /**
  * Get a side data entry of a specific type from a set.
  *
- * @param set the set from which side data should be queried from
- * @param type type of side data to be queried
+ * @param sd    array of side data.
+ * @param nb_sd integer containing the number of entries in the array.
+ * @param type  type of side data to be queried
  *
  * @return a pointer to the side data of a given type on success, NULL if there
  *         is no side data with such type in this set.
  */
-AVFrameSideData *av_frame_side_data_set_get_entry(const AVFrameSideDataSet set,
-                                                  enum AVFrameSideDataType type);
+const AVFrameSideData *av_frame_side_data_get(const AVFrameSideData **sd,
+                                              const int nb_sd,
+                                              enum AVFrameSideDataType type);
 
 /**
  * @}
diff --git a/libavutil/tests/side_data_set.c b/libavutil/tests/side_data_set.c
index 820b3aac44..7ef99db3d2 100644
--- a/libavutil/tests/side_data_set.c
+++ b/libavutil/tests/side_data_set.c
@@ -22,36 +22,42 @@
 #include "libavutil/frame.c"
 #include "libavutil/mastering_display_metadata.h"
 
-static void print_clls(const AVFrameSideDataSet set)
+static void print_clls(const AVFrameSideData **sd, const int nb_sd)
 {
-    for (int i = 0; i < set.nb_sd; i++) {
-        AVFrameSideData *sd = set.sd[i];
+    for (int i = 0; i < nb_sd; i++) {
+        const AVFrameSideData *entry = sd[i];
 
         printf("sd %d, %s",
-               i, av_frame_side_data_name(sd->type));
+               i, av_frame_side_data_name(entry->type));
 
-        if (sd->type != AV_FRAME_DATA_CONTENT_LIGHT_LEVEL) {
+        if (entry->type != AV_FRAME_DATA_CONTENT_LIGHT_LEVEL) {
             putchar('\n');
             continue;
         }
 
         printf(": MaxCLL: %u\n",
-               ((AVContentLightMetadata *)sd->data)->MaxCLL);
+               ((AVContentLightMetadata *)entry->data)->MaxCLL);
     }
 }
 
+typedef struct FrameSideDataSet {
+    AVFrameSideData **sd;
+    int            nb_sd;
+} FrameSideDataSet;
+
 int main(void)
 {
-    AVFrameSideDataSet set = { 0 };
+    FrameSideDataSet set = { 0 };
 
     av_assert0(
-        av_frame_side_data_set_new_entry(
-            &set, AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT, 0, 0));
+        av_frame_side_data_new(&set.sd, &set.nb_sd,
+                               AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT,
+                               0, 0));
 
     // test entries in the middle
     for (int value = 1; value < 4; value++) {
-        AVFrameSideData *sd = av_frame_side_data_set_new_entry(
-            &set, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL,
+        AVFrameSideData *sd = av_frame_side_data_new(
+            &set.sd, &set.nb_sd, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL,
             sizeof(AVContentLightMetadata), 0);
 
         av_assert0(sd);
@@ -60,13 +66,13 @@ int main(void)
     }
 
     av_assert0(
-        av_frame_side_data_set_new_entry(
-            &set, AV_FRAME_DATA_SPHERICAL, 0, 0));
+        av_frame_side_data_new(
+            &set.sd, &set.nb_sd, AV_FRAME_DATA_SPHERICAL, 0, 0));
 
     // test entries at the end
     for (int value = 1; value < 4; value++) {
-        AVFrameSideData *sd = av_frame_side_data_set_new_entry(
-            &set, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL,
+        AVFrameSideData *sd = av_frame_side_data_new(
+            &set.sd, &set.nb_sd, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL,
             sizeof(AVContentLightMetadata), 0);
 
         av_assert0(sd);
@@ -75,11 +81,11 @@ int main(void)
     }
 
     puts("Initial addition results with duplicates:");
-    print_clls(set);
+    print_clls((const AVFrameSideData **)set.sd, set.nb_sd);
 
     {
-        AVFrameSideData *sd = av_frame_side_data_set_new_entry(
-            &set, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL,
+        AVFrameSideData *sd = av_frame_side_data_new(
+            &set.sd, &set.nb_sd, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL,
             sizeof(AVContentLightMetadata),
             AV_FRAME_SIDE_DATA_SET_FLAG_NO_DUPLICATES);
 
@@ -89,9 +95,9 @@ int main(void)
     }
 
     puts("\nFinal state after a single 'no-duplicates' addition:");
-    print_clls(set);
+    print_clls((const AVFrameSideData **)set.sd, set.nb_sd);
 
-    av_frame_side_data_set_uninit(&set);
+    av_frame_side_data_free(&set.sd, &set.nb_sd);
 
     return 0;
 }
