[Vorbis-dev] patch for non-seekable streams on Windows
Monty
xiphmont at xiph.org
Thu Oct 14 17:10:20 PDT 2004
On Thu, Oct 14, 2004 at 04:59:34PM -0700, Vidur Apparao wrote:
>
> I've been trying to get oggdec to work with input streamed in through a
> pipe or a socket. This seems to work on Linux and OS X, but not on
> Windows. I've found that code in vorbisfile.c tests the input stream for
> seekability by invoking fseek in the following way:
>
> int offsettest=(f?callbacks.seek_func(f,0,SEEK_CUR) : -1);
>
> Unfortunately, fseek succeeds for a socket on Windows (even though it's
> not seekable) with the parameters specified. A more definitive test (and
> one that does work on Windows) is to attempt to seek to the end. I've
> attached a patch to vorbisfile.c that fixes my problem.
Note that the line we're using is the authoritative/suggested
technique straight from ANSI and Stevens (and more recently POSIX)
for testing seekability. Windows getting it wrong is not surprising,
but it's in violation of its conformance claims if that is true.
I make that point only because blindly changing the line to work on
Windows does not guarantee it will work properly on any other
platform. We may need to #ifdef this; I'll consult my ANSI and POSIX
refs tonight.
Sigh. You'd think after thirty years of ANSI stdio, Win32 would get
the simple stuff right....
Monty
More information about the Vorbis-dev
mailing list