Commit 1153717c authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

playlist/services_discovery.c: Use a stop method to end the service.

parent 716d5bf2
...@@ -428,6 +428,7 @@ VLC_EXPORT( playlist_item_t *, playlist_GetLastLeaf, ( playlist_t *p_playlist, p ...@@ -428,6 +428,7 @@ VLC_EXPORT( playlist_item_t *, playlist_GetLastLeaf, ( playlist_t *p_playlist, p
VLC_EXPORT( services_discovery_t *, services_discovery_Create, ( vlc_object_t * p_super, const char * psz_service_name ) ); VLC_EXPORT( services_discovery_t *, services_discovery_Create, ( vlc_object_t * p_super, const char * psz_service_name ) );
VLC_EXPORT( void, services_discovery_Destroy, ( services_discovery_t * p_this ) ); VLC_EXPORT( void, services_discovery_Destroy, ( services_discovery_t * p_this ) );
VLC_EXPORT( int, services_discovery_Start, ( services_discovery_t * p_this ) ); VLC_EXPORT( int, services_discovery_Start, ( services_discovery_t * p_this ) );
VLC_EXPORT( void, services_discovery_Stop, ( services_discovery_t * p_this ) );
/* Read info from discovery object */ /* Read info from discovery object */
VLC_EXPORT( char *, services_discovery_GetLocalizedName, ( services_discovery_t * p_this ) ); VLC_EXPORT( char *, services_discovery_GetLocalizedName, ( services_discovery_t * p_this ) );
......
...@@ -72,13 +72,9 @@ services_discovery_Create ( vlc_object_t * p_super, const char * psz_module_name ...@@ -72,13 +72,9 @@ services_discovery_Create ( vlc_object_t * p_super, const char * psz_module_name
***********************************************************************/ ***********************************************************************/
void services_discovery_Destroy ( services_discovery_t * p_sd ) void services_discovery_Destroy ( services_discovery_t * p_sd )
{ {
vlc_object_kill( p_sd ); vlc_event_manager_fini( &p_sd->event_manager );
if( p_sd->pf_run ) vlc_thread_join( p_sd );
free( p_sd->psz_module ); free( p_sd->psz_module );
module_Unneed( p_sd, p_sd->p_module );
vlc_event_manager_fini( &p_sd->event_manager );
free( p_sd->psz_localized_name ); free( p_sd->psz_localized_name );
vlc_object_destroy( p_sd ); vlc_object_destroy( p_sd );
...@@ -100,6 +96,17 @@ int services_discovery_Start ( services_discovery_t * p_sd ) ...@@ -100,6 +96,17 @@ int services_discovery_Start ( services_discovery_t * p_sd )
return VLC_SUCCESS; return VLC_SUCCESS;
} }
/***********************************************************************
* Stop
***********************************************************************/
void services_discovery_Stop ( services_discovery_t * p_sd )
{
vlc_object_kill( p_sd );
if( p_sd->pf_run ) vlc_thread_join( p_sd );
module_Unneed( p_sd, p_sd->p_module );
}
/*********************************************************************** /***********************************************************************
* GetLocalizedName * GetLocalizedName
***********************************************************************/ ***********************************************************************/
...@@ -316,7 +323,7 @@ int playlist_ServicesDiscoveryRemove( playlist_t * p_playlist, ...@@ -316,7 +323,7 @@ int playlist_ServicesDiscoveryRemove( playlist_t * p_playlist,
if( p_asd && p_asd->p_sd ) if( p_asd && p_asd->p_sd )
{ {
services_discovery_Destroy( p_asd->p_sd ); services_discovery_Stop( p_asd->p_sd );
vlc_event_detach( services_discovery_EventManager( p_asd->p_sd ), vlc_event_detach( services_discovery_EventManager( p_asd->p_sd ),
vlc_ServicesDiscoveryItemAdded, vlc_ServicesDiscoveryItemAdded,
...@@ -348,6 +355,8 @@ int playlist_ServicesDiscoveryRemove( playlist_t * p_playlist, ...@@ -348,6 +355,8 @@ int playlist_ServicesDiscoveryRemove( playlist_t * p_playlist,
} }
PL_UNLOCK; PL_UNLOCK;
services_discovery_Destroy( p_asd->p_sd );
free( p_asd ); free( p_asd );
} }
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment