[MPlayer-dev-eng] [PATCH] stream seek eof handling

Laurent laurent.aml at gmail.com
Tue Oct 21 15:51:41 CEST 2008


On 10/17/08, Uoti Urpala <uoti.urpala at pp1.inet.fi> wrote:
> On Fri, 2008-10-17 at 11:52 -0400, Laurent wrote:
> > Here is an attempt to clean this issue.
> >
> > * stream_t->eof flag is cleared when seek succeeds.
> >
> > * EOF and past EOF positions are valid for seek. Though, following
> > read will fail.
> > At least, this allows lavc to detect end of streams by checking if the
> > current stream position is equal or past the EOF position (what lavc
> > does).
>
> > +if ((pos+newpos) >= s->end_pos) {
>
> This assumes that all seekable streams have a length that is known in
> advance. IMO such assumptions should not be required. Wouldn't it be
> enough to make the seek function work as follows?
>
> 1) reset ->eof at start of seek attempt
> 2) return success even if the subsequent stream_fill_buffer() fails
>
> This could still return failure if the underlying stream type seek call
> fails when trying to seek to EOF or later, but at least the common types
> I looked at don't seem to do that at EOF.

Ok.
Here is a new proposal:
* EOF cleared when the underlying seek succeeds. If seek fails, I see
no reason to change the EOF state.
* (pos >= 0) test removed from while, as it is always true.
* Success condition fixed in the while: pos has to be strictly less
than buf_len, otherwise it points past the current buffer.
* When stream_fill_buffer fails, the stream position is nevertheless
increased, so lavc EOF condition is reached. Also returns success.

Thanks,

Laurent
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: stream-stream.c-eoffix.patch
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20081021/6d7a7d2e/attachment.asc>


More information about the MPlayer-dev-eng mailing list