Summary: | WAV ripping is wrong endianness on powerpc | ||
---|---|---|---|
Product: | [Frameworks and Libraries] kio | Reporter: | Fjm Maillists <fjm_maillists> |
Component: | audiocd | Assignee: | rik |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | wheeler |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Debian testing | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Fjm Maillists
2003-04-08 16:49:05 UTC
This bug is in the audiocd ioslave. Please try current HEAD. I committed a possible fix for this problem. Note, that the encoding of .ogg or .mp3, when produced direcltly by the ioslave should already have been correct. Only the .wav output was broken. Ah, OK. I'll have to wait for the next release, as I don't have the space to build a new version. Also, it would be nice if kaudiocreator used the audiocd slave to do the ogg conversion, if it was possible Subject: KDE_3_1_BRANCH: kdemultimedia/kioslave/audiocd CVS commit by wheeler: Backporting Matz's fix to the branch. George (and/or other Mac users) please test soon. Closing the related bug for now. If this fix doesn't work I'll reopen it. This should make ripping of wav files work on Mac now. CCMAIL:staikos@kde.org, 57007-done@bugs.kde.org M +11 -0 audiocd.cpp 1.59.2.6 --- kdemultimedia/kioslave/audiocd/audiocd.cpp #1.59.2.5:1.59.2.6 @@ -1375,4 +1375,9 @@ AudioCDProtocol::parseArgs(const KURL & } +inline int16_t swap16 (int16_t i) +{ + return (((i >> 8) & 0xFF) | ((i << 8) & 0xFF00)); +} + void AudioCDProtocol::paranoiaRead( @@ -1554,4 +1559,10 @@ static char mp3buffer[mp3buffer_size]; if (filetype == "wav" || filetype == "cda") { QByteArray output; + int16_t i16 = 1; + /* WAV is defined to be little endian, so we need to swap it + on big endian platforms. */ + if (((char*)&i16)[0] == 0) + for (int i=0; i < 2 * CD_FRAMESAMPLES; i++) + buf[i] = swap16 (buf[i]); char * cbuf = reinterpret_cast<char *>(buf); output.setRawData(cbuf, CD_FRAMESIZE_RAW); |