From e943a6867f0e37f5eb68e9911a1971f747ed7531 Mon Sep 17 00:00:00 2001 From: TazyFoundSoup Date: Fri, 19 Dec 2025 17:20:02 +1100 Subject: feat(png): add ff_next_chunk function --- include/tinyff/common.h | 17 +++++++++++++++++ include/tinyff/image/png.h | 5 +++-- 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 include/tinyff/common.h (limited to 'include/tinyff') diff --git a/include/tinyff/common.h b/include/tinyff/common.h new file mode 100644 index 0000000..d53adae --- /dev/null +++ b/include/tinyff/common.h @@ -0,0 +1,17 @@ +// Common header for tinyff library +// Not recommended to be included directly +#ifndef TINYFF_COMMON_H +#define TINYFF_COMMON_H + +#include + +// Human readable number types +// NOTE: The only reason I created these was so +// that debugging will be easier +typedef uint8_t ff_byte; + +// Functions + +static inline uint32_t get_big_endian(const uint8_t *buffer); + +#endif \ No newline at end of file diff --git a/include/tinyff/image/png.h b/include/tinyff/image/png.h index 78b92e4..95ab94f 100644 --- a/include/tinyff/image/png.h +++ b/include/tinyff/image/png.h @@ -5,9 +5,10 @@ #include #include #include +#include #include "tinyff/result.h" - +#include "tinyff/common.h" static const unsigned char PNG_SIGNATURE[8] = { @@ -50,6 +51,6 @@ typedef struct { ff_result ff_png_isvalid(FILE *file); ff_result ff_open_png(const char *filepath, ff_png_ctx **out_ctx); - +ff_result ff_next_chunk(FILE *file, ff_png_chunk **out_chunk); #endif -- cgit v1.2.3