libopenraw
|
00001 /* 00002 * libopenraw - ifdfilecontainer.h 00003 * 00004 * Copyright (C) 2005-2006 Hubert Figuiere 00005 * 00006 * This library is free software: you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public License 00008 * as published by the Free Software Foundation, either version 3 of 00009 * the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library. If not, see 00018 * <http://www.gnu.org/licenses/>. 00019 */ 00020 00029 #ifndef _IFDFILECONTAINER_H_ 00030 #define _IFDFILECONTAINER_H_ 00031 00032 #include <vector> 00033 00034 #include <libopenraw/consts.h> 00035 #include <libopenraw/types.h> 00036 00037 #include "rawcontainer.h" 00038 #include "ifddir.h" 00039 #include "ifdentry.h" 00040 00041 namespace OpenRaw { 00042 namespace Internals { 00043 00044 00045 class IFDFileContainer 00046 : public RawContainer 00047 { 00048 public: 00054 IFDFileContainer(IO::Stream *file, off_t offset); 00056 virtual ~IFDFileContainer(); 00057 00062 enum { 00063 IFD_NONE = -1, 00064 IFD_EXIF = -2, 00065 IFD_GPS = -3, 00066 IFD_INTEROP = -4 00067 }; 00068 00078 virtual EndianType isMagicHeader(const char *p, int len); 00079 00086 IFDDir::Ref setDirectory(int dir); 00092 int countDirectories(void); 00096 std::vector<IFDDir::Ref> & directories(); 00097 00103 int currentDirectory(); 00104 00109 size_t getDirectoryDataSize(); 00110 00111 00116 int lastError() const 00117 { 00118 return m_error; 00119 } 00120 00121 int exifOffsetCorrection() const 00122 { 00123 return m_exif_offset_correction; 00124 } 00125 void setExifOffsetCorrection(int corr) 00126 { 00127 m_exif_offset_correction = corr; 00128 } 00129 protected: 00131 virtual bool locateDirsPreHook(); 00132 private: 00133 int m_error; 00134 int m_exif_offset_correction; 00135 00136 IFDDir::Ref m_current_dir; 00137 std::vector<IFDDir::Ref> m_dirs; 00138 00139 bool _locateDirs(); 00140 }; 00141 00142 } 00143 } 00144 00145 #endif