summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfwarmerdam <fwarmerdam>2012-06-06 04:58:00 +0000
committerfwarmerdam <fwarmerdam>2012-06-06 04:58:00 +0000
commit88e3979023c5c61cfdc92107a3a88d2b590d3b77 (patch)
tree5be393d1aea9da6490f451627b792a88ffe678be
parent975b9becc3284aae4b53cb5468d8b4fa18a0adbc (diff)
downloadlibtiff-88e3979023c5c61cfdc92107a3a88d2b590d3b77.tar.gz
add TIFFCreate{Custom,EXIF}Directory() functions
-rw-r--r--ChangeLog8
-rw-r--r--libtiff/tif_dir.c31
-rw-r--r--libtiff/tiffio.h5
3 files changed, 41 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 0764bc0a..32a07efc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2012-06-05 Frank Warmerdam <warmerdam@google.com>
+ * tests/custom_dir.c: Add testing of EXIF and custom directory
+ reading and writing.
+
+ * libtiff/tif_dir.c, libtiff/tiffio.h: Add TIFFCreateCustomDirectory()
+ and TIFFCreateEXIFDirectory() functions.
+
* libtiff/tif_dir.c: Remove FIELD_CUSTOM handling for PAGENUMBER,
HALFTONEHINTS, and YCBCRSUBSAMPLING. Implement DOTRANGE differently.
This is to avoid using special TIFFGetField/TIFFSetField rules for
@@ -9,7 +15,7 @@
* libtiff/tif_jpeg.c: Remove code for fixing up h_sampling and v_sampling
in JPEGPreDecode(). If a fixup will be done it needs to be done sooner
- in JPEGFixupTagsSubsampling() or else buffer sized may be wrong.
+ in JPEGFixupTagsSubsampling() or else buffer sized may be wrong.
2012-06-01 Frank Warmerdam <warmerdam@google.com>
diff --git a/libtiff/tif_dir.c b/libtiff/tif_dir.c
index fc0738b8..061de3e1 100644
--- a/libtiff/tif_dir.c
+++ b/libtiff/tif_dir.c
@@ -1,4 +1,4 @@
-/* $Id: tif_dir.c,v 1.111 2012-06-06 04:56:01 fwarmerdam Exp $ */
+/* $Id: tif_dir.c,v 1.112 2012-06-06 04:58:00 fwarmerdam Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -1237,6 +1237,35 @@ TIFFCreateDirectory(TIFF* tif)
return 0;
}
+int
+TIFFCreateCustomDirectory(TIFF* tif, const TIFFFieldArray* infoarray)
+{
+ TIFFDefaultDirectory(tif);
+
+ /*
+ * Reset the field definitions to match the application provided list.
+ * Hopefully TIFFDefaultDirectory() won't have done anything irreversable
+ * based on it's assumption this is an image directory.
+ */
+ _TIFFSetupFields(tif, infoarray);
+
+ tif->tif_diroff = 0;
+ tif->tif_nextdiroff = 0;
+ tif->tif_curoff = 0;
+ tif->tif_row = (uint32) -1;
+ tif->tif_curstrip = (uint32) -1;
+
+ return 0;
+}
+
+int
+TIFFCreateEXIFDirectory(TIFF* tif)
+{
+ const TIFFFieldArray* exifFieldArray;
+ exifFieldArray = _TIFFGetExifFields();
+ return TIFFCreateCustomDirectory(tif, exifFieldArray);
+}
+
/*
* Setup a default directory structure.
*/
diff --git a/libtiff/tiffio.h b/libtiff/tiffio.h
index 6ca74343..c88ca190 100644
--- a/libtiff/tiffio.h
+++ b/libtiff/tiffio.h
@@ -1,4 +1,4 @@
-/* $Id: tiffio.h,v 1.89 2012-02-18 16:20:26 bfriesen Exp $ */
+/* $Id: tiffio.h,v 1.90 2012-06-06 04:58:00 fwarmerdam Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -392,6 +392,8 @@ extern int TIFFSetupStrips(TIFF *);
extern int TIFFWriteCheck(TIFF*, int, const char *);
extern void TIFFFreeDirectory(TIFF*);
extern int TIFFCreateDirectory(TIFF*);
+extern int TIFFCreateCustomDirectory(TIFF*,const TIFFFieldArray*);
+extern int TIFFCreateEXIFDirectory(TIFF*);
extern int TIFFLastDirectory(TIFF*);
extern int TIFFSetDirectory(TIFF*, uint16);
extern int TIFFSetSubDirectory(TIFF*, uint64);
@@ -400,6 +402,7 @@ extern int TIFFSetField(TIFF*, uint32, ...);
extern int TIFFVSetField(TIFF*, uint32, va_list);
extern int TIFFUnsetField(TIFF*, uint32);
extern int TIFFWriteDirectory(TIFF *);
+extern int TIFFWriteCustomDirectory(TIFF *, uint64 *);
extern int TIFFCheckpointDirectory(TIFF *);
extern int TIFFRewriteDirectory(TIFF *);