[Mplayer-cvslog] CVS: main/libmpdemux network.c,1.80,1.81

Roberto Togni CVS rtognimp at mplayerhq.hu
Wed May 28 23:40:55 CEST 2003


Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv10659

Modified Files:
	network.c 
Log Message:
Fix redirection in real rtsp connections.
Patch by yepyep (sdpplin.c part not committed)



Index: network.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/network.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -r1.80 -r1.81
--- network.c	23 May 2003 19:41:37 -0000	1.80
+++ network.c	28 May 2003 21:40:24 -0000	1.81
@@ -912,8 +912,15 @@
 	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 @@
 	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;



More information about the MPlayer-cvslog mailing list