27#include <libopenraw/debug.h>
30#include "ifdfilecontainer.hpp"
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 = %lld m_numTags = %d\n", (
long long int)dir_offset,
118 m_current_dir->numTags());
119 off_t begin = dir_offset + 2 + (m_current_dir->numTags() * 12);
121 LOGDBG1(
"begin = %lld\n", (
long long int)begin);
123 m_file->seek(begin, SEEK_SET);
127 LOGDBG1(
"nextIFD = %d\n", nextIFD);
132 return nextIFD - begin;
140bool IfdFileContainer::_locateDirs(
void)
145 LOGDBG1(
"_locateDirs()\n");
146 if (m_endian == ENDIAN_NULL) {
151 if (m_endian == ENDIAN_NULL) {
160 if (dir_offset != 0) {
161 LOGDBG1(
"push offset =0x%x\n", dir_offset);
166 std::make_shared<IfdDir>(
m_offset + dir_offset, *
this));
167 m_dirs.push_back(dir);
169 dir_offset = dir->nextIFD();
171 }
while (dir_offset != 0);
173 LOGDBG1(
"# dir found = %ld\n", m_dirs.size());
174 return (m_dirs.size() != 0);
std::vector< IfdDir::Ref > & directories()
virtual EndianType isMagicHeader(const char *p, int len)
IfdFileContainer(const IO::Stream::Ptr &file, off_t offset)
IfdDir::Ref setDirectory(int dir)
size_t getDirectoryDataSize()
virtual ~IfdFileContainer()
int countDirectories(void)
virtual bool locateDirsPreHook()
Option< int32_t > readInt32(const IO::Stream::Ptr &f)
RawContainer(const IO::Stream::Ptr &_file, off_t offset)
CIFF is the container for CRW files. It is an attempt from Canon to make this a standard....