<pre>Add slave for each subtitle URL, based on http://www.edavs.com/forum/viewtopic.php?f=4&t=52. Each URL will be present once as "slaves" is already a set. <br />
Removal of psz_subtitles checks is safe as addSlave() checks for NULL argument. Diff also here: https://github.com/samunders-core/vlc/pull/1/commits/776f39b9d1097e4d1cc02f150bcb3c585fdf3af3
---
modules/services_discovery/upnp.cpp | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp
index 82d43632f47..35992968e76 100644
--- a/modules/services_discovery/upnp.cpp
+++ b/modules/services_discovery/upnp.cpp
@@ -842,9 +842,20 @@ namespace
if ( !title )
return false;
const char *psz_subtitles = xml_getChildElementValue( itemElement, "sec:CaptionInfo" );
- if ( !psz_subtitles &&
- !(psz_subtitles = xml_getChildElementValue( itemElement, "sec:CaptionInfoEx" )) )
- psz_subtitles = xml_getChildElementValue( itemElement, "pv:subtitlefile" );
+ addSlave(psz_subtitles, SLAVE_TYPE_SPU);
+ int list_length = 0;
+ IXML_NodeList* p_subtitle_list = ixmlDocument_getElementsByTagName(
+ (IXML_Document*) itemElement, "sec:CaptionInfoEx" );
+ if (p_subtitle_list)
+ list_length = ixmlNodeList_length( p_subtitle_list );
+ for (int index = 0; index < list_length; index++)
+ {
+ IXML_Node* p_childNode = ixmlNodeList_item( p_subtitle_list, index );
+ psz_subtitles = ixmlNode_getNodeValue( p_childNode );
+ addSlave(psz_subtitles, SLAVE_TYPE_SPU);
+ }
+ ixmlNodeList_free( p_subtitle_list );
+ psz_subtitles = xml_getChildElementValue( itemElement, "pv:subtitlefile" );
addSlave(psz_subtitles, SLAVE_TYPE_SPU);
psz_artist = xml_getChildElementValue( itemElement, "upnp:artist" );
psz_genre = xml_getChildElementValue( itemElement, "upnp:genre" );
</pre>