Don't update the slave source if the window of master hasn't changed
This commit is contained in:
parent
515f2aa513
commit
ecfac47c9a
1 changed files with 14 additions and 13 deletions
|
|
@ -46,24 +46,27 @@ function timer_callback()
|
||||||
|
|
||||||
-- get settings of a master source
|
-- get settings of a master source
|
||||||
local master_props = obs.obs_source_get_settings(master_source)
|
local master_props = obs.obs_source_get_settings(master_source)
|
||||||
|
|
||||||
-- get the "window" property which will tell what window the master source is captturing
|
-- get the "window" property which will tell what window the master source is captturing
|
||||||
local master_window = obs.obs_data_get_string(master_props, 'window')
|
local master_window = obs.obs_data_get_string(master_props, 'window')
|
||||||
-- yes, it uses windows in "game" capture mode (fuck clarity, I guess?)
|
-- yes, it uses windows in "game" capture mode (fuck clarity, I guess?)
|
||||||
|
|
||||||
-- get settings of a slave source
|
-- get settings of a slave source
|
||||||
local slave_props = obs.obs_source_get_settings(slave_source)
|
local slave_props = obs.obs_source_get_settings(slave_source)
|
||||||
|
-- also read the slave props, no need to update anything if there's no need to update anything ;)
|
||||||
|
local slave_window = obs.obs_data_get_string(master_props, 'window')
|
||||||
|
|
||||||
-- now that we have both, create a NEW temporary data object (again, no other way from lua, except ffi since 2020)
|
if slave_window ~= master_window then
|
||||||
local new_slave_props = obs.obs_data_create()
|
-- now that we have both, create a NEW temporary data object (again, no other way from lua, except ffi since 2020)
|
||||||
-- copy/paste the window property from the master to the slave
|
local new_slave_props = obs.obs_data_create()
|
||||||
obs.obs_data_set_string(slave_props, 'window', master_window)
|
-- copy/paste the window property from the master to the slave
|
||||||
-- set the new temporary data object as properties for the slave source
|
obs.obs_data_set_string(slave_props, 'window', master_window)
|
||||||
obs.obs_data_set_obj(new_slave_props, "sourceSettings", slave_props)
|
-- set the new temporary data object as properties for the slave source
|
||||||
|
obs.obs_data_set_obj(new_slave_props, "sourceSettings", slave_props)
|
||||||
|
|
||||||
-- the copied source won't update unless...
|
-- the copied source won't update unless...
|
||||||
obs.obs_source_update(slave_source, slave_props)
|
obs.obs_source_update(slave_source, slave_props)
|
||||||
--obs.obs_frontend_open_source_properties(slave_source_name)
|
--obs.obs_frontend_open_source_properties(slave_source_name)
|
||||||
|
end
|
||||||
|
|
||||||
-- release master and slave objects
|
-- release master and slave objects
|
||||||
obs.obs_source_release(master_source)
|
obs.obs_source_release(master_source)
|
||||||
|
|
@ -169,5 +172,3 @@ function script_load(settings)
|
||||||
print("Source Synchronizer script loaded")
|
print("Source Synchronizer script loaded")
|
||||||
activate(true)
|
activate(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue