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