Class: FLV::Event
- Inherits:
-
Hash
- Object
- Hash
- FLV::Event
- Includes:
- Body, Packable
- Defined in:
- lib/flvedit/flv/event.rb
Overview
The body of a tag containing meta data, cue points or last second information These behave like a Hash. The keys should be symbols while the values can be about any type, including arrays and hashes.
Constant Summary collapse
- TYPICAL_EVENTS =
[:onMetaData, :onCuePoint, :onCaption, :onCaptionInfo, :onLastSecond, :onEvent]
Instance Attribute Summary collapse
-
#event ⇒ Object
Returns the value of attribute event.
Instance Method Summary collapse
- #debug(format) ⇒ Object
-
#initialize(event = :onMetaData, h = {}) ⇒ Event
constructor
A new instance of Event.
- #is?(what) ⇒ Boolean
-
#read_packed(io, options) ⇒ Object
:nodoc:.
-
#write_packed(io) ⇒ Object
:nodoc:.
Methods included from Body
Constructor Details
#initialize(event = :onMetaData, h = {}) ⇒ Event
Returns a new instance of Event.
11 12 13 14 |
# File 'lib/flvedit/flv/event.rb', line 11 def initialize(event = :onMetaData, h = {}) self.replace h self.event = event.to_sym end |
Instance Attribute Details
#event ⇒ Object
Returns the value of attribute event.
9 10 11 |
# File 'lib/flvedit/flv/event.rb', line 9 def event @event end |
Instance Method Details
#debug(format) ⇒ Object
29 30 31 32 |
# File 'lib/flvedit/flv/event.rb', line 29 def debug(format, *) format.values(:event => event) format.values(self) end |
#is?(what) ⇒ Boolean
34 35 36 |
# File 'lib/flvedit/flv/event.rb', line 34 def is?(what) event.to_s == what.to_s || super end |
#read_packed(io, options) ⇒ Object
:nodoc:
16 17 18 19 20 21 22 23 |
# File 'lib/flvedit/flv/event.rb', line 16 def read_packed(io,) #:nodoc: len = io.pos_change do evt, h = io >>:flv_value >>:flv_value self.event = evt.to_sym replace h end FLV::Util.double_check :size, [:bytes], len end |
#write_packed(io) ⇒ Object
:nodoc:
25 26 27 |
# File 'lib/flvedit/flv/event.rb', line 25 def write_packed(io,*) #:nodoc: io << [event.to_s, :flv_value] << [self, :flv_value] end |