diff libmpdemux/asf_streaming.c @ 4288:b84e9861461c

Changed the asf_file_header_t struct to read all the fields properly.
author bertrand
date Sun, 20 Jan 2002 21:38:11 +0000
parents c66fddd8867c
children 971836f677a9
line wrap: on
line diff
--- a/libmpdemux/asf_streaming.c	Sun Jan 20 19:08:56 2002 +0000
+++ b/libmpdemux/asf_streaming.c	Sun Jan 20 21:38:11 2002 +0000
@@ -209,15 +209,16 @@
       pos += sizeof(objh);
       memcpy(&fileh,buffer + pos,sizeof(fileh));
       le2me_ASF_file_header_t(&fileh);
+/*
       if(fileh.packetsize != fileh.packetsize2) {
 	printf("Error packetsize check don't match\n");
 	return -1;
       }
-      asf_ctrl->packet_size = fileh.packetsize;
-      // FIXME: preroll contains the amount of time to bufferize
-      // before playing. To be able to do that we need to
-      // read the timestamp of the first data packet and bufferize.
-      streaming_ctrl->prebuffer_size = fileh.preroll;
+*/
+      asf_ctrl->packet_size = fileh.max_packet_size;
+      // before playing. 
+      // preroll: time in ms to bufferize before playing
+      streaming_ctrl->prebuffer_size = (unsigned int)((double)((double)fileh.preroll/1000)*((double)fileh.max_bitrate/8));
       pos += sizeof(fileh);
       break;
     case 0xB7DC0791 : // stream header
@@ -655,9 +656,8 @@
 	} else {
 		stream->streaming_ctrl->streaming_read = asf_http_streaming_read;
 		stream->streaming_ctrl->streaming_seek = asf_http_streaming_seek;
+		stream->streaming_ctrl->buffering = 1;
 	}
-	stream->streaming_ctrl->prebuffer_size = 20000;
-	stream->streaming_ctrl->buffering = 1;
 	stream->streaming_ctrl->status = streaming_playing_e;
 
 	http_free( http_hdr );