[Ffmpeg-devel] Re: Re: Re: [PATCH] file length handling

Michael Niedermayer michaelni
Sat Dec 23 01:01:40 CET 2006


On Fri, Dec 22, 2006 at 09:38:31AM -0500, Ronald S. Bultje wrote:
> Hi,
> I'd like to add one additional note:
> On Fri, 2006-12-22 at 08:25 -0500, Ronald S. Bultje wrote:
> > > i think the simplest solution would be to handle seeking in http like
> > > 
> > > seek(){
> > >     find new position
> > >     c->req_off= position
> > >     return positon
> > > }
> > > 
> > > read(){
> > >     if(c->req_off != c->off){
> > >         perform actual seek
> > >         c->off= c->req_off;
> > >     }
> > >     ...
> > > }
> > > 
> > > this would also not break compatibility though that is only a minor
> > > advantage due to AVFrac ...
> > 
> > I don't mind doing this, I'm just not a huge fan of this asynchronous
> > programming... I kind of consider this hacky.

iam not happy with it either but we must find some solution ...

> I don't know if there's any always-right way to detect whether the
> server supports range requests. It's part of HTTP 1.1, but not required.
> Servers could stream live content. I currently use the HTTP header to
> see if the range request worked (Content-Range: bytes %from-%to/%total),
> and if I seek asynchronously, I wouldn't be able to do this anymore. I
> can of course seek during the first open() and see if it works, but
> that's more of a hack than anything else.

maybe but independant of the filesize thing, if is_streamed is set incorrectly
then this could have quite negative effects, if is_streamed didnt matter then
we could remove it ... one variable less ...

as an example of the problem lets consider avi, is_streamed=0, the demuxer
tries to read the odml index, no problem the seek succeeds, its inside the
buffer, but not the whole odml index fits in the buffer so the buffer is
refilled with new data, after the odml index the demuxer tries to seek back
and BOOM failure ...

so either all protocols set is_streamed correctly or we need a unknown
is_streamed state in which case a dummy seek would be attempted by a
generic layer if url_is_streamed() is called to set is_streamed correctly
but i dunno if this actually is a good idea

so besides being hackish, is there another disadvantage of a dummy seek?
how much time does it cost on a slow network connection?

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you really think that XML is the answer, then you definitly missunderstood
the question -- Attila Kinali
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20061223/22f6f851/attachment.pgp>

More information about the ffmpeg-devel mailing list