GB28181的arm板的移植

    安防行业里面GB28181协议正在慢慢的普及,公安系统、政府机构、事业单位等机构在对于安防产品的选择上面,更加倾向于安全性更高的GB28181协议的系统进行部署。

今天在这个地方,对于IPC、NVR这种设备上面的GB28181协议的实现做一点思路上面的讲解。

    IPC从sensor取流,在池内编码,然后通过网络传输,市面上的IPC基本上都是支持Onvif、GB28181协议、rtsp协议等等进行传输以及对平台的对接。但是对于非国标的设备

在市场竞争上明显比较吃亏,所以这个地方讲一下产品的设计思想以及部分代码实现。

    IPC在对接GB28181协议的时候,首先需要解决的问题是SIP协议的实现、xml的解析、md5,base64加密算法实现(鉴权)、rtp(rtcp)封包的实现、sdp解析、视频打包处理。

    对于SIP协议的实现很多人选择的是osip、resiprocate、opensip等开源框架,这个地方我提供几个自己实现的SIP接口供大家参考。

//对于sip信令的头部处理集

    int sip_parse_siphead(pSipHead sip_head,char *sip_str)
{
        if(!sip_str)return -1;
        memset(sip_head,0,sizeof(*sip_head));
        if(0 == strncmp(sip_str,"SIP",strlen("SIP"))){
                sip_parse_EchoLine(&sip_head->sh_EchoLine,sip_str);
        }else{
                sip_parse_ReqLine(&sip_head->sh_ReqLine,sip_str);
                }
        sip_parse_Via(&sip_head->sh_Via,sip_str);
        sip_parse_From(&sip_head->sh_From,sip_str);
        sip_parse_To(&sip_head->sh_To,sip_str);
        sip_parse_CallID(&sip_head->sh_CallID,sip_str);
        sip_parse_CSeq(&sip_head->sh_CSeq,sip_str);
        sip_parse_Contact(&sip_head->sh_Contact,sip_str);
        sip_parse_MaxFwd(&sip_head->sh_MaxFwd,sip_str);
        sip_parse_UserAgent(&sip_head->sh_UserAgent,sip_str);
        sip_parse_Expires(&sip_head->sh_Expires,sip_str);
        sip_parse_ContentLen(&sip_head->sh_ContentLen,sip_str);
        sip_parse_ContentType(&sip_head->sh_ContentType,sip_str);
        sip_parse_WWW_Auth(&sip_head->sh_WWW_Auth,sip_str);
        sip_parse_Date(&sip_head->sh_Date,sip_str);
        sip_parse_Subject(&sip_head->sh_Subject,sip_str);
        return 0;//well done the parse

}

//对于IPC信令的封装,尽量简洁好调用




部分源码的实现地址:

http://download.csdn.net/detail/qq_24798461/9890230

你可能感兴趣的:(C,GB28181)