CURLOPT_RTSP_STREAM_URI.md (1918B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_RTSP_STREAM_URI 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_RTSP_REQUEST (3) 9 - CURLOPT_RTSP_TRANSPORT (3) 10 Protocol: 11 - RTSP 12 Added-in: 7.20.0 13 --- 14 15 # NAME 16 17 CURLOPT_RTSP_STREAM_URI - RTSP stream URI 18 19 # SYNOPSIS 20 21 ~~~c 22 #include <curl/curl.h> 23 24 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RTSP_STREAM_URI, char *URI); 25 ~~~ 26 27 # DESCRIPTION 28 29 Set the stream *URI* to operate on by passing a char * . For example, a single 30 session may be controlling *rtsp://foo/twister/audio* and 31 *rtsp://foo/twister/video* and the application can switch to the appropriate 32 stream using this option. If unset, libcurl defaults to operating on generic 33 server options by passing '*' in the place of the RTSP Stream URI. This option 34 is distinct from CURLOPT_URL(3). When working with RTSP, the 35 CURLOPT_RTSP_STREAM_URI(3) indicates what URL to send to the server in the 36 request header while the CURLOPT_URL(3) indicates where to make the connection 37 to. (e.g. the CURLOPT_URL(3) for the above examples might be set to 38 *rtsp://foo/twister* 39 40 The application does not have to keep the string around after setting this 41 option. 42 43 Using this option multiple times makes the last set string override the 44 previous ones. Set it to NULL to disable its use again. 45 46 # DEFAULT 47 48 "*" 49 50 # %PROTOCOLS% 51 52 # EXAMPLE 53 54 ~~~c 55 int main(void) 56 { 57 CURL *curl = curl_easy_init(); 58 if(curl) { 59 CURLcode res; 60 curl_easy_setopt(curl, CURLOPT_URL, "rtsp://example.com/"); 61 curl_easy_setopt(curl, CURLOPT_RTSP_STREAM_URI, 62 "rtsp://foo.example.com/twister/video"); 63 res = curl_easy_perform(curl); 64 curl_easy_cleanup(curl); 65 } 66 } 67 ~~~ 68 69 # %AVAILABILITY% 70 71 # RETURN VALUE 72 73 curl_easy_setopt(3) returns a CURLcode indicating success or error. 74 75 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 76 libcurl-errors(3).