X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=modules%2Fservices_discovery%2Fupnp_intel.cpp;h=a65036a014da9ff07d314e40972d44435ba307b2;hb=494ace96d068ee8e4b6b689da0ae469c0c0e4fe3;hp=d745e9b59bdefd9d98d21c88bb331b62e6633d7f;hpb=6da90a1716250d282f16dc6bc9dacec5b9514caf;p=vlc diff --git a/modules/services_discovery/upnp_intel.cpp b/modules/services_discovery/upnp_intel.cpp index d745e9b59b..a65036a014 100644 --- a/modules/services_discovery/upnp_intel.cpp +++ b/modules/services_discovery/upnp_intel.cpp @@ -42,7 +42,8 @@ # include "config.h" #endif -#include +#include +#include #include @@ -50,6 +51,7 @@ struct services_discovery_sys_t { + playlist_t *p_playlist; playlist_item_t *p_node_cat; playlist_item_t *p_node_one; }; @@ -254,12 +256,16 @@ private: static int Open( vlc_object_t* ); static void Close( vlc_object_t* ); static void Run( services_discovery_t *p_sd ); +static playlist_t *pl_Get( services_discovery_t *p_sd ) +{ + return p_sd->p_sys->p_playlist; +} // Module descriptor vlc_module_begin(); set_shortname( "UPnP" ); -set_description( _( "Universal Plug'n'Play discovery ( Intel SDK )" ) ); +set_description( N_( "Universal Plug'n'Play discovery ( Intel SDK )" ) ); set_category( CAT_PLAYLIST ); set_subcategory( SUBCAT_PLAYLIST_SD ); set_capability( "services_discovery", 0 ); @@ -286,6 +292,7 @@ static int Open( vlc_object_t *p_this ) p_sd->pf_run = Run; p_sd->p_sys = p_sys; + p_sys->p_playlist = pl_Yield( p_sd ); /* Create our playlist node */ playlist_NodesPairCreate( pl_Get( p_sd ), _("Devices"), @@ -304,7 +311,7 @@ static void Close( vlc_object_t *p_this ) true ); playlist_NodeDelete( pl_Get( p_sd ), p_sys->p_node_cat, true, true ); - + pl_Release( p_sd ); free( p_sys ); } @@ -340,7 +347,7 @@ static void Run( services_discovery_t* p_sd ) } msg_Dbg( p_sd, "UPnP discovery started" ); - while( !p_sd->b_die ) + while( vlc_object_alive (p_sd) ) { msleep( 500 ); } @@ -874,7 +881,7 @@ void MediaServer::_buildPlaylist( Container* parent ) /* FIXME: playlist_AddInput() can fail */ playlist_BothAddInput( p_playlist, p_input, parentNode, PLAYLIST_APPEND, PLAYLIST_END, &i_cat, NULL, - false ); + pl_Unlocked ); vlc_gc_decref( p_input ); /* TODO: do this better by storing ids */ playlist_item_t *p_node = playlist_ItemGetById( p_playlist, i_cat, false );