Results 1 to 3 of 3

Thread: Lifetimes of params and return values from NDI SDK (C++, windows)

  1. #1
    Registered User roddyp's Avatar
    Join Date
    Sep 2017
    Location
    UK
    Posts
    36

    Lifetimes of params and return values from NDI SDK (C++, windows)

    Hi all,

    Just wondering if there were specific guidelines for lifetimes of the string/struct params and returned structs with the NDI SDK?

    Example #1:-

    Code:
      Router(const std::string &name, const std::string &groups = "")
      {
        NDIlib_routing_create_t params;
        params.p_ndi_name = name.c_str();
        params.p_groups = groups.c_str();
        instance = NDIlib_routing_create(&params);  // Is it safe for the 'params' struct to go out of scope now? What about the char array pointed to by p_ndi_name 
      }
    Example #2:

    Code:
    const NDIlib_source_t* p_sources = NDIlib_find_get_current_sources(instance, &no_sources);
    How long is p_sources valid for (presumable the caller shouldn't free() it) - and is this thread-safe?

  2. #2
    Software Engineer
    Join Date
    Jul 2006
    Location
    San Antonio, TX
    Posts
    12
    Quote Originally Posted by roddyp View Post
    Is it safe for the 'params' struct to go out of scope now? What about the char array pointed to by p_ndi_name
    That is correct.

    Quote Originally Posted by roddyp View Post
    How long is p_sources valid for (presumable the caller shouldn't free() it) - and is this thread-safe?
    It'll be valid until the next call to NDIlib_find_get_current_sources or NDIlib_find_destroy, so probably not thread-safe if you're using the same instance across multiple threads.
    Brian

  3. #3
    Registered User roddyp's Avatar
    Join Date
    Sep 2017
    Location
    UK
    Posts
    36
    Quote Originally Posted by brianbrice View Post
    It'll be valid until the next call to NDIlib_find_get_current_sources or NDIlib_find_destroy, so probably not thread-safe if you're using the same instance across multiple threads.
    Great - thankyou!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •