Class: Timecode::ComputationValues

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fps, drop_frame) ⇒ ComputationValues

Returns a new instance of ComputationValues.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/timecode.rb', line 20

def initialize(fps, drop_frame)
  rounded_base = fps.round
  if (drop_frame)
    # first 2 frame numbers shall be omitted at the start of each minute,
    # except minutes 0, 10, 20, 30, 40 and 50
    @drop_count = 2
    if (fps > 59 && fps < 60)
      @drop_count *= 2
    end

    @frames_per_min = rounded_base * 60 - @drop_count
    @frames_per_10_min = @frames_per_min * 10 + @drop_count
  else
    @frames_per_min = rounded_base * 60
    @frames_per_10_min = @frames_per_min * 10
  end

  @frames_per_hour = @frames_per_10_min * 6
  @nd_frames_per_min = rounded_base * 60
end

Instance Attribute Details

#drop_countObject (readonly)

Returns the value of attribute drop_count.



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

def drop_count
  @drop_count
end

#frames_per_10_minObject (readonly)

Returns the value of attribute frames_per_10_min.



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

def frames_per_10_min
  @frames_per_10_min
end

#frames_per_hourObject (readonly)

Returns the value of attribute frames_per_hour.



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

def frames_per_hour
  @frames_per_hour
end

#frames_per_minObject (readonly)

Returns the value of attribute frames_per_min.



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

def frames_per_min
  @frames_per_min
end

#nd_frames_per_minObject (readonly)

Returns the value of attribute nd_frames_per_min.



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

def nd_frames_per_min
  @nd_frames_per_min
end