[FFmpeg-devel,v1,07/12] avutil/frame: add helper for extending a set of side data
Checks
Context |
Check |
Description |
andriy/make_x86 |
success
|
Make finished
|
andriy/make_fate_x86 |
success
|
Make fate finished
|
Commit Message
---
libavutil/frame.c | 21 +++++++++++++++++++++
libavutil/frame.h | 11 +++++++++++
2 files changed, 32 insertions(+)
@@ -720,6 +720,27 @@ AVFrameSideData *av_new_side_data_to_set(AVFrameSideDataSet *set,
return ret;
}
+int av_extend_side_data_set(AVFrameSideDataSet *dst,
+ const AVFrameSideDataSet src)
+{
+ for (int i = 0; i < src.nb_side_data; i++) {
+ const AVFrameSideData *sd_src = src.side_data[i];
+ AVFrameSideData *sd_dst =
+ av_new_side_data_to_set(dst, sd_src->type,
+ sd_src->size);
+ if (!sd_dst) {
+ av_side_data_set_wipe(dst);
+ return AVERROR(ENOMEM);
+ }
+
+ memcpy(sd_dst->data, sd_src->data, sd_src->size);
+
+ av_dict_copy(&sd_dst->metadata, sd_src->metadata, 0);
+ }
+
+ return 0;
+}
+
AVFrameSideData *av_get_side_data_from_set(const AVFrameSideDataSet set,
enum AVFrameSideDataType type)
{
@@ -1011,6 +1011,17 @@ AVFrameSideData *av_new_side_data_to_set(AVFrameSideDataSet *set,
enum AVFrameSideDataType type,
size_t size);
+/**
+ * Add multiple side data entries to a set in one go.
+ *
+ * @param dst a set to which the side data should be added
+ * @param src a set from which the side data should be copied from
+ *
+ * @return negative error code on failure, >=0 on success.
+ */
+int av_extend_side_data_set(AVFrameSideDataSet *dst,
+ const AVFrameSideDataSet src);
+
/**
* @param set a set to which the side data should be added
* @param type type of the added side data