diff options
author | Jan Darowski <jan.darowski@gmail.com> | 2015-03-14 15:35:47 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-03-15 15:47:23 -0700 |
commit | 7d37a3f5a65d03df917e63614a76fb95e8bc966f (patch) | |
tree | 9276130d4adbcd98fddc2df066167271a9eaec44 /qthelper.cpp | |
parent | 838b4500662f7b573074fcc0cf13578cd9dbf33f (diff) | |
download | subsurface-7d37a3f5a65d03df917e63614a76fb95e8bc966f.tar.gz |
Refactored image timestamp checking.
Seperated getting image timestamp from picture_load_exif_data() and
ShiftImageTimesDialog::syncCameraClicked() into picture_get_timestamp()
and seperated checking timestamp from dive_create_picture() to
dive_check_picture_time().
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qthelper.cpp')
-rw-r--r-- | qthelper.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/qthelper.cpp b/qthelper.cpp index 104ed00f1..6b2f76eba 100644 --- a/qthelper.cpp +++ b/qthelper.cpp @@ -337,7 +337,7 @@ extern "C" xsltStylesheetPtr get_stylesheet(const char *name) return xslt; } -extern "C" void picture_load_exif_data(struct picture *p, timestamp_t *timestamp) +extern "C" void picture_load_exif_data(struct picture *p) { EXIFInfo exif; memblock mem; @@ -346,7 +346,6 @@ extern "C" void picture_load_exif_data(struct picture *p, timestamp_t *timestamp goto picture_load_exit; if (exif.parseFrom((const unsigned char *)mem.buffer, (unsigned)mem.size) != PARSE_EXIF_SUCCESS) goto picture_load_exit; - *timestamp = exif.epoch(); p->longitude.udeg= lrint(1000000.0 * exif.GeoLocation.Longitude); p->latitude.udeg = lrint(1000000.0 * exif.GeoLocation.Latitude); @@ -355,6 +354,22 @@ picture_load_exit: return; } +extern "C" void picture_get_timestamp(char *filename, timestamp_t *t) +{ + EXIFInfo exif; + memblock mem; + int retval; + + if (readfile(filename, &mem) <= 0) + return; + retval = exif.parseFrom((const unsigned char *)mem.buffer, (unsigned)mem.size); + free(mem.buffer); + if (retval != PARSE_EXIF_SUCCESS) + return; + *t = exif.epoch(); + return; +} + extern "C" const char *system_default_directory(void) { static char filename[PATH_MAX]; |