00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _IFD_FILE_H_
00024 #define _IFD_FILE_H_
00025
00026 #include <vector>
00027 #include <libopenraw/types.h>
00028 #include <libopenraw/consts.h>
00029 #include <libopenraw++/rawfile.h>
00030
00031 #include "ifddir.h"
00032
00033 namespace OpenRaw {
00034 namespace IO {
00035 class Stream;
00036 class File;
00037 }
00038
00039 namespace Internals {
00040 class IFFileContainer;
00041
00043 struct IFDThumbDesc
00044 {
00045 IFDThumbDesc(uint32_t _x, uint32_t _y, ::or_data_type _type,
00046 const IFDDir::Ref & _ifddir)
00047 : x(_x), y(_y), type(_type), ifddir(_ifddir)
00048 {
00049 }
00050 IFDThumbDesc()
00051 : x(0), y(0), type(OR_DATA_TYPE_NONE), ifddir((IFDDir*)NULL)
00052 {
00053 }
00054 uint32_t x;
00055 uint32_t y;
00056 ::or_data_type type;
00057 IFDDir::Ref ifddir;
00058 };
00059
00060
00062 class IFDFile
00063 : public OpenRaw::RawFile
00064 {
00065
00066 protected:
00067 IFDFile(const char *_filename, Type _type,
00068 bool instantiateContainer = true);
00069 virtual ~IFDFile();
00070
00076 virtual ::or_error _enumThumbnailSizes(std::vector<uint32_t> &list);
00077
00083 virtual ::or_error _locateThumbnail(const IFDDir::Ref & dir,
00084 std::vector<uint32_t> &list);
00090 ::or_error _getRawDataFromDir(RawData & data, IFDDir::Ref & dir);
00091
00092 typedef std::map<uint32_t, IFDThumbDesc> ThumbLocations;
00093 ThumbLocations m_thumbLocations;
00094 IO::Stream *m_io;
00095 IFDFileContainer *m_container;
00097 virtual IFDDir::Ref _locateCfaIfd() = 0;
00098 virtual IFDDir::Ref _locateMainIfd() = 0;
00099 virtual IFDDir::Ref _locateExifIfd();
00100
00101 virtual MetaValue *_getMetaValue(int32_t meta_index);
00102
00103 IFDDir::Ref m_cfaIfd;
00104 IFDDir::Ref m_mainIfd;
00108 IFDDir::Ref m_exifIfd;
00110 private:
00111
00112 IFDFile(const IFDFile&);
00113 IFDFile & operator=(const IFDFile &);
00114
00115 virtual ::or_error _getThumbnail(uint32_t size, Thumbnail & thumbnail);
00116 };
00117
00118 }
00119 }
00120
00121
00122 #endif