[Vorbis-dev] patch for non-seekable streams on Windows

Vidur Apparao vidur at slimdevices.com
Thu Oct 14 17:22:21 PDT 2004


Monty wrote:

>
>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.
>>    
>>
>
>Oh, and I forgot to say:  Thanks for tracking it down :-)
>
>Perhaps only some versions of windows have this bug?
>  
>
The problem occurs on Windows XP, suggesting that it's been around for a 
while in the NT flavors of Windows. FWIW, the Microsoft developer site 
(see 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_fseek.asp) 
says the following about its implementation of fseek:

"If successful, fseek returns 0. Otherwise, it returns a nonzero value. 
On devices incapable of seeking, the return value is undefined."

The last sentence implies that the implementation is not ANSI and POSIX 
compliant, no?





More information about the Vorbis-dev mailing list