mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
handler: Add caption handler
This commit is contained in:
parent
579acabe5e
commit
f65fdcdbc1
@ -103,6 +103,7 @@ QHash<QString, HandlerResponse(*)(WSRequestHandler*)> WSRequestHandler::messageM
|
||||
{ "SetStreamSettings", WSRequestHandler::HandleSetStreamSettings },
|
||||
{ "GetStreamSettings", WSRequestHandler::HandleGetStreamSettings },
|
||||
{ "SaveStreamSettings", WSRequestHandler::HandleSaveStreamSettings },
|
||||
{ "SendCaptions", WSRequestHandler::HandleSendCaptions },
|
||||
|
||||
{ "GetStudioModeStatus", WSRequestHandler::HandleGetStudioModeStatus },
|
||||
{ "GetPreviewScene", WSRequestHandler::HandleGetPreviewScene },
|
||||
|
@ -128,6 +128,7 @@ class WSRequestHandler : public QObject {
|
||||
static HandlerResponse HandleSetStreamSettings(WSRequestHandler* req);
|
||||
static HandlerResponse HandleGetStreamSettings(WSRequestHandler* req);
|
||||
static HandlerResponse HandleSaveStreamSettings(WSRequestHandler* req);
|
||||
static HandlerResponse HandleSendCaptions(WSRequestHandler * req);
|
||||
|
||||
static HandlerResponse HandleSetTransitionDuration(WSRequestHandler* req);
|
||||
static HandlerResponse HandleGetTransitionDuration(WSRequestHandler* req);
|
||||
|
@ -287,3 +287,26 @@ HandlerResponse WSRequestHandler::HandleSaveStreamSettings(WSRequestHandler* req
|
||||
obs_frontend_save_streaming_service();
|
||||
return req->SendOKResponse();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send the provided text as embedded CEA-608 caption data
|
||||
*
|
||||
* @api requests
|
||||
* @name SendCaptions
|
||||
* @category streaming
|
||||
*/
|
||||
HandlerResponse WSRequestHandler::HandleSendCaptions(WSRequestHandler* req) {
|
||||
if (!req->hasField("text")) {
|
||||
return req->SendErrorResponse("missing request parameters");
|
||||
}
|
||||
|
||||
OBSOutputAutoRelease output = obs_frontend_get_streaming_output();
|
||||
if (output) {
|
||||
const char* caption = obs_data_get_string(req->data, "text");
|
||||
obs_output_output_caption_text1(output, caption);
|
||||
}
|
||||
|
||||
return req->SendOKResponse();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user