Now compiles even when libiptc is missing.

Original commit message from CVS:
Now compiles even when libiptc is missing.
This commit is contained in:
Edgard Lima 2007-12-04 17:20:25 +00:00
parent cf4c5c9655
commit f44ca529d7
3 changed files with 26 additions and 3 deletions

View file

@ -1,3 +1,11 @@
2007-12-04 Edgard Lima <edgard.lima@indt.org.br>
* ext/metadata/metadatamuxjpeg.c: (metadatamux_wrap_chunk),
(metadatamux_jpeg_lazy_update):
* ext/metadata/metadataparsejpeg.c: (metadataparse_jpeg_parse),
(metadataparse_jpeg_reading):
Now compiles even when libiptc is missing.
2007-12-04 Edgard Lima <edgard.lima@indt.org.br> 2007-12-04 Edgard Lima <edgard.lima@indt.org.br>
* ext/metadata/gstmetadatamux.c: * ext/metadata/gstmetadatamux.c:

View file

@ -45,7 +45,9 @@
#include <string.h> #include <string.h>
#ifdef HAVE_IPTC
#include <libiptcdata/iptc-jpeg.h> #include <libiptcdata/iptc-jpeg.h>
#endif
static int static int
metadatamux_jpeg_reading (JpegMuxData * jpeg_data, guint8 ** buf, metadatamux_jpeg_reading (JpegMuxData * jpeg_data, guint8 ** buf,
@ -55,8 +57,8 @@ metadatamux_jpeg_reading (JpegMuxData * jpeg_data, guint8 ** buf,
#define READ(buf, size) ( (size)--, *((buf)++) ) #define READ(buf, size) ( (size)--, *((buf)++) )
static void static void
metadatamux_wrap_chunk (MetadataChunk * chunk, guint8 * buf, guint32 buf_size, metadatamux_wrap_chunk (MetadataChunk * chunk, const guint8 * buf,
guint8 a, guint8 b) guint32 buf_size, guint8 a, guint8 b)
{ {
guint8 *data = g_new (guint8, 4 + buf_size + chunk->size); guint8 *data = g_new (guint8, 4 + buf_size + chunk->size);
@ -89,6 +91,7 @@ metadatamux_jpeg_lazy_update (JpegMuxData * jpeg_data)
has_exif = TRUE; has_exif = TRUE;
break; break;
case MD_CHUNK_IPTC: case MD_CHUNK_IPTC:
#ifdef HAVE_IPTC
{ {
unsigned int size = jpeg_data->inject_chunks->chunk[i].size + 256; unsigned int size = jpeg_data->inject_chunks->chunk[i].size + 256;
unsigned char *buf = g_new (guint8, size); unsigned char *buf = g_new (guint8, size);
@ -108,6 +111,7 @@ metadatamux_jpeg_lazy_update (JpegMuxData * jpeg_data)
/* FIXME: remove entry from list */ /* FIXME: remove entry from list */
} }
} }
#endif /* #ifdef HAVE_IPTC */
break; break;
case MD_CHUNK_XMP: case MD_CHUNK_XMP:
{ {

View file

@ -45,7 +45,9 @@
#include <string.h> #include <string.h>
#ifdef HAVE_IPTC
#include <libiptcdata/iptc-jpeg.h> #include <libiptcdata/iptc-jpeg.h>
#endif
static int static int
metadataparse_jpeg_reading (JpegParseData * jpeg_data, guint8 ** buf, metadataparse_jpeg_reading (JpegParseData * jpeg_data, guint8 ** buf,
@ -56,9 +58,11 @@ static int
metadataparse_jpeg_exif (JpegParseData * jpeg_data, guint8 ** buf, metadataparse_jpeg_exif (JpegParseData * jpeg_data, guint8 ** buf,
guint32 * bufsize, guint8 ** next_start, guint32 * next_size); guint32 * bufsize, guint8 ** next_start, guint32 * next_size);
#ifdef HAVE_IPTC
static int static int
metadataparse_jpeg_iptc (JpegParseData * jpeg_data, guint8 ** buf, metadataparse_jpeg_iptc (JpegParseData * jpeg_data, guint8 ** buf,
guint32 * bufsize, guint8 ** next_start, guint32 * next_size); guint32 * bufsize, guint8 ** next_start, guint32 * next_size);
#endif
static int static int
metadataparse_jpeg_xmp (JpegParseData * jpeg_data, guint8 ** buf, metadataparse_jpeg_xmp (JpegParseData * jpeg_data, guint8 ** buf,
@ -151,9 +155,11 @@ metadataparse_jpeg_parse (JpegParseData * jpeg_data, guint8 * buf,
next_size); next_size);
break; break;
case JPEG_PARSE_IPTC: case JPEG_PARSE_IPTC:
#ifdef HAVE_IPTC
ret = ret =
metadataparse_jpeg_iptc (jpeg_data, &buf, bufsize, next_start, metadataparse_jpeg_iptc (jpeg_data, &buf, bufsize, next_start,
next_size); next_size);
#endif
break; break;
case JPEG_PARSE_XMP: case JPEG_PARSE_XMP:
ret = ret =
@ -320,7 +326,9 @@ metadataparse_jpeg_reading (JpegParseData * jpeg_data, guint8 ** buf,
} }
} }
} }
} else if (mark[1] == 0xED) { /* may be it is photoshop and may be there is iptc */ }
#ifdef HAVE_IPTC
else if (mark[1] == 0xED) { /* may be it is photoshop and may be there is iptc */
if (chunk_size >= 16) { /* size2 "Photoshop 3.0" */ if (chunk_size >= 16) { /* size2 "Photoshop 3.0" */
if (*bufsize < 14) { if (*bufsize < 14) {
@ -350,6 +358,7 @@ metadataparse_jpeg_reading (JpegParseData * jpeg_data, guint8 ** buf,
} }
} }
} }
#endif /* #ifdef HAVE_IPTC */
/* just set jump sise */ /* just set jump sise */
jpeg_data->read = chunk_size - 2; jpeg_data->read = chunk_size - 2;
@ -388,6 +397,7 @@ metadataparse_jpeg_exif (JpegParseData * jpeg_data, guint8 ** buf,
} }
#ifdef HAVE_IPTC
static int static int
metadataparse_jpeg_iptc (JpegParseData * jpeg_data, guint8 ** buf, metadataparse_jpeg_iptc (JpegParseData * jpeg_data, guint8 ** buf,
guint32 * bufsize, guint8 ** next_start, guint32 * next_size) guint32 * bufsize, guint8 ** next_start, guint32 * next_size)
@ -439,6 +449,7 @@ metadataparse_jpeg_iptc (JpegParseData * jpeg_data, guint8 ** buf,
return ret; return ret;
} }
#endif
static int static int
metadataparse_jpeg_xmp (JpegParseData * jpeg_data, guint8 ** buf, metadataparse_jpeg_xmp (JpegParseData * jpeg_data, guint8 ** buf,