How to use the onvif client library API to get different stream addresses?

Get the device stream address using the code example below:

// Define an ONVIF_DEVICE variable
ONVIF_DEVICE g_device;

// open log file
log_init("log.txt");
log_set_level(LOG_DBG);

// init system buffer
sys_buf_init(10 * MAX_DEV_NUMS);

// init http message buffer
http_msg_buf_init(10 * MAX_DEV_NUMS);

// init g_device
memset(&g_device, 0, sizeof(g_device));

g_device.binfo.XAddr.https = 0; // If using an HTTPS connection, set it to 1
g_device.binfo.XAddr.port = 8000; // Specify the ONVIF service port of the device
strcpy(g_device.binfo.XAddr.host, "192.168.1.3"); // Specify the IP address of the device
strcpy(g_device.binfo.XAddr.url, "/onvif/device_service");

// set device login information
onvif_SetAuthInfo(&g_device, "admin", "admin");
// set auth method
onvif_SetAuthMethod(&g_device, AuthMethod_UsernameToken);
// set request timeout
onvif_SetReqTimeout(&g_device, 5000);

// Next you can call other API interfaces.

if (!GetSystemDateAndTime(&g_device))
{
    printf("%s, GetSystemDateAndTime failed\r\n", g_device.binfo.XAddr.host);
}

if (!GetCapabilities(&g_device))
{
    printf("%s, GetCapabilities failed\r\n", g_device.binfo.XAddr.host);
}

if (!GetServices(&g_device))
{
    printf("%s, GetServices failed\r\n", g_device.binfo.XAddr.host);
}

if (!GetDeviceInformation(&g_device))
{
    printf("%s, GetDeviceInformation failed\r\n", g_device.binfo.XAddr.host);
}

// Call GetStreamUris to get the RTP over RTSP stream address
if (!GetStreamUris(&g_device))
{
    printf("%s, GetDeviceInformation failed\r\n", g_device.binfo.XAddr.host);
}

// If you need to get the stream address of other protocols(such as RTP over UDP),
// you can call the onvif_GetStreamUri interface as follows:

ONVIF_Profile * p_profile = g_device.profiles;
while (p_profile)
{
    GetStreamUri_REQ req;
    GetStreamUri_RES res;

    memset(&req, 0, sizeof(req));
    memset(&res, 0, sizeof(res));

    req.StreamSetup.Transport.Protocol = TransportProtocol_UDP; // TransportProtocol_HTTP - rtsp over http
    req.StreamSetup.Stream = StreamType_RTP_Unicast; // StreamType_RTP_Multicast - rtp multicast
    strcpy(req.ProfileToken, p_profile->token);

    if (onvif_GetStreamUri(p_dev, &req, &res))
    {
        strcpy(p_profile->stream_uri, res.Uri);
    }

    p_profile = p_profile->next;
}