We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1480 - SDL_sound unable to decode Ogg Vorbis file
Summary: SDL_sound unable to decode Ogg Vorbis file
Status: NEW
Alias: None
Product: SDL_sound
Classification: Unclassified
Component: everything (show other bugs)
Version: unspecified
Hardware: x86_64 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Ryan C. Gordon
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-21 14:01 UTC by Nikos Chantziaras
Modified: 2012-04-21 14:01 UTC (History)
0 users

See Also:


Attachments
Ogg Vorbis file that cannot be decoded (73.76 KB, video/ogg)
2012-04-21 14:01 UTC, Nikos Chantziaras
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nikos Chantziaras 2012-04-21 14:01:30 UTC
Created attachment 847 [details]
Ogg Vorbis file that cannot be decoded

SDL_sound (current hg stable-1.0) cannot decode the attached file in whole.  A part of it is decoded, but at the wrong samplerate.  The SOUND_SAMPLEFLAG_ERROR is set in the sample, but Sound_GetError() doesn't return anything.

SDL_mixer has no problems decoding the file with Mix_LoadWAV_RW, so it's not a problem with the file.  SDL_mixer is unsuitable though, because it doesn't support partial decoding; it decodes the whole file in one go.

libvorbis 1.3.2
libogg 1.3.0

This is a test program that demonstrates the bug:

#include <stdio.h>
#include <SDL_sound.h>

int main(void)
{
    if (SDL_Init(SDL_INIT_AUDIO) != 0) {
        printf("SDL_Init() failed: %s\n", SDL_GetError());
        return 1;
    }

    if (Sound_Init() == 0) {
        printf("Sound_Init() failed: %s\n", Sound_GetError());
        return 1;
    }

    SDL_RWops* rw = SDL_RWFromFile("test.ogg", "rb");
    if (rw == 0) {
        printf("ERROR: %s\n", SDL_GetError());
        return 1;
    }

    Sound_AudioInfo wantedFormat;
    wantedFormat.channels = 2;
    wantedFormat.rate = 44100;
    wantedFormat.format = AUDIO_S16LSB;

    Sound_Sample* sample = Sound_NewSample(rw, "OGG", &wantedFormat, 4096);
    if (sample == 0) {
        printf("ERROR: %s\n", Sound_GetError());
        return 1;
    }
    Sound_DecodeAll(sample);
    if (sample->flags & SOUND_SAMPLEFLAG_ERROR) {
        printf("ERROR: %s\n", Sound_GetError());
    }

    Sound_Quit();
    SDL_Quit();
    return 0;
}