From 5e753c35a3ef921069eb357b576cc80761f8cbea Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Sun, 24 Nov 2024 16:23:04 +0100 Subject: Add support to read jpeg version --- src/djpeg.h | 1 + src/jpeg.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/djpeg.h b/src/djpeg.h index 32419e4b..0c466858 100644 --- a/src/djpeg.h +++ b/src/djpeg.h @@ -11,6 +11,7 @@ extern "C" { void *a_Jpeg_new(DilloImage *Image, DilloUrl *url, int version); void a_Jpeg_callback(int Op, void *data); +const char *a_Jpeg_version(void); #ifdef __cplusplus diff --git a/src/jpeg.c b/src/jpeg.c index 59234d1d..fb9e0ca5 100644 --- a/src/jpeg.c +++ b/src/jpeg.c @@ -2,6 +2,7 @@ * File: jpeg.c * * Copyright (C) 2000-2007 Jorge Arellano Cid + * Copyright (C) 2024 Rodrigo Arias Mallo * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -232,6 +233,21 @@ void a_Jpeg_callback(int Op, void *data) } } +const char *a_Jpeg_version(void) +{ +#define QUOTE(x) #x +#define STR(x) QUOTE(x) + +#if defined(LIBJPEG_TURBO_VERSION) + return STR(LIBJPEG_TURBO_VERSION); +#else + return STR(JPEG_LIB_VERSION); +#endif + +#undef STR +#undef QUOTE +} + /** * Receive and process new chunks of JPEG image data */ @@ -405,5 +421,6 @@ static void Jpeg_write(DilloJpeg *jpeg, void *Buf, uint_t BufSize) void *a_Jpeg_new() { return 0; } void a_Jpeg_callback() { return; } +const char *a_Jpeg_version(void) { return NULL; } #endif /* ENABLE_JPEG */ -- cgit v1.2.3