Class: Ffmprb::Process::Input::Looping

Inherits:
ChainBase show all
Defined in:
lib/ffmprb/process/input/looping.rb

Instance Attribute Summary collapse

Attributes inherited from Ffmprb::Process::Input

#io, #process

Instance Method Summary collapse

Methods inherited from ChainBase

#chain_copy, #unfiltered, #unfiltered=

Methods inherited from Ffmprb::Process::Input

#args, #audio, audio_args, #chain_copy, #channel, #channel?, #copy, #crop, #cut, #loop, #mute, #pace, #pp, resolve, #reverse, #temporise_io!, #video, video_args, #volume

Constructor Details

#initialize(unfiltered, times) ⇒ Looping

Returns a new instance of Looping.



16
17
18
19
20
21
22
23
24
# File 'lib/ffmprb/process/input/looping.rb', line 16

def initialize(unfiltered, times)
  super unfiltered

  @times = times

  @raw = @_unfiltered = unfiltered
  # NOTE find the actual input io (not a filter)
  @raw = @raw.unfiltered  while @raw.respond_to? :unfiltered
end

Instance Attribute Details

#timesObject (readonly)

Returns the value of attribute times.



14
15
16
# File 'lib/ffmprb/process/input/looping.rb', line 14

def times
  @times
end

Instance Method Details

#filters_for(lbl, video:, audio:) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/ffmprb/process/input/looping.rb', line 26

def filters_for(lbl, video:, audio:)

  # The plan:
  # 1) Create and route an aux input which would hold the filtered, looped and parameterised stream off the raw input (keep the raw input)
  # 2) Tee+buffer the original raw input io: one stream goes back into the process throw the raw input io replacement fifo; the other is fed into the filtering process
  # 3) Which uses the same underlying filters to produce a filtered and parameterised stream, which is fed into the looping process through a N-Tee+buffer
  # 4) Invoke the looping process which just concatenates its N inputs and produces the new raw input (the aux input)

  # Looping
  # NOTE all the processing is done before looping

  aux_input(video: video, audio: audio).filters_for lbl,
    video: video && OpenStruct.new, audio: audio && OpenStruct.new
end