UI: Add chapter frontend API and hotkey

This commit is contained in:
derrod
2024-05-26 23:11:48 +02:00
parent 4503f0a056
commit 8ac8118b7f
7 changed files with 46 additions and 1 deletions
+18
View File
@@ -2808,6 +2808,23 @@ void OBSBasic::CreateHotkeys()
this);
LoadHotkey(splitFileHotkey, "OBSBasic.SplitFile");
/* Adding chapters is only supported by the native MP4 output */
const string_view output_id =
obs_output_get_id(outputHandler->fileOutput);
if (output_id == "mp4_output") {
addChapterHotkey = obs_hotkey_register_frontend(
"OBSBasic.AddChapterMarker",
Str("Basic.Main.AddChapterMarker"),
[](void *, obs_hotkey_id, obs_hotkey_t *,
bool pressed) {
if (pressed)
obs_frontend_recording_add_chapter(
nullptr);
},
this);
LoadHotkey(addChapterHotkey, "OBSBasic.AddChapterMarker");
}
replayBufHotkeys = obs_hotkey_pair_register_frontend(
"OBSBasic.StartReplayBuffer",
Str("Basic.Main.StartReplayBuffer"),
@@ -2936,6 +2953,7 @@ void OBSBasic::ClearHotkeys()
obs_hotkey_pair_unregister(recordingHotkeys);
obs_hotkey_pair_unregister(pauseHotkeys);
obs_hotkey_unregister(splitFileHotkey);
obs_hotkey_unregister(addChapterHotkey);
obs_hotkey_pair_unregister(replayBufHotkeys);
obs_hotkey_pair_unregister(vcamHotkeys);
obs_hotkey_pair_unregister(togglePreviewHotkeys);