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
Go to the documentation of this file.
1// -------------------------------------------------------------------------------------------
2// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
3// This file is part of the AWS CDI-SDK, licensed under the BSD 2-Clause "Simplified" License.
4// License details at: https://github.com/aws/aws-cdi-sdk/blob/mainline/LICENSE
5// -------------------------------------------------------------------------------------------
6
13#ifndef NDI_WRAPPER_H__
14#define NDI_WRAPPER_H__
15
16#include <stdbool.h>
17#include <stdint.h>
18
20#include "cdi_log_api.h"
21#include "cdi_os_api.h"
22#include "fifo_api.h"
23#include "cdi_pool_api.h"
24#include <Processing.NDI.Lib.h>
25
26//*********************************************************************************************************************
27//***************************************** START OF DEFINITIONS AND TYPES ********************************************
28//*********************************************************************************************************************
29
31typedef struct TestSettings TestSettings;
32
37typedef enum {
42
48typedef struct {
53 NDIlib_video_frame_v2_t video_frame;
54 NDIlib_audio_frame_v2_t audio_frame;
55 NDIlib_metadata_frame_t metadata;
56 } data;
58 volatile uint32_t ref_count;
59
61} FrameData;
62
67typedef struct {
68 uint32_t ndi_time_in_s;
70 uint32_t ndi_time_in_ns;
71} NdiTime;
72
73//*********************************************************************************************************************
74//******************************************* START OF PUBLIC FUNCTIONS ***********************************************
75//*********************************************************************************************************************
76
82bool NdiInitialize(void);
83
87void NdiShowSources(void);
88
97NDIlib_recv_instance_t NdiCreateReceiver(const TestSettings* test_settings_ptr);
98
106NDIlib_send_instance_t NdiCreateSender(const TestSettings* test_settings_ptr);
107
114void NdiReleasePayload(FrameData* arg_ptr);
115
127CdiReturnStatus NdiConvertNdiToCdi(FrameData* arg_ptr, int* data_size_ptr, void** data_ptr, int64_t* timestamp_ptr,
128 CdiAvmBaselineConfig* avm_baseline_config_ptr);
129
135CdiReturnStatus NdiConvertCdiToNdi(const CdiPtpTimestamp* cdi_timestamp_ptr, const CdiAvmBaselineConfig* avm_config_ptr,
136 int payload_size, const CdiSgList* sgl_ptr, FrameData* frame_data_ptr);
137
149CDI_THREAD NdiReceivePayloadThread(void* ndi_thread_data_ptr);
150
158CDI_THREAD NdiTransmitPayloadThread(void* ndi_thread_data_ptr);
159
167NdiTime NdiTimeBreakdown(int64_t ndi_timestamp);
168
169#endif // NDI_WRAPPER_H__
This file contains declarations and definitions for the CDI AVM baseline profile 02....
CdiReturnStatus
Values used for API function return codes.
Definition cdi_core_api.h:189
This file declares the public API data types, structures and functions that comprise the CDI log API.
This file contains the declarations for OS functions for creating/managing/freeing threads,...
#define CDI_THREAD
Define portable thread function return type.
Definition cdi_os_api.h:179
This file declares the public API data types, structures and functions that comprise the CDI Pool Uti...
The declarations in this header file correspond to the definitions in fifo.c.
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.
Definition ndi_wrapper.c:864
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,...
Definition ndi_wrapper.c:730
void NdiShowSources(void)
Show available NDI sources and exit.
Definition ndi_wrapper.c:698
NdiTime NdiTimeBreakdown(int64_t ndi_timestamp)
A function that breaks down the NDI Timestamp, in 100ns format, into seconds, milliseconds,...
Definition ndi_wrapper.c:662
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 F...
Definition ndi_wrapper.c:886
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.
Definition ndi_wrapper.c:841
NdiFrameType
A structure that labels the various NDI frames.
Definition ndi_wrapper.h:37
@ kNdiMetaData
Labels metadata frames as two.
Definition ndi_wrapper.h:40
@ kNdiVideo
Labels video frames as zero.
Definition ndi_wrapper.h:38
@ kNdiAudio
Labels audio frames as one.
Definition ndi_wrapper.h:39
NDIlib_send_instance_t NdiCreateSender(const TestSettings *test_settings_ptr)
A function which creates a NDI sender.
Definition ndi_wrapper.c:682
void NdiReleasePayload(FrameData *arg_ptr)
A function that releases the memory of a NDI video, audio, or metadata frame, and puts back memory po...
Definition ndi_wrapper.c:825
CDI_THREAD NdiTransmitPayloadThread(void *ndi_thread_data_ptr)
Thread used to transmit NDI frames.
Definition ndi_wrapper.c:1083
bool NdiInitialize(void)
A function which initializes the NDI SDK.
Definition ndi_wrapper.c:675
Structure that aggregates the audio, video, and ancillary data structures into a single structure.
Definition cdi_baseline_profile_01_00_api.h:189
A structure for holding a PTP timestamp defined in seconds and nanoseconds. This PTP time as defined ...
Definition cdi_core_api.h:331
This structure defines a scatter-gather list (SGL) which is used to represent an array of data compri...
Definition cdi_core_api.h:728
A structure for storing all info related to a NDI frame, and a specific connection,...
Definition ndi_wrapper.h:48
volatile uint32_t ref_count
Reference counter; if value == 0, can free frame memory.
Definition ndi_wrapper.h:58
NdiFrameType frame_type
Definition ndi_wrapper.h:50
CdiSgList rx_sgl
CDI Rx SGL.
Definition ndi_wrapper.h:60
int p_data_size
Calculated p_data size (if value is not zero).
Definition ndi_wrapper.h:57
TestConnectionInfo * connect_info_ptr
Pointer to all info related to a specific connection.
Definition ndi_wrapper.h:49
A structure for storing breakdown of NDI timestamp in seconds, milliseconds, and nanoseconds.
Definition ndi_wrapper.h:67
uint32_t ndi_time_in_ns
NDI time in nanoseconds.
Definition ndi_wrapper.h:70
uint32_t ndi_time_in_s
NDI time in seconds.
Definition ndi_wrapper.h:68
int64_t ndi_time_in_ms
NDI time in milliseconds.
Definition ndi_wrapper.h:69
A structure for storing all info related to a specific connection, including test settings,...
Definition ndi_test.h:73
A structure that holds all the test settings for a connection as set from the command line.
Definition ndi_test.h:44
static uint8_t data[]
Definition test_unit_sgl.c:56
Store of NDI media frame.
Definition ndi_wrapper.h:52
NDIlib_metadata_frame_t metadata
NDI metadata.
Definition ndi_wrapper.h:55
NDIlib_video_frame_v2_t video_frame
NDI video frame.
Definition ndi_wrapper.h:53
NDIlib_audio_frame_v2_t audio_frame
NDI audio frame.
Definition ndi_wrapper.h:54