#pragma once #include #include #include #include namespace scar { enum class ScreenCaptureBackend { FFMPEG_X11, // X11 via ffmpeg FFMPEG_WAYLAND, // Wayland via ffmpeg + portal FFMPEG_WINDOWS, // Windows GDI via ffmpeg PORTAL_PIPEWIRE // xdg-desktop-portal + Pipewire (Wayland/Hyprland) }; // Screen capture supporting multiple backends class ScreenCapture { public: ScreenCapture(); ~ScreenCapture(); // Auto-detect and start screen capture bool start(); // Start with specific backend bool start(ScreenCaptureBackend backend); // Stop capturing void stop(); // Check if currently capturing bool isCapturing() const { return capturing_; } // Set frame callback using FrameCallback = std::function& frameData, int width, int height)>; void setFrameCallback(FrameCallback callback); private: ScreenCaptureBackend detectBestBackend(); bool startX11Capture(); bool startWaylandCapture(); bool startWindowsCapture(); bool startPortalCapture(); bool capturing_; ScreenCaptureBackend backend_; FrameCallback frameCallback_; // TODO: FFmpeg-specific members // AVFormatContext* formatCtx_; // AVCodecContext* codecCtx_; // AVFrame* frame_; // TODO: DBus/Portal-specific members for Wayland // DBusConnection* dbusConn_; // pw_stream* pipewireStream_; }; } // namespace scar