mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
Base: Fix compile error
I literally could have sworn I remember json::null() being valid, but I guess not. Oops
This commit is contained in:
parent
1dbb7a9686
commit
01013c1b27
@ -23,10 +23,10 @@ RequestResult RequestHandler::GetPersistentData(const Request& request)
|
||||
|
||||
json responseData;
|
||||
json persistentData;
|
||||
if (!(Utils::Json::GetJsonFileContent(persistentDataPath, persistentData) && persistentData.contains(slotName)))
|
||||
responseData["slotValue"] = nullptr;
|
||||
else
|
||||
if (Utils::Json::GetJsonFileContent(persistentDataPath, persistentData) && persistentData.contains(slotName))
|
||||
responseData["slotValue"] = persistentData[slotName];
|
||||
else
|
||||
responseData["slotValue"] = nullptr;
|
||||
|
||||
return RequestResult::Success(responseData);
|
||||
}
|
||||
@ -208,10 +208,10 @@ RequestResult RequestHandler::GetProfileParameter(const Request& request)
|
||||
responseData["defaultParameterValue"] = config_get_default_string(profile, parameterCategory.c_str(), parameterName.c_str());
|
||||
} else if (config_has_user_value(profile, parameterCategory.c_str(), parameterName.c_str())) {
|
||||
responseData["parameterValue"] = config_get_string(profile, parameterCategory.c_str(), parameterName.c_str());
|
||||
responseData["defaultParameterValue"] = json::null();
|
||||
responseData["defaultParameterValue"] = nullptr;
|
||||
} else {
|
||||
responseData["parameterValue"] = json::null();
|
||||
responseData["defaultParameterValue"] = json::null();
|
||||
responseData["parameterValue"] = nullptr;
|
||||
responseData["defaultParameterValue"] = nullptr;
|
||||
}
|
||||
|
||||
return RequestResult::Success(responseData);
|
||||
@ -347,7 +347,7 @@ RequestResult RequestHandler::SetStreamServiceSettings(const Request& request)
|
||||
obs_service_update(currentStreamService, newStreamServiceSettings);
|
||||
} else {
|
||||
// TODO: This leaks memory. I have no idea why.
|
||||
OBSService newStreamService = obs_service_create(requestedStreamServiceType.c_str(), "obs_websocket_custom_service", requestedStreamServiceSettings, NULL);
|
||||
OBSService newStreamService = obs_service_create(requestedStreamServiceType.c_str(), "obs_websocket_custom_service", requestedStreamServiceSettings, nullptr);
|
||||
// TODO: Check service type here, instead of relying on service creation to fail.
|
||||
if (!newStreamService)
|
||||
return RequestResult::Error(RequestStatus::ResourceCreationFailed, "Failed to create the stream service with the requested streamServiceType. It may be an invalid type.");
|
||||
|
@ -366,7 +366,7 @@ std::vector<json> GetListPropertyItems(obs_property_t *property)
|
||||
} else if (itemFormat == OBS_COMBO_FORMAT_STRING) {
|
||||
itemData["itemValue"] = obs_property_list_item_string(property, i);
|
||||
} else {
|
||||
itemData["itemValue"] = json::null();
|
||||
itemData["itemValue"] = nullptr;
|
||||
}
|
||||
ret.push_back(itemData);
|
||||
}
|
||||
|
@ -8,13 +8,13 @@ RequestResult RequestHandler::GetSceneList(const Request& request)
|
||||
if (currentProgramScene)
|
||||
responseData["currentProgramSceneName"] = obs_source_get_name(currentProgramScene);
|
||||
else
|
||||
responseData["currentProgramSceneName"] = json::null();
|
||||
responseData["currentProgramSceneName"] = nullptr;
|
||||
|
||||
OBSSourceAutoRelease currentPreviewScene = obs_frontend_get_current_preview_scene();
|
||||
if (currentPreviewScene)
|
||||
responseData["currentPreviewSceneName"] = obs_source_get_name(currentPreviewScene);
|
||||
else
|
||||
responseData["currentPreviewSceneName"] = json::null();
|
||||
responseData["currentPreviewSceneName"] = nullptr;
|
||||
|
||||
responseData["scenes"] = Utils::Obs::ListHelper::GetSceneList();
|
||||
|
||||
|
@ -171,6 +171,18 @@ enum obs_bounds_type Utils::Obs::EnumHelper::GetSceneItemBoundsType(std::string
|
||||
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;
|
||||
}
|
||||
|
||||
uint64_t Utils::Obs::NumberHelper::GetOutputDuration(obs_output_t *output)
|
||||
{
|
||||
if (!output || !obs_output_active(output))
|
||||
@ -284,11 +296,11 @@ std::vector<json> Utils::Obs::ListHelper::GetSceneItemList(obs_scene_t *scene, b
|
||||
if (obs_source_get_type(itemSource) == OBS_SOURCE_TYPE_INPUT)
|
||||
item["inputKind"] = obs_source_get_id(itemSource);
|
||||
else
|
||||
item["inputKind"] = json::null();
|
||||
item["inputKind"] = nullptr;
|
||||
if (obs_source_get_type(itemSource) == OBS_SOURCE_TYPE_SCENE)
|
||||
item["isGroup"] = obs_source_is_group(itemSource);
|
||||
else
|
||||
item["isGroup"] = json::null();
|
||||
item["isGroup"] = nullptr;
|
||||
}
|
||||
|
||||
enumData->first.push_back(item);
|
||||
|
@ -16,10 +16,11 @@ enum ObsOutputState {
|
||||
};
|
||||
|
||||
enum ObsMediaInputAction {
|
||||
OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PAUSE,
|
||||
OBS_WEBSOCKET_MEDIA_INPUT_ACTION_NONE,
|
||||
OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PLAY,
|
||||
OBS_WEBSOCKET_MEDIA_INPUT_ACTION_RESTART,
|
||||
OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PAUSE,
|
||||
OBS_WEBSOCKET_MEDIA_INPUT_ACTION_STOP,
|
||||
OBS_WEBSOCKET_MEDIA_INPUT_ACTION_RESTART,
|
||||
OBS_WEBSOCKET_MEDIA_INPUT_ACTION_NEXT,
|
||||
OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PREVIOUS
|
||||
};
|
||||
@ -42,6 +43,7 @@ namespace Utils {
|
||||
|
||||
namespace EnumHelper {
|
||||
enum obs_bounds_type GetSceneItemBoundsType(std::string boundsType);
|
||||
enum ObsMediaInputAction GetMediaInputAction(std::string mediaAction);
|
||||
}
|
||||
|
||||
namespace NumberHelper {
|
||||
|
Loading…
Reference in New Issue
Block a user