Expose screen capturer init mechanism in GodotObs

This commit is contained in:
weil 2024-07-14 06:21:18 +02:00
parent aa664fbd6b
commit c5e4c2989b
2 changed files with 9 additions and 1 deletions

View File

@ -52,6 +52,7 @@ void Obs::_bind_methods()
ClassDB::bind_method(D_METHOD("get_screen_frame"), &Obs::getEncodedScreenFrame); ClassDB::bind_method(D_METHOD("get_screen_frame"), &Obs::getEncodedScreenFrame);
ClassDB::bind_method(D_METHOD("render_frame"), &Obs::renderFrameToMesh); ClassDB::bind_method(D_METHOD("render_frame"), &Obs::renderFrameToMesh);
ClassDB::bind_method(D_METHOD("get_screen_count"), &Obs::getScreenCount); ClassDB::bind_method(D_METHOD("get_screen_count"), &Obs::getScreenCount);
ClassDB::bind_method(D_METHOD("start_capture"), &Obs::startCapture);
} }
@ -92,6 +93,12 @@ Obs::~Obs()
} }
bool Obs::startCapture()
{
return m_capturer.init();
}
PackedByteArray Obs::getEncodedScreenFrame(size_t id) PackedByteArray Obs::getEncodedScreenFrame(size_t id)
{ {
#ifdef PROFILER_ENABLED #ifdef PROFILER_ENABLED

View File

@ -28,9 +28,10 @@ public:
Obs(); Obs();
~Obs(); ~Obs();
bool startCapture();
PackedByteArray getEncodedScreenFrame(size_t id); PackedByteArray getEncodedScreenFrame(size_t id);
void renderFrameToMesh(PackedByteArray frame, Ref<StandardMaterial3D> mat); void renderFrameToMesh(PackedByteArray frame, Ref<StandardMaterial3D> mat);
size_t getScreenCount() const; size_t getScreenCount() const;
private: private: