[FFmpeg-cvslog] avutil/stereo3d: add a new allocator function that returns a size

James Almer git at videolan.org
Tue Jun 25 06:01:09 EEST 2024


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Fri Jun 21 23:45:20 2024 -0300| [e6baf4f3841fe07d639e5b0fedefd06b9f994e6b] | committer: James Almer

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 at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e6baf4f3841fe07d639e5b0fedefd06b9f994e6b
---

 doc/APIchanges       | 3 +++
 libavutil/stereo3d.c | 8 ++++++++
 libavutil/stereo3d.h | 8 ++++++++
 libavutil/version.h  | 2 +-
 4 files changed, 20 insertions(+), 1 deletion(-)

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
@@ -33,6 +33,11 @@ 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)
@@ -40,6 +45,9 @@ AVStereo3D *av_stereo3d_alloc(void)
 
     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
@@ -237,6 +237,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.
  *
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, \



More information about the ffmpeg-cvslog mailing list