Class: Exif::Canon
- Inherits:
-
Object
- Object
- Exif::Canon
- Defined in:
- lib/exifparser/makernote/canon.rb
Instance Method Summary collapse
-
#initialize(fin, tiff_origin, dataPos, byteOrder_module) ⇒ Canon
constructor
A new instance of Canon.
- #scan_IFD ⇒ Object
Constructor Details
#initialize(fin, tiff_origin, dataPos, byteOrder_module) ⇒ Canon
Returns a new instance of Canon.
445 446 447 448 449 450 451 |
# File 'lib/exifparser/makernote/canon.rb', line 445 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
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 |
# File 'lib/exifparser/makernote/canon.rb', line 453 def scan_IFD # # Canon MakerNote starts from 0 # @fin.pos = @dataPos + 0 # # get the number of tags # numDirs = decode_ushort(fin_read_n(2)) # # now scan them # 1.upto(numDirs) { curpos_tag = @fin.pos tag = parseTagID(fin_read_n(2)) tagclass = Tag.find(tag.hex, Tag::CanonIFDTable) 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 |