orffile.cpp

00001 /*
00002  * libopenraw - orffile.cpp
00003  *
00004  * Copyright (C) 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
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of 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, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
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         RawFile *ORFFile::factory(const char* _filename)
00039         {
00040             return new ORFFile(_filename);
00041         }
00042 
00043 
00044         ORFFile::ORFFile(const char* _filename)
00045             : IFDFile(_filename, OR_RAWFILE_TYPE_ORF, false)
00046         {
00047              m_container = new ORFContainer(m_io, 0);
00048         }
00049         
00050         ORFFile::~ORFFile()
00051         {
00052         }
00053 
00054         IFDDir::Ref  ORFFile::_locateCfaIfd()
00055         {
00056             // in PEF the CFA IFD is the main IFD
00057             if(!m_mainIfd) {
00058                 m_mainIfd = _locateMainIfd();
00059             }
00060             return m_mainIfd;
00061         }
00062 
00063 
00064         IFDDir::Ref  ORFFile::_locateMainIfd()
00065         {
00066             return m_container->setDirectory(0);
00067         }
00068 
00069         ::or_error ORFFile::_getRawData(RawData & data, uint32_t /*options*/)
00070         {
00071             if(!m_cfaIfd) {
00072                 m_cfaIfd = _locateCfaIfd();
00073             }
00074             return _getRawDataFromDir(data, m_cfaIfd);
00075         }
00076 
00077     }
00078 }
00079 

Generated on Sun Mar 23 09:30:49 2008 for libopenraw by  doxygen 1.5.5