libopenraw
erffile.cpp
1 /*
2  * libopenraw - erffile.cpp
3  *
4  * Copyright (C) 2006-2008 Hubert Figuiere
5  *
6  * This library is free software: you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation, either version 3 of
9  * the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library. If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
21 
22 #include <iostream>
23 #include <libopenraw++/thumbnail.h>
24 #include <libopenraw++/rawdata.h>
25 
26 #include "trace.h"
27 #include "ifd.h"
28 #include "ifdfilecontainer.h"
29 #include "ifddir.h"
30 #include "ifdentry.h"
31 #include "io/file.h"
32 #include "erffile.h"
33 
34 using namespace Debug;
35 
36 namespace OpenRaw {
37 
38 
39  namespace Internals {
40 
41  const IFDFile::camera_ids_t ERFFile::s_def[] = {
42  { "R-D1", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_EPSON,
43  OR_TYPEID_EPSON_RD1) },
44  { 0, 0 }
45  };
46 
47 
48  RawFile *ERFFile::factory(IO::Stream *s)
49  {
50  return new ERFFile(s);
51  }
52 
53  ERFFile::ERFFile(IO::Stream *s)
54  : TiffEpFile(s, OR_RAWFILE_TYPE_ERF)
55  {
56  _setIdMap(s_def);
57  }
58 
59 
60  ERFFile::~ERFFile()
61  {
62  }
63 
64  ::or_error ERFFile::_getRawData(RawData & data, uint32_t /*options*/)
65  {
66  ::or_error err;
67  m_cfaIfd = _locateCfaIfd();
68  if(m_cfaIfd) {
69  err = _getRawDataFromDir(data, m_cfaIfd);
70  }
71  else {
72  err = OR_ERROR_NOT_FOUND;
73  }
74  return err;
75  }
76  }
77 }
78