diff --git a/libmpdemux/demux_avi.c b/libmpdemux/demux_avi.c index c209e6a37c..9d2fa17f1d 100644 --- a/libmpdemux/demux_avi.c +++ b/libmpdemux/demux_avi.c @@ -449,7 +449,7 @@ demuxer_t* demux_open_avi(demuxer_t* demuxer){ 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); diff --git a/libmpdemux/network.c b/libmpdemux/network.c index 455130dd83..6597434411 100644 --- a/libmpdemux/network.c +++ b/libmpdemux/network.c @@ -754,7 +754,11 @@ extension=NULL; 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") ) { diff --git a/libmpdemux/stream.c b/libmpdemux/stream.c index 96e8bc1122..cf211d38ac 100644 --- a/libmpdemux/stream.c +++ b/libmpdemux/stream.c @@ -317,7 +317,7 @@ if(newpos==0 || newpos!=s->pos){ 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; } diff --git a/libmpdemux/stream.h b/libmpdemux/stream.h index 07ba4d93a4..df0df18afb 100644 --- a/libmpdemux/stream.h +++ b/libmpdemux/stream.h @@ -229,7 +229,7 @@ inline static int stream_seek(stream_t *s,off_t pos){ } 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); } diff --git a/libmpdemux/stream_file.c b/libmpdemux/stream_file.c index a32d19fbc1..974171ecc2 100644 --- a/libmpdemux/stream_file.c +++ b/libmpdemux/stream_file.c @@ -56,7 +56,11 @@ static int seek_forward(stream_t *s,off_t newpos) { return 0; } while(s->posfill_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; }