system/ByteOrder: new library for byte ordering / endianess

Replacing GLib macros.
This commit is contained in:
Max Kellermann
2013-10-16 21:09:19 +02:00
parent 08eca827b6
commit 5e26e2ab1d
16 changed files with 289 additions and 109 deletions

View File

@@ -25,9 +25,9 @@
#include "util/Domain.hxx"
#include "thread/Mutex.hxx"
#include "thread/Cond.hxx"
#include "system/ByteOrder.hxx"
#include "Log.hxx"
#include <glib.h>
#include <CoreAudio/AudioHardware.h>
#include <AudioUnit/AudioUnit.h>
#include <CoreServices/CoreServices.h>
@@ -342,9 +342,8 @@ osx_output_open(struct audio_output *ao, AudioFormat &audio_format,
break;
}
#if G_BYTE_ORDER == G_BIG_ENDIAN
stream_description.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian;
#endif
if (IsBigEndian())
stream_description.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian;
stream_description.mBytesPerPacket = audio_format.GetFrameSize();
stream_description.mFramesPerPacket = 1;

View File

@@ -25,10 +25,9 @@
#include "util/Error.hxx"
#include "util/Domain.hxx"
#include "util/Macros.hxx"
#include "system/ByteOrder.hxx"
#include "Log.hxx"
#include <glib.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
@@ -532,7 +531,7 @@ oss_probe_sample_format(int fd, SampleFormat sample_format,
pcm_export.Open(sample_format, 0, false, false,
oss_format == AFMT_S24_PACKED,
oss_format == AFMT_S24_PACKED &&
G_BYTE_ORDER != G_LITTLE_ENDIAN);
!IsLittleEndian());
#endif
return SUCCESS;