ffmpeg | branch: master | Jan Ekström <jee...@gmail.com> | Sun Mar 19 11:25:54 
2023 +0200| [919c9cdbe6d2d69beb6c675d879dd77588f4f001] | committer: Jan Ekström

avutil/frame: add helper for freeing arrays of side data

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=919c9cdbe6d2d69beb6c675d879dd77588f4f001
---

 libavutil/frame.c |  5 +++++
 libavutil/frame.h | 11 +++++++++++
 2 files changed, 16 insertions(+)

diff --git a/libavutil/frame.c b/libavutil/frame.c
index ab425b2235..baac0706db 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -78,6 +78,11 @@ static void frame_side_data_wipe(AVFrame *frame)
     wipe_side_data(&frame->side_data, &frame->nb_side_data);
 }
 
+void av_frame_side_data_free(AVFrameSideData ***sd, int *nb_sd)
+{
+    wipe_side_data(sd, nb_sd);
+}
+
 AVFrame *av_frame_alloc(void)
 {
     AVFrame *frame = av_malloc(sizeof(*frame));
diff --git a/libavutil/frame.h b/libavutil/frame.h
index b94687941d..27281c168f 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -988,6 +988,17 @@ int av_frame_apply_cropping(AVFrame *frame, int flags);
  */
 const char *av_frame_side_data_name(enum AVFrameSideDataType type);
 
+/**
+ * Free all side data entries and their contents, then zeroes out the
+ * values which the pointers are pointing to.
+ *
+ * @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_free(AVFrameSideData ***sd, int *nb_sd);
+
 /**
  * @}
  */

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to