Class: SwfFile::SwfHeader
- Inherits:
-
Object
- Object
- SwfFile::SwfHeader
- Includes:
- Assertions, Compression, Conversions, Parser
- Defined in:
- lib/swf_file/swf_header.rb
Instance Attribute Summary collapse
-
#avm_version ⇒ Object
readonly
Returns the value of attribute avm_version.
-
#bit_count ⇒ Object
readonly
Returns the value of attribute bit_count.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#frame_count ⇒ Object
readonly
Returns the value of attribute frame_count.
-
#frame_rate ⇒ Object
readonly
Returns the value of attribute frame_rate.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#signature ⇒ Object
readonly
Returns the value of attribute signature.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
-
#xmax ⇒ Object
readonly
Returns the value of attribute xmax.
-
#ymax ⇒ Object
readonly
Returns the value of attribute ymax.
Instance Method Summary collapse
-
#duration ⇒ Object
Returns the duration in milliseconds The formula used in this method used to be ((@frame_count / @frame_rate.to_f).round(5) * 1000).round.
-
#initialize(swf_file) ⇒ SwfHeader
constructor
A new instance of SwfHeader.
Methods included from Assertions
Methods included from Conversions
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_version ⇒ Object (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_count ⇒ Object (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 |
#file ⇒ Object (readonly)
Returns the value of attribute file.
9 10 11 |
# File 'lib/swf_file/swf_header.rb', line 9 def file @file end |
#frame_count ⇒ Object (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_rate ⇒ Object (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 |
#height ⇒ Object (readonly)
Returns the value of attribute height.
9 10 11 |
# File 'lib/swf_file/swf_header.rb', line 9 def height @height end |
#signature ⇒ Object (readonly)
Returns the value of attribute signature.
9 10 11 |
# File 'lib/swf_file/swf_header.rb', line 9 def signature @signature end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
9 10 11 |
# File 'lib/swf_file/swf_header.rb', line 9 def size @size end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
9 10 11 |
# File 'lib/swf_file/swf_header.rb', line 9 def version @version end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
9 10 11 |
# File 'lib/swf_file/swf_header.rb', line 9 def width @width end |
#xmax ⇒ Object (readonly)
Returns the value of attribute xmax.
9 10 11 |
# File 'lib/swf_file/swf_header.rb', line 9 def xmax @xmax end |
#ymax ⇒ Object (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
#duration ⇒ Object
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 |