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

Move LibVLC error messages to libvlc_printerr().

parent 9deb8f56
...@@ -88,15 +88,12 @@ VLC_PUBLIC_API int ...@@ -88,15 +88,12 @@ VLC_PUBLIC_API int
libvlc_exception_raised( const libvlc_exception_t *p_exception ); libvlc_exception_raised( const libvlc_exception_t *p_exception );
/** /**
* Raise an exception using a user-provided message. * Raise an exception.
* *
* \param p_exception the exception to raise * \param p_exception the exception to raise
* \param psz_format the exception message format string
* \param ... the format string arguments
*/ */
VLC_PUBLIC_API void VLC_PUBLIC_API void
libvlc_exception_raise( libvlc_exception_t *p_exception, libvlc_exception_raise( libvlc_exception_t *p_exception );
const char *psz_format, ... );
/** /**
* Clear an exception object so it can be reused. * Clear an exception object so it can be reused.
......
...@@ -52,7 +52,8 @@ static aout_instance_t *GetAOut( libvlc_instance_t *p_instance, ...@@ -52,7 +52,8 @@ static aout_instance_t *GetAOut( libvlc_instance_t *p_instance,
p_aout = vlc_object_find( p_instance->p_libvlc_int, VLC_OBJECT_AOUT, FIND_CHILD ); p_aout = vlc_object_find( p_instance->p_libvlc_int, VLC_OBJECT_AOUT, FIND_CHILD );
if( !p_aout ) if( !p_aout )
{ {
libvlc_exception_raise( p_exception, "No active audio output" ); libvlc_exception_raise( p_exception );
libvlc_printerr( "No active audio output" );
return NULL; return NULL;
} }
...@@ -84,7 +85,8 @@ libvlc_audio_output_t * ...@@ -84,7 +85,8 @@ libvlc_audio_output_t *
malloc( sizeof( libvlc_audio_output_t ) ); malloc( sizeof( libvlc_audio_output_t ) );
if( p_actual == NULL ) if( p_actual == NULL )
{ {
libvlc_exception_raise( p_e, "Not enough memory" ); libvlc_exception_raise( p_e );
libvlc_printerr( "Not enough memory" );
libvlc_audio_output_list_release( p_list ); libvlc_audio_output_list_release( p_list );
module_list_free( module_list ); module_list_free( module_list );
return NULL; return NULL;
...@@ -287,7 +289,6 @@ int libvlc_audio_output_get_device_type( libvlc_instance_t *p_instance, ...@@ -287,7 +289,6 @@ int libvlc_audio_output_get_device_type( libvlc_instance_t *p_instance,
vlc_object_release( p_aout ); vlc_object_release( p_aout );
return i_device_type; return i_device_type;
} }
libvlc_exception_raise( p_e, "Unable to get audio output" );
return libvlc_AudioOutputDevice_Error; return libvlc_AudioOutputDevice_Error;
} }
...@@ -299,12 +300,14 @@ void libvlc_audio_output_set_device_type( libvlc_instance_t *p_instance, ...@@ -299,12 +300,14 @@ void libvlc_audio_output_set_device_type( libvlc_instance_t *p_instance,
libvlc_exception_t *p_e ) libvlc_exception_t *p_e )
{ {
aout_instance_t *p_aout = GetAOut( p_instance, p_e ); aout_instance_t *p_aout = GetAOut( p_instance, p_e );
if( p_aout ) if( !p_aout )
return;
if( var_SetInteger( p_aout, "audio-device", device_type ) < 0 )
{ {
if( var_SetInteger( p_aout, "audio-device", device_type ) < 0 ) libvlc_exception_raise( p_e );
libvlc_exception_raise( p_e, "Failed setting audio device" ); libvlc_printerr( "Error setting audio device" );
vlc_object_release( p_aout );
} }
vlc_object_release( p_aout );
} }
/***************************************************************************** /*****************************************************************************
...@@ -363,7 +366,8 @@ void libvlc_audio_set_volume( libvlc_instance_t *p_instance, int i_volume, ...@@ -363,7 +366,8 @@ void libvlc_audio_set_volume( libvlc_instance_t *p_instance, int i_volume,
} }
else else
{ {
libvlc_exception_raise( p_e, "Volume out of range" ); libvlc_exception_raise( p_e );
libvlc_printerr( "Volume out of range" );
} }
} }
...@@ -414,8 +418,9 @@ int libvlc_audio_get_track( libvlc_media_player_t *p_mi, ...@@ -414,8 +418,9 @@ int libvlc_audio_get_track( libvlc_media_player_t *p_mi,
i_ret = var_Get( p_input_thread, "audio-es", &val ); i_ret = var_Get( p_input_thread, "audio-es", &val );
if( i_ret < 0 ) if( i_ret < 0 )
{ {
libvlc_exception_raise( p_e, "Getting Audio track information failed" );
vlc_object_release( p_input_thread ); vlc_object_release( p_input_thread );
libvlc_exception_raise( p_e );
libvlc_printerr( "Audio track information not found" );
return i_ret; return i_ret;
} }
...@@ -450,14 +455,18 @@ void libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track, ...@@ -450,14 +455,18 @@ void libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track,
var_Change( p_input_thread, "audio-es", VLC_VAR_GETCHOICES, &val_list, NULL ); var_Change( p_input_thread, "audio-es", VLC_VAR_GETCHOICES, &val_list, NULL );
if( (i_track < 0) || (i_track > val_list.p_list->i_count) ) if( (i_track < 0) || (i_track > val_list.p_list->i_count) )
{ {
libvlc_exception_raise( p_e, "Audio track out of range" ); libvlc_exception_raise( p_e );
libvlc_printerr( "Audio track out of range" );
goto end; goto end;
} }
newval = val_list.p_list->p_values[i_track]; newval = val_list.p_list->p_values[i_track];
i_ret = var_Set( p_input_thread, "audio-es", newval ); i_ret = var_Set( p_input_thread, "audio-es", newval );
if( i_ret < 0 ) if( i_ret < 0 )
libvlc_exception_raise( p_e, "Setting audio track failed" ); {
libvlc_exception_raise( p_e );
libvlc_printerr( "Audio track out of range" ); /* Race... */
}
end: end:
var_FreeList( &val_list, NULL ); var_FreeList( &val_list, NULL );
...@@ -471,16 +480,12 @@ int libvlc_audio_get_channel( libvlc_instance_t *p_instance, ...@@ -471,16 +480,12 @@ int libvlc_audio_get_channel( libvlc_instance_t *p_instance,
libvlc_exception_t *p_e ) libvlc_exception_t *p_e )
{ {
aout_instance_t *p_aout = GetAOut( p_instance, p_e ); aout_instance_t *p_aout = GetAOut( p_instance, p_e );
if( p_aout ) if( !p_aout )
{ return 0;
vlc_value_t val;
var_Get( p_aout, "audio-channels", &val ); int val = var_GetInteger( p_aout, "audio-channels" );
vlc_object_release( p_aout ); vlc_object_release( p_aout );
return val.i_int; return val;
}
libvlc_exception_raise( p_e, "Unable to get audio output" );
return libvlc_AudioChannel_Error;
} }
/***************************************************************************** /*****************************************************************************
...@@ -491,14 +496,13 @@ void libvlc_audio_set_channel( libvlc_instance_t *p_instance, ...@@ -491,14 +496,13 @@ void libvlc_audio_set_channel( libvlc_instance_t *p_instance,
libvlc_exception_t *p_e ) libvlc_exception_t *p_e )
{ {
aout_instance_t *p_aout = GetAOut( p_instance, p_e ); aout_instance_t *p_aout = GetAOut( p_instance, p_e );
if( p_aout ) if( !p_aout )
{ return;
vlc_value_t val;
val.i_int = channel;
if( var_Set( p_aout, "audio-channels", val ) < 0 )
libvlc_exception_raise( p_e, "Failed setting audio channel" );
vlc_object_release( p_aout ); if( var_SetInteger( p_aout, "audio-channels", channel ) < 0 )
{
libvlc_exception_raise( p_e );
libvlc_printerr( "Audio channel out of range" );
} }
vlc_object_release( p_aout );
} }
...@@ -65,23 +65,8 @@ static void libvlc_exception_not_handled( const char *psz ) ...@@ -65,23 +65,8 @@ static void libvlc_exception_not_handled( const char *psz )
abort(); abort();
} }
void libvlc_exception_raise( libvlc_exception_t *p_exception, void libvlc_exception_raise( libvlc_exception_t *p_exception )
const char *psz_format, ... )
{ {
va_list args;
/* Make sure that there is no unnoticed previous exception */
if( p_exception && p_exception->b_raised )
{
libvlc_exception_not_handled( libvlc_errmsg() );
libvlc_exception_clear( p_exception );
}
/* Unformat-ize the message */
va_start( args, psz_format );
libvlc_vprinterr( psz_format, args );
va_end( args );
/* Does caller care about exceptions ? */ /* Does caller care about exceptions ? */
if( p_exception == NULL ) { if( p_exception == NULL ) {
/* Print something, so that lazy third-parties can easily /* Print something, so that lazy third-parties can easily
...@@ -187,7 +172,8 @@ int libvlc_add_intf( libvlc_instance_t *p_i, const char *name, ...@@ -187,7 +172,8 @@ int libvlc_add_intf( libvlc_instance_t *p_i, const char *name,
{ {
if( libvlc_InternalAddIntf( p_i->p_libvlc_int, name ) ) if( libvlc_InternalAddIntf( p_i->p_libvlc_int, name ) )
{ {
libvlc_exception_raise( p_e, "Interface initialization failed" ); libvlc_printerr("Interface initialization failed");
libvlc_exception_raise( p_e );
return -1; return -1;
} }
return 0; return 0;
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "libvlc_internal.h" #include "libvlc_internal.h"
#include "event_internal.h" #include "event_internal.h"
#include <assert.h>
typedef struct libvlc_event_listeners_group_t typedef struct libvlc_event_listeners_group_t
{ {
...@@ -74,7 +75,8 @@ libvlc_event_manager_new( void * p_obj, libvlc_instance_t * p_libvlc_inst, ...@@ -74,7 +75,8 @@ libvlc_event_manager_new( void * p_obj, libvlc_instance_t * p_libvlc_inst,
p_em = malloc(sizeof( libvlc_event_manager_t )); p_em = malloc(sizeof( libvlc_event_manager_t ));
if( !p_em ) if( !p_em )
{ {
libvlc_exception_raise( p_e, "No Memory left" ); libvlc_exception_raise( p_e );
libvlc_printerr( "Not enough memory" );
return NULL; return NULL;
} }
...@@ -134,7 +136,8 @@ void libvlc_event_manager_register_event_type( ...@@ -134,7 +136,8 @@ void libvlc_event_manager_register_event_type(
listeners_group = malloc(sizeof(libvlc_event_listeners_group_t)); listeners_group = malloc(sizeof(libvlc_event_listeners_group_t));
if( !listeners_group ) if( !listeners_group )
{ {
libvlc_exception_raise( p_e, "No Memory left" ); libvlc_exception_raise( p_e );
libvlc_printerr( "Not enough memory" );
return; return;
} }
...@@ -287,7 +290,8 @@ void event_attach( libvlc_event_manager_t * p_event_manager, ...@@ -287,7 +290,8 @@ void event_attach( libvlc_event_manager_t * p_event_manager,
listener = malloc(sizeof(libvlc_event_listener_t)); listener = malloc(sizeof(libvlc_event_listener_t));
if( !listener ) if( !listener )
{ {
libvlc_exception_raise( p_e, "No Memory left" ); libvlc_exception_raise( p_e );
libvlc_printerr( "Not enough memory" );
return; return;
} }
...@@ -310,9 +314,9 @@ void event_attach( libvlc_event_manager_t * p_event_manager, ...@@ -310,9 +314,9 @@ void event_attach( libvlc_event_manager_t * p_event_manager,
vlc_mutex_unlock( &p_event_manager->object_lock ); vlc_mutex_unlock( &p_event_manager->object_lock );
free(listener); free(listener);
libvlc_exception_raise( p_e, fprintf( stderr, "This object event manager doesn't know about '%s' events",
"This object event manager doesn't know about '%s' events", libvlc_event_type_name(event_type) );
libvlc_event_type_name(event_type)); assert(0);
} }
/************************************************************************** /**************************************************************************
...@@ -399,10 +403,5 @@ void libvlc_event_detach( libvlc_event_manager_t *p_event_manager, ...@@ -399,10 +403,5 @@ void libvlc_event_detach( libvlc_event_manager_t *p_event_manager,
libvlc_event_async_ensure_listener_removal(p_event_manager, &listener_to_remove); libvlc_event_async_ensure_listener_removal(p_event_manager, &listener_to_remove);
if(!found) assert(found);
{
libvlc_exception_raise( p_e,
"This object event manager doesn't know about '%s,%p,%p' event observer",
libvlc_event_type_name(event_type), pf_callback, p_user_data );
}
} }
...@@ -105,7 +105,8 @@ hierarch_node_media_list_view_item_at_index( libvlc_media_list_view_t * p_mlv, ...@@ -105,7 +105,8 @@ hierarch_node_media_list_view_item_at_index( libvlc_media_list_view_t * p_mlv,
libvlc_media_release( p_md ); libvlc_media_release( p_md );
} }
libvlc_exception_raise( p_e, "Index out of bound in Media List View" ); libvlc_exception_raise( p_e );
libvlc_printerr( "Index out of bound in Media List View" );
return NULL; return NULL;
} }
......
...@@ -104,9 +104,11 @@ void libvlc_event_attach_async( libvlc_event_manager_t * p_event_manager, ...@@ -104,9 +104,11 @@ void libvlc_event_attach_async( libvlc_event_manager_t * p_event_manager,
/* Exception shorcuts */ /* Exception shorcuts */
#define RAISENULL( ... ) { libvlc_exception_raise( p_e, __VA_ARGS__ ); \ #define RAISENULL( ... ) { libvlc_printerr(__VA_ARGS__); \
libvlc_exception_raise( p_e ); \
return NULL; } return NULL; }
#define RAISEZERO( ... ) { libvlc_exception_raise( p_e, __VA_ARGS__ ); \ #define RAISEZERO( ... ) { libvlc_printerr(__VA_ARGS__); \
libvlc_exception_raise( p_e ); \
return 0; } return 0; }
#endif #endif
...@@ -245,14 +245,16 @@ libvlc_media_t * libvlc_media_new_from_input_item( ...@@ -245,14 +245,16 @@ libvlc_media_t * libvlc_media_new_from_input_item(
if (!p_input_item) if (!p_input_item)
{ {
libvlc_exception_raise( p_e, "No input item given" ); libvlc_exception_raise( p_e );
libvlc_printerr( "No input item given" );
return NULL; return NULL;
} }
p_md = malloc( sizeof(libvlc_media_t) ); p_md = malloc( sizeof(libvlc_media_t) );
if( !p_md ) if( !p_md )
{ {
libvlc_exception_raise( p_e, "Not enough memory" ); libvlc_exception_raise( p_e );
libvlc_printerr( "Not enough memory" );
return NULL; return NULL;
} }
...@@ -302,7 +304,8 @@ libvlc_media_t * libvlc_media_new( ...@@ -302,7 +304,8 @@ libvlc_media_t * libvlc_media_new(
if (!p_input_item) if (!p_input_item)
{ {
libvlc_exception_raise( p_e, "Can't create md's input_item" ); libvlc_exception_raise( p_e );
libvlc_printerr( "Not enough memory" );
return NULL; return NULL;
} }
...@@ -330,7 +333,8 @@ libvlc_media_t * libvlc_media_new_as_node( ...@@ -330,7 +333,8 @@ libvlc_media_t * libvlc_media_new_as_node(
if (!p_input_item) if (!p_input_item)
{ {
libvlc_exception_raise( p_e, "Can't create md's input_item" ); libvlc_exception_raise( p_e );
libvlc_printerr( "Not enough memory" );
return NULL; return NULL;
} }
...@@ -545,7 +549,8 @@ libvlc_media_get_duration( libvlc_media_t * p_md, ...@@ -545,7 +549,8 @@ libvlc_media_get_duration( libvlc_media_t * p_md,
if( !p_md || !p_md->p_input_item) if( !p_md || !p_md->p_input_item)
{ {
libvlc_exception_raise( p_e, "No input item" ); libvlc_exception_raise( p_e );
libvlc_printerr( "No input item" );
return -1; return -1;
} }
...@@ -563,7 +568,8 @@ libvlc_media_is_preparsed( libvlc_media_t * p_md, ...@@ -563,7 +568,8 @@ libvlc_media_is_preparsed( libvlc_media_t * p_md,
if( !p_md || !p_md->p_input_item) if( !p_md || !p_md->p_input_item)
{ {
libvlc_exception_raise( p_e, "No input item" ); libvlc_exception_raise( p_e );
libvlc_printerr( "No input item" );
return false; return false;
} }
......
...@@ -178,7 +178,8 @@ libvlc_media_discoverer_new_from_name( libvlc_instance_t * p_inst, ...@@ -178,7 +178,8 @@ libvlc_media_discoverer_new_from_name( libvlc_instance_t * p_inst,
p_mdis = malloc(sizeof(libvlc_media_discoverer_t)); p_mdis = malloc(sizeof(libvlc_media_discoverer_t));
if( !p_mdis ) if( !p_mdis )
{ {
libvlc_exception_raise( p_e, "Not enough memory" ); libvlc_exception_raise( p_e );
libvlc_printerr( "Not enough memory" );
return NULL; return NULL;
} }
...@@ -202,7 +203,8 @@ libvlc_media_discoverer_new_from_name( libvlc_instance_t * p_inst, ...@@ -202,7 +203,8 @@ 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_media_list_release( p_mdis->p_mlist );
libvlc_exception_raise( p_e, "Can't find the services_discovery module named '%s'", psz_name ); libvlc_exception_raise( p_e );
libvlc_printerr( "%s: no such discovery module found", psz_name );
free( p_mdis ); free( p_mdis );
return NULL; return NULL;
} }
...@@ -228,7 +230,8 @@ libvlc_media_discoverer_new_from_name( libvlc_instance_t * p_inst, ...@@ -228,7 +230,8 @@ libvlc_media_discoverer_new_from_name( libvlc_instance_t * p_inst,
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_media_list_release( p_mdis->p_mlist );
libvlc_exception_raise( p_e, "Can't start the services_discovery module named '%s'", psz_name ); libvlc_exception_raise( p_e );
libvlc_printerr( "%s: internal module error", psz_name );
free( p_mdis ); free( p_mdis );
return NULL; return NULL;
} }
......
...@@ -111,20 +111,19 @@ libvlc_media_library_load( libvlc_media_library_t * p_mlib, ...@@ -111,20 +111,19 @@ libvlc_media_library_load( libvlc_media_library_t * p_mlib,
char *psz_datadir = config_GetUserDir( VLC_DATA_DIR ); char *psz_datadir = config_GetUserDir( VLC_DATA_DIR );
char * psz_uri; char * psz_uri;
if( !psz_datadir ) /* XXX: i doubt that this can ever happen */ if( psz_datadir == NULL
{ || asprintf( &psz_uri, "file/xspf-open://%s" DIR_SEP "ml.xsp",
libvlc_exception_raise( p_e, "Can't get data directory" );
return;
}
if( asprintf( &psz_uri, "file/xspf-open://%s" DIR_SEP "ml.xsp",
psz_datadir ) == -1 ) psz_datadir ) == -1 )
psz_uri = NULL;
free( psz_datadir );
if( psz_uri == NULL );
{ {
free( psz_datadir ); libvlc_exception_raise( p_e );
libvlc_exception_raise( p_e, "Can't get create the path" ); libvlc_printerr( "Not enough memory" );
return; return;
} }
free( psz_datadir );
if( p_mlib->p_mlist ) if( p_mlib->p_mlist )
libvlc_media_list_release( p_mlib->p_mlist ); libvlc_media_list_release( p_mlib->p_mlist );
...@@ -145,7 +144,8 @@ libvlc_media_library_save( libvlc_media_library_t * p_mlib, ...@@ -145,7 +144,8 @@ libvlc_media_library_save( libvlc_media_library_t * p_mlib,
libvlc_exception_t * p_e ) libvlc_exception_t * p_e )
{ {
(void)p_mlib; (void)p_mlib;
libvlc_exception_raise( p_e, "Not supported" ); libvlc_exception_raise( p_e );
libvlc_printerr( "Function not implemented" );
} }
/************************************************************************** /**************************************************************************
......
...@@ -134,7 +134,8 @@ int mlist_is_writable( libvlc_media_list_t *p_mlist, libvlc_exception_t *p_e ) ...@@ -134,7 +134,8 @@ int mlist_is_writable( libvlc_media_list_t *p_mlist, libvlc_exception_t *p_e )
if( !p_mlist||p_mlist->b_read_only ) if( !p_mlist||p_mlist->b_read_only )
{ {
/* We are read-only from user side */ /* We are read-only from user side */
libvlc_exception_raise( p_e, "Cannot write to read-only media list." ); libvlc_exception_raise( p_e );
libvlc_printerr( "Attempt to write a read-only media list" );
return 0; return 0;
} }
return 1; return 1;
...@@ -259,7 +260,8 @@ libvlc_media_list_add_file_content( libvlc_media_list_t * p_mlist, ...@@ -259,7 +260,8 @@ libvlc_media_list_add_file_content( libvlc_media_list_t * p_mlist,
if( !p_input_item ) if( !p_input_item )
{ {
libvlc_exception_raise( p_e, "Can't create an input item" ); libvlc_exception_raise( p_e );
libvlc_printerr( "Not enough memory" );
return; return;
} }
...@@ -417,7 +419,8 @@ void _libvlc_media_list_remove_index( libvlc_media_list_t * p_mlist, ...@@ -417,7 +419,8 @@ void _libvlc_media_list_remove_index( libvlc_media_list_t * p_mlist,
if( index < 0 || index >= vlc_array_count( &p_mlist->items )) if( index < 0 || index >= vlc_array_count( &p_mlist->items ))
{ {
libvlc_exception_raise( p_e, "Index out of bounds"); libvlc_exception_raise( p_e );
libvlc_printerr( "Index out of bounds" );
return; return;
} }
...@@ -444,7 +447,8 @@ libvlc_media_list_item_at_index( libvlc_media_list_t * p_mlist, ...@@ -444,7 +447,8 @@ libvlc_media_list_item_at_index( libvlc_media_list_t * p_mlist,
if( index < 0 || index >= vlc_array_count( &p_mlist->items )) if( index < 0 || index >= vlc_array_count( &p_mlist->items ))
{ {
libvlc_exception_raise( p_e, "Index out of bounds"); libvlc_exception_raise( p_e );
libvlc_printerr( "Index out of bounds" );
return NULL; return NULL;
} }
......
...@@ -566,14 +566,9 @@ void libvlc_media_list_player_set_media_player(libvlc_media_list_player_t * p_ml ...@@ -566,14 +566,9 @@ void libvlc_media_list_player_set_media_player(libvlc_media_list_player_t * p_ml
**************************************************************************/ **************************************************************************/
void libvlc_media_list_player_set_media_list(libvlc_media_list_player_t * p_mlp, libvlc_media_list_t * p_mlist, libvlc_exception_t * p_e) void libvlc_media_list_player_set_media_list(libvlc_media_list_player_t * p_mlp, libvlc_media_list_t * p_mlist, libvlc_exception_t * p_e)
{ {
lock(p_mlp); assert (p_mlist);
if (!p_mlist) lock(p_mlp);
{
libvlc_exception_raise(p_e, "No media list provided");
unlock(p_mlp);
return;
}
if (p_mlp->p_mlist) if (p_mlp->p_mlist)
{ {
uninstall_playlist_observer(p_mlp); uninstall_playlist_observer(p_mlp);
...@@ -668,7 +663,8 @@ void libvlc_media_list_player_play_item(libvlc_media_list_player_t * p_mlp, libv ...@@ -668,7 +663,8 @@ void libvlc_media_list_player_play_item(libvlc_media_list_player_t * p_mlp, libv
libvlc_media_list_path_t path = libvlc_media_list_path_of_item(p_mlp->p_mlist, p_md); libvlc_media_list_path_t path = libvlc_media_list_path_of_item(p_mlp->p_mlist, p_md);
if (!path) if (!path)
{ {
libvlc_exception_raise(p_e, "No such item in media list"); libvlc_exception_raise(p_e);
libvlc_printerr("Item not found in media list");
unlock(p_mlp); unlock(p_mlp);
return; return;
} }
...@@ -726,7 +722,8 @@ static void set_relative_playlist_position_and_play( ...@@ -726,7 +722,8 @@ static void set_relative_playlist_position_and_play(
if (!p_mlp->p_mlist) if (!p_mlp->p_mlist)
{ {
libvlc_exception_raise(p_e, "No media list"); libvlc_exception_raise(p_e);
libvlc_printerr("No media list");
return; return;
} }
......
...@@ -475,7 +475,8 @@ libvlc_media_list_view_children_for_item( libvlc_media_list_view_t * p_mlv, ...@@ -475,7 +475,8 @@ libvlc_media_list_view_children_for_item( libvlc_media_list_view_t * p_mlv,
{ \ { \
if( p_mlv->pf_##name ) \ if( p_mlv->pf_##name ) \
return p_mlv->pf_##name ARGS(__VA_ARGS__) ; \ return p_mlv->pf_##name ARGS(__VA_ARGS__) ; \
libvlc_exception_raise( p_e, "No '" #name "' method in this media_list_view" ); \ libvlc_exception_raise( p_e ); \
libvlc_printerr( "No '" #name "' method in this media_list_view" ); \
return default_ret_value;\ return default_ret_value;\
} }
...@@ -490,7 +491,8 @@ libvlc_media_list_view_children_for_item( libvlc_media_list_view_t * p_mlv, ...@@ -490,7 +491,8 @@ libvlc_media_list_view_children_for_item( libvlc_media_list_view_t * p_mlv,
p_mlv->pf_##name ARGS(__VA_ARGS__) ; \ p_mlv->pf_##name ARGS(__VA_ARGS__) ; \
return; \ return; \
} \ } \
libvlc_exception_raise( p_e, "No '" #name "' method in this media_list_view" ); \ libvlc_exception_raise( p_e ); \
libvlc_printerr( "No '" #name "' method in this media_list_view" ); \
} }
......
...@@ -275,16 +275,13 @@ libvlc_media_player_new( libvlc_instance_t * p_libvlc_instance, ...@@ -275,16 +275,13 @@ libvlc_media_player_new( libvlc_instance_t * p_libvlc_instance,
{ {
libvlc_media_player_t * p_mi; libvlc_media_player_t * p_mi;
if( !p_libvlc_instance ) assert( p_libvlc_instance );
{
libvlc_exception_raise( p_e, "invalid libvlc instance" );
return NULL;
}
p_mi = malloc( sizeof(libvlc_media_player_t) ); p_mi = malloc( sizeof(libvlc_media_player_t) );
if( !p_mi ) if( !p_mi )
{ {
libvlc_exception_raise( p_e, "not enough memory" ); libvlc_exception_raise( p_e );
libvlc_printerr( "Not enough memory" );
return NULL; return NULL;
} }
p_mi->p_md = NULL; p_mi->p_md = NULL;
...@@ -558,8 +555,9 @@ void libvlc_media_player_play( libvlc_media_player_t *p_mi, ...@@ -558,8 +555,9 @@ void libvlc_media_player_play( libvlc_media_player_t *p_mi,
if( !p_mi->p_md ) if( !p_mi->p_md )
{ {
libvlc_exception_raise( p_e, "no associated media descriptor" );
vlc_mutex_unlock( &p_mi->object_lock ); vlc_mutex_unlock( &p_mi->object_lock );
libvlc_exception_raise( p_e );
libvlc_printerr( "No associated media descriptor" );
return; return;
} }
...@@ -1038,7 +1036,8 @@ void libvlc_media_player_set_rate( ...@@ -1038,7 +1036,8 @@ void libvlc_media_player_set_rate(
if( (rate < 0.0) && !b_can_rewind ) if( (rate < 0.0) && !b_can_rewind )
{ {
vlc_object_release( p_input_thread ); vlc_object_release( p_input_thread );
libvlc_exception_raise( p_e, "Rate value is invalid" ); libvlc_exception_raise( p_e );
libvlc_printerr( "Invalid playback rate" );
return; return;
} }
...@@ -1063,7 +1062,6 @@ float libvlc_media_player_get_rate( ...@@ -1063,7 +1062,6 @@ float libvlc_media_player_get_rate(
if( i_rate < 0 && !b_can_rewind ) if( i_rate < 0 && !b_can_rewind )
{ {
vlc_object_release( p_input_thread ); vlc_object_release( p_input_thread );
libvlc_exception_raise( p_e, "invalid rate" );
return 0.0; return 0.0;
} }