libopenraw

erffile.cpp

00001 /*
00002  * libopenraw - erffile.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 
00022 #include <iostream>
00023 #include <libopenraw++/thumbnail.h>
00024 #include <libopenraw++/rawdata.h>
00025 
00026 #include "debug.h"
00027 #include "ifd.h"
00028 #include "ifdfilecontainer.h"
00029 #include "ifddir.h"
00030 #include "ifdentry.h"
00031 #include "io/file.h"
00032 #include "erffile.h"
00033 
00034 using namespace Debug;
00035 
00036 namespace OpenRaw {
00037 
00038 
00039     namespace Internals {
00040 
00041         const IFDFile::camera_ids_t ERFFile::s_def[] = {
00042             { "R-D1", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_EPSON,
00043                                            OR_TYPEID_EPSON_RD1) },
00044             { 0, 0 }
00045         };
00046 
00047 
00048         RawFile *ERFFile::factory(IO::Stream *s)
00049         {
00050             return new ERFFile(s);
00051         }
00052 
00053         ERFFile::ERFFile(IO::Stream *s)
00054             : TiffEpFile(s, OR_RAWFILE_TYPE_ERF)
00055         {
00056             _setIdMap(s_def);
00057         }
00058 
00059 
00060         ERFFile::~ERFFile()
00061         {
00062         }
00063 
00064         ::or_error ERFFile::_getRawData(RawData & data, uint32_t /*options*/)
00065         {
00066             ::or_error err;
00067             m_cfaIfd = _locateCfaIfd();
00068             if(m_cfaIfd) {
00069                 err = _getRawDataFromDir(data, m_cfaIfd);
00070             }
00071             else {
00072                 err = OR_ERROR_NOT_FOUND;
00073             }
00074             return err;
00075         }
00076     }
00077 }
00078