mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
requests(sources): add SetSourceFilterVisibility method
This commit is contained in:
parent
897f115363
commit
61af0ec9c6
@ -101,6 +101,7 @@ QHash<QString, HandlerResponse(*)(WSRequestHandler*)> WSRequestHandler::messageM
|
|||||||
{ "ReorderSourceFilter", WSRequestHandler::HandleReorderSourceFilter },
|
{ "ReorderSourceFilter", WSRequestHandler::HandleReorderSourceFilter },
|
||||||
{ "MoveSourceFilter", WSRequestHandler::HandleMoveSourceFilter },
|
{ "MoveSourceFilter", WSRequestHandler::HandleMoveSourceFilter },
|
||||||
{ "SetSourceFilterSettings", WSRequestHandler::HandleSetSourceFilterSettings },
|
{ "SetSourceFilterSettings", WSRequestHandler::HandleSetSourceFilterSettings },
|
||||||
|
{ "SetSourceFilterVisibility", WSRequestHandler::HandleSetSourceFilterVisibility },
|
||||||
|
|
||||||
{ "SetCurrentSceneCollection", WSRequestHandler::HandleSetCurrentSceneCollection },
|
{ "SetCurrentSceneCollection", WSRequestHandler::HandleSetCurrentSceneCollection },
|
||||||
{ "GetCurrentSceneCollection", WSRequestHandler::HandleGetCurrentSceneCollection },
|
{ "GetCurrentSceneCollection", WSRequestHandler::HandleGetCurrentSceneCollection },
|
||||||
|
@ -145,6 +145,7 @@ class WSRequestHandler : public QObject {
|
|||||||
static HandlerResponse HandleReorderSourceFilter(WSRequestHandler* req);
|
static HandlerResponse HandleReorderSourceFilter(WSRequestHandler* req);
|
||||||
static HandlerResponse HandleMoveSourceFilter(WSRequestHandler* req);
|
static HandlerResponse HandleMoveSourceFilter(WSRequestHandler* req);
|
||||||
static HandlerResponse HandleSetSourceFilterSettings(WSRequestHandler* req);
|
static HandlerResponse HandleSetSourceFilterSettings(WSRequestHandler* req);
|
||||||
|
static HandlerResponse HandleSetSourceFilterVisibility(WSRequestHandler* req);
|
||||||
|
|
||||||
static HandlerResponse HandleSetCurrentSceneCollection(WSRequestHandler* req);
|
static HandlerResponse HandleSetCurrentSceneCollection(WSRequestHandler* req);
|
||||||
static HandlerResponse HandleGetCurrentSceneCollection(WSRequestHandler* req);
|
static HandlerResponse HandleGetCurrentSceneCollection(WSRequestHandler* req);
|
||||||
|
@ -1378,6 +1378,42 @@ HandlerResponse WSRequestHandler::HandleSetSourceFilterSettings(WSRequestHandler
|
|||||||
return req->SendOKResponse();
|
return req->SendOKResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change the visibility/enabled state of a filter
|
||||||
|
*
|
||||||
|
* @param {String} `sourceName` Source name
|
||||||
|
* @param {String} `filterName` Source filter name
|
||||||
|
* @param {String} `filterEnabled` New filter state
|
||||||
|
*
|
||||||
|
* @api requests
|
||||||
|
* @name EnableSourceFilter
|
||||||
|
* @category sources
|
||||||
|
* @since 4.7.0
|
||||||
|
*/
|
||||||
|
HandlerResponse WSRequestHandler::HandleSetSourceFilterVisibility(WSRequestHandler* req)
|
||||||
|
{
|
||||||
|
if (!req->hasField("sourceName") || !req->hasField("filterName") || !req->hasField("filterEnabled")) {
|
||||||
|
return req->SendErrorResponse("missing request parameters");
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* sourceName = obs_data_get_string(req->data, "sourceName");
|
||||||
|
OBSSourceAutoRelease source = obs_get_source_by_name(sourceName);
|
||||||
|
if (!source) {
|
||||||
|
return req->SendErrorResponse("specified source doesn't exist");
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* filterName = obs_data_get_string(req->data, "filterName");
|
||||||
|
OBSSourceAutoRelease filter = obs_source_get_filter_by_name(source, "filterName");
|
||||||
|
if (!filter) {
|
||||||
|
return req->SendErrorResponse("specified filter doesn't exist on specified source");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool filterEnabled = obs_data_get_string(req->data, "filterEnabled");
|
||||||
|
obs_source_set_enabled(filter, filterEnabled);
|
||||||
|
|
||||||
|
return req->SendOKResponse();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Takes a picture snapshot of a source and then can either or both:
|
* Takes a picture snapshot of a source and then can either or both:
|
||||||
* - Send it over as a Data URI (base64-encoded data) in the response (by specifying `embedPictureFormat` in the request)
|
* - Send it over as a Data URI (base64-encoded data) in the response (by specifying `embedPictureFormat` in the request)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user