添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
前面篇介绍onvif服务端的发现功能,继续在之前的代码基础上完成一个RTSP流的工作,也就是客户端通过ONVIF协议来预览设备端在这个之前必须确定几个简单的条件1 设备端能被发现2 设备端支持RTSP协议,并且能够通过VLC进行正常的预览 通过onvif协议设备需要做的几个基本事情:1  __td...

面篇介绍onvif服务端的发现功能,继续在之前的代码基础上完成一个RTSP流的工作,也就是客户端通过ONVIF协议来预览设备端
在这个之前必须确定几个简单的条件
1 设备端能被发现
2 设备端支持RTSP协议,并且能够通过VLC进行正常的预览


通过onvif协议设备需要做的几个基本事情:
1  __tds__GetCapabilities获取设备能力
2  __trt__GetProfiles获取设备的配置信息
3  获取前段设备的视频编码和视频源的一些基本需要的信息
4 __trt__GetStreamUri后去设备的URi,通过RTSP获取视频流


接口函数有了,实现的时候当然也需要注意匹配,需要把设备的一些主要信息对应匹配到Onvif协议中,下面一个函数一个函数的具体实现如下,在需要注意的地方我都加上了对应的注释,如果还有不清楚的地方可以留言,我会尽量尽我所知道的告诉大家
1 __tds__GetCapabilities,此函数是获取设备端的能力的函数,在这里需要预览,所以基本的media和device的一些基本信息是需要填写的

[cpp] view plain copy
  • Capabilities__Device_Choice:
  • tds__GetCapabilitiesResponse->Capabilities->Device = ( struct tt__DeviceCapabilities *)soap_malloc(soap, sizeof( struct tt__DeviceCapabilities));
  • memset(tds__GetCapabilitiesResponse->Capabilities->Device, 0, sizeof( struct tt__DeviceCapabilities));
  • tds__GetCapabilitiesResponse->Capabilities->Device->XAddr = ( char *)soap_malloc(soap, sizeof( char) * MAX_64_LEN );
  • memset(tds__GetCapabilitiesResponse->Capabilities->Device->XAddr, 0, sizeof( char) * MAX_64_LEN);
  • //填写设备的ip地址以及需要通过onvif协议通信的端口号
  • sprintf(tds__GetCapabilitiesResponse->Capabilities->Device->XAddr, "%s/onvif/device_service", "192.168.12.135:8899");
  • //设备的一些基本能力值,是否支持那些功能,如果在开发的时候,如果前段设备支持这些功能的话,就可以直接填写true,否则填写false
  • tds__GetCapabilitiesResponse->Capabilities->Device->Network = ( struct tt__NetworkCapabilities *)soap_malloc(soap, sizeof( struct tt__NetworkCapabilities ));
  • memset(tds__GetCapabilitiesResponse->Capabilities->Device->Network, 0, sizeof( struct tt__NetworkCapabilities ));
  • tds__GetCapabilitiesResponse->Capabilities->Device->Network->IPFilter = ( enum xsd__boolean *)soap_malloc(soap, sizeof( enum xsd__boolean));
  • *(tds__GetCapabilitiesResponse->Capabilities->Device->Network->IPFilter) = xsd__boolean__false_; // xsd__boolean__true_
  • tds__GetCapabilitiesResponse->Capabilities->Device->Network->ZeroConfiguration= ( enum xsd__boolean *)soap_malloc(soap, sizeof( enum xsd__boolean));
  • *(tds__GetCapabilitiesResponse->Capabilities->Device->Network->ZeroConfiguration) = xsd__boolean__true_; // xsd__boolean__false_
  • tds__GetCapabilitiesResponse->Capabilities->Device->Network->IPVersion6 = ( enum xsd__boolean *)soap_malloc(soap, sizeof( enum xsd__boolean));
  • *(tds__GetCapabilitiesResponse->Capabilities->Device->Network->IPVersion6) = xsd__boolean__false_; // xsd__boolean__true_
  • tds__GetCapabilitiesResponse->Capabilities->Device->Network->DynDNS = ( enum xsd__boolean *)soap_malloc(soap, sizeof( enum xsd__boolean));
  • *(tds__GetCapabilitiesResponse->Capabilities->Device->Network->DynDNS) = xsd__boolean__true_; // xsd__boolean__false_
  • tds__GetCapabilitiesResponse->Capabilities->Device->System = ( struct tt__SystemCapabilities *)soap_malloc(soap, sizeof( struct tt__SystemCapabilities));
  • memset( tds__GetCapabilitiesResponse->Capabilities->Device->System, 0, sizeof( struct tt__SystemCapabilities));
  • tds__GetCapabilitiesResponse->Capabilities->Device->System->DiscoveryResolve = xsd__boolean__true_;
  • tds__GetCapabilitiesResponse->Capabilities->Device->System->DiscoveryBye     = xsd__boolean__true_;
  • tds__GetCapabilitiesResponse->Capabilities->Device->System->RemoteDiscovery  = xsd__boolean__false_;
  • tds__GetCapabilitiesResponse->Capabilities->Device->System->SystemBackup     = xsd__boolean__false_;
  • tds__GetCapabilitiesResponse->Capabilities->Device->System->SystemLogging    = xsd__boolean__false_;
  • tds__GetCapabilitiesResponse->Capabilities->Device->System->FirmwareUpgrade  = xsd__boolean__false_;
  • tds__GetCapabilitiesResponse->Capabilities->Device->System->__sizeSupportedVersions = 1;
  • tds__GetCapabilitiesResponse->Capabilities->Device->System->SupportedVersions = ( struct tt__OnvifVersion *)soap_malloc(soap, sizeof( struct tt__OnvifVersion));
  • tds__GetCapabilitiesResponse->Capabilities->Device->System->SupportedVersions->Major = 2;
  • tds__GetCapabilitiesResponse->Capabilities->Device->System->SupportedVersions->Minor = 0;
  • // 设备IO的一些支持
  • tds__GetCapabilitiesResponse->Capabilities->Device->IO = ( struct tt__IOCapabilities *)soap_malloc(soap, sizeof( struct tt__IOCapabilities));
  • memset(tds__GetCapabilitiesResponse->Capabilities->Device->IO, 0, sizeof( struct tt__IOCapabilities));
  • tds__GetCapabilitiesResponse->Capabilities->Device->IO->InputConnectors = ( int *)soap_malloc(soap, sizeof( int));
  • *(tds__GetCapabilitiesResponse->Capabilities->Device->IO->InputConnectors) = 1;
  • tds__GetCapabilitiesResponse->Capabilities->Device->IO->RelayOutputs = ( int *)soap_malloc(soap, sizeof( int));
  • *(tds__GetCapabilitiesResponse->Capabilities->Device->IO->RelayOutputs) = 1;
  • tds__GetCapabilitiesResponse->Capabilities->Device->Security = ( struct tt__SecurityCapabilities *)soap_malloc(soap, sizeof( struct tt__SecurityCapabilities));
  • memset(tds__GetCapabilitiesResponse->Capabilities->Device->Security, 0, sizeof( struct tt__SecurityCapabilities));
  • tds__GetCapabilitiesResponse->Capabilities->Device->Security->TLS1_x002e1          = xsd__boolean__false_;
  • tds__GetCapabilitiesResponse->Capabilities->Device->Security->TLS1_x002e2          = xsd__boolean__false_;
  • tds__GetCapabilitiesResponse->Capabilities->Device->Security->OnboardKeyGeneration = xsd__boolean__false_;
  • tds__GetCapabilitiesResponse->Capabilities->Device->Security->AccessPolicyConfig   = xsd__boolean__false_;
  • tds__GetCapabilitiesResponse->Capabilities->Device->Security->X_x002e509Token      = xsd__boolean__false_;
  • tds__GetCapabilitiesResponse->Capabilities->Device->Security->SAMLToken            = xsd__boolean__false_;
  • tds__GetCapabilitiesResponse->Capabilities->Device->Security->KerberosToken        = xsd__boolean__false_;
  • tds__GetCapabilitiesResponse->Capabilities->Device->Security->RELToken             = xsd__boolean__false_;
  • Capabilities__Imaging_Choice:
  • //Imaging的一些基本信息,关于视频颜色,IRCut的一些基本信息
  • tds__GetCapabilitiesResponse->Capabilities->Imaging = ( struct tt__ImagingCapabilities *)soap_malloc(soap, sizeof( struct tt__ImagingCapabilities));
  • memset(tds__GetCapabilitiesResponse->Capabilities->Imaging, 0, sizeof( struct tt__ImagingCapabilities));
  • tds__GetCapabilitiesResponse->Capabilities->Imaging->XAddr = ( char *)soap_malloc(soap, sizeof( char) * MAX_64_LEN );
  • memset(tds__GetCapabilitiesResponse->Capabilities->Imaging->XAddr, '\0', sizeof( char) * MAX_64_LEN);
  • sprintf(tds__GetCapabilitiesResponse->Capabilities->Imaging->XAddr, "%s/onvif/imaging_service", "192.168.12.135:8899");
  • Capabilities__Media__Choice:
  • tds__GetCapabilitiesResponse->Capabilities->Media = ( struct tt__MediaCapabilities *)soap_malloc(soap, sizeof( struct tt__MediaCapabilities));
  • memset(tds__GetCapabilitiesResponse->Capabilities->Media, 0, sizeof( struct tt__MediaCapabilities));
  • tds__GetCapabilitiesResponse->Capabilities->Media->XAddr = ( char *)soap_malloc(soap, sizeof( char) * MAX_64_LEN );
  • memset(tds__GetCapabilitiesResponse->Capabilities->Media->XAddr, 0, sizeof( char) * MAX_64_LEN);
  • sprintf(tds__GetCapabilitiesResponse->Capabilities->Media->XAddr, "%s/onvif/media_service", "192.168.12.135:8899");
  • tds__GetCapabilitiesResponse->Capabilities->Media->StreamingCapabilities = ( struct tt__RealTimeStreamingCapabilities *)soap_malloc(soap,
  • sizeof( struct tt__RealTimeStreamingCapabilities));
  • memset(tds__GetCapabilitiesResponse->Capabilities->Media->StreamingCapabilities, 0, sizeof( struct tt__RealTimeStreamingCapabilities));
  • tds__GetCapabilitiesResponse->Capabilities->Media->StreamingCapabilities->RTPMulticast   = ( enum xsd__boolean *)soap_malloc(soap, sizeof( int));
  • *tds__GetCapabilitiesResponse->Capabilities->Media->StreamingCapabilities->RTPMulticast  = xsd__boolean__false_;
  • tds__GetCapabilitiesResponse->Capabilities->Media->StreamingCapabilities->RTP_USCORETCP  = ( enum xsd__boolean*)soap_malloc(soap, sizeof( int));
  • *tds__GetCapabilitiesResponse->Capabilities->Media->StreamingCapabilities->RTP_USCORETCP = xsd__boolean__true_;
  • tds__GetCapabilitiesResponse->Capabilities->Media->StreamingCapabilities->RTP_USCORERTSP_USCORETCP = ( enum xsd__boolean*)soap_malloc(soap, sizeof( int));
  • *tds__GetCapabilitiesResponse->Capabilities->Media->StreamingCapabilities->RTP_USCORERTSP_USCORETCP = xsd__boolean__true_;
  • 2 __tds__GetServices函数的一些基本信息的填写

    [cpp] view plain copy
  • tds__GetServicesResponse->__sizeService = 1;
  • tds__GetServicesResponse->Service = ( struct tds__Service *)soap_malloc(soap, sizeof( struct tds__Service));
  • tds__GetServicesResponse->Service[0].Namespace = ( char *)soap_malloc(soap, sizeof( char)* INFO_LENGTH);
  • strcpy(tds__GetServicesResponse->Service[0].Namespace, "http://www.onvif.org/ver10/events/wsdl");
  • tds__GetServicesResponse->Service[0].XAddr     = ( char *)soap_malloc(soap, sizeof( char)* INFO_LENGTH);
  • strcpy(tds__GetServicesResponse->Service[0].XAddr, "http://192.168.12.135/onvif/services");
  • tds__GetServicesResponse->Service[0].Capabilities = NULL;
  • tds__GetServicesResponse->Service[0].Version = ( struct tt__OnvifVersion *)soap_malloc(soap, sizeof( struct tt__OnvifVersion));
  • tds__GetServicesResponse->Service[0].Version->Major = 0;
  • tds__GetServicesResponse->Service[0].Version->Minor = 3;
  • tds__GetServicesResponse->Service[0].__size = 0;
  • tds__GetServicesResponse->Service[0].__any = NULL;
  • tds__GetServicesResponse->Service[0].__anyAttribute = NULL;
  • 3  __trt__GetProfiles获取设备的配置信息

    [cpp] view plain copy
  • // VideoSourceConfiguration
  • trt__GetProfilesResponse->Profiles[i].Name = ( char *)soap_malloc(soap, sizeof( char)*MAX_PROF_TOKEN);
  • memset(trt__GetProfilesResponse->Profiles[i].Name, '\0', sizeof( char)*MAX_PROF_TOKEN);
  • //profiles的名字,和token不同,实际请求的时候都是需要对应的token值来获取的
  • strcpy(trt__GetProfilesResponse->Profiles[i].Name, "test_profile");
  • trt__GetProfilesResponse->Profiles[i].token = ( char *)soap_malloc(soap, sizeof( char)*MAX_PROF_TOKEN);
  • memset(trt__GetProfilesResponse->Profiles[i].token, '\0', sizeof( char)*MAX_PROF_TOKEN);
  • //此token也就是每次需要获取对应profiles的一些信息的时候,就需要在请求的时候填写此对应的token来,来进行验证判断
  • strcpy(trt__GetProfilesResponse->Profiles[i].token, "test_token");
  • trt__GetProfilesResponse->Profiles[i].fixed = ( enum xsd__boolean *)soap_malloc(soap, sizeof( int));
  • memset(trt__GetProfilesResponse->Profiles[i].fixed, 0, sizeof( int));
  • *(trt__GetProfilesResponse->Profiles[i].fixed) = ( enum xsd__boolean )0;
  • trt__GetProfilesResponse->Profiles[i].__anyAttribute = NULL;
  • trt__GetProfilesResponse->Profiles[i].VideoSourceConfiguration = ( struct tt__VideoSourceConfiguration *)soap_malloc(soap, sizeof( struct tt__VideoSourceConfiguration));
  • memset(trt__GetProfilesResponse->Profiles[i].VideoSourceConfiguration, 0, sizeof( struct tt__VideoSourceConfiguration));
  • trt__GetProfilesResponse->Profiles[i].VideoSourceConfiguration->Name = ( char *)soap_malloc(soap, sizeof( char) * MAX_PROF_TOKEN);
  • memset(trt__GetProfilesResponse->Profiles[i].VideoSourceConfiguration->Name, '\0', sizeof( char) * MAX_PROF_TOKEN);
  • // 类似与上面,VideoSource Name,
  • strcpy(trt__GetProfilesResponse->Profiles[i].VideoSourceConfiguration->Name, "test_vsname");
  • trt__GetProfilesResponse->Profiles[i].VideoSourceConfiguration->token = ( char *)soap_malloc(soap, sizeof( char) * MAX_PROF_TOKEN);
  • memset(trt__GetProfilesResponse->Profiles[i].VideoSourceConfiguration->token, '\0', sizeof( char) * MAX_PROF_TOKEN);
  • //求不同码流的视频源信息需要此token值匹配
  • strcpy(trt__GetProfilesResponse->Profiles[i].VideoSourceConfiguration->token, "test_vsoken");
  • trt__GetProfilesResponse->Profiles[i].VideoSourceConfiguration->SourceToken = ( char *)soap_malloc(soap, sizeof( char) * MAX_PROF_TOKEN);
  • memset(trt__GetProfilesResponse->Profiles[i].VideoSourceConfiguration->SourceToken, '\0', sizeof( char) * MAX_PROF_TOKEN);
  • strcpy(trt__GetProfilesResponse->Profiles[i].VideoSourceConfiguration->SourceToken, "test_vstoken");
  • trt__GetProfilesResponse->Profiles[i].VideoSourceConfiguration->UseCount = 1;
  • trt__GetProfilesResponse->Profiles[i].VideoSourceConfiguration->Bounds = ( struct tt__IntRectangle *)soap_malloc(soap, sizeof( struct tt__IntRectangle));
  • memset(trt__GetProfilesResponse->Profiles[i].VideoSourceConfiguration->Bounds, 0, sizeof( struct tt__IntRectangle));
  • trt__GetProfilesResponse->Profiles[i].VideoSourceConfiguration->Bounds->x = 0;
  • trt__GetProfilesResponse->Profiles[i].VideoSourceConfiguration->Bounds->y = 0;
  • trt__GetProfilesResponse->Profiles[i].VideoSourceConfiguration->Bounds->width = 1280;
  • trt__GetProfilesResponse->Profiles[i].VideoSourceConfiguration->Bounds->height = 720;
  • // VideoEncoderConfiguration
  • trt__GetProfilesResponse->Profiles[i].VideoEncoderConfiguration = ( struct tt__VideoEncoderConfiguration *)soap_malloc(soap, sizeof( struct tt__VideoEncoderConfiguration)) ;
  • memset(trt__GetProfilesResponse->Profiles[i].VideoEncoderConfiguration, '\0', sizeof( struct tt__VideoEncoderConfiguration));
  • trt__GetProfilesResponse->Profiles[i].VideoEncoderConfiguration->Name = ( char *)soap_malloc(soap, sizeof( char)*MAX_PROF_TOKEN);
  • memset(trt__GetProfilesResponse->Profiles[i].VideoEncoderConfiguration->Name, '\0', sizeof( char)*MAX_PROF_TOKEN);
  • strcpy(trt__GetProfilesResponse->Profiles[i].VideoEncoderConfiguration->Name, "test_vename");
  • trt__GetProfilesResponse->Profiles[i].VideoEncoderConfiguration->token = ( char *)soap_malloc(soap, sizeof( char)*MAX_PROF_TOKEN);
  • memset(trt__GetProfilesResponse->Profiles[i].VideoEncoderConfiguration->token, '\0', sizeof( char)*MAX_PROF_TOKEN);
  • strcpy(trt__GetProfilesResponse->Profiles[i].VideoEncoderConfiguration->token, "test_vstoken");
  • trt__GetProfilesResponse->Profiles[i].VideoEncoderConfiguration->UseCount = 1;
  • //当然在实际开发的过程中最好把单个也实现了,也就是__trt__GetProfile函数接口,此接口是根据对应的请求的token来获取对应的信息的!
  • //请求的时候需要匹配的一些基本信息
  • trt__GetVideoEncoderConfigurationResponse->Configuration->Name = ( char *)soap_malloc(soap, sizeof( char)*MAX_PROF_TOKEN);
  • memset(trt__GetVideoEncoderConfigurationResponse->Configuration->Name, '\0', sizeof( char)*MAX_PROF_TOKEN);
  • strcpy(trt__GetVideoEncoderConfigurationResponse->Configuration->Name, "test_vsname");
  • trt__GetVideoEncoderConfigurationResponse->Configuration->token = ( char *)soap_malloc(soap, sizeof( char)*MAX_PROF_TOKEN);
  • memset(trt__GetVideoEncoderConfigurationResponse->Configuration->token, '\0', sizeof( char)*MAX_PROF_TOKEN);
  • strcpy(trt__GetVideoEncoderConfigurationResponse->Configuration->token, "test_vstoken");
  • trt__GetVideoEncoderConfigurationResponse->Configuration->UseCount = 1;
  • trt__GetVideoEncoderConfigurationResponse->Configuration->Quality = 100;
  • //根据前端设备时间支持的编码格式选择对应的值,因为我测试的是设备只支持H264 ,所以选了2
  • trt__GetVideoEncoderConfigurationResponse->Configuration->Encoding = ( enum tt__VideoEncoding) 2; // JPEG = 0 , MPEG = 1, H264 = 2;
  • trt__GetVideoEncoderConfigurationResponse->Configuration->Resolution = ( struct tt__VideoResolution *)soap_malloc(soap, sizeof( struct tt__VideoResolution));
  • memset(trt__GetVideoEncoderConfigurationResponse->Configuration->Resolution, 0 , sizeof( struct tt__VideoResolution));
  • // 请求的视频的分辨率,对应前端设备填写对应的值,我这是1280 * 720
  • trt__GetVideoEncoderConfigurationResponse->Configuration->Resolution->Width  = 1280;
  • trt__GetVideoEncoderConfigurationResponse->Configuration->Resolution->Height = 720;
  • trt__GetVideoEncoderConfigurationResponse->Configuration->RateControl = ( struct tt__VideoRateControl *)soap_malloc(soap, sizeof( struct tt__VideoRateControl));
  • memset(trt__GetVideoEncoderConfigurationResponse->Configuration->RateControl, 0, sizeof( struct tt__VideoRateControl));
  • //请求的对应的编码信息.各个意思参考上面说明
  • trt__GetVideoEncoderConfigurationResponse->Configuration->RateControl->FrameRateLimit   = 30;
  • trt__GetVideoEncoderConfigurationResponse->Configuration->RateControl->EncodingInterval = 1;
  • trt__GetVideoEncoderConfigurationResponse->Configuration->RateControl->BitrateLimit     =2048;
  • trt__GetVideoEncoderConfigurationResponse->Configuration->H264 = ( struct tt__H264Configuration *)soap_malloc(soap, sizeof( struct tt__H264Configuration));
  • memset(trt__GetVideoEncoderConfigurationResponse->Configuration->H264, 0, sizeof( struct tt__H264Configuration));
  • trt__GetVideoEncoderConfigurationResponse->Configuration->H264->GovLength  = 30;
  • trt__GetVideoEncoderConfigurationResponse->Configuration->H264->H264Profile = ( enum tt__H264Profile)3;
  • trt__GetVideoEncoderConfigurationsResponse->Configurations[0].Name = ( char *)soap_malloc(soap, sizeof( char)*MAX_PROF_TOKEN);
  • memset(trt__GetVideoEncoderConfigurationsResponse->Configurations[0].Name, '\0', sizeof( char)*MAX_PROF_TOKEN);
  • strcpy(trt__GetVideoEncoderConfigurationsResponse->Configurations[0].Name, "test_vsname");
  • trt__GetVideoEncoderConfigurationsResponse->Configurations[0].token = ( char *)soap_malloc(soap, sizeof( char)*MAX_PROF_TOKEN);
  • memset(trt__GetVideoEncoderConfigurationsResponse->Configurations[0].token, '\0', sizeof( char)*MAX_PROF_TOKEN);
  • //请求的token值
  • strcpy(trt__GetVideoEncoderConfigurationsResponse->Configurations[0].token, "test_vstoken");
  • trt__GetVideoEncoderConfigurationsResponse->Configurations[0].UseCount = 1;
  • trt__GetVideoEncoderConfigurationsResponse->Configurations[0].Quality = 100;
  • trt__GetVideoEncoderConfigurationsResponse->Configurations[0].Encoding = ( enum tt__VideoEncoding) 2; // JPEG = 0 , MPEG = 1, H264 = 2;
  • trt__GetVideoEncoderConfigurationsResponse->Configurations[0].Resolution = ( struct tt__VideoResolution *)soap_malloc(soap, sizeof( struct tt__VideoResolution));
  • memset(trt__GetVideoEncoderConfigurationsResponse->Configurations[0].Resolution, 0 , sizeof( struct tt__VideoResolution));
  • // 请求的视频的分辨率,对应前端设备填写对应的值,我这是1280 * 720
  • trt__GetVideoEncoderConfigurationsResponse->Configurations[0].Resolution->Width  = 1280;
  • trt__GetVideoEncoderConfigurationsResponse->Configurations[0].Resolution->Height = 720;
  • trt__GetVideoEncoderConfigurationsResponse->Configurations[0].RateControl = ( struct tt__VideoRateControl *)soap_malloc(soap, sizeof( struct tt__VideoRateControl));
  • memset(trt__GetVideoEncoderConfigurationsResponse->Configurations[0].RateControl, 0, sizeof( struct tt__VideoRateControl));
  • //请求的视频数据的一些编码信息
  • trt__GetVideoEncoderConfigurationsResponse->Configurations[0].RateControl->FrameRateLimit   = 30;
  • trt__GetVideoEncoderConfigurationsResponse->Configurations[0].RateControl->EncodingInterval = 1;
  • trt__GetVideoEncoderConfigurationsResponse->Configurations[0].RateControl->BitrateLimit     = 2048;
  • trt__GetVideoEncoderConfigurationsResponse->Configurations[0].H264 = ( struct tt__H264Configuration *)soap_malloc(soap, sizeof( struct tt__H264Configuration));
  • memset(trt__GetVideoEncoderConfigurationsResponse->Configurations[0].H264, 0, sizeof( struct tt__H264Configuration));
  • trt__GetVideoEncoderConfigurationsResponse->Configurations[0].H264->GovLength  = 30;
  • trt__GetVideoEncoderConfigurationsResponse->Configurations[0].H264->H264Profile = ( enum tt__H264Profile)3;
  • trt__GetVideoSourceConfigurationResponse->Configuration->UseCount = 1;
  • trt__GetVideoSourceConfigurationResponse->Configuration->Name = ( char*)soap_malloc(soap, sizeof( char) * MAX_PROF_TOKEN);
  • memset(trt__GetVideoSourceConfigurationResponse->Configuration->Name, '\0', sizeof( char) * MAX_PROF_TOKEN);
  • strcpy(trt__GetVideoSourceConfigurationResponse->Configuration->Name, "test_vsname");
  • trt__GetVideoSourceConfigurationResponse->Configuration->token = ( char*)soap_malloc(soap, sizeof( char) * MAX_PROF_TOKEN);
  • memset(trt__GetVideoSourceConfigurationResponse->Configuration->token, '\0', sizeof( char) * MAX_PROF_TOKEN);
  • strcpy(trt__GetVideoSourceConfigurationResponse->Configuration->token, "test_vstoken");
  • trt__GetVideoSourceConfigurationResponse->Configuration->SourceToken = ( char*)soap_malloc(soap, sizeof( char) * MAX_PROF_TOKEN);
  • memset(trt__GetVideoSourceConfigurationResponse->Configuration->SourceToken, '\0', sizeof( char) * MAX_PROF_TOKEN);
  • strcpy(trt__GetVideoSourceConfigurationResponse->Configuration->SourceToken, "test_vstoken");
  • trt__GetVideoSourceConfigurationResponse->Configuration->Bounds = ( struct tt__IntRectangle *)soap_malloc(soap, sizeof( struct tt__IntRectangle));
  • memset(trt__GetVideoSourceConfigurationResponse->Configuration->Bounds, 0, sizeof( struct tt__IntRectangle));
  • trt__GetVideoSourceConfigurationResponse->Configuration->Bounds->x      = 0;
  • trt__GetVideoSourceConfigurationResponse->Configuration->Bounds->y      = 0;
  • trt__GetVideoSourceConfigurationResponse->Configuration->Bounds->width  = 1280;
  • trt__GetVideoSourceConfigurationResponse->Configuration->Bounds->height = 720;
  • trt__GetVideoSourceConfigurationsResponse->Configurations[0].UseCount = 1;
  • trt__GetVideoSourceConfigurationsResponse->Configurations[0].Name = ( char*)soap_malloc(soap, sizeof( char) * MAX_PROF_TOKEN);
  • memset(trt__GetVideoSourceConfigurationsResponse->Configurations[0].Name, '\0', sizeof( char) * MAX_PROF_TOKEN);
  • strcpy(trt__GetVideoSourceConfigurationsResponse->Configurations[0].Name, "test_vsname");
  • trt__GetVideoSourceConfigurationsResponse->Configurations[0].token = ( char*)soap_malloc(soap, sizeof( char) * MAX_PROF_TOKEN);
  • memset(trt__GetVideoSourceConfigurationsResponse->Configurations[0].token, '\0', sizeof( char) * MAX_PROF_TOKEN);
  • strcpy(trt__GetVideoSourceConfigurationsResponse->Configurations[0].token, "test_vstoken");
  • trt__GetVideoSourceConfigurationsResponse->Configurations[0].SourceToken = ( char*)soap_malloc(soap, sizeof( char) * MAX_PROF_TOKEN);
  • memset(trt__GetVideoSourceConfigurationsResponse->Configurations[0].SourceToken, '\0', sizeof( char) * MAX_PROF_TOKEN);
  • strcpy(trt__GetVideoSourceConfigurationsResponse->Configurations[0].SourceToken, "test_vstoken");
  • trt__GetVideoSourceConfigurationsResponse->Configurations[0].Bounds = ( struct tt__IntRectangle *)soap_malloc(soap, sizeof( struct tt__IntRectangle));
  • memset(trt__GetVideoSourceConfigurationsResponse->Configurations[0].Bounds, 0, sizeof( struct tt__IntRectangle));
  • trt__GetVideoSourceConfigurationsResponse->Configurations[0].Bounds->x      = 0;
  • trt__GetVideoSourceConfigurationsResponse->Configurations[0].Bounds->y      = 0;
  • trt__GetVideoSourceConfigurationsResponse->Configurations[0].Bounds->width  = 1280;
  • trt__GetVideoSourceConfigurationsResponse->Configurations[0].Bounds->height = 720;
  • trt__GetStreamUriResponse->MediaUri = ( struct tt__MediaUri *)soap_malloc(soap, sizeof( struct tt__MediaUri));
  • memset(trt__GetStreamUriResponse->MediaUri, 0, sizeof( struct tt__MediaUri));
  • trt__GetStreamUriResponse->MediaUri->Uri = ( char *)soap_malloc(soap, sizeof( char) * MAX_64_LEN);
  • memset(trt__GetStreamUriResponse->MediaUri->Uri, '\0', sizeof( char) * MAX_64_LEN);
  • //根据各个设备的rtsp协议的uri不同填写对应的值
  • strncpy(trt__GetStreamUriResponse->MediaUri->Uri, "rtsp://192.168.12.135:554/livestream", MAX_64_LEN);
  • trt__GetStreamUriResponse->MediaUri->InvalidAfterConnect = ( enum xsd__boolean)0;
  • trt__GetStreamUriResponse->MediaUri->InvalidAfterReboot  = ( enum xsd__boolean)0;
  • //超时时间
  • trt__GetStreamUriResponse->MediaUri->Timeout = 200;
  • 设备端通过Onvif协议来实现RTSP预览的代码已经基本写完,现在可以看看效果,首先确定设备端能够通过vlc正确预览图像, 也就是说设备端需要支持RTSP协议,

    可能通过Live555来实现。然后就可以通过onvif的工具 Onvif  Deviece Manager 来查看效果了!

    先看看Live Video的效果

    再看看Video Stream的效果图

    最后看看token的一些显示的基本信息

    里面因为是自己的一些token和name信息,所以我就打了码,这是都是可以根据自己的设备自己来定的,所以对对接视频没有响,只要在请求的时候对应自己的设备的能力值获取的时候对应起来就可以的!onvif设备端对接视频流也就完成!

    这个过程中还是有很多不不懂的地方,可能上面的开发过程很多不够完善的地方,如果有懂的更多这方面知识的开发者,
    希望能指出我的不足或者提出自己的观点,大家相互促进学习。

    深入理解rtmp(四)之协议实现分析
    接下来要实现connect,createStream,play,..,为了效率和篇幅,我们直接分析srs-librtmp的实现.srs-librtmp是从srs作者为srs服务实现的客户端库(The client library srs-librtmp of SRS),其实不止客户端,也实现了一个简单的server功能.
    STM32+果云GA6-GPRS/GSM模块+MQTT+HTTP协议连接中移OneNet上传GPS数据定位
    STM32+果云GA6-GPRS/GSM模块+MQTT+HTTP协议连接中移OneNet上传GPS数据定位
    基于声网的音视频SDK和FreeSWITCH开发WebRTC2SIP Gateway 报文设计 (二)
    基于声网的音视频SDK和FreeSWITCH开发WebRTC2SIP Gateway 报文设计
    基于声网的音视频SDK和FreeSWITCH开发WebRTC2SIP Gateway 遇到的坑(三)
    基于声网的音视频SDK和FreeSWITCH开发WebRTC2SIP Gateway 遇到的坑
    好多开发者一直搞不清轻量级RTSP服务SDK和RTSP推流SDK的区别(Github下载地址),以下是相关区别: 轻量级RTSP服务模块:轻量级RTSP服务解决的核心痛点是避免用户或者开发者单独部署RTSP或者RTMP服务,实现本地的音视频数据(如摄像头、麦克风),编码后,汇聚到内置RTSP服务,对外提供可供拉流的RTSP URL,轻量级RTSP服务,适用于内网环境下,对并发要求不高的场景,支持H.264/H.265,支持RTSP鉴权、单播、组播模式,考虑到单个服务承载能力,我们支持同时创建多个RTSP服务,并支持获取当前RTSP服务会话连接数。
    物联网平台实用技巧:通过服务端订阅(HTTP/2)获取设备状态
    物联网很多业务场景中,时常需要获取设备的实时状态,以便根据不同的状态(在线或离线)做不同的处理。阿里云物联网平台提供服务端订阅功能来获取设备的状态信息。本文介绍通过HTTP/2通道订阅获取设备状态的方法
    如何对RTSP播放器做功能和性能评估
    好多开发者在做产品竞品分析的时候,不知道如何界定一个RTSP播放器,大牛直播SDK认为,一个RTSP播放器,不是说有几个类似于Open/Close接口就够了,好的RTSP播放器需要具备以下功能和性能属性: 好多企业或开发者给我们反映,他们期望能把外网的rtsp或rtmp流,直接拉取注入到内网流媒体服务器,保证内网用户,无需访问,直接链接到内网服务器就可以观看到公网rtmp/rtsp流。