mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
requesthandler: Add GetSpecialInputs
This commit is contained in:
parent
c0308d6ce1
commit
24e43d0276
@ -71,6 +71,7 @@ const std::unordered_map<std::string, RequestMethodHandler> RequestHandler::_han
|
||||
// Inputs
|
||||
{"GetInputList", &RequestHandler::GetInputList},
|
||||
{"GetInputKindList", &RequestHandler::GetInputKindList},
|
||||
{"GetSpecialInputs", &RequestHandler::GetSpecialInputs},
|
||||
{"CreateInput", &RequestHandler::CreateInput},
|
||||
{"RemoveInput", &RequestHandler::RemoveInput},
|
||||
{"SetInputName", &RequestHandler::SetInputName},
|
||||
|
@ -89,6 +89,7 @@ class RequestHandler {
|
||||
// Inputs
|
||||
RequestResult GetInputList(const Request&);
|
||||
RequestResult GetInputKindList(const Request&);
|
||||
RequestResult GetSpecialInputs(const Request&);
|
||||
RequestResult CreateInput(const Request&);
|
||||
RequestResult RemoveInput(const Request&);
|
||||
RequestResult SetInputName(const Request&);
|
||||
|
@ -83,6 +83,43 @@ RequestResult RequestHandler::GetInputKindList(const Request& request)
|
||||
return RequestResult::Success(responseData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the names of all special inputs.
|
||||
*
|
||||
* @responseField desktop1 | String | Name of the Desktop Audio input
|
||||
* @responseField desktop2 | String | Name of the Desktop Audio 2 input
|
||||
* @responseField mic1 | String | Name of the Mic/Auxiliary Audio input
|
||||
* @responseField mic2 | String | Name of the Mic/Auxiliary Audio 2 input
|
||||
* @responseField mic3 | String | Name of the Mic/Auxiliary Audio 3 input
|
||||
* @responseField mic4 | String | Name of the Mic/Auxiliary Audio 4 input
|
||||
*
|
||||
* @requestType GetSpecialInputs
|
||||
* @complexity 2
|
||||
* @rpcVersion -1
|
||||
* @initialVersion 5.0.0
|
||||
* @api requests
|
||||
* @category inputs
|
||||
*/
|
||||
RequestResult RequestHandler::GetSpecialInputs(const Request&)
|
||||
{
|
||||
json responseData;
|
||||
|
||||
std::vector<std::string> channels = {"desktop1", "desktop2", "mic1", "mic2", "mic3", "mic4"};
|
||||
|
||||
size_t channelId = 1;
|
||||
for (auto &channel : channels) {
|
||||
OBSSourceAutoRelease input = obs_get_output_source(channelId);
|
||||
if (!input)
|
||||
responseData[channel] = nullptr;
|
||||
else
|
||||
responseData[channel] = obs_source_get_name(input);
|
||||
|
||||
channelId++;
|
||||
}
|
||||
|
||||
return RequestResult::Success(responseData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new input, adding it as a scene item to the specified scene.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user