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 5187 - [PATCH] ogg playback not working on big-endian devices when using Tremor instead of Vorbis
Summary: [PATCH] ogg playback not working on big-endian devices when using Tremor inst...
Status: RESOLVED FIXED
Alias: None
Product: SDL_mixer
Classification: Unclassified
Component: misc (show other bugs)
Version: 2.0.4
Hardware: PowerPC Other
: P2 critical
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-14 10:15 UTC by sergiou87
Modified: 2020-06-15 17:08 UTC (History)
0 users

See Also:


Attachments
Fix for ogg playback on big-endian hosts (2.22 KB, application/mbox)
2020-06-14 10:15 UTC, sergiou87
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sergiou87 2020-06-14 10:15:05 UTC
Created attachment 4382 [details]
Fix for ogg playback on big-endian hosts

The root of the problem is that SDL_mixer *always* provides an audio stream in little-endian byte order (AUDIO_S16). This has two consequences:

- Since Tremor doesn't swap bytes for big-endian devices, it means ov_read from Tremor will provide data in big-endian instead of little-endian as required by the AUDIO_S16 mentioned above, so audio will be unplayable.

- When using Vorbis, bytes will be swapped twice in big-endian devices: first by ov_read to little-endian when reading the file data, and then to big-endian by SDL_Convert_Byteswap before sending the data to the audio device.

Applying this patch fixes Tremor support on big-endian devices and improves
performance/efficiency of Vorbis on big-endian devices.

You can see the changes here: https://github.com/sergiou87/SDL_mixer/commit/a2ceebacdd005791c04b60e5a88c254c619bdffc

Also attached a patch in case it's easier to handle. Happy to submit it to the commit mailing list also if makes things easier.
Comment 1 Sam Lantinga 2020-06-15 17:08:47 UTC
Patch added, thanks!
https://hg.libsdl.org/SDL_mixer/rev/e6f2d0a83df5