mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
838b450066
commit
7d37a3f5a6
4 changed files with 60 additions and 22 deletions
19
qthelper.cpp
19
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];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue