diff --git a/CMakeLists.txt b/CMakeLists.txt index a5e44f23..80dac825 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,7 +108,6 @@ target_sources( src/utils/Json.h src/utils/Obs.cpp src/utils/Obs_StringHelper.cpp - src/utils/Obs_EnumHelper.cpp src/utils/Obs_NumberHelper.cpp src/utils/Obs_ArrayHelper.cpp src/utils/Obs_ObjectHelper.cpp diff --git a/src/eventhandler/EventHandler_Inputs.cpp b/src/eventhandler/EventHandler_Inputs.cpp index 8c5a2e96..2c27d79b 100644 --- a/src/eventhandler/EventHandler_Inputs.cpp +++ b/src/eventhandler/EventHandler_Inputs.cpp @@ -373,11 +373,9 @@ void EventHandler::HandleInputAudioMonitorTypeChanged(void *param, calldata_t *d enum obs_monitoring_type monitorType = (obs_monitoring_type)calldata_int(data, "type"); - std::string monitorTypeString = Utils::Obs::StringHelper::GetInputMonitorType(monitorType); - json eventData; eventData["inputName"] = obs_source_get_name(source); - eventData["monitorType"] = monitorTypeString; + eventData["monitorType"] = monitorType; eventHandler->BroadcastEvent(EventSubscription::Inputs, "InputAudioMonitorTypeChanged", eventData); } diff --git a/src/eventhandler/EventHandler_Outputs.cpp b/src/eventhandler/EventHandler_Outputs.cpp index a4772128..034c415d 100644 --- a/src/eventhandler/EventHandler_Outputs.cpp +++ b/src/eventhandler/EventHandler_Outputs.cpp @@ -53,7 +53,7 @@ void EventHandler::HandleStreamStateChanged(ObsOutputState state) { json eventData; eventData["outputActive"] = GetOutputStateActive(state); - eventData["outputState"] = Utils::Obs::StringHelper::GetOutputState(state); + eventData["outputState"] = state; BroadcastEvent(EventSubscription::Outputs, "StreamStateChanged", eventData); } @@ -75,7 +75,7 @@ void EventHandler::HandleRecordStateChanged(ObsOutputState state) { json eventData; eventData["outputActive"] = GetOutputStateActive(state); - eventData["outputState"] = Utils::Obs::StringHelper::GetOutputState(state); + eventData["outputState"] = state; BroadcastEvent(EventSubscription::Outputs, "RecordStateChanged", eventData); } @@ -97,7 +97,7 @@ void EventHandler::HandleReplayBufferStateChanged(ObsOutputState state) { json eventData; eventData["outputActive"] = GetOutputStateActive(state); - eventData["outputState"] = Utils::Obs::StringHelper::GetOutputState(state); + eventData["outputState"] = state; BroadcastEvent(EventSubscription::Outputs, "ReplayBufferStateChanged", eventData); } @@ -119,7 +119,7 @@ void EventHandler::HandleVirtualcamStateChanged(ObsOutputState state) { json eventData; eventData["outputActive"] = GetOutputStateActive(state); - eventData["outputState"] = Utils::Obs::StringHelper::GetOutputState(state); + eventData["outputState"] = state; BroadcastEvent(EventSubscription::Outputs, "VirtualcamStateChanged", eventData); } diff --git a/src/forms/SettingsDialog.cpp b/src/forms/SettingsDialog.cpp index a3d3fce4..7fd6d973 100644 --- a/src/forms/SettingsDialog.cpp +++ b/src/forms/SettingsDialog.cpp @@ -177,9 +177,10 @@ void SettingsDialog::SaveFormData() } } - bool needsRestart = (conf->ServerEnabled != ui->enableWebSocketServerCheckBox->isChecked()) || - (conf->ServerPort != ui->serverPortSpinBox->value()) || - (ui->enableAuthenticationCheckBox->isChecked() && conf->ServerPassword != ui->serverPasswordLineEdit->text()); + bool needsRestart = + (conf->ServerEnabled != ui->enableWebSocketServerCheckBox->isChecked()) || + (conf->ServerPort != ui->serverPortSpinBox->value()) || + (ui->enableAuthenticationCheckBox->isChecked() && conf->ServerPassword != ui->serverPasswordLineEdit->text()); conf->ServerEnabled = ui->enableWebSocketServerCheckBox->isChecked(); conf->AlertsEnabled = ui->enableSystemTrayAlertsCheckBox->isChecked(); diff --git a/src/requesthandler/RequestHandler_Inputs.cpp b/src/requesthandler/RequestHandler_Inputs.cpp index aead6a31..fea567fc 100644 --- a/src/requesthandler/RequestHandler_Inputs.cpp +++ b/src/requesthandler/RequestHandler_Inputs.cpp @@ -706,7 +706,7 @@ RequestResult RequestHandler::GetInputAudioMonitorType(const Request &request) return RequestResult::Error(RequestStatus::InvalidResourceState, "The specified input does not support audio."); json responseData; - responseData["monitorType"] = Utils::Obs::StringHelper::GetInputMonitorType(input); + responseData["monitorType"] = obs_source_get_monitoring_type(input); return RequestResult::Success(responseData); } diff --git a/src/requesthandler/RequestHandler_MediaInputs.cpp b/src/requesthandler/RequestHandler_MediaInputs.cpp index dab152be..29897600 100644 --- a/src/requesthandler/RequestHandler_MediaInputs.cpp +++ b/src/requesthandler/RequestHandler_MediaInputs.cpp @@ -61,7 +61,8 @@ RequestResult RequestHandler::GetMediaInputStatus(const Request &request) return RequestResult::Error(statusCode, comment); json responseData; - responseData["mediaState"] = Utils::Obs::StringHelper::GetMediaInputState(input); + responseData["mediaState"] = obs_source_media_get_state(input); + ; if (IsMediaTimeValid(input)) { responseData["mediaDuration"] = obs_source_media_get_duration(input); @@ -168,8 +169,7 @@ RequestResult RequestHandler::TriggerMediaInputAction(const Request &request) if (!(input && request.ValidateString("mediaAction", statusCode, comment))) return RequestResult::Error(statusCode, comment); - std::string mediaActionString = request.RequestData["mediaAction"]; - auto mediaAction = Utils::Obs::EnumHelper::GetMediaInputAction(mediaActionString); + enum ObsMediaInputAction mediaAction = request.RequestData["mediaAction"]; switch (mediaAction) { default: diff --git a/src/requesthandler/RequestHandler_SceneItems.cpp b/src/requesthandler/RequestHandler_SceneItems.cpp index 01633ce4..236f1720 100644 --- a/src/requesthandler/RequestHandler_SceneItems.cpp +++ b/src/requesthandler/RequestHandler_SceneItems.cpp @@ -396,9 +396,8 @@ RequestResult RequestHandler::SetSceneItemTransform(const Request &request) if (r.Contains("boundsType")) { if (!r.ValidateOptionalString("boundsType", statusCode, comment)) return RequestResult::Error(statusCode, comment); - std::string boundsTypeString = r.RequestData["boundsType"]; - enum obs_bounds_type boundsType = Utils::Obs::EnumHelper::GetSceneItemBoundsType(boundsTypeString); - if (boundsType == OBS_BOUNDS_NONE && boundsTypeString != "OBS_BOUNDS_NONE") + enum obs_bounds_type boundsType = r.RequestData["boundsType"]; + if (boundsType == OBS_BOUNDS_NONE && r.RequestData["boundsType"] != "OBS_BOUNDS_NONE") return RequestResult::Error(RequestStatus::InvalidRequestField, "The field boundsType has an invalid value."); sceneItemTransform.bounds_type = boundsType; @@ -695,7 +694,7 @@ RequestResult RequestHandler::GetSceneItemBlendMode(const Request &request) auto blendMode = obs_sceneitem_get_blending_mode(sceneItem); json responseData; - responseData["sceneItemBlendMode"] = Utils::Obs::StringHelper::GetSceneItemBlendMode(blendMode); + responseData["sceneItemBlendMode"] = blendMode; return RequestResult::Success(responseData); } @@ -725,10 +724,8 @@ RequestResult RequestHandler::SetSceneItemBlendMode(const Request &request) if (!(sceneItem && request.ValidateString("sceneItemBlendMode", statusCode, comment))) return RequestResult::Error(statusCode, comment); - std::string blendModeString = request.RequestData["sceneItemBlendMode"]; - - auto blendMode = Utils::Obs::EnumHelper::GetSceneItemBlendMode(blendModeString); - if (blendMode == OBS_BLEND_NORMAL && blendModeString != "OBS_BLEND_NORMAL") + enum obs_blending_type blendMode = request.RequestData["sceneItemBlendMode"]; + if (blendMode == OBS_BLEND_NORMAL && request.RequestData["sceneItemBlendMode"] != "OBS_BLEND_NORMAL") return RequestResult::Error(RequestStatus::InvalidRequestField, "The field sceneItemBlendMode has an invalid value."); diff --git a/src/utils/Json.h b/src/utils/Json.h index 27a81802..0d930d4e 100644 --- a/src/utils/Json.h +++ b/src/utils/Json.h @@ -25,6 +25,51 @@ with this program. If not, see using json = nlohmann::json; +NLOHMANN_JSON_SERIALIZE_ENUM(obs_source_type, { + {OBS_SOURCE_TYPE_INPUT, "OBS_SOURCE_TYPE_INPUT"}, + {OBS_SOURCE_TYPE_FILTER, "OBS_SOURCE_TYPE_FILTER"}, + {OBS_SOURCE_TYPE_TRANSITION, "OBS_SOURCE_TYPE_TRANSITION"}, + {OBS_SOURCE_TYPE_SCENE, "OBS_SOURCE_TYPE_SCENE"}, + }) + +NLOHMANN_JSON_SERIALIZE_ENUM(obs_monitoring_type, + { + {OBS_MONITORING_TYPE_NONE, "OBS_MONITORING_TYPE_NONE"}, + {OBS_MONITORING_TYPE_MONITOR_ONLY, "OBS_MONITORING_TYPE_MONITOR_ONLY"}, + {OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT, "OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT"}, + }) + +NLOHMANN_JSON_SERIALIZE_ENUM(obs_media_state, { + {OBS_MEDIA_STATE_NONE, "OBS_MEDIA_STATE_NONE"}, + {OBS_MEDIA_STATE_PLAYING, "OBS_MEDIA_STATE_PLAYING"}, + {OBS_MEDIA_STATE_OPENING, "OBS_MEDIA_STATE_OPENING"}, + {OBS_MEDIA_STATE_BUFFERING, "OBS_MEDIA_STATE_BUFFERING"}, + {OBS_MEDIA_STATE_PAUSED, "OBS_MEDIA_STATE_PAUSED"}, + {OBS_MEDIA_STATE_STOPPED, "OBS_MEDIA_STATE_STOPPED"}, + {OBS_MEDIA_STATE_ENDED, "OBS_MEDIA_STATE_ENDED"}, + {OBS_MEDIA_STATE_ERROR, "OBS_MEDIA_STATE_ERROR"}, + }) + +NLOHMANN_JSON_SERIALIZE_ENUM(obs_bounds_type, { + {OBS_BOUNDS_NONE, "OBS_BOUNDS_NONE"}, + {OBS_BOUNDS_STRETCH, "OBS_BOUNDS_STRETCH"}, + {OBS_BOUNDS_SCALE_INNER, "OBS_BOUNDS_SCALE_INNER"}, + {OBS_BOUNDS_SCALE_OUTER, "OBS_BOUNDS_SCALE_OUTER"}, + {OBS_BOUNDS_SCALE_TO_WIDTH, "OBS_BOUNDS_SCALE_TO_WIDTH"}, + {OBS_BOUNDS_SCALE_TO_HEIGHT, "OBS_BOUNDS_SCALE_TO_HEIGHT"}, + {OBS_BOUNDS_MAX_ONLY, "OBS_BOUNDS_MAX_ONLY"}, + }) + +NLOHMANN_JSON_SERIALIZE_ENUM(obs_blending_type, { + {OBS_BLEND_NORMAL, "OBS_BLEND_NORMAL"}, + {OBS_BLEND_ADDITIVE, "OBS_BLEND_ADDITIVE"}, + {OBS_BLEND_SUBTRACT, "OBS_BLEND_SUBTRACT"}, + {OBS_BLEND_SCREEN, "OBS_BLEND_SCREEN"}, + {OBS_BLEND_MULTIPLY, "OBS_BLEND_MULTIPLY"}, + {OBS_BLEND_LIGHTEN, "OBS_BLEND_LIGHTEN"}, + {OBS_BLEND_DARKEN, "OBS_BLEND_DARKEN"}, + }) + namespace Utils { namespace Json { bool JsonArrayIsValidObsArray(const json &j); diff --git a/src/utils/Obs.h b/src/utils/Obs.h index e7154b3e..2b891214 100644 --- a/src/utils/Obs.h +++ b/src/utils/Obs.h @@ -77,6 +77,16 @@ enum ObsOutputState { OBS_WEBSOCKET_OUTPUT_RESUMED, }; +NLOHMANN_JSON_SERIALIZE_ENUM(ObsOutputState, { + {OBS_WEBSOCKET_OUTPUT_UNKNOWN, "OBS_WEBSOCKET_OUTPUT_UNKNOWN"}, + {OBS_WEBSOCKET_OUTPUT_STARTING, "OBS_WEBSOCKET_OUTPUT_STARTING"}, + {OBS_WEBSOCKET_OUTPUT_STARTED, "OBS_WEBSOCKET_OUTPUT_STARTED"}, + {OBS_WEBSOCKET_OUTPUT_STOPPING, "OBS_WEBSOCKET_OUTPUT_STOPPING"}, + {OBS_WEBSOCKET_OUTPUT_STOPPED, "OBS_WEBSOCKET_OUTPUT_STOPPED"}, + {OBS_WEBSOCKET_OUTPUT_PAUSED, "OBS_WEBSOCKET_OUTPUT_PAUSED"}, + {OBS_WEBSOCKET_OUTPUT_RESUMED, "OBS_WEBSOCKET_OUTPUT_RESUMED"}, + }) + enum ObsMediaInputAction { /** * No action. @@ -150,6 +160,17 @@ enum ObsMediaInputAction { OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PREVIOUS, }; +NLOHMANN_JSON_SERIALIZE_ENUM(ObsMediaInputAction, + { + {OBS_WEBSOCKET_MEDIA_INPUT_ACTION_NONE, "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_NONE"}, + {OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PLAY, "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PLAY"}, + {OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PAUSE, "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PAUSE"}, + {OBS_WEBSOCKET_MEDIA_INPUT_ACTION_STOP, "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_STOP"}, + {OBS_WEBSOCKET_MEDIA_INPUT_ACTION_RESTART, "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_RESTART"}, + {OBS_WEBSOCKET_MEDIA_INPUT_ACTION_NEXT, "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_NEXT"}, + {OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PREVIOUS, "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PREVIOUS"}, + }) + namespace Utils { namespace Obs { namespace StringHelper { @@ -158,21 +179,8 @@ std::string GetCurrentSceneCollection(); std::string GetCurrentProfile(); std::string GetCurrentProfilePath(); std::string GetCurrentRecordOutputPath(); -std::string GetSourceType(obs_source_t *source); -std::string GetInputMonitorType(enum obs_monitoring_type monitorType); -std::string GetInputMonitorType(obs_source_t *input); -std::string GetMediaInputState(obs_source_t *input); std::string GetLastReplayBufferFilePath(); -std::string GetSceneItemBoundsType(enum obs_bounds_type type); -std::string GetSceneItemBlendMode(enum obs_blending_type mode); std::string DurationToTimecode(uint64_t); -std::string GetOutputState(ObsOutputState state); -} - -namespace EnumHelper { -enum obs_bounds_type GetSceneItemBoundsType(std::string boundsType); -enum ObsMediaInputAction GetMediaInputAction(std::string mediaAction); -enum obs_blending_type GetSceneItemBlendMode(std::string mode); } namespace NumberHelper { diff --git a/src/utils/Obs_ArrayHelper.cpp b/src/utils/Obs_ArrayHelper.cpp index 6c958c8c..43c0ba52 100644 --- a/src/utils/Obs_ArrayHelper.cpp +++ b/src/utils/Obs_ArrayHelper.cpp @@ -146,7 +146,7 @@ std::vector Utils::Obs::ArrayHelper::GetSceneItemList(obs_scene_t *scene, if (!enumData->second) { OBSSource itemSource = obs_sceneitem_get_source(sceneItem); item["sourceName"] = obs_source_get_name(itemSource); - item["sourceType"] = StringHelper::GetSourceType(itemSource); + item["sourceType"] = obs_source_get_type(itemSource); if (obs_source_get_type(itemSource) == OBS_SOURCE_TYPE_INPUT) item["inputKind"] = obs_source_get_id(itemSource); else diff --git a/src/utils/Obs_EnumHelper.cpp b/src/utils/Obs_EnumHelper.cpp deleted file mode 100644 index db7301b2..00000000 --- a/src/utils/Obs_EnumHelper.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* -obs-websocket -Copyright (C) 2020-2021 Kyle Manning - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see -*/ - -#include "Obs.h" -#include "../plugin-macros.generated.h" - -#define RET_COMPARE(str, x) \ - if (str == #x) \ - return x; - -enum obs_bounds_type Utils::Obs::EnumHelper::GetSceneItemBoundsType(std::string boundsType) -{ - RET_COMPARE(boundsType, OBS_BOUNDS_NONE) - RET_COMPARE(boundsType, OBS_BOUNDS_STRETCH) - RET_COMPARE(boundsType, OBS_BOUNDS_SCALE_INNER) - RET_COMPARE(boundsType, OBS_BOUNDS_SCALE_OUTER) - RET_COMPARE(boundsType, OBS_BOUNDS_SCALE_TO_WIDTH) - RET_COMPARE(boundsType, OBS_BOUNDS_SCALE_TO_HEIGHT) - RET_COMPARE(boundsType, OBS_BOUNDS_MAX_ONLY) - - return OBS_BOUNDS_NONE; -} - -enum ObsMediaInputAction Utils::Obs::EnumHelper::GetMediaInputAction(std::string mediaAction) -{ - RET_COMPARE(mediaAction, OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PLAY) - RET_COMPARE(mediaAction, OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PAUSE) - RET_COMPARE(mediaAction, OBS_WEBSOCKET_MEDIA_INPUT_ACTION_STOP) - RET_COMPARE(mediaAction, OBS_WEBSOCKET_MEDIA_INPUT_ACTION_RESTART) - RET_COMPARE(mediaAction, OBS_WEBSOCKET_MEDIA_INPUT_ACTION_NEXT) - RET_COMPARE(mediaAction, OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PREVIOUS) - - return OBS_WEBSOCKET_MEDIA_INPUT_ACTION_NONE; -} - -enum obs_blending_type Utils::Obs::EnumHelper::GetSceneItemBlendMode(std::string mode) -{ - RET_COMPARE(mode, OBS_BLEND_NORMAL) - RET_COMPARE(mode, OBS_BLEND_ADDITIVE) - RET_COMPARE(mode, OBS_BLEND_SUBTRACT) - RET_COMPARE(mode, OBS_BLEND_SCREEN) - RET_COMPARE(mode, OBS_BLEND_MULTIPLY) - RET_COMPARE(mode, OBS_BLEND_LIGHTEN) - RET_COMPARE(mode, OBS_BLEND_DARKEN) - - return OBS_BLEND_NORMAL; -} diff --git a/src/utils/Obs_ObjectHelper.cpp b/src/utils/Obs_ObjectHelper.cpp index 6c564112..007be63b 100644 --- a/src/utils/Obs_ObjectHelper.cpp +++ b/src/utils/Obs_ObjectHelper.cpp @@ -73,7 +73,7 @@ json Utils::Obs::ObjectHelper::GetSceneItemTransform(obs_sceneitem_t *item) ret["alignment"] = osi.alignment; - ret["boundsType"] = StringHelper::GetSceneItemBoundsType(osi.bounds_type); + ret["boundsType"] = osi.bounds_type; ret["boundsAlignment"] = osi.bounds_alignment; ret["boundsWidth"] = osi.bounds.x; ret["boundsHeight"] = osi.bounds.y; diff --git a/src/utils/Obs_StringHelper.cpp b/src/utils/Obs_StringHelper.cpp index 62a543cf..58d98449 100644 --- a/src/utils/Obs_StringHelper.cpp +++ b/src/utils/Obs_StringHelper.cpp @@ -72,53 +72,6 @@ std::string Utils::Obs::StringHelper::GetCurrentRecordOutputPath() return ret; } -std::string Utils::Obs::StringHelper::GetSourceType(obs_source_t *source) -{ - obs_source_type sourceType = obs_source_get_type(source); - - switch (sourceType) { - default: - CASE(OBS_SOURCE_TYPE_INPUT) - CASE(OBS_SOURCE_TYPE_FILTER) - CASE(OBS_SOURCE_TYPE_TRANSITION) - CASE(OBS_SOURCE_TYPE_SCENE) - } -} - -std::string Utils::Obs::StringHelper::GetInputMonitorType(enum obs_monitoring_type monitorType) -{ - switch (monitorType) { - default: - CASE(OBS_MONITORING_TYPE_NONE) - CASE(OBS_MONITORING_TYPE_MONITOR_ONLY) - CASE(OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT) - } -} - -std::string Utils::Obs::StringHelper::GetInputMonitorType(obs_source_t *input) -{ - obs_monitoring_type monitorType = obs_source_get_monitoring_type(input); - - return GetInputMonitorType(monitorType); -} - -std::string Utils::Obs::StringHelper::GetMediaInputState(obs_source_t *input) -{ - obs_media_state mediaState = obs_source_media_get_state(input); - - switch (mediaState) { - default: - CASE(OBS_MEDIA_STATE_NONE) - CASE(OBS_MEDIA_STATE_PLAYING) - CASE(OBS_MEDIA_STATE_OPENING) - CASE(OBS_MEDIA_STATE_BUFFERING) - CASE(OBS_MEDIA_STATE_PAUSED) - CASE(OBS_MEDIA_STATE_STOPPED) - CASE(OBS_MEDIA_STATE_ENDED) - CASE(OBS_MEDIA_STATE_ERROR) - } -} - std::string Utils::Obs::StringHelper::GetLastReplayBufferFilePath() { OBSOutputAutoRelease output = obs_frontend_get_replay_buffer_output(); @@ -137,34 +90,6 @@ std::string Utils::Obs::StringHelper::GetLastReplayBufferFilePath() return savedReplayPath; } -std::string Utils::Obs::StringHelper::GetSceneItemBoundsType(enum obs_bounds_type type) -{ - switch (type) { - default: - CASE(OBS_BOUNDS_NONE) - CASE(OBS_BOUNDS_STRETCH) - CASE(OBS_BOUNDS_SCALE_INNER) - CASE(OBS_BOUNDS_SCALE_OUTER) - CASE(OBS_BOUNDS_SCALE_TO_WIDTH) - CASE(OBS_BOUNDS_SCALE_TO_HEIGHT) - CASE(OBS_BOUNDS_MAX_ONLY) - } -} - -std::string Utils::Obs::StringHelper::GetSceneItemBlendMode(enum obs_blending_type mode) -{ - switch (mode) { - default: - CASE(OBS_BLEND_NORMAL) - CASE(OBS_BLEND_ADDITIVE) - CASE(OBS_BLEND_SUBTRACT) - CASE(OBS_BLEND_SCREEN) - CASE(OBS_BLEND_MULTIPLY) - CASE(OBS_BLEND_LIGHTEN) - CASE(OBS_BLEND_DARKEN) - } -} - std::string Utils::Obs::StringHelper::DurationToTimecode(uint64_t ms) { uint64_t secs = ms / 1000ULL; @@ -179,17 +104,3 @@ std::string Utils::Obs::StringHelper::DurationToTimecode(uint64_t ms) QString::asprintf("%02" PRIu64 ":%02" PRIu64 ":%02" PRIu64 ".%03" PRIu64, hoursPart, minutesPart, secsPart, msPart); return formatted.toStdString(); } - -std::string Utils::Obs::StringHelper::GetOutputState(ObsOutputState state) -{ - switch (state) { - default: - CASE(OBS_WEBSOCKET_OUTPUT_UNKNOWN) - CASE(OBS_WEBSOCKET_OUTPUT_STARTING) - CASE(OBS_WEBSOCKET_OUTPUT_STARTED) - CASE(OBS_WEBSOCKET_OUTPUT_STOPPING) - CASE(OBS_WEBSOCKET_OUTPUT_STOPPED) - CASE(OBS_WEBSOCKET_OUTPUT_PAUSED) - CASE(OBS_WEBSOCKET_OUTPUT_RESUMED) - } -}