avutil/mastering_display_metadata: add a new allocator function that returns a size
av_mastering_display_metadata_alloc() is not useful in scenarios where you need to know the runtime size of AVMasteringDisplayMetadata. Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
		
							parent
							
								
									adb67bba06
								
							
						
					
					
						commit
						6d760c666d
					
				@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07
 | 
			
		||||
 | 
			
		||||
API changes, most recent first:
 | 
			
		||||
 | 
			
		||||
2024-04-11 - xxxxxxxxxx - lavu 59.15.100 - frame.h
 | 
			
		||||
  Add av_mastering_display_metadata_alloc_size().
 | 
			
		||||
 | 
			
		||||
2024-04-11 - xxxxxxxxxx - lavu 59.14.100 - frame.h
 | 
			
		||||
  Add av_frame_side_data_add() and av_frame_side_data_remove().
 | 
			
		||||
  Add AV_FRAME_SIDE_DATA_FLAG_REPLACE.
 | 
			
		||||
 | 
			
		||||
@ -18,6 +18,7 @@
 | 
			
		||||
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <stddef.h>
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
@ -29,6 +30,18 @@ AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc(void)
 | 
			
		||||
    return av_mallocz(sizeof(AVMasteringDisplayMetadata));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc_size(size_t *size)
 | 
			
		||||
{
 | 
			
		||||
    AVMasteringDisplayMetadata *mastering = av_mallocz(sizeof(AVMasteringDisplayMetadata));
 | 
			
		||||
    if (!mastering)
 | 
			
		||||
        return NULL;
 | 
			
		||||
 | 
			
		||||
    if (size)
 | 
			
		||||
        *size = sizeof(*mastering);
 | 
			
		||||
 | 
			
		||||
    return mastering;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
AVMasteringDisplayMetadata *av_mastering_display_metadata_create_side_data(AVFrame *frame)
 | 
			
		||||
{
 | 
			
		||||
    AVFrameSideData *side_data = av_frame_new_side_data(frame,
 | 
			
		||||
 | 
			
		||||
@ -77,6 +77,15 @@ typedef struct AVMasteringDisplayMetadata {
 | 
			
		||||
 */
 | 
			
		||||
AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc(void);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Allocate an AVMasteringDisplayMetadata structure and set its fields to
 | 
			
		||||
 * default values. The resulting struct can be freed using av_freep().
 | 
			
		||||
 *
 | 
			
		||||
 * @return An AVMasteringDisplayMetadata filled with default values or NULL
 | 
			
		||||
 *         on failure.
 | 
			
		||||
 */
 | 
			
		||||
AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc_size(size_t *size);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Allocate a complete AVMasteringDisplayMetadata and add it to the frame.
 | 
			
		||||
 *
 | 
			
		||||
 | 
			
		||||
@ -79,7 +79,7 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#define LIBAVUTIL_VERSION_MAJOR  59
 | 
			
		||||
#define LIBAVUTIL_VERSION_MINOR  14
 | 
			
		||||
#define LIBAVUTIL_VERSION_MINOR  15
 | 
			
		||||
#define LIBAVUTIL_VERSION_MICRO 100
 | 
			
		||||
 | 
			
		||||
#define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user