Make XMLPacket tag custom.
This commit is contained in:
parent
cdc1624cde
commit
6d335e77eb
@ -1,4 +1,4 @@
|
||||
/* $Id: tif_dir.c,v 1.58 2005-12-09 14:46:43 dron Exp $ */
|
||||
/* $Id: tif_dir.c,v 1.59 2005-12-09 17:52:39 dron Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
@ -410,11 +410,6 @@ _TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
|
||||
va_arg(ap, uint32*),
|
||||
td->td_richtiffiptcLength);
|
||||
break;
|
||||
case TIFFTAG_XMLPACKET:
|
||||
td->td_xmlpacketLength = (uint32) va_arg(ap, uint32);
|
||||
_TIFFsetByteArray(&td->td_xmlpacketData, va_arg(ap, void*),
|
||||
td->td_xmlpacketLength);
|
||||
break;
|
||||
default: {
|
||||
const TIFFFieldInfo* fip = _TIFFFindFieldInfo(tif, tag, TIFF_ANY);
|
||||
TIFFTagValue *tv;
|
||||
@ -855,10 +850,6 @@ _TIFFVGetField(TIFF* tif, ttag_t tag, va_list ap)
|
||||
*va_arg(ap, uint32*) = td->td_richtiffiptcLength;
|
||||
*va_arg(ap, void**) = td->td_richtiffiptcData;
|
||||
break;
|
||||
case TIFFTAG_XMLPACKET:
|
||||
*va_arg(ap, uint32*) = td->td_xmlpacketLength;
|
||||
*va_arg(ap, void**) = td->td_xmlpacketData;
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
@ -1027,7 +1018,6 @@ TIFFFreeDirectory(TIFF* tif)
|
||||
CleanupField(td_profileData);
|
||||
CleanupField(td_photoshopData);
|
||||
CleanupField(td_richtiffiptcData);
|
||||
CleanupField(td_xmlpacketData);
|
||||
CleanupField(td_stripoffset);
|
||||
CleanupField(td_stripbytecount);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: tif_dir.h,v 1.21 2005-12-09 14:46:43 dron Exp $ */
|
||||
/* $Id: tif_dir.h,v 1.22 2005-12-09 17:52:39 dron Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
@ -90,8 +90,6 @@ typedef struct {
|
||||
/* IPTC parameters */
|
||||
uint32 td_richtiffiptcLength;
|
||||
void *td_richtiffiptcData;
|
||||
uint32 td_xmlpacketLength;
|
||||
void *td_xmlpacketData;
|
||||
int td_customValueCount;
|
||||
TIFFTagValue *td_customValues;
|
||||
} TIFFDirectory;
|
||||
@ -169,15 +167,6 @@ typedef struct {
|
||||
#define FIELD_PHOTOSHOP 52
|
||||
#define FIELD_RICHTIFFIPTC 53
|
||||
#define FIELD_STONITS 54
|
||||
/* unused - was FIELD_IMAGEFULLWIDTH 55 */
|
||||
/* unused - was FIELD_IMAGEFULLLENGTH 56 */
|
||||
/* unused - was FIELD_TEXTUREFORMAT 57 */
|
||||
/* unused - was FIELD_WRAPMODES 58 */
|
||||
/* unused - was FIELD_FOVCOT 59 */
|
||||
/* unused - was FIELD_MATRIX_WORLDTOSCREEN 60 */
|
||||
/* unused - was FIELD_MATRIX_WORLDTOCAMERA 61 */
|
||||
/* unused - was FIELD_COPYRIGHT 62 */
|
||||
#define FIELD_XMLPACKET 63
|
||||
/* FIELD_CUSTOM (see tiffio.h) 65 */
|
||||
/* end of support for well-known tags; codec-private tags follow */
|
||||
#define FIELD_CODEC 66 /* base of codec-private tags */
|
||||
@ -385,7 +374,7 @@ static const TIFFFieldInfo tiffFieldInfo[] = {
|
||||
/* XXX temporarily accept LONG for backwards compatibility */
|
||||
{ TIFFTAG_REFERENCEBLACKWHITE, 6, 6, TIFF_LONG, FIELD_CUSTOM,
|
||||
1, 0, "ReferenceBlackWhite" },
|
||||
{ TIFFTAG_XMLPACKET, -1,-3, TIFF_BYTE, FIELD_XMLPACKET,
|
||||
{ TIFFTAG_XMLPACKET, -1,-3, TIFF_BYTE, FIELD_CUSTOM,
|
||||
0, 1, "XMLPacket" },
|
||||
/* begin SGI tags */
|
||||
{ TIFFTAG_MATTEING, 1, 1, TIFF_SHORT, FIELD_EXTRASAMPLES,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: tif_print.c,v 1.29 2005-12-07 18:05:40 dron Exp $ */
|
||||
/* $Id: tif_print.c,v 1.30 2005-12-09 17:52:40 dron Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
@ -62,9 +62,9 @@ static const char *orientNames[] = {
|
||||
|
||||
static void
|
||||
_TIFFPrintField(FILE* fd, const TIFFFieldInfo *fip,
|
||||
uint16 value_count, void *raw_data)
|
||||
uint32 value_count, void *raw_data)
|
||||
{
|
||||
int j;
|
||||
uint32 j;
|
||||
|
||||
fprintf(fd, " %s: ", fip->field_name);
|
||||
|
||||
@ -112,24 +112,35 @@ _TIFFPrintField(FILE* fd, const TIFFFieldInfo *fip,
|
||||
}
|
||||
|
||||
static int
|
||||
_TIFFPrettyPrintField(TIFF* tif, FILE* fd, ttag_t tag, void *raw_data)
|
||||
_TIFFPrettyPrintField(TIFF* tif, FILE* fd, ttag_t tag,
|
||||
uint32 value_count, void *raw_data)
|
||||
{
|
||||
TIFFDirectory *td = &tif->tif_dir;
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
case TIFFTAG_REFERENCEBLACKWHITE:
|
||||
{
|
||||
int i;
|
||||
{
|
||||
uint16 i;
|
||||
|
||||
fprintf(fd, " Reference Black/White:\n");
|
||||
for (i = 0; i < td->td_samplesperpixel; i++)
|
||||
fprintf(fd, " %2d: %5g %5g\n", i,
|
||||
((float *)raw_data)[2*i+0],
|
||||
((float *)raw_data)[2*i+1]);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
case TIFFTAG_XMLPACKET:
|
||||
{
|
||||
uint32 i;
|
||||
|
||||
fprintf(fd, " XMLPacket (XMP Metadata):\n" );
|
||||
for(i = 0; i < value_count; i++)
|
||||
fputc(((char *)raw_data)[i], fd);
|
||||
fprintf( fd, "\n" );
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -146,8 +157,8 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
|
||||
uint16 i;
|
||||
long l, n;
|
||||
|
||||
fprintf(fd, "TIFF Directory at offset 0x%lx\n",
|
||||
(unsigned long)tif->tif_diroff);
|
||||
fprintf(fd, "TIFF Directory at offset 0x%lx (%lu)\n",
|
||||
(unsigned long)tif->tif_diroff, (unsigned long)tif->tif_diroff);
|
||||
if (TIFFFieldSet(tif,FIELD_SUBFILETYPE)) {
|
||||
fprintf(fd, " Subfile Type:");
|
||||
sep = " ";
|
||||
@ -477,12 +488,6 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
|
||||
fprintf(fd, " %5lu", (long) td->td_subifd[i]);
|
||||
fputc('\n', fd);
|
||||
}
|
||||
if (TIFFFieldSet(tif,FIELD_XMLPACKET)) {
|
||||
fprintf(fd, " XMLPacket (XMP Metadata):\n" );
|
||||
for( i=0; i < td->td_xmlpacketLength; i++ )
|
||||
fputc( ((char *)td->td_xmlpacketData)[i], fd );
|
||||
fprintf( fd, "\n" );
|
||||
}
|
||||
|
||||
/*
|
||||
** Custom tag support.
|
||||
@ -539,12 +544,10 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
|
||||
* _TIFFPrettyPrintField() fall down and print it as any other
|
||||
* tag.
|
||||
*/
|
||||
if (_TIFFPrettyPrintField(tif, fd, tag, raw_data))
|
||||
if (_TIFFPrettyPrintField(tif, fd, tag, value_count, raw_data))
|
||||
continue;
|
||||
else
|
||||
{
|
||||
_TIFFPrintField(fd, fip, value_count, raw_data);
|
||||
}
|
||||
|
||||
if(mem_alloc)
|
||||
_TIFFfree(raw_data);
|
||||
|
Loading…
Reference in New Issue
Block a user