Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let decoders claim a sound file #37

Open
icculus opened this issue Mar 27, 2022 · 1 comment
Open

Let decoders claim a sound file #37

icculus opened this issue Mar 27, 2022 · 1 comment
Assignees

Comments

@icculus
Copy link
Owner

icculus commented Mar 27, 2022

We need to let decoders signal that they own a given sound file.

For example, the .WAV decoder might hit this legitimate failure case (if given a 24-bit audio file, which we don't yet support)...

BAIL_MACRO("WAV: Unsupported sample size.", 0);

But then SDL_sound will try other decoders, which appropriately fail because the file isn't .mp3/.voc/whatever, eventually setting the error message to "Sound format unsupported."

So what we need is a way for decoders to say "this is definitely a .WAV (or whatever) file, but I can't open it (i/o issue, corrupted, some unsupported thing)," so that SDL_sound can report a more meaningful error and also know to stop trying other decoders.

@icculus icculus self-assigned this Mar 27, 2022
@ericoporto
Copy link
Contributor

The alternative generic way of testing formats is through something like magic: https://github.com/file/file/blob/3021bd5ae3494c7c9193e7c95f3afcb2c2d22d4a/magic/Magdir/audio#L956

What can be done here that would be easier is if you are deeper in the decoding and understanding of some header of the file format then it would raise some flag that says "yes I am the correct decoder" and from that point on it would both fail with more meaningful errors and not fallback to trying other decoders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants