summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2014-02-19 20:11:21 +0100
committerAnton Khirnov <anton@khirnov.net>2014-03-24 06:07:51 +0100
commitd161ae0a37900cbd36c1390ca32a56b892c02ab5 (patch)
tree98e95976af28331c04fda86f3a76102b62148820
parent59444c76e6d43529a12dbd80b6dd29c6ba4079a9 (diff)
frame: add a function for removing side data from a frame
-rw-r--r--doc/APIchanges4
-rw-r--r--libavutil/frame.c16
-rw-r--r--libavutil/frame.h6
-rw-r--r--libavutil/version.h2
4 files changed, 27 insertions, 1 deletions
diff --git a/doc/APIchanges b/doc/APIchanges
index afeec8c3b7..d8002533df 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,10 @@ libavutil: 2013-12-xx
API changes, most recent first:
+2014-02-xx - xxxxxxx - lavu 53.08.0 - frame.h
+ Add av_frame_remove_side_data() for removing a single side data
+ instance from a frame.
+
2014-02-xx - xxxxxxx - lavu 53.07.0 - frame.h, replaygain.h
Add AV_FRAME_DATA_REPLAYGAIN for exporting replaygain tags.
Add a new header replaygain.h with the AVReplayGain struct.
diff --git a/libavutil/frame.c b/libavutil/frame.c
index f81bbbd138..cc4bfcdf4b 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -526,3 +526,19 @@ int av_frame_copy(AVFrame *dst, const AVFrame *src)
return AVERROR(EINVAL);
}
+
+void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type)
+{
+ int i;
+
+ for (i = 0; i < frame->nb_side_data; i++) {
+ AVFrameSideData *sd = frame->side_data[i];
+ if (sd->type == type) {
+ av_freep(&sd->data);
+ av_dict_free(&sd->metadata);
+ av_freep(&frame->side_data[i]);
+ frame->side_data[i] = frame->side_data[frame->nb_side_data - 1];
+ frame->nb_side_data--;
+ }
+ }
+}
diff --git a/libavutil/frame.h b/libavutil/frame.h
index e9bc6aeb40..3bec8e5948 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -563,6 +563,12 @@ AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
enum AVFrameSideDataType type);
/**
+ * If side data of the supplied type exists in the frame, free it and remove it
+ * from the frame.
+ */
+void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type);
+
+/**
* @}
*/
diff --git a/libavutil/version.h b/libavutil/version.h
index d680979629..7f439d725a 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -54,7 +54,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 53
-#define LIBAVUTIL_VERSION_MINOR 7
+#define LIBAVUTIL_VERSION_MINOR 8
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \