diff --git a/src/requesthandler/RequestHandler.cpp b/src/requesthandler/RequestHandler.cpp index 30484ad2..60a24829 100644 --- a/src/requesthandler/RequestHandler.cpp +++ b/src/requesthandler/RequestHandler.cpp @@ -41,6 +41,7 @@ const std::map RequestHandler::_handlerMap {"GetInputList", &RequestHandler::GetInputList}, {"GetInputKindList", &RequestHandler::GetInputKindList}, {"GetInputDefaultSettings", &RequestHandler::GetInputDefaultSettings}, + {"GetInputSettings", &RequestHandler::GetInputSettings}, }; RequestResult RequestHandler::ProcessRequest(const Request& request) diff --git a/src/requesthandler/RequestHandler.h b/src/requesthandler/RequestHandler.h index 1828987d..7d2346b9 100644 --- a/src/requesthandler/RequestHandler.h +++ b/src/requesthandler/RequestHandler.h @@ -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 _handlerMap; }; diff --git a/src/requesthandler/RequestHandler_Inputs.cpp b/src/requesthandler/RequestHandler_Inputs.cpp index dc9acec6..49076bdf 100644 --- a/src/requesthandler/RequestHandler_Inputs.cpp +++ b/src/requesthandler/RequestHandler_Inputs.cpp @@ -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); +}