RequestHandler: Add GetInputSettings

This commit is contained in:
tt2468 2021-06-16 02:41:24 -07:00
parent 55755ae066
commit 271db036fe
3 changed files with 18 additions and 0 deletions

View File

@ -41,6 +41,7 @@ const std::map<std::string, RequestMethodHandler> RequestHandler::_handlerMap
{"GetInputList", &RequestHandler::GetInputList},
{"GetInputKindList", &RequestHandler::GetInputKindList},
{"GetInputDefaultSettings", &RequestHandler::GetInputDefaultSettings},
{"GetInputSettings", &RequestHandler::GetInputSettings},
};
RequestResult RequestHandler::ProcessRequest(const Request& request)

View File

@ -55,6 +55,7 @@ class RequestHandler {
RequestResult GetInputList(const Request&);
RequestResult GetInputKindList(const Request&);
RequestResult GetInputDefaultSettings(const Request&);
RequestResult GetInputSettings(const Request&);
static const std::map<std::string, RequestMethodHandler> _handlerMap;
};

View File

@ -58,3 +58,19 @@ RequestResult RequestHandler::GetInputDefaultSettings(const Request& request)
responseData["defaultInputSettings"] = Utils::Json::ObsDataToJson(defaultSettings, true);
return RequestResult::Success(responseData);
}
RequestResult RequestHandler::GetInputSettings(const Request& request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
if (!input)
return RequestResult::Error(statusCode, comment);
OBSDataAutoRelease inputSettings = obs_source_get_settings(input);
json responseData;
responseData["inputSettings"] = Utils::Json::ObsDataToJson(inputSettings);
responseData["inputKind"] = obs_source_get_id(input);
return RequestResult::Success(responseData);
}