2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
11 #include "XBDateTime.h"
13 #include "utils/IArchivable.h"
14 #include "utils/ISerializable.h"
15 #include "utils/ISortable.h"
25 } /* namespace ADDONS */
26 } /* namespace KODI */
30 class CPictureInfoTag
: public IArchivable
, public ISerializable
, public ISortable
32 friend class KODI::ADDONS::CImageDecoder
;
34 // Mimic structs from libexif.h but with C++ types instead of arrays
38 ExifInfo(const ExifInfo
&) = default;
39 ExifInfo(ExifInfo
&&) = default;
40 ExifInfo(const ExifInfo_t
& other
);
42 ExifInfo
& operator=(const ExifInfo
&) = default;
43 ExifInfo
& operator=(ExifInfo
&&) = default;
45 std::string CameraMake
;
46 std::string CameraModel
;
56 float ApertureFNumber
{};
60 float DigitalZoomRatio
{};
61 int FocalLength35mmEquiv
{};
64 int ExposureProgram
{};
68 int CommentsCharset
{};
69 int XPCommentsCharset
{};
71 std::string FileComment
;
72 std::string XPComment
;
73 std::string Description
;
75 unsigned ThumbnailOffset
{};
76 unsigned ThumbnailSize
{};
77 unsigned LargestExifOffset
{};
79 char ThumbnailAtEnd
{};
80 int ThumbnailSizeOffset
{};
82 std::vector
<int> DateTimeOffsets
;
90 static std::string
Convert(int charset
, const char* data
);
96 IPTCInfo(const IPTCInfo
&) = default;
97 IPTCInfo(IPTCInfo
&&) = default;
98 IPTCInfo(const IPTCInfo_t
& other
);
100 IPTCInfo
& operator=(const IPTCInfo
&) = default;
101 IPTCInfo
& operator=(IPTCInfo
&&) = default;
103 std::string RecordVersion
;
104 std::string SupplementalCategories
;
105 std::string Keywords
;
108 std::string Headline
;
109 std::string SpecialInstructions
;
110 std::string Category
;
112 std::string BylineTitle
;
115 std::string CopyrightNotice
;
116 std::string ObjectName
;
120 std::string TransmissionReference
;
123 std::string ReferenceService
;
124 std::string CountryCode
;
125 std::string TimeCreated
;
126 std::string SubLocation
;
127 std::string ImageType
;
131 CPictureInfoTag() { Reset(); }
132 virtual ~CPictureInfoTag() = default;
134 void Archive(CArchive
& ar
) override
;
135 void Serialize(CVariant
& value
) const override
;
136 void ToSortable(SortItem
& sortable
, Field field
) const override
;
137 const std::string
GetInfo(int info
) const;
139 bool Loaded() const { return m_isLoaded
; }
140 bool Load(const std::string
&path
);
142 void SetInfo(const std::string
& key
, const std::string
& value
);
145 * GetDateTimeTaken() -- Returns the EXIF DateTimeOriginal for current picture
147 * The exif library returns DateTimeOriginal if available else the other
148 * DateTime tags. See libexif CExifParse::ProcessDir for details.
150 const CDateTime
& GetDateTimeTaken() const;
152 static int TranslateString(const std::string
&info
);
156 bool m_isLoaded
; // Set to true if metadata has been loaded from the picture file successfully
157 bool m_isInfoSetExternally
; // Set to true if metadata has been set by an external call to SetInfo
158 CDateTime m_dateTimeTaken
;
159 void ConvertDateTime();