Merge /home/maan/scm/paraslash.fml/paraslash
[paraslash.git] / ortp.h
1 /** \file ortp.h some macros used by ortp_send.c and ortp_recv.c*/
2 enum ortp_audio_packet_type {ORTP_EOF, ORTP_BOF, ORTP_HEADER, ORTP_DATA};
3
4 #define ORTP_AUDIO_HEADER_LEN 10
5
6 #define WRITE_PACKET_TYPE(buf, x) (buf)[0] = (unsigned char)((x)&0xff)
7 #define READ_PACKET_TYPE(buf) (unsigned)(buf)[0]
8
9 #define WRITE_CHUNK_TIME(buf, x) (buf)[1] = (unsigned char)((x)&0xff);\
10 (buf)[2] = (unsigned char)(((x)>>8)&0xff);\
11 (buf)[3] = (unsigned char)(((x)>>16)&0xff);\
12 (buf)[4] = (unsigned char)(((x)>>24)&0xff);
13 #define READ_CHUNK_TIME(buf) (unsigned char)(buf)[1] + \
14 ((unsigned char)(buf)[2] << 8) + \
15 ((unsigned char)(buf)[3] << 16) + \
16 ((unsigned char)(buf)[4] << 24)
17
18 #define WRITE_CHUNK_TS(buf, x) (buf)[5] = (unsigned char)((x) & 0xff); \
19 (buf)[6] = (unsigned char)(((x >> 8) & 0xff));
20 #define READ_CHUNK_TS(buf) (unsigned char)(buf)[5] + \
21 ((unsigned char)(buf)[6] << 8)
22
23 #define WRITE_STREAM_TYPE(buf, x) (buf)[7] = (unsigned char)((x)&0xff)
24 #define READ_STREAM_TYPE(buf) (unsigned)(buf)[7]
25
26 #define WRITE_HEADER_LEN(buf, x) (buf)[8] = (unsigned char)((x) & 0xff); \
27 (buf)[9] = (unsigned char)(((x >> 8) & 0xff));
28 #define READ_HEADER_LEN(buf) (unsigned char)(buf)[8] + \
29 ((unsigned char)(buf)[9] << 8)
30