[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [Bug 57007] WAV ripping is wrong endianness on powerpc
From:       Scott Wheeler <wheeler () kde ! org>
Date:       2003-05-01 0:14:47
[Download RAW message or body]

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
     
http://bugs.kde.org/show_bug.cgi?id=57007     
wheeler@kde.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From wheeler@kde.org  2003-05-01 02:14 -------
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);
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic