Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: ogg/vorbis win32 sdk problem (Read 4370 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

ogg/vorbis win32 sdk problem

I have a very simple code to load an ogg file, it works ok under linux, but when used in windows it causes a crash at ov_open. I havent found any clue about what can be the origin of the problem.
Here is the code I use:

   
Code: [Select]
int result;
    
    if(!(oggFile = fopen(path.c_str(), "rb")))
        throw string("Could not open Ogg file.");

    if((result = ov_open(oggFile, &oggStream, NULL, 0)) < 0)
    {
        fclose(oggFile);

        throw string("Could not open Ogg stream. ") + errorString(result);
    }


Can somebody give me an idea?

ogg/vorbis win32 sdk problem

Reply #1
Does this help? (From the vorbisfile documentation.)
Quote
ov_open

declared in "vorbis/vorbisfile.h";

ov_open is one of three initialization functions used to initialize an OggVorbis_File structure and prepare a bitstream for playback.

WARNING for Windows developers: Do not use ov_open() in Windows applications; Windows linking places restrictions on passing FILE * handles successfully, and ov_open() runs afoul of these restrictions [a]. See the ov_open_callbacks() page for details on using ov_open_callbacks() instead.

However, I know from personal experience it works fine in console apps and it also works fine in oggdropXPd.

ogg/vorbis win32 sdk problem

Reply #2
I missed thet in the docs. I will try today, thanks.