| 442 | } |
| 443 | |
| 444 | TiffEncoder::TiffEncoder(ExifData& exifData, IptcData& iptcData, XmpData& xmpData, TiffComponent* pRoot, |
| 445 | const bool isNewImage, const PrimaryGroups* pPrimaryGroups, const TiffHeaderBase* pHeader, |
| 446 | FindEncoderFct findEncoderFct) : |
| 447 | exifData_(exifData), |
| 448 | iptcData_(iptcData), |
| 449 | xmpData_(xmpData), |
| 450 | pHeader_(pHeader), |
| 451 | pRoot_(pRoot), |
| 452 | isNewImage_(isNewImage), |
| 453 | pPrimaryGroups_(pPrimaryGroups), |
| 454 | byteOrder_(pHeader->byteOrder()), |
| 455 | origByteOrder_(byteOrder_), |
| 456 | findEncoderFct_(findEncoderFct) { |
| 457 | encodeIptc(); |
| 458 | encodeXmp(); |
| 459 | |
| 460 | // Find camera make |
| 461 | ExifKey key("Exif.Image.Make"); |
| 462 | if (auto pos = exifData_.findKey(key); pos != exifData_.end()) { |
| 463 | make_ = pos->toString(); |
| 464 | } |
| 465 | if (make_.empty() && pRoot_) { |
| 466 | TiffFinder finder(0x010f, IfdId::ifd0Id); |
| 467 | pRoot_->accept(finder); |
| 468 | auto te = dynamic_cast<TiffEntryBase*>(finder.result()); |
| 469 | if (te && te->pValue()) { |
| 470 | make_ = te->pValue()->toString(); |
| 471 | } |
| 472 | } |
| 473 | } |
| 474 | |
| 475 | void TiffEncoder::encodeIptc() { |
| 476 | // Update IPTCNAA Exif tag, if it exists. Delete the tag if there |