comparison stream/stream.h @ 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 ce0122361a39
children 77cc0ca2c757
comparison
equal deleted inserted replaced
30625:bc29a1172753 30626:27b133678bbd
280 280
281 inline static int stream_seek(stream_t *s,off_t pos){ 281 inline static int stream_seek(stream_t *s,off_t pos){
282 282
283 mp_dbg(MSGT_DEMUX, MSGL_DBG3, "seek to 0x%qX\n",(long long)pos); 283 mp_dbg(MSGT_DEMUX, MSGL_DBG3, "seek to 0x%qX\n",(long long)pos);
284 284
285 if(s->eof)
286 return 0;
285 if(pos<s->pos){ 287 if(pos<s->pos){
286 off_t x=pos-(s->pos-s->buf_len); 288 off_t x=pos-(s->pos-s->buf_len);
287 if(x>=0){ 289 if(x>=0){
288 s->buf_pos=x; 290 s->buf_pos=x;
289 // putchar('*');fflush(stdout); 291 // putchar('*');fflush(stdout);