Home | History | Annotate | Download | only in common
      1 /*
      2  *
      3  *  BlueZ - Bluetooth protocol stack for Linux
      4  *
      5  *  Copyright (C) 2004-2010  Marcel Holtmann <marcel (at) holtmann.org>
      6  *
      7  *
      8  *  This library is free software; you can redistribute it and/or
      9  *  modify it under the terms of the GNU Lesser General Public
     10  *  License as published by the Free Software Foundation; either
     11  *  version 2.1 of the License, or (at your option) any later version.
     12  *
     13  *  This library is distributed in the hope that it will be useful,
     14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
     15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     16  *  Lesser General Public License for more details.
     17  *
     18  *  You should have received a copy of the GNU Lesser General Public
     19  *  License along with this library; if not, write to the Free Software
     20  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     21  *
     22  */
     23 
     24 #if __BYTE_ORDER == __LITTLE_ENDIAN
     25 
     26 struct rtp_header {
     27 	unsigned cc:4;
     28 	unsigned x:1;
     29 	unsigned p:1;
     30 	unsigned v:2;
     31 
     32 	unsigned pt:7;
     33 	unsigned m:1;
     34 
     35 	uint16_t sequence_number;
     36 	uint32_t timestamp;
     37 	uint32_t ssrc;
     38 	uint32_t csrc[0];
     39 } __attribute__ ((packed));
     40 
     41 struct rtp_payload {
     42 	unsigned frame_count:4;
     43 	unsigned rfa0:1;
     44 	unsigned is_last_fragment:1;
     45 	unsigned is_first_fragment:1;
     46 	unsigned is_fragmented:1;
     47 } __attribute__ ((packed));
     48 
     49 #elif __BYTE_ORDER == __BIG_ENDIAN
     50 
     51 struct rtp_header {
     52 	unsigned v:2;
     53 	unsigned p:1;
     54 	unsigned x:1;
     55 	unsigned cc:4;
     56 
     57 	unsigned m:1;
     58 	unsigned pt:7;
     59 
     60 	uint16_t sequence_number;
     61 	uint32_t timestamp;
     62 	uint32_t ssrc;
     63 	uint32_t csrc[0];
     64 } __attribute__ ((packed));
     65 
     66 struct rtp_payload {
     67 	unsigned is_fragmented:1;
     68 	unsigned is_first_fragment:1;
     69 	unsigned is_last_fragment:1;
     70 	unsigned rfa0:1;
     71 	unsigned frame_count:4;
     72 } __attribute__ ((packed));
     73 
     74 #else
     75 #error "Unknown byte order"
     76 #endif
     77