MythTV  master
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
PictureMetaData Class Reference

Reads Exif metadata from a picture using libexiv2. More...

Inheritance diagram for PictureMetaData:
Inheritance graph
[legend]
Collaboration diagram for PictureMetaData:
Collaboration graph
[legend]

Public Member Functions

 PictureMetaData (const QString &filePath)
 Constructor. Reads metadata from image. More...
 
 ~PictureMetaData () override=default
 
bool IsValid () override
 
QStringList GetAllTags () override
 Returns all metadata tags. More...
 
int GetOrientation (bool *exists=nullptr) override
 Read Exif orientation. More...
 
QDateTime GetOriginalDateTime (bool *exists=nullptr) override
 Read Exif timestamp of image capture. More...
 
QString GetComment (bool *exists=nullptr) override
 Read Exif comments from metadata. More...
 

Protected Member Functions

std::string GetTag (const QString &key, bool *exists=nullptr)
 Read a single Exif metadata tag. More...
 

Static Protected Member Functions

static QString DecodeComment (std::string rawValue)
 Decodes charset of UserComment. More...
 

Protected Attributes

Exiv2::Image::UniquePtr m_image
 
Exiv2::ExifData m_exifData
 

Additional Inherited Members

Detailed Description

Reads Exif metadata from a picture using libexiv2.

Definition at line 260 of file imagemetadata.cpp.

Constructor & Destructor Documentation

◆ PictureMetaData()

PictureMetaData::PictureMetaData ( const QString &  filePath)
explicit

Constructor. Reads metadata from image.

Parameters
filePathAbsolute image path

Definition at line 287 of file imagemetadata.cpp.

◆ ~PictureMetaData()

PictureMetaData::~PictureMetaData ( )
overridedefault

Member Function Documentation

◆ IsValid()

bool PictureMetaData::IsValid ( )
inlineoverridevirtual

Implements ImageMetaData.

Definition at line 266 of file imagemetadata.cpp.

Referenced by GetAllTags(), GetTag(), and PictureMetaData().

◆ GetAllTags()

QStringList PictureMetaData::GetAllTags ( )
overridevirtual

Returns all metadata tags.

Ignores "Exif.Image.PrintImageMatching" and lengthy tag values, which are probably proprietary/binary

Returns
List of encoded strings
See also
ImageMetaData::FromString()

Implements ImageMetaData.

Definition at line 317 of file imagemetadata.cpp.

◆ GetOrientation()

int PictureMetaData::GetOrientation ( bool exists = nullptr)
overridevirtual

Read Exif orientation.

Parameters
[out]exists(Optional) True if orientation is defined by metadata
Returns
Exif orientation code

Implements ImageMetaData.

Definition at line 418 of file imagemetadata.cpp.

◆ GetOriginalDateTime()

QDateTime PictureMetaData::GetOriginalDateTime ( bool exists = nullptr)
overridevirtual

Read Exif timestamp of image capture.

Parameters
[out]exists(Optional) True if date exists in metadata
Returns
Timestamp (possibly invalid) in camera timezone

Implements ImageMetaData.

Definition at line 430 of file imagemetadata.cpp.

◆ GetComment()

QString PictureMetaData::GetComment ( bool exists = nullptr)
overridevirtual

Read Exif comments from metadata.

Returns UserComment, if not empty. Otherwise returns ImageDescription

Parameters
[out]exists(Optional) True if either comment is found in metadata
Returns
Comment as a string

Implements ImageMetaData.

Definition at line 446 of file imagemetadata.cpp.

◆ DecodeComment()

QString PictureMetaData::DecodeComment ( std::string  rawValue)
staticprotected

Decodes charset of UserComment.

Parameters
rawValueMetadata value with optional "[charset=...]" prefix
Returns
Decoded comment

Definition at line 469 of file imagemetadata.cpp.

Referenced by GetAllTags(), and GetComment().

◆ GetTag()

std::string PictureMetaData::GetTag ( const QString &  key,
bool exists = nullptr 
)
protected

Read a single Exif metadata tag.

Parameters
[in]keyExif tag key, as per http://www.exiv2.org/tags.html
[out]exists(Optional) True if key is found in metadata
Returns
Encoded tag
See also
ImageMetaData::FromString()

Definition at line 390 of file imagemetadata.cpp.

Referenced by GetComment(), GetOrientation(), and GetOriginalDateTime().

Member Data Documentation

◆ m_image

Exiv2::Image::UniquePtr PictureMetaData::m_image
protected

Definition at line 278 of file imagemetadata.cpp.

Referenced by IsValid(), and PictureMetaData().

◆ m_exifData

Exiv2::ExifData PictureMetaData::m_exifData
protected

Definition at line 279 of file imagemetadata.cpp.

Referenced by GetAllTags(), GetTag(), and PictureMetaData().


The documentation for this class was generated from the following file: