From fb6f8721e24f916a5a609d55a74870a1c7e4ac1b Mon Sep 17 00:00:00 2001 From: jp9000 Date: Sat, 27 Dec 2014 20:55:03 -0800 Subject: [PATCH] libobs: Add 'audio_sync' source signal Adds a signal is called when the sync offset has changed for a source. --- libobs/obs-source.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/libobs/obs-source.c b/libobs/obs-source.c index f59c44816..cd8dc2a1a 100644 --- a/libobs/obs-source.c +++ b/libobs/obs-source.c @@ -82,6 +82,7 @@ static const char *source_signals[] = { "void volume(ptr source, in out float volume)", "void update_properties(ptr source)", "void update_flags(ptr source, int flags)", + "void audio_sync(ptr source, int out int offset)", "void audio_data(ptr source, ptr data)", NULL }; @@ -1881,8 +1882,18 @@ float obs_source_get_present_volume(const obs_source_t *source) void obs_source_set_sync_offset(obs_source_t *source, int64_t offset) { - if (source) - source->sync_offset = offset; + if (source) { + struct calldata data = {0}; + + calldata_set_ptr(&data, "source", source); + calldata_set_int(&data, "offset", offset); + + signal_handler_signal(source->context.signals, "audio_sync", + &data); + + source->sync_offset = calldata_int(&data, "offset"); + calldata_free(&data); + } } int64_t obs_source_get_sync_offset(const obs_source_t *source) -- GitLab