29 #include "metavalue.hpp" 30 #include "rafmetacontainer.hpp" 31 #include "io/stream.hpp" 36 RafMetaValue::RafMetaValue(uint16_t tag, uint16_t size,
const MetaValue & v)
43 RafMetaValue::~RafMetaValue()
47 RafMetaContainer::RafMetaContainer(
const IO::Stream::Ptr &_file)
48 : RawContainer(_file, 0)
51 setEndian(ENDIAN_BIG);
54 uint32_t RafMetaContainer::count()
62 RafMetaValue::Ref RafMetaContainer::getValue(uint16_t tag)
67 std::map<uint16_t, RafMetaValue::Ref>::const_iterator iter = m_tags.find(tag);
68 if(iter != m_tags.end()) {
71 return RafMetaValue::Ref();
74 void RafMetaContainer::_read()
76 auto result = readUInt32(m_file);
78 LOGERR(
"Couldn't read RAF meta count\n");
81 m_count = result.unwrap();
83 for(uint32_t i = 0; i < m_count; i++) {
84 auto result16 = readUInt16(m_file);
85 if (result16.empty()) {
88 uint16_t tag = result16.unwrap();
90 result16 = readUInt16(m_file);
91 if (result16.empty()) {
94 uint16_t size = result16.unwrap();
98 auto result32 = readUInt32(m_file);
100 v = MetaValue::value_t(result32.unwrap());
105 content = (
char*)calloc(1, size + 1);
107 m_file->read(content, size);
108 v = MetaValue::value_t(std::string(content));
112 RafMetaValue::Ref value = std::make_shared<RafMetaValue>(tag, size, MetaValue(v));
113 m_tags.insert(std::make_pair(tag, value));
CIFF is the container for CRW files. It is an attempt from Canon to make this a standard. I guess it failed.