#pragma once #include "screencast/capture/error.h" #include #include #include #include #include #include namespace sc { enum class PixelFormat { Rgba, Bgrx, // 4 bytes/pixel, memory order B, G, R, unused Yuv420p, }; // Opaque resource owned by the capture implementation. struct CapturedFrame { int width = 0; int height = 0; uint64_t timestamp_ns = 0; // capture clock, monotonic PixelFormat pixel_format = PixelFormat::Rgba; int stride = 0; // bytes per row for the first plane; 0 means packed std::vector pixels; }; // Capture target: whole monitor, specific window, or a region. struct CaptureTargetWholeScreen {}; struct CaptureTargetWindow { std::string window_id; }; struct CaptureTargetRegion { int x = 0; int y = 0; int width = 0; int height = 0; }; using CaptureTarget = std::variant; class CaptureSession { public: virtual ~CaptureSession() = default; // Blocking call to acquire one frame. Returns std::nullopt on graceful stop. virtual std::optional next_frame() = 0; // Request the session to stop. May be called from another thread. virtual void stop() = 0; }; // Factory for the PipeWire / xdg-desktop-portal capture backend. class CaptureFactory { public: static CaptureResult> create(CaptureTarget target); }; } // namespace sc