mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
Requests: Add unpublished RemoveInput
The functionality depends on obs-studio#5276 to be merged and released, so we can add it but not enable it for now.
This commit is contained in:
parent
c9fa09edc4
commit
eebcc25115
@ -51,7 +51,7 @@ void Config::Load()
|
||||
// future loads use the override flag.
|
||||
if (FirstLoad) {
|
||||
FirstLoad = false;
|
||||
if (!ServerPassword.empty()) {
|
||||
if (!ServerPassword.isEmpty()) {
|
||||
blog(LOG_INFO, "[Config::Load] (FirstLoad) Generating new server password.");
|
||||
ServerPassword = QString::fromStdString(Utils::Crypto::GeneratePassword());
|
||||
} else {
|
||||
|
@ -49,6 +49,7 @@ const std::map<std::string, RequestMethodHandler> RequestHandler::_handlerMap
|
||||
{"GetInputList", &RequestHandler::GetInputList},
|
||||
{"GetInputKindList", &RequestHandler::GetInputKindList},
|
||||
{"CreateInput", &RequestHandler::CreateInput},
|
||||
//{"RemoveInput", &RequestHandler::RemoveInput}, // Disabled for now. Pending obs-studio#5276
|
||||
{"SetInputName", &RequestHandler::SetInputName},
|
||||
{"GetInputDefaultSettings", &RequestHandler::GetInputDefaultSettings},
|
||||
{"GetInputSettings", &RequestHandler::GetInputSettings},
|
||||
|
@ -70,6 +70,7 @@ class RequestHandler {
|
||||
RequestResult GetInputList(const Request&);
|
||||
RequestResult GetInputKindList(const Request&);
|
||||
RequestResult CreateInput(const Request&);
|
||||
RequestResult RemoveInput(const Request&);
|
||||
RequestResult SetInputName(const Request&);
|
||||
RequestResult GetInputDefaultSettings(const Request&);
|
||||
RequestResult GetInputSettings(const Request&);
|
||||
|
@ -83,6 +83,22 @@ RequestResult RequestHandler::CreateInput(const Request& request)
|
||||
return RequestResult::Success(responseData);
|
||||
}
|
||||
|
||||
RequestResult RequestHandler::RemoveInput(const Request& request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
|
||||
if (!input)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
// Some implementations of removing sources release before remove, and some release after.
|
||||
// Releasing afterwards guarantees that we don't accidentally destroy the source before
|
||||
// remove if we happen to hold the last ref (very, very rare)
|
||||
obs_source_remove(input);
|
||||
|
||||
return RequestResult::Success();
|
||||
}
|
||||
|
||||
RequestResult RequestHandler::SetInputName(const Request& request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
|
Loading…
Reference in New Issue
Block a user