/* * rtp.h -- RTP header file (RFC 1890) */ #include #include "sysdep.h" #define RTP_SVM_RAW 40 /* * The type definitions below are valid for 32-bit architectures and * may have to be adjusted for 16- or 64-bit architectures. */ typedef unsigned char u_int8; typedef unsigned short u_int16; typedef unsigned int u_int32; typedef short int16; /* * Current protocol version. */ #define RTP_VERSION 2 #define RTP_SEQ_MOD (1<<16) #define RTP_MAX_SDES 255 /* maximum text length for SDES */ /* * Largest (user-level) packet size generated by our rtp applications. * Individual video formats may use smaller mtu's. */ #define PACKET_SIZE 1024 #define RTP_MTU 1024 #define MAXHDR 24 #define RTP_HDR_SZ 12 #define TOTHDR 20 /* * * * The RTP header has the following format: * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * |V=2|P|X| CC |M| PT | sequence number | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | timestamp | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | synchronization source (SSRC) identifier | * +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ * | contributing source (CSRC) identifiers | * | .... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * * RTP data header */ typedef struct { #if RTP_BIG_ENDIAN unsigned int version:2; /* protocol version */ unsigned int p:1; /* padding flag */ unsigned int x:1; /* header extension flag */ unsigned int cc:4; /* CSRC count */ unsigned int m:1; /* marker bit */ unsigned int pt:7; /* payload type */ #elif RTP_LITTLE_ENDIAN unsigned int cc:4; /* CSRC count */ unsigned int x:1; /* header extension flag */ unsigned int p:1; /* padding flag */ unsigned int version:2; /* protocol version */ unsigned int pt:7; /* payload type */ unsigned int m:1; /* marker bit */ #else #error Define one of RTP_LITTLE_ENDIAN or RTP_BIG_ENDIAN #endif unsigned int seq:16; /* sequence number */ u_int32 ts; /* timestamp */ u_int32 ssrc; /* synchronization source */ } rtp_hdr_t; /* * CellB encapsulation. * * Motion JPEG encapsulation. * * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | frag offset | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | x | y | Width | Height | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * * Type = Index into a table of predefined JPEG parameters * Width = Width of input in 8-pixel blocks * Height = Height of input in 8-pixel blocks * Q = Quality factor (0-100 = std, >100 = custom) * Frag offset = The byte offset into the frame for the data in * this packet */ struct jpeghdr { // unsigned int type:8; // int off:24; u_int32 off; u_int8 x; u_int8 y; u_int8 width; u_int8 height; /* cells */ };