Mercurial > mplayer.hg
changeset 30626:27b133678bbd
Do not discard stream buffer on eof, instead reuse it to slightly improve
format autodetection with -nocache and non-seekable streams.
author | reimar |
---|---|
date | Sat, 20 Feb 2010 18:53:07 +0000 |
parents | bc29a1172753 |
children | 8ae498c98fec |
files | libmpdemux/demuxer.c stream/stream.c stream/stream.h |
diffstat | 3 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/demuxer.c Sat Feb 20 18:39:26 2010 +0000 +++ b/libmpdemux/demuxer.c Sat Feb 20 18:53:07 2010 +0000 @@ -247,7 +247,7 @@ "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; }
--- a/stream/stream.c Sat Feb 20 18:39:26 2010 +0000 +++ b/stream/stream.c Sat Feb 20 18:53:07 2010 +0000 @@ -264,7 +264,7 @@ 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 @@ 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 @@ 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);