视频监控平台

GB28181平台、视频监控平台

依照GB/T28181国标实现的一个GB28181接入功能,局域网里的监控摄像头只要连网,就可以接入到该平台,实现远程控制和调阅。

可以对监控视频流进行转发,用于其他业务平台的集成调用,也可以转发给 AI智能分析系统,用于进一步分析和智能化使用,用于智慧城市、智慧交通、智慧园区、智慧农业、智慧林业等。

hi_s32 main(int argc, char *argv[])
{
    LOGI("GB28281 start \n");
    srand((int)time(NULL));   //每次执行种子不同,生成不同的随机数
    initConfig();//读取配置参数文件
    // char parameter[20]="clientUa=",value[30]={'\0'};
    // // readConfigFile(parameter,value);
    // writeConfigFile(parameter,"hbuas");
    // initConfig();//读取配置参数文件
    sipServerInit(&sipServerConfig);
    sipClientInit(&sipClientConfig);
    if(init_sip_client(&sipClientConfig,&sipServerConfig) != 0)
    {
        LOGI("init_sip_client failed \n");
    }
    static hi_bool allowReg = HI_TRUE;
    hi_u64 lastKeepaliveTimestamp = 0;
    hi_u64 curTimestamp = 0;
    hi_u64 interval = 3000;// 客户端发送keepalive检测的间隔,单位:毫秒  
    while(!sipClientConfig.quit)
    {
        // 首次发起注册
        if (allowReg && !sipClientConfig.mRegistered) {
            allowReg = HI_FALSE;
            if(request_register(&sipClientConfig,&sipServerConfig) != 0)
            {
                LOGI("request_register failed \n");
            }
            sleep(5);
        }
        // 心跳机制 start (开发过程中,为防止影响抓包,可以先注释)
        if(sipClientConfig.mRegistered){
            curTimestamp = getCurTimestamp();
            if(lastKeepaliveTimestamp == 0){
                lastKeepaliveTimestamp = curTimestamp;
            } else {
                if((curTimestamp - lastKeepaliveTimestamp) > interval){
                    request_message_keepalive(&sipClientConfig,&sipServerConfig);
                    lastKeepaliveTimestamp = curTimestamp;
                }
            }
        }
        // 心跳机制 end
        eXosip_event_t* evtp = eXosip_event_wait(sipClientConfig.mSipCtx, 0, 20);
        if (!evtp) {
            eXosip_automatic_action(sipClientConfig.mSipCtx);
            osip_usleep(100000);
            continue;
        }
        eXosip_automatic_action(sipClientConfig.mSipCtx);
        sip_event_handle(evtp,&sipClientConfig,&sipServerConfig);
        eXosip_event_free(evtp); // 释放        
    }

    printf("hello AAA \n");
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值