From 8b4563f45f058cc578bc9a708e472fa73e8cc24c Mon Sep 17 00:00:00 2001 From: Stevenson Chittumuri Date: Wed, 21 Sep 2022 19:03:48 -0400 Subject: [PATCH 1/2] import ndi searching --- logic/camera_search/search_ndi.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 logic/camera_search/search_ndi.py diff --git a/logic/camera_search/search_ndi.py b/logic/camera_search/search_ndi.py new file mode 100644 index 00000000..e69de29b From 130ba87be7d691dd7fc9526222e80de3cb0154db Mon Sep 17 00:00:00 2001 From: Stevenson Chittumuri Date: Wed, 21 Sep 2022 19:15:20 -0400 Subject: [PATCH 2/2] simple ndi search --- logic/camera_search/search_ndi.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/logic/camera_search/search_ndi.py b/logic/camera_search/search_ndi.py index e69de29b..62407084 100644 --- a/logic/camera_search/search_ndi.py +++ b/logic/camera_search/search_ndi.py @@ -0,0 +1,23 @@ +import NDIlib as ndi + + +def get_ndi_sources(): + if not ndi.initialize(): + return 0 + + ndi_find = ndi.find_create_v2() + + if ndi_find is None: + return 0 + ndi.find_wait_for_sources(ndi_find, 5000) + sources = [] + + if not ndi.find_wait_for_sources(ndi_find, 5000): + print('No change to the sources found.') + + sources = ndi.find_get_current_sources(ndi_find) + print('Network sources (%s found).' % len(sources)) + for i, s in enumerate(sources): + print('%s. %s' % (i + 1, s.ndi_name)) + + return sources \ No newline at end of file