diff options
author | wm4 <wm4@nowhere> | 2014-07-10 00:49:01 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-07-10 00:58:56 +0200 |
commit | 1a1e631ccd561afdea31e2fb2f4982b3fdc81432 (patch) | |
tree | ba93a1718d46bcd93d7f9707b1d839d24a554a57 /video | |
parent | 2e6a8f260ca169e2e1a5646eecfc322de6f77307 (diff) | |
download | mpv-1a1e631ccd561afdea31e2fb2f4982b3fdc81432.tar.bz2 mpv-1a1e631ccd561afdea31e2fb2f4982b3fdc81432.tar.xz |
build: deal with endian mess
There is no standard mechanism for detecting endianess. Doing it at
compile time in a portable way is probably hard. Doing it properly
with a configure check is probably hard too. Using the endian
definitions in <sys/types.h> (usually includes <endian.h>, which is
not available everywhere) works under circumstances, but the previous
commit broke it on OSX.
Ideally all code should be endian dependent, but that is not possible
due to the dependencies (such as FFmpeg, some video output APIs, some
audio output APIs).
Create a header osdep/endian.h, which contains various fallbacks.
Note that the last fallback uses libavutil; however, it's not clear
whether AV_HAVE_BIGENDIAN is a public symbol, or whether including
<libavutil/bswap.h> really makes it visible. And in fact we don't want
to pollute the namespace with libavutil definitions either. Thus it's
only the last fallback.
Diffstat (limited to 'video')
-rw-r--r-- | video/img_format.h | 3 | ||||
-rw-r--r-- | video/img_fourcc.h | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/video/img_format.h b/video/img_format.h index c6c26e7fab..03ae1e91d3 100644 --- a/video/img_format.h +++ b/video/img_format.h @@ -20,7 +20,8 @@ #define MPLAYER_IMG_FORMAT_H #include <inttypes.h> -#include <sys/types.h> + +#include "osdep/endian.h" #include "bstr/bstr.h" #if BYTE_ORDER == BIG_ENDIAN diff --git a/video/img_fourcc.h b/video/img_fourcc.h index ee30ff0c26..1539a7b4f3 100644 --- a/video/img_fourcc.h +++ b/video/img_fourcc.h @@ -1,7 +1,7 @@ #ifndef MPV_IMG_FOURCC_H #define MPV_IMG_FOURCC_H -#include <sys/types.h> +#include "osdep/endian.h" #define MP_FOURCC(a,b,c,d) ((a) | ((b)<<8) | ((c)<<16) | ((unsigned)(d)<<24)) |