mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
EventHandler: Add some calldata helpers
This commit is contained in:
parent
902c9dfdc5
commit
8b30d2e77e
@ -15,6 +15,13 @@ EventHandler::~EventHandler()
|
||||
obs_frontend_remove_event_callback(EventHandler::OnFrontendEvent, this);
|
||||
}
|
||||
|
||||
std::string EventHandler::GetCalldataString(const calldata_t *data, const char* name)
|
||||
{
|
||||
const char* value = nullptr;
|
||||
calldata_get_string(data, name, &value);
|
||||
return value;
|
||||
}
|
||||
|
||||
void EventHandler::OnFrontendEvent(enum obs_frontend_event event, void *private_data) {
|
||||
auto eventHandler = reinterpret_cast<EventHandler*>(private_data);
|
||||
|
||||
|
@ -13,6 +13,14 @@ class EventHandler
|
||||
EventHandler(WebSocketServerPtr webSocketServer);
|
||||
~EventHandler();
|
||||
|
||||
template <typename T> T* GetCalldataPointer(const calldata_t *data, const char* name) {
|
||||
void* ptr = nullptr;
|
||||
calldata_get_ptr(data, name, &ptr);
|
||||
return reinterpret_cast<T*>(ptr);
|
||||
}
|
||||
|
||||
static std::string GetCalldataString(const calldata_t *data, const char* name);
|
||||
|
||||
private:
|
||||
WebSocketServerPtr _webSocketServer;
|
||||
os_cpu_usage_info_t *_cpuUsageInfo;
|
||||
|
Loading…
Reference in New Issue
Block a user