mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
RequestHandler: Add GetInputSettings
This commit is contained in:
parent
55755ae066
commit
271db036fe
@ -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)
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user