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