mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Send RTSP OPTIONS command to detect server type.
Originally committed as revision 15125 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
30aa6aed4a
commit
1cf151e9ae
@ -1045,6 +1045,7 @@ static int rtsp_read_header(AVFormatContext *s,
|
||||
RTSPHeader reply1, *reply = &reply1;
|
||||
unsigned char *content = NULL;
|
||||
int protocol_mask = 0;
|
||||
char real_challenge[64];
|
||||
|
||||
/* extract hostname and port */
|
||||
url_split(NULL, 0, NULL, 0,
|
||||
@ -1083,6 +1084,42 @@ static int rtsp_read_header(AVFormatContext *s,
|
||||
rt->rtsp_hd = rtsp_hd;
|
||||
rt->seq = 0;
|
||||
|
||||
/* request options supported by the server; this also detects server type */
|
||||
for (rt->server_type = RTSP_SERVER_RTP;;) {
|
||||
snprintf(cmd, sizeof(cmd),
|
||||
"OPTIONS %s RTSP/1.0\r\n", s->filename);
|
||||
if (rt->server_type == RTSP_SERVER_RDT)
|
||||
av_strlcat(cmd,
|
||||
/**
|
||||
* The following entries are required for proper
|
||||
* streaming from a Realmedia server. They are
|
||||
* interdependent in some way although we currently
|
||||
* don't quite understand how. Values were copied
|
||||
* from mplayer SVN r23589.
|
||||
* @param CompanyID is a 16-byte ID in base64
|
||||
* @param ClientChallenge is a 16-byte ID in hex
|
||||
*/
|
||||
"ClientChallenge: 9e26d33f2984236010ef6253fb1887f7\r\n"
|
||||
"PlayerStarttime: [28/03/2003:22:50:23 00:00]\r\n"
|
||||
"CompanyID: KnKV4M4I/B2FjJ1TToLycw==\r\n"
|
||||
"GUID: 00000000-0000-0000-0000-000000000000\r\n",
|
||||
sizeof(cmd));
|
||||
rtsp_send_cmd(s, cmd, reply, NULL);
|
||||
if (reply->status_code != RTSP_STATUS_OK) {
|
||||
err = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* detect server type if not standard-compliant RTP */
|
||||
if (rt->server_type != RTSP_SERVER_RDT && reply->real_challenge[0]) {
|
||||
rt->server_type = RTSP_SERVER_RDT;
|
||||
continue;
|
||||
} else if (rt->server_type == RTSP_SERVER_RDT) {
|
||||
strcpy(real_challenge, reply->real_challenge);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* describe the stream */
|
||||
snprintf(cmd, sizeof(cmd),
|
||||
"DESCRIBE %s RTSP/1.0\r\n"
|
||||
|
Loading…
Reference in New Issue
Block a user