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

Sascha Sommer saschasommer at freenet.de
Sat Oct 30 10:47:33 CEST 2004


On Tuesday 26 October 2004 00:33, Stephen Henson wrote:
> 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
>

I think it would be a good idea to change the be2me_* macros in bswap.h, then
as they are probably used in more places.

Sascha




More information about the MPlayer-dev-eng mailing list