1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_INTERLEAVEDATA 5Section: 3 6Source: libcurl 7Protocol: 8 - RTSP 9See-also: 10 - CURLOPT_INTERLEAVEFUNCTION (3) 11 - CURLOPT_RTSP_REQUEST (3) 12--- 13 14# NAME 15 16CURLOPT_INTERLEAVEDATA - pointer passed to RTSP interleave callback 17 18# SYNOPSIS 19 20~~~c 21#include <curl/curl.h> 22 23CURLcode curl_easy_setopt(CURL *handle, CURLOPT_INTERLEAVEDATA, void *pointer); 24~~~ 25 26# DESCRIPTION 27 28This is the userdata *pointer* that is passed to 29CURLOPT_INTERLEAVEFUNCTION(3) when interleaved RTP data is received. If 30the interleave function callback is not set, this pointer is not used 31anywhere. 32 33# DEFAULT 34 35NULL 36 37# EXAMPLE 38 39~~~c 40struct local { 41 void *custom; 42}; 43static size_t rtp_write(void *ptr, size_t size, size_t nmemb, void *userp) 44{ 45 struct local *l = userp; 46 printf("my pointer: %p\n", l->custom); 47 /* take care of the packet in 'ptr', then return... */ 48 return size * nmemb; 49} 50 51int main(void) 52{ 53 struct local rtp_data; 54 CURL *curl = curl_easy_init(); 55 if(curl) { 56 curl_easy_setopt(curl, CURLOPT_INTERLEAVEFUNCTION, rtp_write); 57 curl_easy_setopt(curl, CURLOPT_INTERLEAVEDATA, &rtp_data); 58 59 curl_easy_perform(curl); 60 } 61} 62~~~ 63 64# AVAILABILITY 65 66Added in 7.20.0 67 68# RETURN VALUE 69 70Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 71