[mythtv-users] PPC and MythMusic FIX (at least for mp3s)

Gregorio Gervasio, Jr. gtgj at pacbell.net
Sat Jan 14 00:37:22 UTC 2006


>>>>> Ryan Oltman writes:

r> I submitted a patch which fixes ogg (tested) and flac(not tested).  It is a 
r> complete diff of all the files from svn for it to compile on my mac-mini.  I 
r> think settings.pro needs to be changed slightly, someone hardcoded some intel 
r> stuff in there.  It also allows the endian type to be detected so it can be 
r> used on either PPC or Intel.

r> http://cvs.mythtv.org/trac/ticket/1024

r> I have not investigated wether or not it encodes correctly.  Essentially mp3 
r> and an occasional ogg file is all I'll ever play on it.


        I haven't tested FLAC either but are you sure about the
byte-shifting for 8-bit audio (~line 105 of flacdecoder.cpp)?  Aren't
the buffer values just bytes in this mode?

        Anyway, I found a couple of other places that need byte
swapping:  the AAC decoder and the Synaesthesia visualizer.  I have
tested both with FC4 ppc.  Change the ifdef's to your preference:

Index: mythmusic/mythmusic/synaesthesia.cpp
===================================================================
--- mythmusic/mythmusic/synaesthesia.cpp	(revision 8267)
+++ mythmusic/mythmusic/synaesthesia.cpp	(working copy)
@@ -620,8 +620,13 @@
         int i = outWidth / 4;
 
         do {
+#ifdef __BIG_ENDIAN__
+            register unsigned int const r2 = *(ptrOutput++);
             register unsigned int const r1 = *(ptrOutput++);
+#else
+            register unsigned int const r1 = *(ptrOutput++);
             register unsigned int const r2 = *(ptrOutput++);
+#endif
             register unsigned int const v = ((r1 & 0x000000f0ul) >> 4)  |
                                             ((r1 & 0x0000f000ul) >> 8)  |
                                             ((r1 & 0x00f00000ul) >> 12) |
Index: mythmusic/mythmusic/aacdecoder.cpp
===================================================================
--- mythmusic/mythmusic/aacdecoder.cpp	(revision 8267)
+++ mythmusic/mythmusic/aacdecoder.cpp	(working copy)
@@ -553,8 +553,13 @@
                 short *sample_buffer16 = (short*)char_buffer;
                 for(uint i = 0; i < sample_count; i++)
                 {
+#ifdef __BIG_ENDIAN__
+                    output_buf[output_at + (i*2)]     = (char)((sample_buffer16[i]) >> 8 & 0xFF);
+                    output_buf[output_at + (i*2) + 1] = (char)(sample_buffer16[i] & 0xFF);
+#else
                     output_buf[output_at + (i*2)]     = (char)(sample_buffer16[i] & 0xFF);
                     output_buf[output_at + (i*2) + 1] = (char)((sample_buffer16[i] >> 8) & 0xFF);
+#endif
                 }
             
                 if (sample_count > 0)

-- 
Gregorio Gervasio, Jr.


More information about the mythtv-users mailing list