Class: Exif::Olympus
- Inherits:
-
Object
- Object
- Exif::Olympus
- Defined in:
- lib/exifparser/makernote/olympus.rb
Instance Method Summary collapse
-
#initialize(fin, tiff_origin, dataPos, byteOrder_module) ⇒ Olympus
constructor
A new instance of Olympus.
- #scan_IFD ⇒ Object
Constructor Details
#initialize(fin, tiff_origin, dataPos, byteOrder_module) ⇒ Olympus
Returns a new instance of Olympus.
169 170 171 172 173 174 175 |
# File 'lib/exifparser/makernote/olympus.rb', line 169 def initialize(fin, tiff_origin, dataPos, byteOrder_module) @fin = fin @tiffHeader0 = tiff_origin @dataPos = dataPos @byteOrder_module = byteOrder_module self.extend @byteOrder_module end |
Instance Method Details
#scan_IFD ⇒ Object
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
# File 'lib/exifparser/makernote/olympus.rb', line 177 def scan_IFD # # Olympus MakerNote starts from 8 byte from the origin. # @fin.pos = @dataPos + 8 # # get the number of tags # num_dirs = decode_ushort(fin_read_n(2)) # # now scan them # 1.upto(num_dirs) { curpos_tag = @fin.pos tag = parseTagID(fin_read_n(2)) tagclass = Tag.find(tag.hex, Tag::OlympusIFDTable) unit, formatter = Tag::Format::Unit[decode_ushort(fin_read_n(2))] count = decode_ulong(fin_read_n(4)) tagdata = fin_read_n(4) obj = tagclass.new(tag, "MakerNote", count) obj.extend formatter, @byteOrder_module obj.pos = curpos_tag if unit * count > 4 curpos = @fin.pos begin @fin.pos = @tiffHeader0 + decode_ulong(tagdata) obj.dataPos = @fin.pos obj.data = fin_read_n(unit*count) ensure @fin.pos = curpos end else obj.dataPos = @fin.pos - 4 obj.data = tagdata end obj.processData yield obj } end |