summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler Luu <tluu@ti.com>2011-10-19 01:36:15 -0500
committerIliyan Malchev <malchev@google.com>2011-10-19 10:12:29 -0700
commit754078052c687f6721536009c816644c73e4f145 (patch)
treebab85785f724a4e299c6a43afbb26d070e6ad02b
parentbd90094d709a579d8d74c326269e492627be9daa (diff)
downloadjhead-ics-factoryrom-2-release.tar.gz
1. Change ExposureTime tag to rational format as defined by Exif2.2 standard 2. Update # of components for types with unknown length of -1 after parsing through list Change-Id: Ib1f65f677b2d8acad310ba8cba46efb3e21920a4 Signed-off-by: Tyler Luu <tluu@ti.com>
-rw-r--r--exif.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/exif.c b/exif.c
index a0056e0..60aec70 100644
--- a/exif.c
+++ b/exif.c
@@ -231,7 +231,7 @@ static const TagTable_t TagTable[] = {
{ TAG_CFA_PATTERN1, "CFAPattern", 0, 0},
{ TAG_BATTERY_LEVEL, "BatteryLevel", 0, 0},
{ TAG_COPYRIGHT, "Copyright", FMT_STRING, -1},
- { TAG_EXPOSURETIME, "ExposureTime", FMT_USHORT, 1},
+ { TAG_EXPOSURETIME, "ExposureTime", FMT_SRATIONAL, 1},
{ TAG_FNUMBER, "FNumber", FMT_SRATIONAL, 1},
{ TAG_IPTC_NAA, "IPTC/NAA", 0, 0},
{ TAG_EXIF_OFFSET, "ExifOffset", 0, 0},
@@ -1085,6 +1085,8 @@ static void writeExifTagAndData(int tag,
char* Buffer,
int* DirIndex,
int* DataWriteIndex) {
+ void* componentsPosition = NULL; // for saving component position
+
Put16u(Buffer+ (*DirIndex), tag); // Tag
Put16u(Buffer+(*DirIndex) + 2, format); // Format
if (format == FMT_STRING && components == -1) {
@@ -1101,6 +1103,7 @@ static void writeExifTagAndData(int tag,
}
}
Put32u(Buffer+(*DirIndex) + 4, components); // Components
+ componentsPosition = Buffer+(*DirIndex) + 4; // components # can change for lists
printf("# components: %ld", components);
if (format == FMT_STRING) {
// short strings can fit right in the long, otherwise have to
@@ -1161,6 +1164,7 @@ static void writeExifTagAndData(int tag,
}
curElement = strtok(NULL, ",");
}
+ if (components == -1) Put32u(componentsPosition, i); // update component # for unknowns
}
(*DirIndex) += 12;
}