Receiving
Receiving
NDI receivers are created in the same way as they would be in the NDI SDK, using NDIlib_recv_create_v3
, or the newer function available to the Advanced SDK, NDIlib_recv_create_v4
. As with senders, you provide the device name. It is strongly recommended that your device allow its name to be configured so that individual devices can be identified on the network. (This is not currently used by NDI applications; however it is anticipated that it will be in the future and your device will thus be future-proof.)
An example of creating a receiver follows below:
It is crucial that you provide an XML identification for all hardware devices. This should include your vendor name, model number, serial number and firmware version.
For example, the following XML identification would work (although it should be filled in with the correct settings for your device (serial numbers should be unique to each device manufactured):
Note that you can create a receiver for the preview stream in addition to the program stream. Preview streams might be beneficial for picture-in-picture support, for example.
To do so, you would specify NDIlib_recv_bandwidth_lowest
in the bandwidth field of the create struct, rather than NDIlib_recv_bandwidth_highest
. You can capture audio with a program or preview stream receiver, or you can create a dedicated audio-only receiver and capture audio in a loop on another thread.
It is recommended that you also provide a "preferred" video format that you want to an up-stream device, since this has been commonly used by NDI applications. For instance, CG applications can be informed of a resolution you would like, and will automatically configure themselves to this resolution. An example might be as follows:
Here is a simple example of a loop capturing video only from the program stream receiver:
If desired, you could asynchronously capture and decode by moving decoding to another thread. Just don't forget to use NDIlib_recv_free_video_v2 to free the video buffers when you finish decoding.
The line_stride_in_bytes
field will be used to tell you about the size in bytes of the compressed video data.
Last updated