Feature request #933: Add support for Casio makernotes. Thanks goes to T Modes for the patch.
This commit is contained in:
@@ -12,6 +12,7 @@ endif()
|
||||
|
||||
# Private headers which are only needed for the library itself
|
||||
SET( LIBEXIV2_PRIVATE_HDR canonmn_int.hpp
|
||||
casiomn_int.hpp
|
||||
cr2image_int.hpp
|
||||
crwimage_int.hpp
|
||||
fujimn_int.hpp
|
||||
@@ -81,6 +82,7 @@ SET( LIBEXIV2_SRC asfvideo.cpp
|
||||
basicio.cpp
|
||||
bmpimage.cpp
|
||||
canonmn.cpp
|
||||
casiomn.cpp
|
||||
convert.cpp
|
||||
cr2image.cpp
|
||||
crwedit.cpp
|
||||
|
||||
@@ -69,6 +69,7 @@ CCSRC = asfvideo.cpp \
|
||||
basicio.cpp \
|
||||
bmpimage.cpp \
|
||||
canonmn.cpp \
|
||||
casiomn.cpp \
|
||||
convert.cpp \
|
||||
cr2image.cpp \
|
||||
crwimage.cpp \
|
||||
|
||||
+32
-8
@@ -106,7 +106,10 @@ namespace Exiv2 {
|
||||
"Exif.Pentax.ISO",
|
||||
"Exif.PentaxDng.ISO",
|
||||
"Exif.Olympus.ISOSpeed",
|
||||
"Exif.Samsung2.ISO"
|
||||
"Exif.Samsung2.ISO",
|
||||
"Exif.Casio.ISO",
|
||||
"Exif.Casio2.ISO",
|
||||
"Exif.Casio2.ISOSpeed"
|
||||
};
|
||||
|
||||
// Find the first ISO value which is not "0"
|
||||
@@ -220,7 +223,10 @@ namespace Exiv2 {
|
||||
"Exif.Sony1Cs.Quality",
|
||||
"Exif.Sony2.JPEGQuality",
|
||||
"Exif.Sony2.Quality",
|
||||
"Exif.Sony2Cs.Quality"
|
||||
"Exif.Sony2Cs.Quality",
|
||||
"Exif.Casio.Quality",
|
||||
"Exif.Casio2.QualityMode",
|
||||
"Exif.Casio2.Quality"
|
||||
};
|
||||
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
|
||||
}
|
||||
@@ -248,6 +254,9 @@ namespace Exiv2 {
|
||||
"Exif.Sony2.WhiteBalance",
|
||||
"Exif.Sony1.WhiteBalance2",
|
||||
"Exif.Sony2.WhiteBalance2",
|
||||
"Exif.Casio.WhiteBalance",
|
||||
"Exif.Casio2.WhiteBalance",
|
||||
"Exif.Casio2.WhiteBalance2",
|
||||
"Exif.Photo.WhiteBalance"
|
||||
};
|
||||
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
|
||||
@@ -290,7 +299,10 @@ namespace Exiv2 {
|
||||
"Exif.Panasonic.Saturation",
|
||||
"Exif.Pentax.Saturation",
|
||||
"Exif.PentaxDng.Saturation",
|
||||
"Exif.Sigma.Saturation"
|
||||
"Exif.Sigma.Saturation",
|
||||
"Exif.Casio.Saturation",
|
||||
"Exif.Casio2.Saturation",
|
||||
"Exif.Casio2.Saturation2"
|
||||
};
|
||||
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
|
||||
}
|
||||
@@ -309,7 +321,10 @@ namespace Exiv2 {
|
||||
"Exif.Panasonic.Sharpness",
|
||||
"Exif.Pentax.Sharpness",
|
||||
"Exif.PentaxDng.Sharpness",
|
||||
"Exif.Sigma.Sharpness"
|
||||
"Exif.Sigma.Sharpness",
|
||||
"Exif.Casio.Sharpness",
|
||||
"Exif.Casio2.Sharpness",
|
||||
"Exif.Casio2.Sharpness2"
|
||||
};
|
||||
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
|
||||
}
|
||||
@@ -328,7 +343,11 @@ namespace Exiv2 {
|
||||
"Exif.Panasonic.Contrast",
|
||||
"Exif.Pentax.Contrast",
|
||||
"Exif.PentaxDng.Contrast",
|
||||
"Exif.Sigma.Contrast"
|
||||
"Exif.Sigma.Contrast",
|
||||
"Exif.Casio.Contrast",
|
||||
"Exif.Casio2.Contrast",
|
||||
"Exif.Casio2.Contrast2"
|
||||
|
||||
};
|
||||
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
|
||||
}
|
||||
@@ -401,7 +420,9 @@ namespace Exiv2 {
|
||||
"Exif.NikonLd2.FocusDistance",
|
||||
"Exif.NikonLd3.FocusDistance",
|
||||
"Exif.Olympus.FocusDistance",
|
||||
"Exif.OlympusFi.FocusDistance"
|
||||
"Exif.OlympusFi.FocusDistance",
|
||||
"Exif.Casio.ObjectDistance",
|
||||
"Exif.Casio2.ObjectDistance"
|
||||
};
|
||||
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
|
||||
}
|
||||
@@ -430,7 +451,8 @@ namespace Exiv2 {
|
||||
"Exif.NikonLd3.FocalLength",
|
||||
"Exif.MinoltaCsNew.FocalLength",
|
||||
"Exif.Pentax.FocalLength",
|
||||
"Exif.PentaxDng.FocalLength"
|
||||
"Exif.PentaxDng.FocalLength",
|
||||
"Exif.Casio2.FocalLength"
|
||||
};
|
||||
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
|
||||
}
|
||||
@@ -457,7 +479,9 @@ namespace Exiv2 {
|
||||
"Exif.Sony2Cs.LocalAFAreaPoint",
|
||||
"Exif.Sony1Cs2.LocalAFAreaPoint",
|
||||
"Exif.Sony2Cs2.LocalAFAreaPoint",
|
||||
"Exif.Sony1MltCsA100.LocalAFAreaPoint"
|
||||
"Exif.Sony1MltCsA100.LocalAFAreaPoint",
|
||||
"Exif.Casio.AFPoint",
|
||||
"Exif.Casio2.AFPointPosition"
|
||||
};
|
||||
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@ namespace Exiv2 {
|
||||
{ "SAMSUNG", samsung2Id, newSamsungMn, newSamsungMn2 },
|
||||
{ "SIGMA", sigmaId, newSigmaMn, newSigmaMn2 },
|
||||
{ "SONY", ifdIdNotSet, newSonyMn, 0 }, // mnGroup_ is not used
|
||||
{ "CASIO", ifdIdNotSet, newCasioMn, 0 }, // mnGroup_ is not used
|
||||
// Entries below are only used for lookup by group
|
||||
{ "-", nikon1Id, 0, newIfdMn2 },
|
||||
{ "-", nikon2Id, 0, newNikon2Mn2 },
|
||||
@@ -727,6 +728,59 @@ namespace Exiv2 {
|
||||
return sizeOfSignature();
|
||||
} // SonyMnHeader::write
|
||||
|
||||
const byte Casio2MnHeader::signature_[] = {
|
||||
'Q', 'V', 'C', '\0', '\0', '\0'
|
||||
};
|
||||
const ByteOrder Casio2MnHeader::byteOrder_ = bigEndian;
|
||||
|
||||
uint32_t Casio2MnHeader::sizeOfSignature()
|
||||
{
|
||||
return sizeof(signature_);
|
||||
}
|
||||
|
||||
Casio2MnHeader::Casio2MnHeader()
|
||||
{
|
||||
read(signature_, sizeOfSignature(), invalidByteOrder );
|
||||
}
|
||||
|
||||
Casio2MnHeader::~Casio2MnHeader()
|
||||
{
|
||||
}
|
||||
|
||||
uint32_t Casio2MnHeader::size() const
|
||||
{
|
||||
return sizeOfSignature();
|
||||
}
|
||||
|
||||
uint32_t Casio2MnHeader::ifdOffset() const
|
||||
{
|
||||
return start_;
|
||||
}
|
||||
|
||||
ByteOrder Casio2MnHeader::byteOrder() const
|
||||
{
|
||||
return byteOrder_;
|
||||
}
|
||||
|
||||
bool Casio2MnHeader::read(const byte* pData,
|
||||
uint32_t size,
|
||||
ByteOrder /*byteOrder*/)
|
||||
{
|
||||
if (!pData || size < sizeOfSignature()) return false;
|
||||
if (0 != memcmp(pData, signature_, sizeOfSignature())) return false;
|
||||
buf_.alloc(sizeOfSignature());
|
||||
std::memcpy(buf_.pData_, pData, buf_.size_);
|
||||
start_ = sizeOfSignature();
|
||||
return true;
|
||||
} // Casio2MnHeader::read
|
||||
|
||||
uint32_t Casio2MnHeader::write(IoWrapper& ioWrapper,
|
||||
ByteOrder /*byteOrder*/) const
|
||||
{
|
||||
ioWrapper.write(signature_, sizeOfSignature());
|
||||
return sizeOfSignature();
|
||||
} // Casio2MnHeader::write
|
||||
|
||||
// *************************************************************************
|
||||
// free functions
|
||||
|
||||
@@ -970,6 +1024,29 @@ namespace Exiv2 {
|
||||
return new TiffIfdMakernote(tag, group, mnGroup, 0, true);
|
||||
}
|
||||
|
||||
TiffComponent* newCasioMn(uint16_t tag,
|
||||
IfdId group,
|
||||
IfdId mnGroup,
|
||||
const byte* pData,
|
||||
uint32_t size,
|
||||
ByteOrder byteOrder)
|
||||
{
|
||||
if (size > 6 && std::string(reinterpret_cast<const char*>(pData), 6)
|
||||
== std::string("QVC\0\0\0", 6)) {
|
||||
return newCasio2Mn2(tag, group, casio2Id);
|
||||
};
|
||||
// Require at least an IFD with 1 entry, but not necessarily a next pointer
|
||||
if (size < 14) return 0;
|
||||
return newIfdMn2(tag, group, casioId);
|
||||
}
|
||||
|
||||
TiffComponent* newCasio2Mn2(uint16_t tag,
|
||||
IfdId group,
|
||||
IfdId mnGroup)
|
||||
{
|
||||
return new TiffIfdMakernote(tag, group, mnGroup, new Casio2MnHeader);
|
||||
}
|
||||
|
||||
//! Structure for an index into the array set of complex binary arrays.
|
||||
struct NikonArrayIdx {
|
||||
//! Key for comparisons
|
||||
|
||||
+48
-1
@@ -518,7 +518,41 @@ namespace Exiv2 {
|
||||
|
||||
}; // class SonyMnHeader
|
||||
|
||||
// *****************************************************************************
|
||||
//! Header of a Casio2 Makernote
|
||||
class Casio2MnHeader : public MnHeader {
|
||||
public:
|
||||
//! @name Creators
|
||||
//@{
|
||||
//! Default constructor
|
||||
Casio2MnHeader();
|
||||
//! Virtual destructor.
|
||||
virtual ~Casio2MnHeader();
|
||||
//@}
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
virtual bool read(const byte* pData,
|
||||
uint32_t size,
|
||||
ByteOrder byteOrder);
|
||||
//@}
|
||||
//! @name Accessors
|
||||
//@{
|
||||
virtual uint32_t size() const;
|
||||
virtual uint32_t write(IoWrapper& ioWrapper, ByteOrder byteOrder) const;
|
||||
virtual uint32_t ifdOffset() const;
|
||||
virtual ByteOrder byteOrder() const;
|
||||
//@}
|
||||
//! Return the size of the makernote header signature
|
||||
static uint32_t sizeOfSignature();
|
||||
|
||||
private:
|
||||
DataBuf buf_; //!< Raw header data
|
||||
uint32_t start_; //!< Start of the mn IFD rel. to mn start
|
||||
static const byte signature_[]; //!< Casio makernote header signature
|
||||
static const ByteOrder byteOrder_; //!< Byteorder for makernote (always big endian)
|
||||
|
||||
}; // class Casio2MnHeader
|
||||
|
||||
// *****************************************************************************
|
||||
// template, inline and free functions
|
||||
|
||||
//! Function to create a simple IFD makernote (Canon, Minolta, Nikon1)
|
||||
@@ -661,6 +695,19 @@ namespace Exiv2 {
|
||||
IfdId group,
|
||||
IfdId mnGroup);
|
||||
|
||||
//! Function to create a Casio2 makernote
|
||||
TiffComponent* newCasioMn(uint16_t tag,
|
||||
IfdId group,
|
||||
IfdId mnGroup,
|
||||
const byte* pData,
|
||||
uint32_t size,
|
||||
ByteOrder byteOrder);
|
||||
|
||||
//! Function to create a Casio2 makernote
|
||||
TiffComponent* newCasio2Mn2(uint16_t tag,
|
||||
IfdId group,
|
||||
IfdId mnGroup);
|
||||
|
||||
/*!
|
||||
@brief Function to select cfg + def of the Sony Camera Settings complex binary array.
|
||||
|
||||
|
||||
+3
-1
@@ -324,6 +324,7 @@ namespace {
|
||||
{ 0, createLoaderExifDataJpeg, 8 },
|
||||
{ "image/x-panasonic-rw2", createLoaderExifDataJpeg, 9 },
|
||||
{ 0, createLoaderExifDataJpeg,10 },
|
||||
{ 0, createLoaderExifDataJpeg,11 },
|
||||
{ 0, createLoaderTiff, 0 },
|
||||
{ 0, createLoaderTiff, 1 },
|
||||
{ 0, createLoaderTiff, 2 },
|
||||
@@ -367,7 +368,8 @@ namespace {
|
||||
{ "Exif.Olympus2.ThumbnailImage", 0 }, // 7
|
||||
{ "Exif.Minolta.Thumbnail", 0 }, // 8
|
||||
{ "Exif.PanasonicRaw.PreviewImage", 0 }, // 9
|
||||
{ "Exif.SamsungPreview.JPEGInterchangeFormat", "Exif.SamsungPreview.JPEGInterchangeFormatLength" } // 10
|
||||
{ "Exif.SamsungPreview.JPEGInterchangeFormat", "Exif.SamsungPreview.JPEGInterchangeFormatLength" }, // 10
|
||||
{ "Exif.Casio2.PreviewImage", 0 } // 11
|
||||
};
|
||||
|
||||
const LoaderTiff::Param LoaderTiff::param_[] = {
|
||||
|
||||
@@ -42,6 +42,7 @@ EXIV2_RCSID("@(#) $Id$")
|
||||
#include "i18n.h" // NLS support.
|
||||
|
||||
#include "canonmn_int.hpp"
|
||||
#include "casiomn_int.hpp"
|
||||
#include "fujimn_int.hpp"
|
||||
#include "minoltamn_int.hpp"
|
||||
#include "nikonmn_int.hpp"
|
||||
@@ -104,6 +105,8 @@ namespace Exiv2 {
|
||||
{ canonFiId, "Makernote", "CanonFi", CanonMakerNote::tagListFi },
|
||||
{ canonPaId, "Makernote", "CanonPa", CanonMakerNote::tagListPa },
|
||||
{ canonPrId, "Makernote", "CanonPr", CanonMakerNote::tagListPr },
|
||||
{ casioId, "Makernote", "Casio", CasioMakerNote::tagList },
|
||||
{ casio2Id, "Makernote", "Casio2", Casio2MakerNote::tagList },
|
||||
{ fujiId, "Makernote", "Fujifilm", FujiMakerNote::tagList },
|
||||
{ minoltaId, "Makernote", "Minolta", MinoltaMakerNote::tagList },
|
||||
{ minoltaCs5DId, "Makernote", "MinoltaCs5D", MinoltaMakerNote::tagListCs5D },
|
||||
|
||||
@@ -82,6 +82,8 @@ namespace Exiv2 {
|
||||
canonPaId,
|
||||
canonFiId,
|
||||
canonPrId,
|
||||
casioId,
|
||||
casio2Id,
|
||||
fujiId,
|
||||
minoltaId,
|
||||
minoltaCs5DId,
|
||||
|
||||
@@ -1252,6 +1252,8 @@ namespace Exiv2 {
|
||||
{ Tag::root, minoltaCsNewId, minoltaId, 0x0003 },
|
||||
{ Tag::root, minoltaCs7DId, minoltaId, 0x0004 },
|
||||
{ Tag::root, minoltaCs5DId, minoltaId, 0x0114 },
|
||||
{ Tag::root, casioId, exifId, 0x927c },
|
||||
{ Tag::root, casio2Id, exifId, 0x927c },
|
||||
// ---------------------------------------------------------
|
||||
// Panasonic RW2 raw images
|
||||
{ Tag::pana, ifdIdNotSet, ifdIdNotSet, Tag::pana },
|
||||
@@ -1722,6 +1724,14 @@ namespace Exiv2 {
|
||||
{ Tag::next, panaRawId, newTiffDirectory<ignoreId> },
|
||||
{ Tag::all, panaRawId, newTiffEntry },
|
||||
|
||||
// Casio makernote
|
||||
{ Tag::next, casioId, newTiffDirectory<ignoreId> },
|
||||
{ Tag::all, casioId, newTiffEntry },
|
||||
|
||||
// Casio2 makernote
|
||||
{ Tag::next, casio2Id, newTiffDirectory<ignoreId> },
|
||||
{ Tag::all, casio2Id, newTiffEntry },
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Tags which are not de/encoded
|
||||
{ Tag::next, ignoreId, newTiffDirectory<ignoreId> },
|
||||
|
||||
Reference in New Issue
Block a user