[vorbis-dev] Problem with 'ov_open'...
msmith at xiph.org
Mon Feb 9 17:19:20 PST 2004
On Tuesday 10 February 2004 06:49, Ryan Ashley wrote:
> Hey, I've coded an OGG player for Win32 (it uses AL for playback so it's
> portable to Linux/Mac), but every time the program gets to the 'ov_open()'
> function, the app completely freezes, and I have to use the task-manager to
> kill it. I am supplying it with a valid file handle that was just opened
> (FILE*) and the vorbis file is also a pointer that is not in use (set to
> null). Any ideas why this is happenening? Here is my actual source.
> FILE *SoundFile;
> OggVorbis_File *OVFile;
This is wrong, you only have a pointer to the struct here, no actual struct.
So you need to allocate some storage for it. You can stack-allocate this with
> if(SoundFile != NULL)
This is wrong, you haven't opened the file yet - you need to do this later
(after the fopen()).
> if((SoundFile = fopen(Filename, "rb")) == NULL)
> return false;
> if((ov_open(SoundFile, OVFile, NULL, 0)) < 0)
> return false;
And here, you need to actually pass a pointer to an OggVorbis_File, not just a
pointer that doesn't point to anything at all. Given the suggestion above,
if((ov_open(SoundFile, &OVFile, NULL, 0)) < 0)
> I've put debug messages that my log-class logs, and it logs everything just
> fine up to the ov_open() check, then nothing.
Why it's hanging here I don't know - given your code, I'd expect it to just
crash. Perhaps Jon's suggestion that you're using the wrong libraries is
correct? Also, make sure you have version 1.0.1 of the libraries - version
1.0 had some bugs that could, for certain unusual streams (mostly very short
ones, i think) cause some hangs.
<p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the Vorbis-dev