• Linux下onvif客户端获取h265 IPC摄像头的RTSP地址


    1、 设备搜索,去获取webserver 的地址 ,目的是在获取能力提供服务地址,demo:https://www.cnblogs.com/croxd/p/10683429.html

    2、 GetCapabilities获取能力,目的是在GetProfiles时提供媒体地址,demo:https://www.cnblogs.com/croxd/p/10683503.html

    如果GetCapabilities获取能力失败,soap error 4 或者 52的话,可以参考:https://www.cnblogs.com/croxd/p/10684712.html

        char sercer_addr[] = "http://172.168.0.211/onvif/device_service";//设备搜索获取到的地址
        struct SOAP_ENV__Header header;
        struct soap* soap = ONVIF_Initsoap(&header, NULL, NULL, 5);
        struct _tds__GetCapabilities *req;
        struct _tds__GetCapabilitiesResponse *Response;
    
        req->__sizeCategory = 1;
        req->Category = (enum tt__CapabilityCategory *)soap_malloc(soap, sizeof(int));
        *(req->Category) = (enum tt__CapabilityCategory)5; //5表示:tt__CapabilityCategory__Media
    
        ONVIF_SetAuthInfo(soap,"admin","123456");  //鉴权,输入摄像头的用户名、密码
        ret = soap_call___tds__GetCapabilities(soap, sercer_addr, NULL,req, Response);

    3 、GetServices获取多个媒体地址 demo:https://www.cnblogs.com/croxd/p/10683576.html

    要是在获取GetProfiles时,用第二步的媒体地址不支持h265,那么你就需要调用这个接口。在这个接口的tds__GetServicesResponse结构体中可以获取两个媒体地址  。要是之前没有安装h265的gsoap环境,这边也是只能获取一个媒体地址,安装h265的环境请查看上一篇的文章 :Linux下onvi支持h265环境的的搭建 

        char secvre_addr[] = "http://172.168.0.211/onvif/device_service"; //设备搜索获取得到的服务地址
        struct SOAP_ENV__Header header;
        struct _tds__GetServices *tds__GetServices;
        struct _tds__GetServicesResponse *tds__GetServicesResponse;
     
        struct soap* soap = ONVIF_Initsoap(&header, NULL, NULL, 5);
        
        tds__GetServices->IncludeCapability = 0;
     
        ONVIF_SetAuthInfo(soap,"admin","123456");  //鉴权
        soap_call___tds__GetServices(soap,secvre_addr,NULL, tds__GetServices, tds__GetServicesResponse);

    4、GetProfiles 获取媒体信息文件 demo:https://www.cnblogs.com/croxd/p/10683598.html

    从tr2__GetProfilesResponse结构体获取媒体信息文件,soap_call___tr2__GetProfiles接口是安装h265的环境时,gsoap框架所生成的接口。

        char media_addr2[] = "http://172.168.0.211/onvif/media2_service"; //GetServices得到的地址
        struct SOAP_ENV__Header header;  
        struct soap* soap = ONVIF_Initsoap(&header, NULL, NULL, 5);
     
        struct _tr2__GetProfiles tr2__GetProfiles;
        struct _tr2__GetProfilesResponse tr2__GetProfilesResponse;
        
        tr2__GetProfiles.__sizeType = 1;
        tr2__GetProfiles.Token = NULL;  
        tr2__GetProfiles.Type = NULL;
        ONVIF_SetAuthInfo(soap,"admin","123456");  //鉴权
        soap_call___tr2__GetProfiles(soap, media_addr2, NULL, &tr2__GetProfiles, &tr2__GetProfilesResponse);   

    5、 GetStreamUri 获取RTSP地址 demo:https://www.cnblogs.com/croxd/p/10683616.html

    从tr2__GetStreamUriResponse结构体中获取h265的RTSP地址,soap_call___tr2__GetStreamUri接口是安装h265的环境时,gsoap框架所生成的接口。

        char media_addr2[] = "http://172.168.0.211/onvif/media2_service"; //GetServices得到的地址
        char taken[] = "Profile000";   //get_profiles获取
        struct SOAP_ENV__Header header;
        
        struct soap* soap = ONVIF_Initsoap(&header, NULL, NULL, 5);
        struct _tr2__GetStreamUri tr2__GetStreamUri;
        struct _tr2__GetStreamUriResponse tr2__GetStreamUriResponse;
        tr2__GetStreamUri.Protocol = (char *)soap_malloc(soap, 128*sizeof(char));//
        if (NULL == tr2__GetStreamUri.Protocol){
            printf("soap_malloc is error
    ");
            ret = -1;
        }
    
        tr2__GetStreamUri.ProfileToken = (char *)soap_malloc(soap, 128*sizeof(char ));//
        if (NULL == tr2__GetStreamUri.ProfileToken){
            printf("soap_malloc is error
    ");
            ret = -1;
        }
    
        strcpy(tr2__GetStreamUri.Protocol, "tcp");
        strcpy(tr2__GetStreamUri.ProfileToken, taken);
        ONVIF_SetAuthInfo(soap,"admin","123456");  //鉴权
        soap_call___tr2__GetStreamUri(soap, media_addr2, NULL, &tr2__GetStreamUri, &tr2__GetStreamUriResponse); 
     
  • 相关阅读:
    CEIWEI CommTone串口调试精灵7.1 串口调试 串口工具
    CEIWEI USBMonitor USB监控精灵 v2.3.2 USB过滤驱动 USB监控
    CommMonitor8.0 串口过滤驱动 SDK DLL版本 C#/Delphi调用DEMO
    CommMonitor10.0.3串口过滤工具(serial port monitor)
    (1)、JEasyUI 之 Datagrid的Combobox 显示 textField 值的问题
    button 使用 flex 布局的兼容性问题
    探索 Reflect.apply 与 Function.prototype.apply 的区别
    awk 输出前 N 列的最简单方法
    在 Ubuntu 18.04 下安装 fcitx 及搜狗拼音输入法
    禁用 Gnome Shell 默认的 Ubuntu Dock 和 Ubuntu AppIndicators 扩展
  • 原文地址:https://www.cnblogs.com/croxd/p/10684877.html
Copyright © 2020-2023  润新知