Skip to content

Commit

Permalink
Added support for the exif ImageDescription tag to libexif and made i…
Browse files Browse the repository at this point in the history
…t accessible through slideshow.exifdescription.
  • Loading branch information
fetzerch committed Mar 26, 2012
1 parent 8c38ea6 commit 3333a9b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
8 changes: 7 additions & 1 deletion lib/libexif/ExifParse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,13 @@ void CExifParse::ProcessDir(const unsigned char* const DirStart,
// Extract useful components of tag
switch(Tag)
{
// case TAG_DESCRIPTION: strncpy(m_ExifInfo->Description, ValuePtr, 5); break;
case TAG_DESCRIPTION:
{
int length = max(ByteCount, 0);
length = min(length, 2000);
strncpy(m_ExifInfo->Description, (char *)ValuePtr, length);
break;
}
case TAG_MAKE: strncpy(m_ExifInfo->CameraMake, (char *)ValuePtr, 32); break;
case TAG_MODEL: strncpy(m_ExifInfo->CameraModel, (char *)ValuePtr, 40); break;
// case TAG_SOFTWARE: strncpy(m_ExifInfo->Software, ValuePtr, 5); break;
Expand Down
1 change: 1 addition & 0 deletions lib/libexif/libexif.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ typedef struct {
int ISOequivalent;
int LightSource;
char Comments[MAX_COMMENT];
char Description[MAX_COMMENT];

unsigned ThumbnailOffset; // Exif offset to thumbnail
unsigned ThumbnailSize; // Size of thumbnail.
Expand Down
9 changes: 6 additions & 3 deletions xbmc/pictures/PictureInfoTag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ void CPictureInfoTag::Archive(CArchive& ar)
ar << CStdString(m_exifInfo.CameraModel);
ar << m_exifInfo.CCDWidth;
ar << CStdString(m_exifInfo.Comments);
ar << CStdString(m_exifInfo.Description);
ar << CStdString(m_exifInfo.DateTime);
for (int i = 0; i < 10; i++)
ar << m_exifInfo.DateTimeOffsets[i];
Expand Down Expand Up @@ -128,6 +129,7 @@ void CPictureInfoTag::Archive(CArchive& ar)
GetStringFromArchive(ar, m_exifInfo.CameraModel, sizeof(m_exifInfo.CameraModel));
ar >> m_exifInfo.CCDWidth;
GetStringFromArchive(ar, m_exifInfo.Comments, sizeof(m_exifInfo.Comments));
GetStringFromArchive(ar, m_exifInfo.Description, sizeof(m_exifInfo.Description));
GetStringFromArchive(ar, m_exifInfo.DateTime, sizeof(m_exifInfo.DateTime));
for (int i = 0; i < 10; i++)
ar >> m_exifInfo.DateTimeOffsets[i];
Expand Down Expand Up @@ -191,6 +193,7 @@ void CPictureInfoTag::Serialize(CVariant& value)
value["cameramodel"] = CStdString(m_exifInfo.CameraModel);
value["ccdwidth"] = m_exifInfo.CCDWidth;
value["comments"] = CStdString(m_exifInfo.Comments);
value["description"] = CStdString(m_exifInfo.Description);
value["datetime"] = CStdString(m_exifInfo.DateTime);
for (int i = 0; i < 10; i++)
value["datetimeoffsets"][i] = m_exifInfo.DateTimeOffsets[i];
Expand Down Expand Up @@ -311,9 +314,9 @@ const CStdString CPictureInfoTag::GetInfo(int info) const
value = date.GetAsLocalizedDateTime();
}
break;
// case SLIDE_EXIF_DESCRIPTION:
// value = m_exifInfo.Description;
// break;
case SLIDE_EXIF_DESCRIPTION:
value = m_exifInfo.Description;
break;
case SLIDE_EXIF_CAMERA_MAKE:
value = m_exifInfo.CameraMake;
break;
Expand Down

0 comments on commit 3333a9b

Please sign in to comment.