本文整理汇总了C++中exiv2::ExifData::byteOrder方法的典型用法代码示例。如果您正苦于以下问题:C++ ExifData::byteOrder方法的具体用法?C++ ExifData::byteOrder怎么用?C++ ExifData::byteOrder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类exiv2::ExifData
的用法示例。
在下文中一共展示了ExifData::byteOrder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadFrom
bool KisExifIO::loadFrom(KisMetaData::Store* store, QIODevice* ioDevice) const
{
ioDevice->open(QIODevice::ReadOnly);
if (!ioDevice->isOpen()) {
return false;
}
QByteArray arr = ioDevice->readAll();
Exiv2::ExifData exifData;
Exiv2::ByteOrder byteOrder;
#if EXIV2_MAJOR_VERSION == 0 && EXIV2_MINOR_VERSION <= 17
exifData.load((const Exiv2::byte*)arr.data(), arr.size());
byteOrder = exifData.byteOrder();
#else
try {
byteOrder = Exiv2::ExifParser::decode(exifData, (const Exiv2::byte*)arr.data(), arr.size());
}
catch (const std::exception& ex) {
warnKrita << "Received exception trying to parse exiv data" << ex.what();
return false;
}
catch (...) {
dbgKrita << "Received unknown exception trying to parse exiv data";
return false;
}
#endif
dbgFile << "Byte order = " << byteOrder << ppVar(Exiv2::bigEndian) << ppVar(Exiv2::littleEndian);
dbgFile << "There are" << exifData.count() << " entries in the exif section";
const KisMetaData::Schema* tiffSchema = KisMetaData::SchemaRegistry::instance()->schemaFromUri(KisMetaData::Schema::TIFFSchemaUri);
Q_ASSERT(tiffSchema);
const KisMetaData::Schema* exifSchema = KisMetaData::SchemaRegistry::instance()->schemaFromUri(KisMetaData::Schema::EXIFSchemaUri);
Q_ASSERT(exifSchema);
const KisMetaData::Schema* dcSchema = KisMetaData::SchemaRegistry::instance()->schemaFromUri(KisMetaData::Schema::DublinCoreSchemaUri);
Q_ASSERT(dcSchema);
const KisMetaData::Schema* xmpSchema = KisMetaData::SchemaRegistry::instance()->schemaFromUri(KisMetaData::Schema::XMPSchemaUri);
Q_ASSERT(xmpSchema);
for (Exiv2::ExifMetadata::const_iterator it = exifData.begin();
it != exifData.end(); ++it) {
if (it->key() == "Exif.Photo.StripOffsets"
|| it->key() == "RowsPerStrip"
|| it->key() == "StripByteCounts"
|| it->key() == "JPEGInterchangeFormat"
|| it->key() == "JPEGInterchangeFormatLength"
|| it->tagName() == "0x0000" ) {
dbgFile << it->key().c_str() << " is ignored";
} else if (it->key() == "Exif.Photo.MakerNote") {
const KisMetaData::Schema* makerNoteSchema = KisMetaData::SchemaRegistry::instance()->schemaFromUri(KisMetaData::Schema::MakerNoteSchemaUri);
store->addEntry(KisMetaData::Entry(makerNoteSchema, "RawData", exivValueToKMDValue(it->getValue(), false)));
} else if (it->key() == "Exif.Image.DateTime") { // load as xmp:ModifyDate
store->addEntry(KisMetaData::Entry(xmpSchema, "ModifyDate", KisMetaData::Value(exivValueToDateTime(it->getValue()))));
} else if (it->key() == "Exif.Image.ImageDescription") { // load as "dc:description"
store->addEntry(KisMetaData::Entry(dcSchema, "description", exivValueToKMDValue(it->getValue(), false)));
} else if (it->key() == "Exif.Image.Software") { // load as "xmp:CreatorTool"
store->addEntry(KisMetaData::Entry(xmpSchema, "CreatorTool", exivValueToKMDValue(it->getValue(), false)));
} else if (it->key() == "Exif.Image.Artist") { // load as dc:creator
QList<KisMetaData::Value> creators;
creators.push_back(exivValueToKMDValue(it->getValue(), false));
store->addEntry(KisMetaData::Entry(dcSchema, "creator", KisMetaData::Value(creators, KisMetaData::Value::OrderedArray)));
} else if (it->key() == "Exif.Image.Copyright") { // load as dc:rights
store->addEntry(KisMetaData::Entry(dcSchema, "rights", exivValueToKMDValue(it->getValue(), false)));
} else if (it->groupName() == "Image") {
// Tiff tags
QString fixedTN = it->tagName().c_str();
if (it->key() == "Exif.Image.ExifTag") {
dbgFile << "Ignoring " << it->key().c_str();
} else if (KisMetaData::Entry::isValidName(fixedTN)) {
store->addEntry(KisMetaData::Entry(tiffSchema, fixedTN, exivValueToKMDValue(it->getValue(), false))) ;
} else {
dbgFile << "Invalid tag name: " << fixedTN;
}
} else if (it->groupName() == "Photo" || (it->groupName() == "GPS")) {
// Exif tags (and GPS tags)
KisMetaData::Value v;
if (it->key() == "Exif.Photo.ExifVersion" || it->key() == "Exif.Photo.FlashpixVersion") {
v = exifVersionToKMDValue(it->getValue());
} else if (it->key() == "Exif.Photo.FileSource") {
v = KisMetaData::Value(3);
} else if (it->key() == "Exif.Photo.SceneType") {
v = KisMetaData::Value(1);
} else if (it->key() == "Exif.Photo.ComponentsConfiguration") {
v = exifArrayToKMDIntOrderedArray(it->getValue());
} else if (it->key() == "Exif.Photo.OECF") {
v = exifOECFToKMDOECFStructure(it->getValue(), byteOrder);
} else if (it->key() == "Exif.Photo.DateTimeDigitized" || it->key() == "Exif.Photo.DateTimeOriginal") {
v = KisMetaData::Value(exivValueToDateTime(it->getValue()));
} else if (it->key() == "Exif.Photo.DeviceSettingDescription") {
v = deviceSettingDescriptionExifToKMD(it->getValue());
} else if (it->key() == "Exif.Photo.CFAPattern") {
v = cfaPatternExifToKMD(it->getValue(), byteOrder);
} else if (it->key() == "Exif.Photo.Flash") {
v = flashExifToKMD(it->getValue());
} else if (it->key() == "Exif.Photo.UserComment") {
KisMetaData::Value vUC = exivValueToKMDValue(it->getValue(), false);
Q_ASSERT(vUC.type() == KisMetaData::Value::Variant);
QVariant commentVar = vUC.asVariant();
QString comment;
if (commentVar.type() == QVariant::String) {
comment = commentVar.toString();
} else if (commentVar.type() == QVariant::ByteArray) {
const QByteArray commentString = commentVar.toByteArray();
//.........这里部分代码省略.........