完整域名展示网站源码wordpress自助发货系统
- 作者: 五速梦信息网
- 时间: 2026年04月20日 08:19
当前位置: 首页 > news >正文
完整域名展示网站源码,wordpress自助发货系统,广东东莞营销,建设部继续教育网站实现了Onvif服务端的设备搜索和RTSP流的功能。用 ONVIF Device Manager 测试工具可以成功搜索到设备和获取到RTSP流#xff0c;有的路由器可能不支持239.255.255.250组播#xff0c;我一开始用的电信的那种光猫路由器二合一的#xff0c;一直搜不到设备#xff0c;后面用So…实现了Onvif服务端的设备搜索和RTSP流的功能。用 ONVIF Device Manager 测试工具可以成功搜索到设备和获取到RTSP流有的路由器可能不支持239.255.255.250组播我一开始用的电信的那种光猫路由器二合一的一直搜不到设备后面用Socket调试工具发现根本收不到组播消息换了个小米的路由器就可以了。RTSP服务端我是直接用的 live555 完整代码我已上传不需要积分就能下载。主要是看onvif_server.c 和 onvif_server_interface.c 文件onvif_server.c 主要是创建socket服务onvif_server_interface.c 主要是实现相关的onvif服务接口。相关代码如下 onvif_server.c #include pthread.h #include soapH.h #include macro.hvoid *onvif_discovered_server(void *arg) {struct soap soap_udp;int socked_fd;// 初始化 SOAP 服务器对象soap_init1(soap_udp, SOAP_IO_UDP | SOAP_XML_IGNORENS);soap_udp.bind_flags SO_REUSEADDR; // 允许重复绑定soap_udp.port 3702;soap_set_namespaces(soap_udp, namespaces);// 绑定端口socked_fd soap_bind(soap_udp, NULL, soap_udp.port, 10);if (socked_fd 0){printf(%d soap_bind failed\n, LINE);soap_print_fault(soap_udp, stderr);goto end;}// 加入组播struct ip_mreq mreqcon;mreqcon.imr_multiaddr.s_addr inet_addr(239.255.255.250);mreqcon.imr_interface.s_addr htonl(INADDR_ANY);if (setsockopt(soap_udp.master, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)mreqcon, sizeof(mreqcon)) 0){printf(setsockopt error, error message: %s\n, strerror(errno));goto end;}while (1){socked_fd soap_serve(soap_udp);if (socked_fd ! SOAP_OK){printf(%d soap_serve failed\n, LINE);soap_print_fault(soap_udp, stderr);}soap_destroy(soap_udp);soap_end(soap_udp);}end:soap_done(soap_udp);return NULL; }int http_get(struct soap *soap) {FILE *fd NULL;static char buf[1024 * 5] {0};fd fopen(PATH_HTML, rb);if (!fd)return 404;if (soap_response(soap, SOAP_HTML) SOAP_OK) // HTTP response header with text/html{size_t r fread(buf, 1, sizeof(buf), fd);if (r 0)soap_send(soap, buf);}soap_end_send(soap);fclose(fd);return SOAP_OK; }void *onvif_http_server(void *arg) {struct soap soap_tcp;int socked_fd;fd_set readfds;struct timeval timeout;timeout.tv_sec 1;timeout.tv_usec 0;soap_init1(soap_tcp, SOAP_XML_INDENT);soap_tcp.port DEVICE_PORT;soap_tcp.bind_flags SO_REUSEADDR;soap_tcp.send_timeout 3; // send timeout is 3ssoap_tcp.recv_timeout 3; // receive timeout is 3ssoap_tcp.fget http_get;soap_set_namespaces(soap_tcp, namespaces);socked_fd soap_bind(soap_tcp, DEVICE_IP, soap_tcp.port, 10);if (socked_fd 0){printf(%d soap_bind failed\n, LINE);soap_print_fault(soap_tcp, stderr);goto end;}int socked_fd_new -1;while (1){socked_fd_new soap_accept(soap_tcp);if (!soap_valid_socket(socked_fd_new)){printf(soap_accept failed\n);soap_print_fault(soap_tcp, stderr);goto end;}FD_ZERO(readfds);FD_SET(socked_fd_new, readfds);int activity select(socked_fd_new 1, readfds, NULL, NULL, timeout);if (activity 0){printf(select error\n);goto end;}if (FD_ISSET(socked_fd_new, readfds)){if (soap_serve(soap_tcp) ! SOAP_OK){printf(%d soap_serve failed, error: %d\n, LINE, soap_tcp.error);soap_print_fault(soap_tcp, stderr);}}soap_destroy(soap_tcp);soap_end(soap_tcp);}end:soap_done(soap_tcp);return NULL; }int create_onvif_server() {pthread_t thread1, thread2;pthread_attr_t attr1, attr2;pthread_attr_init(attr1);pthread_attr_init(attr2);pthread_attr_setdetachstate(attr1, PTHREAD_CREATE_DETACHED);pthread_attr_setdetachstate(attr2, PTHREAD_CREATE_DETACHED);if (pthread_create(thread1, attr1, onvif_discovered_server, NULL) ! 0)return -1;if (pthread_create(thread2, attr2, onvif_http_server, NULL) ! 0)return -1;pthread_attr_destroy(attr1);pthread_attr_destroy(attr2);return 0; }onvif_server_interface.c这里只写出已经实现了的接口函数: #include wsaapi.h #include soapH.h #include soapStub.h #include macro.h #include wsseapi.h// 该函数从 soapClient.c 文件中拷贝过来的 SOAP_FMAC5 int SOAP_FMAC6 soap_send_wsddProbeMatches(struct soap *soap, const char *soap_endpoint, const char *soap_action, struct wsddProbeMatchesType *wsddProbeMatches) {struct wsddProbeMatches soap_tmp_wsddProbeMatches;if (soap_action NULL)soap_action http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/ProbeMatches;soap_tmp___wsdd__ProbeMatches.wsdd__ProbeMatches wsddProbeMatches;soap_begin(soap);soap_set_version(soap, 2); /* use SOAP1.2 /soap-encodingStyle NULL; / use SOAP literal style */soap_serializeheader(soap);soap_serialize_wsddProbeMatches(soap, soap_tmp_wsddProbeMatches);if (soap_begin_count(soap))return soap-error;if ((soap-mode SOAP_IO_LENGTH)){if (soap_envelope_begin_out(soap) || soap_putheader(soap) || soap_body_begin_out(soap) || soap_put_wsddProbeMatches(soap, soap_tmp_wsddProbeMatches, -wsdd:ProbeMatches, ) || soap_body_end_out(soap) || soap_envelope_end_out(soap))return soap-error;}if (soap_end_count(soap))return soap-error;if (soap_connect(soap, soap_endpoint, soap_action) || soap_envelope_begin_out(soap) || soap_putheader(soap) || soap_body_begin_out(soap) || soap_put_wsddProbeMatches(soap, soap_tmp_wsdd__ProbeMatches, -wsdd:ProbeMatches, ) || soap_body_end_out(soap) || soap_envelope_end_out(soap) || soap_end_send(soap))return soap_closesock(soap);return SOAP_OK; }// 鉴权 int onvif_access_control(struct soap *soap){const char *username soap_wsse_get_Username(soap);if (!username){soap_wsse_delete_Security(soap); // remove old security headers before returning!return soap-error; // no username: return FailedAuthentication (from soap_wsse_get_Username)}if (strcmp(username, USERNAME) ! 0){printf(username error\n);soap_wsse_delete_Security(soap);return 401;}if (soap_wsse_verify_Password(soap, PASSWORD)){soap_wsse_delete_Security(soap); // remove old security headers before returning!return soap-error; // no username: return FailedAuthentication (from soap_wsse_verify_Password)}return 0; }// 实现 wsddProbe 函数用于处理 WS-Discovery Probe 请求 SOAP_FMAC5 int SOAP_FMAC6 wsddProbe(struct soap *soap, struct wsddProbeType *wsddProbe) {printf(——– %s ——–\n, func);// 定义一个 ProbeMatches 结构用于存储多个 ProbeMatch 条目struct wsddProbeMatchesType ProbeMatches;// 假设设备仅有一个匹配项 (一个服务)int MatchSize 1;// 初始化 ProbeMatches 结构清零内存memset(ProbeMatches, 0, sizeof(ProbeMatches));// 分配内存给 ProbeMatch 数组// 使用 soap_malloc 分配内存这样 gSOAP 可以自动管理其生命周期ProbeMatches.ProbeMatch (struct wsddProbeMatchType *)soap_malloc(soap, sizeof(struct wsddProbeMatchType) * MatchSize);if (!ProbeMatches.ProbeMatch)return SOAP_FAULT; // 内存分配失败返回 SOAP Fault// 初始化 ProbeMatches.ProbeMatchsoap_default_wsddProbeMatchType(soap, ProbeMatches.ProbeMatch);// 设置实际的 ProbeMatch 数量ProbeMatches.sizeProbeMatch MatchSize;// 获取第一个也是唯一一个 ProbeMatch 条目struct wsddProbeMatchType ProbeMatch ProbeMatches.ProbeMatch[0];// —————————-// 填充 EndpointReference 信息// —————————-/** EndpointReference 用于标识设备的唯一地址 (URI)。 通常使用设备的 UUID 来生成一个 URN 格式的地址。*/ProbeMatch-wsaEndpointReference.Address (char *)soap_malloc(soap, 256);if (!ProbeMatch-wsaEndpointReference.Address)return SOAP_FAULT;// 格式化地址为 urn:uuid:device_uuidsnprintf(ProbeMatch-wsaEndpointReference.Address, 256, urn:uuid:%s, 12345678-1234-1234-1234-1234567890ab);// ——————-// 填充 Types 信息// ——————-/** Types 用于描述设备的类型根据 ONVIF 规范通常包括设备提供的服务类型。* 例如tdn:NetworkVideoTransmitter 表示设备是一个网络视频传输器。*/ProbeMatch-Types (char )soap_malloc(soap, 256);if (!ProbeMatch-Types)return SOAP_FAULT;strcpy(ProbeMatch-Types, tdn:NetworkVideoTransmitter);// ——————-// 填充 Scopes 信息// ——————-/** Scopes 用于描述设备的作用域信息提供更详细的设备分类和属性。 例如设备类型、制造商、型号、位置等。* 作用域以空格分隔的 URI 形式表示。*/ProbeMatch-Scopes (struct wsddScopesType *)soap_malloc(soap, sizeof(struct wsddScopesType));if (!ProbeMatch-Scopes)return SOAP_FAULT;ProbeMatch-Scopes-item (char )soap_malloc(soap, 512);if (!ProbeMatch-Scopes-item)return SOAP_FAULT;// 示例作用域信息根据实际情况调整snprintf(ProbeMatch-Scopes-item, 512,onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/type/audio_encoder onvif://www.onvif.org/hardware/%s onvif://www.onvif.org/name/%s,MyDeviceHardware, MyONVIFDevice);// ——————-// 填充 XAddrs 信息// ——————-/** XAddrs 提供设备服务的访问地址 (URL)通常包括 HTTP 或 HTTPS 地址。 该地址用于访问设备的 Onvif 服务如设备管理、媒体服务等。*/ProbeMatch-XAddrs (char )soap_malloc(soap, 256);if (!ProbeMatch-XAddrs)return SOAP_FAULT;// 格式化服务访问地址snprintf(ProbeMatch-XAddrs, 256, http://%s:%d/onvif/device_service, DEVICE_IP, DEVICE_PORT);// —————————// 填充 MetadataVersion 信息// —————————/** MetadataVersion 表示设备元数据的版本号用于跟踪设备描述的变化。 每当设备的元数据如服务列表、配置等发生变化时应递增此版本号。*/ProbeMatch-MetadataVersion 1;// Build SOAP Headersoap-header-wsaRelatesTo (struct wsaRelationship *)soap_malloc(soap, sizeof(struct wsaRelationship));if (!soap-header-wsaRelatesTo)return SOAP_FAULT;// 初始化 soap-header-wsaRelatesTosoap_defaultwsaRelatesTo(soap, soap-header-wsaRelatesTo);soap-header-wsaRelatesTo-item soap-header-wsaMessageID;soap-header-wsaAction soap_strdup(soap, http://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatches);soap-header-wsa__To soap_strdup(soap, http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous);// 发送 ProbeMatches 响应return soap_send_wsddProbeMatches(soap, http://, NULL, ProbeMatches); }SOAP_FMAC5 int SOAP_FMAC6 tdsGetCapabilities(struct soap *soap, struct _tdsGetCapabilities *tdsGetCapabilities, struct _tdsGetCapabilitiesResponse *tdsGetCapabilitiesResponse) {printf(——– %s ——–\n, func);/int ret onvif_access_control(soap);if (ret ! 0)return ret;/tdsGetCapabilitiesResponse-Capabilities (struct ttCapabilities *)soap_malloc(soap, sizeof(struct ttCapabilities));memset(tdsGetCapabilitiesResponse-Capabilities, 0, sizeof(struct ttCapabilities));// Mediaif (tdsGetCapabilities-Category[0] ttCapabilityCategoryMedia ||tdsGetCapabilities-Category[0] ttCapabilityCategoryAll){tdsGetCapabilitiesResponse-Capabilities-Media (struct ttMediaCapabilities *)soap_malloc(soap, sizeof(struct ttMediaCapabilities));memset(tdsGetCapabilitiesResponse-Capabilities-Media, 0, sizeof(struct ttMediaCapabilities));tdsGetCapabilitiesResponse-Capabilities-Media-XAddr (char *)soap_malloc(soap, sizeof(char) * 256);memset(tdsGetCapabilitiesResponse-Capabilities-Media-XAddr, 0, sizeof(char) * 256);sprintf(tdsGetCapabilitiesResponse-Capabilities-Media-XAddr, http://%s:%d/onvif/media_service, DEVICE_IP, DEVICE_PORT);//MediaStreamingCapabilitiestdsGetCapabilitiesResponse-Capabilities-Media-StreamingCapabilities (struct ttRealTimeStreamingCapabilities *)soap_malloc(soap, sizeof(struct ttRealTimeStreamingCapabilities));memset(tdsGetCapabilitiesResponse-Capabilities-Media-StreamingCapabilities, 0, sizeof(struct ttRealTimeStreamingCapabilities));tdsGetCapabilitiesResponse-Capabilities-Media-StreamingCapabilities-RTPMulticast (enum xsdboolean )soap_malloc(soap, sizeof(enum xsd__boolean));(tdsGetCapabilitiesResponse-Capabilities-Media-StreamingCapabilities-RTPMulticast) xsdbooleanfalse_; // 表示设备不支持RTP的多播功能tdsGetCapabilitiesResponse-Capabilities-Media-StreamingCapabilities-RTP_USCORERTSP_USCORETCP (enum xsdboolean *)soap_malloc(soap, sizeof(enum xsdboolean));*(tdsGetCapabilitiesResponse-Capabilities-Media-StreamingCapabilities-RTP_USCORERTSP_USCORETCP) xsdbooleantrue_; // 表示设备支持通过RTSP的TCP传输方式tdsGetCapabilitiesResponse-Capabilities-Media-StreamingCapabilities-RTP_USCORETCP (enum xsdboolean *)soap_malloc(soap, sizeof(enum xsdboolean));*(tdsGetCapabilitiesResponse-Capabilities-Media-StreamingCapabilities-RTP_USCORETCP) xsdboolean_true; // 表示设备支持RTP协议的TCP传输方式}// 返回成功return SOAP_OK; }SOAP_FMAC5 int SOAP_FMAC6 trtGetVideoSources(struct soap *soap, struct _trtGetVideoSources *trtGetVideoSources, struct _trtGetVideoSourcesResponse *trtGetVideoSourcesResponse) {printf(——– %s ——–\n, func);int size 1;trtGetVideoSourcesResponse-sizeVideoSources size;trtGetVideoSourcesResponse-VideoSources (struct ttVideoSource *)soap_malloc(soap, sizeof(struct ttVideoSource) * size);memset(trtGetVideoSourcesResponse-VideoSources, 0, sizeof(struct ttVideoSource) * trtGetVideoSourcesResponse-sizeVideoSources);trtGetVideoSourcesResponse-VideoSources-token (char *)soap_malloc(soap, sizeof(char) * 32);memset(trtGetVideoSourcesResponse-VideoSources-token, 0, sizeof(char) * 32);strcpy(trtGetVideoSourcesResponse-VideoSources-token, vs_SourceToken);trtGetVideoSourcesResponse-VideoSources-Resolution (struct ttVideoResolution *)soap_malloc(soap, sizeof(struct ttVideoResolution));memset(trtGetVideoSourcesResponse-VideoSources-Resolution, 0, sizeof(struct ttVideoResolution));trtGetVideoSourcesResponse-VideoSources-Resolution-Width VIDEO_WIDTH;trtGetVideoSourcesResponse-VideoSources-Resolution-Height VIDEO_HEIGHT;trtGetVideoSourcesResponse-VideoSources-Framerate FRAME_RATE;return SOAP_OK; }SOAP_FMAC5 int SOAP_FMAC6 trtGetProfile(struct soap *soap, struct _trtGetProfile *trtGetProfile, struct _trtGetProfileResponse *trtGetProfileResponse) {printf(——– %s ——–\n, func);trtGetProfileResponse-Profile (struct ttProfile *)soap_malloc(soap, sizeof(struct ttProfile));memset(trtGetProfileResponse-Profile, 0, sizeof(struct ttProfile));trtGetProfileResponse-Profile-Name (char *)soap_malloc(soap, sizeof(char) * 32);memset(trtGetProfileResponse-Profile-Name, 0, sizeof(char) * 32);strcpy(trtGetProfileResponse-Profile-Name, MyProfile);trtGetProfileResponse-Profile-token (char *)soap_malloc(soap, sizeof(char) * 32);memset(trtGetProfileResponse-Profile-token, 0, sizeof(char) * 32);strcpy(trtGetProfileResponse-Profile-token, ProfileToken);trtGetProfileResponse-Profile-fixed (enum xsdboolean *)soap_malloc(soap, sizeof(enum xsdboolean));*(trtGetProfileResponse-Profile-fixed) xsdbooleantrue_;// VideoSourceConfigurationname和VideoSourceConfigurationtokentrtGetProfileResponse-Profile-VideoSourceConfiguration (struct ttVideoSourceConfiguration *)soap_malloc(soap, sizeof(struct ttVideoSourceConfiguration));memset(trtGetProfileResponse-Profile-VideoSourceConfiguration, 0, sizeof(struct ttVideoSourceConfiguration));trtGetProfileResponse-Profile-VideoSourceConfiguration-Name (char *)soap_malloc(soap, sizeof(char) * 32);memset(trtGetProfileResponse-Profile-VideoSourceConfiguration-Name, 0, sizeof(char) * 32);strcpy(trtGetProfileResponse-Profile-VideoSourceConfiguration-Name, vs_name);trtGetProfileResponse-Profile-VideoSourceConfiguration-token (char *)soap_malloc(soap, sizeof(char) * 32);memset(trtGetProfileResponse-Profile-VideoSourceConfiguration-token, 0, sizeof(char) * 32);strcpy(trtGetProfileResponse-Profile-VideoSourceConfiguration-token, vs_token);trtGetProfileResponse-Profile-VideoSourceConfiguration-SourceToken (char *)soap_malloc(soap, sizeof(char) * 32);memset(trtGetProfileResponse-Profile-VideoSourceConfiguration-SourceToken, 0, sizeof(char) * 32);strcpy(trtGetProfileResponse-Profile-VideoSourceConfiguration-SourceToken, vs_SourceToken);trtGetProfileResponse-Profile-VideoSourceConfiguration-UseCount 1;// VideoSourceConfigurationBoundstrtGetProfileResponse-Profile-VideoSourceConfiguration-Bounds (struct ttIntRectangle *)soap_malloc(soap, sizeof(struct ttIntRectangle));memset(trtGetProfileResponse-Profile-VideoSourceConfiguration-Bounds, 0, sizeof(struct ttIntRectangle));trtGetProfileResponse-Profile-VideoSourceConfiguration-Bounds-x 0;trtGetProfileResponse-Profile-VideoSourceConfiguration-Bounds-y 0;trtGetProfileResponse-Profile-VideoSourceConfiguration-Bounds-width VIDEO_WIDTH;trtGetProfileResponse-Profile-VideoSourceConfiguration-Bounds-height VIDEO_HEIGHT;// VideoEncoderConfigurationtrtGetProfileResponse-Profile-VideoEncoderConfiguration (struct ttVideoEncoderConfiguration *)soap_malloc(soap, sizeof(struct ttVideoEncoderConfiguration));memset(trtGetProfileResponse-Profile-VideoEncoderConfiguration, 0, sizeof(struct ttVideoEncoderConfiguration));trtGetProfileResponse-Profile-VideoEncoderConfiguration-Name (char *)soap_malloc(soap, sizeof(char) * 32);memset(trtGetProfileResponse-Profile-VideoEncoderConfiguration-Name, 0, sizeof(char) * 32);strcpy(trtGetProfileResponse-Profile-VideoEncoderConfiguration-Name, ve_name);trtGetProfileResponse-Profile-VideoEncoderConfiguration-token (char *)soap_malloc(soap, sizeof(char) * 32);memset(trtGetProfileResponse-Profile-VideoEncoderConfiguration-token, 0, sizeof(char) * 32);strcpy(trtGetProfileResponse-Profile-VideoEncoderConfiguration-token, ve_token);trtGetProfileResponse-Profile-VideoEncoderConfiguration-UseCount 1;trtGetProfileResponse-Profile-VideoEncoderConfiguration-Encoding ttVideoEncodingH264;// VideoEncoderConfigurationResolution、RateControltrtGetProfileResponse-Profile-VideoEncoderConfiguration-Resolution (struct ttVideoResolution *)soap_malloc(soap, sizeof(struct ttVideoResolution));memset(trtGetProfileResponse-Profile-VideoEncoderConfiguration-Resolution, 0, sizeof(struct ttVideoResolution));trtGetProfileResponse-Profile-VideoEncoderConfiguration-Resolution-Width VIDEO_WIDTH;trtGetProfileResponse-Profile-VideoEncoderConfiguration-Resolution-Height VIDEO_HEIGHT;trtGetProfileResponse-Profile-VideoEncoderConfiguration-Quality 10;// VideoEncoderConfigurationRateControltrtGetProfileResponse-Profile-VideoEncoderConfiguration-RateControl (struct ttVideoRateControl *)soap_malloc(soap, sizeof(struct ttVideoRateControl));memset(trtGetProfileResponse-Profile-VideoEncoderConfiguration-RateControl, 0, sizeof(struct ttVideoRateControl));trtGetProfileResponse-Profile-VideoEncoderConfiguration-RateControl-FrameRateLimit FRAME_RATE;trtGetProfileResponse-Profile-VideoEncoderConfiguration-RateControl-EncodingInterval 1;trtGetProfileResponse-Profile-VideoEncoderConfiguration-RateControl-BitrateLimit 6000;// VideoEncoderConfigurationH264trtGetProfileResponse-Profile-VideoEncoderConfiguration-H264 (struct ttH264Configuration *)soap_malloc(soap, sizeof(struct ttH264Configuration));memset(trtGetProfileResponse-Profile-VideoEncoderConfiguration-H264, 0, sizeof(struct ttH264Configuration));trtGetProfileResponse-Profile-VideoEncoderConfiguration-H264-GovLength 120;trtGetProfileResponse-Profile-VideoEncoderConfiguration-H264-H264Profile ttH264Profile__High;return SOAP_OK; }SOAP_FMAC5 int SOAP_FMAC6 trtGetProfiles(struct soap *soap, struct _trtGetProfiles *trtGetProfiles, struct _trtGetProfilesResponse *trtGetProfilesResponse) {printf(——– %s ——–\n, func);trtGetProfilesResponse-sizeProfiles 1;trtGetProfilesResponse-Profiles (struct ttProfile *)soap_malloc(soap, sizeof(struct ttProfile) * trtGetProfilesResponse-sizeProfiles);memset(trtGetProfilesResponse-Profiles, 0, sizeof(struct ttProfile) * trtGetProfilesResponse-sizeProfiles);int i 0;trtGetProfilesResponse-Profiles[i].Name (char *)soap_malloc(soap, sizeof(char) * 32);memset(trtGetProfilesResponse-Profiles[i].Name, 0, sizeof(char) * 32);strcpy(trtGetProfilesResponse-Profiles[i].Name, MyProfile);trtGetProfilesResponse-Profiles[i].token (char *)soap_malloc(soap, sizeof(char) * 32);memset(trtGetProfilesResponse-Profiles[i].token, 0, sizeof(char) * 32);strcpy(trtGetProfilesResponse-Profiles[i].token, ProfileToken);// VideoSourceConfigurationnametrtGetProfilesResponse-Profiles[i].VideoSourceConfiguration (struct ttVideoSourceConfiguration *)soap_malloc(soap, sizeof(struct ttVideoSourceConfiguration));memset(trtGetProfilesResponse-Profiles[i].VideoSourceConfiguration, 0, sizeof(struct ttVideoSourceConfiguration));trtGetProfilesResponse-Profiles[i].VideoSourceConfiguration-Name (char *)soap_malloc(soap, sizeof(char) * 32);memset(trtGetProfilesResponse-Profiles[i].VideoSourceConfiguration-Name, 0, sizeof(char) * 32);strcpy(trtGetProfilesResponse-Profiles[i].VideoSourceConfiguration-Name, vs_name);// VideoSourceConfigurationtokentrtGetProfilesResponse-Profiles[i].VideoSourceConfiguration-token (char *)soap_malloc(soap, sizeof(char) * 32);memset(trtGetProfilesResponse-Profiles[i].VideoSourceConfiguration-token, 0, sizeof(char) * 32);strcpy(trtGetProfilesResponse-Profiles[i].VideoSourceConfiguration-token, vs_token);trtGetProfilesResponse-Profiles[i].VideoSourceConfiguration-SourceToken (char *)soap_malloc(soap, sizeof(char) * 32);memset(trtGetProfilesResponse-Profiles[i].VideoSourceConfiguration-SourceToken, 0, sizeof(char) * 32);strcpy(trtGetProfilesResponse-Profiles[i].VideoSourceConfiguration-SourceToken, vs_SourceToken);trtGetProfilesResponse-Profiles[i].VideoSourceConfiguration-UseCount 1; // 表示该视频源配置的使用次数// VideoSourceConfigurationBoundstrtGetProfilesResponse-Profiles[i].VideoSourceConfiguration-Bounds (struct ttIntRectangle *)soap_malloc(soap, sizeof(struct ttIntRectangle));memset(trtGetProfilesResponse-Profiles[i].VideoSourceConfiguration-Bounds, 0, sizeof(struct ttIntRectangle));trtGetProfilesResponse-Profiles[i].VideoSourceConfiguration-Bounds-x 0;trtGetProfilesResponse-Profiles[i].VideoSourceConfiguration-Bounds-y 0;trtGetProfilesResponse-Profiles[i].VideoSourceConfiguration-Bounds-width VIDEO_WIDTH;trtGetProfilesResponse-Profiles[i].VideoSourceConfiguration-Bounds-height VIDEO_HEIGHT;// VideoEncoderConfigurationtrtGetProfilesResponse-Profiles[i].VideoEncoderConfiguration (struct ttVideoEncoderConfiguration *)soap_malloc(soap, sizeof(struct ttVideoEncoderConfiguration));memset(trtGetProfilesResponse-Profiles[i].VideoEncoderConfiguration, 0, sizeof(struct ttVideoEncoderConfiguration));trtGetProfilesResponse-Profiles[i].VideoEncoderConfiguration-Name (char *)soap_malloc(soap, sizeof(char) * 32);memset(trtGetProfilesResponse-Profiles[i].VideoEncoderConfiguration-Name, 0, sizeof(char) * 32);strcpy(trtGetProfilesResponse-Profiles[i].VideoEncoderConfiguration-Name, ve_name);trtGetProfilesResponse-Profiles[i].VideoEncoderConfiguration-token (char *)soap_malloc(soap, sizeof(char) * 32);memset(trtGetProfilesResponse-Profiles[i].VideoEncoderConfiguration-token, 0, sizeof(char) * 32);strcpy(trtGetProfilesResponse-Profiles[i].VideoEncoderConfiguration-token, ve_token);trtGetProfilesResponse-Profiles[i].VideoEncoderConfiguration-UseCount 1; // 表示视频编码配置的使用次数trtGetProfilesResponse-Profiles[i].VideoEncoderConfiguration-Encoding ttVideoEncodingH264; // 视频编码格式// VideoEncoderConfigurationResolutiontrtGetProfilesResponse-Profiles[i].VideoEncoderConfiguration-Resolution (struct ttVideoResolution *)soap_malloc(soap, sizeof(struct ttVideoResolution));memset(trtGetProfilesResponse-Profiles[i].VideoEncoderConfiguration-Resolution, 0, sizeof(struct ttVideoResolution));trtGetProfilesResponse-Profiles[i].VideoEncoderConfiguration-Resolution-Width VIDEO_WIDTH;trtGetProfilesResponse-Profiles[i].VideoEncoderConfiguration-Resolution-Height VIDEO_HEIGHT;trtGetProfilesResponse-Profiles[i].VideoEncoderConfiguration-Quality 10; // 视频质量// VideoEncoderConfigurationRateControltrtGetProfilesResponse-Profiles[i].VideoEncoderConfiguration-RateControl (struct ttVideoRateControl *)soap_malloc(soap, sizeof(struct ttVideoRateControl));memset(trtGetProfilesResponse-Profiles[i].VideoEncoderConfiguration-RateControl, 0, sizeof(struct ttVideoRateControl));trtGetProfilesResponse-Profiles[i].VideoEncoderConfiguration-RateControl-FrameRateLimit FRAME_RATE; // 帧率trtGetProfilesResponse-Profiles[i].VideoEncoderConfiguration-RateControl-EncodingInterval 1; // 编码间隔trtGetProfilesResponse-Profiles[i].VideoEncoderConfiguration-RateControl-BitrateLimit 3000; // 比特率限制// VideoEncoderConfigurationH264trtGetProfilesResponse-Profiles[i].VideoEncoderConfiguration-H264 (struct ttH264Configuration *)soap_malloc(soap, sizeof(struct ttH264Configuration));memset(trtGetProfilesResponse-Profiles[i].VideoEncoderConfiguration-H264, 0, sizeof(struct ttH264Configuration));trtGetProfilesResponse-Profiles[i].VideoEncoderConfiguration-H264-GovLength 120; // GOP长度trtGetProfilesResponse-Profiles[i].VideoEncoderConfiguration-H264-H264Profile ttH264Profile__High; // H.264 Profilereturn SOAP_OK; }SOAP_FMAC5 int SOAP_FMAC6 trtGetVideoSourceConfiguration(struct soap *soap, struct _trtGetVideoSourceConfiguration *trtGetVideoSourceConfiguration, struct _trtGetVideoSourceConfigurationResponse *trtGetVideoSourceConfigurationResponse) {printf(——– %s ——–\n, func);trtGetVideoSourceConfigurationResponse-Configuration (struct ttVideoSourceConfiguration *)soap_malloc(soap, sizeof(struct ttVideoSourceConfiguration));memset(trtGetVideoSourceConfigurationResponse-Configuration, 0, sizeof(struct ttVideoSourceConfiguration));trtGetVideoSourceConfigurationResponse-Configuration-UseCount 1;trtGetVideoSourceConfigurationResponse-Configuration-Name (char *)soap_malloc(soap, sizeof(char) * 32);memset(trtGetVideoSourceConfigurationResponse-Configuration-Name, 0, sizeof(char) * 32);trtGetVideoSourceConfigurationResponse-Configuration-token (char *)soap_malloc(soap, sizeof(char) * 32);memset(trtGetVideoSourceConfigurationResponse-Configuration-token, 0, sizeof(char) * 32);strcpy(trtGetVideoSourceConfigurationResponse-Configuration-Name, vs_name);strcpy(trtGetVideoSourceConfigurationResponse-Configuration-token, vs_token);trtGetVideoSourceConfigurationResponse-Configuration-SourceToken (char *)soap_malloc(soap, sizeof(char) * 32);memset(trtGetVideoSourceConfigurationResponse-Configuration-SourceToken, 0, sizeof(char) * 32);strcpy(trtGetVideoSourceConfigurationResponse-Configuration-SourceToken, vs_SourceToken);trtGetVideoSourceConfigurationResponse-Configuration-Bounds (struct ttIntRectangle *)soap_malloc(soap, sizeof(struct ttIntRectangle));memset(trtGetVideoSourceConfigurationResponse-Configuration-Bounds, 0, sizeof(struct ttIntRectangle));trtGetVideoSourceConfigurationResponse-Configuration-Bounds-x 0;trtGetVideoSourceConfigurationResponse-Configuration-Bounds-y 0;trtGetVideoSourceConfigurationResponse-Configuration-Bounds-width VIDEO_WIDTH;trtGetVideoSourceConfigurationResponse-Configuration-Bounds-height VIDEO_HEIGHT;return SOAP_OK; }SOAP_FMAC5 int SOAP_FMAC6 trtGetStreamUri(struct soap *soap, struct _trtGetStreamUri *trtGetStreamUri, struct _trtGetStreamUriResponse *trtGetStreamUriResponse) {printf(——– %s ——–\n, func);trtGetStreamUriResponse-MediaUri (struct ttMediaUri *)soap_malloc(soap, sizeof(struct ttMediaUri));memset(trtGetStreamUriResponse-MediaUri, 0, sizeof(struct ttMediaUri));trtGetStreamUriResponse-MediaUri-Uri (char *)soap_malloc(soap, sizeof(char) * 256);memset(trtGetStreamUriResponse-MediaUri-Uri, 0, sizeof(char) * 256);sprintf(trtGetStreamUriResponse-MediaUri-Uri, RTSPURL);trtGetStreamUriResponse-MediaUri-InvalidAfterConnect xsdboolean__true;trtGetStreamUriResponse-MediaUri-InvalidAfterReboot xsdbooleantrue_;// 超时时间trtGetStreamUriResponse-MediaUri-Timeout 200;return 0; }参考了这个项目中的源码onvif-server-with-rtsp 我的另一篇博客Ubuntu 编译gSOAP库并生成ONVIF代码框架_gsoap 生成-CSDN博客 相关资料一个比较完善的Onvif服务端 不过源码要钱happytimesoft
- 上一篇: 完整网站模板小企业网站欣赏
- 下一篇: 玩具购物网站模板网站首页 关键词
相关文章
-
完整网站模板小企业网站欣赏
完整网站模板小企业网站欣赏
- 技术栈
- 2026年04月20日
-
完整网站开发教程自己做的网站买域名多少钱
完整网站开发教程自己做的网站买域名多少钱
- 技术栈
- 2026年04月20日
-
外行学习个人网站建设网站建设包含项目
外行学习个人网站建设网站建设包含项目
- 技术栈
- 2026年04月20日
-
玩具购物网站模板网站首页 关键词
玩具购物网站模板网站首页 关键词
- 技术栈
- 2026年04月20日
-
玩客云 做网站服务器家庭安全卫士论坛WordPress
玩客云 做网站服务器家庭安全卫士论坛WordPress
- 技术栈
- 2026年04月20日
-
晚上必看的正能量网站桂林市区地图
晚上必看的正能量网站桂林市区地图
- 技术栈
- 2026年04月20日
