CDI SDK
SDK for transporting chunks of data reliably and with low latency using a polled mode network driver.
Loading...
Searching...
No Matches
ndi_wrapper.h File Reference

The declarations in this header file correspond to the definitions in ndi_wrapper.c and ndi_test.c. More...

#include <stdbool.h>
#include <stdint.h>
#include "cdi_baseline_profile_02_00_api.h"
#include "cdi_log_api.h"
#include "cdi_os_api.h"
#include "fifo_api.h"
#include "cdi_pool_api.h"
#include <Processing.NDI.Lib.h>

Go to the source code of this file.

Data Structures

struct  FrameData
 A structure for storing all info related to a NDI frame, and a specific connection, including test settings, connection configuration data from the SDK, and state information for the test connection. More...
 
union  FrameData::NdiDataType
 Store of NDI media frame. More...
 
struct  NdiTime
 A structure for storing breakdown of NDI timestamp in seconds, milliseconds, and nanoseconds. More...
 

Typedefs

typedef struct TestConnectionInfo TestConnectionInfo
 Forward reference.
 
typedef struct TestSettings TestSettings
 Forward reference.
 

Enumerations

enum  NdiFrameType { kNdiVideo = 0 , kNdiAudio = 1 , kNdiMetaData = 2 }
 A structure that labels the various NDI frames. More...
 

Functions

bool NdiInitialize (void)
 A function which initializes the NDI SDK.
 
void NdiShowSources (void)
 Show available NDI sources and exit.
 
NDIlib_recv_instance_t NdiCreateReceiver (const TestSettings *test_settings_ptr)
 A function which creates a NDI finder, looks for NDI sources, creates a NDI receiver, and connects to a NDI source to receive stream information.
 
NDIlib_send_instance_t NdiCreateSender (const TestSettings *test_settings_ptr)
 A function which creates a NDI sender.
 
void NdiReleasePayload (FrameData *arg_ptr)
 A function that releases the memory of a NDI video, audio, or metadata frame, and puts back memory pool allocation.
 
CdiReturnStatus NdiConvertNdiToCdi (FrameData *arg_ptr, int *data_size_ptr, void **data_ptr, int64_t *timestamp_ptr, CdiAvmBaselineConfig *avm_baseline_config_ptr)
 A function that maps information of NDI frame to an AVM structure that is compatible with CDI.
 
CdiReturnStatus NdiConvertCdiToNdi (const CdiPtpTimestamp *cdi_timestamp_ptr, const CdiAvmBaselineConfig *avm_config_ptr, int payload_size, const CdiSgList *sgl_ptr, FrameData *frame_data_ptr)
 Convert CDI payload to NDI frame.
 
CDI_THREAD NdiReceivePayloadThread (void *ndi_thread_data_ptr)
 A function that captures NDI frames that is to be written to the memory pool and put in the Payload FIFO. Function also reads from Callback FIFO to determine if NDI frame memory should be released or resent. Function uses a receding time clock element to determine if video frames are being sent consistently at the expected time. If video frame is not seen in expected time, function resends last seen video frame, else it keeps sending new video frames.
 
CDI_THREAD NdiTransmitPayloadThread (void *ndi_thread_data_ptr)
 Thread used to transmit NDI frames.
 
NdiTime NdiTimeBreakdown (int64_t ndi_timestamp)
 A function that breaks down the NDI Timestamp, in 100ns format, into seconds, milliseconds, and nanoseconds.
 

Detailed Description

The declarations in this header file correspond to the definitions in ndi_wrapper.c and ndi_test.c.

Enumeration Type Documentation

◆ NdiFrameType

A structure that labels the various NDI frames.

Enumerator
kNdiVideo 

Labels video frames as zero.

kNdiAudio 

Labels audio frames as one.

kNdiMetaData 

Labels metadata frames as two.

Function Documentation

◆ NdiConvertCdiToNdi()

CdiReturnStatus NdiConvertCdiToNdi ( const CdiPtpTimestamp * cdi_timestamp_ptr,
const CdiAvmBaselineConfig * avm_config_ptr,
int payload_size,
const CdiSgList * sgl_ptr,
FrameData * frame_data_ptr )

Convert CDI payload to NDI frame.

Returns
A value from the CdiReturnStatus enumeration.

◆ NdiConvertNdiToCdi()

CdiReturnStatus NdiConvertNdiToCdi ( FrameData * arg_ptr,
int * data_size_ptr,
void ** data_ptr,
int64_t * timestamp_ptr,
CdiAvmBaselineConfig * avm_baseline_config_ptr )

A function that maps information of NDI frame to an AVM structure that is compatible with CDI.

Parameters
arg_ptrFrame Data pointer which stores NDI frame.
data_size_ptrArgument passed in to CDI send containing size of data.
data_ptrArgument passed in to CDI send containing data.
timestamp_ptrArgument passed in to CDI send containing timestamp of data.
avm_baseline_config_ptrArgument passed in to CDI send containing configuration of data.
Returns
A value from the CdiReturnStatus enumeration.

◆ NdiCreateReceiver()

NDIlib_recv_instance_t NdiCreateReceiver ( const TestSettings * test_settings_ptr)

A function which creates a NDI finder, looks for NDI sources, creates a NDI receiver, and connects to a NDI source to receive stream information.

Parameters
test_settings_ptrPointer to Test Settings argument to find NDI source based from the command line, if given.
Returns
Returns a NDI receiver that is connected to a NDI source.

◆ NdiCreateSender()

NDIlib_send_instance_t NdiCreateSender ( const TestSettings * test_settings_ptr)

A function which creates a NDI sender.

Parameters
test_settings_ptrPointer to Test Settings argument to create NDI source based from the command line, if given.
Returns
Returns a NDI sender.

◆ NdiInitialize()

bool NdiInitialize ( void )

A function which initializes the NDI SDK.

Returns
true or false.

◆ NdiReceivePayloadThread()

CDI_THREAD NdiReceivePayloadThread ( void * ndi_thread_data_ptr)

A function that captures NDI frames that is to be written to the memory pool and put in the Payload FIFO. Function also reads from Callback FIFO to determine if NDI frame memory should be released or resent. Function uses a receding time clock element to determine if video frames are being sent consistently at the expected time. If video frame is not seen in expected time, function resends last seen video frame, else it keeps sending new video frames.

Parameters
ndi_thread_data_ptrContains necessary and unchanged data like Test Connections Information.
Returns
Always returns 0.

◆ NdiReleasePayload()

void NdiReleasePayload ( FrameData * arg_ptr)

A function that releases the memory of a NDI video, audio, or metadata frame, and puts back memory pool allocation.

Parameters
arg_ptrA pointer to an Frame Data structure that is to be released.

◆ NdiTimeBreakdown()

NdiTime NdiTimeBreakdown ( int64_t ndi_timestamp)

A function that breaks down the NDI Timestamp, in 100ns format, into seconds, milliseconds, and nanoseconds.

Parameters
ndi_timestampNDI timestamp.
Returns
Returns a structure containing breakdown of NDI timestamp in seconds, milliseconds, and nanoseconds.

◆ NdiTransmitPayloadThread()

CDI_THREAD NdiTransmitPayloadThread ( void * ndi_thread_data_ptr)

Thread used to transmit NDI frames.

Parameters
ndi_thread_data_ptrPointer to NDI thread data.
Returns
Always returns 0.