av_mastering_display_metadata_alloc() is not useful in scenarios where you need to know the runtime size of AVMasteringDisplayMetadata.
Unified · Split
| @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07 · 1 unmodified line | |||
| 2 | 2 | ||
| 3 | API changes, most recent first: | 3 | API changes, most recent first: |
| 4 | 4 | ||
| 5 | 2024-04-11 - xxxxxxxxxx - lavu 59.15.100 - frame.h | ||
| 6 | Add av_mastering_display_metadata_alloc_size(). | ||
| 7 | |||
| 5 | 2024-04-11 - xxxxxxxxxx - lavu 59.14.100 - frame.h | 8 | 2024-04-11 - xxxxxxxxxx - lavu 59.14.100 - frame.h |
| 6 | Add av_frame_side_data_add() and av_frame_side_data_remove(). | 9 | Add av_frame_side_data_add() and av_frame_side_data_remove(). |
| 7 | Add AV_FRAME_SIDE_DATA_FLAG_REPLACE. | 10 | Add AV_FRAME_SIDE_DATA_FLAG_REPLACE. |
| @@ -18,6 +18,7 @@ · 17 unmodified lines | |||
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | #include <stddef.h> | ||
| 21 | #include <stdint.h> | 22 | #include <stdint.h> |
| 22 | #include <string.h> | 23 | #include <string.h> |
| 23 | 24 | ||
| @@ -29,6 +30,18 @@ AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc(void) · 5 unmodified lines | |||
| 29 | return av_mallocz(sizeof(AVMasteringDisplayMetadata)); | 30 | return av_mallocz(sizeof(AVMasteringDisplayMetadata)); |
| 30 | } | 31 | } |
| 31 | 32 | ||
| 33 | AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc_size(size_t *size) | ||
| 34 | { | ||
| 35 | AVMasteringDisplayMetadata *mastering = av_mallocz(sizeof(AVMasteringDisplayMetadata)); | ||
| 36 | if (!mastering) | ||
| 37 | return NULL; | ||
| 38 | |||
| 39 | if (size) | ||
| 40 | *size = sizeof(*mastering); | ||
| 41 | |||
| 42 | return mastering; | ||
| 43 | } | ||
| 44 | |||
| 32 | AVMasteringDisplayMetadata *av_mastering_display_metadata_create_side_data(AVFrame *frame) | 45 | AVMasteringDisplayMetadata *av_mastering_display_metadata_create_side_data(AVFrame *frame) |
| 33 | { | 46 | { |
| 34 | AVFrameSideData *side_data = av_frame_new_side_data(frame, | 47 | AVFrameSideData *side_data = av_frame_new_side_data(frame, |
| @@ -77,6 +77,15 @@ typedef struct AVMasteringDisplayMetadata { · 76 unmodified lines | |||
| 77 | */ | 77 | */ |
| 78 | AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc(void); | 78 | AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc(void); |
| 79 | 79 | ||
| 80 | /** | ||
| 81 | * Allocate an AVMasteringDisplayMetadata structure and set its fields to | ||
| 82 | * default values. The resulting struct can be freed using av_freep(). | ||
| 83 | * | ||
| 84 | * @return An AVMasteringDisplayMetadata filled with default values or NULL | ||
| 85 | * on failure. | ||
| 86 | */ | ||
| 87 | AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc_size(size_t *size); | ||
| 88 | |||
| 80 | /** | 89 | /** |
| 81 | * Allocate a complete AVMasteringDisplayMetadata and add it to the frame. | 90 | * Allocate a complete AVMasteringDisplayMetadata and add it to the frame. |
| 82 | * | 91 | * |
| @@ -79,7 +79,7 @@ · 78 unmodified lines | |||
| 79 | */ | 79 | */ |
| 80 | 80 | ||
| 81 | #define LIBAVUTIL_VERSION_MAJOR 59 | 81 | #define LIBAVUTIL_VERSION_MAJOR 59 |
| 82 | #define LIBAVUTIL_VERSION_MINOR 14 | 82 | #define LIBAVUTIL_VERSION_MINOR 15 |
| 83 | #define LIBAVUTIL_VERSION_MICRO 100 | 83 | #define LIBAVUTIL_VERSION_MICRO 100 |
| 84 | 84 | ||
| 85 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ | 85 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ |