Class: EDL::TimewarpMatcher
Instance Attribute Summary collapse
-
#fps ⇒ Object
readonly
Returns the value of attribute fps.
Instance Method Summary collapse
- #apply(stack, line) ⇒ Object
-
#initialize(fps) ⇒ TimewarpMatcher
constructor
A new instance of TimewarpMatcher.
Methods inherited from Matcher
Constructor Details
#initialize(fps) ⇒ TimewarpMatcher
Returns a new instance of TimewarpMatcher.
209 210 211 212 |
# File 'lib/edl.rb', line 209 def initialize(fps) @fps = fps @regexp = /M2(\s+)(\w+)(\s+)(\-?\d+\.\d+)(\s+)(\d{1,2}):(\d{1,2}):(\d{1,2}):(\d{1,2})/ end |
Instance Attribute Details
#fps ⇒ Object (readonly)
Returns the value of attribute fps.
207 208 209 |
# File 'lib/edl.rb', line 207 def fps @fps end |
Instance Method Details
#apply(stack, line) ⇒ Object
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
# File 'lib/edl.rb', line 214 def apply(stack, line) matches = line.scan(@regexp).flatten.map{|e| e.strip}.reject{|e| e.nil? || e.empty?} from_reel = matches.shift fps = matches.shift begin # FIXME tw_start_source_tc = Parser.timecode_from_line_elements(matches, @fps) rescue Timecode::Error => e raise ApplyError, "Invalid TC in timewarp (#{e})", line end evt_with_tw = stack.reverse.find{|e| e.src_start_tc == tw_start_source_tc && e.reel == from_reel } unless evt_with_tw raise ApplyError, "Cannot find event marked by timewarp", line else tw = Timewarp.new tw.actual_framerate, tw.clip = fps.to_f, evt_with_tw evt_with_tw.timewarp = tw end end |