cyndilib.receiver#
Receiver#
- class cyndilib.receiver.Receiver#
Bases:
objectA 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
Sourceobject to connect to.None(default) indices no source.color_format – The
RecvColorFormatto acceptbandwidth – The
RecvBandwidthto useallow_video_fields –
Trueif interlaced video frames can be handled. IfFalse, only progressive frames will be delivered.recv_name – Name for the receiver
- video_frame#
- Type:
- audio_frame#
- Type:
- metadata_frame#
- Type:
- connect_to(self, src: Source)#
Alias for
set_source()
- 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, recv_type: ReceiveFrameType, timeout_ms: int) 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_frameoraudio_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
ReceiveFrameTypeindicating what was received. If nothing was available before the timeout, the result will beReceiveFrameType.nothing
- reconnect(self)#
- set_audio_frame(self, af: AudioRecvFrame)#
Set the
audio_frame
- set_metadata_frame(self, mf: MetadataRecvFrame)#
Set the
metadata_frame
- set_source(self, src: Source)#
Set the current
sourceIf the source is None, disconnects if necessary. Otherwise, attempt to connect to it.
- set_source_tally_preview(self, value: bool)#
Set the preview tally state for the currently connected source
See notes in the
set_source_tally_program()method
- set_source_tally_program(self, value: bool)#
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
sourceobject’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, vf: VideoRecvFrame)#
Set the
video_frame
RecvThread#
- class cyndilib.receiver.RecvThread(receiver, timeout_ms, recv_frame_type=7, wait_time=0.1)#
Bases:
ThreadA thread designed for use with
ReceiverRepeatedly 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_videoand the other torecv_audio.- Parameters:
receiver (Receiver) – The receiver instance
timeout_ms (int) – Timeout (in milliseconds) to use when calling
Receiver.receive()recv_frame_type (ReceiveFrameType) – The type(s) of frames to receive
wait_time (float) – Amount of time (in seconds) to sleep between calls to
Receiver.receive()
- 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(value)#
Bases:
IntFlagAn enumeration.
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
VideoRecvFrameorAudioRecvFramebuffer was full when trying to read (results only)
- recv_all#
A combination of
recv_video,recv_audioandrecv_metadata