libopenraw
|
00001 /* 00002 * libopenraw - orffile.cpp 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 #include <libopenraw++/thumbnail.h> 00022 #include <libopenraw++/rawdata.h> 00023 00024 #include "debug.h" 00025 #include "orffile.h" 00026 #include "ifd.h" 00027 #include "ifddir.h" 00028 #include "ifdentry.h" 00029 #include "orfcontainer.h" 00030 #include "io/file.h" 00031 00032 using namespace Debug; 00033 00034 namespace OpenRaw { 00035 00036 namespace Internals { 00037 00038 const struct IFDFile::camera_ids_t ORFFile::s_def[] = { 00039 { "E-1 ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS, 00040 OR_TYPEID_OLYMPUS_E1) }, 00041 { "E-10 ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS, 00042 OR_TYPEID_OLYMPUS_E10) }, 00043 { "E-3 ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS, 00044 OR_TYPEID_OLYMPUS_E3) }, 00045 { "E-300 ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS, 00046 OR_TYPEID_OLYMPUS_E300) }, 00047 { "E-330 ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS, 00048 OR_TYPEID_OLYMPUS_E330) }, 00049 { "E-400 ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS, 00050 OR_TYPEID_OLYMPUS_E400) }, 00051 { "E-410 ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS, 00052 OR_TYPEID_OLYMPUS_E410) }, 00053 { "E-500 ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS, 00054 OR_TYPEID_OLYMPUS_E500) }, 00055 { "E-510 ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS, 00056 OR_TYPEID_OLYMPUS_E510) }, 00057 00058 { 0, 0 } 00059 }; 00060 00061 RawFile *ORFFile::factory(IO::Stream *s) 00062 { 00063 return new ORFFile(s); 00064 } 00065 00066 00067 ORFFile::ORFFile(IO::Stream *s) 00068 : IFDFile(s, OR_RAWFILE_TYPE_ORF, false) 00069 { 00070 _setIdMap(s_def); 00071 m_container = new ORFContainer(m_io, 0); 00072 } 00073 00074 ORFFile::~ORFFile() 00075 { 00076 } 00077 00078 IFDDir::Ref ORFFile::_locateCfaIfd() 00079 { 00080 // in PEF the CFA IFD is the main IFD 00081 if(!m_mainIfd) { 00082 m_mainIfd = _locateMainIfd(); 00083 } 00084 return m_mainIfd; 00085 } 00086 00087 00088 IFDDir::Ref ORFFile::_locateMainIfd() 00089 { 00090 return m_container->setDirectory(0); 00091 } 00092 00093 00094 00095 ::or_error ORFFile::_getRawData(RawData & data, uint32_t /*options*/) 00096 { 00097 if(!m_cfaIfd) { 00098 m_cfaIfd = _locateCfaIfd(); 00099 } 00100 return _getRawDataFromDir(data, m_cfaIfd); 00101 } 00102 00103 } 00104 } 00105