| 289 | } |
| 290 | |
| 291 | static avifEncoderItem * avifEncoderDataCreateItem(avifEncoderData * data, const char * type, const char * infeName, size_t infeNameSize, uint32_t cellIndex) |
| 292 | { |
| 293 | avifEncoderItem * item = (avifEncoderItem *)avifArrayPush(&data->items); |
| 294 | if (item == NULL) { |
| 295 | return NULL; |
| 296 | } |
| 297 | ++data->lastItemID; |
| 298 | item->id = data->lastItemID; |
| 299 | memcpy(item->type, type, sizeof(item->type)); |
| 300 | item->infeName = infeName; |
| 301 | item->infeNameSize = infeNameSize; |
| 302 | item->encodeOutput = avifCodecEncodeOutputCreate(); |
| 303 | if (item->encodeOutput == NULL) { |
| 304 | goto error; |
| 305 | } |
| 306 | item->cellIndex = cellIndex; |
| 307 | if (!avifArrayCreate(&item->mdatFixups, sizeof(avifOffsetFixup), 4)) { |
| 308 | goto error; |
| 309 | } |
| 310 | if (!avifArrayCreate(&item->associations, sizeof(avifItemPropertyAssociation), 4)) { |
| 311 | goto error; |
| 312 | } |
| 313 | return item; |
| 314 | |
| 315 | error: |
| 316 | if (item->encodeOutput != NULL) { |
| 317 | avifCodecEncodeOutputDestroy(item->encodeOutput); |
| 318 | } |
| 319 | avifArrayDestroy(&item->mdatFixups); |
| 320 | --data->lastItemID; |
| 321 | avifArrayPop(&data->items); |
| 322 | return NULL; |
| 323 | } |
| 324 | |
| 325 | static avifEncoderItem * avifEncoderDataFindItemByID(avifEncoderData * data, uint16_t id) |
| 326 | { |
no test coverage detected