Class: EDL::Cutter

Inherits:
Object
  • Object
show all
Defined in:
lib/edl/cutter.rb

Overview

Can chop an offline edit into events according to the EDL

Direct Known Subclasses

FFMpegCutter

Instance Method Summary collapse

Constructor Details

#initialize(source_path) ⇒ Cutter

:nodoc:



6
7
8
# File 'lib/edl/cutter.rb', line 6

def initialize(source_path)
  @source_path = source_path
end

Instance Method Details

#cut(edl) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/edl/cutter.rb', line 10

def cut(edl)
  source_for_cutting = edl.from_zero # .without_transitions.without_generators
  # We need to use the original length in record
  source_for_cutting.events.each do |evt|
    cut_segment(evt, evt.rec_start_tc, evt.rec_start_tc + evt.length)
  end
end

#cut_segment(evt, start_at, end_at) ⇒ Object



18
19
20
# File 'lib/edl/cutter.rb', line 18

def cut_segment(evt, start_at, end_at)
  STDERR.puts "Cutting #{@source_path} from #{start_at} to #{end_at} - #{evt.num}"
end