Requests: Apply some code style changes

This commit is contained in:
tt2468 2021-11-17 02:09:27 -08:00
parent 061fb6f012
commit 1dbb7a9686
5 changed files with 15 additions and 6 deletions

View File

@ -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"] = nullptr;
responseData["defaultParameterValue"] = json::null();
} else {
responseData["parameterValue"] = nullptr;
responseData["defaultParameterValue"] = nullptr;
responseData["parameterValue"] = json::null();
responseData["defaultParameterValue"] = json::null();
}
return RequestResult::Success(responseData);

View File

@ -365,6 +365,8 @@ std::vector<json> GetListPropertyItems(obs_property_t *property)
itemData["itemValue"] = obs_property_list_item_float(property, i);
} else if (itemFormat == OBS_COMBO_FORMAT_STRING) {
itemData["itemValue"] = obs_property_list_item_string(property, i);
} else {
itemData["itemValue"] = json::null();
}
ret.push_back(itemData);
}

View File

@ -15,6 +15,9 @@ RequestResult RequestHandler::GetMediaInputStatus(const Request& request)
if (mediaState == OBS_MEDIA_STATE_PLAYING || mediaState == OBS_MEDIA_STATE_PAUSED) {
responseData["mediaDuration"] = obs_source_media_get_duration(input);
responseData["mediaCursor"] = obs_source_media_get_time(input);
} else {
responseData["mediaDuration"] = json::null();
responseData["mediaCursor"] = json::null();
}
return RequestResult::Success(responseData);

View File

@ -8,13 +8,13 @@ RequestResult RequestHandler::GetSceneList(const Request& request)
if (currentProgramScene)
responseData["currentProgramSceneName"] = obs_source_get_name(currentProgramScene);
else
responseData["currentProgramSceneName"] = nullptr;
responseData["currentProgramSceneName"] = json::null();
OBSSourceAutoRelease currentPreviewScene = obs_frontend_get_current_preview_scene();
if (currentPreviewScene)
responseData["currentPreviewSceneName"] = obs_source_get_name(currentPreviewScene);
else
responseData["currentPreviewSceneName"] = nullptr;
responseData["currentPreviewSceneName"] = json::null();
responseData["scenes"] = Utils::Obs::ListHelper::GetSceneList();

View File

@ -283,8 +283,12 @@ std::vector<json> Utils::Obs::ListHelper::GetSceneItemList(obs_scene_t *scene, b
item["sourceType"] = StringHelper::GetSourceType(itemSource);
if (obs_source_get_type(itemSource) == OBS_SOURCE_TYPE_INPUT)
item["inputKind"] = obs_source_get_id(itemSource);
else if (obs_source_get_type(itemSource) == OBS_SOURCE_TYPE_SCENE)
else
item["inputKind"] = json::null();
if (obs_source_get_type(itemSource) == OBS_SOURCE_TYPE_SCENE)
item["isGroup"] = obs_source_is_group(itemSource);
else
item["isGroup"] = json::null();
}
enumData->first.push_back(item);