rtpdataheader.h

#ifndef RTPDATAHEADER_H
#define RTPDATAHEADER_H

// For 32bit intel machines
typedef short int16;
typedef int   int32;
typedef unsigned int u_int32;
typedef unsigned short u_int16;

#define RTP_BIG_ENDIAN 0
#define RTP_LITTLE_ENDIAN 1

//  RTP data header
//typedef __attribute__ ((__packed__)) struct {
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 32bits
    u_int32 ssrc;                   // synchronization source
} rtp_hdr_t;

#endif

//判断大小端
typedef unsigned char BYTE;
int main(int argc, char* argv[])
{
   unsigned int num,*p;
   p = #
   num = 0;
   *(BYTE *)p = 0xff;
   if(num == 0xff)
   {
      printf("little\n");
   }
   else //num == 0xff000000

   {
      printf("big\n");
   }
   return 0;
}

 

转载于:https://www.cnblogs.com/tangxiacun/p/4551627.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值