aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2024-06-21 23:45:20 -0300
committerJames Almer <jamrial@gmail.com>2024-06-25 00:01:05 -0300
commite6baf4f3841fe07d639e5b0fedefd06b9f994e6b (patch)
tree68e909b1a5a0338516788f55500c216cc8ae0d90
parent1034296eac7e6b58a06b6474c9cd53ee86124d3c (diff)
downloadffmpeg-e6baf4f3841fe07d639e5b0fedefd06b9f994e6b.tar.gz
avutil/stereo3d: add a new allocator function that returns a size
av_stereo3d_alloc() is not useful in scenarios where you need to know the runtime size of AVStereo3D. Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r--doc/APIchanges3
-rw-r--r--libavutil/stereo3d.c8
-rw-r--r--libavutil/stereo3d.h8
-rw-r--r--libavutil/version.h2
4 files changed, 20 insertions, 1 deletions
diff --git a/doc/APIchanges b/doc/APIchanges
index 3e728c9ef1..cf0555d5e0 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07
API changes, most recent first:
+2024-06-25 - xxxxxxxxxx - lavu 59.26.100 - stereo3d.h
+ Add av_stereo3d_alloc_size().
+
2024-06-19 - xxxxxxxxxx - lavu 59.25.100 - dovi_meta.h
Add AVDOVIRpuDataHeader.ext_mapping_idc_0_4 and ext_mapping_idc_5_7.
diff --git a/libavutil/stereo3d.c b/libavutil/stereo3d.c
index ad6064e5d9..7ea3dceb33 100644
--- a/libavutil/stereo3d.c
+++ b/libavutil/stereo3d.c
@@ -34,12 +34,20 @@ static void get_defaults(AVStereo3D *stereo)
AVStereo3D *av_stereo3d_alloc(void)
{
+ return av_stereo3d_alloc_size(NULL);
+}
+
+AVStereo3D *av_stereo3d_alloc_size(size_t *size)
+{
AVStereo3D *stereo = av_mallocz(sizeof(AVStereo3D));
if (!stereo)
return NULL;
get_defaults(stereo);
+ if (size)
+ *size = sizeof(*stereo);
+
return stereo;
}
diff --git a/libavutil/stereo3d.h b/libavutil/stereo3d.h
index d8b191118c..386455a5a4 100644
--- a/libavutil/stereo3d.h
+++ b/libavutil/stereo3d.h
@@ -238,6 +238,14 @@ typedef struct AVStereo3D {
AVStereo3D *av_stereo3d_alloc(void);
/**
+ * Allocate an AVStereo3D structure and set its fields to default values.
+ * The resulting struct can be freed using av_freep().
+ *
+ * @return An AVStereo3D filled with default values or NULL on failure.
+ */
+AVStereo3D *av_stereo3d_alloc_size(size_t *size);
+
+/**
* Allocate a complete AVFrameSideData and add it to the frame.
*
* @param frame The frame which side data is added to.
diff --git a/libavutil/version.h b/libavutil/version.h
index 78e6431642..9c1a2dfe39 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 59
-#define LIBAVUTIL_VERSION_MINOR 25
+#define LIBAVUTIL_VERSION_MINOR 26
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \