mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
General: code and docs cleanup
This commit is contained in:
40
WSEvents.cpp
40
WSEvents.cpp
@ -115,8 +115,6 @@ void WSEvents::FrontendEventHandler(enum obs_frontend_event event, void* private
|
|||||||
if (!owner->_srv)
|
if (!owner->_srv)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// TODO : implement SourceOrderChanged and RepopulateSources
|
|
||||||
|
|
||||||
if (event == OBS_FRONTEND_EVENT_SCENE_CHANGED) {
|
if (event == OBS_FRONTEND_EVENT_SCENE_CHANGED) {
|
||||||
owner->OnSceneChange();
|
owner->OnSceneChange();
|
||||||
}
|
}
|
||||||
@ -669,25 +667,25 @@ void WSEvents::StreamStatus() {
|
|||||||
obs_output_release(stream_output);
|
obs_output_release(stream_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************************************************
|
/**
|
||||||
* Heatbeat is emitted every 2 seconds, when enabled with request: SetHeartbeat *
|
* Emitted every 2 seconds after enabling it by calling SetHeartbeat.
|
||||||
* *
|
*
|
||||||
* @return {boolean} `pulse` Toggles between every JSON meassage as an "I am alive" indicator. *
|
* @return {boolean} `pulse` Toggles between every JSON meassage as an "I am alive" indicator.
|
||||||
* @return {string (optional)} `current-profile` Current active profile. *
|
* @return {string (optional)} `current-profile` Current active profile.
|
||||||
* @return {string (optional)} `current-scene` Current active scene. *
|
* @return {string (optional)} `current-scene` Current active scene.
|
||||||
* @return {boolean (optional)} `streaming` Current streaming state. *
|
* @return {boolean (optional)} `streaming` Current streaming state.
|
||||||
* @return {int (optional)} `total-stream-time` Total time (in seconds) since the stream started. *
|
* @return {int (optional)} `total-stream-time` Total time (in seconds) since the stream started.
|
||||||
* @return {int (optional)} `total-stream-bytes` Total bytes sent since the stream started. *
|
* @return {int (optional)} `total-stream-bytes` Total bytes sent since the stream started.
|
||||||
* @return {int (optional)} `total-stream-frames` Total frames streamed since the stream started. *
|
* @return {int (optional)} `total-stream-frames` Total frames streamed since the stream started.
|
||||||
* @return {boolean (optional)} `recording` Current recording state. *
|
* @return {boolean (optional)} `recording` Current recording state.
|
||||||
* @return {int (optional)} `total-record-time` Total time (in seconds) since recording started. *
|
* @return {int (optional)} `total-record-time` Total time (in seconds) since recording started.
|
||||||
* @return {int (optional)} `total-record-bytes` Total bytes recorded since the recording started. *
|
* @return {int (optional)} `total-record-bytes` Total bytes recorded since the recording started.
|
||||||
* @return {int (optional)} `total-record-frames` Total frames recorded since the recording started. *
|
* @return {int (optional)} `total-record-frames` Total frames recorded since the recording started.
|
||||||
* *
|
*
|
||||||
* @api events *
|
* @api events
|
||||||
* @name Heartbeat *
|
* @name Heartbeat
|
||||||
* @category general *
|
* @category general
|
||||||
************************************************************************ September 2017 *** by RainbowEK ***/
|
*/
|
||||||
void WSEvents::Heartbeat() {
|
void WSEvents::Heartbeat() {
|
||||||
|
|
||||||
if (!Heartbeat_active) return;
|
if (!Heartbeat_active) return;
|
||||||
|
@ -31,9 +31,9 @@ class WSEvents : public QObject {
|
|||||||
~WSEvents();
|
~WSEvents();
|
||||||
static void FrontendEventHandler(
|
static void FrontendEventHandler(
|
||||||
enum obs_frontend_event event, void* private_data);
|
enum obs_frontend_event event, void* private_data);
|
||||||
|
static WSEvents* Instance;
|
||||||
void connectTransitionSignals(obs_source_t* transition);
|
void connectTransitionSignals(obs_source_t* transition);
|
||||||
void connectSceneSignals(obs_source_t* scene);
|
void connectSceneSignals(obs_source_t* scene);
|
||||||
static WSEvents* Instance;
|
|
||||||
|
|
||||||
uint64_t GetStreamingTime();
|
uint64_t GetStreamingTime();
|
||||||
const char* GetStreamingTimecode();
|
const char* GetStreamingTimecode();
|
||||||
|
@ -300,30 +300,27 @@ void WSRequestHandler::HandleAuthenticate(WSRequestHandler* req) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************************************************
|
/**
|
||||||
* Heatbeat update message is emitted every 2 seconds, when enabled with this request. *
|
* Enable/disable sending of the Heartbeat event
|
||||||
* When the Heartbeat is enabled it always sends a `pulse` to indicate that the host obs is alive. *
|
*
|
||||||
* Read comment from 'void WSEvents::Heartbeat()' for the total picture. *
|
* @param {boolean} `enable` Starts/Stops emitting heartbeat messages
|
||||||
* *
|
*
|
||||||
* @param {boolean} `enable` Starts/Stops emitting heartbeat messages *
|
* @api requests
|
||||||
* *
|
* @name HandleSetHeartbeat
|
||||||
* @api requests *
|
* @category general
|
||||||
* @name HandleSetHeartbeat *
|
*/
|
||||||
* @category general *
|
|
||||||
************************************************************************ September 2017 *** by RainbowEK ***/
|
|
||||||
void WSRequestHandler::HandleSetHeartbeat(WSRequestHandler* req) {
|
void WSRequestHandler::HandleSetHeartbeat(WSRequestHandler* req) {
|
||||||
if (!req->hasField("enable")) {
|
if (!req->hasField("enable")) {
|
||||||
req->SendErrorResponse("Heartbeat <enable> parameter missing");
|
req->SendErrorResponse("Heartbeat <enable> parameter missing");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WSEvents::Instance->Heartbeat_active =
|
||||||
|
obs_data_get_bool(req->data, "enable");
|
||||||
|
|
||||||
obs_data_t* response = obs_data_create();
|
obs_data_t* response = obs_data_create();
|
||||||
|
obs_data_set_bool(response, "enable",
|
||||||
bool keyValue = obs_data_get_bool(req->data, "enable");
|
WSEvents::Instance->Heartbeat_active);
|
||||||
if (keyValue) WSEvents::Instance->Heartbeat_active = true;
|
|
||||||
else WSEvents::Instance->Heartbeat_active = false;
|
|
||||||
|
|
||||||
obs_data_set_bool(response, "enable", keyValue);
|
|
||||||
req->SendOKResponse(response);
|
req->SendOKResponse(response);
|
||||||
|
|
||||||
obs_data_release(response);
|
obs_data_release(response);
|
||||||
|
Reference in New Issue
Block a user