#ifndef IVIDEOCAPURER_H #define IVIDEOCAPURER_H #include "basic/frame.h" #include #include #include "qwindowdefs_win.h" namespace avrecorder { namespace video { // 平台宏定义 #if defined(_WIN32) #define PLATFORM_WINDOWS #elif defined(__APPLE__) #define PLATFORM_MACOS #elif defined(__linux__) #define PLATFORM_LINUX #endif // 捕获目标类型 enum class CaptureTargetType { Window, Monitor, // 预留更多类型,如 macOS 的 CGWindowID、X11 Window 等 }; // 捕获目标描述 struct CaptureTarget { CaptureTargetType type; union { #ifdef PLATFORM_WINDOWS HWND hwnd; int monitorIdx; #endif #ifdef PLATFORM_MACOS uint32_t cgWindowId; uint32_t displayId; #endif #ifdef PLATFORM_LINUX unsigned long x11Window; int x11Screen; #endif }; }; // 捕获方式 enum class CaptureMethod { GDI, DXGI, WGC, // 预留更多方式,如 macOS/Linux }; // 统一视频捕获接口 class IVideoCapturer { public: virtual ~IVideoCapturer() = default; virtual bool open(const CaptureTarget& target, int width, int height) = 0; virtual void close() = 0; virtual AVFrame* getFrame() = 0; virtual void setDrawCursor(bool enable) = 0; }; } // namespace video } // namespace avrecorder #endif // IVIDEOCAPURER_H