MCPcopy Create free account
hub / github.com/AOMediaCodec/libavif / avifRWStreamFinishBox

Function avifRWStreamFinishBox

src/stream.c:429–442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

427}
428
429avifResult avifRWStreamFinishBox(avifRWStream * stream, avifBoxMarker marker)
430{
431 assert(stream->numUsedBitsInPartialByte == 0); // Byte alignment is required.
432 size_t boxSize = stream->offset - marker;
433 // Since marker comes from a previous avifRWStreamWriteBox() or
434 // avifRWStreamWriteFullBox() call, boxSize must be >= the size of the size
435 // and type fields. This implies that boxSize cannot be equal to the two
436 // special values 0 and 1.
437 AVIF_ASSERT_OR_RETURN(boxSize >= sizeof(uint32_t) + 4);
438 AVIF_CHECKERR(boxSize <= UINT32_MAX, AVIF_RESULT_INVALID_ARGUMENT);
439 uint32_t noSize = avifHTONL((uint32_t)boxSize);
440 memcpy(stream->raw->data + marker, &noSize, sizeof(uint32_t));
441 return AVIF_RESULT_OK;
442}
443
444avifResult avifRWStreamWriteU8(avifRWStream * stream, uint8_t v)
445{

Calls 1

avifHTONLFunction · 0.85

Tested by 1

TESTFunction · 0.68