Skip to content

Commit

Permalink
Add GPSAltitude and GPSAltitudeRef EXIF tag.
Browse files Browse the repository at this point in the history
Change-Id: I29fec625f3d3c796caf8ca6197eb3f4e77f08270
  • Loading branch information
Wu-cheng Li committed May 21, 2010
1 parent 70059dd commit 1ed8197
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion gpsinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static TagTable_t GpsTags[]= {
{ 0x03, "GPSLongitudeRef", FMT_STRING, 2},
{ 0x04, "GPSLongitude", FMT_URATIONAL, 3},
{ 0x05, "GPSAltitudeRef", FMT_BYTE, 1},
{ 0x06, "GPSAltitude", FMT_SRATIONAL, 1},
{ 0x06, "GPSAltitude", FMT_URATIONAL, 1},
{ 0x07, "GPSTimeStamp", FMT_SRATIONAL, 3},
{ 0x08, "GPSSatellites", FMT_STRING, -1},
{ 0x09, "GPSStatus", FMT_STRING, 2},
Expand Down Expand Up @@ -247,11 +247,14 @@ void ProcessGpsInfo(unsigned char * DirStart, int ByteCountUnused, unsigned char

case TAG_GPS_ALT_REF:
ImageInfo.GpsAlt[0] = (char)(ValuePtr[0] ? '-' : ' ');
ImageInfo.GpsAltRef = (char)ValuePtr[0];
break;

case TAG_GPS_ALT:
sprintf(ImageInfo.GpsAlt + 1, "%.2fm",
ConvertAnyFormat(ValuePtr, Format));
ImageInfo.GpsAltRaw.num = Get32u(ValuePtr);
ImageInfo.GpsAltRaw.denom = Get32u(4+(char *)ValuePtr);
break;

case TAG_GPS_TIMESTAMP:
Expand Down
2 changes: 2 additions & 0 deletions jhead.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ typedef struct {
char GpsLongRaw[31];
char GpsLongRef[2];
char GpsAlt[20];
rat_t GpsAltRaw;
char GpsAltRef;
// gps-datestamp is 11 bytes ascii in EXIF 2.2
char GpsDateStamp[11];
char GpsTimeStamp[11];
Expand Down
3 changes: 2 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,8 @@ static jstring getAttributes(JNIEnv *env, jobject jobj, jstring jfilename)
if (bufLen == 0) return NULL;
}
if (ImageInfo.GpsAlt[0]) {
bufLen = addKeyValueString(&buf, bufLen, "GPSAltitude", ImageInfo.GpsAlt);
bufLen = addKeyValueRational(&buf, bufLen, "GPSAltitude", ImageInfo.GpsAltRaw);
bufLen = addKeyValueInt(&buf, bufLen, "GPSAltitudeRef", ImageInfo.GpsAltRef);
if (bufLen == 0) return NULL;
}
if (ImageInfo.GpsDateStamp[0]) {
Expand Down

0 comments on commit 1ed8197

Please sign in to comment.