// VLC callback prototypes
static int Open( vlc_object_t* );
static void Close( vlc_object_t* );
-VLC_SD_PROBE_HELPER("upnp", N_("Universal Plug'n'Play"))
+VLC_SD_PROBE_HELPER("upnp", "Universal Plug'n'Play", SD_CAT_LAN)
// Module descriptor
case UPNP_EVENT_SUBSCRIBE_COMPLETE:
msg_Warn( p_sd, "subscription complete" );
break;
-
+
case UPNP_DISCOVERY_SEARCH_TIMEOUT:
msg_Warn( p_sd, "search timeout" );
break;
-
+
default:
msg_Dbg( p_sd,
"%s:%d: DEBUG: UNHANDLED EVENT ( TYPE=%d )",
services_discovery_t* p_sd )
{
if ( !doc )
- {
- msg_Dbg( p_sd, "%s:%d: NULL", __FILE__, __LINE__ );
+ {
+ msg_Dbg( p_sd, "%s:%d: NULL", __FILE__, __LINE__ );
return;
}
-
+
if ( !location )
{
- msg_Dbg( p_sd, "%s:%d: NULL", __FILE__, __LINE__ );
+ msg_Dbg( p_sd, "%s:%d: NULL", __FILE__, __LINE__ );
return;
}
IXML_NodeList* deviceList =
ixmlDocument_getElementsByTagName( doc, "device" );
-
+
if ( deviceList )
{
for ( unsigned int i = 0; i < ixmlNodeList_length( deviceList ); i++ )
__FILE__, __LINE__ );
continue;
}
-
+
if ( p_sd->p_sys->serverList->getServer( UDN ) != 0 )
continue;
const char* friendlyName =
- xml_getChildElementValue( deviceElement,
+ xml_getChildElementValue( deviceElement,
"friendlyName" );
-
+
if ( !friendlyName )
{
msg_Dbg( p_sd, "%s:%d: no friendlyName!", __FILE__, __LINE__ );
}
MediaServer* server = new MediaServer( UDN, friendlyName, p_sd );
-
+
if ( !p_sd->p_sys->serverList->addServer( server ) )
{
IXML_Document* action = 0;
IXML_Document* response = 0;
const char* url = getContentDirectoryControlURL();
-
+
if ( !url || strcmp( url, "" ) == 0 )
{
msg_Dbg( _p_sd, "No subscription url set!" );
res = UpnpAddToAction( &action, "Browse",
serviceType, "ObjectID", ObjectID );
-
- if ( res != UPNP_E_SUCCESS )
+
+ if ( res != UPNP_E_SUCCESS )
{
msg_Dbg( _p_sd,
"%s:%d: ERROR: %s", __FILE__, __LINE__,
res = UpnpAddToAction( &action, "Browse",
serviceType, "BrowseFlag", BrowseFlag );
-
+
if ( res != UPNP_E_SUCCESS )
{
msg_Dbg( _p_sd,
res = UpnpAddToAction( &action, "Browse",
serviceType, "Filter", Filter );
-
+
if ( res != UPNP_E_SUCCESS )
{
msg_Dbg( _p_sd,
res = UpnpAddToAction( &action, "Browse",
serviceType, "SortCriteria", SortCriteria );
-
+
if ( res != UPNP_E_SUCCESS )
{
msg_Dbg( _p_sd,
0,
action,
&response );
-
+
if ( res != UPNP_E_SUCCESS )
{
msg_Dbg( _p_sd,
_contents = root;
_contents->setInputItem( _inputItem );
- _buildPlaylist( _contents );
+ _buildPlaylist( _contents, NULL );
}
bool MediaServer::_fetchContents( Container* parent )
IXML_Document* result = parseBrowseResult( response );
ixmlDocument_free( response );
-
+
if ( !result )
{
msg_Dbg( _p_sd,
IXML_NodeList* containerNodeList =
ixmlDocument_getElementsByTagName( result, "container" );
-
+
if ( containerNodeList )
{
for ( unsigned int i = 0;
const char* childCountStr =
ixmlElement_getAttribute( containerElement, "childCount" );
-
+
if ( !childCountStr )
continue;
-
+
int childCount = atoi( childCountStr );
const char* title = xml_getChildElementValue( containerElement,
"dc:title" );
-
+
if ( !title )
continue;
-
+
const char* resource = xml_getChildElementValue( containerElement,
"res" );
const char* objectID =
ixmlElement_getAttribute( itemElement, "id" );
-
+
if ( !objectID )
continue;
const char* title =
xml_getChildElementValue( itemElement, "dc:title" );
-
+
if ( !title )
continue;
const char* resource =
xml_getChildElementValue( itemElement, "res" );
-
+
if ( !resource )
continue;
return true;
}
-void MediaServer::_buildPlaylist( Container* parent )
+void MediaServer::_buildPlaylist( Container* parent, input_item_node_t *p_input_node )
{
+ bool send = p_input_node == NULL;
+ if( send )
+ p_input_node = input_item_node_Create( parent->getInputItem() );
+
for ( unsigned int i = 0; i < parent->getNumContainers(); i++ )
{
Container* container = parent->getContainer( i );
- input_item_t* p_input_item = input_item_New( _p_sd, "vlc://nop", parent->getTitle() );
- input_item_AddSubItem( parent->getInputItem(), p_input_item );
+ input_item_t* p_input_item = input_item_New( _p_sd, "vlc://nop", parent->getTitle() );
+ input_item_node_t *p_new_node =
+ input_item_node_AppendItem( p_input_node, p_input_item );
container->setInputItem( p_input_item );
- _buildPlaylist( container );
+ _buildPlaylist( container, p_new_node );
}
for ( unsigned int i = 0; i < parent->getNumItems(); i++ )
item->getResource(),
item->getTitle() );
assert( p_input_item );
- input_item_AddSubItem( parent->getInputItem(), p_input_item );
+ input_item_node_AppendItem( p_input_node, p_input_item );
item->setInputItem( p_input_item );
}
+
+ if( send )
+ input_item_node_PostAndDelete( p_input_node );
}
void MediaServer::setInputItem( input_item_t* p_input_item )
services_discovery_t* p_sd = _p_sd;
- p_input_item = input_item_New( p_sd, "vlc://nop", s->getFriendlyName() );
+ p_input_item = input_item_New( p_sd, "vlc://nop", s->getFriendlyName() );
s->setInputItem( p_input_item );
services_discovery_AddItem( p_sd, p_input_item, NULL );