aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/frame.c
diff options
context:
space:
mode:
authorJan Ekström <jeebjp@gmail.com>2023-03-19 15:37:40 +0200
committerJan Ekström <jeebjp@gmail.com>2024-03-20 19:15:05 +0200
commitf287a285d91bd89aa36699ce75818c7267f5f6ee (patch)
treee4ee879a3c6c049e5eb337cf7674355cb7bf76a4 /libavutil/frame.c
parent3c52f73e253eba81e4c58b69d8a8eb578128bef4 (diff)
downloadffmpeg-f287a285d91bd89aa36699ce75818c7267f5f6ee.tar.gz
avutil/frame: add helper for getting side data from array
Diffstat (limited to 'libavutil/frame.c')
-rw-r--r--libavutil/frame.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/libavutil/frame.c b/libavutil/frame.c
index 9d3eae4bae..89db687d9c 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -813,16 +813,26 @@ int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd,
return 0;
}
-AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
- 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 < frame->nb_side_data; i++) {
- if (frame->side_data[i]->type == type)
- return frame->side_data[i];
+ for (int i = 0; i < nb_sd; i++) {
+ if (sd[i]->type == type)
+ return sd[i];
}
return NULL;
}
+AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
+ enum AVFrameSideDataType type)
+{
+ return (AVFrameSideData *)av_frame_side_data_get(
+ (const AVFrameSideData **)frame->side_data, frame->nb_side_data,
+ type
+ );
+}
+
static int frame_copy_video(AVFrame *dst, const AVFrame *src)
{
int planes;