1CURLOPT_INTERLEAVEFUNCTION(3c)url_easy_setopt optionCsURLOPT_INTERLEAVEFUNCTION(3)
2
3
4
6 CURLOPT_INTERLEAVEFUNCTION - callback function for RTSP interleaved
7 data
8
10 #include <curl/curl.h>
11
12 size_t interleave_callback(void *ptr, size_t size, size_t nmemb,
13 void *userdata);
14
15 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_INTERLEAVEFUNCTION,
16 interleave_callback);
17
19 Pass a pointer to your callback function, which should match the proto‐
20 type shown above.
21
22 This callback function gets called by libcurl as soon as it has re‐
23 ceived interleaved RTP data. This function gets called for each $ block
24 and therefore contains exactly one upper-layer protocol unit (e.g. one
25 RTP packet). Curl writes the interleaved header as well as the included
26 data for each call. The first byte is always an ASCII dollar sign. The
27 dollar sign is followed by a one byte channel identifier and then a 2
28 byte integer length in network byte order. See RFC2326 Section 10.12
29 for more information on how RTP interleaving behaves. If unset or set
30 to NULL, curl will use the default write function.
31
32 Interleaved RTP poses some challenges for the client application. Since
33 the stream data is sharing the RTSP control connection, it is critical
34 to service the RTP in a timely fashion. If the RTP data is not handled
35 quickly, subsequent response processing may become unreasonably delayed
36 and the connection may close. The application may use CURL_RTSPREQ_RE‐
37 CEIVE to service RTP data when no requests are desired. If the applica‐
38 tion makes a request, (e.g. CURL_RTSPREQ_PAUSE) then the response han‐
39 dler will process any pending RTP data before marking the request as
40 finished.
41
42 The CURLOPT_INTERLEAVEDATA(3) is passed in the userdata argument in the
43 callback.
44
46 NULL, the interleave data is then passed to the regular write function:
47 CURLOPT_WRITEFUNCTION(3).
48
50 RTSP
51
53 static size_t rtp_write(void *ptr, size_t size, size_t nmemb, void *user)
54 {
55 struct local *l = (struct local *)user;
56 /* take care of the packet in 'ptr', then return... */
57 return size * nmemb;
58 }
59 {
60 struct local rtp_data;
61 curl_easy_setopt(curl, CURLOPT_INTERLEAVEFUNCTION, rtp_write);
62 curl_easy_setopt(curl, CURLOPT_INTERLEAVEDATA, &rtp_data);
63 }
64
66 Added in 7.20.0
67
69 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
70 if not.
71
73 CURLOPT_INTERLEAVEDATA(3), CURLOPT_RTSP_REQUEST(3),
74
75
76
77libcurl 7.76.1 November 04, 2020 CURLOPT_INTERLEAVEFUNCTION(3)