Skip to content

Commit

Permalink
feat: Update NDILIB to 5
Browse files Browse the repository at this point in the history
  • Loading branch information
olzzon committed Nov 7, 2021
1 parent dd19034 commit 7506423
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 47 deletions.
6 changes: 3 additions & 3 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'conditions': [
['OS=="win"', {
"link_settings": {
"libraries": [ "Processing.NDI.Lib.x64.lib" ],
"libraries": [ "Processing.NDI.Lib.x64.dll" ],
"library_dirs": [ "lib/win_x64" ]
},
"copies": [
Expand All @@ -36,13 +36,13 @@
},
"link_settings": {
"libraries": [
"<(module_root_dir)/build/Release/libndi.dylib"
"<(module_root_dir)/build/Release/libndi_advanced.dylib"
],
"copies": [
{
"destination": "build/Release/",
"files": [
"<!@(ls -1 lib/mac_x64/libndi.dylib)"
"<!@(ls -1 lib/mac_x64/libndi_advanced.dylib)"
]
}
]
Expand Down
25 changes: 15 additions & 10 deletions include/Processing.NDI.FrameSync.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,19 @@
// Recording multiple channels : Maybe. If you want to sync some input channels to match a master clock
// so that they can be ISO edited, then you might want a frame-sync.

// The type instance for a frame-synchronizer
// The type instance for a frame-synchronizer.
typedef void* NDIlib_framesync_instance_t;

// Create a frame synchronizer instance that can be used to get frames from a receiver. Once this receiver
// has been bound to a frame-sync then you should use it in order to receive video frames. You can continue
// to use the underlying receiver for other operations (tally, PTZ, etc...). Note that it remains your
// responsibility to destroy the receiver even when a frame-sync is using it. You should always destroy the
// receiver after the frame-sync has been destroyed.
//
PROCESSINGNDILIB_API
NDIlib_framesync_instance_t NDIlib_framesync_create(NDIlib_recv_instance_t p_receiver);

// Destroy a frame-sync implementation
// Destroy a frame-sync implementation.
PROCESSINGNDILIB_API
void NDIlib_framesync_destroy(NDIlib_framesync_instance_t p_instance);

Expand All @@ -103,29 +104,30 @@ void NDIlib_framesync_destroy(NDIlib_framesync_instance_t p_instance);
// will return in p_audio_data the current received audio format if there is one or sample-rate and
// no_channels equal to zero if there is not one. At any time you can specify sample_rate and no_channels as
// zero and it will return the current received audio format.
//
PROCESSINGNDILIB_API
void NDIlib_framesync_capture_audio(// The frame sync instance data
void NDIlib_framesync_capture_audio(// The frame sync instance data.
NDIlib_framesync_instance_t p_instance,
// The destination audio buffer that you wish to have filled in.
NDIlib_audio_frame_v2_t* p_audio_data,
// Your desired sample rate, number of channels and the number of desired samples.
int sample_rate, int no_channels, int no_samples);
PROCESSINGNDILIB_API
void NDIlib_framesync_capture_audio_v2(// The frame sync instance data
void NDIlib_framesync_capture_audio_v2(// The frame sync instance data.
NDIlib_framesync_instance_t p_instance,
// The destination audio buffer that you wish to have filled in.
NDIlib_audio_frame_v3_t* p_audio_data,
// Your desired sample rate, number of channels and the number of desired samples.
int sample_rate, int no_channels, int no_samples);

// Free audio returned by NDIlib_framesync_capture_audio
// Free audio returned by NDIlib_framesync_capture_audio.
PROCESSINGNDILIB_API
void NDIlib_framesync_free_audio(// The frame sync instance data
void NDIlib_framesync_free_audio(// The frame sync instance data.
NDIlib_framesync_instance_t p_instance,
// The destination audio buffer that you wish to have filled in.
NDIlib_audio_frame_v2_t* p_audio_data);
PROCESSINGNDILIB_API
void NDIlib_framesync_free_audio_v2(// The frame sync instance data
void NDIlib_framesync_free_audio_v2(// The frame sync instance data.
NDIlib_framesync_instance_t p_instance,
// The destination audio buffer that you wish to have filled in.
NDIlib_audio_frame_v3_t* p_audio_data);
Expand All @@ -148,6 +150,7 @@ void NDIlib_framesync_free_audio_v2(// The frame sync instance data
// number is correct since new samples might have been captured in that time. On synchronous use of this
// function however this will be the minimum number of samples in the queue at any later time until
// NDIlib_framesync_capture_audio is called.
//
PROCESSINGNDILIB_API
int NDIlib_framesync_audio_queue_depth(NDIlib_framesync_instance_t p_instance);

Expand All @@ -161,17 +164,19 @@ int NDIlib_framesync_audio_queue_depth(NDIlib_framesync_instance_t p_instance);
// structure. The reason for this is that it allows you to determine that there has not yet been any video
// and act accordingly. For instance you might want to display a constant frame output at a particular video
// format, or black.
//
PROCESSINGNDILIB_API
void NDIlib_framesync_capture_video(// The frame sync instance data
void NDIlib_framesync_capture_video(// The frame sync instance data.
NDIlib_framesync_instance_t p_instance,
// The destination video buffer that you wish to have filled in.
NDIlib_video_frame_v2_t* p_video_data,
// The frame type that you would prefer, all effort is made to match these.
NDIlib_frame_format_type_e field_type NDILIB_CPP_DEFAULT_VALUE(NDIlib_frame_format_type_progressive));

// Free audio returned by NDIlib_framesync_capture_video
// Free audio returned by NDIlib_framesync_capture_video.
//
PROCESSINGNDILIB_API
void NDIlib_framesync_free_video(// The frame sync instance data
void NDIlib_framesync_free_video(// The frame sync instance data.
NDIlib_framesync_instance_t p_instance,
// The destination video buffer that you wish to have filled in.
NDIlib_video_frame_v2_t* p_video_data);
68 changes: 34 additions & 34 deletions include/Processing.NDI.Recv.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
//
//***********************************************************************************************************

// Structures and type definitions required by NDI finding
// The reference to an instance of the receiver
// Structures and type definitions required by NDI finding.
// The reference to an instance of the receiver.
typedef void* NDIlib_recv_instance_t;

typedef enum NDIlib_recv_bandwidth_e
Expand All @@ -37,25 +37,25 @@ typedef enum NDIlib_recv_bandwidth_e
NDIlib_recv_bandwidth_lowest = 0, // Receive metadata, audio, video at a lower bandwidth and resolution.
NDIlib_recv_bandwidth_highest = 100, // Receive metadata, audio, video at full resolution.

// Ensure this is 32bits in size
// Ensure this is 32bits in size.
NDIlib_recv_bandwidth_max = 0x7fffffff
} NDIlib_recv_bandwidth_e;

typedef enum NDIlib_recv_color_format_e
{ // When there is no alpha channel, this mode delivers BGRX
// When there is an alpha channel, this mode delivers BGRA
{ // When there is no alpha channel, this mode delivers BGRX.
// When there is an alpha channel, this mode delivers BGRA.
NDIlib_recv_color_format_BGRX_BGRA = 0,

// When there is no alpha channel, this mode delivers UYVY
// When there is an alpha channel, this mode delivers BGRA
// When there is no alpha channel, this mode delivers UYVY.
// When there is an alpha channel, this mode delivers BGRA.
NDIlib_recv_color_format_UYVY_BGRA = 1,

// When there is no alpha channel, this mode delivers BGRX
// When there is an alpha channel, this mode delivers RGBA
// When there is no alpha channel, this mode delivers BGRX.
// When there is an alpha channel, this mode delivers RGBA.
NDIlib_recv_color_format_RGBX_RGBA = 2,

// When there is no alpha channel, this mode delivers UYVY
// When there is an alpha channel, this mode delivers RGBA
// When there is no alpha channel, this mode delivers UYVY.
// When there is an alpha channel, this mode delivers RGBA.
NDIlib_recv_color_format_UYVY_RGBA = 3,

// This format will try to decode the video using the fastest available color format for the incoming
Expand All @@ -66,7 +66,7 @@ typedef enum NDIlib_recv_color_format_e
// When using this format, you should consider than allow_video_fields is true, and individual fields
// will always be delivered.
//
// For most video sources on most platforms, this will follow the following conventions
// For most video sources on most platforms, this will follow the following conventions.
// No alpha channel : UYVY
// Alpha channel : UYVA
NDIlib_recv_color_format_fastest = 100,
Expand All @@ -83,7 +83,7 @@ typedef enum NDIlib_recv_color_format_e
// Alpha channel : PA16 or UYVA
NDIlib_recv_color_format_best = 101,

// Legacy definitions for backwards compatibility
// Legacy definitions for backwards compatibility.
NDIlib_recv_color_format_e_BGRX_BGRA = NDIlib_recv_color_format_BGRX_BGRA,
NDIlib_recv_color_format_e_UYVY_BGRA = NDIlib_recv_color_format_UYVY_BGRA,
NDIlib_recv_color_format_e_RGBX_RGBA = NDIlib_recv_color_format_RGBX_RGBA,
Expand All @@ -95,11 +95,11 @@ typedef enum NDIlib_recv_color_format_e
NDIlib_recv_color_format_BGRX_BGRA_flipped = 1000 + NDIlib_recv_color_format_BGRX_BGRA,
#endif

// Force the size to be 32bits
// Force the size to be 32bits.
NDIlib_recv_color_format_max = 0x7fffffff
} NDIlib_recv_color_format_e;

// The creation structure that is used when you are creating a receiver
// The creation structure that is used when you are creating a receiver.
typedef struct NDIlib_recv_create_v3_t
{ // The source that you wish to connect to.
NDIlib_source_t source_to_connect_to;
Expand Down Expand Up @@ -135,13 +135,13 @@ typedef struct NDIlib_recv_create_v3_t
// This allows you determine the current performance levels of the receiving to be able to detect whether
// frames have been dropped.
typedef struct NDIlib_recv_performance_t
{ // The number of video frames
{ // The number of video frames.
int64_t video_frames;

// The number of audio frames
// The number of audio frames.
int64_t audio_frames;

// The number of metadata frames
// The number of metadata frames.
int64_t metadata_frames;

#if NDILIB_CPP_DEFAULT_CONSTRUCTORS
Expand All @@ -150,15 +150,15 @@ typedef struct NDIlib_recv_performance_t

} NDIlib_recv_performance_t;

// Get the current queue depths
// Get the current queue depths.
typedef struct NDIlib_recv_queue_t
{ // The number of video frames
{ // The number of video frames.
int video_frames;

// The number of audio frames
// The number of audio frames.
int audio_frames;

// The number of metadata frames
// The number of metadata frames.
int metadata_frames;

#if NDILIB_CPP_DEFAULT_CONSTRUCTORS
Expand Down Expand Up @@ -190,10 +190,10 @@ void NDIlib_recv_connect(NDIlib_recv_instance_t p_instance, const NDIlib_source_
// appropriate free function below.
PROCESSINGNDILIB_API
NDIlib_frame_type_e NDIlib_recv_capture_v2(
NDIlib_recv_instance_t p_instance, // The library instance
NDIlib_video_frame_v2_t* p_video_data, // The video data received (can be NULL)
NDIlib_audio_frame_v2_t* p_audio_data, // The audio data received (can be NULL)
NDIlib_metadata_frame_t* p_metadata, // The metadata received (can be NULL)
NDIlib_recv_instance_t p_instance, // The library instance.
NDIlib_video_frame_v2_t* p_video_data, // The video data received (can be NULL).
NDIlib_audio_frame_v2_t* p_audio_data, // The audio data received (can be NULL).
NDIlib_metadata_frame_t* p_metadata, // The metadata received (can be NULL).
uint32_t timeout_in_ms); // The amount of time in milliseconds to wait for data.

// This will allow you to receive video, audio and metadata frames. Any of the buffers can be NULL, in which
Expand All @@ -204,25 +204,25 @@ NDIlib_frame_type_e NDIlib_recv_capture_v2(
// appropriate free function below.
PROCESSINGNDILIB_API
NDIlib_frame_type_e NDIlib_recv_capture_v3(
NDIlib_recv_instance_t p_instance, // The library instance
NDIlib_video_frame_v2_t* p_video_data, // The video data received (can be NULL)
NDIlib_audio_frame_v3_t* p_audio_data, // The audio data received (can be NULL)
NDIlib_metadata_frame_t* p_metadata, // The metadata received (can be NULL)
NDIlib_recv_instance_t p_instance, // The library instance.
NDIlib_video_frame_v2_t* p_video_data, // The video data received (can be NULL).
NDIlib_audio_frame_v3_t* p_audio_data, // The audio data received (can be NULL).
NDIlib_metadata_frame_t* p_metadata, // The metadata received (can be NULL).
uint32_t timeout_in_ms); // The amount of time in milliseconds to wait for data.

// Free the buffers returned by capture for video
// Free the buffers returned by capture for video.
PROCESSINGNDILIB_API
void NDIlib_recv_free_video_v2(NDIlib_recv_instance_t p_instance, const NDIlib_video_frame_v2_t* p_video_data);

// Free the buffers returned by capture for audio
// Free the buffers returned by capture for audio.
PROCESSINGNDILIB_API
void NDIlib_recv_free_audio_v2(NDIlib_recv_instance_t p_instance, const NDIlib_audio_frame_v2_t* p_audio_data);

// Free the buffers returned by capture for audio
// Free the buffers returned by capture for audio.
PROCESSINGNDILIB_API
void NDIlib_recv_free_audio_v3(NDIlib_recv_instance_t p_instance, const NDIlib_audio_frame_v3_t* p_audio_data);

// Free the buffers returned by capture for metadata
// Free the buffers returned by capture for metadata.
PROCESSINGNDILIB_API
void NDIlib_recv_free_metadata(NDIlib_recv_instance_t p_instance, const NDIlib_metadata_frame_t* p_metadata);

Expand Down
Binary file not shown.
Binary file added lib/win_x64/Processing.NDI.Lib.UWP.x64.dll
Binary file not shown.
Binary file added lib/win_x64/Processing.NDI.Lib.x64.dll
Binary file not shown.

0 comments on commit 7506423

Please sign in to comment.