mardi 13 juillet 2021

IF NDI stream exist do one thing, if not, do something else C++

I have a C++ Script that looks for an NDI stream on the network and if it exist, lists them. What I need the script to do is; if an NDI Stream(s) exist do one thing and if it doesn't exit do something else. The current script is set up to check every 20 seconds which I need, I just unfortunately have week C++ skills and I am struggling with it. The existing code I need to alter is below.

for (const auto start = high_resolution_clock::now(); high_resolution_clock::now() - start < minutes(60);)
{
    if (!NDIlib_find_wait_for_sources(pNDI_find, 20000/* 20 seconds */))
        { printf("No change to the sources found.\n"); continue; }
    
    // Get the updated list of sources
    uint32_t no_sources = 0;
    const NDIlib_source_t* p_sources = NDIlib_find_get_current_sources(pNDI_find, &no_sources);
            
    // Display all the sources.
    printf("Network sources (%u found).\n", no_sources);
    for (uint32_t i = 0; i < no_sources; i++)
        printf("%u. %s\n", i + 1, p_sources[i].p_ndi_name);
}

I would be grateful for any help you can offer.

Aucun commentaire:

Enregistrer un commentaire