CURLOPT_INTERLEAVEDATA(3)
CURLOPT_INTERLEAVEDATA π
okay bestie, so this is a page from the libcurl manual β the library functions manual, to be exact β and it's all about CURLOPT_INTERLEAVEDATA, which is genuinely one of those tiny options that makes the whole RTSP thing work. no cap. let's get into it π
β¨ NAME β¨
CURLOPT_INTERLEAVEDATA β the pointer that gets passed to the RTSP interleave callback, periodt.
πΈ SYNOPSIS πΈ
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_INTERLEAVEDATA, void *pointer);
π¦ DESCRIPTION π¦
So here's the vibe: this is the userdata pointer that gets handed over to CURLOPT_INTERLEAVEFUNCTION(3) whenever interleaved RTP data shows up. like, it's the little bag of stuff you get to carry into your callback. π
and lowkey important: if you never set the interleave function callback, this pointer literally isn't used anywhere. it just sits there. main character energy with no scene to be in, honestly. π
β DEFAULT β
NULL
π PROTOCOLS π
this functionality affects rtsp only. iykyk. π«Ά
π₯ EXAMPLE π₯
here's the whole little program, copied exactly so you can steal it:
struct local {
void *custom;
};
static size_t rtp_write(void *ptr, size_t size, size_t nmemb, void *userp)
{
struct local *l = userp;
printf("my pointer: %p\n", l->custom);
/* take care of the packet in 'ptr', then return... */
return size * nmemb;
}
int main(void)
{
struct local rtp_data;
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_INTERLEAVEFUNCTION, rtp_write);
curl_easy_setopt(curl, CURLOPT_INTERLEAVEDATA, &rtp_data);
curl_easy_perform(curl);
}
}
π AVAILABILITY π
added in curl 7.20.0 β vintage, but iconic. π
β¨ RETURN VALUE β¨
curl_easy_setopt(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK β slay β and non-zero means an error occurred, so go check libcurl-errors(3) for what went wrong. π
π SEE ALSO π
fr fr bestie, don't setCURLOPT_INTERLEAVEDATAwithoutCURLOPT_INTERLEAVEFUNCTIONβ the page says the pointer isn't used anywhere if the callback isn't set. that's just facts. π
okay that's the whole page, hope your RTSP journey is cute and your packets are interleaved beautifully πΈπ
this libcurl page is dated 2026-10-12 and comes from the libcurl source β bye bestie, mwah! ππ¦
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms