orffile.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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 const struct IFDFile::camera_ids_t ORFFile::s_def[] = {
00039 { "E-1 ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS,
00040 OR_TYPEID_OLYMPUS_E1) },
00041 { "E-10 ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS,
00042 OR_TYPEID_OLYMPUS_E10) },
00043 { "E-3 ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS,
00044 OR_TYPEID_OLYMPUS_E3) },
00045 { "E-300 ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS,
00046 OR_TYPEID_OLYMPUS_E300) },
00047 { "E-330 ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS,
00048 OR_TYPEID_OLYMPUS_E330) },
00049 { "E-400 ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS,
00050 OR_TYPEID_OLYMPUS_E400) },
00051 { "E-410 ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS,
00052 OR_TYPEID_OLYMPUS_E410) },
00053 { "E-500 ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS,
00054 OR_TYPEID_OLYMPUS_E500) },
00055 { "E-510 ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS,
00056 OR_TYPEID_OLYMPUS_E510) },
00057
00058 { 0, 0 }
00059 };
00060
00061 RawFile *ORFFile::factory(IO::Stream *s)
00062 {
00063 return new ORFFile(s);
00064 }
00065
00066
00067 ORFFile::ORFFile(IO::Stream *s)
00068 : IFDFile(s, OR_RAWFILE_TYPE_ORF, false)
00069 {
00070 _setIdMap(s_def);
00071 m_container = new ORFContainer(m_io, 0);
00072 }
00073
00074 ORFFile::~ORFFile()
00075 {
00076 }
00077
00078 IFDDir::Ref ORFFile::_locateCfaIfd()
00079 {
00080
00081 if(!m_mainIfd) {
00082 m_mainIfd = _locateMainIfd();
00083 }
00084 return m_mainIfd;
00085 }
00086
00087
00088 IFDDir::Ref ORFFile::_locateMainIfd()
00089 {
00090 return m_container->setDirectory(0);
00091 }
00092
00093
00094
00095 ::or_error ORFFile::_getRawData(RawData & data, uint32_t )
00096 {
00097 if(!m_cfaIfd) {
00098 m_cfaIfd = _locateCfaIfd();
00099 }
00100 return _getRawDataFromDir(data, m_cfaIfd);
00101 }
00102
00103 }
00104 }
00105