Returns NULL if a memory allocation failed.
| 258 | |
| 259 | // Returns NULL if a memory allocation failed. |
| 260 | static avifEncoderData * avifEncoderDataCreate(void) |
| 261 | { |
| 262 | avifEncoderData * data = (avifEncoderData *)avifAlloc(sizeof(avifEncoderData)); |
| 263 | if (!data) { |
| 264 | return NULL; |
| 265 | } |
| 266 | memset(data, 0, sizeof(avifEncoderData)); |
| 267 | data->imageMetadata = avifImageCreateEmpty(); |
| 268 | if (!data->imageMetadata) { |
| 269 | goto error; |
| 270 | } |
| 271 | data->altImageMetadata = avifImageCreateEmpty(); |
| 272 | if (!data->altImageMetadata) { |
| 273 | goto error; |
| 274 | } |
| 275 | if (!avifArrayCreate(&data->items, sizeof(avifEncoderItem), 8)) { |
| 276 | goto error; |
| 277 | } |
| 278 | if (!avifArrayCreate(&data->frames, sizeof(avifEncoderFrame), 1)) { |
| 279 | goto error; |
| 280 | } |
| 281 | if (!avifArrayCreate(&data->alternativeItemIDs, sizeof(uint16_t), 1)) { |
| 282 | goto error; |
| 283 | } |
| 284 | return data; |
| 285 | |
| 286 | error: |
| 287 | avifEncoderDataDestroy(data); |
| 288 | return NULL; |
| 289 | } |
| 290 | |
| 291 | static avifEncoderItem * avifEncoderDataCreateItem(avifEncoderData * data, const char * type, const char * infeName, size_t infeNameSize, uint32_t cellIndex) |
| 292 | { |
no test coverage detected