#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_playlist.h>
+#include <vlc_services_discovery.h>
/* FIXME: thread-safety ?? */
/* FIXME: playlist locking */
static int Open ( vlc_object_t * );
static void Close( vlc_object_t * );
-vlc_module_begin();
- set_shortname( "UPnP");
- set_description( N_("Universal Plug'n'Play discovery") );
- set_category( CAT_PLAYLIST );
- set_subcategory( SUBCAT_PLAYLIST_SD );
+VLC_SD_PROBE_HELPER("upnp", "Universal Plug'n'Play", SD_CAT_LAN)
- set_capability( "services_discovery", 0 );
- set_callbacks( Open, Close );
+vlc_module_begin ()
+ set_shortname( "UPnP")
+ set_description( N_("Universal Plug'n'Play") )
+ set_category( CAT_PLAYLIST )
+ set_subcategory( SUBCAT_PLAYLIST_SD )
-vlc_module_end();
+ set_capability( "services_discovery", 0 )
+ set_callbacks( Open, Close )
-/*****************************************************************************
- * Local prototypes
- *****************************************************************************/
-
-/* Main functions */
- static void Run ( services_discovery_t *p_sd );
-
-/*****************************************************************************
- * Open: initialize and create stuff
- *****************************************************************************/
-static int Open( vlc_object_t *p_this )
-{
- services_discovery_t *p_sd = ( services_discovery_t* )p_this;
-
- p_sd->pf_run = Run;
-
- services_discovery_SetLocalizedName( p_sd, _("Devices") );
-
- return VLC_SUCCESS;
-}
+ VLC_SD_PROBE_SUBMODULE
-
-/*****************************************************************************
- * Close:
- *****************************************************************************/
-static void Close( vlc_object_t *p_this )
-{
-}
+vlc_module_end ()
/*****************************************************************************
* Run: main UPnP thread
addSearchResponseListener( this );
//addEventListener( this );
}
-
};
-static void Run( services_discovery_t *p_sd )
+/*****************************************************************************
+ * Open: initialize and create stuff
+ *****************************************************************************/
+static int Open( vlc_object_t *p_this )
{
- UPnPHandler u( p_sd );
+ services_discovery_t *p_sd = ( services_discovery_t* )p_this;
- u.start();
+ UPnPHandler *u = new UPnPHandler( p_sd );
+ u->start( );
+ msg_Dbg( p_sd, "upnp discovery started" );
+ p_sd->p_private = u;
- msg_Dbg( p_sd, "UPnP discovery started" );
- /* read SAP packets */
- while( vlc_object_alive (p_sd) )
- {
- msleep( 500 );
- }
+ return VLC_SUCCESS;
+}
+
+
+/*****************************************************************************
+ * Close:
+ *****************************************************************************/
+static void Close( vlc_object_t *p_this )
+{
+ UPnPHandler *u = (UPnPHandler *)p_this->p_private;
+ u->stop( );
- u.stop();
- msg_Dbg( p_sd, "UPnP discovery stopped" );
+ msg_Dbg( p_this, "upnp discovery stopped" );
}
*/
char *str = strdup( dev->getFriendlyName( ) );
- p_item = playlist_NodeCreate( p_playlist, str, p_sd->p_cat, 0, NULL );
+ p_item = playlist_NodeCreate( p_playlist, str, p_sd->p_cat, PLAYLIST_END, 0, NULL );
p_item->i_flags &= ~PLAYLIST_SKIP_FLAG;
msg_Dbg( p_sd, "device %s added", str );
free( str );
ItemNode *iNode = (ItemNode *)node;
input_item_t *p_input = input_item_New( p_sd, iNode->getResource(), title );
/* FIXME: playlist_AddInput() can fail */
- playlist_BothAddInput( p_playlist, p_input, p_parent,
- PLAYLIST_APPEND, PLAYLIST_END, NULL, NULL,
+ playlist_NodeAddInput( p_playlist, p_input, p_parent,
+ PLAYLIST_APPEND, PLAYLIST_END,
false );
vlc_gc_decref( p_input );
} else if ( node->isContainerNode() )
char* p_name = strdup(title); /* See other comment on strdup */
playlist_item_t* p_node = playlist_NodeCreate( p_playlist, p_name,
- p_parent, 0, NULL );
+ p_parent, PLAYLIST_END, 0, NULL );
free(p_name);
unsigned nContentNodes = conNode->getNContentNodes();