Class: SwfFile::SwfHeader

Inherits:
Object
  • Object
show all
Includes:
Assertions, Compression, Conversions, Parser
Defined in:
lib/swf_file/swf_header.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Assertions

#compressed?

Methods included from Conversions

#to_hash, #to_s

Constructor Details

#initialize(swf_file) ⇒ SwfHeader

Returns a new instance of SwfHeader.



13
14
15
16
17
# File 'lib/swf_file/swf_header.rb', line 13

def initialize(swf_file)
  @file = swf_file
  parse_header
  parse_packed_bits
end

Instance Attribute Details

#avm_versionObject (readonly)

Returns the value of attribute avm_version.



9
10
11
# File 'lib/swf_file/swf_header.rb', line 9

def avm_version
  @avm_version
end

#bit_countObject (readonly)

Returns the value of attribute bit_count.



9
10
11
# File 'lib/swf_file/swf_header.rb', line 9

def bit_count
  @bit_count
end

#fileObject (readonly)

Returns the value of attribute file.



9
10
11
# File 'lib/swf_file/swf_header.rb', line 9

def file
  @file
end

#frame_countObject (readonly)

Returns the value of attribute frame_count.



9
10
11
# File 'lib/swf_file/swf_header.rb', line 9

def frame_count
  @frame_count
end

#frame_rateObject (readonly)

Returns the value of attribute frame_rate.



9
10
11
# File 'lib/swf_file/swf_header.rb', line 9

def frame_rate
  @frame_rate
end

#heightObject (readonly)

Returns the value of attribute height.



9
10
11
# File 'lib/swf_file/swf_header.rb', line 9

def height
  @height
end

#signatureObject (readonly)

Returns the value of attribute signature.



9
10
11
# File 'lib/swf_file/swf_header.rb', line 9

def signature
  @signature
end

#sizeObject (readonly)

Returns the value of attribute size.



9
10
11
# File 'lib/swf_file/swf_header.rb', line 9

def size
  @size
end

#versionObject (readonly)

Returns the value of attribute version.



9
10
11
# File 'lib/swf_file/swf_header.rb', line 9

def version
  @version
end

#widthObject (readonly)

Returns the value of attribute width.



9
10
11
# File 'lib/swf_file/swf_header.rb', line 9

def width
  @width
end

#xmaxObject (readonly)

Returns the value of attribute xmax.



9
10
11
# File 'lib/swf_file/swf_header.rb', line 9

def xmax
  @xmax
end

#ymaxObject (readonly)

Returns the value of attribute ymax.



9
10
11
# File 'lib/swf_file/swf_header.rb', line 9

def ymax
  @ymax
end

Instance Method Details

#durationObject

Returns the duration in milliseconds The formula used in this method used to be ((@frame_count / @frame_rate.to_f).round(5) * 1000).round. This however, was not compatible with ruby 1.8, thus reverted to its current form.



22
23
24
# File 'lib/swf_file/swf_header.rb', line 22

def duration
  ((@frame_count / @frame_rate.to_f * 10**5).round.to_f / 10**5 * 1000).round
end