diff options
author | ace20022 <ace20022@xbmc.org> | 2015-07-10 16:22:18 +0200 |
---|---|---|
committer | ace20022 <ace20022@xbmc.org> | 2015-07-10 16:33:56 +0200 |
commit | 6791014a69035053f9ccf9d93b17c646a1c0e677 (patch) | |
tree | 86605dd0e306b549e3bfd1264ea83fafcc9573f4 | |
parent | 5db13451939e3f4599302ada8eef69e52cda464d (diff) |
[libexif] Add an own field for XP comments.
-rw-r--r-- | addons/resource.language.en_gb/resources/strings.po | 6 | ||||
-rwxr-xr-x | lib/libexif/ExifParse.cpp | 6 | ||||
-rw-r--r-- | lib/libexif/libexif.h | 2 | ||||
-rw-r--r-- | xbmc/pictures/PictureInfoTag.cpp | 10 | ||||
-rw-r--r-- | xbmc/pictures/PictureInfoTag.h | 1 |
5 files changed, 21 insertions, 4 deletions
diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po index e432dc493d..b7ca1b282e 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -12168,7 +12168,11 @@ msgctxt "#21843" msgid "Orientation" msgstr "" -#empty strings from id 21844 to 21856 +msgctxt "#21844" +msgid "XP comment" +msgstr "" + +#empty strings from id 21845 to 21856 msgctxt "#21857" msgid "Sub-location" diff --git a/lib/libexif/ExifParse.cpp b/lib/libexif/ExifParse.cpp index 1d4934b84b..1ef43260f7 100755 --- a/lib/libexif/ExifParse.cpp +++ b/lib/libexif/ExifParse.cpp @@ -486,10 +486,10 @@ void CExifParse::ProcessDir(const unsigned char* const DirStart, case TAG_XP_COMMENT: { // The XP user comment field is always unicode (UCS-2) encoded - m_ExifInfo->CommentsCharset = EXIF_COMMENT_CHARSET_UNICODE; + m_ExifInfo->XPCommentsCharset = EXIF_COMMENT_CHARSET_UNICODE; size_t length = min(ByteCount, MAX_COMMENT); - memcpy(m_ExifInfo->Comments, ValuePtr, length); - m_ExifInfo->Comments[length] = '\0'; + memcpy(m_ExifInfo->XPComment, ValuePtr, length); + m_ExifInfo->XPComment[length] = '\0'; } break; diff --git a/lib/libexif/libexif.h b/lib/libexif/libexif.h index cf5b81c7dd..be2d37d1a6 100644 --- a/lib/libexif/libexif.h +++ b/lib/libexif/libexif.h @@ -108,8 +108,10 @@ typedef struct { int ISOequivalent; int LightSource; int CommentsCharset; // EXIF_COMMENT_CHARSET_* + int XPCommentsCharset; char Comments[MAX_COMMENT + 1]; // +1 for null termination char FileComment[MAX_COMMENT + 1]; + char XPComment[MAX_COMMENT + 1]; char Description[MAX_COMMENT + 1]; unsigned ThumbnailOffset; // Exif offset to thumbnail diff --git a/xbmc/pictures/PictureInfoTag.cpp b/xbmc/pictures/PictureInfoTag.cpp index 68ed713ba3..b011072b15 100644 --- a/xbmc/pictures/PictureInfoTag.cpp +++ b/xbmc/pictures/PictureInfoTag.cpp @@ -345,6 +345,16 @@ const std::string CPictureInfoTag::GetInfo(int info) const g_charsetConverter.unknownToUTF8(m_exifInfo.Comments, value); } break; + case SLIDE_EXIF_XPCOMMENT: + if (m_exifInfo.XPCommentsCharset == EXIF_COMMENT_CHARSET_UNICODE) + { + g_charsetConverter.ucs2ToUTF8(std::u16string((char16_t*)m_exifInfo.XPComment), value); + } + else + { + value = "Illegal charset used."; + } + break; case SLIDE_EXIF_LONG_DATE_TIME: if (m_dateTimeTaken.IsValid()) value = m_dateTimeTaken.GetAsLocalizedDateTime(true); diff --git a/xbmc/pictures/PictureInfoTag.h b/xbmc/pictures/PictureInfoTag.h index 1a3759343d..4adfdcf7b9 100644 --- a/xbmc/pictures/PictureInfoTag.h +++ b/xbmc/pictures/PictureInfoTag.h @@ -63,6 +63,7 @@ #define SLIDE_EXIF_GPS_LONGITUDE 941 #define SLIDE_EXIF_GPS_ALTITUDE 942 #define SLIDE_EXIF_ORIENTATION 943 +#define SLIDE_EXIF_XPCOMMENT 944 #define SLIDE_IPTC_SUBLOCATION 957 #define SLIDE_IPTC_IMAGETYPE 958 |