lib/ffmprb/process/input/looping.rb in ffmprb-0.11.4 vs lib/ffmprb/process/input/looping.rb in ffmprb-0.12.1
- old
+ new
@@ -39,25 +39,25 @@
end
protected
def aux_input(video:, audio:)
+ Ffmprb.logger.debug{"Creating aux inp with #{audio} / #{video}"}
# NOTE (2)
# NOTE replace the raw input io with a copy io, getting original fifo/file
intermediate_extname = Process.intermediate_channel_extname(video: @raw.io.channel?(:video), audio: @raw.io.channel?(:audio))
src_io = @raw.temporise_io!(intermediate_extname)
if src_io.extname != intermediate_extname # NOTE kinda like src_io is not suitable for piping
meh_src_io, src_io = src_io, File.temp_fifo(intermediate_extname)
Util::Thread.new "source converter" do
Ffmprb.process do
-
inp = input(meh_src_io)
- output(src_io, video: nil, audio: nil) do # XXX this is not properly tested, unfortunately
+ # TODO this is not properly tested, unfortunately
+ output src_io, video: video, audio: audio do
lay inp
end
-
end
end
end
cpy_io = File.temp_fifo(src_io.extname)
Ffmprb.logger.debug{"(L2) Temporising the raw input (#{src_io.path}) and creating copy (#{cpy_io.path})"}
@@ -85,11 +85,11 @@
buff_ios = (1..times).map{File.temp_fifo intermediate_extname}
Ffmprb.logger.debug{"Preprocessed #{dst_io.path} will be teed to #{buff_ios.map(&:path).join '; '}"}
Util::Thread.new "cloning buffer watcher" do
dst_io.threaded_buffered_copy_to(*buff_ios).tap do |io_buff|
Util::Thread.join_children!
- Ffmprb.logger.warn "Looping ~from #{src_io.path} finished before its consumer: if you just wanted to loop input #{Util.ffmpeg_inputs_max} times, that's fine, but if you expected it to loop indefinitely... #{Util.ffmpeg_inputs_max} is the maximum #loop can do at the moment, and it may just not be enough in this case (workaround by concatting or file a complaint at #{Ffmprb::GEM_GITHUB_URL}/issues please)." if times == Util.ffmpeg_inputs_max && io_buff.stats.blocks_buff == 0
+ Ffmprb.logger.warn "Looping ~from #{src_io.path} finished before its consumer: if you just wanted to loop input #{Util.ffmpeg_inputs_max} times, that's fine, but if you expected it to loop indefinitely... #{Util.ffmpeg_inputs_max} is the maximum #loop can do at the moment, and it may just not be enough in this case (workaround by concatting or something)." if times == Util.ffmpeg_inputs_max && io_buff.stats.blocks_buff == 0
end
end
# NOTE additional (filtered, processed and looped) input io
aux_io = File.temp_fifo(intermediate_extname)
@@ -102,10 +102,10 @@
Ffmprb.logger.debug{"(L4) Looping (#{buff_ios.map &:path}) into (#{aux_io.path})"}
begin # NOTE may not write its entire output, it's ok
Ffmprb.process parent: @raw.process, ignore_broken_pipes: false do
ins = buff_ios.map{ |i| input i }
- output(aux_io, video: nil, audio: nil) do
+ output(aux_io, video: video, audio: audio) do
ins.each{ |i| lay i }
end
end
rescue Util::BrokenPipeError