diff options
| author | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-05-22 09:43:59 +1000 |
|---|---|---|
| committer | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-05-22 09:43:59 +1000 |
| commit | 77aa9a3259ddfd6c64534d63424d5b0fa3010900 (patch) | |
| tree | 3744ec77c3cbe164457d1e421fd4bf7dceff4c02 /src/format | |
| parent | 4d42b317f4970bd08f9b81fcc184fc015736ff58 (diff) | |
refactor: move benches to include directory
Diffstat (limited to 'src/format')
| -rw-r--r-- | src/format/image/png.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/format/image/png.c b/src/format/image/png.c index 12080d6..d5959bc 100644 --- a/src/format/image/png.c +++ b/src/format/image/png.c @@ -483,10 +483,16 @@ ff_result ff_close_png(ff_ctx* ctx, ff_png_ctx *png_ctx) ff_result ff_write_chunk(ff_stream *stream, const char *type, uint8_t *buf, size_t len) { - stream->write(stream, 4, type); - stream->write(stream, 4, (uint32_t*)&len); - stream->write(stream, len, buf); - stream->write(stream, 4, (uint32_t*)0); // TODO: Implement actual CRC calculation (use ff_write_be32) + stream->write(type, 4, stream->user); + + uint32_t be_len = (uint32_t)len; + stream->write(&be_len, 4, stream->user); + + stream->write(buf, len, stream->user); + + uint32_t zero_crc = 0; + stream->write(&zero_crc, 4, stream->user); + return FF_RESULT_OK; } @@ -495,7 +501,7 @@ ff_result ff_encode_png(ff_ctx *ctx, ff_png_ctx *png_ctx, ff_stream *stream) FF_BENCH_START(ctx, "png"); FF_BENCH_MARK(ctx, "ff_encode_png"); - stream->write(stream, 8, PNG_SIGNATURE); + stream->write(stream, 8, (void *)PNG_SIGNATURE); // TODO: Actually write the PNG data // For now I'll void the parameters |
