libopenraw
orfcontainer.cpp
1 /*
2  * libopenraw - orfcontainer.cpp
3  *
4  * Copyright (C) 2006-2017 Hubert Figuière
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 #include <libopenraw/debug.h>
22 
23 #include "trace.hpp"
24 #include "orfcontainer.hpp"
25 
26 using namespace Debug;
27 
28 namespace OpenRaw {
29 
30 namespace Internals {
31 
32 OrfContainer::OrfContainer(const IO::Stream::Ptr &_file, off_t _offset)
33  : IfdFileContainer(_file, _offset), subtype_(0)
34 {
35 }
36 
37 OrfContainer::~OrfContainer()
38 {
39 }
40 
41 IfdFileContainer::EndianType OrfContainer::isMagicHeader(const char *p, int len)
42 {
43  if (len < 4) {
44  // we need at least 4 bytes to check
45  return ENDIAN_NULL;
46  }
47  if ((p[0] == 'I') && (p[1] == 'I')) {
48  if ((p[2] == 'R') && ((p[3] == 'O') || (p[3] == 'S'))) {
49 
50  LOGDBG1("Identified EL ORF file. Subtype = %c\n", p[3]);
51  subtype_ = p[3];
52  return ENDIAN_LITTLE;
53  }
54  } else if ((p[0] == 'M') && (p[1] == 'M')) {
55  if ((p[3] == 'R') && ((p[2] == 'O') || (p[2] == 'S'))) {
56 
57  LOGDBG1("Identified BE ORF file. Subtype = %c\n", p[2]);
58  subtype_ = p[2];
59  return ENDIAN_BIG;
60  }
61  }
62 
63  LOGERR("Unidentified ORF file\n");
64 
65  return ENDIAN_NULL;
66 }
67 }
68 }
CIFF is the container for CRW files. It is an attempt from Canon to make this a standard. I guess it failed.
Definition: arwfile.cpp:30
Definition: trace.cpp:30