Skip to content

Commit

Permalink
Add chapter proc handler
Browse files Browse the repository at this point in the history
  • Loading branch information
exeldro committed Jul 17, 2024
1 parent 8de87e4 commit 11c04e6
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions vertical-canvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,29 @@ static void get_stream_output(void *data, calldata_t *cd)
}
}

static void add_chapter(void *data, calldata_t *cd)
{
UNUSED_PARAMETER(data);
const auto width = calldata_int(cd, "width");
const auto height = calldata_int(cd, "height");
for (const auto &it : canvas_docks) {
if ((width && it->GetCanvasWidth() != width) || (height && it->GetCanvasHeight() != height))
continue;
auto output = it->GetRecordOutput();
if (!output)
continue;

proc_handler_t *ph = obs_output_get_proc_handler(output);
calldata cd2;
calldata_init(&cd2);
calldata_set_string(&cd2, "chapter_name", calldata_string(cd, "chapter_name"));
proc_handler_call(ph, "add_chapter", &cd2);
calldata_free(&cd2);
obs_output_release(output);
return;
}
}

obs_websocket_vendor vendor = nullptr;

void vendor_request_version(obs_data_t *request_data, obs_data_t *response_data, void *)
Expand Down Expand Up @@ -647,6 +670,8 @@ void obs_module_post_load(void)
start_stream_output, nullptr);
proc_handler_add(ph, "void aitum_vertical_stop_stream_output(in int width, in int height, in string name)",
stop_stream_output, nullptr);
proc_handler_add(ph, "void aitum_vertical_add_chapter(in int width, in int height, in string chapter_name)", add_chapter,
nullptr);

if (!vendor)
vendor = obs_websocket_register_vendor("aitum-vertical-canvas");
Expand Down

0 comments on commit 11c04e6

Please sign in to comment.