Mercurial > libavformat.hg
comparison rtsp.c @ 4332:0d776969b708 libavformat
Fix the Transport: line in the SETUP request so that it works with WMS
servers when trying to set up a session over TCP:
- add the interleave property
- add unicast, only for WMS (since it is normally only UDP, but WMS expects it
for UDP and TCP)
- add mode=play
See discussion in "[PATCH] RTSP-MS 9/15: add interleave property to the TCP
transport line of the SETUP request" thread on mailinglist.
| author | rbultje |
|---|---|
| date | Sun, 01 Feb 2009 13:37:45 +0000 |
| parents | f49e5d92ab26 |
| children | 3ae604db67e0 |
comparison
equal
deleted
inserted
replaced
| 4331:49c1d3b27727 | 4332:0d776969b708 |
|---|---|
| 884 static int | 884 static int |
| 885 make_setup_request (AVFormatContext *s, const char *host, int port, | 885 make_setup_request (AVFormatContext *s, const char *host, int port, |
| 886 int lower_transport, const char *real_challenge) | 886 int lower_transport, const char *real_challenge) |
| 887 { | 887 { |
| 888 RTSPState *rt = s->priv_data; | 888 RTSPState *rt = s->priv_data; |
| 889 int j, i, err; | 889 int j, i, err, interleave = 0; |
| 890 RTSPStream *rtsp_st; | 890 RTSPStream *rtsp_st; |
| 891 RTSPHeader reply1, *reply = &reply1; | 891 RTSPHeader reply1, *reply = &reply1; |
| 892 char cmd[2048]; | 892 char cmd[2048]; |
| 893 const char *trans_pref; | 893 const char *trans_pref; |
| 894 | 894 |
| 941 } | 941 } |
| 942 | 942 |
| 943 /* RTP/TCP */ | 943 /* RTP/TCP */ |
| 944 else if (lower_transport == RTSP_LOWER_TRANSPORT_TCP) { | 944 else if (lower_transport == RTSP_LOWER_TRANSPORT_TCP) { |
| 945 snprintf(transport, sizeof(transport) - 1, | 945 snprintf(transport, sizeof(transport) - 1, |
| 946 "%s/TCP", trans_pref); | 946 "%s/TCP;", trans_pref); |
| 947 if (rt->server_type == RTSP_SERVER_WMS) | |
| 948 av_strlcat(transport, "unicast;", sizeof(transport)); | |
| 949 av_strlcatf(transport, sizeof(transport), | |
| 950 "interleaved=%d-%d", | |
| 951 interleave, interleave + 1); | |
| 952 interleave += 2; | |
| 947 } | 953 } |
| 948 | 954 |
| 949 else if (lower_transport == RTSP_LOWER_TRANSPORT_UDP_MULTICAST) { | 955 else if (lower_transport == RTSP_LOWER_TRANSPORT_UDP_MULTICAST) { |
| 950 snprintf(transport, sizeof(transport) - 1, | 956 snprintf(transport, sizeof(transport) - 1, |
| 951 "%s/UDP;multicast", trans_pref); | 957 "%s/UDP;multicast", trans_pref); |
| 952 } | 958 } |
| 953 if (rt->server_type == RTSP_SERVER_REAL) | 959 if (rt->server_type == RTSP_SERVER_REAL || |
| 960 rt->server_type == RTSP_SERVER_WMS) | |
| 954 av_strlcat(transport, ";mode=play", sizeof(transport)); | 961 av_strlcat(transport, ";mode=play", sizeof(transport)); |
| 955 snprintf(cmd, sizeof(cmd), | 962 snprintf(cmd, sizeof(cmd), |
| 956 "SETUP %s RTSP/1.0\r\n" | 963 "SETUP %s RTSP/1.0\r\n" |
| 957 "Transport: %s\r\n", | 964 "Transport: %s\r\n", |
| 958 rtsp_st->control_url, transport); | 965 rtsp_st->control_url, transport); |
