Files
screen_cast/include/screencast/render/renderer.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

40 lines
965 B
C++

#pragma once
#include "screencast/codec/decoder.h"
#include "screencast/render/error.h"
#include <memory>
#include <string>
namespace sc {
struct RendererConfig {
std::string window_title = "screencast receiver";
int initial_width = 1280;
int initial_height = 720;
// Borderless fullscreen. On the headless KMSDRM backend (no window
// manager) fullscreen is enabled automatically.
bool fullscreen = false;
};
class Renderer {
public:
virtual ~Renderer() = default;
// Present one decoded frame. Returns false if the window was closed.
virtual bool present(const DecodedFrame& frame) = 0;
// Pump events (window close, resize). Non-blocking.
virtual bool poll_events() = 0;
// Destroy the window and release GPU resources.
virtual void shutdown() = 0;
};
class RendererFactory {
public:
static RendererResult<std::unique_ptr<Renderer>> create(const RendererConfig& config);
};
} // namespace sc