<html dir="ltr"><head></head><body style="text-align:left; direction:ltr;"><div>On Mon, 2018-10-15 at 16:18 +0200, Steve Lhomme wrote:</div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><pre><br></pre><pre>On 15/10/2018 10:18, Shaleen Jain wrote:</pre><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><pre>-int MediaRenderer::SetAVTransportURI(const char* uri)</pre><pre>+std::vector<protocol_info_t> MediaRenderer::GetProtocolInfo()</pre><pre>  {</pre><pre>+    std::string protocol_csv;</pre><pre>+    std::vector<protocol_info_t> supported_protocols;</pre><pre>+    std::list<std::pair<const char*, const char*>> arg_list;</pre><pre>+</pre><pre>+    IXML_Document *response = SendAction("GetProtocolInfo",</pre><pre>+                                CONNECTION_MANAGER_SERVICE_TYPE, arg_list);</pre><pre>+    if(!response)</pre><pre>+    {</pre><pre>+        return supported_protocols;</pre><pre>+    }</pre><pre>+</pre><pre>+    // Get the CSV list of protocols/profiles supported by the device</pre><pre>+    if( IXML_NodeList *protocol_list = ixmlDocument_getElementsByTagName( response , "Sink" ) )</pre><pre>+    {</pre><pre>+        if ( IXML_Node* protocol_node = ixmlNodeList_item( protocol_list, 0 ) )</pre><pre>+        {</pre><pre>+            IXML_Node* p_text_node = ixmlNode_getFirstChild( protocol_node );</pre><pre>+            if ( p_text_node )</pre><pre>+            {</pre><pre>+                protocol_csv.assign(ixmlNode_getNodeValue( p_text_node ));</pre><pre>+            }</pre><pre>+        }</pre><pre>+        ixmlNodeList_free( protocol_list);</pre><pre>+    }</pre><pre>+    ixmlDocument_free(response);</pre><pre>+</pre><pre>+    msg_Dbg(parent, "Device supports protocols: %s", protocol_csv.c_str());</pre><pre>+    // parse the CSV list</pre><pre>+    // format: <transportProtocol>:<network>:<mime>:<additionalInfo></pre><pre>+    std::vector<std::string> protocols = split(protocol_csv, ',');</pre><pre>+    for (std::string protocol : protocols ) {</pre><pre>+        std::vector<std::string> protocol_info = split(protocol, ':');</pre><pre>+</pre><pre>+        // We only support http transport for now.</pre><pre>+        if (protocol_info.size() == 4 && protocol_info.at(0) == "http-get")</pre><pre>+        {</pre><pre>+            protocol_info_t proto;</pre><pre>+</pre><pre>+            // Get the DLNA profile name</pre><pre>+            std::string profile_name;</pre><pre>+            std::string tag = "DLNA.ORG_PN=";</pre><pre>+</pre><pre>+            if (protocol_info.at(3) == "*")</pre><pre>+            {</pre><pre>+               profile_name = "*";</pre><pre>+            }</pre><pre>+            else if (std::size_t index = protocol_info.at(3).find(tag) != std::string::npos)</pre><pre>+            {</pre><pre>+                std::size_t end = protocol_info.at(3).find(';', index + 1);</pre><pre>+                int start = index + tag.length() - 1;</pre><pre>+                int length = end - start;</pre><pre>+                profile_name = protocol_info.at(3).substr(start, length);</pre><pre>+            }</pre><pre>+</pre><pre>+            // Match our supported profiles to device profiles</pre><pre>+            for (dlna_profile_t profile : dlna_profile_list) {</pre><pre>+                if (protocol_info.at(2) == profile.mime</pre><pre>+                        && (profile_name == profile.name || profile_name == "*"))</pre><pre>+                {</pre><pre>+                    proto.profile = std::move(profile);</pre><pre>+                    supported_protocols.push_back(proto);</pre><pre>+                    // we do not break here to account for wildcards</pre><pre>+                    // as protocolInfo's fourth field aka <additionalInfo></pre><pre>+                }</pre><pre>+            }</pre><pre>+        }</pre><pre>+    }</pre><pre>+</pre><pre>+    msg_Dbg( parent , "Got %lu supported profiles", supported_protocols.size() );</pre></blockquote><pre><br></pre><pre>Should be %zu</pre></blockquote><div><br></div><div>Done.</div><div><br></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><pre>_______________________________________________</pre><pre>vlc-devel mailing list</pre><pre>To unsubscribe or modify your subscription options:</pre><a href="https://mailman.videolan.org/listinfo/vlc-devel"><pre>https://mailman.videolan.org/listinfo/vlc-devel</pre></a></blockquote><div><span><pre>-- <br></pre><div style="width: 71ch;">Regards,</div><div style="width: 71ch;">Shaleen Jain</div></span></div></body></html>