/* * Copyright (C) 2006-2007 Andre Noll * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ /** \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)