/* * Copyright (C) 2006-2007 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ /** \file ortp.h some macros used by ortp_send.c and ortp_recv.c*/ /** the possible packet types */ enum ortp_audio_packet_type {ORTP_EOF, ORTP_BOF, ORTP_HEADER, ORTP_DATA}; /** number of bytes of the paraslash ortp header */ #define ORTP_AUDIO_HEADER_LEN 10 /** write type of this packet to \a buf */ #define WRITE_PACKET_TYPE(buf, x) (buf)[0] = (unsigned char)((x)&0xff) /** get type of this packet */ #define READ_PACKET_TYPE(buf) (unsigned)(buf)[0] /** write the chunk time for this packet to \a buf */ #define WRITE_CHUNK_TIME(buf, x) (buf)[1] = (unsigned char)((x)&0xff);\ (buf)[2] = (unsigned char)(((x)>>8)&0xff);\ (buf)[3] = (unsigned char)(((x)>>16)&0xff);\ (buf)[4] = (unsigned char)(((x)>>24)&0xff); /** get the chunk time of this packet */ #define READ_CHUNK_TIME(buf) (unsigned char)(buf)[1] + \ ((unsigned char)(buf)[2] << 8) + \ ((unsigned char)(buf)[3] << 16) + \ ((unsigned char)(buf)[4] << 24) /** write the chunk timestamp */ #define WRITE_CHUNK_TS(buf, x) (buf)[5] = (unsigned char)((x) & 0xff); \ (buf)[6] = (unsigned char)(((x >> 8) & 0xff)); /** get the chunk timestamp */ #define READ_CHUNK_TS(buf) (unsigned char)(buf)[5] + \ ((unsigned char)(buf)[6] << 8) /** write the stream type (header or headerless) */ #define WRITE_STREAM_TYPE(buf, x) (buf)[7] = (unsigned char)((x)&0xff) /** get the type of the stream (header or headerless) */ #define READ_STREAM_TYPE(buf) (unsigned)(buf)[7] /** write the length of the header (only used for streams with header) */ #define WRITE_HEADER_LEN(buf, x) (buf)[8] = (unsigned char)((x) & 0xff); \ (buf)[9] = (unsigned char)(((x >> 8) & 0xff)); /** get the length of the header (only used for packets containing a header) */ #define READ_HEADER_LEN(buf) (unsigned char)(buf)[8] + \ ((unsigned char)(buf)[9] << 8)