From patchwork Tue Feb 20 16:32:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maksym Veremeyenko X-Patchwork-Id: 7680 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.150.33 with SMTP id c30csp2914516jai; Tue, 20 Feb 2018 08:32:58 -0800 (PST) X-Google-Smtp-Source: AH8x224kc7vrUnzvto+PgsbSu/9uldC27DxtF0xbDhcQsaS5imHpYzhYy57oNFQ0YPBNhFB0W9Tk X-Received: by 10.28.230.12 with SMTP id d12mr736945wmh.114.1519144378447; Tue, 20 Feb 2018 08:32:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519144378; cv=none; d=google.com; s=arc-20160816; b=M3HE0HimVyR88B0PlGRcROu1b63+EzWjaQyP63fho2dKJqHhOLq7Ezvp81oTSiaBH0 pkDPZebdiLIeFeXVs6mrgOwKgQfYF+a2VVwLkAkdgbDrIEGJ3rnLerFELFO4XVZmbUOc bd4SgZosY97wB97HOvwb9kHTIg7U46U62Sx/ig9DDvm2C+kRM3N4PO7ChXH7C9kRPejd MLLJu8Tt5N1CEf8rIgamjoVhTIQ6Yi670ImSbl09DxKNNereH4w4Az2wEFzi0W3i3H8E h+BNTXBWsk8+MY5oo2jC7B+DMGkqNxJ/VaF2OJyKkSVnFRLGJ920L+zZSrnx+c97+3un pLvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject :content-language:mime-version:user-agent:date:message-id:from:to :delivered-to:arc-authentication-results; bh=Ey3DW6wjvvqgRBbjwNdv880z45iRdfxd9hNh1eTWDL8=; b=SsmRTz5FD/O363EMHMvzA6n7LDNvtpAc20wNmS+ZImVI4M4NphAsraQj1u859jWUvg vbComL60YIMEPd4UAmEneg8Y7pt7qkNeQarWxckppPmQlrF5v2lbuKP2DVXi18ZigZ// X7gXpAACoJmSSk1BlC28ZgvWrTH+lazoIfHzWwGkoDRPC3+L28tXn/hUSRnHgapEYOPP jvCzNMjNV0HeLvZVcUwpiHEqUtAtqAs5+S6RHMWHKh1neijfaU6OqGwDDUanyRykleVq ptRq0oGA3I7KZTE2KQdo1qZyWn2e/MrlaNjSypysFAc0u1FTnQAZa4GousJuVl0R96m2 n72w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id l127si4913072wmd.250.2018.02.20.08.32.57; Tue, 20 Feb 2018 08:32:58 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2A77A68A359; Tue, 20 Feb 2018 18:32:55 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from kazbek.m1stereo.tv (mail.m1stereo.tv [91.244.124.37]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BA545689FAD for ; Tue, 20 Feb 2018 18:32:47 +0200 (EET) Received: from [10.1.5.65] (dev-3.internal.m1stereo.tv [10.1.5.65]) by kazbek.m1stereo.tv (8.14.4/8.14.4) with ESMTP id w1KGWmZN008973 for ; Tue, 20 Feb 2018 18:32:48 +0200 To: ffmpeg-devel@ffmpeg.org From: Maksym Veremeyenko Message-ID: Date: Tue, 20 Feb 2018 18:32:48 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 Content-Language: en-US Subject: [FFmpeg-devel] [PATCH 1/2] Add NewTek NDI headers X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Hi attached patch add a NewTek NDI headers to source tree. these headers is under MIT license. please apply. diff --git a/compat/libndi_newtek/Processing.NDI.DynamicLoad.h b/compat/libndi_newtek/Processing.NDI.DynamicLoad.h new file mode 100644 index 0000000..6ec390b --- /dev/null +++ b/compat/libndi_newtek/Processing.NDI.DynamicLoad.h @@ -0,0 +1,128 @@ +#pragma once + +// NOTE : The following MIT license applies to this file ONLY and not to the SDK as a whole. Please review the SDK documentation +// for the description of the full license terms, which are also provided in the file "NDI License Agreement.pdf" within the SDK or +// online at http://new.tk/ndisdk_license/. Your use of any part of this SDK is acknowledgment that you agree to the SDK license +// terms. THe full NDI SDK may be downloaded at https://www.newtek.com/ndi/sdk/ +// +//*********************************************************************************************************************************************** +// +// Copyright(c) 2014-2017 NewTek, inc +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation +// files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +//*********************************************************************************************************************************************** + +//**************************************************************************************************************** +typedef struct NDIlib_v3 +{ // V1.5 + bool(*NDIlib_initialize)(void); + void(*NDIlib_destroy)(void); + const char* (*NDIlib_version)(void); + bool(*NDIlib_is_supported_CPU)(void); + PROCESSINGNDILIB_DEPRECATED NDIlib_find_instance_t(*NDIlib_find_create)(const NDIlib_find_create_t* p_create_settings); + NDIlib_find_instance_t(*NDIlib_find_create_v2)(const NDIlib_find_create_t* p_create_settings); + void(*NDIlib_find_destroy)(NDIlib_find_instance_t p_instance); + const NDIlib_source_t* (*NDIlib_find_get_sources)(NDIlib_find_instance_t p_instance, uint32_t* p_no_sources, uint32_t timeout_in_ms); + NDIlib_send_instance_t(*NDIlib_send_create)(const NDIlib_send_create_t* p_create_settings); + void(*NDIlib_send_destroy)(NDIlib_send_instance_t p_instance); + PROCESSINGNDILIB_DEPRECATED void(*NDIlib_send_send_video)(NDIlib_send_instance_t p_instance, const NDIlib_video_frame_t* p_video_data); + PROCESSINGNDILIB_DEPRECATED void(*NDIlib_send_send_video_async)(NDIlib_send_instance_t p_instance, const NDIlib_video_frame_t* p_video_data); + PROCESSINGNDILIB_DEPRECATED void(*NDIlib_send_send_audio)(NDIlib_send_instance_t p_instance, const NDIlib_audio_frame_t* p_audio_data); + void(*NDIlib_send_send_metadata)(NDIlib_send_instance_t p_instance, const NDIlib_metadata_frame_t* p_metadata); + NDIlib_frame_type_e(*NDIlib_send_capture)(NDIlib_send_instance_t p_instance, NDIlib_metadata_frame_t* p_metadata, uint32_t timeout_in_ms); + void(*NDIlib_send_free_metadata)(NDIlib_send_instance_t p_instance, const NDIlib_metadata_frame_t* p_metadata); + bool(*NDIlib_send_get_tally)(NDIlib_send_instance_t p_instance, NDIlib_tally_t* p_tally, uint32_t timeout_in_ms); + int(*NDIlib_send_get_no_connections)(NDIlib_send_instance_t p_instance, uint32_t timeout_in_ms); + void(*NDIlib_send_clear_connection_metadata)(NDIlib_send_instance_t p_instance); + void(*NDIlib_send_add_connection_metadata)(NDIlib_send_instance_t p_instance, const NDIlib_metadata_frame_t* p_metadata); + void(*NDIlib_send_set_failover)(NDIlib_send_instance_t p_instance, const NDIlib_source_t* p_failover_source); + PROCESSINGNDILIB_DEPRECATED NDIlib_recv_instance_t(*NDIlib_recv_create_v2)(const NDIlib_recv_create_t* p_create_settings); + PROCESSINGNDILIB_DEPRECATED NDIlib_recv_instance_t(*NDIlib_recv_create)(const NDIlib_recv_create_t* p_create_settings); + void(*NDIlib_recv_destroy)(NDIlib_recv_instance_t p_instance); + PROCESSINGNDILIB_DEPRECATED NDIlib_frame_type_e(*NDIlib_recv_capture)(NDIlib_recv_instance_t p_instance, NDIlib_video_frame_t* p_video_data, NDIlib_audio_frame_t* p_audio_data, NDIlib_metadata_frame_t* p_metadata, uint32_t timeout_in_ms); + PROCESSINGNDILIB_DEPRECATED void(*NDIlib_recv_free_video)(NDIlib_recv_instance_t p_instance, const NDIlib_video_frame_t* p_video_data); + PROCESSINGNDILIB_DEPRECATED void(*NDIlib_recv_free_audio)(NDIlib_recv_instance_t p_instance, const NDIlib_audio_frame_t* p_audio_data); + void(*NDIlib_recv_free_metadata)(NDIlib_recv_instance_t p_instance, const NDIlib_metadata_frame_t* p_metadata); + bool(*NDIlib_recv_send_metadata)(NDIlib_recv_instance_t p_instance, const NDIlib_metadata_frame_t* p_metadata); + bool(*NDIlib_recv_set_tally)(NDIlib_recv_instance_t p_instance, const NDIlib_tally_t* p_tally); + void(*NDIlib_recv_get_performance)(NDIlib_recv_instance_t p_instance, NDIlib_recv_performance_t* p_total, NDIlib_recv_performance_t* p_dropped); + void(*NDIlib_recv_get_queue)(NDIlib_recv_instance_t p_instance, NDIlib_recv_queue_t* p_total); + void(*NDIlib_recv_clear_connection_metadata)(NDIlib_recv_instance_t p_instance); + void(*NDIlib_recv_add_connection_metadata)(NDIlib_recv_instance_t p_instance, const NDIlib_metadata_frame_t* p_metadata); + int(*NDIlib_recv_get_no_connections)(NDIlib_recv_instance_t p_instance); + NDIlib_routing_instance_t(*NDIlib_routing_create)(const NDIlib_routing_create_t* p_create_settings); + void(*NDIlib_routing_destroy)(NDIlib_routing_instance_t p_instance); + bool(*NDIlib_routing_change)(NDIlib_routing_instance_t p_instance, const NDIlib_source_t* p_source); + bool(*NDIlib_routing_clear)(NDIlib_routing_instance_t p_instance); + void(*NDIlib_util_send_send_audio_interleaved_16s)(NDIlib_send_instance_t p_instance, const NDIlib_audio_frame_interleaved_16s_t* p_audio_data); + PROCESSINGNDILIB_DEPRECATED void(*NDIlib_util_audio_to_interleaved_16s)(const NDIlib_audio_frame_t* p_src, NDIlib_audio_frame_interleaved_16s_t* p_dst); + PROCESSINGNDILIB_DEPRECATED void(*NDIlib_util_audio_from_interleaved_16s)(const NDIlib_audio_frame_interleaved_16s_t* p_src, NDIlib_audio_frame_t* p_dst); + // V2 + bool(*NDIlib_find_wait_for_sources)(NDIlib_find_instance_t p_instance, uint32_t timeout_in_ms); + const NDIlib_source_t* (*NDIlib_find_get_current_sources)(NDIlib_find_instance_t p_instance, uint32_t* p_no_sources); + PROCESSINGNDILIB_DEPRECATED void(*NDIlib_util_audio_to_interleaved_32f)(const NDIlib_audio_frame_t* p_src, NDIlib_audio_frame_interleaved_32f_t* p_dst); + PROCESSINGNDILIB_DEPRECATED void(*NDIlib_util_audio_from_interleaved_32f)(const NDIlib_audio_frame_interleaved_32f_t* p_src, NDIlib_audio_frame_t* p_dst); + void(*NDIlib_util_send_send_audio_interleaved_32f)(NDIlib_send_instance_t p_instance, const NDIlib_audio_frame_interleaved_32f_t* p_audio_data); + // V3 + void(*NDIlib_recv_free_video_v2)(NDIlib_recv_instance_t p_instance, const NDIlib_video_frame_v2_t* p_video_data); + void(*NDIlib_recv_free_audio_v2)(NDIlib_recv_instance_t p_instance, const NDIlib_audio_frame_v2_t* p_audio_data); + NDIlib_frame_type_e(*NDIlib_recv_capture_v2)(NDIlib_recv_instance_t p_instance, NDIlib_video_frame_v2_t* p_video_data, NDIlib_audio_frame_v2_t* p_audio_data, NDIlib_metadata_frame_t* p_metadata, uint32_t timeout_in_ms); // The amount of time in milliseconds to wait for data. + void(*NDIlib_send_send_video_v2)(NDIlib_send_instance_t p_instance, const NDIlib_video_frame_v2_t* p_video_data); + void(*NDIlib_send_send_video_async_v2)(NDIlib_send_instance_t p_instance, const NDIlib_video_frame_v2_t* p_video_data); + void(*NDIlib_send_send_audio_v2)(NDIlib_send_instance_t p_instance, const NDIlib_audio_frame_v2_t* p_audio_data); + void(*NDIlib_util_audio_to_interleaved_16s_v2)(const NDIlib_audio_frame_v2_t* p_src, NDIlib_audio_frame_interleaved_16s_t* p_dst); + void(*NDIlib_util_audio_from_interleaved_16s_v2)(const NDIlib_audio_frame_interleaved_16s_t* p_src, NDIlib_audio_frame_v2_t* p_dst); + void(*NDIlib_util_audio_to_interleaved_32f_v2)(const NDIlib_audio_frame_v2_t* p_src, NDIlib_audio_frame_interleaved_32f_t* p_dst); + void(*NDIlib_util_audio_from_interleaved_32f_v2)(const NDIlib_audio_frame_interleaved_32f_t* p_src, NDIlib_audio_frame_v2_t* p_dst); + // V3.01 + void(*NDIlib_recv_free_string)(NDIlib_recv_instance_t p_instance, const char* p_string); + bool(*NDIlib_recv_ptz_is_supported)(NDIlib_recv_instance_t p_instance); + bool(*NDIlib_recv_recording_is_supported)(NDIlib_recv_instance_t p_instance); + const char*(*NDIlib_recv_get_web_control)(NDIlib_recv_instance_t p_instance); + bool(*NDIlib_recv_ptz_zoom)(NDIlib_recv_instance_t p_instance, const float zoom_value); + bool(*NDIlib_recv_ptz_zoom_speed)(NDIlib_recv_instance_t p_instance, const float zoom_speed); + bool(*NDIlib_recv_ptz_pan_tilt)(NDIlib_recv_instance_t p_instance, const float pan_value, const float tilt_value); + bool(*NDIlib_recv_ptz_pan_tilt_speed)(NDIlib_recv_instance_t p_instance, const float pan_speed, const float tilt_speed); + bool(*NDIlib_recv_ptz_store_preset)(NDIlib_recv_instance_t p_instance, const int preset_no); + bool(*NDIlib_recv_ptz_recall_preset)(NDIlib_recv_instance_t p_instance, const int preset_no, const float speed); + bool(*NDIlib_recv_ptz_auto_focus)(NDIlib_recv_instance_t p_instance); + bool(*NDIlib_recv_ptz_focus)(NDIlib_recv_instance_t p_instance, const float focus_value); + bool(*NDIlib_recv_ptz_focus_speed)(NDIlib_recv_instance_t p_instance, const float focus_speed); + bool(*NDIlib_recv_ptz_white_balance_auto)(NDIlib_recv_instance_t p_instance); + bool(*NDIlib_recv_ptz_white_balance_indoor)(NDIlib_recv_instance_t p_instance); + bool(*NDIlib_recv_ptz_white_balance_outdoor)(NDIlib_recv_instance_t p_instance); + bool(*NDIlib_recv_ptz_white_balance_oneshot)(NDIlib_recv_instance_t p_instance); + bool(*NDIlib_recv_ptz_white_balance_manual)(NDIlib_recv_instance_t p_instance, const float red, const float blue); + bool(*NDIlib_recv_ptz_exposure_auto)(NDIlib_recv_instance_t p_instance); + bool(*NDIlib_recv_ptz_exposure_manual)(NDIlib_recv_instance_t p_instance, const float exposure_level); + bool(*NDIlib_recv_recording_start)(NDIlib_recv_instance_t p_instance, const char* p_filename_hint); + bool(*NDIlib_recv_recording_stop)(NDIlib_recv_instance_t p_instance); + bool(*NDIlib_recv_recording_set_audio_level)(NDIlib_recv_instance_t p_instance, const float level_dB); + bool(*NDIlib_recv_recording_is_recording)(NDIlib_recv_instance_t p_instance); + const char*(*NDIlib_recv_recording_get_filename)(NDIlib_recv_instance_t p_instance); + const char*(*NDIlib_recv_recording_get_error)(NDIlib_recv_instance_t p_instance); + bool(*NDIlib_recv_recording_get_times)(NDIlib_recv_instance_t p_instance, NDIlib_recv_recording_time_t* p_times); + // V3.10 + NDIlib_recv_instance_t(*NDIlib_recv_create_v3)(const NDIlib_recv_create_v3_t* p_create_settings); + +} NDIlib_v3; + +typedef struct NDIlib_v3 NDIlib_v2; + +// Load the library +PROCESSINGNDILIB_API +const NDIlib_v3* NDIlib_v3_load(void); + +PROCESSINGNDILIB_API PROCESSINGNDILIB_DEPRECATED +const NDIlib_v2* NDIlib_v2_load(void); \ No newline at end of file diff --git a/compat/libndi_newtek/Processing.NDI.Find.h b/compat/libndi_newtek/Processing.NDI.Find.h new file mode 100644 index 0000000..628fa75 --- /dev/null +++ b/compat/libndi_newtek/Processing.NDI.Find.h @@ -0,0 +1,74 @@ +#pragma once + +// NOTE : The following MIT license applies to this file ONLY and not to the SDK as a whole. Please review the SDK documentation +// for the description of the full license terms, which are also provided in the file "NDI License Agreement.pdf" within the SDK or +// online at http://new.tk/ndisdk_license/. Your use of any part of this SDK is acknowledgment that you agree to the SDK license +// terms. THe full NDI SDK may be downloaded at https://www.newtek.com/ndi/sdk/ +// +//*********************************************************************************************************************************************** +// +// Copyright(c) 2014-2017 NewTek, inc +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation +// files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +//*********************************************************************************************************************************************** + +//************************************************************************************************************************** +// Structures and type definitions required by NDI finding +// The reference to an instance of the finder +typedef void* NDIlib_find_instance_t; + +// The creation structure that is used when you are creating a finder +typedef struct NDIlib_find_create_t +{ // Do we want to incluide the list of NDI sources that are running + // on the local machine ? + // If TRUE then local sources will be visible, if FALSE then they + // will not. + bool show_local_sources; + + // Which groups do you want to search in for sources + const char* p_groups; + + // The list of additional IP addresses that exist that we should query for + // sources on. For instance, if you want to find the sources on a remote machine + // that is not on your local sub-net then you can put a comma seperated list of + // those IP addresses here and those sources will be available locally even though + // they are not mDNS discoverable. An example might be "12.0.0.8,13.0.12.8". + // When none is specified the registry is used. + // Default = NULL; + const char* p_extra_ips; + +#if NDILIB_CPP_DEFAULT_CONSTRUCTORS + NDIlib_find_create_t(bool show_local_sources_ = true, const char* p_groups_ = NULL, const char* p_extra_ips_ = NULL); +#endif // NDILIB_CPP_DEFAULT_CONSTRUCTORS + +} NDIlib_find_create_t; + +//************************************************************************************************************************** +// Create a new finder instance. This will return NULL if it fails. +// This function is deprecated, please use NDIlib_find_create_v2 if you can. This function +// ignores the p_extra_ips member and sets it to the default. +PROCESSINGNDILIB_API +NDIlib_find_instance_t NDIlib_find_create_v2(const NDIlib_find_create_t* p_create_settings); + +// This will destroy an existing finder instance. +PROCESSINGNDILIB_API +void NDIlib_find_destroy(NDIlib_find_instance_t p_instance); + +// This function will recover the current set of sources (i.e. the ones that exist right this second). +PROCESSINGNDILIB_API +const NDIlib_source_t* NDIlib_find_get_current_sources(NDIlib_find_instance_t p_instance, uint32_t* p_no_sources); + +// This will allow you to wait until the number of online sources have changed. +PROCESSINGNDILIB_API +bool NDIlib_find_wait_for_sources(NDIlib_find_instance_t p_instance, uint32_t timeout_in_ms); diff --git a/compat/libndi_newtek/Processing.NDI.Lib.cplusplus.h b/compat/libndi_newtek/Processing.NDI.Lib.cplusplus.h new file mode 100644 index 0000000..a1a381f --- /dev/null +++ b/compat/libndi_newtek/Processing.NDI.Lib.cplusplus.h @@ -0,0 +1,94 @@ +#pragma once + +// NOTE : The following MIT license applies to this file ONLY and not to the SDK as a whole. Please review the SDK documentation +// for the description of the full license terms, which are also provided in the file "NDI License Agreement.pdf" within the SDK or +// online at http://new.tk/ndisdk_license/. Your use of any part of this SDK is acknowledgment that you agree to the SDK license +// terms. THe full NDI SDK may be downloaded at https://www.newtek.com/ndi/sdk/ +// +//*********************************************************************************************************************************************** +// +// Copyright(c) 2014-2017 NewTek, inc +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation +// files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +//*********************************************************************************************************************************************** + + +// C++ implemenrations of default constructors are here to avoid them needing to be inline with +// all of the rest of the code. + +// All the structs used and reasonable defaults are here +inline NDIlib_source_t::NDIlib_source_t(const char* p_ndi_name_, const char* p_ip_address_) + : p_ndi_name(p_ndi_name_), p_ip_address(p_ip_address_) {} + +inline NDIlib_video_frame_v2_t::NDIlib_video_frame_v2_t(int xres_, int yres_, NDIlib_FourCC_type_e FourCC_, int frame_rate_N_, int frame_rate_D_, + float picture_aspect_ratio_, NDIlib_frame_format_type_e frame_format_type_, + int64_t timecode_, uint8_t* p_data_, int line_stride_in_bytes_, const char* p_metadata_, int64_t timestamp_) + : xres(xres_), yres(yres_), FourCC(FourCC_), frame_rate_N(frame_rate_N_), frame_rate_D(frame_rate_D_), + picture_aspect_ratio(picture_aspect_ratio_), frame_format_type(frame_format_type_), + timecode(timecode_), p_data(p_data_), line_stride_in_bytes(line_stride_in_bytes_), p_metadata(p_metadata_), timestamp(timestamp_) {} + +inline NDIlib_audio_frame_v2_t::NDIlib_audio_frame_v2_t(int sample_rate_, int no_channels_, int no_samples_, int64_t timecode_, float* p_data_, + int channel_stride_in_bytes_, const char* p_metadata_, int64_t timestamp_) + : sample_rate(sample_rate_), no_channels(no_channels_), no_samples(no_samples_), timecode(timecode_), + p_data(p_data_), channel_stride_in_bytes(channel_stride_in_bytes_), p_metadata(p_metadata_), timestamp(timestamp_) {} + +inline NDIlib_video_frame_t::NDIlib_video_frame_t(int xres_, int yres_, NDIlib_FourCC_type_e FourCC_, int frame_rate_N_, int frame_rate_D_, + float picture_aspect_ratio_, NDIlib_frame_format_type_e frame_format_type_, + int64_t timecode_, uint8_t* p_data_, int line_stride_in_bytes_) + : xres(xres_), yres(yres_), FourCC(FourCC_), frame_rate_N(frame_rate_N_), frame_rate_D(frame_rate_D_), + picture_aspect_ratio(picture_aspect_ratio_), frame_format_type(frame_format_type_), + timecode(timecode_), p_data(p_data_), line_stride_in_bytes(line_stride_in_bytes_) {} + +inline NDIlib_audio_frame_t::NDIlib_audio_frame_t(int sample_rate_, int no_channels_, int no_samples_, int64_t timecode_, float* p_data_, + int channel_stride_in_bytes_) + : sample_rate(sample_rate_), no_channels(no_channels_), no_samples(no_samples_), timecode(timecode_), + p_data(p_data_), channel_stride_in_bytes(channel_stride_in_bytes_) {} + +inline NDIlib_metadata_frame_t::NDIlib_metadata_frame_t(int length_, int64_t timecode_, char* p_data_) + : length(length_), timecode(timecode_), p_data(p_data_) {} + +inline NDIlib_tally_t::NDIlib_tally_t(bool on_program_, bool on_preview_) + : on_program(on_program_), on_preview(on_preview_) {} + +inline NDIlib_routing_create_t::NDIlib_routing_create_t(const char* p_ndi_name_, const char* p_groups_) + : p_ndi_name(p_ndi_name_), p_groups(p_groups_) {} + +inline NDIlib_recv_create_v3_t::NDIlib_recv_create_v3_t(const NDIlib_source_t source_to_connect_to_, NDIlib_recv_color_format_e color_format_, + NDIlib_recv_bandwidth_e bandwidth_, bool allow_video_fields_, const char* p_ndi_name_) + : source_to_connect_to(source_to_connect_to_), color_format(color_format_), bandwidth(bandwidth_), allow_video_fields(allow_video_fields_), p_ndi_name(p_ndi_name_) {} +inline NDIlib_recv_create_t::NDIlib_recv_create_t(const NDIlib_source_t source_to_connect_to_, NDIlib_recv_color_format_e color_format_, + NDIlib_recv_bandwidth_e bandwidth_, bool allow_video_fields_) + : source_to_connect_to(source_to_connect_to_), color_format(color_format_), bandwidth(bandwidth_), allow_video_fields(allow_video_fields_) {} + +inline NDIlib_recv_performance_t::NDIlib_recv_performance_t(void) + : video_frames(0), audio_frames(0), metadata_frames(0) {} + +inline NDIlib_recv_queue_t::NDIlib_recv_queue_t(void) + : video_frames(0), audio_frames(0), metadata_frames(0) {} + +inline NDIlib_recv_recording_time_t::NDIlib_recv_recording_time_t(void) + : no_frames(0), start_time(0), last_time(0) {} + +inline NDIlib_send_create_t::NDIlib_send_create_t(const char* p_ndi_name_, const char* p_groups_, bool clock_video_, bool clock_audio_) + : p_ndi_name(p_ndi_name_), p_groups(p_groups_), clock_video(clock_video_), clock_audio(clock_audio_) {} + +inline NDIlib_find_create_t::NDIlib_find_create_t(bool show_local_sources_, const char* p_groups_, const char* p_extra_ips_) + : show_local_sources(show_local_sources_), p_groups(p_groups_), p_extra_ips(p_extra_ips_) {} + +inline NDIlib_audio_frame_interleaved_16s_t::NDIlib_audio_frame_interleaved_16s_t(int sample_rate_, int no_channels_, int no_samples_, int64_t timecode_, int reference_level_, short* p_data_) + : sample_rate(sample_rate_), no_channels(no_channels_), no_samples(no_samples_), timecode(timecode_), + reference_level(reference_level_), p_data(p_data_) {} + +inline NDIlib_audio_frame_interleaved_32f_t::NDIlib_audio_frame_interleaved_32f_t(int sample_rate_, int no_channels_, int no_samples_, int64_t timecode_, float* p_data_) + : sample_rate(sample_rate_), no_channels(no_channels_), no_samples(no_samples_), timecode(timecode_), p_data(p_data_) {} \ No newline at end of file diff --git a/compat/libndi_newtek/Processing.NDI.Lib.h b/compat/libndi_newtek/Processing.NDI.Lib.h new file mode 100644 index 0000000..1af592e --- /dev/null +++ b/compat/libndi_newtek/Processing.NDI.Lib.h @@ -0,0 +1,129 @@ +#pragma once + +// NOTE : The following MIT license applies to this file ONLY and not to the SDK as a whole. Please review the SDK documentation +// for the description of the full license terms, which are also provided in the file "NDI License Agreement.pdf" within the SDK or +// online at http://new.tk/ndisdk_license/. Your use of any part of this SDK is acknowledgment that you agree to the SDK license +// terms. THe full NDI SDK may be downloaded at https://www.newtek.com/ndi/sdk/ +// +//*********************************************************************************************************************************************** +// +// Copyright(c) 2014-2017 NewTek, inc +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation +// files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +//*********************************************************************************************************************************************** + +// Is this library being compiled, or imported by another application. +#ifdef _WIN32 +#define PROCESSINGNDILIB_DEPRECATED __declspec(deprecated) +#ifdef PROCESSINGNDILIB_EXPORTS +#ifdef __cplusplus +#define PROCESSINGNDILIB_API extern "C" __declspec(dllexport) +#else +#define PROCESSINGNDILIB_API __declspec(dllexport) +#endif +#else +#ifdef __cplusplus +#define PROCESSINGNDILIB_API extern "C" __declspec(dllimport) +#else +#define PROCESSINGNDILIB_API __declspec(dllimport) +#endif +#ifdef _MSC_VER +#ifdef _WIN64 +#define NDILIB_LIBRARY_NAME "Processing.NDI.Lib.x64.dll" +#define NDILIB_REDIST_FOLDER "NDI_RUNTIME_DIR_V3" +#define NDILIB_REDIST_URL "http://new.tk/NDIRedistV3" +#else +#define NDILIB_LIBRARY_NAME "Processing.NDI.Lib.x86.dll" +#define NDILIB_REDIST_FOLDER "NDI_RUNTIME_DIR_V3" +#define NDILIB_REDIST_URL "http://new.tk/NDIRedistV3" +#endif +#endif +#endif +#else +#ifdef __APPLE__ +#define NDILIB_LIBRARY_NAME "libndi.3.dylib" +#define NDILIB_REDIST_FOLDER "NDI_RUNTIME_DIR_V3" +#define NDILIB_REDIST_URL "http://new.tk/NDIRedistV3Apple" +#else // __APPLE__ +#define NDILIB_LIBRARY_NAME "libndi.so.3" +#define NDILIB_REDIST_FOLDER "NDI_RUNTIME_DIR_V3" +#define NDILIB_REDIST_URL "" +#endif // __APPLE__ +#define PROCESSINGNDILIB_DEPRECATED +#ifdef __cplusplus +#define PROCESSINGNDILIB_API extern "C" __attribute((visibility("default"))) +#else +#define PROCESSINGNDILIB_API __attribute((visibility("default"))) +#endif +#endif + +#ifndef NDILIB_CPP_DEFAULT_CONSTRUCTORS +#ifdef __cplusplus +#define NDILIB_CPP_DEFAULT_CONSTRUCTORS 1 +#else // __cplusplus +#define NDILIB_CPP_DEFAULT_CONSTRUCTORS 0 +#endif // __cplusplus +#endif // NDILIB_CPP_DEFAULT_CONSTRUCTORS + +// Data structures shared by multiple SDKs +#include "Processing.NDI.compat.h" +#include "Processing.NDI.structs.h" + +// This is not actually required, but will start and end the libraries which might get +// you slightly better performance in some cases. In general it is more "correct" to +// call these although it is not required. There is no way to call these that would have +// an adverse impact on anything (even calling destroy before you've deleted all your +// objects). This will return false if the CPU is not sufficiently capable to run NDILib +// currently NDILib requires SSE4.2 instructions (see documentation). You can verify +// a specific CPU against the library with a call to NDIlib_is_supported_CPU() +PROCESSINGNDILIB_API +bool NDIlib_initialize(void); + +PROCESSINGNDILIB_API +void NDIlib_destroy(void); + +PROCESSINGNDILIB_API +const char* NDIlib_version(void); + +// Recover whether the current CPU in the system is capable of running NDILib. +PROCESSINGNDILIB_API +bool NDIlib_is_supported_CPU(void); + +// The finding (discovery API) +#include "Processing.NDI.Find.h" + +// The receiveing video and audio API +#include "Processing.NDI.Recv.h" +// Extensions to support PTZ control, etc... +#include "Processing.NDI.Recv.ex.h" + +// The sending video API +#include "Processing.NDI.Send.h" + +// The routing of inputs API +#include "Processing.NDI.Routing.h" + +// Utility functions +#include "Processing.NDI.utilities.h" + +// Deprecated structures and functions +#include "Processing.NDI.deprecated.h" + +// Dynamic loading used for OSS libraries +#include "Processing.NDI.DynamicLoad.h" + +// The C++ implemenrations +#if NDILIB_CPP_DEFAULT_CONSTRUCTORS +#include "Processing.NDI.Lib.cplusplus.h" +#endif // NDILIB_CPP_DEFAULT_CONSTRUCTORS \ No newline at end of file diff --git a/compat/libndi_newtek/Processing.NDI.Recv.ex.h b/compat/libndi_newtek/Processing.NDI.Recv.ex.h new file mode 100644 index 0000000..00317dd --- /dev/null +++ b/compat/libndi_newtek/Processing.NDI.Recv.ex.h @@ -0,0 +1,148 @@ +#pragma once + +//************************************************************************************************************************************************************** +// Has this receiver got PTZ control. Note that it might take a second or two after the connection for this value to be set. +// To avoid the need to poll this function, you can know when the value of this function might have changed when the +// NDILib_recv_capture* call would return NDIlib_frame_type_status_change +PROCESSINGNDILIB_API +bool NDIlib_recv_ptz_is_supported(NDIlib_recv_instance_t p_instance); + +// Has this receiver got recording control. Note that it might take a second or two after the connection for this value to be set. +// To avoid the need to poll this function, you can know when the value of this function might have changed when the +// NDILib_recv_capture* call would return NDIlib_frame_type_status_change +PROCESSINGNDILIB_API +bool NDIlib_recv_recording_is_supported(NDIlib_recv_instance_t p_instance); + +//************************************************************************************************************************************************************** +// PTZ Controls +// Zoom to an absolute value. +// zoom_value = 0.0 (zoomed in) ... 1.0 (zoomed out) +PROCESSINGNDILIB_API +bool NDIlib_recv_ptz_zoom(NDIlib_recv_instance_t p_instance, const float zoom_value); + +// Zoom at a particular speed +// zoom_speed = -1.0 (zoom outwards) ... +1.0 (zoom inwards) +PROCESSINGNDILIB_API +bool NDIlib_recv_ptz_zoom_speed(NDIlib_recv_instance_t p_instance, const float zoom_speed); + +// Set the pan and tilt to an absolute value +// pan_value = -1.0 (left) ... 0.0 (centred) ... +1.0 (right) +// tilt_value = -1.0 (bottom) ... 0.0 (centred) ... +1.0 (top) +PROCESSINGNDILIB_API +bool NDIlib_recv_ptz_pan_tilt(NDIlib_recv_instance_t p_instance, const float pan_value, const float tilt_value); + +// Set the pan and tilt direction and speed +// pan_speed = -1.0 (moving left) ... 0.0 (stopped) ... +1.0 (moving right) +// tilt_speed = -1.0 (down) ... 0.0 (stopped) ... +1.0 (moving up) +PROCESSINGNDILIB_API +bool NDIlib_recv_ptz_pan_tilt_speed(NDIlib_recv_instance_t p_instance, const float pan_speed, const float tilt_speed); + +// Store the current position, focus, etc... as a preset. +// preset_no = 0 ... 99 +PROCESSINGNDILIB_API +bool NDIlib_recv_ptz_store_preset(NDIlib_recv_instance_t p_instance, const int preset_no); + +// Recall a preset, including position, focus, etc... +// preset_no = 0 ... 99 +// speed = 0.0(as slow as possible) ... 1.0(as fast as possible) The speed at which to move to the new preset +PROCESSINGNDILIB_API +bool NDIlib_recv_ptz_recall_preset(NDIlib_recv_instance_t p_instance, const int preset_no, const float speed); + +// Put the camera in auto-focus +PROCESSINGNDILIB_API +bool NDIlib_recv_ptz_auto_focus(NDIlib_recv_instance_t p_instance); + +// Focus to an absolute value. +// focus_value = 0.0 (focussed to infinity) ... 1.0 (focussed as close as possible) +PROCESSINGNDILIB_API +bool NDIlib_recv_ptz_focus(NDIlib_recv_instance_t p_instance, const float focus_value); + +// Focus at a particular speed +// focus_speed = -1.0 (focus outwards) ... +1.0 (focus inwards) +PROCESSINGNDILIB_API +bool NDIlib_recv_ptz_focus_speed(NDIlib_recv_instance_t p_instance, const float focus_speed); + +// Put the camera in auto white balance moce +PROCESSINGNDILIB_API +bool NDIlib_recv_ptz_white_balance_auto(NDIlib_recv_instance_t p_instance); + +// Put the camera in indoor white balance +PROCESSINGNDILIB_API +bool NDIlib_recv_ptz_white_balance_indoor(NDIlib_recv_instance_t p_instance); + +// Put the camera in indoor white balance +PROCESSINGNDILIB_API +bool NDIlib_recv_ptz_white_balance_outdoor(NDIlib_recv_instance_t p_instance); + +// Use the current brightness to automatically set the current white balance +PROCESSINGNDILIB_API +bool NDIlib_recv_ptz_white_balance_oneshot(NDIlib_recv_instance_t p_instance); + +// Set the manual camera white balance using the R, B values +// red = 0.0(not red) ... 1.0(very red) +// blue = 0.0(not blue) ... 1.0(very blue) +PROCESSINGNDILIB_API +bool NDIlib_recv_ptz_white_balance_manual(NDIlib_recv_instance_t p_instance, const float red, const float blue); + +// Put the camera in auto-exposure mode +PROCESSINGNDILIB_API +bool NDIlib_recv_ptz_exposure_auto(NDIlib_recv_instance_t p_instance); + +// Manually set the camera exposure +// exposure_level = 0.0(dark) ... 1.0(light) +PROCESSINGNDILIB_API +bool NDIlib_recv_ptz_exposure_manual(NDIlib_recv_instance_t p_instance, const float exposure_level); + +//************************************************************************************************************************************************************** +// Recording control +// This will start recording.If the recorder was already recording then the message is ignored.A filename is passed in as a ‘hint’.Since the recorder might +// already be recording(or might not allow complete flexibility over its filename), the filename might or might not be used.If the filename is empty, or +// not present, a name will be chosen automatically. If you do not with to provide a filename hint you can simply pass NULL. +PROCESSINGNDILIB_API +bool NDIlib_recv_recording_start(NDIlib_recv_instance_t p_instance, const char* p_filename_hint); + +// Stop recording. +PROCESSINGNDILIB_API +bool NDIlib_recv_recording_stop(NDIlib_recv_instance_t p_instance); + +// This will control the audio level for the recording.dB is specified in decibels relative to the reference level of the source. Not all recording sources support +// controlling audio levels.For instance, a digital audio device would not be able to avoid clipping on sources already at the wrong level, thus +// might not support this message. +PROCESSINGNDILIB_API +bool NDIlib_recv_recording_set_audio_level(NDIlib_recv_instance_t p_instance, const float level_dB); + +// This will determine if the source is currently recording. It will return true while recording is in progress and false when it is not. Because there is +// one recorded and multiple people might be connected to it, there is a chance that it is recording which was initiated by someone else. +PROCESSINGNDILIB_API +bool NDIlib_recv_recording_is_recording(NDIlib_recv_instance_t p_instance); + +// Get the current filename for recording. When this is set it will return a non-NULL value which is owned by you and freed using NDIlib_recv_free_string. +// If a file was already being recorded by another client, the massage will contain the name of that file. The filename contains a UNC path (when one is available) +// to the recorded file, and can be used to access the file on your local machine for playback. If a UNC path is not available, then this will represent the local +// filename. This will remain valid even after the file has stopped being recorded until the next file is started. +PROCESSINGNDILIB_API +const char* NDIlib_recv_recording_get_filename(NDIlib_recv_instance_t p_instance); + +// This will tell you whether there was a recording error and what that string is. When this is set it will return a non-NULL value which is owned by you and +// freed using NDIlib_recv_free_string. When there is no error it will return NULL. +PROCESSINGNDILIB_API +const char* NDIlib_recv_recording_get_error(NDIlib_recv_instance_t p_instance); + +// In order to get the duration +typedef struct NDIlib_recv_recording_time_t +{ // The number of actual video frames recorded. + int64_t no_frames; + + // The starting time and current largest time of the record, in UTC time, at 100ns unit intervals. This allows you to know the record + // time irrespective of frame-rate. For instance, last_time - start_time woudl give you the recording length in 100ns intervals. + int64_t start_time, last_time; + +#if NDILIB_CPP_DEFAULT_CONSTRUCTORS + NDIlib_recv_recording_time_t(void); +#endif // NDILIB_CPP_DEFAULT_CONSTRUCTORS + +} NDIlib_recv_recording_time_t; + +// Get the current recording times. These remain +PROCESSINGNDILIB_API +bool NDIlib_recv_recording_get_times(NDIlib_recv_instance_t p_instance, NDIlib_recv_recording_time_t* p_times); \ No newline at end of file diff --git a/compat/libndi_newtek/Processing.NDI.Recv.h b/compat/libndi_newtek/Processing.NDI.Recv.h new file mode 100644 index 0000000..db9f510 --- /dev/null +++ b/compat/libndi_newtek/Processing.NDI.Recv.h @@ -0,0 +1,214 @@ +#pragma once + +// NOTE : The following MIT license applies to this file ONLY and not to the SDK as a whole. Please review the SDK documentation +// for the description of the full license terms, which are also provided in the file "NDI License Agreement.pdf" within the SDK or +// online at http://new.tk/ndisdk_license/. Your use of any part of this SDK is acknowledgment that you agree to the SDK license +// terms. THe full NDI SDK may be downloaded at https://www.newtek.com/ndi/sdk/ +// +//*********************************************************************************************************************************************** +// +// Copyright(c) 2014-2017 NewTek, inc +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation +// files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +//*********************************************************************************************************************************************** + +//************************************************************************************************************************** +// 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 +{ + NDIlib_recv_bandwidth_metadata_only = -10, // Receive metadata. + NDIlib_recv_bandwidth_audio_only = 10, // Receive metadata, audio. + 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. + +} NDIlib_recv_bandwidth_e; + +typedef enum NDIlib_recv_color_format_e +{ + NDIlib_recv_color_format_BGRX_BGRA = 0, // No alpha channel: BGRX, Alpha channel: BGRA + NDIlib_recv_color_format_UYVY_BGRA = 1, // No alpha channel: UYVY, Alpha channel: BGRA + NDIlib_recv_color_format_RGBX_RGBA = 2, // No alpha channel: RGBX, Alpha channel: RGBA + NDIlib_recv_color_format_UYVY_RGBA = 3, // No alpha channel: UYVY, Alpha channel: RGBA + +#ifdef _WIN32 + // On Windows there are some APIs that require bottom to top images in RGBA format. Specifying + // this format will return images in this format. The image data pointer will still point to the + // "top" of the image, althought he stride will be negative. You can get the "bottom" line of the image + // using : video_data.p_data + (video_data.yres - 1)*video_data.line_stride_in_bytes + NDIlib_recv_color_format_BGRX_BGRA_flipped = 200, +#endif + + // Read the SDK documentation to understand the pros and cons of this format. + NDIlib_recv_color_format_fastest = 100, + + // Legacy definitions for backwards compatability + 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, + NDIlib_recv_color_format_e_UYVY_RGBA = NDIlib_recv_color_format_UYVY_RGBA + +} NDIlib_recv_color_format_e; + +// 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; + + // Your preference of color space. See above. + NDIlib_recv_color_format_e color_format; + + // The bandwidth setting that you wish to use for this video source. Bandwidth + // controlled by changing both the compression level and the resolution of the source. + // A good use for low bandwidth is working on WIFI connections. + NDIlib_recv_bandwidth_e bandwidth; + + // When this flag is FALSE, all video that you receive will be progressive. For sources + // that provide fields, this is de-interlaced on the receiving side (because we cannot change + // what the up-stream source was actually rendering. This is provided as a convenience to + // down-stream sources that do not wish to understand fielded video. There is almost no + // performance impact of using this function. + bool allow_video_fields; + + // The name of the NDI receiver to create. This is a NULL terminated UTF8 string and should be + // the name of receive channel that you have. This is in many ways symettric with the name of + // senders, so this might be "Channel 1" on your system. + const char* p_ndi_name; + +#if NDILIB_CPP_DEFAULT_CONSTRUCTORS + NDIlib_recv_create_v3_t(const NDIlib_source_t source_to_connect_to_ = NDIlib_source_t(), NDIlib_recv_color_format_e color_format_ = NDIlib_recv_color_format_UYVY_BGRA, + NDIlib_recv_bandwidth_e bandwidth_ = NDIlib_recv_bandwidth_highest, bool allow_video_fields_ = true, const char* p_ndi_name_ = NULL); +#endif // NDILIB_CPP_DEFAULT_CONSTRUCTORS + +} 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 + int64_t video_frames; + + // The number of audio frames + int64_t audio_frames; + + // The number of metadata frames + int64_t metadata_frames; + +#if NDILIB_CPP_DEFAULT_CONSTRUCTORS + NDIlib_recv_performance_t(void); +#endif // NDILIB_CPP_DEFAULT_CONSTRUCTORS + +} NDIlib_recv_performance_t; + +// Get the current queue depths +typedef struct NDIlib_recv_queue_t +{ // The number of video frames + int video_frames; + + // The number of audio frames + int audio_frames; + + // The number of metadata frames + int metadata_frames; + +#if NDILIB_CPP_DEFAULT_CONSTRUCTORS + NDIlib_recv_queue_t(void); +#endif // NDILIB_CPP_DEFAULT_CONSTRUCTORS + +} NDIlib_recv_queue_t; + +//************************************************************************************************************************** +// Create a new receiver instance. This will return NULL if it fails. +PROCESSINGNDILIB_API +NDIlib_recv_instance_t NDIlib_recv_create_v3(const NDIlib_recv_create_v3_t* p_create_settings); + +// This will destroy an existing receiver instance. +PROCESSINGNDILIB_API +void NDIlib_recv_destroy(NDIlib_recv_instance_t p_instance); + +// This will allow you to receive video, audio and metadata frames. +// Any of the buffers can be NULL, in which case data of that type +// will not be captured in this call. This call can be called simultaneously +// on separate threads, so it is entirely possible to receive audio, video, metadata +// all on separate threads. This function will return NDIlib_frame_type_none if no +// data is received within the specified timeout and NDIlib_frame_type_error if the connection is lost. +// Buffers captured with this must be freed with the 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) + uint32_t timeout_in_ms); // The amount of time in milliseconds to wait for data. + +// 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 +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 metadata +PROCESSINGNDILIB_API +void NDIlib_recv_free_metadata(NDIlib_recv_instance_t p_instance, const NDIlib_metadata_frame_t* p_metadata); + +// This will free a string that was allocated and returned by NDIlib_recv (for instance the NDIlib_recv_get_web_control) function. +PROCESSINGNDILIB_API +void NDIlib_recv_free_string(NDIlib_recv_instance_t p_instance, const char* p_string); + +// This function will send a meta message to the source that we are connected too. This returns FALSE if we are +// not currently connected to anything. +PROCESSINGNDILIB_API +bool NDIlib_recv_send_metadata(NDIlib_recv_instance_t p_instance, const NDIlib_metadata_frame_t* p_metadata); + +// Set the up-stream tally notifications. This returns FALSE if we are not currently connected to anything. That +// said, the moment that we do connect to something it will automatically be sent the tally state. +PROCESSINGNDILIB_API +bool NDIlib_recv_set_tally(NDIlib_recv_instance_t p_instance, const NDIlib_tally_t* p_tally); + +// Get the current performance structures. This can be used to determine if you have been calling NDIlib_recv_capture fast +// enough, or if your processing of data is not keeping up with real-time. The total structure will give you the total frame +// counts received, the dropped structure will tell you how many frames have been dropped. Either of these could be NULL. +PROCESSINGNDILIB_API +void NDIlib_recv_get_performance(NDIlib_recv_instance_t p_instance, NDIlib_recv_performance_t* p_total, NDIlib_recv_performance_t* p_dropped); + +// This will allow you to determine the current queue depth for all of the frame sources at any time. +PROCESSINGNDILIB_API +void NDIlib_recv_get_queue(NDIlib_recv_instance_t p_instance, NDIlib_recv_queue_t* p_total); + +// Connection based metadata is data that is sent automatically each time a new connection is received. You queue all of these +// up and they are sent on each connection. To reset them you need to clear them all and set them up again. +PROCESSINGNDILIB_API +void NDIlib_recv_clear_connection_metadata(NDIlib_recv_instance_t p_instance); + +// Add a connection metadata string to the list of what is sent on each new connection. If someone is already connected then +// this string will be sent to them immediately. +PROCESSINGNDILIB_API +void NDIlib_recv_add_connection_metadata(NDIlib_recv_instance_t p_instance, const NDIlib_metadata_frame_t* p_metadata); + +// Is this receiver currently connected to a source on the other end, or has the source not yet been found or is no longe ronline. +// This will normally return 0 or 1 +PROCESSINGNDILIB_API +int NDIlib_recv_get_no_connections(NDIlib_recv_instance_t p_instance); + +// Get the URL that might be used for configuration of this input. Note that it might take a second or two after the connection for +// this value to be set. This function will return NULL if there is no web control user interface. You should call NDIlib_recv_free_string +// to free the string that is returned by this function. The returned value will be a fully formed URL, for instamce "http://10.28.1.192/configuration/" +// To avoid the need to poll this function, you can know when the value of this function might have changed when the +// NDILib_recv_capture* call would return NDIlib_frame_type_status_change +PROCESSINGNDILIB_API +const char* NDIlib_recv_get_web_control(NDIlib_recv_instance_t p_instance); \ No newline at end of file diff --git a/compat/libndi_newtek/Processing.NDI.Routing.h b/compat/libndi_newtek/Processing.NDI.Routing.h new file mode 100644 index 0000000..3fc0ee4 --- /dev/null +++ b/compat/libndi_newtek/Processing.NDI.Routing.h @@ -0,0 +1,59 @@ +#pragma once + +// NOTE : The following MIT license applies to this file ONLY and not to the SDK as a whole. Please review the SDK documentation +// for the description of the full license terms, which are also provided in the file "NDI License Agreement.pdf" within the SDK or +// online at http://new.tk/ndisdk_license/. Your use of any part of this SDK is acknowledgment that you agree to the SDK license +// terms. THe full NDI SDK may be downloaded at https://www.newtek.com/ndi/sdk/ +// +//*********************************************************************************************************************************************** +// +// Copyright(c) 2014-2017 NewTek, inc +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation +// files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +//*********************************************************************************************************************************************** + +//************************************************************************************************************************** +// Structures and type definitions required by NDI sending +// The reference to an instance of the sender +typedef void* NDIlib_routing_instance_t; + +// The creation structure that is used when you are creating a sender +typedef struct NDIlib_routing_create_t +{ // The name of the NDI source to create. This is a NULL terminated UTF8 string. + const char* p_ndi_name; + + // What groups should this source be part of + const char* p_groups; + +#if NDILIB_CPP_DEFAULT_CONSTRUCTORS + NDIlib_routing_create_t(const char* p_ndi_name_ = NULL, const char* p_groups_ = NULL); +#endif // NDILIB_CPP_DEFAULT_CONSTRUCTORS + +} NDIlib_routing_create_t; + +// Create an NDI routing source +PROCESSINGNDILIB_API +NDIlib_routing_instance_t NDIlib_routing_create(const NDIlib_routing_create_t* p_create_settings); + +// Destroy and NDI routing source +PROCESSINGNDILIB_API +void NDIlib_routing_destroy(NDIlib_routing_instance_t p_instance); + +// Change the routing of this source to another destination +PROCESSINGNDILIB_API +bool NDIlib_routing_change(NDIlib_routing_instance_t p_instance, const NDIlib_source_t* p_source); + +// Change the routing of this source to another destination +PROCESSINGNDILIB_API +bool NDIlib_routing_clear(NDIlib_routing_instance_t p_instance); \ No newline at end of file diff --git a/compat/libndi_newtek/Processing.NDI.Send.h b/compat/libndi_newtek/Processing.NDI.Send.h new file mode 100644 index 0000000..68c6920 --- /dev/null +++ b/compat/libndi_newtek/Processing.NDI.Send.h @@ -0,0 +1,126 @@ +#pragma once + +// NOTE : The following MIT license applies to this file ONLY and not to the SDK as a whole. Please review the SDK documentation +// for the description of the full license terms, which are also provided in the file "NDI License Agreement.pdf" within the SDK or +// online at http://new.tk/ndisdk_license/. Your use of any part of this SDK is acknowledgment that you agree to the SDK license +// terms. THe full NDI SDK may be downloaded at https://www.newtek.com/ndi/sdk/ +// +//*********************************************************************************************************************************************** +// +// Copyright(c) 2014-2017 NewTek, inc +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation +// files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +//*********************************************************************************************************************************************** + +//************************************************************************************************************************** +// Structures and type definitions required by NDI sending +// The reference to an instance of the sender +typedef void* NDIlib_send_instance_t; + +// The creation structure that is used when you are creating a sender +typedef struct NDIlib_send_create_t +{ // The name of the NDI source to create. This is a NULL terminated UTF8 string. + const char* p_ndi_name; + + // What groups should this source be part of. NULL means default. + const char* p_groups; + + // Do you want audio and video to "clock" themselves. When they are clocked then + // by adding video frames, they will be rate limited to match the current frame-rate + // that you are submitting at. The same is true for audio. In general if you are submitting + // video and audio off a single thread then you should only clock one of them (video is + // probably the better of the two to clock off). If you are submtiting audio and video + // of separate threads then having both clocked can be useful. + bool clock_video, clock_audio; + +#if NDILIB_CPP_DEFAULT_CONSTRUCTORS + NDIlib_send_create_t(const char* p_ndi_name_ = NULL, const char* p_groups_ = NULL, bool clock_video_ = true, bool clock_audio_ = false); +#endif // NDILIB_CPP_DEFAULT_CONSTRUCTORS + +} NDIlib_send_create_t; + +// Create a new sender instance. This will return NULL if it fails. +PROCESSINGNDILIB_API +NDIlib_send_instance_t NDIlib_send_create(const NDIlib_send_create_t* p_create_settings); + +// This will destroy an existing finder instance. +PROCESSINGNDILIB_API +void NDIlib_send_destroy(NDIlib_send_instance_t p_instance); + +// This will add a video frame +PROCESSINGNDILIB_API +void NDIlib_send_send_video_v2(NDIlib_send_instance_t p_instance, const NDIlib_video_frame_v2_t* p_video_data); + +// This will add a video frame and will return immediately, having scheduled the frame to be displayed. +// All processing and sending of the video will occur asynchronously. The memory accessed by NDIlib_video_frame_t +// cannot be freed or re-used by the caller until a synchronizing event has occured. In general the API is better +// able to take advantage of asynchronous processing than you might be able to by simple having a separate thread +// to submit frames. +// +// This call is particularly beneficial when processing BGRA video since it allows any color conversion, compression +// and network sending to all be done on separate threads from your main rendering thread. +// +// Synchronozing events are : +// - a call to NDIlib_send_send_video +// - a call to NDIlib_send_send_video_async with another frame to be sent +// - a call to NDIlib_send_send_video with p_video_data=NULL +// - a call to NDIlib_send_destroy +PROCESSINGNDILIB_API +void NDIlib_send_send_video_async_v2(NDIlib_send_instance_t p_instance, const NDIlib_video_frame_v2_t* p_video_data); + +// This will add an audio frame +PROCESSINGNDILIB_API +void NDIlib_send_send_audio_v2(NDIlib_send_instance_t p_instance, const NDIlib_audio_frame_v2_t* p_audio_data); + +// This will add a metadata frame +PROCESSINGNDILIB_API +void NDIlib_send_send_metadata(NDIlib_send_instance_t p_instance, const NDIlib_metadata_frame_t* p_metadata); + +// This allows you to receive metadata from the other end of the connection +PROCESSINGNDILIB_API +NDIlib_frame_type_e NDIlib_send_capture( + NDIlib_send_instance_t p_instance, // The instance data + 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 metadata +PROCESSINGNDILIB_API +void NDIlib_send_free_metadata(NDIlib_send_instance_t p_instance, const NDIlib_metadata_frame_t* p_metadata); + +// Determine the current tally sate. If you specify a timeout then it will wait until it has changed, otherwise it will simply poll it +// and return the current tally immediately. The return value is whether anything has actually change (true) or whether it timed out (false) +PROCESSINGNDILIB_API +bool NDIlib_send_get_tally(NDIlib_send_instance_t p_instance, NDIlib_tally_t* p_tally, uint32_t timeout_in_ms); + +// Get the current number of receivers connected to this source. This can be used to avoid even rendering when nothing is connected to the video source. +// which can significantly improve the efficiency if you want to make a lot of sources available on the network. If you specify a timeout that is not +// 0 then it will wait until there are connections for this amount of time. +PROCESSINGNDILIB_API +int NDIlib_send_get_no_connections(NDIlib_send_instance_t p_instance, uint32_t timeout_in_ms); + +// Connection based metadata is data that is sent automatically each time a new connection is received. You queue all of these +// up and they are sent on each connection. To reset them you need to clear them all and set them up again. +PROCESSINGNDILIB_API +void NDIlib_send_clear_connection_metadata(NDIlib_send_instance_t p_instance); + +// Add a connection metadata string to the list of what is sent on each new connection. If someone is already connected then +// this string will be sent to them immediately. +PROCESSINGNDILIB_API +void NDIlib_send_add_connection_metadata(NDIlib_send_instance_t p_instance, const NDIlib_metadata_frame_t* p_metadata); + +// This will assign a new fail-over source for this video source. What this means is that if this video source was to fail +// any receivers would automatically switch over to use this source, unless this source then came back online. You can specify +// NULL to clear the source. +PROCESSINGNDILIB_API +void NDIlib_send_set_failover(NDIlib_send_instance_t p_instance, const NDIlib_source_t* p_failover_source); \ No newline at end of file diff --git a/compat/libndi_newtek/Processing.NDI.compat.h b/compat/libndi_newtek/Processing.NDI.compat.h new file mode 100644 index 0000000..7d5c841 --- /dev/null +++ b/compat/libndi_newtek/Processing.NDI.compat.h @@ -0,0 +1,39 @@ +#pragma once + +// NOTE : The following MIT license applies to this file ONLY and not to the SDK as a whole. Please review the SDK documentation +// for the description of the full license terms, which are also provided in the file "NDI License Agreement.pdf" within the SDK or +// online at http://new.tk/ndisdk_license/. Your use of any part of this SDK is acknowledgment that you agree to the SDK license +// terms. THe full NDI SDK may be downloaded at https://www.newtek.com/ndi/sdk/ +// +//*********************************************************************************************************************************************** +// +// Copyright(c) 2014-2017 NewTek, inc +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation +// files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +//*********************************************************************************************************************************************** + +#ifdef __cplusplus + +#include + +#else + +#include +#include + +#endif + +#ifndef INFINITE +#define INFINITE 0xFFFFFFFF +#endif diff --git a/compat/libndi_newtek/Processing.NDI.deprecated.h b/compat/libndi_newtek/Processing.NDI.deprecated.h new file mode 100644 index 0000000..f41f0f3 --- /dev/null +++ b/compat/libndi_newtek/Processing.NDI.deprecated.h @@ -0,0 +1,213 @@ +#pragma once + +// NOTE : The following MIT license applies to this file ONLY and not to the SDK as a whole. Please review the SDK documentation +// for the description of the full license terms, which are also provided in the file "NDI License Agreement.pdf" within the SDK or +// online at http://new.tk/ndisdk_license/. Your use of any part of this SDK is acknowledgment that you agree to the SDK license +// terms. THe full NDI SDK may be downloaded at https://www.newtek.com/ndi/sdk/ +// +//*********************************************************************************************************************************************** +// +// Copyright(c) 2014-2017 NewTek, inc +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation +// files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +//*********************************************************************************************************************************************** + +// This describes a video frame +PROCESSINGNDILIB_DEPRECATED +typedef struct NDIlib_video_frame_t +{ // The resolution of this frame + int xres, yres; + + // What FourCC this is with. This can be two values + NDIlib_FourCC_type_e FourCC; + + // What is the frame-rate of this frame. + // For instance NTSC is 30000,1001 = 30000/1001 = 29.97fps + int frame_rate_N, frame_rate_D; + + // What is the picture aspect ratio of this frame. + // For instance 16.0/9.0 = 1.778 is 16:9 video + float picture_aspect_ratio; + + // Is this a fielded frame, or is it progressive + NDIlib_frame_format_type_e frame_format_type; + + // The timecode of this frame in 100ns intervals + int64_t timecode; + + // The video data itself + uint8_t* p_data; + + // The inter line stride of the video data, in bytes. + int line_stride_in_bytes; + +#if NDILIB_CPP_DEFAULT_CONSTRUCTORS + NDIlib_video_frame_t(int xres_ = 0, int yres_ = 0, NDIlib_FourCC_type_e FourCC_ = NDIlib_FourCC_type_UYVY, int frame_rate_N_ = 30000, int frame_rate_D_ = 1001, + float picture_aspect_ratio_ = 0.0f, NDIlib_frame_format_type_e frame_format_type_ = NDIlib_frame_format_type_progressive, + int64_t timecode_ = NDIlib_send_timecode_synthesize, uint8_t* p_data_ = NULL, int line_stride_in_bytes_ = 0); +#endif // NDILIB_CPP_DEFAULT_CONSTRUCTORS + +} NDIlib_video_frame_t; + +// This describes an audio frame +PROCESSINGNDILIB_DEPRECATED +typedef struct NDIlib_audio_frame_t +{ // The sample-rate of this buffer + int sample_rate; + + // The number of audio channels + int no_channels; + + // The number of audio samples per channel + int no_samples; + + // The timecode of this frame in 100ns intervals + int64_t timecode; + + // The audio data + float* p_data; + + // The inter channel stride of the audio channels, in bytes + int channel_stride_in_bytes; + +#if NDILIB_CPP_DEFAULT_CONSTRUCTORS + NDIlib_audio_frame_t(int sample_rate_ = 48000, int no_channels_ = 2, int no_samples_ = 0, int64_t timecode_ = NDIlib_send_timecode_synthesize, + float* p_data_ = NULL, int channel_stride_in_bytes_ = 0); +#endif // NDILIB_CPP_DEFAULT_CONSTRUCTORS + +} NDIlib_audio_frame_t; + +// For legacy reasons I called this the wrong thing. For backwards compatability. +PROCESSINGNDILIB_API PROCESSINGNDILIB_DEPRECATED +NDIlib_find_instance_t NDIlib_find_create2(const NDIlib_find_create_t* p_create_settings); + +PROCESSINGNDILIB_API PROCESSINGNDILIB_DEPRECATED +NDIlib_find_instance_t NDIlib_find_create(const NDIlib_find_create_t* p_create_settings); + +// DEPRECATED. This function is basically exactly the following and was confusing to use. +// if ((!timeout_in_ms) || (NDIlib_find_wait_for_sources(timeout_in_ms))) +// return NDIlib_find_get_current_sources(p_instance, p_no_sources); +// return NULL; +PROCESSINGNDILIB_API PROCESSINGNDILIB_DEPRECATED +const NDIlib_source_t* NDIlib_find_get_sources(NDIlib_find_instance_t p_instance, uint32_t* p_no_sources, uint32_t timeout_in_ms); + +// The creation structure that is used when you are creating a receiver +PROCESSINGNDILIB_DEPRECATED +typedef struct NDIlib_recv_create_t +{ // The source that you wish to connect to. + NDIlib_source_t source_to_connect_to; + + // Your preference of color space. See above. + NDIlib_recv_color_format_e color_format; + + // The bandwidth setting that you wish to use for this video source. Bandwidth + // controlled by changing both the compression level and the resolution of the source. + // A good use for low bandwidth is working on WIFI connections. + NDIlib_recv_bandwidth_e bandwidth; + + // When this flag is FALSE, all video that you receive will be progressive. For sources + // that provide fields, this is de-interlaced on the receiving side (because we cannot change + // what the up-stream source was actually rendering. This is provided as a convenience to + // down-stream sources that do not wish to understand fielded video. There is almost no + // performance impact of using this function. + bool allow_video_fields; + +#if NDILIB_CPP_DEFAULT_CONSTRUCTORS + NDIlib_recv_create_t(const NDIlib_source_t source_to_connect_to_ = NDIlib_source_t(), NDIlib_recv_color_format_e color_format_ = NDIlib_recv_color_format_UYVY_BGRA, + NDIlib_recv_bandwidth_e bandwidth_ = NDIlib_recv_bandwidth_highest, bool allow_video_fields_ = true); +#endif // NDILIB_CPP_DEFAULT_CONSTRUCTORS + +} NDIlib_recv_create_t; + +// This function is deprecated, please use NDIlib_recv_create_v3 if you can. Using this function will continue to work, and be +// supported for backwards compatibility. This version sets the receiver name to NULL. +PROCESSINGNDILIB_API PROCESSINGNDILIB_DEPRECATED +NDIlib_recv_instance_t NDIlib_recv_create_v2(const NDIlib_recv_create_t* p_create_settings); + +// For legacy reasons I called this the wrong thing. For backwards compatability. +PROCESSINGNDILIB_API PROCESSINGNDILIB_DEPRECATED +NDIlib_recv_instance_t NDIlib_recv_create2(const NDIlib_recv_create_t* p_create_settings); + +// This function is deprecated, please use NDIlib_recv_create_v3 if you can. Using this function will continue to work, and be +// supported for backwards compatibility. This version sets bandwidth to highest and allow fields to true. +PROCESSINGNDILIB_API PROCESSINGNDILIB_DEPRECATED +NDIlib_recv_instance_t NDIlib_recv_create(const NDIlib_recv_create_t* p_create_settings); + +// This will allow you to receive video, audio and metadata frames. +// Any of the buffers can be NULL, in which case data of that type +// will not be captured in this call. This call can be called simultaneously +// on separate threads, so it is entirely possible to receive audio, video, metadata +// all on separate threads. This function will return NDIlib_frame_type_none if no +// data is received within the specified timeout and NDIlib_frame_type_error if the connection is lost. +// Buffers captured with this must be freed with the appropriate free function below. +PROCESSINGNDILIB_API PROCESSINGNDILIB_DEPRECATED +NDIlib_frame_type_e NDIlib_recv_capture( +NDIlib_recv_instance_t p_instance, // The library instance +NDIlib_video_frame_t* p_video_data, // The video data received (can be NULL) +NDIlib_audio_frame_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 +PROCESSINGNDILIB_API PROCESSINGNDILIB_DEPRECATED +void NDIlib_recv_free_video(NDIlib_recv_instance_t p_instance, const NDIlib_video_frame_t* p_video_data); + +// Free the buffers returned by capture for audio +PROCESSINGNDILIB_API PROCESSINGNDILIB_DEPRECATED +void NDIlib_recv_free_audio(NDIlib_recv_instance_t p_instance, const NDIlib_audio_frame_t* p_audio_data); + +// This will add a video frame +PROCESSINGNDILIB_API PROCESSINGNDILIB_DEPRECATED +void NDIlib_send_send_video(NDIlib_send_instance_t p_instance, const NDIlib_video_frame_t* p_video_data); + +// This will add a video frame and will return immediately, having scheduled the frame to be displayed. +// All processing and sending of the video will occur asynchronously. The memory accessed by NDIlib_video_frame_t +// cannot be freed or re-used by the caller until a synchronizing event has occured. In general the API is better +// able to take advantage of asynchronous processing than you might be able to by simple having a separate thread +// to submit frames. +// +// This call is particularly beneficial when processing BGRA video since it allows any color conversion, compression +// and network sending to all be done on separate threads from your main rendering thread. +// +// Synchronozing events are : +// - a call to NDIlib_send_send_video +// - a call to NDIlib_send_send_video_async with another frame to be sent +// - a call to NDIlib_send_send_video with p_video_data=NULL +// - a call to NDIlib_send_destroy +PROCESSINGNDILIB_API PROCESSINGNDILIB_DEPRECATED +void NDIlib_send_send_video_async(NDIlib_send_instance_t p_instance, const NDIlib_video_frame_t* p_video_data); + +// This will add an audio frame +PROCESSINGNDILIB_API PROCESSINGNDILIB_DEPRECATED +void NDIlib_send_send_audio(NDIlib_send_instance_t p_instance, const NDIlib_audio_frame_t* p_audio_data); + +// Convert an planar floating point audio buffer into a interleaved short audio buffer. +// IMPORTANT : You must allocate the space for the samples in the destination to allow for your own memory management. +PROCESSINGNDILIB_API PROCESSINGNDILIB_DEPRECATED +void NDIlib_util_audio_to_interleaved_16s(const NDIlib_audio_frame_t* p_src, NDIlib_audio_frame_interleaved_16s_t* p_dst); + +// Convert an interleaved short audio buffer audio buffer into a planar floating point one. +// IMPORTANT : You must allocate the space for the samples in the destination to allow for your own memory management. +PROCESSINGNDILIB_API PROCESSINGNDILIB_DEPRECATED +void NDIlib_util_audio_from_interleaved_16s(const NDIlib_audio_frame_interleaved_16s_t* p_src, NDIlib_audio_frame_t* p_dst); + +// Convert an planar floating point audio buffer into a interleaved floating point audio buffer. +// IMPORTANT : You must allocate the space for the samples in the destination to allow for your own memory management. +PROCESSINGNDILIB_API PROCESSINGNDILIB_DEPRECATED +void NDIlib_util_audio_to_interleaved_32f(const NDIlib_audio_frame_t* p_src, NDIlib_audio_frame_interleaved_32f_t* p_dst); + +// Convert an interleaved floating point audio buffer into a planar floating point one. +// IMPORTANT : You must allocate the space for the samples in the destination to allow for your own memory management. +PROCESSINGNDILIB_API PROCESSINGNDILIB_DEPRECATED +void NDIlib_util_audio_from_interleaved_32f(const NDIlib_audio_frame_interleaved_32f_t* p_src, NDIlib_audio_frame_t* p_dst); \ No newline at end of file diff --git a/compat/libndi_newtek/Processing.NDI.structs.h b/compat/libndi_newtek/Processing.NDI.structs.h new file mode 100644 index 0000000..6b1b507 --- /dev/null +++ b/compat/libndi_newtek/Processing.NDI.structs.h @@ -0,0 +1,247 @@ +#pragma once + +// NOTE : The following MIT license applies to this file ONLY and not to the SDK as a whole. Please review the SDK documentation +// for the description of the full license terms, which are also provided in the file "NDI License Agreement.pdf" within the SDK or +// online at http://new.tk/ndisdk_license/. Your use of any part of this SDK is acknowledgment that you agree to the SDK license +// terms. THe full NDI SDK may be downloaded at https://www.newtek.com/ndi/sdk/ +// +//*********************************************************************************************************************************************** +// +// Copyright(c) 2014-2017 NewTek, inc +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation +// files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +//*********************************************************************************************************************************************** + +#ifndef NDI_LIB_FOURCC +#define NDI_LIB_FOURCC(ch0, ch1, ch2, ch3) \ + ((uint32_t)(uint8_t)(ch0) | ((uint32_t)(uint8_t)(ch1) << 8) | ((uint32_t)(uint8_t)(ch2) << 16) | ((uint32_t)(uint8_t)(ch3) << 24)) +#endif + +// An enumeration to specify the type of a packet returned by the functions +typedef enum NDIlib_frame_type_e +{ NDIlib_frame_type_none = 0, + NDIlib_frame_type_video = 1, + NDIlib_frame_type_audio = 2, + NDIlib_frame_type_metadata = 3, + NDIlib_frame_type_error = 4, + + // This indicates that the settings on this input have changed. + // For instamce, this value will be returned from NDIlib_recv_capture_v2 and NDIlib_recv_capture + // when the device is known to have new settings, for instance the web-url has changed ot the device + // is now known to be a PTZ camera. + NDIlib_frame_type_status_change = 100 + +} NDIlib_frame_type_e; + +typedef enum NDIlib_FourCC_type_e +{ // YCbCr color space + NDIlib_FourCC_type_UYVY = NDI_LIB_FOURCC('U', 'Y', 'V', 'Y'), + + // BGRA + NDIlib_FourCC_type_BGRA = NDI_LIB_FOURCC('B', 'G', 'R', 'A'), + NDIlib_FourCC_type_BGRX = NDI_LIB_FOURCC('B', 'G', 'R', 'X'), + + // RGBA + NDIlib_FourCC_type_RGBA = NDI_LIB_FOURCC('R', 'G', 'B', 'A'), + NDIlib_FourCC_type_RGBX = NDI_LIB_FOURCC('R', 'G', 'B', 'X'), + + // This is a UYVY buffer followed immediately by an alpha channel buffer. + // If the stride of the YCbCr component is "stride", then the alpha channel + // starts at image_ptr + yres*stride. The alpha channel stride is stride/2. + NDIlib_FourCC_type_UYVA = NDI_LIB_FOURCC('U', 'Y', 'V', 'A') + +} NDIlib_FourCC_type_e; + +typedef enum NDIlib_frame_format_type_e +{ // A progressive frame + NDIlib_frame_format_type_progressive = 1, + + // A fielded frame with the field 0 being on the even lines and field 1 being + // on the odd lines/ + NDIlib_frame_format_type_interleaved = 0, + + // Individual fields + NDIlib_frame_format_type_field_0 = 2, + NDIlib_frame_format_type_field_1 = 3 + +} NDIlib_frame_format_type_e; + +// When you specify this as a timecode, the timecode will be synthesized for you. This may +// be used when sending video, audio or metadata. If you never specify a timecode at all, +// asking for each to be synthesized, then this will use the current system time as the +// starting timecode and then generate synthetic ones, keeping your streams exactly in +// sync as long as the frames you are sending do not deviate from the system time in any +// meaningful way. In practice this means that if you never specify timecodes that they +// will always be generated for you correctly. Timecodes coming from different senders on +// the same machine will always be in sync with eachother when working in this way. If you +// have NTP installed on your local network, then streams can be synchronized between +// multiple machines with very high precision. +// +// If you specify a timecode at a particular frame (audio or video), then ask for all subsequent +// ones to be synthesized. The subsequent ones will be generated to continue this sequency +// maintining the correct relationship both the between streams and samples generated, avoiding +// them deviating in time from teh timecode that you specified in any meanginfful way. +// +// If you specify timecodes on one stream (e.g. video) and ask for the other stream (audio) to +// be sythesized, the correct timecodes will be generated for the other stream and will be synthesize +// exactly to match (they are not quantized inter-streams) the correct sample positions. +// +// When you send metadata messagesa and ask for the timecode to be synthesized, then it is chosen +// to match the closest audio or video frame timecode so that it looks close to something you might +// want ... unless there is no sample that looks close in which a timecode is synthesized from the +// last ones known and the time since it was sent. +// +static const int64_t NDIlib_send_timecode_synthesize = INT64_MAX; +static const int64_t NDIlib_send_timecode_empty = 0; + +// If the time-stamp is not available (i.e. a version of a sender before v2.5) +static const int64_t NDIlib_recv_timestamp_undefined = INT64_MAX; + +// This is a descriptor of a NDI source available on the network. +typedef struct NDIlib_source_t +{ // A UTF8 string that provides a user readable name for this source. + // This can be used for serialization, etc... and comprises the machine + // name and the source name on that machine. In the form + // MACHINE_NAME (NDI_SOURCE_NAME) + // If you specify this parameter either as NULL, or an EMPTY string then the + // specific ip addres adn port number from below is used. + const char* p_ndi_name; + + // A UTF8 string that provides the actual IP address and port number. + // This is in the form : IP_ADDRESS:PORT_NO, for instance "127.0.0.1:10000" + // If you leave this parameter either as NULL, or an EMPTY string then the + // ndi name above is used to look up the mDNS name to determine the IP and + // port number. Connection is faster if the IP address is known. + const char* p_ip_address; + + // Default constructor in C++ +#if NDILIB_CPP_DEFAULT_CONSTRUCTORS + NDIlib_source_t(const char* p_ndi_name_ = NULL, const char* p_ip_address_ = NULL); +#endif // NDILIB_CPP_DEFAULT_CONSTRUCTORS + +} NDIlib_source_t; + +// This describes a video frame +typedef struct NDIlib_video_frame_v2_t +{ // The resolution of this frame + int xres, yres; + + // What FourCC this is with. This can be two values + NDIlib_FourCC_type_e FourCC; + + // What is the frame-rate of this frame. + // For instance NTSC is 30000,1001 = 30000/1001 = 29.97fps + int frame_rate_N, frame_rate_D; + + // What is the picture aspect ratio of this frame. + // For instance 16.0/9.0 = 1.778 is 16:9 video + // 0 means square pixels + float picture_aspect_ratio; + + // Is this a fielded frame, or is it progressive + NDIlib_frame_format_type_e frame_format_type; + + // The timecode of this frame in 100ns intervals + int64_t timecode; + + // The video data itself + uint8_t* p_data; + + // The inter line stride of the video data, in bytes. + int line_stride_in_bytes; + + // Per frame metadata for this frame. This is a NULL terminated UTF8 string that should be + // in XML format. If you do not want any metadata then you may specify NULL here. + const char* p_metadata; // Present in >= v2.5 + + // This is only valid when receiving a frame and is specified as a 100ns time that was the exact + // moment that the frame was submitted by the sending side and is generated by the SDK. If this + // value is NDIlib_recv_timestamp_undefined then this value is not available and is NDIlib_recv_timestamp_undefined. + int64_t timestamp; // Present in >= v2.5 + +#if NDILIB_CPP_DEFAULT_CONSTRUCTORS + NDIlib_video_frame_v2_t(int xres_ = 0, int yres_ = 0, NDIlib_FourCC_type_e FourCC_ = NDIlib_FourCC_type_UYVY, int frame_rate_N_ = 30000, int frame_rate_D_ = 1001, + float picture_aspect_ratio_ = 0.0f, NDIlib_frame_format_type_e frame_format_type_ = NDIlib_frame_format_type_progressive, + int64_t timecode_ = NDIlib_send_timecode_synthesize, uint8_t* p_data_ = NULL, int line_stride_in_bytes_ = 0, const char* p_metadata_ = NULL, int64_t timestamp_ = NDIlib_send_timecode_empty); +#endif // NDILIB_CPP_DEFAULT_CONSTRUCTORS + +} NDIlib_video_frame_v2_t; + +// This describes an audio frame +typedef struct NDIlib_audio_frame_v2_t +{ // The sample-rate of this buffer + int sample_rate; + + // The number of audio channels + int no_channels; + + // The number of audio samples per channel + int no_samples; + + // The timecode of this frame in 100ns intervals + int64_t timecode; + + // The audio data + float* p_data; + + // The inter channel stride of the audio channels, in bytes + int channel_stride_in_bytes; + + // Per frame metadata for this frame. This is a NULL terminated UTF8 string that should be + // in XML format. If you do not want any metadata then you may specify NULL here. + const char* p_metadata; // Present in >= v2.5 + + // This is only valid when receiving a frame and is specified as a 100ns time that was the exact + // moment that the frame was submitted by the sending side and is generated by the SDK. If this + // value is NDIlib_recv_timestamp_undefined then this value is not available and is NDIlib_recv_timestamp_undefined. + int64_t timestamp; // Present in >= v2.5 + +#if NDILIB_CPP_DEFAULT_CONSTRUCTORS + NDIlib_audio_frame_v2_t(int sample_rate_ = 48000, int no_channels_ = 2, int no_samples_ = 0, int64_t timecode_ = NDIlib_send_timecode_synthesize, + float* p_data_ = NULL, int channel_stride_in_bytes_ = 0, const char* p_metadata_ = NULL, int64_t timestamp_ = NDIlib_send_timecode_empty); +#endif // NDILIB_CPP_DEFAULT_CONSTRUCTORS + +} NDIlib_audio_frame_v2_t; + +// The data description for metadata +typedef struct NDIlib_metadata_frame_t +{ // The length of the string in UTF8 characters. This includes the NULL terminating character. + // If this is 0, then the length is assume to be the length of a null terminated string. + int length; + + // The timecode of this frame in 100ns intervals + int64_t timecode; + + // The metadata as a UTF8 XML string. This is a NULL terminated string. + char* p_data; + +#if NDILIB_CPP_DEFAULT_CONSTRUCTORS + NDIlib_metadata_frame_t(int length_ = 0, int64_t timecode_ = NDIlib_send_timecode_synthesize, char* p_data_ = NULL); +#endif // NDILIB_CPP_DEFAULT_CONSTRUCTORS + +} NDIlib_metadata_frame_t; + +// Tally structures +typedef struct NDIlib_tally_t +{ // Is this currently on program output + bool on_program; + + // Is this currently on preview output + bool on_preview; + +#if NDILIB_CPP_DEFAULT_CONSTRUCTORS + NDIlib_tally_t(bool on_program_ = false, bool on_preview_ = false); +#endif // NDILIB_CPP_DEFAULT_CONSTRUCTORS + +} NDIlib_tally_t; diff --git a/compat/libndi_newtek/Processing.NDI.utilities.h b/compat/libndi_newtek/Processing.NDI.utilities.h new file mode 100644 index 0000000..4e23256 --- /dev/null +++ b/compat/libndi_newtek/Processing.NDI.utilities.h @@ -0,0 +1,108 @@ +#pragma once + +// NOTE : The following MIT license applies to this file ONLY and not to the SDK as a whole. Please review the SDK documentation +// for the description of the full license terms, which are also provided in the file "NDI License Agreement.pdf" within the SDK or +// online at http://new.tk/ndisdk_license/. Your use of any part of this SDK is acknowledgment that you agree to the SDK license +// terms. THe full NDI SDK may be downloaded at https://www.newtek.com/ndi/sdk/ +// +//*********************************************************************************************************************************************** +// +// Copyright(c) 2014-2017 NewTek, inc +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation +// files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +//*********************************************************************************************************************************************** + +// Because many applications like submitting 16bit interleaved audio, these functions will convert in +// and out of that format. It is important to note that the NDI SDK does define fully audio levels, something +// that most applications that you use do not. Specifically, the floating point -1.0 to +1.0 range is defined +// as a professional audio reference level of +4dBU. If we take 16bit audio and scale it into this range +// it is almost always correct for sending and will cause no problems. For receiving however it is not at +// all uncommon that the user has audio that exceeds reference level and in this case it is likely that audio +// exceeds the reference level and so if you are not careful you will end up having audio clipping when +// you use the 16 bit range. + +// This describes an audio frame +typedef struct NDIlib_audio_frame_interleaved_16s_t +{ // The sample-rate of this buffer + int sample_rate; + + // The number of audio channels + int no_channels; + + // The number of audio samples per channel + int no_samples; + + // The timecode of this frame in 100ns intervals + int64_t timecode; + + // The audio reference level in dB. This specifies how many dB above the reference level (+4dBU) is the full range of 16 bit audio. + // If you do not understand this and want to just use numbers : + // - If you are sending audio, specify +0dB. Most common applications produce audio at reference level. + // - If receiving audio, specify +20dB. This means that the full 16 bit range corresponds to professional level audio with 20dB of headroom. Note that + // if you are writing it into a file it might sound soft because you have 20dB of headroom before clipping. + int reference_level; + + // The audio data, interleaved 16bpp + short* p_data; + +#if NDILIB_CPP_DEFAULT_CONSTRUCTORS + NDIlib_audio_frame_interleaved_16s_t(int sample_rate_ = 48000, int no_channels_ = 2, int no_samples_ = 0, int64_t timecode_ = NDIlib_send_timecode_synthesize, + int reference_level_ = 0, short* p_data_ = NULL); +#endif // NDILIB_CPP_DEFAULT_CONSTRUCTORS + +} NDIlib_audio_frame_interleaved_16s_t; + +// This describes an audio frame +typedef struct NDIlib_audio_frame_interleaved_32f_t +{ // The sample-rate of this buffer + int sample_rate; + + // The number of audio channels + int no_channels; + + // The number of audio samples per channel + int no_samples; + + // The timecode of this frame in 100ns intervals + int64_t timecode; + + // The audio data, interleaved 32bpp + float* p_data; + +#if NDILIB_CPP_DEFAULT_CONSTRUCTORS + NDIlib_audio_frame_interleaved_32f_t(int sample_rate_ = 48000, int no_channels_ = 2, int no_samples_ = 0, int64_t timecode_ = NDIlib_send_timecode_synthesize, + float* p_data_ = NULL); +#endif // NDILIB_CPP_DEFAULT_CONSTRUCTORS + +} NDIlib_audio_frame_interleaved_32f_t; + +// This will add an audio frame in 16bpp +PROCESSINGNDILIB_API +void NDIlib_util_send_send_audio_interleaved_16s(NDIlib_send_instance_t p_instance, const NDIlib_audio_frame_interleaved_16s_t* p_audio_data); + +// This will add an audio frame interleaved floating point +PROCESSINGNDILIB_API +void NDIlib_util_send_send_audio_interleaved_32f(NDIlib_send_instance_t p_instance, const NDIlib_audio_frame_interleaved_32f_t* p_audio_data); + +PROCESSINGNDILIB_API +void NDIlib_util_audio_to_interleaved_16s_v2(const NDIlib_audio_frame_v2_t* p_src, NDIlib_audio_frame_interleaved_16s_t* p_dst); + +PROCESSINGNDILIB_API +void NDIlib_util_audio_from_interleaved_16s_v2(const NDIlib_audio_frame_interleaved_16s_t* p_src, NDIlib_audio_frame_v2_t* p_dst); + +PROCESSINGNDILIB_API +void NDIlib_util_audio_to_interleaved_32f_v2(const NDIlib_audio_frame_v2_t* p_src, NDIlib_audio_frame_interleaved_32f_t* p_dst); + +PROCESSINGNDILIB_API +void NDIlib_util_audio_from_interleaved_32f_v2(const NDIlib_audio_frame_interleaved_32f_t* p_src, NDIlib_audio_frame_v2_t* p_dst); \ No newline at end of file