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 )
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 );
int val = var_GetInteger( p_aout, "audio-channels" );
vlc_object_release( p_aout );
return val.i_int;
}
libvlc_exception_raise( p_e, "Unable to get audio output" );
return libvlc_AudioChannel_Error;
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 );
libvlc_exception_raise( p_e, "Can't get create the path" );
if( psz_uri == NULL );
{
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" );
}
}
......@@ -39,6 +39,7 @@
#include "media_player_internal.h"
#include <vlc_osd.h>
#include <assert.h>
/*
* Remember to release the returned vout_thread_t.
......@@ -54,7 +55,8 @@ static vout_thread_t *GetVout( libvlc_media_player_t *p_mi,
p_vout = input_GetVout( p_input );
if( !p_vout )
{
libvlc_exception_raise( p_exception, "No active video output" );
libvlc_exception_raise( p_exception );
libvlc_printerr( "No active video output" );
}
vlc_object_release( p_input );
}
......@@ -116,16 +118,13 @@ libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, const char *psz_filepat
{
vout_thread_t *p_vout;
/* The filepath must be not NULL */
if( !psz_filepath )
{
libvlc_exception_raise( p_e, "filepath is null" );
return;
}
assert( psz_filepath );
/* We must have an input */
if( !p_mi->p_input_thread )
{
libvlc_exception_raise( p_e, "Input does not exist" );
libvlc_exception_raise( p_e );
libvlc_printerr( "Input does not exist" );
return;
}
......@@ -243,11 +242,12 @@ void libvlc_video_set_aspect_ratio( libvlc_media_player_t *p_mi,
if( !p_vout ) return;
i_ret = var_SetString( p_vout, "aspect-ratio", psz_aspect );
if( i_ret )
libvlc_exception_raise( p_e,
"Unexpected error while setting aspect-ratio value" );
vlc_object_release( p_vout );
if( i_ret )
{
libvlc_exception_raise( p_e );
libvlc_printerr( "Bad or unsupported aspect ratio" );
}
}
int libvlc_video_get_spu( libvlc_media_player_t *p_mi,
......@@ -265,8 +265,9 @@ int libvlc_video_get_spu( libvlc_media_player_t *p_mi,
i_ret = var_Get( p_input_thread, "spu-es", &val );
if( i_ret < 0 )
{
libvlc_exception_raise( p_e, "Getting subtitle information failed" );
vlc_object_release( p_input_thread );
libvlc_exception_raise( p_e );
libvlc_printerr( "Subtitle informations not found" );
return i_ret;
}
......@@ -318,15 +319,11 @@ void libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu,
var_Change( p_input_thread, "spu-es", VLC_VAR_GETCHOICES, &val_list, NULL );
if( val_list.p_list->i_count == 0 )
if( ( val_list.p_list->i_count == 0 )
|| (i_spu < 0) || (i_spu > val_list.p_list->i_count) )
{
libvlc_exception_raise( p_e, "Subtitle value out of range" );
goto end;
}
if( (i_spu < 0) || (i_spu > val_list.p_list->i_count) )
{
libvlc_exception_raise( p_e, "Subtitle value out of range" );
libvlc_exception_raise( p_e );
libvlc_printerr( "Subtitle number out of range" );
goto end;
}
......@@ -334,7 +331,8 @@ void libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu,
i_ret = var_Set( p_input_thread, "spu-es", newval );
if( i_ret < 0 )
{
libvlc_exception_raise( p_e, "Setting subtitle value failed" );
libvlc_exception_raise( p_e );
libvlc_printerr( "Subtitle selection error" );
}
end:
......@@ -397,16 +395,19 @@ void libvlc_video_set_crop_geometry( libvlc_media_player_t *p_mi,
if( !p_vout ) return;
i_ret = var_SetString( p_vout, "crop", psz_geometry );
if( i_ret )
libvlc_exception_raise( p_e,
"Unexpected error while setting crop geometry" );
vlc_object_release( p_vout );
if( i_ret )
{
libvlc_exception_raise( p_e );
libvlc_printerr( "Bad or unsupported cropping geometry" );
}
}
int libvlc_video_get_teletext( libvlc_media_player_t *p_mi,
libvlc_exception_t *p_e )
{
#if 0
vout_thread_t *p_vout = GetVout( p_mi, p_e );
vlc_object_t *p_vbi;
int i_ret = -1;
......@@ -423,11 +424,15 @@ int libvlc_video_get_teletext( libvlc_media_player_t *p_mi,
vlc_object_release( p_vout );
return i_ret;
#else
return -1;
#endif
}
void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page,
libvlc_exception_t *p_e )
{
#if 0
vout_thread_t *p_vout = GetVout( p_mi, p_e );
vlc_object_t *p_vbi;
int i_ret = -1;
......@@ -445,13 +450,13 @@ void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page,
"Unexpected error while setting teletext page" );
}
vlc_object_release( p_vout );
#endif
}
void libvlc_toggle_teletext( libvlc_media_player_t *p_mi,
libvlc_exception_t *p_e )
{
input_thread_t *p_input_thread;
vlc_object_t *p_vbi;
int i_ret;
p_input_thread = libvlc_get_input_thread(p_mi, p_e);
......@@ -463,7 +468,8 @@ void libvlc_toggle_teletext( libvlc_media_player_t *p_mi,
return;
}
const bool b_selected = var_GetInteger( p_input_thread, "teletext-es" ) >= 0;
#if 0
vlc_object_t *p_vbi;
p_vbi = (vlc_object_t *)vlc_object_find_name( p_input_thread, "zvbi",
FIND_CHILD );
if( p_vbi )
......@@ -488,7 +494,9 @@ void libvlc_toggle_teletext( libvlc_media_player_t *p_mi,
}
vlc_object_release( p_vbi );
}
else if( b_selected )
else
#endif
if( b_selected )
{
var_SetInteger( p_input_thread, "spu-es", -1 );
}
......@@ -544,7 +552,8 @@ int libvlc_video_get_track( libvlc_media_player_t *p_mi,
i_ret = var_Get( p_input_thread, "video-es", &val );
if( i_ret < 0 )
{
libvlc_exception_raise( p_e, "Getting Video track information failed" );
libvlc_exception_raise( p_e );
libvlc_printerr( "Video track information not found" );
vlc_object_release( p_input_thread );
return i_ret;
}
......@@ -577,17 +586,16 @@ void libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track,
var_Change( p_input_thread, "video-es", VLC_VAR_GETCHOICES, &val_list, NULL );
for( i = 0; i < val_list.p_list->i_count; i++ )
{
vlc_value_t val = val_list.p_list->p_values[i];
if( i_track == val.i_int )
if( i_track == val_list.p_list->p_values[i].i_int )
{
i_ret = var_Set( p_input_thread, "video-es", val );
i_ret = var_SetInteger( p_input_thread, "video-es", i_track );
if( i_ret < 0 )
libvlc_exception_raise( p_e, "Setting video track failed" );
break;
goto end;
}
}