libopenraw
Public Types | Public Member Functions | Protected Member Functions | List of all members
OpenRaw::Internals::IFDFileContainer Class Reference
Inheritance diagram for OpenRaw::Internals::IFDFileContainer:
OpenRaw::Internals::RawContainer OpenRaw::Internals::MRWContainer OpenRaw::Internals::OrfContainer

Public Types

enum  { IFD_NONE = -1, IFD_EXIF = -2, IFD_GPS = -3, IFD_INTEROP = -4 }
 
- Public Types inherited from OpenRaw::Internals::RawContainer
enum  EndianType { ENDIAN_NULL = 0, ENDIAN_BIG, ENDIAN_LITTLE }
 

Public Member Functions

 IFDFileContainer (IO::Stream *file, off_t offset)
 
virtual ~IFDFileContainer ()
 
virtual EndianType isMagicHeader (const char *p, int len)
 
IFDDir::Ref setDirectory (int dir)
 
int countDirectories (void)
 
std::vector< IFDDir::Ref > & directories ()
 
int currentDirectory ()
 
size_t getDirectoryDataSize ()
 
int lastError () const
 
int exifOffsetCorrection () const
 
void setExifOffsetCorrection (int corr)
 
- Public Member Functions inherited from OpenRaw::Internals::RawContainer
 RawContainer (IO::Stream *_file, off_t offset)
 
virtual ~RawContainer ()
 
IO::Streamfile ()
 
EndianType endian () const
 
bool readInt8 (IO::Stream *f, int8_t &v)
 
bool readUInt8 (IO::Stream *f, uint8_t &v)
 
bool readInt16 (IO::Stream *f, int16_t &v)
 
bool readInt32 (IO::Stream *f, int32_t &v)
 
bool readUInt16 (IO::Stream *f, uint16_t &v)
 
bool readUInt32 (IO::Stream *f, uint32_t &v)
 
size_t fetchData (void *buf, const off_t offset, const size_t buf_size)
 

Protected Member Functions

virtual bool locateDirsPreHook ()
 
- Protected Member Functions inherited from OpenRaw::Internals::RawContainer
 RawContainer (const RawContainer &)
 
RawContaineroperator= (const RawContainer &)
 
void setEndian (EndianType _endian)
 

Additional Inherited Members

- Protected Attributes inherited from OpenRaw::Internals::RawContainer
IO::Streamm_file
 
off_t m_offset
 
EndianType m_endian
 

Detailed Description

Definition at line 45 of file ifdfilecontainer.h.

Member Enumeration Documentation

anonymous enum

due to the way Exif works, we have to set specific index to address these IFD

Enumerator
IFD_NONE 

invalid IFD. Means an error

IFD_EXIF 

exif IFD: see field 0x6789 in IFD 0

IFD_GPS 

GPS IFD: see field 0x8825 in IFD 0

IFD_INTEROP 

interoperability IFD: see field 0xa005 in exif IFD

Definition at line 62 of file ifdfilecontainer.h.

Constructor & Destructor Documentation

OpenRaw::Internals::IFDFileContainer::IFDFileContainer ( IO::Stream file,
off_t  offset 
)

constructor

Parameters
filethe file handle
offsetthe offset from the start of the file

Definition at line 40 of file ifdfilecontainer.cpp.

OpenRaw::Internals::IFDFileContainer::~IFDFileContainer ( )
virtual

destructor

Definition at line 49 of file ifdfilecontainer.cpp.

Member Function Documentation

int OpenRaw::Internals::IFDFileContainer::countDirectories ( void  )

Count the number of image file directories, not including EXIF, GPS and INTEROP.

Returns
the number of image file directories

Definition at line 74 of file ifdfilecontainer.cpp.

Referenced by directories(), and setDirectory().

int OpenRaw::Internals::IFDFileContainer::currentDirectory ( )

Get the number of the current directory

Returns
the index of the current directory. By default we are in directory 0. -1 indicates an initialized IFD file
std::vector< IFDDir::Ref > & OpenRaw::Internals::IFDFileContainer::directories ( )

Get the directories, loading them if necessary

Returns
the directories

Definition at line 87 of file ifdfilecontainer.cpp.

References countDirectories().

Referenced by OpenRaw::Internals::IFDFile::_enumThumbnailSizes().

size_t OpenRaw::Internals::IFDFileContainer::getDirectoryDataSize ( )

get the extra data size chunk associated to the current image directory

Returns
the size of the data chunk in bytes

Definition at line 121 of file ifdfilecontainer.cpp.

References OpenRaw::Internals::RawContainer::m_file, OpenRaw::Internals::RawContainer::readInt32(), and OpenRaw::IO::Stream::seek().

IFDFileContainer::EndianType OpenRaw::Internals::IFDFileContainer::isMagicHeader ( const char *  p,
int  len 
)
virtual

Check the IFD magic header

Parameters
pthe pointer to check
lenthe length of the block to check. Likely to be at least 4.
Returns
the endian if it is the magic header

subclasses needs to override it for like Olympus RAW

Reimplemented in OpenRaw::Internals::MRWContainer, and OpenRaw::Internals::OrfContainer.

Definition at line 56 of file ifdfilecontainer.cpp.

References OpenRaw::Internals::RawContainer::ENDIAN_BIG, and OpenRaw::Internals::RawContainer::ENDIAN_LITTLE.

int OpenRaw::Internals::IFDFileContainer::lastError ( ) const
inline

Return the last error

Returns
the error code

Definition at line 116 of file ifdfilecontainer.h.

bool OpenRaw::Internals::IFDFileContainer::locateDirsPreHook ( )
protectedvirtual

hook to be called at the start of _locateDirs()

Reimplemented in OpenRaw::Internals::MRWContainer.

Definition at line 144 of file ifdfilecontainer.cpp.

IFDDir::Ref OpenRaw::Internals::IFDFileContainer::setDirectory ( int  dir)

Set the current directory

Parameters
dirthe index of the directory to read, or one of the specific IFD index values that are < -1
Returns
NULL if no error, or return the reference to the current directory

Definition at line 96 of file ifdfilecontainer.cpp.

References countDirectories().


The documentation for this class was generated from the following files: