aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/frame.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2024-03-28 12:58:24 -0300
committerJames Almer <jamrial@gmail.com>2024-04-11 09:18:19 -0300
commita16338089cfbf89d94465e9d678bfe1b875a8f5a (patch)
tree96f239850ede148c7461336f15fd6c0ef8c1bc52 /libavutil/frame.c
parente4f5c2414bb50df07dce9a8860aaeeaccaed15cf (diff)
downloadffmpeg-a16338089cfbf89d94465e9d678bfe1b875a8f5a.tar.gz
avutil/frame: add helper for adding side data w/ AVBufferRef to array
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavutil/frame.c')
-rw-r--r--libavutil/frame.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libavutil/frame.c b/libavutil/frame.c
index 930f01dc19..f77e1986bf 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -821,6 +821,25 @@ AVFrameSideData *av_frame_side_data_new(AVFrameSideData ***sd, int *nb_sd,
return ret;
}
+AVFrameSideData *av_frame_side_data_add(AVFrameSideData ***sd, int *nb_sd,
+ enum AVFrameSideDataType type,
+ AVBufferRef **pbuf, unsigned int flags)
+{
+ const AVSideDataDescriptor *desc = av_frame_side_data_desc(type);
+ AVFrameSideData *sd_dst = NULL;
+ AVBufferRef *buf = *pbuf;
+
+ if (flags & AV_FRAME_SIDE_DATA_FLAG_UNIQUE)
+ remove_side_data(sd, nb_sd, type);
+
+ sd_dst = add_side_data_from_buf(sd, nb_sd, type, buf);
+ if (!sd_dst)
+ return NULL;
+
+ *pbuf = NULL;
+ return sd_dst;
+}
+
int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd,
const AVFrameSideData *src, unsigned int flags)
{