cyndilib.finder#

Source#

class cyndilib.finder.Source#

Bases: object

Represents an NDI® source

The source name is a combination of the sender’s host_name and a stream_name within the sender (as senders may send multiple streams).

The two names are concatenated within the full name as "<host_name> (<stream_name>)".

name#

The full source name as reported through the NDI® library

Type:

str, readonly

valid#

True if this source is currently tracked by the NDI® library

Type:

bool, readonly

host_name#

The host name portion parsed from the source name

preview_tally#

A bool indicating the source’s preview tally state

program_tally#

A bool indicating the source’s program tally state

set_preview_tally(self, value: bool)#

Set the source’s preview tally to the given state

Note

This is only valid for sources attached to an active receiver.Receiver

set_program_tally(self, value: bool)#

Set the source’s program tally to the given state

Note

This is only valid for sources attached to an active receiver.Receiver

stream_name#

The stream name portion parsed from the source name

update(self) bool#

Finder#

class cyndilib.finder.Finder#

Bases: object

Discovers NDI® sources available on the network

is_open#

True if the finder is open

Type:

bool

notify#

A Condition to notify listeners when sources are added or removed

Type:

Condition

num_sources#

The current number of sources found

Type:

int

change_callback#

A callback to be used when sources are added or removed

finder_thread#

The thread used to make blocking calls to update sources

close(self)#

Closes the finder_thread

get_source(self, name: unicode) Source#

Get a Source by its name

get_source_names(self)#

Get the discovered sources as a list[str]

iter_sources(self)#

Iterate over the current sources as Source objects

This can also be done by iterating of the finder instance itself:

>>> with Finder() as finder:
...     for source in finder:
...         ...
open(self)#

Starts the finder_thread and begins searching for sources

set_change_callback(self, cb)#

Set the change_callback

update_sources(self)#

Manually update the current sources tracked by the NDI® library

Warning

This method should typically not be called directly and especially not if the finder_thread is in use.

wait(self, timeout=None)#

Wait for a source to be added or removed

wait_for_sources(self, timeout: float)#

Wait for the NDI® library to report a change in its source list

If a change was detected a call to update_sources() should follow.

Parameters:

timeout (float) – Time (in seconds) to block before a change is detected

Returns:

Flag indicating if a change was detected before the timout was reached

Return type:

bool

Warning

This method should typically not be called directly and especially not if the finder_thread is in use.