[FFmpeg-devel] [PATCH 27/29] avcodec/hevcdec: switch to ff_frame_new_side_data_from_buf

Anton Khirnov anton at khirnov.net
Mon Mar 4 15:06:42 EET 2024


From: Niklas Haas <git at haasn.dev>

For consistency, even though this cannot be overriden at the packet
level.

Signed-off-by: Anton Khirnov <anton at khirnov.net>
---
 libavcodec/hevcdec.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 76aa6b4588..a6b124dd2a 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2825,11 +2825,9 @@ static int set_side_data(HEVCContext *s)
     }
 
     if (s->rpu_buf) {
-        AVFrameSideData *rpu = av_frame_new_side_data_from_buf(out, AV_FRAME_DATA_DOVI_RPU_BUFFER, s->rpu_buf);
-        if (!rpu)
-            return AVERROR(ENOMEM);
-
-        s->rpu_buf = NULL;
+        ret = ff_frame_new_side_data_from_buf(s->avctx, out, AV_FRAME_DATA_DOVI_RPU_BUFFER, &s->rpu_buf, NULL);
+        if (ret < 0)
+            return ret;
     }
 
     if ((ret = ff_dovi_attach_side_data(&s->dovi_ctx, out)) < 0)
@@ -2840,10 +2838,9 @@ static int set_side_data(HEVCContext *s)
         if (!info_ref)
             return AVERROR(ENOMEM);
 
-        if (!av_frame_new_side_data_from_buf(out, AV_FRAME_DATA_DYNAMIC_HDR_VIVID, info_ref)) {
-            av_buffer_unref(&info_ref);
-            return AVERROR(ENOMEM);
-        }
+        ret = ff_frame_new_side_data_from_buf(s->avctx, out, AV_FRAME_DATA_DYNAMIC_HDR_VIVID, &info_ref, NULL);
+        if (ret < 0)
+            return ret;
     }
 
     return 0;
-- 
2.43.0



More information about the ffmpeg-devel mailing list