3 * Copyright (C) 2005-2013 Team XBMC
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with XBMC; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
22 #include "utils/ISerializable.h"
23 #include "utils/ISortable.h"
24 #include "utils/Archive.h"
25 #include "DllLibExif.h"
26 #include "XBDateTime.h"
28 #define SLIDE_FILE_NAME 900 // Note that not all image tags will be present for each image
29 #define SLIDE_FILE_PATH 901
30 #define SLIDE_FILE_SIZE 902
31 #define SLIDE_FILE_DATE 903
32 #define SLIDE_INDEX 904
33 #define SLIDE_RESOLUTION 905
34 #define SLIDE_COMMENT 906
35 #define SLIDE_COLOUR 907
36 #define SLIDE_PROCESS 908
38 #define SLIDE_EXIF_LONG_DATE 917
39 #define SLIDE_EXIF_LONG_DATE_TIME 918
40 #define SLIDE_EXIF_DATE 919 /* Implementation only to just get
42 #define SLIDE_EXIF_DATE_TIME 920
43 #define SLIDE_EXIF_DESCRIPTION 921
44 #define SLIDE_EXIF_CAMERA_MAKE 922
45 #define SLIDE_EXIF_CAMERA_MODEL 923
46 #define SLIDE_EXIF_COMMENT 924
47 #define SLIDE_EXIF_SOFTWARE 925
48 #define SLIDE_EXIF_APERTURE 926
49 #define SLIDE_EXIF_FOCAL_LENGTH 927
50 #define SLIDE_EXIF_FOCUS_DIST 928
51 #define SLIDE_EXIF_EXPOSURE 929
52 #define SLIDE_EXIF_EXPOSURE_TIME 930
53 #define SLIDE_EXIF_EXPOSURE_BIAS 931
54 #define SLIDE_EXIF_EXPOSURE_MODE 932
55 #define SLIDE_EXIF_FLASH_USED 933
56 #define SLIDE_EXIF_WHITE_BALANCE 934
57 #define SLIDE_EXIF_LIGHT_SOURCE 935
58 #define SLIDE_EXIF_METERING_MODE 936
59 #define SLIDE_EXIF_ISO_EQUIV 937
60 #define SLIDE_EXIF_DIGITAL_ZOOM 938
61 #define SLIDE_EXIF_CCD_WIDTH 939
62 #define SLIDE_EXIF_GPS_LATITUDE 940
63 #define SLIDE_EXIF_GPS_LONGITUDE 941
64 #define SLIDE_EXIF_GPS_ALTITUDE 942
65 #define SLIDE_EXIF_ORIENTATION 943
67 #define SLIDE_IPTC_SUBLOCATION 957
68 #define SLIDE_IPTC_IMAGETYPE 958
69 #define SLIDE_IPTC_TIMECREATED 959
70 #define SLIDE_IPTC_SUP_CATEGORIES 960
71 #define SLIDE_IPTC_KEYWORDS 961
72 #define SLIDE_IPTC_CAPTION 962
73 #define SLIDE_IPTC_AUTHOR 963
74 #define SLIDE_IPTC_HEADLINE 964
75 #define SLIDE_IPTC_SPEC_INSTR 965
76 #define SLIDE_IPTC_CATEGORY 966
77 #define SLIDE_IPTC_BYLINE 967
78 #define SLIDE_IPTC_BYLINE_TITLE 968
79 #define SLIDE_IPTC_CREDIT 969
80 #define SLIDE_IPTC_SOURCE 970
81 #define SLIDE_IPTC_COPYRIGHT_NOTICE 971
82 #define SLIDE_IPTC_OBJECT_NAME 972
83 #define SLIDE_IPTC_CITY 973
84 #define SLIDE_IPTC_STATE 974
85 #define SLIDE_IPTC_COUNTRY 975
86 #define SLIDE_IPTC_TX_REFERENCE 976
87 #define SLIDE_IPTC_DATE 977
88 #define SLIDE_IPTC_URGENCY 978
89 #define SLIDE_IPTC_COUNTRY_CODE 979
90 #define SLIDE_IPTC_REF_SERVICE 980
92 class CPictureInfoTag : public IArchivable, public ISerializable, public ISortable
95 CPictureInfoTag() { Reset(); };
97 virtual void Archive(CArchive& ar);
98 virtual void Serialize(CVariant& value) const;
99 virtual void ToSortable(SortItem& sortable, Field field) const;
100 const CPictureInfoTag& operator=(const CPictureInfoTag& item);
101 const CStdString GetInfo(int info) const;
103 bool Loaded() const { return m_isLoaded; };
104 bool Load(const CStdString &path);
106 static int TranslateString(const CStdString &info);
108 void SetInfo(int info, const CStdString& value);
111 * GetDateTimeTaken() -- Returns the EXIF DateTimeOriginal for current picture
113 * The exif library returns DateTimeOriginal if available else the other
114 * DateTime tags. See libexif CExifParse::ProcessDir for details.
116 const CDateTime& GetDateTimeTaken() const;
118 void GetStringFromArchive(CArchive &ar, char *string, size_t length);
119 ExifInfo_t m_exifInfo;
120 IPTCInfo_t m_iptcInfo;
121 bool m_isLoaded; // Set to true if metadata has been loaded from the picture file successfully
122 bool m_isInfoSetExternally; // Set to true if metadata has been set by an external call to SetInfo
123 CDateTime m_dateTimeTaken;
124 void ConvertDateTime();