[MPlayer-dev-eng] Alignment problems in real.c

Stephen Henson lists at drh-consultancy.demon.co.uk
Tue Oct 26 00:33:42 CEST 2004


I cross compiled mplayer 1.0Pre5 for an NSLU2 which uses an XScale 
processor.

Attempting to use an rtsp URL on a realaudio stream using -dumpstream 
causes a Sig11 crash.

I didn't have a debugger for this platform so I spent an afternoon 
narrowing this down with lots of debugging printfs.

I finally traced this to the macros at the start of 
libmpdemux/realrtsp/real.c:

#define BE_32C(x,y) (*((uint32_t*)(x))=be2me_32(y))

#define BE_16(x)  be2me_16(*(uint16_t*)(x))

#define BE_32(x)  be2me_32(*(uint32_t*)(x))

The XScale is big endian and the above causes word alignment problems in 
select_mlti_data().

The file rmff.c has similar macros but defined as:

#define BE_16(x)  ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
#define BE_32(x)  ((((uint8_t*)(x))[0] << 24) | \
                    (((uint8_t*)(x))[1] << 16) | \
                    (((uint8_t*)(x))[2] << 8) | \
                     ((uint8_t*)(x))[3])


After replacing the BE_16 and BE_32 macros in real.c with those in 
rmff.c it worked fine. I suppose BE32_C should be fixed too but it only 
appears to be used on word boundaries in real.c

Steve.





More information about the MPlayer-dev-eng mailing list