summaryrefslogtreecommitdiffstats
path: root/core/dive.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-03-19 20:20:42 +0100
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2018-04-01 16:04:48 +0300
commit66b71c60a0980a1490be3bdacb1fdfa9dcca0c48 (patch)
tree92bd4485c5903a70be97ebb01328613cb4e9e14e /core/dive.c
parent9b2482aca9bed6dc512f52131b54b4db915f549c (diff)
downloadsubsurface-66b71c60a0980a1490be3bdacb1fdfa9dcca0c48.tar.gz
Dive pictures: use get_metadata() in dive_create_picture()
Thus, metadata has to be only read once and the picture_load_exif_data() function can be removed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/dive.c')
-rw-r--r--core/dive.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/core/dive.c b/core/dive.c
index ab033858e..1a26ac5d7 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -3780,16 +3780,18 @@ bool picture_check_valid(const char *filename, int shift_time)
void dive_create_picture(struct dive *dive, const char *filename, int shift_time, bool match_all)
{
- timestamp_t timestamp = picture_get_timestamp(filename);
+ struct metadata metadata;
+ get_metadata(filename, &metadata);
if (!new_picture_for_dive(dive, filename))
return;
- if (!match_all && !dive_check_picture_time(dive, shift_time, timestamp))
+ if (!match_all && !dive_check_picture_time(dive, shift_time, metadata.timestamp))
return;
struct picture *picture = alloc_picture();
picture->filename = strdup(filename);
- picture->offset.seconds = timestamp - dive->when + shift_time;
- picture_load_exif_data(picture);
+ picture->offset.seconds = metadata.timestamp - dive->when + shift_time;
+ picture->longitude = metadata.longitude;
+ picture->latitude = metadata.latitude;
dive_add_picture(dive, picture);
dive_set_geodata_from_picture(dive, picture);