mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
parent
690726d281
commit
1d0db34bb2
@ -126,6 +126,7 @@ const std::unordered_map<std::string, RequestMethodHandler> RequestHandler::_han
|
||||
{"GetSceneItemList", &RequestHandler::GetSceneItemList},
|
||||
{"GetGroupSceneItemList", &RequestHandler::GetGroupSceneItemList},
|
||||
{"GetSceneItemId", &RequestHandler::GetSceneItemId},
|
||||
{"GetSceneItemSourceName", &RequestHandler::GetSceneItemSourceName},
|
||||
{"CreateSceneItem", &RequestHandler::CreateSceneItem},
|
||||
{"RemoveSceneItem", &RequestHandler::RemoveSceneItem},
|
||||
{"DuplicateSceneItem", &RequestHandler::DuplicateSceneItem},
|
||||
|
@ -145,6 +145,7 @@ private:
|
||||
RequestResult GetSceneItemList(const Request &);
|
||||
RequestResult GetGroupSceneItemList(const Request &);
|
||||
RequestResult GetSceneItemId(const Request &);
|
||||
RequestResult GetSceneItemSourceName(const Request &);
|
||||
RequestResult CreateSceneItem(const Request &);
|
||||
RequestResult RemoveSceneItem(const Request &);
|
||||
RequestResult DuplicateSceneItem(const Request &);
|
||||
|
@ -128,6 +128,37 @@ RequestResult RequestHandler::GetSceneItemId(const Request &request)
|
||||
return RequestResult::Success(responseData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the source name of a scene item.
|
||||
*
|
||||
* @requestField sceneName | String | Name of the scene the item is in
|
||||
* @requestField sceneItemId | Number | Numeric ID of the scene item | >= 0
|
||||
*
|
||||
* @responseField sourceName | String | Name of the source associated with the scene item
|
||||
*
|
||||
* @requestType GetSceneItemSourceName
|
||||
* @complexity 3
|
||||
* @rpcVersion -1
|
||||
* @initialVersion 5.4.0
|
||||
* @api requests
|
||||
* @category scene items
|
||||
*/
|
||||
RequestResult RequestHandler::GetSceneItemSourceName(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment);
|
||||
if (!sceneItem)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
OBSSource source = obs_sceneitem_get_source(sceneItem);
|
||||
|
||||
json responseData;
|
||||
responseData["sourceName"] = obs_source_get_name(source);
|
||||
|
||||
return RequestResult::Success(responseData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scene item using a source.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user