[Mplayer-cvslog] CVS: main/libmpdemux network.c,1.20,1.21 asf_streaming.c,1.15,1.16

Arpi of Ize arpi at mplayer.dev.hu
Tue Jan 8 02:13:50 CET 2002


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

Modified Files:
	network.c asf_streaming.c 
Log Message:
various small streaming fixes by Alban Bedel <albeu at free.fr>

Index: network.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/network.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- network.c	25 Dec 2001 16:35:57 -0000	1.20
+++ network.c	8 Jan 2002 01:13:22 -0000	1.21
@@ -147,7 +147,7 @@
 			return -1;
 		}
 	}
-	tv.tv_sec = 5;	// 5 seconds timeout on connection
+	tv.tv_sec = 15;	// 15 seconds timeout on connection
 	tv.tv_usec = 0;	
 	FD_ZERO( &set );
 	FD_SET( socket_server_fd, &set );
@@ -569,12 +569,17 @@
 	}
 	
 	stream->streaming_ctrl->url = url_copy(url);
-//	stream->streaming_ctrl->demuxer_type = demuxer_type;
-	stream->fd = -1;
+//	stream->streaming_ctrl->demuxer_type = demuxer_type;	
 
 	// For RTP streams, we usually don't know the stream type until we open it.
 	if( !strcmp( url->protocol, "rtp"))
 	{
+		if(stream->fd >= 0) 
+		{
+			if(close(stream->fd) < 0)
+				printf("streaming_start : Closing socket %d failed %s\n",stream->fd,strerror(errno));
+		}
+		stream->fd = -1;
 		stream->fd = rtp_streaming_start( stream );
 	}
 	// For connection-oriented streams, we can usually determine the streaming type.

Index: asf_streaming.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/asf_streaming.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- asf_streaming.c	25 Dec 2001 11:40:10 -0000	1.15
+++ asf_streaming.c	8 Jan 2002 01:13:22 -0000	1.16
@@ -214,7 +214,7 @@
 asf_http_streaming_read( int fd, char *buffer, int size, streaming_ctrl_t *streaming_ctrl ) {
   static ASF_stream_chunck_t chunk;
   int read,chunk_size = 0;
-  static int rest = 0, drop_chunk = 0, waiting = 0;
+  static int rest = 0, drop_chunk = 0, waiting = 0,eof= 0;
   asf_http_streaming_ctrl_t *asf_http_ctrl = (asf_http_streaming_ctrl_t*)streaming_ctrl->data;
 
   while(1) {
@@ -224,8 +224,9 @@
 	int r = nop_streaming_read( fd, ((char*)&chunk) + read, 
 				    sizeof(ASF_stream_chunck_t)-read, 
 				    streaming_ctrl );
-	if(r < 0){
-	  printf("End of stream without a full chunk header\n");
+	if(r <= 0){
+	  if( r < 0) 
+	    printf("Error while reading chunk header\n");
 	  return -1;
 	}
 	read += r;
@@ -260,8 +261,9 @@
       }
       while(read < chunk_size) {
 	int got = nop_streaming_read( fd,buffer+read,chunk_size-read,streaming_ctrl );
-	if(got < 0) {
-	  printf("Error while reading chunk EOF ?\n");
+	if(got <= 0) {
+	  if(got < 0)
+	    printf("Error while reading chunk\n");
 	  return -1;
 	}
 	read += got;
@@ -610,18 +612,15 @@
 				}
 				break;
 			case ASF_Redirector_e:
-				url_next = asf_http_ASX_redirect( http_hdr );
-				if( url_next==NULL ) {
-					printf("Failed to parse ASX file\n");
-					close(fd);
-					http_free( http_hdr );
-					return -1;
-				}
-				url_free( stream->streaming_ctrl->url );
-				stream->streaming_ctrl->url = url_next;
-				url = url_next;
-				done = 0;
-				break;
+			  if( http_hdr->body_size>0 ) {
+			    if( streaming_bufferize( stream->streaming_ctrl, http_hdr->body, http_hdr->body_size )<0 ) {
+			      http_free( http_hdr );
+			      return -1;
+			    }
+			  }
+			  stream->type = STREAMTYPE_PLAYLIST;
+			  done = 1;
+			  break;
 			case ASF_Unknown_e:
 			default:
 				printf("Unknown ASF streaming type\n");
@@ -633,7 +632,7 @@
 	} while(!done);
 
 	stream->fd= fd;
-	if( streaming_type==ASF_PlainText_e ) {
+	if( streaming_type==ASF_PlainText_e || streaming_type==ASF_Redirector_e ) {
 		stream->streaming_ctrl->streaming_read = nop_streaming_read;
 		stream->streaming_ctrl->streaming_seek = nop_streaming_seek;
 	} else {




More information about the MPlayer-cvslog mailing list