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
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 psz_format the exception message format string
* \param ... the format string arguments
*/
VLC_PUBLIC_API void
libvlc_exception_raise( libvlc_exception_t *p_exception,
const char *psz_format, ... );
libvlc_exception_raise( libvlc_exception_t *p_exception );
/**
* Clear an exception object so it can be reused.
......
......@@ -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 );
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;
}
......@@ -84,7 +85,8 @@ libvlc_audio_output_t *
malloc( sizeof( libvlc_audio_output_t ) );
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 );
module_list_free( module_list );
return NULL;
......@@ -287,7 +289,6 @@ int libvlc_audio_output_get_device_type( libvlc_instance_t *p_instance,
vlc_object_release( p_aout );
return i_device_type;
}
libvlc_exception_raise( p_e, "Unable to get audio output" );
return libvlc_AudioOutputDevice_Error;
}
......@@ -299,12 +300,14 @@ void libvlc_audio_output_set_device_type( libvlc_instance_t *p_instance,
libvlc_exception_t *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, "Failed setting audio device" );
vlc_object_release( p_aout );
libvlc_exception_raise( p_e );
libvlc_printerr( "Error setting audio device" );
}
vlc_object_release( p_aout );
}
/*****************************************************************************
......@@ -363,7 +366,8 @@ void libvlc_audio_set_volume( libvlc_instance_t *p_instance, int i_volume,
}
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,
i_ret = var_Get( p_input_thread, "audio-es", &val );
if( i_ret < 0 )
{
libvlc_exception_raise( p_e, "Getting Audio track information failed" );
vlc_object_release( p_input_thread );
libvlc_exception_raise( p_e );
libvlc_printerr( "Audio track information not found" );
return i_ret;
}
......@@ -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 );
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;
}
newval = val_list.p_list->p_values[i_track];
i_ret = var_Set( p_input_thread, "audio-es", newval );
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:
var_FreeList( &val_list, NULL );
......@@ -471,16 +480,12 @@ int libvlc_audio_get_channel( libvlc_instance_t *p_instance,
libvlc_exception_t *p_e )
{
aout_instance_t *p_aout = GetAOut( p_instance, p_e );
if( p_aout )
{
vlc_value_t val;
if( !p_aout )
return 0;
var_Get( p_aout, "audio-channels", &val );
vlc_object_release( p_aout );
return val.i_int;
}
libvlc_exception_raise( p_e, "Unable to get audio output" );
return libvlc_AudioChannel_Error;
int val = var_GetInteger( p_aout, "audio-channels" );
vlc_object_release( p_aout );
return val;
}
/*****************************************************************************
......@@ -491,14 +496,13 @@ void libvlc_audio_set_channel( libvlc_instance_t *p_instance,
libvlc_exception_t *p_e )
{
aout_instance_t *p_aout = GetAOut( p_instance, p_e );
if( p_aout )
{
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" );
if( !p_aout )
return;
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 )
abort();
}
void libvlc_exception_raise( libvlc_exception_t *p_exception,
const char *psz_format, ... )
void libvlc_exception_raise( libvlc_exception_t *p_exception )
{
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 ? */
if( p_exception == NULL ) {
/* 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,
{
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 0;
......
......@@ -31,6 +31,7 @@
#include "libvlc_internal.h"
#include "event_internal.h"
#include <assert.h>
typedef struct libvlc_event_listeners_group_t
{
......@@ -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 ));
if( !p_em )
{
libvlc_exception_raise( p_e, "No Memory left" );
libvlc_exception_raise( p_e );
libvlc_printerr( "Not enough memory" );
return NULL;
}
......@@ -134,7 +136,8 @@ void libvlc_event_manager_register_event_type(
listeners_group = malloc(sizeof(libvlc_event_listeners_group_t));
if( !listeners_group )
{
libvlc_exception_raise( p_e, "No Memory left" );
libvlc_exception_raise( p_e );
libvlc_printerr( "Not enough memory" );
return;
}
......@@ -287,7 +290,8 @@ void event_attach( libvlc_event_manager_t * p_event_manager,
listener = malloc(sizeof(libvlc_event_listener_t));
if( !listener )
{
libvlc_exception_raise( p_e, "No Memory left" );
libvlc_exception_raise( p_e );
libvlc_printerr( "Not enough memory" );
return;
}
......@@ -310,9 +314,9 @@ void event_attach( libvlc_event_manager_t * p_event_manager,
vlc_mutex_unlock( &p_event_manager->object_lock );
free(listener);
libvlc_exception_raise( p_e,
"This object event manager doesn't know about '%s' events",
libvlc_event_type_name(event_type));
fprintf( stderr, "This object event manager doesn't know about '%s' events",
libvlc_event_type_name(event_type) );
assert(0);
}
/**************************************************************************
......@@ -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);
if(!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 );
}
assert(found);
}
......@@ -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_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;
}
......
......@@ -104,9 +104,11 @@ void libvlc_event_attach_async( libvlc_event_manager_t * p_event_manager,
/* Exception shorcuts */
#define RAISENULL( ... ) { libvlc_exception_raise( p_e, __VA_ARGS__ ); \
#define RAISENULL( ... ) { libvlc_printerr(__VA_ARGS__); \
libvlc_exception_raise( p_e ); \
return NULL; }
#define RAISEZERO( ... ) { libvlc_exception_raise( p_e, __VA_ARGS__ ); \
#define RAISEZERO( ... ) { libvlc_printerr(__VA_ARGS__); \
libvlc_exception_raise( p_e ); \
return 0; }
#endif
......@@ -245,14 +245,16 @@ libvlc_media_t * libvlc_media_new_from_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;
}
p_md = malloc( sizeof(libvlc_media_t) );
if( !p_md )
{
libvlc_exception_raise( p_e, "Not enough memory" );
libvlc_exception_raise( p_e );
libvlc_printerr( "Not enough memory" );
return NULL;
}
......@@ -302,7 +304,8 @@ libvlc_media_t * libvlc_media_new(
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;
}
......@@ -330,7 +333,8 @@ libvlc_media_t * libvlc_media_new_as_node(
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;
}
......@@ -545,7 +549,8 @@ libvlc_media_get_duration( libvlc_media_t * p_md,
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;
}
......@@ -563,7 +568,8 @@ libvlc_media_is_preparsed( libvlc_media_t * p_md,
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;
}
......
......@@ -178,7 +178,8 @@ libvlc_media_discoverer_new_from_name( libvlc_instance_t * p_inst,
p_mdis = malloc(sizeof(libvlc_media_discoverer_t));
if( !p_mdis )
{
libvlc_exception_raise( p_e, "Not enough memory" );
libvlc_exception_raise( p_e );
libvlc_printerr( "Not enough memory" );
return NULL;
}
......@@ -202,7 +203,8 @@ libvlc_media_discoverer_new_from_name( libvlc_instance_t * p_inst,
if( !p_mdis->p_sd )
{
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 );
return NULL;
}
......@@ -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 ) )
{
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 );
return NULL;
}
......
......@@ -111,20 +111,19 @@ libvlc_media_library_load( libvlc_media_library_t * p_mlib,
char *psz_datadir = config_GetUserDir( VLC_DATA_DIR );
char * psz_uri;
if( !psz_datadir ) /* XXX: i doubt that this can ever happen */
{
libvlc_exception_raise( p_e, "Can't get data directory" );
return;
}
if( asprintf( &psz_uri, "file/xspf-open://%s" DIR_SEP "ml.xsp",
if( psz_datadir == NULL
|| asprintf( &psz_uri, "file/xspf-open://%s" DIR_SEP "ml.xsp",
psz_datadir ) == -1 )
psz_uri = NULL;
free( psz_datadir );
if( psz_uri == NULL );
{
free( psz_datadir );
libvlc_exception_raise( p_e, "Can't get create the path" );
libvlc_exception_raise( p_e );
libvlc_printerr( "Not enough memory" );
return;
}
free( psz_datadir );
if( 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,
libvlc_exception_t * p_e )
{
(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 )
if( !p_mlist||p_mlist->b_read_only )
{
/* 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 1;
......@@ -259,7 +260,8 @@ libvlc_media_list_add_file_content( libvlc_media_list_t * p_mlist,
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;
}
......@@ -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 ))
{
libvlc_exception_raise( p_e, "Index out of bounds");
libvlc_exception_raise( p_e );
libvlc_printerr( "Index out of bounds" );
return;
}
......@@ -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 ))
{
libvlc_exception_raise( p_e, "Index out of bounds");
libvlc_exception_raise( p_e );
libvlc_printerr( "Index out of bounds" );
return NULL;
}
......
......@@ -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)
{
lock(p_mlp);
assert (p_mlist);
if (!p_mlist)
{
libvlc_exception_raise(p_e, "No media list provided");
unlock(p_mlp);
return;
}
lock(p_mlp);
if (p_mlp->p_mlist)
{
uninstall_playlist_observer(p_mlp);
......@@ -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);
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);
return;
}
......@@ -726,7 +722,8 @@ static void set_relative_playlist_position_and_play(
if (!p_mlp->p_mlist)
{
libvlc_exception_raise(p_e, "No media list");
libvlc_exception_raise(p_e);
libvlc_printerr("No media list");
return;
}
......
......@@ -475,7 +475,8 @@ libvlc_media_list_view_children_for_item( libvlc_media_list_view_t * p_mlv,
{ \
if( p_mlv->pf_##name ) \
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;\
}
......@@ -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__) ; \
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,
{
libvlc_media_player_t * p_mi;
if( !p_libvlc_instance )
{
libvlc_exception_raise( p_e, "invalid libvlc instance" );
return NULL;
}
assert( p_libvlc_instance );
p_mi = malloc( sizeof(libvlc_media_player_t) );
if( !p_mi )
{
libvlc_exception_raise( p_e, "not enough memory" );
libvlc_exception_raise( p_e );
libvlc_printerr( "Not enough memory" );
return NULL;
}
p_mi->p_md = NULL;
......@@ -558,8 +555,9 @@ void libvlc_media_player_play( libvlc_media_player_t *p_mi,
if( !p_mi->p_md )
{
libvlc_exception_raise( p_e, "no associated media descriptor" );
vlc_mutex_unlock( &p_mi->object_lock );
libvlc_exception_raise( p_e );
libvlc_printerr( "No associated media descriptor" );
return;
}
......@@ -1038,7 +1036,8 @@ void libvlc_media_player_set_rate(
if( (rate < 0.0) && !b_can_rewind )
{
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;
}
......@@ -1063,7 +1062,6 @@ float libvlc_media_player_get_rate(
if( i_rate < 0 && !b_can_rewind )
{
vlc_object_release( p_input_thread );
libvlc_exception_raise( p_e, "invalid rate" );
return 0.0;
}
vlc_object_release( p_input_thread );
......@@ -1143,7 +1141,8 @@ libvlc_track_description_t *
malloc( sizeof( libvlc_track_description_t ) );
if ( !p_track_description )
{
libvlc_exception_raise( p_e, "not enough memory" );
libvlc_exception_raise( p_e );
libvlc_printerr( "Not enough memory" );
goto end;
}
p_actual = p_track_description;
......@@ -1157,7 +1156,8 @@ libvlc_track_description_t *
if ( !p_actual )
{
libvlc_track_description_release( p_track_description );
libvlc_exception_raise( p_e, "not enough memory" );
libvlc_exception_raise( p_e );
libvlc_printerr( "Not enough memory" );
goto end;
}
}
......@@ -1220,5 +1220,8 @@ void libvlc_media_player_next_frame( libvlc_media_player_t *p_mi, libvlc_excepti
vlc_object_release( p_input_thread );
}
else
libvlc_exception_raise( p_e, "Input thread is NULL" );
{
libvlc_exception_raise( p_e );
libvlc_printerr( "No active input" );
}
}
This diff is collapsed.
......@@ -30,6 +30,7 @@
#include <vlc_es.h>
#include <vlc_input.h>
#include <vlc_vlm.h>
#include <assert.h>
#include "libvlc_internal.h"
......@@ -166,8 +167,8 @@ static int libvlc_vlm_init( libvlc_instance_t *p_instance,
p_instance->libvlc_vlm.p_vlm = vlm_New( p_instance->p_libvlc_int );
if( !p_instance->libvlc_vlm.p_vlm )
{
libvlc_exception_raise( p_exception,
"Unable to create VLM." );
libvlc_exception_raise( p_exception );
libvlc_printerr( "VLM not supported or out of memory" );
return VLC_EGENERIC;
}
var_AddCallback( (vlc_object_t *)p_instance->libvlc_vlm.p_vlm,
......@@ -209,8 +210,8 @@ libvlc_vlm_get_media_instance( libvlc_instance_t *p_instance,
vlm_Control( p_vlm, VLM_GET_MEDIA_INSTANCES, id, &pp_minstance,
&i_minstance ) )
{
libvlc_exception_raise( p_exception, "Unable to get %s instances",
psz_name );
libvlc_exception_raise( p_exception );
libvlc_printerr( "%s: media instances not found", psz_name );
return NULL;
}
p_minstance = NULL;
......@@ -355,44 +356,41 @@ const char* libvlc_vlm_show_media( libvlc_instance_t *p_instance,
VLM_RET(p_vlm, NULL);
if( psz_name == NULL )
assert( psz_name );
if( asprintf( &psz_message, "show %s", psz_name ) == -1 )
{
libvlc_exception_raise( p_exception, "No media name supplied" );
libvlc_exception_raise( p_exception );
libvlc_printerr( "Not enough memory" );
return NULL;
}
else if( asprintf( &psz_message, "show %s", psz_name ) == -1 )
vlm_ExecuteCommand( p_vlm, psz_message, &answer );
if( answer->psz_value )
{
libvlc_exception_raise( p_exception, "Unable to call show %s",
psz_name );
libvlc_exception_raise( p_exception );
libvlc_printerr( "Unable to call show %s: %s",
psz_name, answer->psz_value );
}
else
{
vlm_ExecuteCommand( p_vlm, psz_message, &answer );
if( answer->psz_value )
else if ( answer->child )
{ /* in case everything was requested */
if ( strcmp( psz_name, "" ) == 0 )
{
libvlc_exception_raise( p_exception, "Unable to call show %s: %s",
psz_name, answer->psz_value );
psz_fmt = "{\n\t%s\n}\n";
psz_delimiter = "\n\t";
i_list = 0;
}
else if ( answer->child ) {
/* in case everything was requested */
if ( strcmp( psz_name, "" ) == 0 )
{
psz_fmt = "{\n\t%s\n}\n";
psz_delimiter = "\n\t";
i_list = 0;
}
else
{
psz_fmt = "%s\n";
psz_delimiter = "\n";
i_list = 1;
}
if( asprintf( &psz_response, psz_fmt,
recurse_answer( answer, psz_delimiter, i_list ) )
== -1 )
{
libvlc_exception_raise( p_exception, "Error in show %s",
psz_name );
}
else
{
psz_fmt = "%s\n";
psz_delimiter = "\n";
i_list = 1;
}
if( asprintf( &psz_response, psz_fmt,
recurse_answer( answer, psz_delimiter, i_list ) ) == -1 )
{
libvlc_exception_raise( p_exception );
libvlc_printerr( "Out of memory" );
}
}
free( psz_message );
......@@ -429,8 +427,10 @@ void libvlc_vlm_add_broadcast( libvlc_instance_t *p_instance,
n = vlm_Control( p_vlm, VLM_ADD_MEDIA, &m, NULL );
vlm_media_Clean( &m );
if( n )
libvlc_exception_raise( p_exception, "Media %s creation failed",
psz_name );
{
libvlc_exception_raise( p_exception );
libvlc_printerr( "Media %s creation failed", psz_name );
}
}
void libvlc_vlm_add_vod( libvlc_instance_t *p_instance, const char *psz_name,
......@@ -457,8 +457,10 @@ void libvlc_vlm_add_vod( libvlc_instance_t *p_instance, const char *psz_name,
n = vlm_Control( p_vlm, VLM_ADD_MEDIA, &m, NULL );
vlm_media_Clean( &m );
if( n )
libvlc_exception_raise( p_exception, "Media %s creation failed",
psz_name );
{
libvlc_exception_raise( p_exception );
libvlc_printerr( "Media %s creation failed", psz_name );
}
}
void libvlc_vlm_del_media( libvlc_instance_t *p_instance, const char *psz_name,
......@@ -472,7 +474,8 @@ void libvlc_vlm_del_media( libvlc_instance_t *p_instance, const char *psz_name,
if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) ||
vlm_Control( p_vlm, VLM_DEL_MEDIA, id ) )
{
libvlc_exception_raise( p_exception, "Unable to delete %s", psz_name );
libvlc_exception_raise( p_exception );
libvlc_printerr( "Unable to delete %s", psz_name );
}
}
......@@ -483,7 +486,8 @@ void libvlc_vlm_del_media( libvlc_instance_t *p_instance, const char *psz_name,
VLM(p_vlm); \
if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) || \
vlm_Control( p_vlm, VLM_GET_MEDIA, id, &p_media ) ) { \
libvlc_exception_raise( p_exception, psz_error, psz_name ); \
libvlc_exception_raise( p_exception ); \
libvlc_printerr( psz_error, psz_name ); \
return; \
} \
if( !p_media ) goto error; \
......@@ -497,7 +501,8 @@ void libvlc_vlm_del_media( libvlc_instance_t *p_instance, const char *psz_name,
vlm_media_Delete( p_media ); \
return; \
error: \
libvlc_exception_raise( p_exception, psz_error, psz_name );\
libvlc_exception_raise( p_exception ); \
libvlc_printerr( psz_error, psz_name ); \
} while(0)
void libvlc_vlm_set_enabled( libvlc_instance_t *p_instance,
......@@ -598,7 +603,8 @@ void libvlc_vlm_play_media( libvlc_instance_t *p_instance,
if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) ||
vlm_Control( p_vlm, VLM_START_MEDIA_BROADCAST_INSTANCE, id, NULL, 0 ) )
{
libvlc_exception_raise( p_exception, "Unable to play %s", psz_name );
libvlc_exception_raise( p_exception );
libvlc_printerr( "Unable to play %s", psz_name );
}
}
......@@ -614,7 +620,8 @@ void libvlc_vlm_stop_media( libvlc_instance_t *p_instance,
if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) ||
vlm_Control( p_vlm, VLM_STOP_MEDIA_INSTANCE, id, NULL ) )
{
libvlc_exception_raise( p_exception, "Unable to stop %s", psz_name );
libvlc_exception_raise( p_exception );
libvlc_printerr( "Unable to stop %s", psz_name );
}
}
......@@ -630,7 +637,8 @@ void libvlc_vlm_pause_media( libvlc_instance_t *p_instance,
if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) ||
vlm_Control( p_vlm, VLM_PAUSE_MEDIA_INSTANCE, id, NULL ) )
{
libvlc_exception_raise( p_exception, "Unable to pause %s", psz_name );
libvlc_exception_raise( p_exception );
libvlc_printerr( "Unable to pause %s", psz_name );
}
}
......@@ -646,8 +654,10 @@ void libvlc_vlm_seek_media( libvlc_instance_t *p_instance,
if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) ||