1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_INTERLEAVEDATA
5Section: 3
6Source: libcurl
7Protocol:
8  - RTSP
9See-also:
10  - CURLOPT_INTERLEAVEFUNCTION (3)
11  - CURLOPT_RTSP_REQUEST (3)
12Added-in: 7.20.0
13---
14
15# NAME
16
17CURLOPT_INTERLEAVEDATA - pointer passed to RTSP interleave callback
18
19# SYNOPSIS
20
21~~~c
22#include <curl/curl.h>
23
24CURLcode curl_easy_setopt(CURL *handle, CURLOPT_INTERLEAVEDATA, void *pointer);
25~~~
26
27# DESCRIPTION
28
29This is the userdata *pointer* that is passed to
30CURLOPT_INTERLEAVEFUNCTION(3) when interleaved RTP data is received. If
31the interleave function callback is not set, this pointer is not used
32anywhere.
33
34# DEFAULT
35
36NULL
37
38# %PROTOCOLS%
39
40# EXAMPLE
41
42~~~c
43struct local {
44  void *custom;
45};
46static 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
54int 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
71Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
72