#ifndef __AV_CAPTURER_H__ #define __AV_CAPTURER_H__ #include "dxgi_capturer.h" #include "gdi_capturer.h" #include "wgc_capturer.h" class VideoCapturer { public: enum Method { GDI, DXGI, WGC }; enum Type { WINDOW, MONITOR }; ~VideoCapturer(); bool Open(HWND hwnd, Method method); bool Open(int monitorIdx, Method method); AVFrame* GetFrame(); void SetDrawCursor(bool isDrawCursor); void Close(); int GetWidth() const; int GetHeight() const; Method GetMethod() const { return m_usingMethod; } private: bool _GetHwndSize(HWND hwnd); void _DrawCursor(HDC hdc); Method m_usingMethod = WGC; RECT m_rect; Type m_type = MONITOR; DxgiCapturer* m_dxgiCapturer = nullptr; GdiCapturer* m_gdiCapturer = nullptr; WgcCapturer* m_wgcCapturer = nullptr; int m_width = 0; int m_height = 0; int m_borderHeight = 0; int m_borderWidth = 0; HWND m_srcHwnd = nullptr; bool m_isDrawCursor = true; }; #endif