wgc_capturer.h 925 B

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef __WGC_CAPTURER_H__
  2. #define __WGC_CAPTURER_H__
  3. #include "wgc/pch.h"
  4. #include "wgc/App.h"
  5. #include <list>
  6. class WgcCapturer {
  7. public:
  8. bool StartCapturerWindow(HWND hwnd, int width, int height);
  9. bool StartCapturerMonitor(HMONITOR monitor, int width, int height);
  10. void SetDrawCursor(bool isDrawCursor) { _app->SetDrawCursor(isDrawCursor); }
  11. static void Init();
  12. static WgcCapturer* New();
  13. static void Delete(WgcCapturer* ptr);
  14. static void Uninit();
  15. void Close()
  16. {
  17. if (_app != nullptr) {
  18. _app->Close();
  19. }
  20. }
  21. AVFrame* GetFrame() { return _app->GetFrame(); }
  22. private:
  23. WgcCapturer();
  24. ~WgcCapturer();
  25. App* _app = nullptr;
  26. bool _isAppInit = false;
  27. static std::list<WgcCapturer*> _capturers;
  28. static winrt::Windows::System::DispatcherQueue* queuePtr;
  29. static winrt::Windows::UI::Composition::ContainerVisual* rootPtr;
  30. };
  31. #endif