mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Dive pictures: If EXIF data couldn't be parsed, use creation date
This is a preparation for supporting videos. Some video formats may not possess such meta data, or we may not yet be able to parse them. In such a case, use the file creation date. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
d9b502f0c7
commit
c896938f7a
1 changed files with 6 additions and 2 deletions
|
@ -402,8 +402,12 @@ static int parseExif(const QString &filename, easyexif::EXIFInfo &exif)
|
|||
extern "C" timestamp_t picture_get_timestamp(const char *filename)
|
||||
{
|
||||
easyexif::EXIFInfo exif;
|
||||
if (parseExif(localFilePath(QString(filename)), exif) != PARSE_EXIF_SUCCESS)
|
||||
return 0;
|
||||
if (parseExif(localFilePath(QString(filename)), exif) != PARSE_EXIF_SUCCESS) {
|
||||
// If we couldn't parse EXIF data, use file creation date.
|
||||
// TODO: QFileInfo::created is deprecated in newer Qt versions.
|
||||
QDateTime created = QFileInfo(QString(filename)).created();
|
||||
return created.toSecsSinceEpoch();
|
||||
}
|
||||
return exif.epoch();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue