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>
This commit is contained in:
James Almer 2024-06-21 23:45:20 -03:00
parent 1034296eac
commit e6baf4f384
4 changed files with 20 additions and 1 deletions

View File

@ -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.

View File

@ -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;
}

View File

@ -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.
*

View File

@ -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, \