53 lines
1.6 KiB
Python
53 lines
1.6 KiB
Python
|
|
"""Renderer-CLI (Phase-0-Spike).
|
|||
|
|
|
|||
|
|
Aufruf:
|
|||
|
|
python -m hms_renderer --pipeline d3d11 --video-a A --video-b B
|
|||
|
|
|
|||
|
|
Ohne GStreamer-Installation: kontrollierter Abbruch mit Exit-Code 2 und
|
|||
|
|
klarer Meldung – niemals Erfolgssimulation (§1.1 Nr. 5, §33).
|
|||
|
|
"""
|
|||
|
|
|
|||
|
|
from __future__ import annotations
|
|||
|
|
|
|||
|
|
import argparse
|
|||
|
|
import shutil
|
|||
|
|
import subprocess
|
|||
|
|
import sys
|
|||
|
|
|
|||
|
|
from hms_renderer.pipelines import build_compositor_pipeline, build_single_video_pipeline
|
|||
|
|
|
|||
|
|
|
|||
|
|
def main(argv: list[str] | None = None) -> int:
|
|||
|
|
parser = argparse.ArgumentParser(prog="hms-renderer")
|
|||
|
|
parser.add_argument("--pipeline", choices=["d3d11", "devgl"], default="d3d11")
|
|||
|
|
parser.add_argument("--video-a", required=True)
|
|||
|
|
parser.add_argument("--video-b", default=None, help="zweite Quelle für Compositing")
|
|||
|
|
parser.add_argument("--dry-run", action="store_true", help="nur Pipeline-String ausgeben")
|
|||
|
|
args = parser.parse_args(argv)
|
|||
|
|
|
|||
|
|
use_d3d11 = args.pipeline == "d3d11"
|
|||
|
|
if args.video_b:
|
|||
|
|
pipeline = build_compositor_pipeline(args.video_a, args.video_b, d3d11=use_d3d11)
|
|||
|
|
else:
|
|||
|
|
pipeline = build_single_video_pipeline(args.video_a, d3d11=use_d3d11)
|
|||
|
|
|
|||
|
|
if args.dry_run:
|
|||
|
|
print(pipeline)
|
|||
|
|
return 0
|
|||
|
|
|
|||
|
|
gst_launch = shutil.which("gst-launch-1.0")
|
|||
|
|
if gst_launch is None:
|
|||
|
|
print(
|
|||
|
|
"ERROR: gst-launch-1.0 nicht gefunden. GStreamer 1.28.6 muss gebündelt "
|
|||
|
|
"oder installiert sein (build/windows/GSTREAMER.md).",
|
|||
|
|
file=sys.stderr,
|
|||
|
|
)
|
|||
|
|
return 2
|
|||
|
|
|
|||
|
|
result = subprocess.run([gst_launch, "-v", pipeline], check=False)
|
|||
|
|
return result.returncode
|
|||
|
|
|
|||
|
|
|
|||
|
|
if __name__ == "__main__":
|
|||
|
|
sys.exit(main())
|