WIP: cattura in processo separato + close_stream (NON validata, sospesa)
This commit is contained in:
@@ -19,6 +19,7 @@ Config: ~/.config/ambilight/config.json
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
|
||||
@@ -193,7 +194,7 @@ def apply_params(zones, cfg):
|
||||
|
||||
def capture_loop(state, strip):
|
||||
"""Ciclo di cattura: sceglie il backend (portal o kmsgrab) e invia i frame."""
|
||||
from ambicapture import Capture, KmsgrabCapture, screencast_stream
|
||||
from ambicapture import ChildCapture, KmsgrabCapture
|
||||
|
||||
cap = None
|
||||
key = None
|
||||
@@ -206,10 +207,13 @@ def capture_loop(state, strip):
|
||||
if cfg["capture"] == "kmsgrab":
|
||||
c = KmsgrabCapture(cfg["leds"], fps=cfg["fps"], device=cfg["drm_device"]).start()
|
||||
return c, f"kmsgrab {c.binary} su {cfg['drm_device']}"
|
||||
node, w, h = screencast_stream()
|
||||
c = Capture(node, cfg["leds"], fps=cfg["fps"])
|
||||
c.start()
|
||||
return c, f"portal node={node} sorgente {w}x{h}"
|
||||
helper = os.path.join(os.path.dirname(os.path.abspath(__file__)), "ambicatcher.py")
|
||||
c = ChildCapture([sys.executable, helper,
|
||||
"--leds", str(cfg["leds"]), "--rows", "72", "--sub", "4",
|
||||
"--fps", str(int(cfg["fps"])), "--drain"],
|
||||
cfg["leds"]).start()
|
||||
return c, f"portal (processo separato) node={c.header.get('node')} " \
|
||||
f"sorgente {c.header.get('w')}x{c.header.get('h')}"
|
||||
|
||||
while True:
|
||||
cfg = state.snapshot()
|
||||
|
||||
Reference in New Issue
Block a user