Skip to content

Commit

Permalink
source: clear old image data on activate
Browse files Browse the repository at this point in the history
  • Loading branch information
fzwoch committed Feb 1, 2022
1 parent 4a067de commit 8b4f266
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ package main
// extern void (filter_update)(uintptr_t data, obs_data_t *settings);
// extern void (dummy_update)(uintptr_t data, obs_data_t *settings);
//
// typedef void (*activate_t)(uintptr_t data);
// extern void source_activate(uintptr_t data);
//
// typedef struct obs_source_frame* (*filter_video_t)(uintptr_t data, struct obs_source_frame *frames);
// extern struct obs_source_frame* filter_video(uintptr_t data, struct obs_source_frame *frames);
//
Expand Down Expand Up @@ -136,6 +139,7 @@ func obs_module_load() C.bool {
get_properties: C.get_properties_t(unsafe.Pointer(C.source_get_properties)),
get_defaults: C.get_defaults_t(unsafe.Pointer(C.source_get_defaults)),
update: C.update_t(unsafe.Pointer(C.source_update)),
activate: C.activate_t(unsafe.Pointer(C.source_activate)),
}, C.sizeof_struct_obs_source_info)

C.obs_register_source_s(&C.struct_obs_source_info{
Expand Down
7 changes: 7 additions & 0 deletions source.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,13 @@ func source_update(data C.uintptr_t, settings *C.obs_data_t) {
go source_loop(h)
}

//export source_activate
func source_activate(data C.uintptr_t) {
h := cgo.Handle(data).Value().(*teleportSource)

C.obs_source_output_video(h.source, nil)
}

func source_loop(h *teleportSource) {
defer h.Done()

Expand Down

0 comments on commit 8b4f266

Please sign in to comment.