81         if (rbuf[idx] == 
'\r') {
 
   83         } 
else if (rbuf[idx] == 
'\n') {
 
   89     } 
while (idx < rbufsize);
 
   95                            const char *extracontent, uint16_t seq)
 
  102             snprintf(message, 
sizeof(message), 
"RTSP/1.0 %d %s\r\n",
 
  110     av_strlcatf(message, 
sizeof(message), 
"CSeq: %d\r\n", seq);
 
  113         av_strlcat(message, extracontent, 
sizeof(message));
 
  115     av_dlog(s, 
"Sending response:\n%s", message);
 
  126     if (!session_id[0]) {
 
  130     if (strcmp(session_id, request->
session_id)) {
 
  147         ret = 
read_line(s, rbuf, 
sizeof(rbuf), &rbuflen);
 
  151             av_dlog(s, 
"Parsing[%d]: %s\n", rbuflen, rbuf);
 
  154     } 
while (rbuflen > 0);
 
  155     if (request->
seq != rt->
seq + 1) {
 
  160     if (rt->
session_id[0] && strcmp(method, 
"OPTIONS")) {
 
  191                    "Unable to get complete SDP Description in ANNOUNCE\n");
 
  204            "Content-Length header value exceeds sdp allocated buffer (4KB)\n");
 
  206                     "Content-Length exceeds buffer size", request.
seq);
 
  223                     "Public: ANNOUNCE, PAUSE, SETUP, TEARDOWN, RECORD\r\n",
 
  235     char responseheaders[1024];
 
  237     int transportidx = 0;
 
  256                    " protocol not supported (yet)\n");
 
  262                "using first of all\n");
 
  283         snprintf(responseheaders, 
sizeof(responseheaders), 
"Transport: " 
  284                  "RTP/AVP/TCP;unicast;mode=receive;interleaved=%d-%d" 
  289             ff_url_join(url, 
sizeof(url), 
"rtp", NULL, host, localport, NULL);
 
  290             av_dlog(s, 
"Opening: %s", url);
 
  309         snprintf(responseheaders, 
sizeof(responseheaders), 
"Transport: " 
  310                  "RTP/AVP/UDP;unicast;mode=receive;source=%s;" 
  311                  "client_port=%d-%d;server_port=%d-%d\r\n",
 
  323     av_strlcatf(responseheaders, 
sizeof(responseheaders), 
"Session: %s\r\n",
 
  337     char responseheaders[1024];
 
  346     snprintf(responseheaders, 
sizeof(responseheaders), 
"Session: %s\r\n",
 
  355                                      int linelen, 
char *uri, 
int urisize,
 
  356                                      char *method, 
int methodsize,
 
  360     const char *linept, *searchlinept;
 
  361     linept = strchr(line, 
' ');
 
  362     if (linept - line > methodsize - 1) {
 
  366     memcpy(method, line, linept - line);
 
  367     method[linept - line] = 
'\0';
 
  369     if (!strcmp(method, 
"ANNOUNCE"))
 
  371     else if (!strcmp(method, 
"OPTIONS"))
 
  373     else if (!strcmp(method, 
"RECORD"))
 
  375     else if (!strcmp(method, 
"SETUP"))
 
  377     else if (!strcmp(method, 
"PAUSE"))
 
  379     else if (!strcmp(method, 
"TEARDOWN"))
 
  392             && (*methodcode != 
SETUP)) {
 
  409     searchlinept = strchr(linept, 
' ');
 
  410     if (searchlinept == NULL) {
 
  414     if (searchlinept - linept > urisize - 1) {
 
  418     memcpy(uri, linept, searchlinept - linept);
 
  419     uri[searchlinept - linept] = 
'\0';
 
  421         char host[128], path[512], auth[128];
 
  423         char ctl_host[128], ctl_path[512], ctl_auth[128];
 
  425         av_url_split(NULL, 0, auth, 
sizeof(auth), host, 
sizeof(host), &port,
 
  426                      path, 
sizeof(path), uri);
 
  427         av_url_split(NULL, 0, ctl_auth, 
sizeof(ctl_auth), ctl_host,
 
  428                      sizeof(ctl_host), &ctl_port, ctl_path, 
sizeof(ctl_path),
 
  430         if (strcmp(host, ctl_host))
 
  433         if (strcmp(path, ctl_path) && *methodcode != 
SETUP)
 
  435                    " %s\n", path, ctl_path);
 
  438                    "Updating control URI to %s\n", uri);
 
  443     linept = searchlinept + 1;
 
  454     unsigned char rbuf[4096];
 
  455     unsigned char method[10];
 
  462     ret = 
read_line(s, rbuf, 
sizeof(rbuf), &rbuflen);
 
  466                              sizeof(method), &methodcode);
 
  476     if (methodcode == 
PAUSE) {
 
  480     } 
else if (methodcode == 
OPTIONS) {
 
  482                               "Public: ANNOUNCE, PAUSE, SETUP, TEARDOWN, " 
  483                               "RECORD\r\n", request.
seq);
 
  484     } 
else if (methodcode == 
TEARDOWN) {
 
  522                      "Range: npt=%"PRId64
".%03"PRId64
"-\r\n",
 
  571     unsigned char *content = NULL;
 
  576              "Accept: application/sdp\r\n");
 
  583                    "Require: com.real.retain-entity-for-setup\r\n",
 
  607     char host[128], path[512], auth[128];
 
  611     unsigned char rbuf[4096];
 
  612     unsigned char method[10];
 
  618     av_url_split(NULL, 0, auth, 
sizeof(auth), host, 
sizeof(host), &port,
 
  629     ff_url_join(tcpname, 
sizeof(tcpname), 
"tcp", NULL, host, port,
 
  640         ret = 
read_line(s, rbuf, 
sizeof(rbuf), &rbuflen);
 
  644                                  sizeof(method), &methodcode);
 
  653         } 
else if (methodcode == 
OPTIONS) {
 
  655         } 
else if (methodcode == 
RECORD) {
 
  659         } 
else if (methodcode == 
SETUP)
 
  720     av_dlog(s, 
"tcp_read_packet:\n");
 
  739     av_dlog(s, 
"id=%d len=%d\n", 
id, len);
 
  740     if (len > buf_size || len < 8)
 
  754             id <= rtsp_st->interleaved_max)
 
  769     av_url_split(NULL, 0, NULL, 0, host, 
sizeof(host), &port, NULL, 0,
 
  794                          "Unsubscribe: %s\r\n",
 
  805             int r, rule_nr, first = 1;
 
  892                           int64_t timestamp, 
int flags)
 
  936     .priv_class     = &rtsp_demuxer_class,