From 1a5f65e4affcc0c517e2b50c08bc9ca8a6deaae1 Mon Sep 17 00:00:00 2001 From: Joe Rayhawk Date: Thu, 24 Nov 2022 19:35:07 -0800 Subject: Events: support filter state updates --- src/obswebsocket.cr | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/obswebsocket.cr b/src/obswebsocket.cr index e4a1509..5f19008 100644 --- a/src/obswebsocket.cr +++ b/src/obswebsocket.cr @@ -351,13 +351,21 @@ module OBS raise SourceMissingException.new( "SourceFilterEnableStateChanged: missing source #{ edata["sourceName"].as_s}" ) end when "SourceFilterListReindexed" - # FIXME + edata = d["eventData"] + self.sources[edata["sourceName"].as_s].filters.deletecache() + # This could probably be made more efficient using the eventData when "SourceFilterCreated" - # FIXME + edata = d["eventData"] + self.sources[edata["sourceName"].as_s].filters.deletecache() + # This could probably be made more efficient using the eventData when "SourceFilterRemoved" - # FIXME + edata = d["eventData"] + self.sources[edata["sourceName"].as_s].filters.deletecache() + # This could probably be made more efficient using the eventData when "SourceFilterNameChanged" - # FIXME + edata = d["eventData"] + self.sources[edata["sourceName"].as_s].filters.deletecache() + # This could probably be made more efficient using the eventData when "StreamStateChanged" when "RecordStateChanged" when "ReplayBufferStateChanged" @@ -1058,6 +1066,10 @@ module OBS @filters_by_name.empty? && populate @filters_by_name end + def deletecache() + @filters_by_name = Hash( String, OBS::SourceFilter ).new + @filters_by_index = Array( String ).new + end end class SourceFilter -- cgit v1.2.3