我有网络 IP 摄像机(佳能 VB-M40)。本相机支持 ONVIF 协议。我正在使用 C 语言在 Windows 中实现其 ONVIF 功能。我使用以下请求获得了它的 RTSP URI。
snprintf(postData, sizeof(postData),
"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
"<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" "
"xmlns:tds=\"http://www.onvif.org/ver10/media/wsdl\""
"xmlns:tt=\"http://www.onvif.org/ver10/schema\">"
"<soap:Body>"
"<tds:GetStreamUri>"
"<tds:StreamSetup>"
"<tt:Stream>0</tt:Stream>"
"<tt:Transport>"
"<tt:Protocol>HTTP</tt:Protocol>"
"</tt:Transport>"
"</tds:StreamSetup>"
"<tds:ProfileToken>profile1</tds:ProfileToken>"
"</tds:GetStreamUri>"
"</soap:Body></soap:Envelope>",
username, digest_str, nonce_str, time_str);
回应是:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope"
xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsa5="http://www.w3.org/2005/08/addressing"
xmlns:c14n="http://www.w3.org/2001/10/xml-exc-c14n#"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:MC2="http://www.onvif.org/ver10/schema"
xmlns:MC3="http://www.w3.org/2005/05/xmlmime"
xmlns:MC4="http://docs.oasis-open.org/wsn/b-2"
xmlns:MC10="http://www.w3.org/2004/08/xop/include"
xmlns:MC5="http://docs.oasis-open.org/wsrf/bf-2"
xmlns:MC6="http://docs.oasis-open.org/wsn/t-1"
xmlns:CC="http://www.canon.com/ns/networkcamera/onvif/va/schema"
xmlns:MC1="http://www.onvif.org/ver10/media/wsdl"
xmlns:MC8="http://www.onvif.org/ver20/analytics/wsdl/RuleEngineBinding"
xmlns:MC9="http://www.onvif.org/ver20/analytics/wsdl/AnalyticsEngineBinding"
xmlns:MC7="http://www.onvif.org/ver20/analytics/wsdl"
xmlns:ter="http://www.onvif.org/ver10/error"
xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2"
xmlns:tns1="http://www.onvif.org/ver10/topics">
<SOAP-ENV:Header></SOAP-ENV:Header>
<SOAP-ENV:Body>
<MC1:GetStreamUriResponse>
<MC1:MediaUri>
<MC2:Uri>rtsp://192.168.5.53:8090/profile1=r</MC2:Uri>
<MC2:InvalidAfterConnect>false</MC2:InvalidAfterConnect>
<MC2:InvalidAfterReboot>true</MC2:InvalidAfterReboot>
<MC2:Timeout>PT0M0S</MC2:Timeout>
</MC1:MediaUri>
</MC1:GetStreamUriResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
根据 ONVIF 规范,一旦我得到流 URI,我应该向设备发送“DESCRIBE”请求。我正在使用此过程,因为我需要 TCP 上的流。
我的问题是如何将“DESCRIBE”请求发送到设备以及在哪个套接字上?
我是否应该在发送 GetStreamURI 请求的同一个套接字上发送此请求。或者我必须创建另一个。请求的格式是什么?