libopenraw
|
00001 /* 00002 * libopenraw - ifdfile.h 00003 * 00004 * Copyright (C) 2006-2008 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 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(IO::Stream * s, 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 void _identifyId(); 00102 00103 virtual MetaValue *_getMetaValue(int32_t meta_index); 00104 00105 IFDDir::Ref m_cfaIfd; 00106 IFDDir::Ref m_mainIfd; 00110 IFDDir::Ref m_exifIfd; 00111 private: 00112 00113 IFDFile(const IFDFile&); 00114 IFDFile & operator=(const IFDFile &); 00115 00116 virtual ::or_error _getThumbnail(uint32_t size, Thumbnail & thumbnail); 00117 }; 00118 00119 } 00120 } 00121 00122 00123 #endif