[MPlayer-cvslog] r30668 - in trunk: libmpdemux/demuxer.c stream/stream.c stream/stream.h

reimar subversion at mplayerhq.hu
Sat Feb 20 19:53:07 CET 2010


Author: reimar
Date: Sat Feb 20 19:53:07 2010
New Revision: 30668

Log:
Do not discard stream buffer on eof, instead reuse it to slightly improve
format autodetection with -nocache and non-seekable streams.

Modified:
   trunk/libmpdemux/demuxer.c
   trunk/stream/stream.c
   trunk/stream/stream.h

Modified: trunk/libmpdemux/demuxer.c
==============================================================================
--- trunk/libmpdemux/demuxer.c	Sat Feb 20 19:39:26 2010	(r30667)
+++ trunk/libmpdemux/demuxer.c	Sat Feb 20 19:53:07 2010	(r30668)
@@ -247,7 +247,7 @@ demuxer_t *new_demuxer(stream_t *stream,
                    "big troubles ahead.");
     if (filename) // Filename hack for avs_check_file
         d->filename = strdup(filename);
-    stream_reset(stream);
+    stream->eof = 0;
     stream_seek(stream, stream->start_pos);
     return d;
 }

Modified: trunk/stream/stream.c
==============================================================================
--- trunk/stream/stream.c	Sat Feb 20 19:39:26 2010	(r30667)
+++ trunk/stream/stream.c	Sat Feb 20 19:53:07 2010	(r30668)
@@ -264,7 +264,7 @@ stream_t* open_output_stream(char* filen
 
 int stream_fill_buffer(stream_t *s){
   int len;
-  if (/*s->fd == NULL ||*/ s->eof) { s->buf_pos = s->buf_len = 0; return 0; }
+  if (/*s->fd == NULL ||*/ s->eof) { return 0; }
   switch(s->type){
   case STREAMTYPE_STREAM:
 #ifdef CONFIG_NETWORK
@@ -285,7 +285,7 @@ int stream_fill_buffer(stream_t *s){
   default:
     len= s->fill_buffer ? s->fill_buffer(s,s->buffer,STREAM_BUFFER_SIZE) : 0;
   }
-  if(len<=0){ s->eof=1; s->buf_pos=s->buf_len=0; return 0; }
+  if(len<=0){ s->eof=1; return 0; }
   s->buf_pos=0;
   s->buf_len=len;
   s->pos+=len;
@@ -392,8 +392,8 @@ while(stream_fill_buffer(s) > 0 && pos >
 
 void stream_reset(stream_t *s){
   if(s->eof){
-    s->pos=0; //ftell(f);
-//    s->buf_pos=s->buf_len=0;
+    s->pos=0;
+    s->buf_pos=s->buf_len=0;
     s->eof=0;
   }
   if(s->control) s->control(s,STREAM_CTRL_RESET,NULL);

Modified: trunk/stream/stream.h
==============================================================================
--- trunk/stream/stream.h	Sat Feb 20 19:39:26 2010	(r30667)
+++ trunk/stream/stream.h	Sat Feb 20 19:53:07 2010	(r30668)
@@ -282,6 +282,8 @@ inline static int stream_seek(stream_t *
 
   mp_dbg(MSGT_DEMUX, MSGL_DBG3, "seek to 0x%qX\n",(long long)pos);
 
+  if(s->eof)
+    return 0;
   if(pos<s->pos){
     off_t x=pos-(s->pos-s->buf_len);
     if(x>=0){


More information about the MPlayer-cvslog mailing list