[misc] Move endianess utils from rtp_common.h to misc.h

So that transcode.c can also use them.
This commit is contained in:
ejurgensen 2023-12-19 22:46:25 +01:00
parent d618e83c1a
commit 186b1418dc
3 changed files with 14 additions and 21 deletions

View File

@ -59,6 +59,18 @@ net_is_http_or_https(const char *url);
/* ----------------------- Conversion/hashing/sanitizers -------------------- */
#ifdef HAVE_ENDIAN_H
# include <endian.h>
#elif defined(HAVE_SYS_ENDIAN_H)
# include <sys/endian.h>
#elif defined(HAVE_LIBKERN_OSBYTEORDER_H)
#include <libkern/OSByteOrder.h>
#define htobe16(x) OSSwapHostToBigInt16(x)
#define be16toh(x) OSSwapBigToHostInt16(x)
#define htobe32(x) OSSwapHostToBigInt32(x)
#define be32toh(x) OSSwapBigToHostInt32(x)
#endif
// Samples to bytes, bytes to samples
#define STOB(s, bits, c) ((s) * (c) * (bits) / 8)
#define BTOS(b, bits, c) ((b) / ((c) * (bits) / 8))

View File

@ -32,15 +32,7 @@
#include <ifaddrs.h>
#include <unistd.h>
#include <fcntl.h>
#ifdef HAVE_ENDIAN_H
# include <endian.h>
#elif defined(HAVE_SYS_ENDIAN_H)
# include <sys/endian.h>
#elif defined(HAVE_LIBKERN_OSBYTEORDER_H)
#include <libkern/OSByteOrder.h>
#define htobe32(x) OSSwapHostToBigInt32(x)
#define be32toh(x) OSSwapBigToHostInt32(x)
#endif
#include <gnutls/gnutls.h>
#include <event2/event.h>
#include <json.h>
@ -54,6 +46,7 @@
#include "outputs.h"
#include "db.h"
#include "artwork.h"
#include "misc.h"
#ifdef HAVE_PROTOBUF_OLD
#include "cast_channel.v0.pb-c.h"

View File

@ -5,18 +5,6 @@
#include <inttypes.h>
#include <stdbool.h>
#ifdef HAVE_ENDIAN_H
# include <endian.h>
#elif defined(HAVE_SYS_ENDIAN_H)
# include <sys/endian.h>
#elif defined(HAVE_LIBKERN_OSBYTEORDER_H)
#include <libkern/OSByteOrder.h>
#define htobe16(x) OSSwapHostToBigInt16(x)
#define be16toh(x) OSSwapBigToHostInt16(x)
#define htobe32(x) OSSwapHostToBigInt32(x)
#define be32toh(x) OSSwapBigToHostInt32(x)
#endif
struct rtcp_timestamp
{
uint32_t pos;