资源简介
基于H.265的RTP封装。
代码片段和文件信息
#include “StdAfx.h“
#include “h265rtpsv.h“
#include
#pragma comment(lib “ws2_32.lib“)
h265rtpsv::h265rtpsv(void)
{
m_maxpayloadsize = 1440;
m_mode = PACK_MODE_RTPPAYLOAD;
m_current_ts = 0;/*or some random value*/
m_last_seq = 0;
m_aps_allowed = FALSE;
m_pNaluBuf = NULL;
m_pNaluBufItertor = NULL;
m_uNaluBufSize = 0;
m_uNaluDataLen = 0;
m_bframeEndInNaluBuf = FALSE;
m_pRtpBuf = NULL;
m_pRtpBufItertor = NULL;
m_uRtpBufSize = 0;
m_uRtpDataLen = 0;
m_uNaluCountInRtpBuf = 0;
//m_cLowestlayerId = 0;
//m_cLowestTId = 0;
}
h265rtpsv::~h265rtpsv(void)
{
if (m_pNaluBuf)
{
delete [] m_pNaluBuf;
m_pNaluBuf = NULL;
}
if (m_pRtpBuf)
{
delete [] m_pRtpBuf;
m_pRtpBuf = NULL;
}
}
void h265rtpsv::SetMaxPayloadSize( unsigned int size )
{
m_maxpayloadsize = size;
}
void h265rtpsv::SetMode( int mode/* PACK_MODE_RAW or PACK_MODE_3984 */ )
{
m_mode = mode;
}
void h265rtpsv::EnableAPs( BOOL yesno )
{
m_aps_allowed = yesno;
}
void h265rtpsv::Reset()
{
TRACE(“h265rtpsv::Reset!\n“);
m_current_ts = 0;
m_last_seq = 0;
m_uNaluDataLen = 0;
m_uRtpDataLen = 0;
m_bframeEndInNaluBuf = FALSE;
m_pNaluBufItertor = NULL;
m_pRtpBufItertor = NULL;
m_uNaluCountInRtpBuf = 0;
//m_cLowestlayerId = 0;
//m_cLowestTId = 0;
}
/*process NALUs and pack them into rtp payloads */
BOOL h265rtpsv::InputNalu( const char* nalu unsigned long nlen BOOL frameend
char*& pl unsigned long& plen BOOL& bMark BOOL& bHavemore )
{
pl = NULL;
plen = 0;
bMark = FALSE;
bHavemore = FALSE;
switch(m_mode)
{
case PACK_MODE_RAW_H265:
{ // do nothing but a check
if (!nalu)
return FALSE;
char* raw = (char*)nalu;
unsigned long rawlen = nlen;
if (rawlen > 4)
{
if (memcmp(raw NALU_STARTBYTES32 4) == 0)
{
raw += 4;
rawlen -= 4;
}
else if (memcmp(raw NALU_STARTBYTES24 3) == 0)
{
raw += 3;
rawlen -= 3;
}
}
if (nlen > m_maxpayloadsize)
{
TRACE(“This H264 packet does not fit into mtu: size=%i\n“ nlen);
return FALSE;
}
pl = raw;
plen = rawlen;
bMark = frameend;
bHavemore = FALSE;
return TRUE;
}
break;
case PACK_MODE_RTPPAYLOAD:
{ // do pack
char* raw = (char*)nalu;
unsigned long rawlen = nlen;
if (!raw)
{
raw = m_pNaluBuf;
rawlen = m_uNaluDataLen;
if (!raw)
{
return FALSE;
}
}
else
{
m_uNaluDataLen = 0;
m_pNaluBufItertor = NULL;
}
if (rawlen > 4)
{
if (memcmp(raw NALU_STARTBYTES32 4) == 0)
{
raw += 4;
rawlen -= 4;
}
else if (memcmp(raw NALU_STARTBYTES24 3) == 0)
{
raw += 3;
rawlen -= 3;
}
}
if (m_aps_allowed)
{
if (m_uRtpDataLen > 0)
{
if (m_uRtpDataLen+rawlen+2 < m_maxpayloadsize)
{
unsigned short size = hto
- 上一篇:基于PCL开源库fpfh+icp算法实现点云配准
- 下一篇:组态王秒计时器制做
相关资源
- V4L2 通过JRTPLIB 实现RTP实时视频传输并
- 读取H264+发送RTP包的代码--VsParserSend
- 基于RTPRTCP和RTSP协议的流媒体快速流间
- RTP传输h264码流
- RTSP/RTP 嵌入式流媒体服务器的实现
- RTP打包与解析,荷载PS和H264
- RTP实时传输H.264
- H.264&H.265视频压缩编码参考码率表
- RFC3550_RTP协议中文版.pdf免费
- 最简RTSP客户端程序
- 最简 jrtplib 收发数据
- linux下的实时语音聊天程序源码adpcm编
- mitty多普达smartphone刷机工具
- linux 语音实时对讲
- RTPC sar面目标成像
- rtp/rtcp协议实现源码
- 水杉导出pmx插件 ExportPMX
- linux c下acc打包成RTP并在VLC上播放
- Codejock ChartPro vfp 使用
- rtp解包组包.zip
- 从网络抓包中提取RTP包,RTP解包为H
- infoteam OpenPCS _SmartPLC/Redundant.zip
- RTP流传输音视频
- 将H264码流打成RTP包UDP发送-vlc播放
- h264 h265 rtp打包
- PowerDesigner15 数据字典模板
- RFC3550 中英文完整版
- RFC3550(RTP)中文版.pdf
- rtp协议中文版.pdf
- 海思H.265解码库
评论
共有 条评论