summaryrefslogtreecommitdiffstats
path: root/libmpdemux/network.c
diff options
context:
space:
mode:
authorrtognimp <rtognimp@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-05-28 21:40:53 +0000
committerrtognimp <rtognimp@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-05-28 21:40:53 +0000
commit7f47ef5532312f2eebb2d002c8cd29dbe4682979 (patch)
tree18036f93fae59cc1cdd47ab90ac3d4ebaba915a8 /libmpdemux/network.c
parent39fe37918d72a05f1447574b418b75b40502f884 (diff)
downloadmpv-7f47ef5532312f2eebb2d002c8cd29dbe4682979.tar.bz2
mpv-7f47ef5532312f2eebb2d002c8cd29dbe4682979.tar.xz
Fix redirection in real rtsp connections.
Patch by yepyep (sdpplin.c part not committed) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10200 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/network.c')
-rw-r--r--libmpdemux/network.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/libmpdemux/network.c b/libmpdemux/network.c
index 6969f6f8f4..b09effa647 100644
--- a/libmpdemux/network.c
+++ b/libmpdemux/network.c
@@ -912,8 +912,15 @@ realrtsp_streaming_start( stream_t *stream ) {
rtsp_session_t *rtsp;
char *mrl;
int port;
+ int redirected, temp;
char aport[10];
if( stream==NULL ) return -1;
+
+ temp = 5; // counter so we don't get caught in infinite redirections (you never know)
+
+ do {
+
+ redirected = 0;
fd = connect2Server( stream->streaming_ctrl->url->hostname,
port = (stream->streaming_ctrl->url->port ? stream->streaming_ctrl->url->port : 554) );
@@ -925,9 +932,20 @@ realrtsp_streaming_start( stream_t *stream ) {
strcpy(mrl,stream->streaming_ctrl->url->url);
strcat(mrl,":");
strcat(mrl,aport);
- rtsp = rtsp_session_start(fd,mrl, stream->streaming_ctrl->url->file,
- stream->streaming_ctrl->url->hostname, port);
+ rtsp = rtsp_session_start(fd,&mrl, stream->streaming_ctrl->url->file,
+ stream->streaming_ctrl->url->hostname, port, &redirected);
+
+ if ( redirected == 1 ) {
+ url_free(stream->streaming_ctrl->url);
+ stream->streaming_ctrl->url = url_new(mrl);
+ close(fd);
+ }
+
free(mrl);
+ temp--;
+
+ } while( (redirected != 0) && (temp > 0) );
+
if(!rtsp) return -1;
stream->fd=fd;