22 #include <sys/types.h> 27 #include <libopenraw/debug.h> 30 #include "ifdfilecontainer.hpp" 32 using namespace Debug;
38 IfdFileContainer::IfdFileContainer(
const IO::Stream::Ptr &_file, off_t _offset)
41 , m_exif_offset_correction(0)
59 if ((p[0] == 0x49) && (p[1] == 0x49) && (p[2] == 0x2a) && (p[3] == 0x00)) {
61 }
else if ((p[0] == 0x4d) && (p[1] == 0x4d) && (p[2] == 0x00) &&
70 if (m_dirs.size() == 0) {
72 bool ret = _locateDirs();
82 if (m_dirs.size() == 0) {
102 if (dir > (
int)m_dirs.size()) {
104 return IfdDir::Ref();
106 m_current_dir = m_dirs[dir];
107 m_current_dir->load();
108 return m_current_dir;
114 LOGDBG1(
"getDirectoryDataSize()\n");
115 off_t dir_offset = m_current_dir->offset();
117 LOGDBG1(
"offset = %ld m_numTags = %d\n", dir_offset, m_current_dir->numTags());
118 off_t begin = dir_offset + 2 + (m_current_dir->numTags() * 12);
120 LOGDBG1(
"begin = %ld\n", begin);
122 m_file->seek(begin, SEEK_SET);
126 LOGDBG1(
"nextIFD = %d\n", nextIFD);
131 return nextIFD - begin;
139 bool IfdFileContainer::_locateDirs(
void)
144 LOGDBG1(
"_locateDirs()\n");
145 if (m_endian == ENDIAN_NULL) {
150 if (m_endian == ENDIAN_NULL) {
159 if (dir_offset != 0) {
160 LOGDBG1(
"push offset =0x%x\n", dir_offset);
165 std::make_shared<IfdDir>(
m_offset + dir_offset, *
this));
166 m_dirs.push_back(dir);
168 dir_offset = dir->nextIFD();
170 }
while (dir_offset != 0);
172 LOGDBG1(
"# dir found = %ld\n", m_dirs.size());
173 return (m_dirs.size() != 0);
CIFF is the container for CRW files. It is an attempt from Canon to make this a standard. I guess it failed.
virtual bool locateDirsPreHook()
size_t getDirectoryDataSize()
IfdDir::Ref setDirectory(int dir)
virtual EndianType isMagicHeader(const char *p, int len)
std::vector< IfdDir::Ref > & directories()
int countDirectories(void)
virtual ~IfdFileContainer()
Option< int32_t > readInt32(const IO::Stream::Ptr &f)