5f8c6b6147
LutrisProvider reads the local pga.db (rusqlite, read-only/immutable so a running Lutris can't block us) → installed games, launch via `lutris lutris:rungameid/<id>`, cover art from Lutris's on-disk cache inlined as data: URLs (no public CDN keyed by a stable id, unlike Steam/Heroic). HeroicProvider parses Heroic's store_cache JSON — legendary/gog/nile = Epic+GOG+Amazon in one provider — installed-only with an install-dir existence cross-check (works around Heroic's gog is_installed bug #2691), free public CDN cover art, launch via `heroic --no-gui heroic://launch?...` (the single-instance-Electron gamescope-escape caveat is documented; needs live confirm). New command_for arms (lutris_id digits-guard, heroic runner+appName-guard) + both providers wired into all_games(); everything Linux-gated (the launchers are Linux-only), so the Windows/macOS host build is unaffected. Deps rusqlite (bundled SQLite, no system dep) + base64 added to the Linux target only. Unit tests with sqlite/json fixtures (installed-only filtering, CDN-art mapping, launch guards); live `library` enumeration returns [] gracefully on a box without the launchers. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
215 lines
12 KiB
TOML
215 lines
12 KiB
TOML
[package]
|
|
name = "punktfunk-host"
|
|
description = "punktfunk Linux streaming host: virtual display, capture, encode, input injection"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
rust-version.workspace = true
|
|
license.workspace = true
|
|
authors.workspace = true
|
|
repository.workspace = true
|
|
|
|
[dependencies]
|
|
punktfunk-core = { path = "../punktfunk-core", features = ["quic"] }
|
|
# M3 native control plane (the `punktfunk/1` QUIC handshake; data plane stays native-thread UDP).
|
|
quinn = "0.11"
|
|
anyhow = "1"
|
|
tracing = "0.1"
|
|
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
|
axum = "0.8"
|
|
mdns-sd = "0.20"
|
|
tokio = { version = "1", features = ["full"] }
|
|
rsa = "0.9"
|
|
sha2 = { version = "0.10", features = ["oid"] }
|
|
aes = "0.8"
|
|
aes-gcm = "0.10"
|
|
cbc = { version = "0.1", features = ["alloc"] }
|
|
rand = "0.8"
|
|
hex = "0.4"
|
|
rcgen = { version = "0.13", default-features = false, features = ["aws_lc_rs", "pem"] }
|
|
x509-parser = "0.16"
|
|
axum-server = { version = "0.7", features = ["tls-rustls"] }
|
|
rustls = "0.23"
|
|
rustls-pemfile = "2"
|
|
# Manual HTTPS+mTLS serve loop for the mgmt API (axum-server can't surface the peer cert): a
|
|
# tokio-rustls handshake exposes the client cert, then hyper serves the axum Router with the
|
|
# verified fingerprint injected as a request extension. Versions match the workspace lock.
|
|
tokio-rustls = "0.26"
|
|
hyper = { version = "1", features = ["server", "http1", "http2"] }
|
|
hyper-util = { version = "0.1", features = ["server", "server-auto", "tokio", "service"] }
|
|
tower = { version = "0.5", features = ["util"] }
|
|
rusty_enet = "0.4"
|
|
serde = { version = "1", features = ["derive"] }
|
|
serde_json = "1"
|
|
# Management/control-plane REST API + OpenAPI (control pane, M2). `axum_extras` wires
|
|
# utoipa into axum 0.8 extractors; utoipa-axum collects `#[utoipa::path]` routes into the
|
|
# spec; utoipa-scalar serves the interactive docs. Codegen-friendly: the spec is emitted
|
|
# verbatim by the `openapi` subcommand. Control plane only — never the per-frame path.
|
|
utoipa = { version = "5", features = ["axum_extras"] }
|
|
utoipa-axum = "0.2"
|
|
utoipa-scalar = { version = "0.3", features = ["axum"] }
|
|
|
|
[dev-dependencies]
|
|
# Drive the management API router in-process (no socket) in the handler tests.
|
|
tower = { version = "0.5", features = ["util"] }
|
|
http-body-util = "0.1"
|
|
|
|
# Opus stereo encode for the host->client audio plane. The `opus` crate vendors libopus via
|
|
# `audiopus_sys` (cmake-built from source — no system lib, no vcpkg), so it builds on Windows MSVC
|
|
# too (needs CMake + NASM, both on the box). Both platforms that have an audio-capture backend.
|
|
[target.'cfg(any(target_os = "linux", target_os = "windows"))'.dependencies]
|
|
opus = "0.3"
|
|
|
|
[target.'cfg(target_os = "linux")'.dependencies]
|
|
# `screencast` gates the ScreenCast portal module; `remote_desktop` adds the RemoteDesktop
|
|
# portal we use for libei input on KWin/GNOME; `tokio` is the default runtime.
|
|
# `open_pipe_wire_remote` is unconditional, so ashpd's own `pipewire` feature is not
|
|
# needed — we drive PipeWire with the `pipewire` crate below.
|
|
ashpd = { version = "0.13", features = ["screencast", "remote_desktop"] }
|
|
ffmpeg-next = "8"
|
|
libc = "0.2"
|
|
# Must match the pipewire crate ashpd 0.13 links (libspa/pipewire-sys `links` key is
|
|
# unique per build), i.e. 0.9 — NOT the 0.10 the setup doc mentions.
|
|
pipewire = "0.9"
|
|
# ashpd 0.13 uses the tokio runtime; a current-thread runtime drives the one-time
|
|
# portal handshake (control plane — never the per-frame path).
|
|
tokio = { version = "1", features = ["rt", "rt-multi-thread", "net", "time"] }
|
|
# Input injection into headless Sway via the wlroots virtual-input Wayland protocols
|
|
# (uinput won't reach a compositor running with WLR_LIBINPUT_NO_DEVICES=1).
|
|
wayland-client = "0.31"
|
|
wayland-protocols-wlr = { version = "0.3", features = ["client"] }
|
|
wayland-protocols-misc = { version = "0.3", features = ["client"] }
|
|
# Codegen for KDE's `zkde_screencast_unstable_v1` (vendored in `protocols/`): create a KWin
|
|
# virtual output sized to the client's resolution and get its PipeWire node (KRdp's path).
|
|
# `wayland-backend` is referenced by the generated interface tables.
|
|
wayland-scanner = "0.31"
|
|
wayland-backend = "0.3"
|
|
# Parse `pw-dump` JSON to find gamescope's PipeWire node (gamescope backend).
|
|
serde_json = "1"
|
|
# Read the Lutris library DB (`pga.db`) for the Lutris store provider. `bundled` vendors + compiles
|
|
# SQLite (cc, already needed for ffmpeg/opus) so there's no system libsqlite3 runtime dependency —
|
|
# clean for the deb/rpm/flatpak packaging. Opened read-only/immutable (Lutris may hold it open).
|
|
rusqlite = { version = "0.40", features = ["bundled"] }
|
|
# Inline Lutris's local cover-art JPEGs as `data:` URLs in the library (Lutris has no public CDN
|
|
# keyed by a stable id, unlike Steam/Heroic; a `data:` URL is self-contained — no host-served endpoint).
|
|
base64 = "0.22"
|
|
# Builds/validates the xkb keymap uploaded to the virtual keyboard + tracks modifier state.
|
|
xkbcommon = "0.8"
|
|
# The safe `opus` crate is stereo-only; surround (5.1/7.1) needs the libopus *multistream*
|
|
# encoder (`opus_multistream_encoder_*`). `audiopus_sys` is the sys layer `opus` already
|
|
# vendors (same libopus link), so this adds bindings, not a second copy of the library.
|
|
audiopus_sys = "0.2"
|
|
# libei (EI sender) for the portable input path on KWin/GNOME (RemoteDesktop portal).
|
|
# The `tokio` feature wires reis's event stream into tokio's reactor.
|
|
reis = { version = "0.6.1", features = ["tokio"] }
|
|
# `StreamExt::next` on reis's tokio event stream in the libei worker loop.
|
|
futures-util = "0.3"
|
|
# Zero-copy capture (plan §9): EGL imports the PipeWire dmabuf, CUDA maps it, NVENC encodes
|
|
# it with no CPU roundtrip. `khronos-egl` (dynamic = load the NVIDIA libEGL at runtime) gives
|
|
# eglCreateImage + the dma_buf import; the CUDA driver API (EGL interop) and libgbm are linked
|
|
# via hand-rolled FFI in `src/zerocopy/` (no Rust crate exposes the EGL-interop driver calls).
|
|
khronos-egl = { version = "6", features = ["dynamic"] }
|
|
# Vulkan bridge for LINEAR dmabufs (gamescope): import via VK_EXT_external_memory_dma_buf,
|
|
# GPU-copy into an exportable allocation, export OPAQUE_FD → cuImportExternalMemory (the
|
|
# officially-supported CUDA pairing; raw dmabuf fds are rejected by the desktop driver).
|
|
ash = "0.38"
|
|
# `libcuda.so.1` is dlopen'd at runtime (NOT link-time) so one Linux binary runs on NVIDIA
|
|
# (zero-copy via CUDA) AND on AMD/Intel (VAAPI, no NVIDIA driver present) — see `zerocopy::cuda`.
|
|
libloading = "0.8"
|
|
|
|
[target.'cfg(target_os = "windows")'.dependencies]
|
|
# Windows host backends. `windows` covers the Win32/CCD APIs the SudoVDA virtual-display backend
|
|
# drives (SetupAPI device enumeration, DeviceIoControl IOCTLs, QueryDisplayConfig name resolution);
|
|
# capture/encode/input/audio backends extend the feature set as they land.
|
|
windows = { version = "0.62", features = [
|
|
"Win32_Foundation",
|
|
"Win32_Security",
|
|
# ConvertStringSecurityDescriptorToSecurityDescriptorW — the SDDL on the virtual-DualSense
|
|
# shared-memory section (inject/dualsense_windows.rs) so the UMDF host can open it.
|
|
"Win32_Security_Authorization",
|
|
"Win32_Devices_DeviceAndDriverInstallation",
|
|
# SwDeviceCreate/SwDeviceClose — the per-session virtual-DualSense devnode
|
|
# (inject/dualsense_windows.rs).
|
|
"Win32_Devices_Enumeration_Pnp",
|
|
"Win32_Devices_Display",
|
|
"Win32_Storage_FileSystem",
|
|
"Win32_System_IO",
|
|
"Win32_UI_Input_KeyboardAndMouse",
|
|
"Win32_UI_WindowsAndMessaging",
|
|
"Win32_System_StationsAndDesktops",
|
|
"Win32_Graphics_Dxgi",
|
|
"Win32_Graphics_Dxgi_Common",
|
|
"Win32_Graphics_Direct3D",
|
|
"Win32_Graphics_Direct3D11",
|
|
"Win32_Graphics_Direct3D_Fxc",
|
|
"Win32_Graphics_Gdi",
|
|
# Windows.Graphics.Capture (WGC) backend — composed-desktop capture (overlay/MPO-correct HDR).
|
|
"Foundation",
|
|
"Graphics",
|
|
"Graphics_Capture",
|
|
"Graphics_DirectX",
|
|
"Graphics_DirectX_Direct3D11",
|
|
"Win32_System_WinRT_Direct3D11",
|
|
"Win32_System_WinRT_Graphics_Capture",
|
|
# WGC runs under SYSTEM via interactive-user impersonation (WGC won't activate as SYSTEM).
|
|
"Win32_System_RemoteDesktop",
|
|
# Two-process secure-desktop design: the SYSTEM host spawns the WGC helper in the interactive
|
|
# user session (CreateProcessAsUserW) with stdout/stdin redirected to anonymous pipes.
|
|
"Win32_System_Threading",
|
|
"Win32_System_Pipes",
|
|
"Win32_System_Environment",
|
|
# Force-composed-flip overlay: a topmost layered window on the Winlogon desktop disqualifies the
|
|
# secure desktop's fullscreen independent-flip so Desktop Duplication can capture it.
|
|
"Win32_System_LibraryLoader",
|
|
# VirtualProtect — for the inline patch of the win32u GPU-preference shim (Apollo's MinHook port:
|
|
# the hybrid-GPU output-reparenting hook that keeps Desktop Duplication stable on a 4090+iGPU box).
|
|
# See capture/windows/dxgi.rs `install_gpu_pref_hook`. No trampoline (we fully replace the fn) → no detour
|
|
# crate / no C length-disassembler dep; a 12-byte absolute-jmp prologue patch suffices.
|
|
"Win32_System_Memory",
|
|
# Per-monitor-v2 DPI awareness — IDXGIOutput5::DuplicateOutput1 (the modern capture path Apollo
|
|
# uses; FP16/format-list, robust to overlay/format churn) requires the process to be DPI-aware.
|
|
"Win32_UI_HiDpi",
|
|
# Windows service supervisor (src/service.rs): a kill-on-close job object so a service crash never
|
|
# orphans the SYSTEM host it launched into the interactive session.
|
|
"Win32_System_JobObjects",
|
|
] }
|
|
# The SCM plumbing for the `service` subcommand (define_windows_service! / dispatcher / control
|
|
# handler / ServiceManager install). Wraps the Win32 service API; the supervision loop itself uses
|
|
# the `windows` crate above.
|
|
windows-service = "0.7"
|
|
# Software H.264 encoder (GPU-less path + NVENC fallback). The default `source` feature statically
|
|
# compiles OpenH264 (BSD-2) — no system lib, builds on MSVC; nasm on PATH adds the SIMD fast path.
|
|
openh264 = "0.9"
|
|
# WASAPI loopback audio capture (default render endpoint -> 48 kHz stereo f32 for the Opus path).
|
|
wasapi = "0.23"
|
|
# Virtual Xbox 360 gamepad: the in-tree XUSB companion UMDF driver (packaging/windows/xusb-driver),
|
|
# driven over shared memory from inject/windows/gamepad_windows.rs — no ViGEmBus dependency.
|
|
# NVENC hardware encoder (NVENC SDK, D3D11 input). The SDK pins `cudarc` with
|
|
# `cuda-version-from-build-system` (a build-time CUDA-toolkit probe); its `ci-check` feature switches
|
|
# cudarc to `dynamic-loading` (loads nvcuda.dll at runtime — nothing needed at build), which is how
|
|
# the crate builds on docs.rs/CI. We enable it so the GPU-less VM/CI compiles; the DirectX NVENC path
|
|
# never calls CUDA at runtime, so the pinned CUDA bindings version is irrelevant.
|
|
nvidia-video-codec-sdk = { version = "0.4", features = ["ci-check"], optional = true }
|
|
# AMD (AMF) + Intel (QSV) hardware encode on Windows via libavcodec — the analogue of the Linux
|
|
# VAAPI backend (`src/encode/ffmpeg_win.rs`). Optional + behind the `amf-qsv` feature because it
|
|
# link-imports the FFmpeg libs at build time (needs a `FFMPEG_DIR` with the AMF/QSV encoders — the
|
|
# same BtbN gpl-shared tree the Windows client uses) and pulls the shared `avcodec/avutil/...` DLLs
|
|
# at runtime. `ffmpeg-sys-next` auto-detects the FFmpeg version (7.x/avcodec-61 or 8.x/62).
|
|
ffmpeg-next = { version = "8", optional = true }
|
|
# Shared host<->driver wire contract for the pf-vdisplay IddCx virtual-display backend
|
|
# (vdisplay/pf_vdisplay.rs): the control-plane IOCTL codes + `#[repr(C)] Pod` request/reply structs,
|
|
# defined ONCE so host<->driver ABI drift is a compile error. `bytemuck` serializes those structs
|
|
# to/from the DeviceIoControl byte buffers.
|
|
pf-driver-proto = { path = "../pf-driver-proto" }
|
|
bytemuck = { version = "1.19", features = ["derive"] }
|
|
|
|
[features]
|
|
# NVENC hardware encode (Windows). OFF by default: it pulls the NVENC SDK, and the host then needs
|
|
# the NVENC entry points (NvEncodeAPICreateInstance / NvEncodeAPIGetMaxSupportedVersion) at link
|
|
# time — i.e. `nvencodeapi.lib` from the NVIDIA Video Codec SDK (or an import lib generated from
|
|
# nvEncodeAPI64.dll) on the linker path. Build the GPU host with `--features nvenc`.
|
|
nvenc = ["dep:nvidia-video-codec-sdk"]
|
|
# AMD/Intel hardware encode on Windows (AMF/QSV via ffmpeg-next). OFF by default: it needs a
|
|
# `FFMPEG_DIR` (BtbN gpl-shared, includes `*_amf`/`*_qsv`) at build time and bundles the FFmpeg
|
|
# DLLs at runtime. Build the all-vendor GPU host with `--features nvenc,amf-qsv`.
|
|
amf-qsv = ["dep:ffmpeg-next"]
|