aboutsummaryrefslogtreecommitdiffstats
path: root/src/encoder/OpusEncoderPlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-16 21:09:19 +0200
committerMax Kellermann <max@duempel.org>2013-10-16 22:09:44 +0200
commit5e26e2ab1dadb1e4176d5a4cac03100a7d21c22f (patch)
treefccf16ec9b798ab06913250073e003b2830d2817 /src/encoder/OpusEncoderPlugin.cxx
parent08eca827b659f2becc872c151919948b5a9ffe4d (diff)
downloadmpd-5e26e2ab1dadb1e4176d5a4cac03100a7d21c22f.tar.gz
mpd-5e26e2ab1dadb1e4176d5a4cac03100a7d21c22f.tar.xz
mpd-5e26e2ab1dadb1e4176d5a4cac03100a7d21c22f.zip
system/ByteOrder: new library for byte ordering / endianess
Replacing GLib macros.
Diffstat (limited to '')
-rw-r--r--src/encoder/OpusEncoderPlugin.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/encoder/OpusEncoderPlugin.cxx b/src/encoder/OpusEncoderPlugin.cxx
index f3803e2ec..982fdd9a2 100644
--- a/src/encoder/OpusEncoderPlugin.cxx
+++ b/src/encoder/OpusEncoderPlugin.cxx
@@ -25,6 +25,7 @@
#include "ConfigError.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
+#include "system/ByteOrder.hxx"
#include <opus.h>
#include <ogg/ogg.h>
@@ -338,9 +339,9 @@ opus_encoder_generate_head(struct opus_encoder *encoder)
memcpy(header, "OpusHead", 8);
header[8] = 1;
header[9] = encoder->audio_format.channels;
- *(uint16_t *)(header + 10) = GUINT16_TO_LE(encoder->lookahead);
+ *(uint16_t *)(header + 10) = ToLE16(encoder->lookahead);
*(uint32_t *)(header + 12) =
- GUINT32_TO_LE(encoder->audio_format.sample_rate);
+ ToLE32(encoder->audio_format.sample_rate);
header[16] = 0;
header[17] = 0;
header[18] = 0;
@@ -365,9 +366,9 @@ opus_encoder_generate_tags(struct opus_encoder *encoder)
size_t comments_size = 8 + 4 + version_length + 4;
unsigned char *comments = (unsigned char *)g_malloc(comments_size);
memcpy(comments, "OpusTags", 8);
- *(uint32_t *)(comments + 8) = GUINT32_TO_LE(version_length);
+ *(uint32_t *)(comments + 8) = ToLE32(version_length);
memcpy(comments + 12, version, version_length);
- *(uint32_t *)(comments + 12 + version_length) = GUINT32_TO_LE(0);
+ *(uint32_t *)(comments + 12 + version_length) = ToLE32(0);
ogg_packet packet;
packet.packet = comments;