aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/frame.h
diff options
context:
space:
mode:
authorJan Ekström <jeebjp@gmail.com>2023-03-19 15:00:33 +0200
committerJan Ekström <jeebjp@gmail.com>2024-03-20 19:14:02 +0200
commit53335f6cf42fc9f627a29663c2df6daacd891161 (patch)
tree9c70fc0e84b3d34556c1913be923cd24190258ec /libavutil/frame.h
parentd2bb22f6d5c1f44951e074f84233e1c8249dbad3 (diff)
downloadffmpeg-53335f6cf42fc9f627a29663c2df6daacd891161.tar.gz
avutil/frame: add helper for adding side data to array
Additionally, add an API test to check that the no-duplicates addition works after duplicates have been inserted.
Diffstat (limited to 'libavutil/frame.h')
-rw-r--r--libavutil/frame.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/libavutil/frame.h b/libavutil/frame.h
index 27281c168f..5d68d1e7af 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -999,6 +999,28 @@ const char *av_frame_side_data_name(enum AVFrameSideDataType type);
*/
void av_frame_side_data_free(AVFrameSideData ***sd, int *nb_sd);
+#define AV_FRAME_SIDE_DATA_FLAG_UNIQUE (1 << 0)
+
+/**
+ * Add new side data entry to an array.
+ *
+ * @param sd pointer to array of side data to which to add another entry,
+ * or to NULL in order to start a new array.
+ * @param nb_sd pointer to an integer containing the number of entries in
+ * the array.
+ * @param type type of the added side data
+ * @param size size of the side data
+ * @param flags Some combination of AV_FRAME_SIDE_DATA_FLAG_* flags, or 0.
+ *
+ * @return newly added side data on success, NULL on error. In case of
+ * AV_FRAME_SIDE_DATA_FLAG_UNIQUE being set, entries of matching
+ * AVFrameSideDataType will be removed before the addition is
+ * attempted.
+ */
+AVFrameSideData *av_frame_side_data_new(AVFrameSideData ***sd, int *nb_sd,
+ enum AVFrameSideDataType type,
+ size_t size, unsigned int flags);
+
/**
* @}
*/