diff options
| -rw-r--r-- | include/tinyff/image/png.h | 3 | ||||
| -rw-r--r-- | src/format/image/png.c | 16 |
2 files changed, 19 insertions, 0 deletions
diff --git a/include/tinyff/image/png.h b/include/tinyff/image/png.h index c2c7db2..3937e8d 100644 --- a/include/tinyff/image/png.h +++ b/include/tinyff/image/png.h @@ -37,6 +37,9 @@ typedef struct { uint8_t bit_depth; uint8_t color_type; + // Interlace method + uint8_t interlace_method; + // Image data ff_png_mode image_mode; diff --git a/src/format/image/png.c b/src/format/image/png.c index f21b42b..3fd14d5 100644 --- a/src/format/image/png.c +++ b/src/format/image/png.c @@ -92,6 +92,7 @@ ff_result ff_png_header_handler(uint8_t *buf, size_t len, ff_png_ctx *ctx) ctx->height = h; ctx->bit_depth = buf[8]; ctx->color_type = buf[9]; + ctx->interlace_method = buf[12]; ff_dprintf("png: IHDR stored in context\n"); @@ -148,6 +149,21 @@ ff_result ff_png_data_handler(uint8_t *buf, size_t len, ff_png_ctx *ctx) return FF_RESULT_ERROR_DECOMPRESSION_FAILURE; } + ff_dprintf("png: IDAT data uncompressed successfully\n"); + + // Now we parse the uncompressed data into our pixel buffer + // However I don't understand Adam7 so interlaced images are not supported yet + if (ctx->interlace_method != 0) { + ff_dprintf("png: interlaced images are not supported yet\n"); + free(uncompressed_data); + return FF_RESULT_WARN_NO_IMPL; + } + + // Now I am very inexperienced so I'm doing what I think is right + // TODO: Review this code later + + + return FF_RESULT_WARN_NO_IMPL; } |
