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

Matt Hannan matthannan1 at cox.net
Fri Jan 13 23:48:11 UTC 2006


Ryan Oltman wrote:
> My first contribution back to the opensource community (after using Linux for 
> the last 11 years its about damn time).
>
> Okay after being bugged by mythmusic on not working on a ppc I decided to sit 
> down and figure this thing out.  Especially since there appears to be 2 other 
> people in the world that would love to have a mac-mini frontend to mythtv 
> using linux.
>
> If you don't know the mac mini works fine with mplayer and the 1.2GHz is close 
> to playing 1920x1080 xvid files without too many frame drops, but it would 
> produce noise under mythmusic.
>
> The problem is that libmad returns little endian audio and the powerpc is a 
> big endian machine.  Simply compile minimad.c that comes with libmad on a ppc 
> machine and see that it doesn't work.  You get noise.
>
> I'm using 0.18.1 from gentoo on the mac mini.  The mythmusic plugin code I 
> used for my fixes came from: 
> http://cvs.mythtv.org/trac/
> I used the release-0-18-fixes to compile only mythmusic.
>
> I know vorbis file have the same problem, but I don't use them (I did test 
> one), so I figure there is a similar fix that can be done in that file.
>
> The fix:
>
> swap lines 486 & 487 and 493 & 494 of maddecoder.cpp
>
> The diff (which is a little confusing):
> 486d485
> <         *(output_buf + output_at++) = ((sample >> 0) & 0xff);
> 487a487
>   
>>         *(output_buf + output_at++) = ((sample >> 0) & 0xff);
>>     
> 493d492
> <             *(output_buf + output_at++) = ((sample >> 0) & 0xff);
> 494a494
>   
>>             *(output_buf + output_at++) = ((sample >> 0) & 0xff);
>>     
>
>
> Original Code:
>
>     while (samples--)
>     {
>         signed int sample;
>
>         if (output_bytes + 4096 > globalBufferSize)
>         {
>             flush();
>         }
>         sample = fix_sample(16, *left++);
>         *(output_buf + output_at++) = ((sample >> 0) & 0xff);
>         *(output_buf + output_at++) = ((sample >> 8) & 0xff);
>         output_bytes += 2;
>
>         if (channels == 2)
>         {
>             sample = fix_sample(16, *right++);
>             *(output_buf + output_at++) = ((sample >> 0) & 0xff);
>             *(output_buf + output_at++) = ((sample >> 8) & 0xff);
>             output_bytes += 2;
>         }
>     }
>
> Big Endian Code (works on PPC):
>     while (samples--)
>     {
>         signed int sample;
>
>         if (output_bytes + 4096 > globalBufferSize)
>         {
>             flush();
>         }
>         sample = fix_sample(16, *left++);
>         *(output_buf + output_at++) = ((sample >> 8) & 0xff);
>         *(output_buf + output_at++) = ((sample >> 0) & 0xff);
>         output_bytes += 2;
>
>         if (channels == 2)
>         {
>             sample = fix_sample(16, *right++);
>             *(output_buf + output_at++) = ((sample >> 8) & 0xff);
>             *(output_buf + output_at++) = ((sample >> 0) & 0xff);
>             output_bytes += 2;
>         }
>     }
>
> Compile and enjoy the music on the mac-mini!
>
>   
Pardon my Fench, but SACRE' MERDE!
Thank you soooooo much!
My entire music library is mp3, so this is a very good thing.
Getting it to work for other formats is probably not far behind.
I am not much of a programmer, but this is just tempting enough to try.
Matt


More information about the mythtv-users mailing list