video_capturer.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef __AV_CAPTURER_H__
  2. #define __AV_CAPTURER_H__
  3. #include "dxgi_capturer.h"
  4. #include "gdi_capturer.h"
  5. #include "wgc_capturer.h"
  6. class VideoCapturer {
  7. public:
  8. enum Method {
  9. GDI,
  10. DXGI,
  11. WGC
  12. };
  13. enum Type {
  14. WINDOW,
  15. MONITOR
  16. };
  17. ~VideoCapturer();
  18. bool Open(HWND hwnd, Method method);
  19. bool Open(int monitorIdx, Method method);
  20. AVFrame* GetFrame();
  21. void SetDrawCursor(bool isDrawCursor);
  22. void Close();
  23. int GetWidth() const;
  24. int GetHeight() const;
  25. Method GetMethod() const { return m_usingMethod; }
  26. private:
  27. bool _GetHwndSize(HWND hwnd);
  28. void _DrawCursor(HDC hdc);
  29. Method m_usingMethod = WGC;
  30. RECT m_rect;
  31. Type m_type = MONITOR;
  32. DxgiCapturer* m_dxgiCapturer = nullptr;
  33. GdiCapturer* m_gdiCapturer = nullptr;
  34. WgcCapturer* m_wgcCapturer = nullptr;
  35. int m_width = 0;
  36. int m_height = 0;
  37. int m_borderHeight = 0;
  38. int m_borderWidth = 0;
  39. HWND m_srcHwnd = nullptr;
  40. bool m_isDrawCursor = true;
  41. };
  42. #endif