Class: SwfHeader

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(swf_file) ⇒ SwfHeader

Returns a new instance of SwfHeader.



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

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.



4
5
6
# File 'lib/swf_file/swf_header.rb', line 4

def avm_version
  @avm_version
end

#bit_countObject (readonly)

Returns the value of attribute bit_count.



4
5
6
# File 'lib/swf_file/swf_header.rb', line 4

def bit_count
  @bit_count
end

#fileObject (readonly)

Returns the value of attribute file.



4
5
6
# File 'lib/swf_file/swf_header.rb', line 4

def file
  @file
end

#frame_countObject (readonly)

Returns the value of attribute frame_count.



4
5
6
# File 'lib/swf_file/swf_header.rb', line 4

def frame_count
  @frame_count
end

#frame_rateObject (readonly)

Returns the value of attribute frame_rate.



4
5
6
# File 'lib/swf_file/swf_header.rb', line 4

def frame_rate
  @frame_rate
end

#heightObject (readonly)

Returns the value of attribute height.



4
5
6
# File 'lib/swf_file/swf_header.rb', line 4

def height
  @height
end

#signatureObject (readonly)

Returns the value of attribute signature.



4
5
6
# File 'lib/swf_file/swf_header.rb', line 4

def signature
  @signature
end

#sizeObject (readonly)

Returns the value of attribute size.



4
5
6
# File 'lib/swf_file/swf_header.rb', line 4

def size
  @size
end

#versionObject (readonly)

Returns the value of attribute version.



4
5
6
# File 'lib/swf_file/swf_header.rb', line 4

def version
  @version
end

#widthObject (readonly)

Returns the value of attribute width.



4
5
6
# File 'lib/swf_file/swf_header.rb', line 4

def width
  @width
end

#xmaxObject (readonly)

Returns the value of attribute xmax.



4
5
6
# File 'lib/swf_file/swf_header.rb', line 4

def xmax
  @xmax
end

#ymaxObject (readonly)

Returns the value of attribute ymax.



4
5
6
# File 'lib/swf_file/swf_header.rb', line 4

def ymax
  @ymax
end

Instance Method Details

#compressed?(memoize_result = true) ⇒ Boolean

Returns:

  • (Boolean)


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

def compressed?(memoize_result = true)
  buffer_compressed?(memoize_result)
end

#durationObject

Returns the duration in milliseconds



19
20
21
# File 'lib/swf_file/swf_header.rb', line 19

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

#to_hashObject Also known as: inspect



27
28
29
# File 'lib/swf_file/swf_header.rb', line 27

def to_hash
  Conversions::Hash.from_swf_header self
end

#to_sObject



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

def to_s
  "#{@file} #{@width}x#{@height} #{@frame_rate}fps"
end