CURLOPT_RTSP_REQUEST.md (4478B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_RTSP_REQUEST 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_RTSP_SESSION_ID (3) 9 - CURLOPT_RTSP_STREAM_URI (3) 10 Protocol: 11 - RTSP 12 Added-in: 7.20.0 13 --- 14 15 # NAME 16 17 CURLOPT_RTSP_REQUEST - RTSP request 18 19 # SYNOPSIS 20 21 ~~~c 22 #include <curl/curl.h> 23 24 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RTSP_REQUEST, long request); 25 ~~~ 26 27 # DESCRIPTION 28 29 Tell libcurl what kind of RTSP request to make. Pass one of the following RTSP 30 enum values as a long in the *request* argument. Unless noted otherwise, 31 commands require the Session ID to be initialized. 32 33 ## CURL_RTSPREQ_OPTIONS 34 35 Used to retrieve the available methods of the server. The application is 36 responsible for parsing and obeying the response. The session ID is not needed 37 for this method. 38 39 ## CURL_RTSPREQ_DESCRIBE 40 41 Used to get the low level description of a stream. The application should note 42 what formats it understands in the *'Accept:'* header. Unless set manually, 43 libcurl automatically adds in *'Accept: application/sdp'*. Time-condition 44 headers are added to Describe requests if the CURLOPT_TIMECONDITION(3) 45 option is used. (The session ID is not needed for this method) 46 47 ## CURL_RTSPREQ_ANNOUNCE 48 49 When sent by a client, this method changes the description of the session. For 50 example, if a client is using the server to record a meeting, the client can 51 use Announce to inform the server of all the meta-information about the 52 session. ANNOUNCE acts like an HTTP PUT or POST just like 53 *CURL_RTSPREQ_SET_PARAMETER* 54 55 ## CURL_RTSPREQ_SETUP 56 57 Setup is used to initialize the transport layer for the session. The 58 application must set the desired Transport options for a session by using the 59 CURLOPT_RTSP_TRANSPORT(3) option prior to calling setup. If no session 60 ID is currently set with CURLOPT_RTSP_SESSION_ID(3), libcurl extracts 61 and uses the session ID in the response to this request. The session ID is not 62 needed for this method. 63 64 ## CURL_RTSPREQ_PLAY 65 66 Send a Play command to the server. Use the CURLOPT_RANGE(3) option to 67 modify the playback time (e.g. *npt=10-15*). 68 69 ## CURL_RTSPREQ_PAUSE 70 71 Send a Pause command to the server. Use the CURLOPT_RANGE(3) option with 72 a single value to indicate when the stream should be 73 halted. (e.g. *npt=25*) 74 75 ## CURL_RTSPREQ_TEARDOWN 76 77 This command terminates an RTSP session. Simply closing a connection does not 78 terminate the RTSP session since it is valid to control an RTSP session over 79 different connections. 80 81 ## CURL_RTSPREQ_GET_PARAMETER 82 83 Retrieve a parameter from the server. By default, libcurl adds a 84 *Content-Type: text/parameters* header on all non-empty requests unless a 85 custom one is set. GET_PARAMETER acts just like an HTTP PUT or POST (see 86 *CURL_RTSPREQ_SET_PARAMETER*). Applications wishing to send a heartbeat 87 message (e.g. in the presence of a server-specified timeout) should send use 88 an empty GET_PARAMETER request. 89 90 ## CURL_RTSPREQ_SET_PARAMETER 91 92 Set a parameter on the server. By default, libcurl uses a *Content-Type: 93 text/parameters* header unless a custom one is set. The interaction with 94 SET_PARAMETER is much like an HTTP PUT or POST. An application may either use 95 CURLOPT_UPLOAD(3) with CURLOPT_READDATA(3) like an HTTP PUT, or it may use 96 CURLOPT_POSTFIELDS(3) like an HTTP POST. No chunked transfers are allowed, so 97 the application must set the CURLOPT_INFILESIZE(3) in the former and 98 CURLOPT_POSTFIELDSIZE(3) in the latter. Also, there is no use of multi-part 99 POSTs within RTSP. 100 101 ## CURL_RTSPREQ_RECORD 102 103 Used to tell the server to record a session. Use the CURLOPT_RANGE(3) 104 option to modify the record time. 105 106 ## CURL_RTSPREQ_RECEIVE 107 108 This is a special request because it does not send any data to the server. The 109 application may call this function in order to receive interleaved RTP 110 data. It returns after processing one read buffer of data in order to give the 111 application a chance to run. 112 113 # DEFAULT 114 115 # %PROTOCOLS% 116 117 # EXAMPLE 118 119 ~~~c 120 int main(void) 121 { 122 CURL *curl = curl_easy_init(); 123 if(curl) { 124 CURLcode res; 125 curl_easy_setopt(curl, CURLOPT_URL, "rtsp://example.com/"); 126 /* ask for options */ 127 curl_easy_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_OPTIONS); 128 res = curl_easy_perform(curl); 129 curl_easy_cleanup(curl); 130 } 131 } 132 ~~~ 133 134 # %AVAILABILITY% 135 136 # RETURN VALUE 137 138 curl_easy_setopt(3) returns a CURLcode indicating success or error. 139 140 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 141 libcurl-errors(3).