[MPlayer-dev-eng] Re: [PATCH] make demuxer_get_percent_pos() recheck file length

Jan Knutar jknutar at nic.fi
Mon Oct 3 23:36:12 CEST 2005


On Tuesday 04 October 2005 00:25, Rich Felker wrote:

> > > I dunno anything about windows API, but does it have integer file 
> > > descriptors?
> > 
> > More importantly, for example a network file descriptor and a regular file
> > descriptor are different under Windows and you can't use the same calls
> > on them (i.e. if you have a network one you can't read() it). Dunno if
> > mingw/cygwin hides this from you though. I suspect MinGW/MSYS does
> > not.
> 
> Of course cygwin 'hides' it since it's in blatent violation of posix.
> Unfortunately mingw doesn't. :(

More importantly, what I was getting at, which also Oded was trying to convince
people, is that it's extremely unsafe to use the fd for anything. We should really
have everything go through the stream layer, and let the stream layer work
out the details. Having #ifdef windows in code outside stream layer will just create
a big mess, especially if MPlayer is to be ever ported to any other non-nix system
than win32. *nix is pretty lenient in letting you abuse fd's however you want, but
that's not true for other systems.

This creates another problem though, consider playback over http, ftp or nfs, and file.
Over file, checking whether the file has grown is pretty inexpensive, over nfs too. Over
http, it can be quite expensive though, same for ftp.

Over http you can post a HEAD request to query the current size, however it'll take atleast
quarter of a second in average case, unacceptable to do inline...

Maybe there should be some sort of hint about whether stat will be fast or slow and whether
seeks will be fast or slow.....




More information about the MPlayer-dev-eng mailing list