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.
|
// future loads use the override flag.
|
||||||
if (FirstLoad) {
|
if (FirstLoad) {
|
||||||
FirstLoad = false;
|
FirstLoad = false;
|
||||||
if (!ServerPassword.empty()) {
|
if (!ServerPassword.isEmpty()) {
|
||||||
blog(LOG_INFO, "[Config::Load] (FirstLoad) Generating new server password.");
|
blog(LOG_INFO, "[Config::Load] (FirstLoad) Generating new server password.");
|
||||||
ServerPassword = QString::fromStdString(Utils::Crypto::GeneratePassword());
|
ServerPassword = QString::fromStdString(Utils::Crypto::GeneratePassword());
|
||||||
} else {
|
} else {
|
||||||
|
@ -49,6 +49,7 @@ const std::map<std::string, RequestMethodHandler> RequestHandler::_handlerMap
|
|||||||
{"GetInputList", &RequestHandler::GetInputList},
|
{"GetInputList", &RequestHandler::GetInputList},
|
||||||
{"GetInputKindList", &RequestHandler::GetInputKindList},
|
{"GetInputKindList", &RequestHandler::GetInputKindList},
|
||||||
{"CreateInput", &RequestHandler::CreateInput},
|
{"CreateInput", &RequestHandler::CreateInput},
|
||||||
|
//{"RemoveInput", &RequestHandler::RemoveInput}, // Disabled for now. Pending obs-studio#5276
|
||||||
{"SetInputName", &RequestHandler::SetInputName},
|
{"SetInputName", &RequestHandler::SetInputName},
|
||||||
{"GetInputDefaultSettings", &RequestHandler::GetInputDefaultSettings},
|
{"GetInputDefaultSettings", &RequestHandler::GetInputDefaultSettings},
|
||||||
{"GetInputSettings", &RequestHandler::GetInputSettings},
|
{"GetInputSettings", &RequestHandler::GetInputSettings},
|
||||||
|
@ -70,6 +70,7 @@ class RequestHandler {
|
|||||||
RequestResult GetInputList(const Request&);
|
RequestResult GetInputList(const Request&);
|
||||||
RequestResult GetInputKindList(const Request&);
|
RequestResult GetInputKindList(const Request&);
|
||||||
RequestResult CreateInput(const Request&);
|
RequestResult CreateInput(const Request&);
|
||||||
|
RequestResult RemoveInput(const Request&);
|
||||||
RequestResult SetInputName(const Request&);
|
RequestResult SetInputName(const Request&);
|
||||||
RequestResult GetInputDefaultSettings(const Request&);
|
RequestResult GetInputDefaultSettings(const Request&);
|
||||||
RequestResult GetInputSettings(const Request&);
|
RequestResult GetInputSettings(const Request&);
|
||||||
|
@ -83,6 +83,22 @@ RequestResult RequestHandler::CreateInput(const Request& request)
|
|||||||
return RequestResult::Success(responseData);
|
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)
|
RequestResult RequestHandler::SetInputName(const Request& request)
|
||||||
{
|
{
|
||||||
RequestStatus::RequestStatus statusCode;
|
RequestStatus::RequestStatus statusCode;
|
||||||
|
Loading…
Reference in New Issue
Block a user