libfaad/AACCodec nonfunctional on x86_64 Ubuntu 8.04, -fPIC problems rebuilding
#1
When attempting to play an M4A/AAC file under x86_64, AACCodec fails with this error message:

Code:
17:57:49 T:2585143360 M:294600704   ERROR: AACCodec: Unable to open file /mnt/music/file.m4a (Pulse coding not allowed in short blocks)

This message suggests that the file is malformed, but it is not. Under 32-bit Linux, other players (iTunes on OS X), or XBMC-Xbox, the files play correctly.

This is an old bug bug related to libfaad, resulting from the use of ambiguous types (unsigned long, etc) instead of specific ones (uint32_t, etc):
http://bugs.gentoo.org/show_bug.cgi?id=58780
http://bugs.gentoo.org/show_bug.cgi?id=61528
http://mail-index.netbsd.org/pkgsrc-bugs.../0012.html

I've been trying to fix it by building AACCodec with a newer version of libfaad, but I'm running into -fPIC problems that I can't seem to get around.

Code:
gcc -shared -o AACCodec-i486-linux.so *.o alac_decoder/*.o faad2/libfaad/*.o mp4ff/*.o `cat ../../../XBMC/xbmc/cores/DllLoader/exports/wrapper.def` ../../../XBMC/xbmc/cores/DllLoader/exports/wrapper.o
/usr/bin/ld: faad2/libfaad/bits.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
faad2/libfaad/bits.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [AACCodec-i486-linux.so] Error 1

I added CFLAGS=-fPIC to libfaad's Makefile.am, and it does appear that all the .c files are being compiled with -fPIC, including bits.o, but I get the same error.
Reply
#2
Ignore this -- I was CFLAGS=-fPIC to the wrong Makefile.am (which I guess really should have been AM_CFLAGS anyway).

I have working AAC audio on x86_64 Smile

Posting a patch will be much harder for this, as the majority of the change is the libfaad upgrade, and the directory structure for libfaad has changed.

I can send a patch for the changed files and simply a zip of the new (and slightly modified) libfaad, but it may be easier if I get commit access.

I plan on doing more 64-bit fixes, and if I have time, maybe some "real" development as well Smile
Reply
#3
As an aside:

I also recompiled the libfaad used for DVDPlayer, which was not wrapped by the AACCodec library. This was a little more complicated -- apparently the libfaad function names have all changed from faacDec*() to NeAACDec*(), for reasons which I'm sure are completely meaningful and not at all stupid. There is a header to add backwards-compatibility for names, but since the DLL loader does tricky macro hackery to resolve methods to the m_ prefixed function pointers, it wasn't compiling cleanly. So I had to go into DllLibFaad.h and DVDAudioCodecLibFaad.cpp and replace references to faacDec* functions with references to NeAACDec* functions.

Now it works beautifully, and I can play AAC audio in videos (tested with H.264 .mp4 with AAC audio).
Reply
#4
Could you submit the patch along with a note that libfaad needs updating?
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
Reply
#5
I could, but it's a little weird since I had to change the Makefile.ams in libfaad and all that.

This is the output of svn status on my /branches/linuxport/sources directory right now:
http://pastebin.org/38669 (too big for one forum post)
Reply

Logout Mark Read Team Forum Stats Members Help
libfaad/AACCodec nonfunctional on x86_64 Ubuntu 8.04, -fPIC problems rebuilding0