2019-09-17 19:24:46 +00:00
|
|
|
#ifndef __RTP_PACK__
|
|
|
|
#define __RTP_PACK__
|
|
|
|
|
|
|
|
#pragma pack(1)//设定为1字节对齐
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <memory.h>
|
|
|
|
#include <stdlib.h>
|
2019-09-20 14:49:21 +00:00
|
|
|
#include "librtsp.h"
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
unsigned char magic;
|
|
|
|
unsigned char channel;
|
|
|
|
unsigned short length;
|
|
|
|
} RtspInterleavedFrameHeader;
|
|
|
|
|
2019-09-17 19:24:46 +00:00
|
|
|
typedef struct {
|
|
|
|
unsigned char cc:4; /* CSRC count */
|
|
|
|
unsigned char x:1; /* header extension flag */
|
|
|
|
unsigned char p:1; /* padding flag */
|
|
|
|
unsigned char version:2; /* protocol version */
|
|
|
|
unsigned char pt:7; /* payload type */
|
|
|
|
unsigned char m:1; /* marker bit */
|
|
|
|
unsigned short seq; /* sequence number */
|
|
|
|
unsigned int ts; /* timestamp */
|
|
|
|
unsigned int ssrc; /* synchronization source */
|
|
|
|
} CRtpHeader;
|
|
|
|
typedef struct {
|
|
|
|
unsigned char FUType:5;
|
|
|
|
unsigned char NRI:2;
|
|
|
|
unsigned char F:1;
|
|
|
|
}FuIdentifier;
|
|
|
|
typedef struct {
|
|
|
|
unsigned char NALUnitType:5;
|
|
|
|
unsigned char Forbid:1;
|
|
|
|
unsigned char End:1;
|
|
|
|
unsigned char Start:1;
|
|
|
|
}FuHeader;
|
|
|
|
typedef struct {
|
|
|
|
FuIdentifier Identifier;
|
|
|
|
FuHeader Header;
|
|
|
|
} CH264NalUnit;
|
|
|
|
|
|
|
|
#pragma pack(4)//设定为4字节对齐
|
|
|
|
#define MAX_RTP_LEN 1001
|
|
|
|
|
|
|
|
typedef struct{
|
|
|
|
unsigned char *data;
|
|
|
|
int length;
|
|
|
|
}Vector;
|
|
|
|
|
2019-09-20 14:49:21 +00:00
|
|
|
int Pack264(unsigned char *frame,int, Vector **outbuf);
|
|
|
|
// for very low memory device like hi3518
|
|
|
|
int Pack264AndSend(unsigned char *frame,int size,RtspClient * p);
|
|
|
|
|
|
|
|
#endif
|