Class: FLV::Edit::Processor::Cut

Inherits:
Base
  • Object
show all
Defined in:
lib/flv/edit/processor/cut.rb

Instance Method Summary collapse

Methods included from Base

#getters, included, #is?, #size, #to_h

Instance Method Details

#on_headerObject



8
9
10
11
12
# File 'lib/flv/edit/processor/cut.rb', line 8

def on_header(*)
  @from, @to = options[:cut].begin, options[:cut].end
  @wait_for_keyframe = options[:keyframe_mode]
  @first_timestamp = nil
end

#on_tag(tag) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/flv/edit/processor/cut.rb', line 14

def on_tag(tag)
  if tag.timestamp > @to
    stop
  elsif (tag.timestamp < @from) || (@wait_for_keyframe &&= !tag.body.is?(:keyframe))
    absorb
  else
    @first_timestamp ||= tag.timestamp
    tag.timestamp -= @first_timestamp
  end
end