PDA

View Full Version : Manually configuring NDI source to connect to



yashinski.dev
09-20-2018, 03:04 AM
Hello all,
We're working on an app that utilizes a set of NDI cameras.
We need the app to switch between cameras as the user in pressing the corresponding key, for example;
I have 6 cameras key-mapped like this
cam - |1| |2| |3| |4| |5| |6|
------------------------
key - |1| |2| |3| |4| |5| |6|

Each cam is a predefined source, so cam 1 will always be the same physical camera.


Now out issue is we can't really understand how the "NDIlib_recv_connect()" function works.

How can we do something like this:
ndilib_recv_connet(receiver, 10.0.0.24:5599)

Or how can we predefine a source so this will work:
ndilib_recv_connet(receiver, predefinedsource1)


Thanks in advance for any help!

ddv2005
09-22-2018, 06:42 PM
Hi.
NDIlib_recv_create_v3_t -> source_to_connect_to -> p_ndi_name is "a UTF8 string that provides a user readable name for this source.
his 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)"
Each camera has own host name and you can connect to it by MACHINE_NAME (NDI_SOURCE_NAME). Also you can connect by IP but the problem is that port number is dynamic and you still have to find it by MACHINE_NAME (NDI_SOURCE_NAME) via finder API.

Dmitry

yashinski.dev
09-23-2018, 02:42 AM
Hi Dmitry,
Thanks for your answer, but I already know the source is made of the name and address of the camera in a struct.
problem is, when I try to define it manually like this:
ndisource("cameraname", 123.1.2.3)
connect(ndisource)
it gives me an error


how would i write this correctly:
source1("cam1", 127.0.0.3)
source2("cam2", 127.0.0.4)
..
..
..
..
connect(source1)




Thanks,
Nimrod

ddv2005
09-23-2018, 06:51 AM
Hi Nimrod,

If you want to known NDI name of your cameras then run "NDIAnalysis.exe /find" from latest SDK or NDIlib_Find example. It will show you list of all NDI sources in your network. Then use this name as p_ndi_name and p_url_address_ = NULL .

P.S. NDI name can't be "cam1" because NDI name format is MACHINE_NAME (NDI_SOURCE_NAME)...for example "cam1 (INPUT1)"

yashinski.dev
09-25-2018, 01:56 AM
Thanks for the suggestion Dmitry, though I get a different error now.

This is my code:

NDIlib_source_t* source1 = NULL;
source1->p_ndi_name = "BIRDDOG-XXXXX (SDI)";
source1->p_url_address = NULL;


When I run the this VS highlights the ndi_name string and I get this runtime error :

Exception thrown at 0x000000013F72148F in opencvtest.exe: 0xC0000005:
Access violation writing location 0x0000000000000000.


What is the issue now?
Can this be acheived?

Thanks again,
Nimrod

yashinski.dev
09-25-2018, 02:12 AM
Ok, Problem solved!

This is my code now:

NDIlib_source_t source1 = NULL;
source1.p_ndi_name = "BIRDDOG-XXXXX (SDI)";
source1.p_url_address = NULL;


NDIlib_recv_instance_t pNDI_recv = NDIlib_recv_create_v3();
if (!pNDI_recv) return 0;

NDIlib_recv_connect(pNDI_recv, &source1);



Thanks for the help Dmitry!