Class: FLV::Tag

Inherits:
Object
  • Object
show all
Defined in:
lib/flv/tag.rb,
lib/flv/tag/data.rb,
lib/flv/tag/audio.rb,
lib/flv/tag/video.rb

Direct Known Subclasses

Audio, Data, Video

Defined Under Namespace

Classes: Audio, Data, Video

Constant Summary collapse

METADATA_TYPE =
0x12
AUDIO_TYPE =
0x08
VIDEO_TYPE =
0x09

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(io) ⇒ Tag

Returns a new instance of Tag.



23
24
25
26
# File 'lib/flv/tag.rb', line 23

def initialize(io)
  @reader = StreamReader.new(io)
  read
end

Instance Attribute Details

Returns the value of attribute footer.



13
14
15
# File 'lib/flv/tag.rb', line 13

def footer
  @footer
end

#lengthObject (readonly)

Returns the value of attribute length.



13
14
15
# File 'lib/flv/tag.rb', line 13

def length
  @length
end

#raw_dataObject (readonly)

Returns the value of attribute raw_data.



13
14
15
# File 'lib/flv/tag.rb', line 13

def raw_data
  @raw_data
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



13
14
15
# File 'lib/flv/tag.rb', line 13

def timestamp
  @timestamp
end

Class Method Details

.read(io) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/flv/tag.rb', line 15

def self.read(io)
  case io.readbyte
  when METADATA_TYPE  then Data.new(io)
  when AUDIO_TYPE     then Audio.new(io)
  when VIDEO_TYPE     then Video.new(io)
  end
end

Instance Method Details

#inspectObject



28
29
30
# File 'lib/flv/tag.rb', line 28

def inspect
  "#<#{self.class}>"
end