[vlc-commits] Add support for extern audio track as slave for Upnp in addItem
Bastien Penavayre
git at videolan.org
Wed Jun 1 17:31:51 CEST 2016
vlc | branch: master | Bastien Penavayre <swac31 at gmail.com> | Wed Jun 1 17:10:48 2016 +0200| [7e6114e7c495901cb92b5bbbbf8d0e482755c02e] | committer: Hugo Beauzée-Luyssen
Add support for extern audio track as slave for Upnp in addItem
If an Upnp non-audio item holds audio subitems then they're used as
slaves for the item.
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7e6114e7c495901cb92b5bbbbf8d0e482755c02e
---
modules/services_discovery/upnp.cpp | 39 ++++++++++++++++++++++++++---------
1 file changed, 29 insertions(+), 10 deletions(-)
diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp
index 9ae13f2..81c3c1c 100644
--- a/modules/services_discovery/upnp.cpp
+++ b/modules/services_discovery/upnp.cpp
@@ -810,7 +810,17 @@ namespace
class ItemDescriptionHolder
{
private:
- std::set<std::string> slaves;
+ struct Slave : std::string
+ {
+ slave_type type;
+
+ Slave(std::string const &url, slave_type type) :
+ std::string(url), type(type)
+ {
+ }
+ };
+
+ std::set<Slave> slaves;
const char* objectID,
* title,
@@ -848,7 +858,7 @@ namespace
if ( !psz_subtitles &&
!(psz_subtitles = xml_getChildElementValue( itemElement, "sec:CaptionInfoEx" )) )
psz_subtitles = xml_getChildElementValue( itemElement, "pv:subtitlefile" );
- addSlave(psz_subtitles);
+ addSlave(psz_subtitles, SLAVE_TYPE_SPU);
psz_artist = xml_getChildElementValue( itemElement, "upnp:artist" );
psz_genre = xml_getChildElementValue( itemElement, "upnp:genre" );
psz_album = xml_getChildElementValue( itemElement, "upnp:album" );
@@ -868,16 +878,17 @@ namespace
return true;
}
- void addSlave(const char *psz_slave)
+ void addSlave(const char *psz_slave, slave_type type)
{
if (psz_slave)
- slaves.insert(psz_slave);
+ slaves.insert(Slave(psz_slave, type));
}
void addSubtitleSlave(IXML_Element* p_resource)
{
if (slaves.empty())
- addSlave(ixmlElement_getAttribute( p_resource, "pv:subtitleFileUri" ));
+ addSlave(ixmlElement_getAttribute( p_resource, "pv:subtitleFileUri" ),
+ SLAVE_TYPE_SPU);
}
void setArtworkURL(IXML_Element* p_resource)
@@ -901,9 +912,9 @@ namespace
input_item_SetAlbumArtist( p_item, psz_album_artist );
if ( psz_albumArt != NULL )
input_item_SetArtworkURL( p_item, psz_albumArt );
- for (std::set<std::string>::iterator it = slaves.begin(); it != slaves.end(); ++it)
+ for (std::set<Slave>::iterator it = slaves.begin(); it != slaves.end(); ++it)
{
- input_item_slave *p_slave = input_item_slave_New( it->c_str(), SLAVE_TYPE_SPU,
+ input_item_slave *p_slave = input_item_slave_New( it->c_str(), it->type,
SLAVE_PRIORITY_MATCH_ALL );
if ( p_slave )
input_item_AddSlave( p_item, p_slave );
@@ -972,10 +983,18 @@ bool MediaServer::addItem( IXML_Element* itemElement )
break;
}
else if (strncmp(rez_type, "http-get:*:text/", 16) == 0)
- holder.addSlave(xml_getChildElementValue( p_resource, "res" ));
+ holder.addSlave(xml_getChildElementValue( p_resource, "res" ), SLAVE_TYPE_SPU);
else if (strncmp(rez_type, "http-get:*:audio/", 17) == 0)
- if (holder.media_type == ItemDescriptionHolder::AUDIO && !p_item)
- p_item = holder.createNewItem(p_resource);
+ {
+ if (holder.media_type == ItemDescriptionHolder::AUDIO)
+ {
+ if (!p_item)
+ p_item = holder.createNewItem(p_resource);
+ }
+ else
+ holder.addSlave(xml_getChildElementValue( p_resource, "res" ),
+ SLAVE_TYPE_AUDIO);
+ }
}
ixmlNodeList_free( p_resource_list );
if (!p_item)
More information about the vlc-commits
mailing list