#1108 Added IPTC parser for tiff.
This commit is contained in:
parent
c26dd2091f
commit
6e19d043ef
@ -609,11 +609,9 @@ namespace Exiv2 {
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string binaryToString(DataBuf& buf, size_t size, size_t start /*=0*/)
|
||||
std::string binaryToString(const byte* buff, size_t size, size_t start /*=0*/)
|
||||
{
|
||||
std::string result = "";
|
||||
byte* buff = buf.pData_;
|
||||
|
||||
size += start;
|
||||
|
||||
while (start < size) {
|
||||
@ -627,4 +625,9 @@ namespace Exiv2 {
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string binaryToString(DataBuf& buf, size_t size, size_t start /*=0*/)
|
||||
{
|
||||
return binaryToString(buf.pData_,size,start);
|
||||
}
|
||||
|
||||
}} // namespace Internal, Exiv2
|
||||
|
||||
@ -60,6 +60,11 @@ namespace Exiv2 {
|
||||
*/
|
||||
std::string binaryToString(DataBuf& buf, size_t size, size_t start =0);
|
||||
|
||||
/*!
|
||||
@brief format binary for display in \em printStructure() \em .
|
||||
*/
|
||||
std::string binaryToString(const byte* buff, size_t size, size_t start /*=0*/);
|
||||
|
||||
}} // namespace Internal, Exiv2
|
||||
|
||||
#endif // #ifndef IMAGE_INT_HPP_
|
||||
|
||||
@ -574,12 +574,31 @@ namespace Exiv2 {
|
||||
|
||||
sp = kount == count ? "" : " ...";
|
||||
out << sp << std::endl;
|
||||
if ( option == kpsRecursive
|
||||
&& (tag == 0x8769 /* ExifTag */ /* || tag == 0x927c MakerNote */)
|
||||
){
|
||||
if ( option == kpsRecursive && tag == 0x8769 /* ExifTag */ ) {
|
||||
size_t restore = io.tell();
|
||||
printIFDStructure(io,out,option,Offset,bSwap,c,depth);
|
||||
io.seek(restore,BasicIo::beg);
|
||||
} else if ( option == kpsRecursive && tag == 0x83bb /* IPTCNAA */ ) {
|
||||
size_t restore = io.tell(); // save
|
||||
io.seek(offset,BasicIo::beg); // position
|
||||
byte* bytes=new byte[count] ; // allocate memory
|
||||
io.read(bytes,count) ; // read
|
||||
io.seek(restore,BasicIo::beg); // restore
|
||||
|
||||
uint32_t i = 0 ;
|
||||
while ( i < count-3 && bytes[i] != 0x1c ) i++;
|
||||
out << " Record | DataSet | Name | Length | Data" << std::endl;
|
||||
while ( bytes[i] == 0x1c && i < size-3 ) {
|
||||
char buff[100];
|
||||
uint16_t record = bytes[i+1];
|
||||
uint16_t dataset = bytes[i+2];
|
||||
uint16_t len = getUShort(bytes+i+3,bigEndian);
|
||||
sprintf(buff," %6d | %7d | %-24s | %6d | ",record,dataset, Exiv2::IptcDataSets::dataSetName(dataset,record).c_str(), len);
|
||||
|
||||
out << buff << Internal::binaryToString(bytes,(len>40?40:len),i+5) << (len>40?"...":"") << std::endl;
|
||||
i += 5 + len;
|
||||
}
|
||||
delete[] bytes;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user