| 7246 | } |
| 7247 | |
| 7248 | avifResult avifDecoderRead(avifDecoder * decoder, avifImage * image) |
| 7249 | { |
| 7250 | avifResult result = avifDecoderParse(decoder); |
| 7251 | if (result != AVIF_RESULT_OK) { |
| 7252 | return result; |
| 7253 | } |
| 7254 | result = avifDecoderNextImage(decoder); |
| 7255 | if (result != AVIF_RESULT_OK) { |
| 7256 | return result; |
| 7257 | } |
| 7258 | // If decoder->image->imageOwnsYUVPlanes is true and decoder->image is not used after this call, |
| 7259 | // the ownership of the planes in decoder->image could be transferred here instead of copied. |
| 7260 | // However most codec_*.c implementations allocate the output buffer themselves and return a |
| 7261 | // view, unless some postprocessing is applied (container-level grid reconstruction for |
| 7262 | // example), so the first condition rarely holds. |
| 7263 | // The second condition does not hold either: it is not required by the documentation in avif.h. |
| 7264 | return avifImageCopy(image, decoder->image, AVIF_PLANES_ALL); |
| 7265 | } |
| 7266 | |
| 7267 | avifResult avifDecoderReadMemory(avifDecoder * decoder, avifImage * image, const uint8_t * data, size_t size) |
| 7268 | { |