Class: FLV::Event

Inherits:
Hash
  • Object
show all
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

Instance Method Summary collapse

Methods included from Body

included

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

#eventObject

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

Returns:

  • (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,options) #: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, options[: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