[Ffmpeg-devel] file length / http

Michael Niedermayer michaelni
Mon Dec 18 11:14:47 CET 2006


On Sun, Dec 17, 2006 at 10:15:48PM -0500, Ronald S. Bultje wrote:
> Hi all,
> I've looked at the input provided to my http seeking patch, and am also
> looking at making sure it works correctly with both seekable and
> unseekable servers without too much trouble.
> One thing I noticed is that a lot of demuxers currently use SEEK_END, -1
> followed by SEEK_SET, 0 to find out the length of a file. Worse yet,
> url_fsize() is implemented in exactly that manner.
> This is OK for files. However, for streams, this can cause considerable
> delay while reopening the HTTP/tcp connection. Also, this will not
> always work, e.g. if the server doesn't support seeking. Still, the file
> length may be known (through the http Content-Length property in the
> reply header).
> Would anyone oppose if instead, I add a "length" value into URLContext?


> For files that are still being written, I can update it after every
> read(). 

        return c->file_size;

no need to mess with non http protocols, just keep file_size at 0

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope

More information about the ffmpeg-devel mailing list