diff mbox series

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

Message ID 20240304130657.30631-27-anton@khirnov.net
State New
Headers show
Series [FFmpeg-devel,01/29] lavu/opt: factor per-type dispatch out of av_opt_get() | 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

Anton Khirnov March 4, 2024, 1:06 p.m. UTC
From: Niklas Haas <git@haasn.dev>

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

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

Patch

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;