Aggiunge overlay server-side burn-in e stabilizza diretta live.
Tabellone, badge e brand sono ricodificati nel flusso _air via OverlayRelay; sync punteggio HTTP, volume condiviso rails/sidekiq, qualità 720p migliorata e badge CONNECTING in ripresa da pausa. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
32
backend/bin/overlay_png_feeder.rb
Normal file
32
backend/bin/overlay_png_feeder.rb
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env ruby
|
||||
# Invia overlay.png aggiornata a ffmpeg via image2pipe (FIFO).
|
||||
# ffmpeg con -loop 1 legge il file una sola volta: questo processo rilegge il PNG
|
||||
# quando cambia mtime (punteggio, badge stato, …).
|
||||
require "fileutils"
|
||||
|
||||
pipe_path = ARGV.fetch(0)
|
||||
png_path = ARGV.fetch(1)
|
||||
poll_sec = (ARGV[2] || ENV.fetch("OVERLAY_PIPE_POLL_SEC", "0.4")).to_f
|
||||
|
||||
abort "pipe mancante: #{pipe_path}" unless File.exist?(pipe_path)
|
||||
abort "png mancante: #{png_path}" unless File.exist?(png_path)
|
||||
|
||||
stop = false
|
||||
trap("TERM") { stop = true }
|
||||
trap("INT") { stop = true }
|
||||
|
||||
# image2pipe richiede frame continui: inviamo la PNG a ritmo fisso ( anche se invariata ).
|
||||
File.open(pipe_path, "wb") do |pipe|
|
||||
loop do
|
||||
break if stop
|
||||
|
||||
if File.exist?(png_path)
|
||||
pipe.write(File.binread(png_path))
|
||||
pipe.flush
|
||||
end
|
||||
|
||||
sleep poll_sec
|
||||
end
|
||||
rescue Errno::EPIPE
|
||||
# ffmpeg chiuso
|
||||
end
|
||||
Reference in New Issue
Block a user