libopenraw
lib
orfcontainer.cpp
1
/*
2
* libopenraw - orfcontainer.cpp
3
*
4
* Copyright (C) 2006-2016 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
Trace
(DEBUG1) <<
"Identified EL ORF file. Subtype = "
<< p[3]
51
<<
"\n"
;
52
subtype_ = p[3];
53
return
ENDIAN_LITTLE;
54
}
55
}
else
if
((p[0] ==
'M'
) && (p[1] ==
'M'
)) {
56
if
((p[3] ==
'R'
) && ((p[2] ==
'O'
) || (p[2] ==
'S'
))) {
57
58
Trace
(DEBUG1) <<
"Identified BE ORF file. Subtype = "
<< p[2]
59
<<
"\n"
;
60
subtype_ = p[2];
61
return
ENDIAN_BIG;
62
}
63
}
64
65
Trace
(ERROR) <<
"Unidentified ORF file\n"
;
66
67
return
ENDIAN_NULL;
68
}
69
}
70
}
OpenRaw
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
Debug::Trace
Definition:
trace.hpp:54
OpenRaw::Internals::OrfContainer::isMagicHeader
virtual IfdFileContainer::EndianType isMagicHeader(const char *p, int len) override
Definition:
orfcontainer.cpp:41
Debug
Definition:
trace.cpp:30
OpenRaw::Internals::RawContainer::EndianType
EndianType
Definition:
rawcontainer.hpp:41
OpenRaw::Internals::OrfContainer::~OrfContainer
virtual ~OrfContainer()
Definition:
orfcontainer.cpp:37
Generated by
1.8.12