Class: EDL::Event

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

Overview

Represents an edit event (or, more specifically, an EDL line denoting a clip being part of an EDL event)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) {|_self| ... } ⇒ Event

Returns a new instance of Event

Yields:

  • (_self)

Yield Parameters:

  • _self (EDL::Event)

    the object that the method was called on


48
49
50
51
# File 'lib/edl/event.rb', line 48

def initialize(opts = {})
  opts.each_pair { |k, v| send("#{k}=", v) }
  yield(self) if block_given?
end

Instance Attribute Details

#clip_nameObject

Clip name contained in FROM CLIP NAME: comment


34
35
36
# File 'lib/edl/event.rb', line 34

def clip_name
  @clip_name
end

#commentsObject

:nodoc:


31
32
33
# File 'lib/edl/event.rb', line 31

def comments
  @comments
end

#line_numberObject

Where is this event located in the original file


46
47
48
# File 'lib/edl/event.rb', line 46

def line_number
  @line_number
end

#numObject

Event number as in the EDL


7
8
9
# File 'lib/edl/event.rb', line 7

def num
  @num
end

#outgoing_transition_durationObject

:nodoc:


43
44
45
# File 'lib/edl/event.rb', line 43

def outgoing_transition_duration
  @outgoing_transition_duration
end

#rec_end_tcObject

Record end timecode of the event in the master as in the EDL, outgoing transition is not included


28
29
30
# File 'lib/edl/event.rb', line 28

def rec_end_tc
  @rec_end_tc
end

#rec_start_tcObject

Record start timecode of the event in the master as in the EDL


24
25
26
# File 'lib/edl/event.rb', line 24

def rec_start_tc
  @rec_start_tc
end

#reelObject

Reel name as in the EDL


10
11
12
# File 'lib/edl/event.rb', line 10

def reel
  @reel
end

#src_end_tcObject

Source end timecode of the last frame as in the EDL, no timewarps or dissolves included


21
22
23
# File 'lib/edl/event.rb', line 21

def src_end_tc
  @src_end_tc
end

#src_start_tcObject

Source start timecode of the start frame as in the EDL, no timewarps or dissolves included


17
18
19
# File 'lib/edl/event.rb', line 17

def src_start_tc
  @src_start_tc
end

#timewarpObject

Timewarp metadata (an EDL::Timewarp), or nil if no retime is made


37
38
39
# File 'lib/edl/event.rb', line 37

def timewarp
  @timewarp
end

#trackObject

Event tracks as in the EDL


13
14
15
# File 'lib/edl/event.rb', line 13

def track
  @track
end

#transitionObject

Incoming transition metadata (EDL::Transition), or nil if no transition is used


40
41
42
# File 'lib/edl/event.rb', line 40

def transition
  @transition
end

Instance Method Details

#black?Boolean Also known as: slug?

Is this a black slug?

Returns:

  • (Boolean)

106
107
108
# File 'lib/edl/event.rb', line 106

def black?
  reel == 'BL'
end

#capture_from_tcObject

Capture from (and including!) this timecode to complete this event including timewarps and transitions


129
130
131
# File 'lib/edl/event.rb', line 129

def capture_from_tc
  @timewarp ? @timewarp.source_used_from : src_start_tc
end

#capture_to_and_including_tcObject

Capture up to AND INCLUDING this timecode to complete this event including timewarps and transitions


134
135
136
# File 'lib/edl/event.rb', line 134

def capture_to_and_including_tc
  capture_to_tc - 1
end

#capture_to_tcObject

Capture up to BUT NOT INCLUDING this timecode to complete this event including timewarps and transitions


139
140
141
# File 'lib/edl/event.rb', line 139

def capture_to_tc
  @timewarp ? @timewarp.source_used_upto : (src_end_tc + outgoing_transition_duration)
end

#copy_properties_to(evt) ⇒ Object


77
78
79
80
81
82
# File 'lib/edl/event.rb', line 77

def copy_properties_to(evt)
  %w[num reel track src_start_tc src_end_tc rec_start_tc rec_end_tc].each do |k|
    evt.send("#{k}=", send(k)) if evt.respond_to?(k)
  end
  evt
end

#ends_with_transition?Boolean

Returns true if the clip ends with a transition (if the next clip starts with a transition)

Returns:

  • (Boolean)

96
97
98
# File 'lib/edl/event.rb', line 96

def ends_with_transition?
  outgoing_transition_duration > 0
end

#generator?Boolean

Returns true if this event is a generator

Returns:

  • (Boolean)

157
158
159
# File 'lib/edl/event.rb', line 157

def generator?
  black? || %(AX GEN).include?(reel)
end

#has_timewarp?Boolean

Returns true if the clip has a timewarp (speed ramp, motion memory, you name it)

Returns:

  • (Boolean)

101
102
103
# File 'lib/edl/event.rb', line 101

def has_timewarp?
  !timewarp.nil?
end

#has_transition?Boolean Also known as: starts_with_transition?

Returns true if the clip starts with a transiton (not a jump cut)

Returns:

  • (Boolean)

85
86
87
# File 'lib/edl/event.rb', line 85

def has_transition?
  !!@transition
end

#incoming_transition_durationObject

The duration of the incoming transition, or 0 if no transition is used


91
92
93
# File 'lib/edl/event.rb', line 91

def incoming_transition_duration
  @transition ? @transition.duration : 0
end

#inspectObject


58
59
60
# File 'lib/edl/event.rb', line 58

def inspect
  to_s
end

#rec_lengthObject

Get the record length of the event (how long it occupies in the EDL without an eventual outgoing transition)


112
113
114
# File 'lib/edl/event.rb', line 112

def rec_length
  (rec_end_tc.to_i - rec_start_tc.to_i).to_i
end

#rec_length_with_transitionObject

Get the record length of the event (how long it occupies in the EDL with an eventual outgoing transition)


117
118
119
# File 'lib/edl/event.rb', line 117

def rec_length_with_transition
  rec_length + outgoing_transition_duration.to_i
end

#reverse?Boolean Also known as: reversed?

Is the clip reversed in the edit?

Returns:

  • (Boolean)

72
73
74
# File 'lib/edl/event.rb', line 72

def reverse?
  (timewarp && timewarp.reverse?)
end

#speedObject

Speed of this clip in percent relative to the source speed. 100 for non-timewarped events


144
145
146
# File 'lib/edl/event.rb', line 144

def speed
  @timewarp ? @timewarp.speed : 100.0
end

#src_lengthObject Also known as: capture_length

How long does the capture need to be to complete this event including timewarps and transitions


122
123
124
# File 'lib/edl/event.rb', line 122

def src_length
  @timewarp ? @timewarp.actual_length_of_source : rec_length_with_transition
end

#to_sObject

Output a textual description (will not work as an EDL line!)


54
55
56
# File 'lib/edl/event.rb', line 54

def to_s
  %w[num reel track src_start_tc src_end_tc rec_start_tc rec_end_tc].map { |a| send(a).to_s }.join('  ')
end