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
23 received interleaved RTP data. This function gets called for each $
24 block and therefore contains exactly one upper-layer protocol unit
25 (e.g. one RTP packet). Curl writes the interleaved header as well as
26 the included data for each call. The first byte is always an ASCII dol‐
27 lar sign. The dollar sign is followed by a one byte channel identifier
28 and then a 2 byte integer length in network byte order. See RFC2326
29 Section 10.12 for more information on how RTP interleaving behaves. If
30 unset or set 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
37 CURL_RTSPREQ_RECEIVE to service RTP data when no requests are desired.
38 If the application makes a request, (e.g. CURL_RTSPREQ_PAUSE) then the
39 response handler will process any pending RTP data before marking the
40 request as 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.66.0 August 11, 2018 CURLOPT_INTERLEAVEFUNCTION(3)