Commit c8869bbd authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Media discovery: remove exception

parent b030f616
...@@ -51,13 +51,11 @@ typedef struct libvlc_media_discoverer_t libvlc_media_discoverer_t; ...@@ -51,13 +51,11 @@ typedef struct libvlc_media_discoverer_t libvlc_media_discoverer_t;
* *
* \param p_inst libvlc instance * \param p_inst libvlc instance
* \param psz_name service name * \param psz_name service name
* \param p_e an initialized exception object * \return media discover object or NULL in case of error
* \return media discover object
*/ */
VLC_PUBLIC_API libvlc_media_discoverer_t * VLC_PUBLIC_API libvlc_media_discoverer_t *
libvlc_media_discoverer_new_from_name( libvlc_instance_t * p_inst, libvlc_media_discoverer_new_from_name( libvlc_instance_t * p_inst,
const char * psz_name, const char * psz_name );
libvlc_exception_t * p_e );
/** /**
* Release media discover object. If the reference count reaches 0, then * Release media discover object. If the reference count reaches 0, then
......
...@@ -170,15 +170,13 @@ static void services_discovery_ended( const vlc_event_t * p_event, ...@@ -170,15 +170,13 @@ static void services_discovery_ended( const vlc_event_t * p_event,
**************************************************************************/ **************************************************************************/
libvlc_media_discoverer_t * libvlc_media_discoverer_t *
libvlc_media_discoverer_new_from_name( libvlc_instance_t * p_inst, libvlc_media_discoverer_new_from_name( libvlc_instance_t * p_inst,
const char * psz_name, const char * psz_name )
libvlc_exception_t * p_e )
{ {
libvlc_media_discoverer_t * p_mdis; libvlc_media_discoverer_t * p_mdis;
p_mdis = malloc(sizeof(libvlc_media_discoverer_t)); p_mdis = malloc(sizeof(libvlc_media_discoverer_t));
if( !p_mdis ) if( unlikely(!p_mdis) )
{ {
libvlc_exception_raise( p_e );
libvlc_printerr( "Not enough memory" ); libvlc_printerr( "Not enough memory" );
return NULL; return NULL;
} }
...@@ -206,9 +204,9 @@ libvlc_media_discoverer_new_from_name( libvlc_instance_t * p_inst, ...@@ -206,9 +204,9 @@ libvlc_media_discoverer_new_from_name( libvlc_instance_t * p_inst,
if( !p_mdis->p_sd ) if( !p_mdis->p_sd )
{ {
libvlc_media_list_release( p_mdis->p_mlist );
libvlc_exception_raise( p_e );
libvlc_printerr( "%s: no such discovery module found", psz_name ); libvlc_printerr( "%s: no such discovery module found", psz_name );
libvlc_media_list_release( p_mdis->p_mlist );
libvlc_event_manager_release( p_mdis->p_event_manager );
free( p_mdis ); free( p_mdis );
return NULL; return NULL;
} }
...@@ -233,9 +231,9 @@ libvlc_media_discoverer_new_from_name( libvlc_instance_t * p_inst, ...@@ -233,9 +231,9 @@ libvlc_media_discoverer_new_from_name( libvlc_instance_t * p_inst,
/* Here we go */ /* Here we go */
if( !vlc_sd_Start( p_mdis->p_sd, psz_name ) ) if( !vlc_sd_Start( p_mdis->p_sd, psz_name ) )
{ {
libvlc_media_list_release( p_mdis->p_mlist );
libvlc_exception_raise( p_e );
libvlc_printerr( "%s: internal module error", psz_name ); libvlc_printerr( "%s: internal module error", psz_name );
libvlc_media_list_release( p_mdis->p_mlist );
libvlc_event_manager_release( p_mdis->p_event_manager );
free( p_mdis ); free( p_mdis );
return NULL; return NULL;
} }
......
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