def remove_output_rec_callbacks(output_name): output = obs.obs_get_output_by_name(output_name) signal_handler = obs.obs_output_get_signal_handler(output) obs.signal_handler_disconnect(signal_handler, "start", load_start_url_reccb) obs.signal_handler_disconnect(signal_handler, "stop", load_stop_url_reccb) obs.obs_output_release(output)
def disconnect_handler(): global signal_handler if signal_handler is not None: obs.signal_handler_disconnect(signal_handler, "source_activate", source_activated) signal_handler = None
def restore_sceneitem_after_shake(): global shaken_sceneitem, shaken_sceneitem_angle if shaken_sceneitem: obs.obs_sceneitem_set_rot(shaken_sceneitem, shaken_sceneitem_angle) obs.signal_handler_disconnect(shaken_scene_handler, "item_remove", on_shaken_sceneitem_removed) shaken_sceneitem = None
def update_recording_callback(reconnect=True): if opencastplug.recording_signal_handler is not None: obs.signal_handler_disconnect(opencastplug.recording_signal_handler, "stop", cb_recording_finished) if reconnect: opencastplug.recording_signal_handler = obs.obs_output_get_signal_handler( obs.obs_frontend_get_recording_output()) obs.signal_handler_connect(opencastplug.recording_signal_handler, "stop", cb_recording_finished)
def remove_muted_callback(sn): if sn is None: return False # no callback is set source = obs.obs_get_source_by_name(sn) if source is None: return False handler = obs.obs_source_get_signal_handler(source) obs.signal_handler_disconnect(handler, "mute", mute_callback) obs.obs_source_release(source) return True
def script_update(settings): global is_active, visibility_handler is_active = obs.obs_data_get_bool(settings, "is_active") if is_active: scenes = obs.obs_frontend_get_scenes() for scene in scenes: visibility_handler = obs.obs_source_get_signal_handler(scene) obs.signal_handler_connect(visibility_handler, "item_visible", on_visibility_toggle) obs.source_list_release(scenes) else: obs.signal_handler_disconnect(visibility_handler, "item_visible", on_visibility_toggle) visibility_handler = None obs.remove_current_callback()
def remove_muted_callback(sn): if sn is None: return False # no callback is set source = obs.obs_get_source_by_name(sn) if source is None: dprint("ERROR: Could not remove callback for", sn) return False handler = obs.obs_source_get_signal_handler(source) obs.signal_handler_disconnect(handler, "mute", mute_callback) dprint("Removed callback for \"{:s}\"".format( obs.obs_source_get_name(source))) obs.obs_source_release(source) return True
def script_update(settings): logger.debug('script_update') cached_settings["use_default_fps"] = obs.obs_data_get_bool(settings, "use_default_fps") cached_settings["custom_fps"] = obs.obs_data_get_int(settings, "custom_fps") cached_settings["enabled"] = obs.obs_data_get_bool(settings, "enabled") if cached_settings["enabled"]: logger.info('Registering start and stop handlers.') signal_handler = obs.obs_output_get_signal_handler(output) try: obs.signal_handler_connect(signal_handler, 'start', recording_start_handler) obs.signal_handler_connect(signal_handler, 'stop', recording_stopped_handler) except RuntimeError as e: logger.critical(f'Disregarding error when connecting start and stop handlers: {e}') else: logger.info('Disconnecting start and stop handlers.') signal_handler = obs.obs_output_get_signal_handler(output) obs.signal_handler_disconnect(signal_handler, 'start', recording_start_handler) if not is_being_recorded: obs.signal_handler_disconnect(signal_handler, 'stop', recording_stopped_handler) logger.debug(f'cached_settings: {cached_settings}')