[0] | 1 | //roaraudio.h: |
---|
| 2 | |
---|
| 3 | #ifndef _ROARAUDIO_H_ |
---|
| 4 | #define _ROARAUDIO_H_ |
---|
| 5 | |
---|
| 6 | #include <stdlib.h> |
---|
| 7 | #include <unistd.h> |
---|
| 8 | #include <stdio.h> |
---|
| 9 | #include <string.h> |
---|
| 10 | #include <errno.h> |
---|
| 11 | #include <sys/types.h> |
---|
| 12 | #include <limits.h> |
---|
| 13 | |
---|
| 14 | #include <arpa/inet.h> |
---|
| 15 | |
---|
| 16 | #include <sys/socket.h> |
---|
| 17 | #include <netinet/in.h> |
---|
| 18 | #include <netinet/tcp.h> |
---|
| 19 | #include <sys/un.h> |
---|
| 20 | |
---|
| 21 | #include <netdb.h> |
---|
| 22 | |
---|
| 23 | #include <roaraudio/config.h> |
---|
| 24 | |
---|
| 25 | // NOTE: we need this macro in some of our header files. |
---|
| 26 | #if INT_MAX >= 32767 |
---|
| 27 | #define roar_intm16 int |
---|
| 28 | #define roar_uintm16 unsigned int |
---|
| 29 | #else |
---|
| 30 | #define roar_intm16 int16_t |
---|
| 31 | #define roar_uintm16 uint16_t |
---|
| 32 | #endif |
---|
| 33 | |
---|
| 34 | #include <roaraudio/proto.h> |
---|
| 35 | #include <roaraudio/audio.h> |
---|
| 36 | #include <roaraudio/stream.h> |
---|
| 37 | #include <roaraudio/client.h> |
---|
| 38 | #include <roaraudio/sample.h> |
---|
| 39 | |
---|
| 40 | #include <libroar/libroar.h> |
---|
| 41 | |
---|
| 42 | #define ROAR_DEFAULT_PORT 16002 |
---|
| 43 | #define ROAR_DEFAULT_HOST "localhost" |
---|
| 44 | |
---|
| 45 | #define ROAR_DEFAULT_SOCK_GLOBAL "/tmp/roar" |
---|
| 46 | #define ROAR_DEFAULT_SOCK_USER ".roar" |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | //some basic macros: |
---|
| 50 | #define ROAR_STDIN 0 |
---|
| 51 | #define ROAR_STDOUT 1 |
---|
| 52 | #define ROAR_STDERR 2 |
---|
| 53 | |
---|
| 54 | #define ROAR_DEBUG_OUTFH stderr |
---|
| 55 | |
---|
| 56 | #ifdef ROAR_DBG_PREFIX |
---|
| 57 | #undef ROAR_DBG_PREFIX |
---|
| 58 | #endif |
---|
| 59 | #define ROAR_DBG_PREFIX "roaraudio" |
---|
| 60 | |
---|
| 61 | #define ROAR_DBG_FULLPREFIX "(" ROAR_DBG_PREFIX ": " __FILE__ ":%i): " |
---|
| 62 | |
---|
| 63 | #ifdef DEBUG |
---|
| 64 | #define ROAR_DBG(format, args...) fprintf(ROAR_DEBUG_OUTFH, ROAR_DBG_FULLPREFIX "DEBUG: " format "\n", __LINE__, ## args) |
---|
| 65 | #else |
---|
| 66 | #define ROAR_DBG(format, args...) |
---|
| 67 | #endif |
---|
| 68 | |
---|
| 69 | #define ROAR_ERR(format, args...) fprintf(ROAR_DEBUG_OUTFH, ROAR_DBG_FULLPREFIX "Error: " format "\n", __LINE__, ## args) |
---|
| 70 | |
---|
| 71 | |
---|
| 72 | #ifdef ROAR_HAVE_SAFE_OVERFLOW |
---|
| 73 | #define ROAR_MATH_OVERFLOW_ADD(a, b) ((a)+(b)) |
---|
| 74 | #else |
---|
| 75 | #define ROAR_MATH_OVERFLOW_ADD(a, b) ((4294967295U - (a)) + 1 + (b)) |
---|
| 76 | #endif |
---|
| 77 | |
---|
| 78 | |
---|
| 79 | |
---|
| 80 | #if BYTE_ORDER == BIG_ENDIAN |
---|
| 81 | |
---|
| 82 | #define ROAR_NET2HOST32(x) (x) |
---|
| 83 | #define ROAR_HOST2NET32(x) (x) |
---|
| 84 | #define ROAR_NET2HOST16(x) (x) |
---|
| 85 | #define ROAR_HOST2NET16(x) (x) |
---|
| 86 | |
---|
| 87 | //#elif BYTE_ORDER == LITTLE_ENDIAN |
---|
| 88 | #else |
---|
| 89 | |
---|
| 90 | #define ROAR_NET2HOST32(x) ntohl((x)) |
---|
| 91 | #define ROAR_HOST2NET32(x) htonl((x)) |
---|
| 92 | #define ROAR_NET2HOST16(x) ntohs((x)) |
---|
| 93 | #define ROAR_HOST2NET16(x) htons((x)) |
---|
| 94 | |
---|
| 95 | #endif |
---|
| 96 | |
---|
| 97 | #endif |
---|
| 98 | |
---|
| 99 | //ll |
---|