Upnp控制点无法播放音频

时间:2017-10-20 19:38:25

标签: curl upnp dlna

这是设置SetAVTransportURI操作的正确格式吗?

echo '
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
 <s:Body>
  <u:SetAVTransportURI xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">
    <InstanceID>0</InstanceID>
    <CurrentURI>http://www.vorbis.com/music/Epoq-Lepidoptera.ogg</CurrentURI>
    <CurrentURIMetaData></CurrentURIMetaData>
    </u:SetAVTransportURI>
  </s:Body>
</s:Envelope>
' | curl -v -d @- \
 -H 'SOAPAction: "urn:schemas-upnp-org:service:AVTransport:1#SetAVTransportURI"' \
 -H 'content-type: text/xml; charset="utf-8"' \
 -H 'Connection: close' \
 http://192.168.1.6:49152/ctl/AVTransport

我收到501错误作为回复

* Hostname was NOT found in DNS cache
*   Trying 192.168.1.6...
* Connected to 192.168.1.6 (192.168.1.6) port 49152 (#0)
> POST /ctl/AVTransport HTTP/1.1
> User-Agent: curl/7.35.0
> Host: 192.168.1.6:49152
> Accept: */*
> SOAPAction: "urn:schemas-upnp-org:service:AVTransport:1#SetAVTransportURI"
> content-type: text/xml; charset="utf-8"
> Connection: close
> Content-Length: 432
> 
* upload completely sent off: 432 out of 432 bytes
< HTTP/1.1 500 Internal Server Error
< CONTENT-LENGTH: 411
< CONTENT-TYPE: text/xml; charset="utf-8"
< DATE: Fri, 20 Oct 2017 19:22:34 GMT
< EXT:
* Server Linux/4.9.28-v7+, UPnP/1.0, Portable SDK for UPnP devices/1.6.19+git20141001 is not blacklisted
< SERVER: Linux/4.9.28-v7+, UPnP/1.0, Portable SDK for UPnP devices/1.6.19+git20141001
< X-User-Agent: redsonic
< 
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring>UPnPError</faultstring>
<detail>
<UPnPError xmlns="urn:schemas-upnp-org:control-1-0">
<errorCode>501</errorCode>
<errorDescription>Action Failed</errorDescription>
</UPnPError>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
* Connection #0 to host 192.168.1.6 left intact

PS - 我还尝试将DDLite元数据(有和没有转义)添加到CurrentURIMetadata。它给出了相同的501错误

&lt;DIDL-Lite xmlns=\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:sec=\"http://www.sec.co.kr/\" xmlns:upnp=\"urn:schemas-upnp-org:metadata-1-0/upnp/\""&gt;&lt;item id=\"0\" parentID=\"-1\" restricted=\"false\""&gt;&lt;res protocolInfo=\"http-get:*:audio/ogg:*\""&gt;http://www.vorbis.com/music/Epoq-Lepidoptera.ogg&lt;/res"&gt;&lt;/item"&gt;&lt;/DIDL-Lite"&gt;

PPS - the docs中没有任何内容可以表明出现了什么问题。

1 个答案:

答案 0 :(得分:0)

稀释。似乎连接必须是keep-alivecurrenturimetadata有一些字段,XML正确转义。如果一些渲染器是空的,它们会发疯。

echo '
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
 <s:Body>
  <u:SetAVTransportURI xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">
    <InstanceID>0</InstanceID>
    <CurrentURI>http://www.vorbis.com/music/Epoq-Lepidoptera.ogg</CurrentURI>
    <CurrentURIMetaData>&lt;DIDL-Lite xmlns=&quot;urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:sec=&quot;http://www.sec.co.kr/&quot; xmlns:upnp=&quot;urn:schemas-upnp-org:metadata-1-0/upnp/&quot;&gt;&lt;item id=&quot;0&quot; parentID=&quot;-1&quot; restricted=&quot;false&quot;&gt;&lt;res protocolInfo=&quot;http-get:*:audio/ogg:*&quot;&gt;http://www.vorbis.com/music/Epoq-Lepidoptera.ogg&lt;/res&gt;&lt;/item&gt;&lt;/DIDL-Lite&gt;</CurrentURIMetaData>
    </u:SetAVTransportURI>
  </s:Body>
</s:Envelope>
' | curl -v -d @- \
 -H 'SOAPAction: "urn:schemas-upnp-org:service:AVTransport:1#SetAVTransportURI"' \
 -H 'content-type: text/xml; charset="utf-8"' \
 -H 'Connection: keep-alive' \
 http://192.168.1.6:49152/ctl/AVTransport