Class: FLV::Edit::Processor::Join
Overview
Join is a Processor class (see Base and desc)
Constant Summary
Constants included
from Dispatcher
Dispatcher::ALL_EVENTS, Dispatcher::EVENT_TRIGGER, Dispatcher::EVENT_TRIGGER_LIST, Dispatcher::MAIN_EVENTS
Instance Attribute Summary
Attributes inherited from Base
#options
Instance Method Summary
collapse
Methods included from Dispatcher
#absorb, #dispatch_instead, included, #initialize, #stop
Methods inherited from Base
#clone, #each_source, #initialize, #process_all
Instance Method Details
#each(&block) ⇒ Object
17
18
19
20
|
# File 'lib/flvedit/processor/join.rb', line 17
def each(&block)
return to_enum unless block_given?
each_source_without_join { super }
end
|
#each_source_with_join ⇒ Object
11
12
13
14
|
# File 'lib/flvedit/processor/join.rb', line 11
def each_source_with_join
return to_enum(:each_source) unless block_given?
yield
end
|
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/flvedit/processor/join.rb', line 42
def (h)
if = !@delta
@delta = 0
@wait_for_keyframe = false
@last_video_timestamp = 0
else
if @last_video_timestamp
last_interval = @last_video_timestamp - @next_to_last_video_timestamp
@delta += [@last_video_timestamp + last_interval, @last_timestamp].max
@wait_for_keyframe = true
else
@delta += @last_timestamp
end
dispatch_instead(Tag.new(@delta, evt = Event.new(:onNextSegment, :file => ::File.basename(h.path))))
end
end
|
#on_keyframe(tag) ⇒ Object
35
36
37
38
39
40
|
# File 'lib/flvedit/processor/join.rb', line 35
def on_keyframe(tag)
if @wait_for_keyframe
@wait_for_keyframe = false
@delta -= tag.timestamp
end
end
|
#on_tag(tag) ⇒ Object
22
23
24
25
26
27
28
29
|
# File 'lib/flvedit/processor/join.rb', line 22
def on_tag(tag)
if @wait_for_keyframe
absorb
else
@last_timestamp = tag.timestamp
tag.timestamp += @delta
end
end
|
#on_video(tag) ⇒ Object
31
32
33
|
# File 'lib/flvedit/processor/join.rb', line 31
def on_video(tag)
@next_to_last_video_timestamp, @last_video_timestamp = @last_video_timestamp, tag.timestamp
end
|