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

LibVLC media player: remove exceptions

parent 8d875234
...@@ -720,7 +720,7 @@ VLC_PUBLIC_API void libvlc_toggle_teletext( libvlc_media_player_t *, libvlc_exce ...@@ -720,7 +720,7 @@ VLC_PUBLIC_API void libvlc_toggle_teletext( libvlc_media_player_t *, libvlc_exce
* \param p_mi media player * \param p_mi media player
* \return the number of available video tracks (int) * \return the number of available video tracks (int)
*/ */
VLC_PUBLIC_API int libvlc_video_get_track_count( libvlc_media_player_t *, libvlc_exceptio_t * ); VLC_PUBLIC_API int libvlc_video_get_track_count( libvlc_media_player_t *, libvlc_exception_t * );
/** /**
* Get the description of available video tracks. * Get the description of available video tracks.
...@@ -730,7 +730,7 @@ VLC_PUBLIC_API int libvlc_video_get_track_count( libvlc_media_player_t *, libvlc ...@@ -730,7 +730,7 @@ VLC_PUBLIC_API int libvlc_video_get_track_count( libvlc_media_player_t *, libvlc
* \return list with description of available video tracks, or NULL on error * \return list with description of available video tracks, or NULL on error
*/ */
VLC_PUBLIC_API libvlc_track_description_t * VLC_PUBLIC_API libvlc_track_description_t *
libvlc_video_get_track_description( libvlc_media_player_t * ); libvlc_video_get_track_description( libvlc_media_player_t *, libvlc_exception_t * );
/** /**
* Get current video track. * Get current video track.
......
...@@ -367,7 +367,7 @@ void libvlc_audio_set_volume( libvlc_instance_t *p_instance, int i_volume, ...@@ -367,7 +367,7 @@ void libvlc_audio_set_volume( libvlc_instance_t *p_instance, int i_volume,
int libvlc_audio_get_track_count( libvlc_media_player_t *p_mi, int libvlc_audio_get_track_count( libvlc_media_player_t *p_mi,
libvlc_exception_t *p_e ) libvlc_exception_t *p_e )
{ {
input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e ); input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi );
int i_track_count; int i_track_count;
if( !p_input_thread ) if( !p_input_thread )
...@@ -386,7 +386,7 @@ libvlc_track_description_t * ...@@ -386,7 +386,7 @@ libvlc_track_description_t *
libvlc_audio_get_track_description( libvlc_media_player_t *p_mi, libvlc_audio_get_track_description( libvlc_media_player_t *p_mi,
libvlc_exception_t *p_e ) libvlc_exception_t *p_e )
{ {
return libvlc_get_track_description( p_mi, "audio-es", p_e); return libvlc_get_track_description( p_mi, "audio-es" );
} }
/***************************************************************************** /*****************************************************************************
...@@ -395,7 +395,7 @@ libvlc_track_description_t * ...@@ -395,7 +395,7 @@ libvlc_track_description_t *
int libvlc_audio_get_track( libvlc_media_player_t *p_mi, int libvlc_audio_get_track( libvlc_media_player_t *p_mi,
libvlc_exception_t *p_e ) libvlc_exception_t *p_e )
{ {
input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e ); input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi );
vlc_value_t val_list; vlc_value_t val_list;
vlc_value_t val; vlc_value_t val;
int i_track = -1; int i_track = -1;
...@@ -432,7 +432,7 @@ int libvlc_audio_get_track( libvlc_media_player_t *p_mi, ...@@ -432,7 +432,7 @@ int libvlc_audio_get_track( libvlc_media_player_t *p_mi,
void libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track, void libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track,
libvlc_exception_t *p_e ) libvlc_exception_t *p_e )
{ {
input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e ); input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi );
vlc_value_t val_list; vlc_value_t val_list;
vlc_value_t newval; vlc_value_t newval;
int i_ret = -1; int i_ret = -1;
......
...@@ -587,7 +587,7 @@ void libvlc_media_list_player_play(libvlc_media_list_player_t * p_mlp, libvlc_ex ...@@ -587,7 +587,7 @@ void libvlc_media_list_player_play(libvlc_media_list_player_t * p_mlp, libvlc_ex
unlock(p_mlp); unlock(p_mlp);
return; /* Will set to play */ return; /* Will set to play */
} }
libvlc_media_player_play(p_mlp->p_mi, p_e); libvlc_media_player_play(p_mlp->p_mi);
unlock(p_mlp); unlock(p_mlp);
} }
...@@ -603,7 +603,7 @@ void libvlc_media_list_player_pause(libvlc_media_list_player_t * p_mlp, libvlc_e ...@@ -603,7 +603,7 @@ void libvlc_media_list_player_pause(libvlc_media_list_player_t * p_mlp, libvlc_e
unlock(p_mlp); unlock(p_mlp);
return; return;
} }
libvlc_media_player_pause(p_mlp->p_mi, p_e); libvlc_media_player_pause(p_mlp->p_mi);
unlock(p_mlp); unlock(p_mlp);
} }
...@@ -636,7 +636,7 @@ void libvlc_media_list_player_play_item_at_index(libvlc_media_list_player_t * p_ ...@@ -636,7 +636,7 @@ void libvlc_media_list_player_play_item_at_index(libvlc_media_list_player_t * p_
{ {
lock(p_mlp); lock(p_mlp);
set_current_playing_item(p_mlp, libvlc_media_list_path_with_root_index(i_index)); set_current_playing_item(p_mlp, libvlc_media_list_path_with_root_index(i_index));
libvlc_media_player_play(p_mlp->p_mi, p_e); libvlc_media_player_play(p_mlp->p_mi);
unlock(p_mlp); unlock(p_mlp);
/* Send the next item event */ /* Send the next item event */
...@@ -661,7 +661,7 @@ void libvlc_media_list_player_play_item(libvlc_media_list_player_t * p_mlp, libv ...@@ -661,7 +661,7 @@ void libvlc_media_list_player_play_item(libvlc_media_list_player_t * p_mlp, libv
} }
set_current_playing_item(p_mlp, path); set_current_playing_item(p_mlp, path);
libvlc_media_player_play(p_mlp->p_mi, p_e); libvlc_media_player_play(p_mlp->p_mi);
unlock(p_mlp); unlock(p_mlp);
} }
...@@ -762,7 +762,7 @@ static void set_relative_playlist_position_and_play( ...@@ -762,7 +762,7 @@ static void set_relative_playlist_position_and_play(
return; return;
} }
libvlc_media_player_play(p_mlp->p_mi, p_e); libvlc_media_player_play(p_mlp->p_mi);
libvlc_media_list_unlock(p_mlp->p_mlist); libvlc_media_list_unlock(p_mlp->p_mlist);
......
...@@ -122,24 +122,16 @@ static void release_input_thread( libvlc_media_player_t *p_mi, bool b_input_abor ...@@ -122,24 +122,16 @@ static void release_input_thread( libvlc_media_player_t *p_mi, bool b_input_abor
* *
* Function will lock the object. * Function will lock the object.
*/ */
input_thread_t *libvlc_get_input_thread( libvlc_media_player_t *p_mi, input_thread_t *libvlc_get_input_thread( libvlc_media_player_t *p_mi )
libvlc_exception_t *p_e )
{ {
input_thread_t *p_input_thread; input_thread_t *p_input_thread;
if( !p_mi ) RAISENULL( "Media Instance is NULL" ); assert( p_mi );
lock(p_mi); lock(p_mi);
if( !p_mi->p_input_thread )
{
unlock(p_mi);
RAISENULL( "Input is NULL" );
}
p_input_thread = p_mi->p_input_thread; p_input_thread = p_mi->p_input_thread;
if( p_input_thread )
vlc_object_hold( p_input_thread ); vlc_object_hold( p_input_thread );
unlock(p_mi); unlock(p_mi);
return p_input_thread; return p_input_thread;
...@@ -572,7 +564,7 @@ int libvlc_media_player_play( libvlc_media_player_t *p_mi ) ...@@ -572,7 +564,7 @@ int libvlc_media_player_play( libvlc_media_player_t *p_mi )
{ {
input_thread_t * p_input_thread; input_thread_t * p_input_thread;
if( (p_input_thread = libvlc_get_input_thread( p_mi, NULL )) ) if( (p_input_thread = libvlc_get_input_thread( p_mi )) )
{ {
/* A thread already exists, send it a play message */ /* A thread already exists, send it a play message */
input_Control( p_input_thread, INPUT_SET_STATE, PLAYING_S ); input_Control( p_input_thread, INPUT_SET_STATE, PLAYING_S );
...@@ -622,7 +614,7 @@ int libvlc_media_player_play( libvlc_media_player_t *p_mi ) ...@@ -622,7 +614,7 @@ int libvlc_media_player_play( libvlc_media_player_t *p_mi )
**************************************************************************/ **************************************************************************/
void libvlc_media_player_pause( libvlc_media_player_t *p_mi ) void libvlc_media_player_pause( libvlc_media_player_t *p_mi )
{ {
input_thread_t * p_input_thread = libvlc_get_input_thread( p_mi, NULL ); input_thread_t * p_input_thread = libvlc_get_input_thread( p_mi );
if( !p_input_thread ) if( !p_input_thread )
return; return;
...@@ -782,7 +774,7 @@ libvlc_time_t libvlc_media_player_get_length( ...@@ -782,7 +774,7 @@ libvlc_time_t libvlc_media_player_get_length(
input_thread_t *p_input_thread; input_thread_t *p_input_thread;
libvlc_time_t i_time; libvlc_time_t i_time;
p_input_thread = libvlc_get_input_thread ( p_mi, NULL ); p_input_thread = libvlc_get_input_thread ( p_mi );
if( !p_input_thread ) if( !p_input_thread )
return -1; return -1;
...@@ -797,7 +789,7 @@ libvlc_time_t libvlc_media_player_get_time( libvlc_media_player_t *p_mi ) ...@@ -797,7 +789,7 @@ libvlc_time_t libvlc_media_player_get_time( libvlc_media_player_t *p_mi )
input_thread_t *p_input_thread; input_thread_t *p_input_thread;
libvlc_time_t i_time; libvlc_time_t i_time;
p_input_thread = libvlc_get_input_thread ( p_mi, NULL ); p_input_thread = libvlc_get_input_thread ( p_mi );
if( !p_input_thread ) if( !p_input_thread )
return -1; return -1;
...@@ -811,7 +803,7 @@ void libvlc_media_player_set_time( libvlc_media_player_t *p_mi, ...@@ -811,7 +803,7 @@ void libvlc_media_player_set_time( libvlc_media_player_t *p_mi,
{ {
input_thread_t *p_input_thread; input_thread_t *p_input_thread;
p_input_thread = libvlc_get_input_thread ( p_mi, NULL ); p_input_thread = libvlc_get_input_thread ( p_mi );
if( !p_input_thread ) if( !p_input_thread )
return; return;
...@@ -824,7 +816,7 @@ void libvlc_media_player_set_position( libvlc_media_player_t *p_mi, ...@@ -824,7 +816,7 @@ void libvlc_media_player_set_position( libvlc_media_player_t *p_mi,
{ {
input_thread_t *p_input_thread; input_thread_t *p_input_thread;
p_input_thread = libvlc_get_input_thread ( p_mi, NULL ); p_input_thread = libvlc_get_input_thread ( p_mi );
if( !p_input_thread ) if( !p_input_thread )
return; return;
...@@ -837,7 +829,7 @@ float libvlc_media_player_get_position( libvlc_media_player_t *p_mi ) ...@@ -837,7 +829,7 @@ float libvlc_media_player_get_position( libvlc_media_player_t *p_mi )
input_thread_t *p_input_thread; input_thread_t *p_input_thread;
float f_position; float f_position;
p_input_thread = libvlc_get_input_thread ( p_mi, NULL ); p_input_thread = libvlc_get_input_thread ( p_mi );
if( !p_input_thread ) if( !p_input_thread )
return -1.0; return -1.0;
...@@ -852,7 +844,7 @@ void libvlc_media_player_set_chapter( libvlc_media_player_t *p_mi, ...@@ -852,7 +844,7 @@ void libvlc_media_player_set_chapter( libvlc_media_player_t *p_mi,
{ {
input_thread_t *p_input_thread; input_thread_t *p_input_thread;
p_input_thread = libvlc_get_input_thread ( p_mi, NULL ); p_input_thread = libvlc_get_input_thread ( p_mi );
if( !p_input_thread ) if( !p_input_thread )
return; return;
...@@ -865,7 +857,7 @@ int libvlc_media_player_get_chapter( libvlc_media_player_t *p_mi ) ...@@ -865,7 +857,7 @@ int libvlc_media_player_get_chapter( libvlc_media_player_t *p_mi )
input_thread_t *p_input_thread; input_thread_t *p_input_thread;
int i_chapter; int i_chapter;
p_input_thread = libvlc_get_input_thread ( p_mi, NULL ); p_input_thread = libvlc_get_input_thread ( p_mi );
if( !p_input_thread ) if( !p_input_thread )
return -1; return -1;
...@@ -880,7 +872,7 @@ int libvlc_media_player_get_chapter_count( libvlc_media_player_t *p_mi ) ...@@ -880,7 +872,7 @@ int libvlc_media_player_get_chapter_count( libvlc_media_player_t *p_mi )
input_thread_t *p_input_thread; input_thread_t *p_input_thread;
vlc_value_t val; vlc_value_t val;
p_input_thread = libvlc_get_input_thread ( p_mi, NULL ); p_input_thread = libvlc_get_input_thread ( p_mi );
if( !p_input_thread ) if( !p_input_thread )
return -1; return -1;
...@@ -897,7 +889,7 @@ int libvlc_media_player_get_chapter_count_for_title( ...@@ -897,7 +889,7 @@ int libvlc_media_player_get_chapter_count_for_title(
input_thread_t *p_input_thread; input_thread_t *p_input_thread;
vlc_value_t val; vlc_value_t val;
p_input_thread = libvlc_get_input_thread ( p_mi, NULL ); p_input_thread = libvlc_get_input_thread ( p_mi );
if( !p_input_thread ) if( !p_input_thread )
return -1; return -1;
...@@ -919,7 +911,7 @@ void libvlc_media_player_set_title( libvlc_media_player_t *p_mi, ...@@ -919,7 +911,7 @@ void libvlc_media_player_set_title( libvlc_media_player_t *p_mi,
{ {
input_thread_t *p_input_thread; input_thread_t *p_input_thread;
p_input_thread = libvlc_get_input_thread ( p_mi, NULL ); p_input_thread = libvlc_get_input_thread ( p_mi );
if( !p_input_thread ) if( !p_input_thread )
return; return;
...@@ -938,7 +930,7 @@ int libvlc_media_player_get_title( libvlc_media_player_t *p_mi ) ...@@ -938,7 +930,7 @@ int libvlc_media_player_get_title( libvlc_media_player_t *p_mi )
input_thread_t *p_input_thread; input_thread_t *p_input_thread;
int i_title; int i_title;
p_input_thread = libvlc_get_input_thread ( p_mi, NULL ); p_input_thread = libvlc_get_input_thread ( p_mi );
if( !p_input_thread ) if( !p_input_thread )
return -1; return -1;
...@@ -953,7 +945,7 @@ int libvlc_media_player_get_title_count( libvlc_media_player_t *p_mi ) ...@@ -953,7 +945,7 @@ int libvlc_media_player_get_title_count( libvlc_media_player_t *p_mi )
input_thread_t *p_input_thread; input_thread_t *p_input_thread;
vlc_value_t val; vlc_value_t val;
p_input_thread = libvlc_get_input_thread ( p_mi, NULL ); p_input_thread = libvlc_get_input_thread ( p_mi );
if( !p_input_thread ) if( !p_input_thread )
return -1; return -1;
...@@ -967,7 +959,7 @@ void libvlc_media_player_next_chapter( libvlc_media_player_t *p_mi ) ...@@ -967,7 +959,7 @@ void libvlc_media_player_next_chapter( libvlc_media_player_t *p_mi )
{ {
input_thread_t *p_input_thread; input_thread_t *p_input_thread;
p_input_thread = libvlc_get_input_thread ( p_mi, NULL ); p_input_thread = libvlc_get_input_thread ( p_mi );
if( !p_input_thread ) if( !p_input_thread )
return; return;
...@@ -982,7 +974,7 @@ void libvlc_media_player_previous_chapter( libvlc_media_player_t *p_mi ) ...@@ -982,7 +974,7 @@ void libvlc_media_player_previous_chapter( libvlc_media_player_t *p_mi )
{ {
input_thread_t *p_input_thread; input_thread_t *p_input_thread;
p_input_thread = libvlc_get_input_thread ( p_mi, NULL ); p_input_thread = libvlc_get_input_thread ( p_mi );
if( !p_input_thread ) if( !p_input_thread )
return; return;
...@@ -995,7 +987,7 @@ void libvlc_media_player_previous_chapter( libvlc_media_player_t *p_mi ) ...@@ -995,7 +987,7 @@ void libvlc_media_player_previous_chapter( libvlc_media_player_t *p_mi )
float libvlc_media_player_get_fps( libvlc_media_player_t *p_mi ) float libvlc_media_player_get_fps( libvlc_media_player_t *p_mi )
{ {
input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi, NULL ); input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi );
double f_fps = 0.0; double f_fps = 0.0;
if( p_input_thread ) if( p_input_thread )
...@@ -1011,7 +1003,7 @@ int libvlc_media_player_will_play( libvlc_media_player_t *p_mi ) ...@@ -1011,7 +1003,7 @@ int libvlc_media_player_will_play( libvlc_media_player_t *p_mi )
{ {
bool b_will_play; bool b_will_play;
input_thread_t *p_input_thread = input_thread_t *p_input_thread =
libvlc_get_input_thread ( p_mi, NULL ); libvlc_get_input_thread ( p_mi );
if ( !p_input_thread ) if ( !p_input_thread )
return false; return false;
...@@ -1026,7 +1018,7 @@ int libvlc_media_player_set_rate( libvlc_media_player_t *p_mi, float rate ) ...@@ -1026,7 +1018,7 @@ int libvlc_media_player_set_rate( libvlc_media_player_t *p_mi, float rate )
input_thread_t *p_input_thread; input_thread_t *p_input_thread;
bool b_can_rewind; bool b_can_rewind;
p_input_thread = libvlc_get_input_thread ( p_mi, NULL ); p_input_thread = libvlc_get_input_thread ( p_mi );
if( !p_input_thread ) if( !p_input_thread )
return -1; return -1;
...@@ -1049,7 +1041,7 @@ float libvlc_media_player_get_rate( libvlc_media_player_t *p_mi ) ...@@ -1049,7 +1041,7 @@ float libvlc_media_player_get_rate( libvlc_media_player_t *p_mi )
float f_rate; float f_rate;
bool b_can_rewind; bool b_can_rewind;
p_input_thread = libvlc_get_input_thread ( p_mi, NULL ); p_input_thread = libvlc_get_input_thread ( p_mi );
if( !p_input_thread ) if( !p_input_thread )
return 0.0; /* rate < 0 indicates rewind */ return 0.0; /* rate < 0 indicates rewind */
...@@ -1079,7 +1071,7 @@ int libvlc_media_player_is_seekable( libvlc_media_player_t *p_mi ) ...@@ -1079,7 +1071,7 @@ int libvlc_media_player_is_seekable( libvlc_media_player_t *p_mi )
input_thread_t *p_input_thread; input_thread_t *p_input_thread;
bool b_seekable; bool b_seekable;
p_input_thread = libvlc_get_input_thread ( p_mi, NULL ); p_input_thread = libvlc_get_input_thread ( p_mi );
if ( !p_input_thread ) if ( !p_input_thread )
return false; return false;
b_seekable = var_GetBool( p_input_thread, "can-seek" ); b_seekable = var_GetBool( p_input_thread, "can-seek" );
...@@ -1093,7 +1085,7 @@ libvlc_track_description_t * ...@@ -1093,7 +1085,7 @@ libvlc_track_description_t *
libvlc_get_track_description( libvlc_media_player_t *p_mi, libvlc_get_track_description( libvlc_media_player_t *p_mi,
const char *psz_variable ) const char *psz_variable )
{ {
input_thread_t *p_input = libvlc_get_input_thread( p_mi, NULL ); input_thread_t *p_input = libvlc_get_input_thread( p_mi );
libvlc_track_description_t *p_track_description = NULL, libvlc_track_description_t *p_track_description = NULL,
*p_actual, *p_previous; *p_actual, *p_previous;
...@@ -1125,7 +1117,6 @@ libvlc_track_description_t * ...@@ -1125,7 +1117,6 @@ libvlc_track_description_t *
if ( !p_actual ) if ( !p_actual )
{ {
libvlc_track_description_release( p_track_description ); libvlc_track_description_release( p_track_description );
libvlc_exception_raise( p_e );
libvlc_printerr( "Not enough memory" ); libvlc_printerr( "Not enough memory" );
goto end; goto end;
} }
...@@ -1165,7 +1156,7 @@ int libvlc_media_player_can_pause( libvlc_media_player_t *p_mi ) ...@@ -1165,7 +1156,7 @@ int libvlc_media_player_can_pause( libvlc_media_player_t *p_mi )
input_thread_t *p_input_thread; input_thread_t *p_input_thread;
bool b_can_pause; bool b_can_pause;
p_input_thread = libvlc_get_input_thread ( p_mi, NULL ); p_input_thread = libvlc_get_input_thread ( p_mi );
if ( !p_input_thread ) if ( !p_input_thread )
return false; return false;
b_can_pause = var_GetBool( p_input_thread, "can-pause" ); b_can_pause = var_GetBool( p_input_thread, "can-pause" );
...@@ -1176,7 +1167,7 @@ int libvlc_media_player_can_pause( libvlc_media_player_t *p_mi ) ...@@ -1176,7 +1167,7 @@ int libvlc_media_player_can_pause( libvlc_media_player_t *p_mi )
void libvlc_media_player_next_frame( libvlc_media_player_t *p_mi ) void libvlc_media_player_next_frame( libvlc_media_player_t *p_mi )
{ {
input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi, NULL ); input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi );
if( p_input_thread != NULL ) if( p_input_thread != NULL )
{ {
var_TriggerCallback( p_input_thread, "frame-next" ); var_TriggerCallback( p_input_thread, "frame-next" );
......
...@@ -49,12 +49,11 @@ struct libvlc_media_player_t ...@@ -49,12 +49,11 @@ struct libvlc_media_player_t
}; };
/* Media player - audio, video */ /* Media player - audio, video */
input_thread_t *libvlc_get_input_thread(libvlc_media_player_t *, libvlc_exception_t * ); input_thread_t *libvlc_get_input_thread(libvlc_media_player_t * );
libvlc_track_description_t * libvlc_get_track_description( libvlc_track_description_t * libvlc_get_track_description(
libvlc_media_player_t *p_mi, libvlc_media_player_t *p_mi,
const char *psz_variable, const char *psz_variable );
libvlc_exception_t *p_e );
#endif #endif
...@@ -60,7 +60,7 @@ mediacontrol_snapshot( mediacontrol_Instance *self, ...@@ -60,7 +60,7 @@ mediacontrol_snapshot( mediacontrol_Instance *self,
libvlc_exception_init( &ex ); libvlc_exception_init( &ex );
mediacontrol_exception_init( exception ); mediacontrol_exception_init( exception );
p_input = libvlc_get_input_thread( self->p_media_player, &ex ); p_input = libvlc_get_input_thread( self->p_media_player );
if( ! p_input ) if( ! p_input )
{ {
RAISE_NULL( mediacontrol_InternalException, "No input" ); RAISE_NULL( mediacontrol_InternalException, "No input" );
...@@ -140,7 +140,7 @@ mediacontrol_display_text( mediacontrol_Instance *self, ...@@ -140,7 +140,7 @@ mediacontrol_display_text( mediacontrol_Instance *self,
RAISE_VOID( mediacontrol_InternalException, "Empty text" ); RAISE_VOID( mediacontrol_InternalException, "Empty text" );
} }
p_input = libvlc_get_input_thread( self->p_media_player, &ex ); p_input = libvlc_get_input_thread( self->p_media_player );
if( ! p_input ) if( ! p_input )
{ {
RAISE_VOID( mediacontrol_InternalException, "No input" ); RAISE_VOID( mediacontrol_InternalException, "No input" );
...@@ -240,16 +240,12 @@ int ...@@ -240,16 +240,12 @@ int
mediacontrol_get_rate( mediacontrol_Instance *self, mediacontrol_get_rate( mediacontrol_Instance *self,
mediacontrol_Exception *exception ) mediacontrol_Exception *exception )
{ {
libvlc_exception_t ex;
int i_ret; int i_ret;
mediacontrol_exception_init( exception ); mediacontrol_exception_init( exception );
libvlc_exception_init( &ex ); i_ret = libvlc_media_player_get_rate( self->p_media_player );
i_ret = libvlc_media_player_get_rate( self->p_media_player, &ex );
HANDLE_LIBVLC_EXCEPTION_ZERO( &ex );
return i_ret / 10; return (i_ret >= 0) ? (i_ret / 10) : -1;
} }
void void
...@@ -257,13 +253,9 @@ mediacontrol_set_rate( mediacontrol_Instance *self, ...@@ -257,13 +253,9 @@ mediacontrol_set_rate( mediacontrol_Instance *self,
const int rate, const int rate,
mediacontrol_Exception *exception ) mediacontrol_Exception *exception )
{ {
libvlc_exception_t ex;
mediacontrol_exception_init( exception ); mediacontrol_exception_init( exception );
libvlc_exception_init( &ex );
libvlc_media_player_set_rate( self->p_media_player, rate * 10, &ex ); libvlc_media_player_set_rate( self->p_media_player, rate * 10 );
HANDLE_LIBVLC_EXCEPTION_VOID( &ex );
} }
int int
......
...@@ -114,11 +114,9 @@ mediacontrol_get_media_position( mediacontrol_Instance *self, ...@@ -114,11 +114,9 @@ mediacontrol_get_media_position( mediacontrol_Instance *self,
mediacontrol_Exception *exception ) mediacontrol_Exception *exception )
{ {
mediacontrol_Position* retval = NULL; mediacontrol_Position* retval = NULL;
libvlc_exception_t ex;
int64_t pos; int64_t pos;
mediacontrol_exception_init( exception ); mediacontrol_exception_init( exception );
libvlc_exception_init( &ex );
retval = ( mediacontrol_Position* )malloc( sizeof( mediacontrol_Position ) ); retval = ( mediacontrol_Position* )malloc( sizeof( mediacontrol_Position ) );
retval->origin = an_origin; retval->origin = an_origin;
...@@ -133,7 +131,7 @@ mediacontrol_get_media_position( mediacontrol_Instance *self, ...@@ -133,7 +131,7 @@ mediacontrol_get_media_position( mediacontrol_Instance *self,
} }
/* We are asked for an AbsolutePosition. */ /* We are asked for an AbsolutePosition. */
pos = libvlc_media_player_get_time( self->p_media_player, &ex ); pos = libvlc_media_player_get_time( self->p_media_player );
if( a_key == mediacontrol_MediaTime ) if( a_key == mediacontrol_MediaTime )
{ {
...@@ -155,15 +153,12 @@ mediacontrol_set_media_position( mediacontrol_Instance *self, ...@@ -155,15 +153,12 @@ mediacontrol_set_media_position( mediacontrol_Instance *self,
const mediacontrol_Position * a_position, const mediacontrol_Position * a_position,
mediacontrol_Exception *exception ) mediacontrol_Exception *exception )
{ {
libvlc_exception_t ex;
int64_t i_pos; int64_t i_pos;
libvlc_exception_init( &ex );
mediacontrol_exception_init( exception ); mediacontrol_exception_init( exception );
i_pos = private_mediacontrol_position2microsecond( self->p_media_player, a_position ); i_pos = private_mediacontrol_position2microsecond( self->p_media_player, a_position );
libvlc_media_player_set_time( self->p_media_player, i_pos / 1000, &ex ); libvlc_media_player_set_time( self->p_media_player, i_pos / 1000 );
HANDLE_LIBVLC_EXCEPTION_VOID( &ex );
} }
/* Starts playing a stream */ /* Starts playing a stream */
...@@ -221,8 +216,7 @@ mediacontrol_start( mediacontrol_Instance *self, ...@@ -221,8 +216,7 @@ mediacontrol_start( mediacontrol_Instance *self,
libvlc_media_player_set_media( self->p_media_player, p_media ); libvlc_media_player_set_media( self->p_media_player, p_media );
libvlc_media_player_play( self->p_media_player, &ex ); libvlc_media_player_play( self->p_media_player );
HANDLE_LIBVLC_EXCEPTION_VOID( &ex );
} }
} }
...@@ -230,34 +224,23 @@ void ...@@ -230,34 +224,23 @@ void
mediacontrol_pause( mediacontrol_Instance *self, mediacontrol_pause( mediacontrol_Instance *self,
mediacontrol_Exception *exception ) mediacontrol_Exception *exception )
{ {
libvlc_exception_t ex;
mediacontrol_exception_init( exception ); mediacontrol_exception_init( exception );
libvlc_exception_init( &ex ); libvlc_media_player_pause( self->p_media_player );
libvlc_media_player_pause( self->p_media_player, &ex );
HANDLE_LIBVLC_EXCEPTION_VOID( &ex );
} }
void void
mediacontrol_resume( mediacontrol_Instance *self, mediacontrol_resume( mediacontrol_Instance *self,
mediacontrol_Exception *exception ) mediacontrol_Exception *exception )
{ {
libvlc_exception_t ex;
mediacontrol_exception_init( exception ); mediacontrol_exception_init( exception );
libvlc_exception_init( &ex ); libvlc_media_player_pause( self->p_media_player );
libvlc_media_player_pause( self->p_media_player, &ex );
HANDLE_LIBVLC_EXCEPTION_VOID( &ex );
} }
void void
mediacontrol_stop( mediacontrol_Instance *self, mediacontrol_stop( mediacontrol_Instance *self,
mediacontrol_Exception *exception ) mediacontrol_Exception *exception )
{ {
libvlc_exception_t ex;
mediacontrol_exception_init( exception ); mediacontrol_exception_init( exception );
libvlc_exception_init( &ex );
libvlc_media_player_stop( self->p_media_player ); libvlc_media_player_stop( self->p_media_player );
} }
...@@ -379,20 +362,8 @@ mediacontrol_get_stream_information( mediacontrol_Instance *self, ...@@ -379,20 +362,8 @@ mediacontrol_get_stream_information( mediacontrol_Instance *self,
retval->url = libvlc_media_get_mrl( p_media ); retval->url = libvlc_media_get_mrl( p_media );
retval->position = libvlc_media_player_get_time( self->p_media_player, &ex ); retval->position = libvlc_media_player_get_time( self->p_media_player );
if( libvlc_exception_raised( &ex ) ) retval->length = libvlc_media_player_get_length( self->p_media_player );
{
libvlc_exception_clear( &ex );
retval->position = 0;
}
retval->length = libvlc_media_player_get_length( self->p_media_player, &ex );
if( libvlc_exception_raised( &ex ) )
{
libvlc_exception_clear( &ex );
retval->length = 0;
}
} }
return retval; return retval;
} }
...@@ -66,10 +66,8 @@ libvlc_time_t private_mediacontrol_unit_convert( libvlc_media_player_t *p_media_ ...@@ -66,10 +66,8 @@ libvlc_time_t private_mediacontrol_unit_convert( libvlc_media_player_t *p_media_
if( to == mediacontrol_SampleCount ) if( to == mediacontrol_SampleCount )
{ {
double f_fps; double f_fps;
libvlc_exception_t ex;
libvlc_exception_init( &ex );
f_fps = libvlc_media_player_get_rate( p_media_player, &ex ); f_fps = libvlc_media_player_get_rate( p_media_player );
if( f_fps < 0 ) if( f_fps < 0 )
return 0; return 0;
else else
...@@ -82,10 +80,8 @@ libvlc_time_t private_mediacontrol_unit_convert( libvlc_media_player_t *p_media_ ...@@ -82,10 +80,8 @@ libvlc_time_t private_mediacontrol_unit_convert( libvlc_media_player_t *p_media_
case mediacontrol_SampleCount: case mediacontrol_SampleCount:
{ {
double f_fps; double f_fps;
libvlc_exception_t ex;
libvlc_exception_init( &ex );
f_fps = libvlc_media_player_get_rate( p_media_player, &ex ); f_fps = libvlc_media_player_get_rate( p_media_player );
if( f_fps < 0 ) if( f_fps < 0 )
return 0; return 0;
...@@ -129,10 +125,8 @@ private_mediacontrol_position2microsecond( libvlc_media_player_t * p_media_playe ...@@ -129,10 +125,8 @@ private_mediacontrol_position2microsecond( libvlc_media_player_t * p_media_playe
{ {
libvlc_time_t l_time = 0; libvlc_time_t l_time = 0;
libvlc_time_t l_pos = 0; libvlc_time_t l_pos = 0;
libvlc_exception_t ex;
libvlc_exception_init( &ex );
l_time = libvlc_media_player_get_time( p_media_player, &ex ); l_time = libvlc_media_player_get_time( p_media_player );
/* Ignore exception, we will assume a 0 time value */ /* Ignore exception, we will assume a 0 time value */
l_pos = private_mediacontrol_unit_convert( p_media_player, l_pos = private_mediacontrol_unit_convert( p_media_player,
...@@ -147,14 +141,12 @@ private_mediacontrol_position2microsecond( libvlc_media_player_t * p_media_playe ...@@ -147,14 +141,12 @@ private_mediacontrol_position2microsecond( libvlc_media_player_t * p_media_playe
libvlc_time_t l_time = 0; libvlc_time_t l_time = 0;
libvlc_time_t l_length = 0; libvlc_time_t l_length = 0;
libvlc_time_t l_pos = 0; libvlc_time_t l_pos = 0;
libvlc_exception_t ex;
libvlc_exception_init( &ex );
l_length = libvlc_media_player_get_length( p_media_player, &ex ); l_length = libvlc_media_player_get_length( p_media_player );
if( l_length <= 0 ) if( l_length <= 0 )
return 0; return 0;
l_time = libvlc_media_player_get_time( p_media_player, &ex ); l_time = libvlc_media_player_get_time( p_media_player );
/* Ignore exception, we will assume a 0 time value */ /* Ignore exception, we will assume a 0 time value */
l_pos = private_mediacontrol_unit_convert( p_media_player, l_pos = private_mediacontrol_unit_convert( p_media_player,
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
static vout_thread_t *GetVout( libvlc_media_player_t *p_mi, static vout_thread_t *GetVout( libvlc_media_player_t *p_mi,
libvlc_exception_t *p_exception ) libvlc_exception_t *p_exception )
{ {
input_thread_t *p_input = libvlc_get_input_thread( p_mi, p_exception ); input_thread_t *p_input = libvlc_get_input_thread( p_mi );
vout_thread_t *p_vout = NULL; vout_thread_t *p_vout = NULL;
if( p_input ) if( p_input )
...@@ -60,6 +60,11 @@ static vout_thread_t *GetVout( libvlc_media_player_t *p_mi, ...@@ -60,6 +60,11 @@ static vout_thread_t *GetVout( libvlc_media_player_t *p_mi,
} }
vlc_object_release( p_input ); vlc_object_release( p_input );
} }
else
{
libvlc_exception_raise( p_exception );
libvlc_printerr( "No active input" );
}
return p_vout; return p_vout;
} }
...@@ -185,7 +190,7 @@ int libvlc_video_get_width( libvlc_media_player_t *p_mi, ...@@ -185,7 +190,7 @@ int libvlc_video_get_width( libvlc_media_player_t *p_mi,
int libvlc_media_player_has_vout( libvlc_media_player_t *p_mi, int libvlc_media_player_has_vout( libvlc_media_player_t *p_mi,
libvlc_exception_t *p_e ) libvlc_exception_t *p_e )
{ {
input_thread_t *p_input_thread = libvlc_get_input_thread(p_mi, p_e); input_thread_t *p_input_thread = libvlc_get_input_thread(p_mi);
bool has_vout = false; bool has_vout = false;
if( p_input_thread ) if( p_input_thread )
...@@ -263,14 +268,19 @@ void libvlc_video_set_aspect_ratio( libvlc_media_player_t *p_mi, ...@@ -263,14 +268,19 @@ void libvlc_video_set_aspect_ratio( libvlc_media_player_t *p_mi,
int libvlc_video_get_spu( libvlc_media_player_t *p_mi, int libvlc_video_get_spu( libvlc_media_player_t *p_mi,
libvlc_exception_t *p_e ) libvlc_exception_t *p_e )
{ {
input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e ); input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi );
vlc_value_t val_list; vlc_value_t val_list;
vlc_value_t val; vlc_value_t val;
int i_spu = -1; int i_spu = -1;
int i_ret = -1; int i_ret = -1;
int i; int i;
if( !p_input_thread ) return -1; if( !p_input_thread )
{
libvlc_exception_raise( p_e );
libvlc_printerr( "No active input" );
return -1;
}
i_ret = var_Get( p_input_thread, "spu-es", &val ); i_ret = var_Get( p_input_thread, "spu-es", &val );
if( i_ret < 0 ) if( i_ret < 0 )
...@@ -298,11 +308,15 @@ int libvlc_video_get_spu( libvlc_media_player_t *p_mi, ...@@ -298,11 +308,15 @@ int libvlc_video_get_spu( libvlc_media_player_t *p_mi,
int libvlc_video_get_spu_count( libvlc_media_player_t *p_mi, int libvlc_video_get_spu_count( libvlc_media_player_t *p_mi,
libvlc_exception_t *p_e ) libvlc_exception_t *p_e )
{ {
input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e ); input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi );
int i_spu_count; int i_spu_count;
if( !p_input_thread ) if( !p_input_thread )
{
libvlc_exception_raise( p_e );
libvlc_printerr( "No active input" );
return -1; return -1;
}
i_spu_count = var_CountChoices( p_input_thread, "spu-es" ); i_spu_count = var_CountChoices( p_input_thread, "spu-es" );
...@@ -314,18 +328,23 @@ libvlc_track_description_t * ...@@ -314,18 +328,23 @@ libvlc_track_description_t *
libvlc_video_get_spu_description( libvlc_media_player_t *p_mi, libvlc_video_get_spu_description( libvlc_media_player_t *p_mi,
libvlc_exception_t *p_e ) libvlc_exception_t *p_e )
{ {
return libvlc_get_track_description( p_mi, "spu-es", p_e); return libvlc_get_track_description( p_mi, "spu-es" );
} }
void libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu, void libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu,
libvlc_exception_t *p_e ) libvlc_exception_t *p_e )
{ {
input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e ); input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi );
vlc_value_t val_list; vlc_value_t val_list;
vlc_value_t newval; vlc_value_t newval;
int i_ret = -1; int i_ret = -1;
if( !p_input_thread ) return; if( !p_input_thread )
{
libvlc_exception_raise( p_e );
libvlc_printerr( "No active input" );
return;
}
var_Change( p_input_thread, "spu-es", VLC_VAR_GETCHOICES, &val_list, NULL ); var_Change( p_input_thread, "spu-es", VLC_VAR_GETCHOICES, &val_list, NULL );
...@@ -354,7 +373,7 @@ int libvlc_video_set_subtitle_file( libvlc_media_player_t *p_mi, ...@@ -354,7 +373,7 @@ int libvlc_video_set_subtitle_file( libvlc_media_player_t *p_mi,
const char *psz_subtitle, const char *psz_subtitle,
libvlc_exception_t *p_e ) libvlc_exception_t *p_e )
{ {
input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi, p_e ); input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi );
bool b_ret = false; bool b_ret = false;
if( p_input_thread ) if( p_input_thread )
...@@ -370,7 +389,7 @@ libvlc_track_description_t * ...@@ -370,7 +389,7 @@ libvlc_track_description_t *
libvlc_video_get_title_description( libvlc_media_player_t *p_mi, libvlc_video_get_title_description( libvlc_media_player_t *p_mi,
libvlc_exception_t * p_e ) libvlc_exception_t * p_e )
{ {
return libvlc_get_track_description( p_mi, "title", p_e); return libvlc_get_track_description( p_mi, "title" );
} }
libvlc_track_description_t * libvlc_track_description_t *
...@@ -380,7 +399,7 @@ libvlc_track_description_t * ...@@ -380,7 +399,7 @@ libvlc_track_description_t *
{ {
char psz_title[12]; char psz_title[12];
sprintf( psz_title, "title %2i", i_title ); sprintf( psz_title, "title %2i", i_title );
return libvlc_get_track_description( p_mi, psz_title, p_e); return libvlc_get_track_description( p_mi, psz_title );
} }
char *libvlc_video_get_crop_geometry( libvlc_media_player_t *p_mi, char *libvlc_video_get_crop_geometry( libvlc_media_player_t *p_mi,
...@@ -419,7 +438,7 @@ void libvlc_toggle_teletext( libvlc_media_player_t *p_mi, ...@@ -419,7 +438,7 @@ void libvlc_toggle_teletext( libvlc_media_player_t *p_mi,
{ {
input_thread_t *p_input_thread; input_thread_t *p_input_thread;
p_input_thread = libvlc_get_input_thread(p_mi, p_e); p_input_thread = libvlc_get_input_thread(p_mi);
if( !p_input_thread ) return; if( !p_input_thread ) return;
if( var_CountChoices( p_input_thread, "teletext-es" ) <= 0 ) if( var_CountChoices( p_input_thread, "teletext-es" ) <= 0 )
...@@ -449,7 +468,7 @@ void libvlc_toggle_teletext( libvlc_media_player_t *p_mi, ...@@ -449,7 +468,7 @@ void libvlc_toggle_teletext( libvlc_media_player_t *p_mi,
int libvlc_video_get_track_count( libvlc_media_player_t *p_mi, int libvlc_video_get_track_count( libvlc_media_player_t *p_mi,
libvlc_exception_t *p_e ) libvlc_exception_t *p_e )
{ {
input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e ); input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi );
int i_track_count; int i_track_count;
if( !p_input_thread ) if( !p_input_thread )
...@@ -465,13 +484,13 @@ libvlc_track_description_t * ...@@ -465,13 +484,13 @@ libvlc_track_description_t *
libvlc_video_get_track_description( libvlc_media_player_t *p_mi, libvlc_video_get_track_description( libvlc_media_player_t *p_mi,
libvlc_exception_t *p_e ) libvlc_exception_t *p_e )
{ {
return libvlc_get_track_description( p_mi, "video-es", p_e); return libvlc_get_track_description( p_mi, "video-es" );
} }
int libvlc_video_get_track( libvlc_media_player_t *p_mi, int libvlc_video_get_track( libvlc_media_player_t *p_mi,
libvlc_exception_t *p_e ) libvlc_exception_t *p_e )
{ {
input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e ); input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi );
vlc_value_t val_list; vlc_value_t val_list;
vlc_value_t val; vlc_value_t val;
int i_track = -1; int i_track = -1;
...@@ -487,7 +506,7 @@ int libvlc_video_get_track( libvlc_media_player_t *p_mi, ...@@ -487,7 +506,7 @@ int libvlc_video_get_track( libvlc_media_player_t *p_mi,
libvlc_exception_raise( p_e ); libvlc_exception_raise( p_e );
libvlc_printerr( "Video track information not found" ); libvlc_printerr( "Video track information not found" );
vlc_object_release( p_input_thread ); vlc_object_release( p_input_thread );
return i_ret; return -1;
} }
var_Change( p_input_thread, "video-es", VLC_VAR_GETCHOICES, &val_list, NULL ); var_Change( p_input_thread, "video-es", VLC_VAR_GETCHOICES, &val_list, NULL );
...@@ -507,7 +526,7 @@ int libvlc_video_get_track( libvlc_media_player_t *p_mi, ...@@ -507,7 +526,7 @@ int libvlc_video_get_track( libvlc_media_player_t *p_mi,
void libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track, void libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track,
libvlc_exception_t *p_e ) libvlc_exception_t *p_e )
{ {
input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e ); input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi );
vlc_value_t val_list; vlc_value_t val_list;
int i_ret = -1; int i_ret = -1;
int i; int i;
......
...@@ -78,8 +78,8 @@ static void test_events (const char ** argv, int argc) ...@@ -78,8 +78,8 @@ static void test_events (const char ** argv, int argc)
vlc = libvlc_new (argc, argv, &ex); vlc = libvlc_new (argc, argv, &ex);
catch (); catch ();
mi = libvlc_media_player_new (vlc, &ex); mi = libvlc_media_player_new (vlc);
catch (); assert (mi != NULL);
em = libvlc_media_player_event_manager (mi); em = libvlc_media_player_event_manager (mi);
......
...@@ -39,13 +39,12 @@ static void test_media_player_play_stop(const char** argv, int argc) ...@@ -39,13 +39,12 @@ static void test_media_player_play_stop(const char** argv, int argc)
md = libvlc_media_new (vlc, file, &ex); md = libvlc_media_new (vlc, file, &ex);
catch (); catch ();
mi = libvlc_media_player_new_from_media (md, &ex); mi = libvlc_media_player_new_from_media (md);
catch (); assert (mi != NULL);
libvlc_media_release (md); libvlc_media_release (md);
libvlc_media_player_play (mi, &ex); libvlc_media_player_play (mi);
catch ();
/* Wait a correct state */ /* Wait a correct state */
libvlc_state_t state; libvlc_state_t state;
...@@ -78,13 +77,12 @@ static void test_media_player_pause_stop(const char** argv, int argc) ...@@ -78,13 +77,12 @@ static void test_media_player_pause_stop(const char** argv, int argc)
md = libvlc_media_new (vlc, file, &ex); md = libvlc_media_new (vlc, file, &ex);
catch (); catch ();
mi = libvlc_media_player_new_from_media (md, &ex); mi = libvlc_media_player_new_from_media (md);
catch (); assert (mi != NULL);
libvlc_media_release (md); libvlc_media_release (md);
libvlc_media_player_play (mi, &ex); libvlc_media_player_play (mi);
catch ();
log ("Waiting for playing\n"); log ("Waiting for playing\n");
...@@ -102,8 +100,7 @@ static void test_media_player_pause_stop(const char** argv, int argc) ...@@ -102,8 +100,7 @@ static void test_media_player_pause_stop(const char** argv, int argc)
#if 0 #if 0
/* This can't work because under some condition (short file, this is the case) this will be /* This can't work because under some condition (short file, this is the case) this will be
* equivalent to a play() */ * equivalent to a play() */
libvlc_media_player_pause (mi, &ex); libvlc_media_player_pause (mi);
catch();
log ("Waiting for pause\n"); log ("Waiting for pause\n");
......
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