diff --git a/src/requesthandler/RequestHandler.cpp b/src/requesthandler/RequestHandler.cpp index f3c21599..02fddd62 100644 --- a/src/requesthandler/RequestHandler.cpp +++ b/src/requesthandler/RequestHandler.cpp @@ -134,6 +134,9 @@ const std::map RequestHandler::_handlerMap // Ui {"GetStudioModeEnabled", &RequestHandler::GetStudioModeEnabled}, {"SetStudioModeEnabled", &RequestHandler::SetStudioModeEnabled}, + {"OpenInputPropertiesDialog", &RequestHandler::OpenInputPropertiesDialog}, + {"OpenInputFiltersDialog", &RequestHandler::OpenInputFiltersDialog}, + {"OpenInputInteractDialog", &RequestHandler::OpenInputInteractDialog}, }; RequestHandler::RequestHandler(SessionPtr session) : diff --git a/src/requesthandler/RequestHandler.h b/src/requesthandler/RequestHandler.h index 19e3fde4..c918ae16 100644 --- a/src/requesthandler/RequestHandler.h +++ b/src/requesthandler/RequestHandler.h @@ -156,6 +156,9 @@ class RequestHandler { // Ui RequestResult GetStudioModeEnabled(const Request&); RequestResult SetStudioModeEnabled(const Request&); + RequestResult OpenInputPropertiesDialog(const Request&); + RequestResult OpenInputFiltersDialog(const Request&); + RequestResult OpenInputInteractDialog(const Request&); SessionPtr _session; static const std::map _handlerMap; diff --git a/src/requesthandler/RequestHandler_Ui.cpp b/src/requesthandler/RequestHandler_Ui.cpp index 4a093591..12fa5d04 100644 --- a/src/requesthandler/RequestHandler_Ui.cpp +++ b/src/requesthandler/RequestHandler_Ui.cpp @@ -70,3 +70,81 @@ RequestResult RequestHandler::SetStudioModeEnabled(const Request& request) return RequestResult::Success(); } + +/** + * Opens the properties dialog of an input. + * + * @requestField inputName | String | Name of the input to open the dialog of + * + * @requestType OpenInputPropertiesDialog + * @complexity 1 + * @rpcVersion -1 + * @initialVersion 5.0.0 + * @category ui + * @api requests + */ +RequestResult RequestHandler::OpenInputPropertiesDialog(const Request& request) +{ + RequestStatus::RequestStatus statusCode; + std::string comment; + OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment); + if (!input) + return RequestResult::Error(statusCode, comment); + + obs_frontend_open_source_properties(input); + + return RequestResult::Success(); +} + +/** + * Opens the filters dialog of an input. + * + * @requestField inputName | String | Name of the input to open the dialog of + * + * @requestType OpenInputFiltersDialog + * @complexity 1 + * @rpcVersion -1 + * @initialVersion 5.0.0 + * @category ui + * @api requests + */ +RequestResult RequestHandler::OpenInputFiltersDialog(const Request& request) +{ + RequestStatus::RequestStatus statusCode; + std::string comment; + OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment); + if (!input) + return RequestResult::Error(statusCode, comment); + + obs_frontend_open_source_filters(input); + + return RequestResult::Success(); +} + +/** + * Opens the interact dialog of an input. + * + * @requestField inputName | String | Name of the input to open the dialog of + * + * @requestType OpenInputInteractDialog + * @complexity 1 + * @rpcVersion -1 + * @initialVersion 5.0.0 + * @category ui + * @api requests + */ +RequestResult RequestHandler::OpenInputInteractDialog(const Request& request) +{ + RequestStatus::RequestStatus statusCode; + std::string comment; + OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment); + if (!input) + return RequestResult::Error(statusCode, comment); + + if (!(obs_source_get_output_flags(input) & OBS_SOURCE_INTERACTION)) + return RequestResult::Error(RequestStatus::InvalidResourceState, "The specified input does not support interaction."); + + obs_frontend_open_source_interaction(input); + + return RequestResult::Success(); +}