mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
requesthandler: Add CreateRecordChapter
The new `Hybrid MP4 [BETA]` output added in OBS adds support for writing chapter markers to the file.
This commit is contained in:
parent
71920c484b
commit
6483dcaef0
@ -178,6 +178,7 @@ const std::unordered_map<std::string, RequestMethodHandler> RequestHandler::_han
|
|||||||
{"PauseRecord", &RequestHandler::PauseRecord},
|
{"PauseRecord", &RequestHandler::PauseRecord},
|
||||||
{"ResumeRecord", &RequestHandler::ResumeRecord},
|
{"ResumeRecord", &RequestHandler::ResumeRecord},
|
||||||
{"SplitRecordFile", &RequestHandler::SplitRecordFile},
|
{"SplitRecordFile", &RequestHandler::SplitRecordFile},
|
||||||
|
{"CreateRecordChapter", &RequestHandler::CreateRecordChapter},
|
||||||
|
|
||||||
// Media Inputs
|
// Media Inputs
|
||||||
{"GetMediaInputStatus", &RequestHandler::GetMediaInputStatus},
|
{"GetMediaInputStatus", &RequestHandler::GetMediaInputStatus},
|
||||||
|
@ -197,6 +197,7 @@ private:
|
|||||||
RequestResult PauseRecord(const Request &);
|
RequestResult PauseRecord(const Request &);
|
||||||
RequestResult ResumeRecord(const Request &);
|
RequestResult ResumeRecord(const Request &);
|
||||||
RequestResult SplitRecordFile(const Request &);
|
RequestResult SplitRecordFile(const Request &);
|
||||||
|
RequestResult CreateRecordChapter(const Request &);
|
||||||
|
|
||||||
// Media Inputs
|
// Media Inputs
|
||||||
RequestResult GetMediaInputStatus(const Request &);
|
RequestResult GetMediaInputStatus(const Request &);
|
||||||
|
@ -211,3 +211,38 @@ RequestResult RequestHandler::SplitRecordFile(const Request &)
|
|||||||
|
|
||||||
return RequestResult::Success();
|
return RequestResult::Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a new chapter marker to the file currently being recorded.
|
||||||
|
*
|
||||||
|
* Note: As of OBS 30.2.0, the only file format supporting this feature is Hybrid MP4.
|
||||||
|
*
|
||||||
|
* @requestField ?chapterName | String | Name of the new chapter
|
||||||
|
*
|
||||||
|
* @requestType CreateRecordChapter
|
||||||
|
* @complexity 2
|
||||||
|
* @rpcVersion -1
|
||||||
|
* @initialVersion 5.5.0
|
||||||
|
* @api requests
|
||||||
|
* @category record
|
||||||
|
*/
|
||||||
|
RequestResult RequestHandler::CreateRecordChapter(const Request &request)
|
||||||
|
{
|
||||||
|
std::string chapterName;
|
||||||
|
if (request.Contains("chapterName")) {
|
||||||
|
RequestStatus::RequestStatus statusCode;
|
||||||
|
std::string comment;
|
||||||
|
if (!request.ValidateOptionalString("chapterName", statusCode, comment))
|
||||||
|
return RequestResult::Error(statusCode, comment);
|
||||||
|
chapterName = request.RequestData["chapterName"];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!obs_frontend_recording_active())
|
||||||
|
return RequestResult::Error(RequestStatus::OutputNotRunning);
|
||||||
|
|
||||||
|
if (!obs_frontend_recording_add_chapter(chapterName.empty() ? nullptr : chapterName.c_str()))
|
||||||
|
return RequestResult::Error(RequestStatus::RequestProcessingFailed,
|
||||||
|
"Verify that the output being used supports chapter markers.");
|
||||||
|
|
||||||
|
return RequestResult::Success();
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user