cyndilib.receiver#

Receiver#

class cyndilib.receiver.Receiver(unicode source_name=u'', Source source=None, color_format=RecvColorFormat.UYVY_BGRA, RecvBandwidth bandwidth=RecvBandwidth.lowest, bool allow_video_fields=True, unicode recv_name=u'')#

Bases: object

A receiver for NDI® streams

Parameters:
  • source_name (str, optional) – The NDI® source name to connect to. An empty string (default) indicates no source

  • source (Source, optional) – A Source object to connect to. None (default) indices no source.

  • color_format – The RecvColorFormat to accept

  • bandwidth – The RecvBandwidth to use

  • allow_video_fieldsTrue if interlaced video frames can be handled. If False, only progressive frames will be delivered.

  • recv_name – Name for the receiver

source_name#

The current NDI® source name

Type:

str

source#

The current Source object

Type:

Source

video_frame#
Type:

VideoRecvFrame

audio_frame#
Type:

AudioRecvFrame

metadata_frame#
Type:

MetadataRecvFrame

framesync#
Type:

FrameSync

connect_to(self, Source src)#

Alias for set_source()

disconnect(self)#

Disconnect from the source (if connected)

get_num_connections(self)#
get_performance_data(self)#
is_connected(self)#

Returns True if currently connected

preview_tally#

Indicates the preview tally state as set by set_source_tally_program()

program_tally#

Indicates the program tally state as set by set_source_tally_program()

receive(self, ReceiveFrameType recv_type, uint32_t timeout_ms) ReceiveFrameType#

Receive frame data of the given type

If requesting a video or audio frame and the result indicates data was received, the incoming frame data will be available in the video_frame or audio_frame.

Parameters:
  • recv_type (ReceiveFrameType) – The frame type(s) to receive

  • timeout_ms (int) – Time (in milliseconds) to wait for a frame to be available

Returns a ReceiveFrameType indicating what was received. If nothing was available before the timeout, the result will be ReceiveFrameType.nothing

reconnect(self)#
set_audio_frame(self, AudioRecvFrame af)#

Set the audio_frame

set_metadata_frame(self, MetadataRecvFrame mf)#

Set the metadata_frame

set_source(self, Source src)#

Set the current source

If the source is None, disconnects if necessary. Otherwise, attempt to connect to it.

set_source_tally_preview(self, bool value)#

Set the preview tally state for the currently connected source

See notes in the set_source_tally_program() method

set_source_tally_program(self, bool value)#

Set the program tally state for the currently connected source.

This method sends a tally command to the source and does not necessarily affect the state of the source object’s tally. It will be updated independently when tally metadata is received.

This is because other receivers may have also sent tally messages to the source. When this occurs, the source’s tally remains “on” until all of its connected receivers have set it to “off” (like a bitwise “OR”)

set_video_frame(self, VideoRecvFrame vf)#

Set the video_frame

RecvThread#

class cyndilib.receiver.RecvThread(receiver, timeout_ms, recv_frame_type=7, wait_time=0.1)#

Bases: Thread

A thread designed for use with Receiver

Repeatedly calls Receiver.receive() using the supplied arguments. A callback is then triggered whenever new frames are received.

This can be used to handle video and audio using two separate threads. One thread would be set to use recv_video and the other to recv_audio.

Parameters:
run(self)#
set_callback(self, cb)#

Set the callback used to indicate new frames

set_wait_event(self)#
stop(self)#

Stop the thread

ReceiveFrameType#

class cyndilib.receiver.ReceiveFrameType(enum.IntFlag)#

Frame type flags used to receive specific frame types and indicate results. Members and be combined using bit-wise operators.

nothing#

Indicate nothing can or has been received

recv_video#

Indicate video frames can or have been received

recv_audio#

Indicate video frames can or have been received

recv_metadata#

Indicate metadata frames can or have been received

recv_status_change#

Indicate a status change has occurred (results only)

recv_error#

Indicate an error occurred (results only)

recv_buffers_full#

Indicates a VideoRecvFrame or AudioRecvFrame buffer was full when trying to read (results only)

recv_all#

A combination of recv_video, recv_audio and recv_metadata