CURLOPT_RTSP_REQUEST(3)
π CURLOPT_RTSP_REQUEST(3) β RTSP request, but make it make sense
Okay bestie, so this one's from the Library Functions Manual, and it's literally about telling libcurl which RTSP request you wanna make. RTSP girlies rise π
β¨ SYNOPSIS β¨
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RTSP_REQUEST, long request);
πΈ DESCRIPTION πΈ
So basically, you're telling libcurl what kind of RTSP request to make. You pass one of the RTSP enum values below as a long in the request argument, and that's it, that's the whole vibe π
Heads up bestie: unless it says otherwise, these commands need the Session ID to be initialized first. No session ID, no party π
CURL_RTSPREQ_OPTIONSβ this one grabs the available methods of the server. Your app is the one responsible for parsing and obeying the response, so like, don't @ libcurl for that. Also the session ID is not needed for this method β¨CURL_RTSPREQ_DESCRIBEβ gets the low level description of a stream. Your app should note what formats it understands in the'Accept:'header. Unless you set it manually, libcurl automatically adds in'Accept: application/sdp'. Oh and Time-condition headers get added to Describe requests if you're using theCURLOPT_TIMECONDITION(3)option. (The session ID is not needed for this method π«Ά)CURL_RTSPREQ_ANNOUNCEβ when a client sends this, the method changes the description of the session. Like, say a client is using the server to record a meeting β the client can use Announce to inform the server of all the meta-information about the session.ANNOUNCEacts like an HTTPPUTorPOST, just likeCURL_RTSPREQ_SET_PARAMETERπCURL_RTSPREQ_SETUPβ Setup initializes the transport layer for the session. Your app must set the desired Transport options for a session using theCURLOPT_RTSP_TRANSPORT(3)option prior to calling setup (order matters, bestie, it's giving prerequisites π). If no session ID is currently set withCURLOPT_RTSP_SESSION_ID(3), libcurl extracts and uses the session ID in the response to this request. The session ID is not needed for this method.CURL_RTSPREQ_PLAYβ sends a Play command to the server. Use theCURLOPT_RANGE(3)option to modify the playback time (e.g.npt=10-15) βCURL_RTSPREQ_PAUSEβ sends a Pause command to the server. Use theCURLOPT_RANGE(3)option with a single value to indicate when the stream should be halted. (e.g.npt=25)CURL_RTSPREQ_TEARDOWNβ this command terminates an RTSP session. And ngl, simply closing a connection does not terminate the RTSP session, because it is valid to control an RTSP session over different connections. So yeah, you actually gotta send this one πCURL_RTSPREQ_GET_PARAMETERβ retrieves a parameter from the server. By default, libcurl adds aContent-Type: text/parametersheader on all non-empty requests unless a custom one is set.GET_PARAMETERacts just like an HTTPPUTorPOST(seeCURL_RTSPREQ_SET_PARAMETER). Applications wishing to send a heartbeat message (e.g. in the presence of a server-specified timeout) should use an emptyGET_PARAMETERrequest π©·CURL_RTSPREQ_SET_PARAMETERβ sets a parameter on the server. By default, libcurl uses a Content-Type: text/parameters header unless a custom one is set. The interaction withSET_PARAMETERis much like an HTTPPUTorPOST. An application may either useCURLOPT_UPLOAD(3)withCURLOPT_READDATA(3)like an HTTPPUT, or it may useCURLOPT_POSTFIELDS(3)like an HTTPPOST. No chunked transfers are allowed, so the application must set theCURLOPT_INFILESIZE(3)in the former andCURLOPT_POSTFIELDSIZE(3)in the latter. Also, there is no use of multi-part POSTs within RTSP β just so we're clear π§CURL_RTSPREQ_RECORDβ tells the server to record a session. Use theCURLOPT_RANGE(3)option to modify the record time πCURL_RTSPREQ_RECEIVEβ this one's special because it does not send any data to the server. The application may call this function in order to receive interleaved RTP data. It returns after processing one read buffer of data, so the application gets a chance to run. Main character energy: it hits pause on itself so you can go π¦
π DEFAULT π
(The original page leaves this section empty β so like, nothing documented here, no cap.)
π PROTOCOLS π
This functionality affects rtsp only. RTSP exclusive, iykyk π
π₯ EXAMPLE π₯
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
curl_easy_setopt(curl, CURLOPT_URL, "rtsp://example.com/");
/* ask for options */
curl_easy_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_OPTIONS);
result = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
}
Literal copy-paste-and-slay, bestie β¨
π¦ HISTORY π¦
CURL_RTSPREQ_* enums became long types in 8.13.0. Prior to this version, a long cast was necessary when passed to curl_easy_setopt(3). So if you're on old curl, cast it, don't fight it π
β AVAILABILITY β
Added in curl 7.20.0 π
π RETURN VALUE π
curl_easy_setopt(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK. Non-zero means an error occurred β see libcurl-errors(3) for the whole lore drop π
π SEE ALSO π
Okay that's the whole page, go be iconic with your RTSP requests π β¨ This was libcurl, dated 2026-10-12, signing off β 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