首页 > 其他 > 详细

rtpdataheader.h

时间:2015-06-04 15:08:00      阅读:192      评论:0      收藏:0      [点我收藏+]
#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;
}

 

rtpdataheader.h

原文:http://www.cnblogs.com/tangxiacun/p/4551627.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!