cyndilib.router#
Module implementing the NDI Routing API.
New in version 0.1.1.
Router#
- class cyndilib.router.Router#
Bases:
objectClass representing an NDI® router instance
With NDI® routing, you can create virtual outputs on the network which ‘look’ like normal sources, but are actually just routing to other sources on the network.
- Parameters:
New in version 0.1.1.
- name#
The name of the router instance. This is the name that will appear on the network.
- Type:
str, readonly
- groups#
The groups that this router instance belongs to. This is a comma-separated list of group names.
- Type:
str, readonly
- source#
The current source that this router is routing from. This will be
Noneif there is no source currently connected.- Type:
Source, readonly
- dest#
The current destination that this router is routing to. This will be
Noneif there is no destination currently connected.- Type:
Source, readonly
- close(self)#
Close the routing instance
- dest_host_name#
The current
host_nameof thedestThis will be
Noneif there is nodestcurrently connected.
- dest_stream_name#
The current
stream_nameof thedestThis will be
Noneif there is nodestcurrently connected.
- get_num_connections(self)#
Get the current number of receivers connected to this router
- is_active#
Whether the routing instance is currently active (i.e. has a valid source connected and is open)
- is_open#
Whether the routing instance is currently open
- open(self)#
Open the routing instance
- routing_change(self, source: Source)#
Change the routing to the specified source
- Raises:
RuntimeError – If the router is not open.
- routing_clear(self)#
Clear the current routing
- Raises:
RuntimeError – If the router is not open.
- source_host_name#
The current
host_nameof thesourceThis will be
Noneif there is nosourcecurrently connected.
- source_stream_name#
The current
stream_nameof thesourceThis will be
Noneif there is nosourcecurrently connected.
RoutingMatrix#
- class cyndilib.router.RoutingMatrix#
Bases:
objectClass representing a routing matrix, which manages multiple
Routerinstances and their routing definitions.This class also manages its own
Finderinstance to discover available sources on the network.New in version 0.1.1.
- add_router(self, router: Router)#
Add the given router to the routing matrix
- Raises:
KeyError – If a router with the same name as the given router already exists in the routing matrix
- add_router_by_name(self, name: str, groups: str = '')#
Add a router with the given name to the routing matrix
- Raises:
KeyError – If a router with the given name already exists in the routing matrix
- clear_route(self, dest_name: str)#
Clear the route for the router with the given name
Note
This will not remove the router from the routing matrix, it will just clear its current routing to any source.
- Raises:
KeyError – If a router with the given name does not exist in the routing matrix
- close(self)#
Close the routing matrix and all contained routers
- get_router_by_name(self, name: str)#
Get a router with the given name from the routing matrix
- Raises:
KeyError – If a router with the given name does not exist in the routing matrix
- get_routing_table(self)#
Get the current routing table as a dictionary mapping router names to source names
The returned dictionary is formatted as
{router_name: source_name, ...}and is a copy of the internal routing table, so modifying it will not affect the routing matrix.For routers that do not have a source currently connected, the source name will be
None.
- is_open#
Whether the routing matrix is currently open
- make_route(self, dest_name: str, source_name: str)#
Make a route from the source with the given name to the router with the given name
If a router with the given destination name does not already exist, it will be created.
- open(self)#
Open the routing matrix and all contained routers
- remove_router(self, router: Router)#
Remove the given router from the routing matrix
- Raises:
KeyError – If the given router does not exist in the routing matrix
- remove_router_by_name(self, name: str)#
Remove a router with the given name from the routing matrix
- Raises:
KeyError – If a router with the given name does not exist in the routing matrix
- set_finder_callback(self, cb)#
Set a callback function to be called whenever the finder’s
change_callbackis triggered