diff options
author | Stefan Kost <ensonic@users.sf.net> | 2009-06-10 11:15:01 +0300 |
---|---|---|
committer | Stefan Kost <ensonic@users.sf.net> | 2009-06-22 13:33:32 +0300 |
commit | f096d6406e9b5e00fa21390224c2bfcc3be8f135 (patch) | |
tree | ad34f9558132536b210e01d3e44da32b66b24fba /ext/metadata | |
parent | 1cf9f2d497cf882a179cdfd677900c690cef58ee (diff) | |
download | gst-plugins-bad-f096d6406e9b5e00fa21390224c2bfcc3be8f135.tar.gz gst-plugins-bad-f096d6406e9b5e00fa21390224c2bfcc3be8f135.tar.bz2 gst-plugins-bad-f096d6406e9b5e00fa21390224c2bfcc3be8f135.zip |
metadata: fix conversion of geo coordinates
Coordinate conversion has been verified with exiv2 and some webpages.
Minutes wher totally off and seconds were not used at all.
Diffstat (limited to 'ext/metadata')
-rw-r--r-- | ext/metadata/metadataexif.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/ext/metadata/metadataexif.c b/ext/metadata/metadataexif.c index 58d83e2d..0769dab4 100644 --- a/ext/metadata/metadataexif.c +++ b/ext/metadata/metadataexif.c @@ -694,16 +694,16 @@ metadataparse_exif_content_foreach_entry_func (ExifEntry * entry, /* DDD - degrees */ value = (gdouble) rt->numerator / (gdouble) rt->denominator; + GST_DEBUG ("deg: %lu / %lu", rt->numerator, rt->denominator); rt++; /* MM - minutes and SS - seconds */ - if (rt->numerator % rt->denominator) { - value += (gdouble) rt->numerator / (gdouble) rt->denominator; - } else { - value += rt->numerator / rt->denominator; - rt++; - value += rt->numerator / rt->denominator; - } + GST_DEBUG ("min: %lu / %lu", rt->numerator, rt->denominator); + value += (gdouble) rt->numerator / ((gdouble) rt->denominator * 60.0); + rt++; + GST_DEBUG ("sec: %lu / %lu", rt->numerator, rt->denominator); + value += + (gdouble) rt->numerator / ((gdouble) rt->denominator * 3600.0); /* apply sign */ if (entry->tag == EXIF_TAG_GPS_LATITUDE) { @@ -1049,17 +1049,24 @@ metadatamux_exif_for_each_tag_in_list (const GstTagList * list, const ExifTag ref_tag = entry->tag == EXIF_TAG_GPS_LATITUDE ? EXIF_TAG_GPS_LATITUDE_REF : EXIF_TAG_GPS_LONGITUDE_REF; + /* DDD - degrees */ rt->numerator = (gulong) v; rt->denominator = 1; + GST_DEBUG ("deg: %lf : %lu / %lu", v, rt->numerator, rt->denominator); v -= rt->numerator; rt++; - rt->numerator = (gulong) (0.5 + v * 100.0); - rt->denominator = 100; + /* MM - minutes */ + rt->numerator = (gulong) (v * 60.0); + rt->denominator = 1; + GST_DEBUG ("min: %lf : %lu / %lu", v, rt->numerator, rt->denominator); + v -= ((gdouble) rt->numerator / 60.0); rt++; - rt->numerator = 0; + /* SS - seconds */ + rt->numerator = (gulong) (0.5 + v * 3600.0); rt->denominator = 1; + GST_DEBUG ("sec: %lf : %lu / %lu", v, rt->numerator, rt->denominator); if (entry->tag == EXIF_TAG_GPS_LONGITUDE) { GST_DEBUG ("longitude : %lf", value); |