diff options
author | Marcus Meissner <marcus@jet.franken.de> | 2010-08-19 20:31:09 +0000 |
---|---|---|
committer | Marcus Meissner <marcus@jet.franken.de> | 2010-08-19 20:31:09 +0000 |
commit | 4c9c0a2f539f04526e6f984a622c3340fc417a46 (patch) | |
tree | 80bfe44748b3171d4b8180df28824f87ef9914e3 | |
parent | f0592b378b171c7de7f59a979d7c727bf62529d2 (diff) | |
download | libgphoto2-4c9c0a2f539f04526e6f984a622c3340fc417a46.tar.gz |
make libjpeg presence conditional
git-svn-id: https://svn.code.sf.net/p/gphoto/code/branches/libgphoto2-2_4/libgphoto2@13282 67ed7778-7388-44ab-90cf-0a291f65f57c
-rw-r--r-- | camlibs/ax203/ax203.c | 19 | ||||
-rw-r--r-- | camlibs/ax203/ax203_compress_jpeg.c | 4 | ||||
-rw-r--r-- | camlibs/ax203/jpeg_memsrcdest.c | 2 |
3 files changed, 23 insertions, 2 deletions
diff --git a/camlibs/ax203/ax203.c b/camlibs/ax203/ax203.c index a251d4631..86af85aaa 100644 --- a/camlibs/ax203/ax203.c +++ b/camlibs/ax203/ax203.c @@ -34,7 +34,9 @@ #include <gphoto2/gphoto2-result.h> #include "ax203.h" +#ifdef HAVE_LIBJPEG #include "jpeg_memsrcdest.h" +#endif static const struct eeprom_info { const char *name; @@ -1028,10 +1030,12 @@ ax203_decode_image(Camera *camera, char *src, int src_size, int **dest) int ret; unsigned int x, y, width, height; unsigned char *components[3]; +#ifdef HAVE_LIBJPEG struct jpeg_decompress_struct dinfo; struct jpeg_error_mgr jderr; JSAMPLE row[camera->pl->width * 3]; JSAMPROW row_pointer[1] = { row }; +#endif switch (camera->pl->compression_version) { case AX203_COMPRESSION_YUV: @@ -1086,6 +1090,7 @@ ax203_decode_image(Camera *camera, char *src, int src_size, int **dest) } return GP_OK; case AX3003_COMPRESSION_JPEG: +#ifdef HAVE_LIBJPEG dinfo.err = jpeg_std_error (&jderr); jpeg_create_decompress (&dinfo); jpeg_mem_src (&dinfo, (unsigned char *)src, src_size); @@ -1115,6 +1120,11 @@ ax203_decode_image(Camera *camera, char *src, int src_size, int **dest) jpeg_finish_decompress (&dinfo); jpeg_destroy_decompress (&dinfo); return GP_OK; +#else + gp_log(GP_LOG_ERROR,"ax203", "jpeg decompression not supported - no libjpeg during build"); + return GP_ERROR_NOT_SUPPORTED; +#endif + break; } #endif /* Never reached */ @@ -1126,13 +1136,16 @@ static int ax203_encode_image(Camera *camera, int **src, char *dest, int dest_size) { #ifdef HAVE_GD - int x, y, size = ax203_filesize (camera); + int size = ax203_filesize (camera); +#ifdef HAVE_LIBJPEG + int x, y; struct jpeg_compress_struct cinfo; struct jpeg_error_mgr jcerr; JOCTET *jpeg_dest = NULL; unsigned long jpeg_size = 0; JSAMPLE row[camera->pl->width * 3]; JSAMPROW row_pointer[1] = { row }; +#endif if (dest_size < size) return GP_ERROR_FIXED_LIMIT_EXCEEDED; @@ -1152,6 +1165,7 @@ ax203_encode_image(Camera *camera, int **src, char *dest, int dest_size) camera->pl->width, camera->pl->height); case AX3003_COMPRESSION_JPEG: +#ifdef HAVE_LIBJPEG cinfo.err = jpeg_std_error (&jcerr); jpeg_create_compress (&cinfo); jpeg_mem_dest (&cinfo, &jpeg_dest, &jpeg_size); @@ -1184,6 +1198,9 @@ ax203_encode_image(Camera *camera, int **src, char *dest, int dest_size) /* Round size up to a multiple of 256 because of ax3003 abfs size granularity. */ return (jpeg_size + 0xff) & ~0xff; +#else + return GP_ERROR_NOT_SUPPORTED; +#endif } /* Never reached */ #endif diff --git a/camlibs/ax203/ax203_compress_jpeg.c b/camlibs/ax203/ax203_compress_jpeg.c index 641077800..177016651 100644 --- a/camlibs/ax203/ax203_compress_jpeg.c +++ b/camlibs/ax203/ax203_compress_jpeg.c @@ -27,9 +27,11 @@ #endif #include "ax203.h" +#ifdef HAVE_LIBJPEG #include "jpeg_memsrcdest.h" +#endif -#ifdef HAVE_GD +#if defined(HAVE_GD) && defined(HAVE_LIBJPEG) static int locate_tables_n_write(JOCTET *jpeg, int jpeg_size, JOCTET table_type, uint8_t *outbuf, int *outc) diff --git a/camlibs/ax203/jpeg_memsrcdest.c b/camlibs/ax203/jpeg_memsrcdest.c index a2f79df94..6fcb6c44c 100644 --- a/camlibs/ax203/jpeg_memsrcdest.c +++ b/camlibs/ax203/jpeg_memsrcdest.c @@ -17,6 +17,7 @@ /* this is not a core library module, so it doesn't define JPEG_INTERNALS */ #include <stdlib.h> #include <stdio.h> +#ifdef HAVE_LIBJPEG #include <jpeglib.h> #include <jerror.h> #include "jpeg_memsrcdest.h" @@ -302,3 +303,4 @@ jpeg_mem_dest (j_compress_ptr cinfo, unsigned char ** outbuffer, } #endif +#endif |