Archived

This topic is now archived and is closed to further replies.

Ogg Vorbis OV_EBADHEADER

This topic is 5812 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Anyone know what causes the vorbisfile library function ov_open to return OV_EBADHEADER? The docs list it as meaning "Invalid Vorbis bitstream header", but they don''t say what can be done about it. Is this caused by something being wrong with the .ogg file I''m trying to load? The file plays just fine via winamp''s vorbis decoder, so I''m thinking it might be something in my code... Here''s the relevant section: //Open file FILE *filePoint = fopen(fileName.data(), "r"); //Init vorbisfile lib OggVorbis_File vorbisFile; ZeroMemory(&vorbisFile, sizeof(OggVorbis_File)); int ret = ov_open(filePoint, &vorbisFile, NULL, 0); ov_open returns the OV_EBADHEADER error value. I''ve tried multiple ogg files. They all give the same error. Anyone run into this before?

Share this post


Link to post
Share on other sites
hell....

ov_open isn''t exactly the most complex call in the world. There''s really only the one way to call it in most instances, and the SDK example does it the same way. I''m using the same .lib as everyone else, so what gives?

Could it be something to do with the fopen? Another mode perhaps?

Share this post


Link to post
Share on other sites
quote:
Original post by PyroBoy
Anyone know what causes the vorbisfile library function ov_open to return OV_EBADHEADER? The docs list it as meaning "Invalid Vorbis bitstream header", but they don''t say what can be done about it.
Is this caused by something being wrong with the .ogg file I''m trying to load? The file plays just fine via winamp''s vorbis decoder, so I''m thinking it might be something in my code... Here''s the relevant section:

//Open file
FILE *filePoint = fopen(fileName.data(), "r");

//Init vorbisfile lib
OggVorbis_File vorbisFile;
ZeroMemory(&vorbisFile, sizeof(OggVorbis_File));
int ret = ov_open(filePoint, &vorbisFile, NULL, 0);

ov_open returns the OV_EBADHEADER error value.

I''ve tried multiple ogg files. They all give the same error. Anyone run into this before?




make it... ''b'' = binary mode which YOU REALLY NEED <.<

FILE *filePoint = fopen(fileName.data(), "rb");




Share this post


Link to post
Share on other sites
quote:
Original post by Ranger_One
make it... ''b'' = binary mode which YOU REALLY NEED <.<


Yes, you''re right, Windows needs to be specifically told to use binary mode or it mangles the data. Good idea, I forgot all about Windows .

[Resist Windows XP''s Invasive Production Activation Technology!]

Share this post


Link to post
Share on other sites
That did it! Thanks a lot!

Come to think of it, the example *did* make a big deal about binary mode in win32, but it used stdin to read the stream, not fopen. I guess I should have figured it would be the same deal.

Share this post


Link to post
Share on other sites