1CURLOPT_INTERLEAVEFUNCTION(3c)url_easy_setopt optionCsURLOPT_INTERLEAVEFUNCTION(3)
2
3
4

NAME

6       CURLOPT_INTERLEAVEFUNCTION - callback for RTSP interleaved data
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       size_t interleave_callback(void *ptr, size_t size, size_t nmemb,
12                                  void *userdata);
13
14       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_INTERLEAVEFUNCTION,
15                                 interleave_callback);
16

DESCRIPTION

18       Pass a pointer to your callback function, which should match the proto‐
19       type shown above.
20
21       This callback function gets called by libcurl as soon  as  it  has  re‐
22       ceived interleaved RTP data. This function gets called for each $ block
23       and therefore contains exactly one upper-layer protocol unit (e.g.  one
24       RTP packet). Curl writes the interleaved header as well as the included
25       data for each call. The first byte is always an ASCII dollar sign.  The
26       dollar  sign  is followed by a one byte channel identifier and then a 2
27       byte integer length in network byte order. See  RFC2326  Section  10.12
28       for  more  information on how RTP interleaving behaves. If unset or set
29       to NULL, curl will use the default write function.
30
31       Interleaved RTP poses some challenges for the client application. Since
32       the  stream data is sharing the RTSP control connection, it is critical
33       to service the RTP in a timely fashion. If the RTP data is not  handled
34       quickly, subsequent response processing may become unreasonably delayed
35       and the connection may close. The application may use  CURL_RTSPREQ_RE‐
36       CEIVE to service RTP data when no requests are desired. If the applica‐
37       tion makes a request, (e.g.  CURL_RTSPREQ_PAUSE) then the response han‐
38       dler  will  process  any pending RTP data before marking the request as
39       finished.
40
41       The CURLOPT_INTERLEAVEDATA(3) is passed in the userdata argument in the
42       callback.
43

DEFAULT

45       NULL, the interleave data is then passed to the regular write function:
46       CURLOPT_WRITEFUNCTION(3).
47

PROTOCOLS

49       RTSP
50

EXAMPLE

52       static size_t rtp_write(void *ptr, size_t size, size_t nmemb, void *user)
53       {
54         struct local *l = (struct local *)user;
55         /* take care of the packet in 'ptr', then return... */
56         return size * nmemb;
57       }
58       {
59         struct local rtp_data;
60         curl_easy_setopt(curl, CURLOPT_INTERLEAVEFUNCTION, rtp_write);
61         curl_easy_setopt(curl, CURLOPT_INTERLEAVEDATA, &rtp_data);
62       }
63

AVAILABILITY

65       Added in 7.20.0
66

RETURN VALUE

68       Returns CURLE_OK if the option is supported,  and  CURLE_UNKNOWN_OPTION
69       if not.
70

SEE ALSO

72       CURLOPT_INTERLEAVEDATA(3), CURLOPT_RTSP_REQUEST(3),
73
74
75
76libcurl 7.85.0                   May 17, 2022    CURLOPT_INTERLEAVEFUNCTION(3)
Impressum