mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
RequestHandler: Add SendStreamCaption
This commit is contained in:
parent
ab137ce8a4
commit
fa8a091a3e
@ -143,6 +143,7 @@ const std::unordered_map<std::string, RequestMethodHandler> RequestHandler::_han
|
||||
{"ToggleStream", &RequestHandler::ToggleStream},
|
||||
{"StartStream", &RequestHandler::StartStream},
|
||||
{"StopStream", &RequestHandler::StopStream},
|
||||
{"SendStreamCaption", &RequestHandler::SendStreamCaption},
|
||||
|
||||
// Record
|
||||
{"GetRecordStatus", &RequestHandler::GetRecordStatus},
|
||||
|
@ -161,6 +161,7 @@ class RequestHandler {
|
||||
RequestResult ToggleStream(const Request&);
|
||||
RequestResult StartStream(const Request&);
|
||||
RequestResult StopStream(const Request&);
|
||||
RequestResult SendStreamCaption(const Request&);
|
||||
|
||||
// Record
|
||||
RequestResult GetRecordStatus(const Request&);
|
||||
|
@ -122,3 +122,35 @@ RequestResult RequestHandler::StopStream(const Request&)
|
||||
|
||||
return RequestResult::Success();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends CEA-608 caption text over the stream output.
|
||||
*
|
||||
* @requestField captionText | String | Caption text
|
||||
*
|
||||
* @requestType SendStreamCaption
|
||||
* @complexity 2
|
||||
* @rpcVersion -1
|
||||
* @initialVersion 5.0.0
|
||||
* @category stream
|
||||
* @api requests
|
||||
*/
|
||||
RequestResult RequestHandler::SendStreamCaption(const Request& request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
if (!request.ValidateString("captionText", statusCode, comment, true))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
if (!obs_frontend_streaming_active())
|
||||
return RequestResult::Error(RequestStatus::OutputNotRunning);
|
||||
|
||||
std::string captionText = request.RequestData["captionText"];
|
||||
|
||||
OBSOutputAutoRelease output = obs_frontend_get_streaming_output();
|
||||
|
||||
// 0.0 means no delay until the next caption can be sent
|
||||
obs_output_output_caption_text2(output, captionText.c_str(), 0.0);
|
||||
|
||||
return RequestResult::Success();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user