[FFmpeg-devel] [PATCH v2 05/12] avutil/frame: add helper for adding side data to set
Jan Ekström
jeebjp at gmail.com
Wed Apr 12 00:20:45 EEST 2023
---
libavutil/frame.c | 12 ++++++++++++
libavutil/frame.h | 13 +++++++++++++
2 files changed, 25 insertions(+)
diff --git a/libavutil/frame.c b/libavutil/frame.c
index ab1a4e7f6a..29e9b631f8 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -708,6 +708,18 @@ AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
return ret;
}
+
+AVFrameSideData *av_new_side_data_to_set(AVFrameSideDataSet *set,
+ enum AVFrameSideDataType type,
+ size_t size)
+{
+ AVBufferRef *buf = av_buffer_alloc(size);
+ AVFrameSideData *ret = add_side_data_to_set_from_buf(set, type, buf);
+ if (!ret)
+ av_buffer_unref(&buf);
+ return ret;
+}
+
AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
enum AVFrameSideDataType type)
{
diff --git a/libavutil/frame.h b/libavutil/frame.h
index 734ac3fe75..167a8f0ff6 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -998,6 +998,19 @@ const char *av_frame_side_data_name(enum AVFrameSideDataType type);
*/
void av_side_data_set_wipe(AVFrameSideDataSet *set);
+/**
+ * Add a new side data entry to a set.
+ *
+ * @param set a set to which the side data should be added
+ * @param type type of the added side data
+ * @param size size of the side data
+ *
+ * @return newly added side data on success, NULL on error
+ */
+AVFrameSideData *av_new_side_data_to_set(AVFrameSideDataSet *set,
+ enum AVFrameSideDataType type,
+ size_t size);
+
/**
* @}
*/
--
2.40.0
More information about the ffmpeg-devel
mailing list