[Mplayer-cvslog] CVS: main/libmpdemux demux_avi.c, 1.59, 1.60 network.c, 1.90, 1.91 stream.c, 1.71, 1.72 stream.h, 1.67, 1.68 stream_file.c, 1.4, 1.5

Roberto Togni CVS syncmail at mplayerhq.hu
Sat Mar 13 17:10:05 CET 2004


CVS change done by Roberto Togni CVS

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv10883

Modified Files:
	demux_avi.c network.c stream.c stream.h stream_file.c 
Log Message:
Seek in HTTP streams and stdin seek fixes
Patch by eviv bulgroz <ebulgroz(at)yahoo(dot)com>


Index: demux_avi.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_avi.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- demux_avi.c	17 Feb 2004 12:30:44 -0000	1.59
+++ demux_avi.c	13 Mar 2004 16:10:01 -0000	1.60
@@ -449,7 +449,7 @@
   demuxer->priv=(void*)priv;
 
   //---- AVI header:
-  read_avi_header(demuxer,(demuxer->stream->flags & STREAM_SEEK)?index_mode:-2);
+  read_avi_header(demuxer,(demuxer->stream->flags & STREAM_SEEK_BW)?index_mode:-2);
   
   if(demuxer->audio->id>=0 && !demuxer->a_streams[demuxer->audio->id]){
       mp_msg(MSGT_DEMUX,MSGL_WARN,"AVI: invalid audio stream ID: %d - ignoring (nosound)\n",demuxer->audio->id);

Index: network.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/network.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -r1.90 -r1.91
--- network.c	17 Feb 2004 12:30:44 -0000	1.90
+++ network.c	13 Mar 2004 16:10:02 -0000	1.91
@@ -754,7 +754,11 @@
 			streaming_ctrl->data = (void*)http_hdr;
 
 			// Check if we can make partial content requests and thus seek in http-streams
-		        seekable=(http_hdr!=NULL && http_hdr->status_code==200 && strncmp(http_get_field(http_hdr,"Accept-Ranges"),"bytes",5)==0);
+		        if( http_hdr!=NULL && http_hdr->status_code==200 ) {
+			    char *accept_ranges;
+			    if( (accept_ranges = http_get_field(http_hdr,"Accept-Ranges")) != NULL )
+				seekable = strncmp(accept_ranges,"bytes",5)==0;
+			} 
 
 			// Check if the response is an ICY status_code reason_phrase
 			if( !strcasecmp(http_hdr->protocol, "ICY") ) {

Index: stream.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/stream.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- stream.c	17 Feb 2004 12:30:45 -0000	1.71
+++ stream.c	13 Mar 2004 16:10:02 -0000	1.72
@@ -317,7 +317,7 @@
     if(s->seek) { // new stream seek is much cleaner than streaming_ctrl one
       if(!s->seek(s,newpos)) {
       	mp_msg(MSGT_STREAM,MSGL_ERR, "Seek failed\n");
-      	return 1;
+      	return 0;
       }
       break;
     }

Index: stream.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/stream.h,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- stream.h	17 Feb 2004 12:30:45 -0000	1.67
+++ stream.h	13 Mar 2004 16:10:02 -0000	1.68
@@ -229,7 +229,7 @@
 }
 
 inline static int stream_skip(stream_t *s,off_t len){
-  if(len<0 || (len>2*STREAM_BUFFER_SIZE && (s->flags & STREAM_SEEK))) {
+  if( (len<0 && (s->flags & STREAM_SEEK_BW)) || (len>2*STREAM_BUFFER_SIZE && (s->flags & STREAM_SEEK_FW)) ) {
     // negative or big skip!
     return stream_seek(s,stream_tell(s)+len);
   }

Index: stream_file.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/stream_file.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- stream_file.c	14 Aug 2003 12:15:43 -0000	1.4
+++ stream_file.c	13 Mar 2004 16:10:02 -0000	1.5
@@ -56,7 +56,11 @@
     return 0;
   }
   while(s->pos<newpos){
-    if(s->fill_buffer(s,s->buffer,STREAM_BUFFER_SIZE)<=0) break; // EOF
+    int len=s->fill_buffer(s,s->buffer,STREAM_BUFFER_SIZE);
+    if(len<=0){ s->eof=1; s->buf_pos=s->buf_len=0; break; } // EOF
+    s->buf_pos=0;
+    s->buf_len=len;
+    s->pos+=len;
   }
   return 1;
 }




More information about the MPlayer-cvslog mailing list