X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fservices_discovery%2Fupnp_cc.cpp;h=91bec309b29de85bf476278a1a47c17014987484;hb=deb641c7c5e45770b3b1e2510e8bfc42a057af6c;hp=b7f9f3865063f4b6cb8075a838ef615ec3c4c7e8;hpb=83a9495bed15c054a6ad56d134770908713b7847;p=vlc diff --git a/modules/services_discovery/upnp_cc.cpp b/modules/services_discovery/upnp_cc.cpp index b7f9f38650..91bec309b2 100644 --- a/modules/services_discovery/upnp_cc.cpp +++ b/modules/services_discovery/upnp_cc.cpp @@ -6,7 +6,7 @@ * * Authors: Rémi Denis-Courmont * - * Based on original wxWindows patch for VLC, and dependant on CyberLink + * Based on original wxWindows patch for VLC, and dependent on CyberLink * UPnP library from : * Satoshi Konno * @@ -32,7 +32,12 @@ #include #undef PACKAGE_NAME -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include #include /* FIXME: thread-safety ?? */ @@ -54,7 +59,7 @@ using namespace CyberLink; vlc_module_begin(); set_shortname( "UPnP"); - set_description( _("Universal Plug'n'Play discovery") ); + set_description( N_("Universal Plug'n'Play discovery") ); set_category( CAT_PLAYLIST ); set_subcategory( SUBCAT_PLAYLIST_SD ); @@ -151,7 +156,7 @@ static void Run( services_discovery_t *p_sd ) msg_Dbg( p_sd, "UPnP discovery started" ); /* read SAP packets */ - while( !p_sd->b_die ) + while( vlc_object_alive (p_sd) ) { msleep( 500 ); } @@ -180,7 +185,7 @@ playlist_item_t *UPnPHandler::AddDevice( Device *dev ) */ char *str = strdup( dev->getFriendlyName( ) ); - p_item = playlist_NodeCreate( p_playlist, str, p_sd->p_cat,0 ); + p_item = playlist_NodeCreate( p_playlist, str, p_sd->p_cat, 0, NULL ); p_item->i_flags &= ~PLAYLIST_SKIP_FLAG; msg_Dbg( p_sd, "device %s added", str ); free( str ); @@ -213,16 +218,18 @@ void UPnPHandler::AddContent( playlist_item_t *p_parent, ContentNode *node ) { ItemNode *iNode = (ItemNode *)node; input_item_t *p_input = input_ItemNew( p_sd, iNode->getResource(), title ); + /* FIXME: playlist_AddInput() can fail */ playlist_BothAddInput( p_playlist, p_input, p_parent, PLAYLIST_APPEND, PLAYLIST_END, NULL, NULL, - VLC_FALSE ); + false ); + vlc_gc_decref( p_input ); } else if ( node->isContainerNode() ) { ContainerNode *conNode = (ContainerNode *)node; char* p_name = strdup(title); /* See other comment on strdup */ - playlist_item_t* p_node = playlist_NodeCreate( p_playlist, - p_name, p_parent, 0 ); + playlist_item_t* p_node = playlist_NodeCreate( p_playlist, p_name, + p_parent, 0, NULL ); free(p_name); unsigned nContentNodes = conNode->getNContentNodes(); @@ -238,7 +245,7 @@ void UPnPHandler::RemoveDevice( Device *dev ) playlist_item_t *p_item = FindDeviceNode( dev ); if( p_item != NULL ) - playlist_NodeDelete( p_playlist, p_item, VLC_TRUE, VLC_TRUE ); + playlist_NodeDelete( p_playlist, p_item, true, true ); }