00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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 "peffile.h"
00033
00034 using namespace Debug;
00035
00036 namespace OpenRaw {
00037
00038
00039 namespace Internals {
00040
00041 RawFile *PEFFile::factory(const char* _filename)
00042 {
00043 return new PEFFile(_filename);
00044 }
00045
00046 PEFFile::PEFFile(const char* _filename)
00047 : IFDFile(_filename, OR_RAWFILE_TYPE_PEF)
00048 {
00049 }
00050
00051
00052 PEFFile::~PEFFile()
00053 {
00054 }
00055
00056 IFDDir::Ref PEFFile::_locateCfaIfd()
00057 {
00058
00059 if(!m_mainIfd) {
00060 m_mainIfd = _locateMainIfd();
00061 }
00062 return m_mainIfd;
00063 }
00064
00065
00066 IFDDir::Ref PEFFile::_locateMainIfd()
00067 {
00068 return m_container->setDirectory(0);
00069 }
00070
00071 ::or_error PEFFile::_getRawData(RawData & data, uint32_t )
00072 {
00073 ::or_error err;
00074 if(!m_cfaIfd) {
00075 m_cfaIfd = _locateCfaIfd();
00076 }
00077 err = _getRawDataFromDir(data, m_cfaIfd);
00078 if(err == OR_ERROR_NONE) {
00079 uint16_t compression = 0;
00080 m_cfaIfd->getValue(IFD::EXIF_TAG_COMPRESSION, compression);
00081 switch(compression) {
00082 case 1:
00083 data.setDataType(OR_DATA_TYPE_CFA);
00084 break;
00085 case 65535:
00086
00087 break;
00088 default:
00089 break;
00090 }
00091 }
00092 return err;
00093 }
00094 }
00095 }
00096