Class: Exif::Sigma

Inherits:
Object
  • Object
show all
Defined in:
lib/exifparser/makernote/sigma.rb

Instance Method Summary collapse

Constructor Details

#initialize(fin, tiff_origin, dataPos, byteOrder_module) ⇒ Sigma

Returns a new instance of Sigma.



178
179
180
181
182
183
184
# File 'lib/exifparser/makernote/sigma.rb', line 178

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_IFDObject



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
216
217
218
219
220
221
222
223
224
225
226
227
# File 'lib/exifparser/makernote/sigma.rb', line 186

def scan_IFD
  #
  # Sigma MakerNote starts from 10 byte from the origin
  #
  @fin.pos = @dataPos + 10

  #
  # 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::SigmaIFDTable)
    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