<div dir="ltr">Hello,<div><br></div><div>with the release of SDL2, a couple new sound sample format definitions have</div><div>been added to SDL_audio.h that the ogg decoder in SDL_sound is not prepared</div><div>to handle (because it only expects 8 and 16 bit formats). Attached is a patch to</div>
<div>fall back to signed 16 bit in case of formats that ov_read from libvorbisfile can't</div><div>handle.</div><div><br></div><div><div>diff -r 36048b57f6f4 decoders/ogg.c</div><div>--- a/decoders/ogg.c<span class="" style="white-space:pre">      </span>Sun Dec 01 14:00:35 2013 +0100</div>
<div>+++ b/decoders/ogg.c<span class="" style="white-space:pre">        </span>Sun Dec 01 15:33:34 2013 +0100</div><div>@@ -230,8 +230,13 @@</div><div>      *  necessary, and SDL_sound will not. If the user didn't specify a</div>
<div>      *  desired format, then we pretend the "actual" format is something that</div><div>      *  OGG files are apparently commonly encoded in.</div><div>+     * Exceptions: if the desired sample size is over 2 bytes (either float</div>
<div>+     *  or int32), we default to S16 because ov_read can't handle it.</div><div>      */</div><div>-    sample->actual.format = (sample->desired.format == 0) ?</div><div>+</div><div>+    int vf_can_convert = ((sample->desired.format & 0xFF) / 8) <= 2;</div>
<div>+</div><div>+    sample->actual.format = (sample->desired.format == 0 || !vf_can_convert) ?</div><div>                              AUDIO_S16SYS : sample->desired.format;</div><div>     return(1);</div><div>
 } /* OGG_open */</div></div></div>