Class: FLV
- Inherits:
-
Object
show all
- Defined in:
- lib/flv.rb,
lib/flv/tag.rb,
lib/flv/version.rb,
lib/flv/tag/data.rb,
lib/flv/tag/audio.rb,
lib/flv/tag/video.rb,
lib/flv/format_error.rb,
lib/flv/stream_reader.rb,
lib/flv/script_data_parser.rb
Defined Under Namespace
Classes: FormatError, ScriptDataParser, StreamReader, Tag
Constant Summary
collapse
- AUDIO_FLAG =
0x04
- VIDEO_FLAG =
0x01
- VERSION =
"0.1.0"
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(io) ⇒ FLV
Returns a new instance of FLV.
16
17
18
19
20
21
|
# File 'lib/flv.rb', line 16
def initialize(io)
@io = io
@reader = StreamReader.new(io)
end
|
Instance Attribute Details
#flags ⇒ Object
Returns the value of attribute flags.
14
15
16
|
# File 'lib/flv.rb', line 14
def flags
@flags
end
|
Class Method Details
.read(path) ⇒ Object
7
8
9
|
# File 'lib/flv.rb', line 7
def self.read(path)
new(File.open(path, "rb"))
end
|
Instance Method Details
#audio? ⇒ Boolean
23
24
25
|
# File 'lib/flv.rb', line 23
def audio?
(flags & AUDIO_FLAG).nonzero?
end
|
#each_tag ⇒ Object
35
36
37
38
39
40
41
|
# File 'lib/flv.rb', line 35
def each_tag
return enum_for(:each_tag) unless block_given?
until @io.eof?
yield Tag.read(@io)
end
end
|
31
32
33
|
# File 'lib/flv.rb', line 31
def tags
@tags ||= each_tag.to_a
end
|
#video? ⇒ Boolean
27
28
29
|
# File 'lib/flv.rb', line 27
def video?
(flags & VIDEO_FLAG).nonzero?
end
|