先放代码:

IpcInfo info;if(UI_lookup_ipc(ipc_id, info))//从数据库获取对应id的ipc信息{return -1 ;}char *xaddr = (char *)malloc(256);memset(xaddr, '\0', 256);sprintf(xaddr, "http://%s:%d/onvif/device_service", info.net_info.ip_addr1, 80);if( NULL == xaddr || '\0' == xaddr[0]){DBGLOG("param invalid!");return -1;}struct soap *soap=discovery_get_soap();  //soap_new();if (NULL==soap){printf("the soap fails to create!\n");return -1;}struct _tds__GetCapabilities *tds__GetCapabilities = (struct _tds__GetCapabilities *)soap_mallocz( soap, sizeof(struct _tds__GetCapabilities));struct _tds__GetCapabilitiesResponse *tds__GetCapabilitiesResponse= (struct _tds__GetCapabilitiesResponse *)soap_mallocz( soap, sizeof(struct _tds__GetCapabilitiesResponse));struct _trt__GetProfilesResponse   *trt__GetProfilesResponse=(struct _trt__GetProfilesResponse   *)soap_mallocz( soap, sizeof(struct _trt__GetProfilesResponse));struct _trt__GetProfiles *trt__GetProfiles=(struct _trt__GetProfiles *)soap_mallocz( soap, sizeof(struct _trt__GetProfiles));char username[MAX_TOKEN_LEN] = {""};char password[MAX_TOKEN_LEN];UI_lookup_passwd(ipc_id, username, password);//从数据库中获得对应的账号密码信息int diffTime = onvif_get_system_time_and_date_diff(soap, xaddr);if('\0' != username[0]){soap_wsse_add_UsernameTokenDigest1(soap,diffTime, g_uuid, username, password);//用户验证}tds__GetCapabilities->Category = (enum tt__CapabilityCategory *)soap_mallocz( soap, sizeof(enum tt__CapabilityCategory));*(tds__GetCapabilities->Category) = tt__CapabilityCategory__Media;//设备鉴权,获取媒体配置tds__GetCapabilities->__sizeCategory = 1;char Xaddr[MAX_URL_LEN];if(soap_call___tds__GetCapabilities(soap, xaddr , NULL, tds__GetCapabilities, tds__GetCapabilitiesResponse )!=SOAP_OK ){DBGLOG("error:GetCapabilities, xddr(%s)", xaddr);SOAP_PRINT_FAULT(soap, stderr);strcpy(Xaddr, xaddr);}else{printf("success\n");if( NULL == tds__GetCapabilitiesResponse->Capabilities|| NULL == tds__GetCapabilitiesResponse->Capabilities->Media|| NULL == tds__GetCapabilitiesResponse->Capabilities->Media->XAddr|| strlen(tds__GetCapabilitiesResponse->Capabilities->Media->XAddr) > MAX_URL_LEN){strcpy(Xaddr, xaddr);}else{strcpy(Xaddr, tds__GetCapabilitiesResponse->Capabilities->Media->XAddr);}}if( '\0' != username[0] ){soap_wsse_add_UsernameTokenDigest1(soap,diffTime, g_uuid, username, password);//每次调用soap接口都需要验证DBGLOG("%s %s", username, password);}struct tt__Profile *Profiles;int protoken_size=5;if(soap_call___trt__GetProfiles(soap, Xaddr, NULL, trt__GetProfiles,trt__GetProfilesResponse )!=SOAP_OK ){if(NULL==trt__GetProfilesResponse){printf("error!\n");return -1;}protoken_size = fiflter_profiles(soap, trt__GetProfilesResponse, &Profiles);if(0==protoken_size)return -1;if (protoken_size>1){Profiles++;}}else{protoken_size = fiflter_profiles(soap, trt__GetProfilesResponse, &Profiles);//获取profiles文件数,并将内容取出if (protoken_size>1){Profiles++;}}struct _trt__SetVideoEncoderConfiguration *trt__SetVideoEncoderConfiguration=(struct _trt__SetVideoEncoderConfiguration*)soap_mallocz( soap, sizeof(struct _trt__SetVideoEncoderConfiguration));struct _trt__SetVideoEncoderConfigurationResponse *trt__SetVideoEncoderConfigurationResponse=(struct _trt__SetVideoEncoderConfigurationResponse *)soap_mallocz( soap, sizeof(struct _trt__SetVideoEncoderConfigurationResponse));trt__SetVideoEncoderConfiguration->ForcePersistence=xsd__boolean__true_;if(NULL==Profiles->VideoEncoderConfiguration||NULL==Profiles->VideoEncoderConfiguration->RateControl||NULL==Profiles->VideoEncoderConfiguration->RateControl->BitrateLimit||NULL==Profiles->VideoEncoderConfiguration->RateControl->FrameRateLimit){printf("error in getprofiles!\n");return -1;}trt__SetVideoEncoderConfiguration->Configuration=Profiles->VideoEncoderConfiguration;printf("%s\n%s\n",Profiles->token,trt__SetVideoEncoderConfiguration->Configuration->token);if(1==g_stl_enable)//码流切换控制部分,所取值须在允许范围内{trt__SetVideoEncoderConfiguration->Configuration->RateControl->FrameRateLimit=16;trt__SetVideoEncoderConfiguration->Configuration->RateControl->BitrateLimit=128;}else{trt__SetVideoEncoderConfiguration->Configuration->RateControl->FrameRateLimit=25;trt__SetVideoEncoderConfiguration->Configuration->RateControl->BitrateLimit=512;}if('\0' != username[0]){soap_wsse_add_UsernameTokenDigest1(soap,diffTime, g_uuid, username, password);}if(soap_call___trt__SetVideoEncoderConfiguration(soap, Xaddr, NULL, trt__SetVideoEncoderConfiguration,trt__SetVideoEncoderConfigurationResponse)!=SOAP_OK ){DBGLOG("error:SetVideoEncoderConfiguration, xddr(%s)", Xaddr);SOAP_PRINT_FAULT(soap, stderr);return -1;}if(NULL!=xaddr){free(xaddr);xaddr=NULL;}if(NULL!=soap){soap_destroy(soap);}if(NULL!=tds__GetCapabilities){free(tds__GetCapabilities);tds__GetCapabilities=NULL;}if(NULL!=tds__GetCapabilitiesResponse){free(tds__GetCapabilitiesResponse);tds__GetCapabilitiesResponse=NULL;}if(NULL!=trt__GetProfilesResponse){free(trt__GetProfilesResponse);trt__GetProfilesResponse=NULL;}if(NULL!=trt__GetProfiles){free(trt__GetProfiles);trt__GetProfiles=NULL;}if(NULL!=trt__SetVideoEncoderConfiguration){free(trt__SetVideoEncoderConfiguration);trt__SetVideoEncoderConfiguration=NULL;}if(NULL!=trt__SetVideoEncoderConfigurationResponse){free(trt__SetVideoEncoderConfigurationResponse);trt__SetVideoEncoderConfigurationResponse=NULL;}return 0;

用多种型号的ip摄像头测试时发现:雄迈ipc不支持远程onvif修改,大华ipc支持远程修改,海康ipc265编码onvif协议不支持,profiles大小超出onvif解析数据包最大数值。

对于获取不到profiles的海康ipc,如码流编码为h264,可通过soap_call___trt__GetVideoEncoderConfiguration接口,获取对应码流的配置,从而进行修改

onvif协议远程调节ip摄像机码流信息相关推荐

  1. RTP协议全解析(H264码流和PS流)(转)

    源: RTP协议全解析(H264码流和PS流) 转载于:https://www.cnblogs.com/LittleTiger/p/10489247.html

  2. 宇视摄像机码流类型定码率和变码率的区别?

    问题:宇视摄像机码流类型定码率和变码率的区别? 答案: 定码率:数据以恒定的码率进行传输,波动较小 变码率:码率会根据实况质量进行调整,波动较大

  3. FFmpeg源码分析:avformat_find_stream_info分析码流信息

    FFmpeg在调用avformat_open_input()之后,可能码流信息不够完整,可以使用avformat_find_stream_info()获取更多的码流信息.比如获取视频帧率.视频宽高,重 ...

  4. RTP协议全解(H264码流和PS流)

    1 视频编码的原理 1.1 一个图像或者一个视频序列进行压缩,产生码流. 对图像的处理即是:帧内预测编码 其预测值P,是由已编码的图像做参考,经运动补偿得到的.预测图像P和当前帧Fn相减,得到两图像的 ...

  5. RTP协议全解(H264码流和PS流)——看完这篇可以毕业

    http://blog.csdn.net/bytxl/article/details/50395427 版权声明:本文为博主原创文章,未经博主允许不得转载. 目录(?)[+] 1 视频编码的原理 1. ...

  6. RTP协议全解析(H264码流和PS流

    写在前面:RTP的解析,网上找了很多资料,但是都不全,所以我力图整理出一个比较全面的解析, 其中借鉴了很多文章,我都列在了文章最后,在此表示感谢. 互联网的发展离不开大家的无私奉献,我决定从我做起,希 ...

  7. ps流 转发_(转)RTP协议全解(H264码流和PS流)

    写在前面:RTP的解析,网上找了很多资料,但是都不全,所以我力图整理出一个比较全面的解析, 其中借鉴了很多文章,我都列在了文章最后,在此表示感谢. 互联网的发展离不开大家的无私奉献,我决定从我做起,希 ...

  8. 摄像机码流平滑参数解析

    码流平滑 针对因I帧过大导致瞬时码流过高场景,可以通过设置码流平滑参数降低I帧大小,从而抑制过高的瞬时码流. 背景信息 码流平滑是针对支持H.264和H.265编码的系列设备实现的功能,通过调整设备内 ...

  9. ps流 转发_RTP协议全解析(H264码流和PS流)(转)

    [LeetCode] Arranging Coins 排列硬币 You have a total of n coins that you want to form in a staircase sha ...

最新文章

  1. 【模板小程序】求M~N范围内的质数个数
  2. 通过JS如何获取IP地址
  3. “【第二届】Erlang Fans交流会”议程
  4. [渝粤教育] 中国地质大学 马克思主义基本原理 复习题
  5. 查询显示注释_SQL的简单查询
  6. Typora颠覆写作体验的极简好用 Markdown 编辑器基本设置教程
  7. 火车头php接口制作,火车头接口
  8. Java延时队列DelayedQueue
  9. [leetcode-347-Top K Frequent Elements]
  10. 离线计算框架MapReduce
  11. python 执行shell 事务_python中执行shell的两种方法总结
  12. csc.exe的使用
  13. 浅谈公安大数据的建设
  14. [NOIP模拟测试34]反思+题解
  15. dot product【点积】
  16. MPEG DASH MPD文件字段解释
  17. Moran_DeepLPF_Deep_Local_Parametric_Filters_for_Image_Enhancement_CVPR_2020_paper
  18. Ubuntu18.04 MySQL+hive安装
  19. Python光大证券中文云系统——爬取新浪财经新闻
  20. 基于Comsol的超声探测锂电池SOC状态仿真分析

热门文章

  1. PHP实现斐波纳契数列
  2. C语言 switch语句
  3. Android(安卓) 接入企业微信
  4. Maven命令行窗口指定settings.xml
  5. 技术大佬:我去,你竟然还在用 try–catch-finally
  6. SpringBoot单元测试Mock静态方法
  7. 小白问题,python anaconda关系 pip install安装包
  8. U型地埋管(地埋管换热器采用单孔双U管)仿真教程
  9. dmc预测控制 matlab,预测控制动态矩阵DMC算法研究分析及仿真.doc
  10. 什么是智能客服?智能客服能做到什么?