mirror of
https://github.com/mpv-player/mpv
synced 2024-12-30 11:02:10 +00:00
b745c2d005
Until now, the audio chain could handle both little endian and big endian formats. This actually doesn't make much sense, since the audio API and the HW will most likely prefer native formats. Or at the very least, it should be trivial for audio drivers to do the byte swapping themselves. From now on, the audio chain contains native-endian formats only. All AOs and some filters are adjusted. af_convertsignendian.c is now wrongly named, but the filter name is adjusted. In some cases, the audio infrastructure was reused on the demuxer side, but that is relatively easy to rectify. This is a quite intrusive and radical change. It's possible that it will break some things (especially if they're obscure or not Linux), so watch out for regressions. It's probably still better to do it the bulldozer way, since slow transition and researching foreign platforms would take a lot of time and effort.
38 lines
810 B
C
38 lines
810 B
C
#ifndef MP_ENDIAN_H_
|
|
#define MP_ENDIAN_H_
|
|
|
|
#include <sys/types.h>
|
|
|
|
#if !defined(BYTE_ORDER)
|
|
|
|
#if defined(__BYTE_ORDER)
|
|
#define BYTE_ORDER __BYTE_ORDER
|
|
#define LITTLE_ENDIAN __LITTLE_ENDIAN
|
|
#define BIG_ENDIAN __BIG_ENDIAN
|
|
#elif defined(__DARWIN_BYTE_ORDER)
|
|
#define BYTE_ORDER __DARWIN_BYTE_ORDER
|
|
#define LITTLE_ENDIAN __DARWIN_LITTLE_ENDIAN
|
|
#define BIG_ENDIAN __DARWIN_BIG_ENDIAN
|
|
#else
|
|
#include <libavutil/bswap.h>
|
|
#if AV_HAVE_BIGENDIAN
|
|
#define BYTE_ORDER 1234
|
|
#define LITTLE_ENDIAN 4321
|
|
#define BIG_ENDIAN 1234
|
|
#else
|
|
#define BYTE_ORDER 1234
|
|
#define LITTLE_ENDIAN 1234
|
|
#define BIG_ENDIAN 4321
|
|
#endif
|
|
#endif
|
|
|
|
#endif /* !defined(BYTE_ORDER) */
|
|
|
|
#if BYTE_ORDER == BIG_ENDIAN
|
|
#define MP_SELECT_LE_BE(LE, BE) BE
|
|
#else
|
|
#define MP_SELECT_LE_BE(LE, BE) LE
|
|
#endif
|
|
|
|
#endif
|