Files
screen_cast/include/screencast/app/cli.h
T
fegger 7c04506dde feat(render): fullscreen headless receiver with letterboxing
A headless receiver has no window manager, so a windowed window is
meaningless there — the screencast should simply fill the screen. The
renderer now goes borderless fullscreen automatically when SDL runs
the KMSDRM backend, and --fullscreen forces the same behavior in
desktop sessions. The video keeps its aspect ratio via
SDL_SetRenderLogicalPresentation(LETTERBOX): a 4:3 desktop on a 16:9
TV renders with black bars instead of a stretched picture, the cursor
is hidden, and the clear-before-draw keeps the bars black.

Verified live on a 3440x1440 monitor: the --fullscreen receiver window
covered the entire display while a 4:3 synthetic feed rendered with
pure-black pillarbox bars (Y=0/SAT=0) and a saturated-red center
(V=254). meson test 5/5 in both build configurations.
2026-09-07 13:18:08 +02:00

35 lines
892 B
C++

#pragma once
#include <cstdint>
#include <optional>
#include <string_view>
#include <variant>
namespace sc {
struct SendCommand {
std::string_view target = "monitor"; // monitor, window
std::string_view peer_address; // optional; empty means auto-discover
int bitrate_kbps = 4000;
};
struct ReceiveCommand {
std::string_view peer_address; // optional, informational
int local_rtp_port = 5004;
int signaling_port = 5005;
bool fullscreen = false;
};
struct DiscoverCommand {
int timeout_seconds = 3;
};
using Command = std::variant<SendCommand, ReceiveCommand, DiscoverCommand>;
// Parse command line arguments. Prints usage and returns std::nullopt on error.
// `argv` is `char const* const*` so both `main`'s `char**` and const arrays
// convert implicitly.
std::optional<Command> parse_cli(int argc, const char* const argv[]);
} // namespace sc