]> git.sesse.net Git - vlc/commitdiff
LibVLC media player: remove exceptions
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 31 Jan 2010 17:52:07 +0000 (19:52 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 31 Jan 2010 17:52:07 +0000 (19:52 +0200)
include/vlc/libvlc_media_player.h
src/control/audio.c
src/control/media_list_player.c
src/control/media_player.c
src/control/media_player_internal.h
src/control/mediacontrol_audio_video.c
src/control/mediacontrol_core.c
src/control/mediacontrol_util.c
src/control/video.c
test/libvlc/events.c
test/libvlc/media_player.c

index 28c4f8854140236fa7069364db7034a721adcd29..70bebdc3e94fb6cb79d18d92f1205cf4d9b33163 100644 (file)
@@ -720,7 +720,7 @@ VLC_PUBLIC_API void libvlc_toggle_teletext( libvlc_media_player_t *, libvlc_exce
  * \param p_mi media player
  * \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.
@@ -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
  */
 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.
index ab90312775fabf724462cb5c28e430c3588154f6..47bfe4c9cc1035765258819956728bc95b996731 100644 (file)
@@ -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,
                                   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;
 
     if( !p_input_thread )
@@ -386,7 +386,7 @@ libvlc_track_description_t *
         libvlc_audio_get_track_description( libvlc_media_player_t *p_mi,
                                             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 *
 int libvlc_audio_get_track( libvlc_media_player_t *p_mi,
                             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;
     int i_track = -1;
@@ -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,
                              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 newval;
     int i_ret = -1;
index dcf38ca1e4f398ab3b2d448aed9f3cb8de73d6f5..c8cf76c8ac868c90217bd2b6c50ab70ae931a0e3 100644 (file)
@@ -587,7 +587,7 @@ void libvlc_media_list_player_play(libvlc_media_list_player_t * p_mlp, libvlc_ex
         unlock(p_mlp);
         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);
 }
 
@@ -603,7 +603,7 @@ void libvlc_media_list_player_pause(libvlc_media_list_player_t * p_mlp, libvlc_e
         unlock(p_mlp);
         return;
     }
-    libvlc_media_player_pause(p_mlp->p_mi, p_e);
+    libvlc_media_player_pause(p_mlp->p_mi);
     unlock(p_mlp);
 }
 
@@ -636,7 +636,7 @@ void libvlc_media_list_player_play_item_at_index(libvlc_media_list_player_t * p_
 {
     lock(p_mlp);
     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);
 
     /* Send the next item event */
@@ -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);
-    libvlc_media_player_play(p_mlp->p_mi, p_e);
+    libvlc_media_player_play(p_mlp->p_mi);
     unlock(p_mlp);
 }
 
@@ -762,7 +762,7 @@ static void set_relative_playlist_position_and_play(
         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);
 
index 98ab5ad1a9499bc3ca45003b46b0e17815f1fb4c..86be29dc93c7a89dcb74c43ba7ac431856d980a2 100644 (file)
@@ -122,24 +122,16 @@ static void release_input_thread( libvlc_media_player_t *p_mi, bool b_input_abor
  *
  * Function will lock the object.
  */
-input_thread_t *libvlc_get_input_thread( libvlc_media_player_t *p_mi,
-                                         libvlc_exception_t *p_e )
+input_thread_t *libvlc_get_input_thread( libvlc_media_player_t *p_mi )
 {
     input_thread_t *p_input_thread;
 
-    if( !p_mi ) RAISENULL( "Media Instance is NULL" );
+    assert( 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;
-    vlc_object_hold( p_input_thread );
-
+    if( p_input_thread )
+        vlc_object_hold( p_input_thread );
     unlock(p_mi);
 
     return p_input_thread;
@@ -572,7 +564,7 @@ int libvlc_media_player_play( libvlc_media_player_t *p_mi )
 {
     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 */
         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 )
  **************************************************************************/
 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 )
         return;
 
@@ -782,7 +774,7 @@ libvlc_time_t libvlc_media_player_get_length(
     input_thread_t *p_input_thread;
     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 )
         return -1;
 
@@ -797,7 +789,7 @@ libvlc_time_t libvlc_media_player_get_time( libvlc_media_player_t *p_mi )
     input_thread_t *p_input_thread;
     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 )
         return -1;
 
@@ -811,7 +803,7 @@ void libvlc_media_player_set_time( libvlc_media_player_t *p_mi,
 {
     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 )
         return;
 
@@ -824,7 +816,7 @@ void libvlc_media_player_set_position( libvlc_media_player_t *p_mi,
 {
     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 )
         return;
 
@@ -837,7 +829,7 @@ float libvlc_media_player_get_position( libvlc_media_player_t *p_mi )
     input_thread_t *p_input_thread;
     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 )
         return -1.0;
 
@@ -852,7 +844,7 @@ void libvlc_media_player_set_chapter( libvlc_media_player_t *p_mi,
 {
     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 )
         return;
 
@@ -865,7 +857,7 @@ int libvlc_media_player_get_chapter( libvlc_media_player_t *p_mi )
     input_thread_t *p_input_thread;
     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 )
         return -1;
 
@@ -880,7 +872,7 @@ int libvlc_media_player_get_chapter_count( libvlc_media_player_t *p_mi )
     input_thread_t *p_input_thread;
     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 )
         return -1;
 
@@ -897,7 +889,7 @@ int libvlc_media_player_get_chapter_count_for_title(
     input_thread_t *p_input_thread;
     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 )
         return -1;
 
@@ -919,7 +911,7 @@ void libvlc_media_player_set_title( libvlc_media_player_t *p_mi,
 {
     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 )
         return;
 
@@ -938,7 +930,7 @@ int libvlc_media_player_get_title( libvlc_media_player_t *p_mi )
     input_thread_t *p_input_thread;
     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 )
         return -1;
 
@@ -953,7 +945,7 @@ int libvlc_media_player_get_title_count( libvlc_media_player_t *p_mi )
     input_thread_t *p_input_thread;
     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 )
         return -1;
 
@@ -967,7 +959,7 @@ void libvlc_media_player_next_chapter( libvlc_media_player_t *p_mi )
 {
     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 )
         return;
 
@@ -982,7 +974,7 @@ void libvlc_media_player_previous_chapter( libvlc_media_player_t *p_mi )
 {
     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 )
         return;
 
@@ -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 )
 {
-    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;
 
     if( p_input_thread )
@@ -1011,7 +1003,7 @@ int libvlc_media_player_will_play( libvlc_media_player_t *p_mi )
 {
     bool b_will_play;
     input_thread_t *p_input_thread =
-                            libvlc_get_input_thread ( p_mi, NULL );
+                            libvlc_get_input_thread ( p_mi );
     if ( !p_input_thread )
         return false;
 
@@ -1026,7 +1018,7 @@ int libvlc_media_player_set_rate( libvlc_media_player_t *p_mi, float rate )
     input_thread_t *p_input_thread;
     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 )
         return -1;
 
@@ -1049,7 +1041,7 @@ float libvlc_media_player_get_rate( libvlc_media_player_t *p_mi )
     float f_rate;
     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 )
         return 0.0;  /* rate < 0 indicates rewind */
 
@@ -1079,7 +1071,7 @@ int libvlc_media_player_is_seekable( libvlc_media_player_t *p_mi )
     input_thread_t *p_input_thread;
     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 )
         return false;
     b_seekable = var_GetBool( p_input_thread, "can-seek" );
@@ -1093,7 +1085,7 @@ libvlc_track_description_t *
         libvlc_get_track_description( libvlc_media_player_t *p_mi,
                                       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,
                                *p_actual, *p_previous;
 
@@ -1125,7 +1117,6 @@ libvlc_track_description_t *
             if ( !p_actual )
             {
                 libvlc_track_description_release( p_track_description );
-                libvlc_exception_raise( p_e );
                 libvlc_printerr( "Not enough memory" );
                 goto end;
             }
@@ -1165,7 +1156,7 @@ int libvlc_media_player_can_pause( libvlc_media_player_t *p_mi )
     input_thread_t *p_input_thread;
     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 )
         return false;
     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 )
 
 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 )
     {
         var_TriggerCallback( p_input_thread, "frame-next" );
index 96bb61041c709d280bc240e5e97656527dbff7e1..5d23ba21977488267f7d845fa8324eb70a70f88d 100644 (file)
@@ -49,12 +49,11 @@ struct libvlc_media_player_t
 };
 
 /* 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_media_player_t *p_mi,
-        const char *psz_variable,
-        libvlc_exception_t *p_e );
+        const char *psz_variable );
 
 #endif
index 5356747806e370050c813a7dd7ab431138258ae0..6d9c30c6ec3113f61b196c54e82ab82c7cb5a631 100644 (file)
@@ -60,7 +60,7 @@ mediacontrol_snapshot( mediacontrol_Instance *self,
     libvlc_exception_init( &ex );
     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 )
     {
         RAISE_NULL( mediacontrol_InternalException, "No input" );
@@ -140,7 +140,7 @@ mediacontrol_display_text( mediacontrol_Instance *self,
         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 )
     {
         RAISE_VOID( mediacontrol_InternalException, "No input" );
@@ -240,16 +240,12 @@ int
 mediacontrol_get_rate( mediacontrol_Instance *self,
                mediacontrol_Exception *exception )
 {
-    libvlc_exception_t ex;
     int i_ret;
 
     mediacontrol_exception_init( exception );
-    libvlc_exception_init( &ex );
-
-    i_ret = libvlc_media_player_get_rate( self->p_media_player, &ex );
-    HANDLE_LIBVLC_EXCEPTION_ZERO( &ex );
+    i_ret = libvlc_media_player_get_rate( self->p_media_player );
 
-    return i_ret / 10;
+    return (i_ret >= 0) ? (i_ret / 10) : -1;
 }
 
 void
@@ -257,13 +253,9 @@ mediacontrol_set_rate( mediacontrol_Instance *self,
                const int rate,
                mediacontrol_Exception *exception )
 {
-    libvlc_exception_t ex;
-
     mediacontrol_exception_init( exception );
-    libvlc_exception_init( &ex );
 
-    libvlc_media_player_set_rate( self->p_media_player, rate * 10, &ex );
-    HANDLE_LIBVLC_EXCEPTION_VOID( &ex );
+    libvlc_media_player_set_rate( self->p_media_player, rate * 10 );
 }
 
 int
index a030920674fb92ff7d193362b114f212080df5cf..7ab5e8f557439f08fa137c64272d45a35b81ec82 100644 (file)
@@ -114,11 +114,9 @@ mediacontrol_get_media_position( mediacontrol_Instance *self,
                                  mediacontrol_Exception *exception )
 {
     mediacontrol_Position* retval = NULL;
-    libvlc_exception_t ex;
     int64_t pos;
 
     mediacontrol_exception_init( exception );
-    libvlc_exception_init( &ex );
 
     retval = ( mediacontrol_Position* )malloc( sizeof( mediacontrol_Position ) );
     retval->origin = an_origin;
@@ -133,7 +131,7 @@ mediacontrol_get_media_position( mediacontrol_Instance *self,
     }
 
     /* 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 )
     {
@@ -155,15 +153,12 @@ mediacontrol_set_media_position( mediacontrol_Instance *self,
                                  const mediacontrol_Position * a_position,
                                  mediacontrol_Exception *exception )
 {
-    libvlc_exception_t ex;
     int64_t i_pos;
 
-    libvlc_exception_init( &ex );
     mediacontrol_exception_init( exception );
 
     i_pos = private_mediacontrol_position2microsecond( self->p_media_player, a_position );
-    libvlc_media_player_set_time( self->p_media_player, i_pos / 1000, &ex );
-    HANDLE_LIBVLC_EXCEPTION_VOID( &ex );
+    libvlc_media_player_set_time( self->p_media_player, i_pos / 1000 );
 }
 
 /* Starts playing a stream */
@@ -221,8 +216,7 @@ mediacontrol_start( mediacontrol_Instance *self,
 
         libvlc_media_player_set_media( self->p_media_player, p_media );
 
-        libvlc_media_player_play( self->p_media_player, &ex );
-        HANDLE_LIBVLC_EXCEPTION_VOID( &ex );
+        libvlc_media_player_play( self->p_media_player );
     }
 }
 
@@ -230,34 +224,23 @@ void
 mediacontrol_pause( mediacontrol_Instance *self,
                     mediacontrol_Exception *exception )
 {
-    libvlc_exception_t ex;
-
     mediacontrol_exception_init( exception );
-    libvlc_exception_init( &ex );
-    libvlc_media_player_pause( self->p_media_player, &ex );
-    HANDLE_LIBVLC_EXCEPTION_VOID( &ex );
+    libvlc_media_player_pause( self->p_media_player );
 }
 
 void
 mediacontrol_resume( mediacontrol_Instance *self,
                      mediacontrol_Exception *exception )
 {
-    libvlc_exception_t ex;
-
     mediacontrol_exception_init( exception );
-    libvlc_exception_init( &ex );
-    libvlc_media_player_pause( self->p_media_player, &ex );
-    HANDLE_LIBVLC_EXCEPTION_VOID( &ex );
+    libvlc_media_player_pause( self->p_media_player );
 }
 
 void
 mediacontrol_stop( mediacontrol_Instance *self,
                    mediacontrol_Exception *exception )
 {
-    libvlc_exception_t ex;
-
     mediacontrol_exception_init( exception );
-    libvlc_exception_init( &ex );
     libvlc_media_player_stop( self->p_media_player );
 }
 
@@ -379,20 +362,8 @@ mediacontrol_get_stream_information( mediacontrol_Instance *self,
 
         retval->url = libvlc_media_get_mrl( p_media );
 
-        retval->position = libvlc_media_player_get_time( self->p_media_player, &ex );
-        if( libvlc_exception_raised( &ex ) )
-        {
-            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;
-        }
-
+        retval->position = libvlc_media_player_get_time( self->p_media_player );
+        retval->length = libvlc_media_player_get_length( self->p_media_player );
     }
     return retval;
 }
index b34dfa38feb41df6fa3dfabf4fda37a9712b4929..965f853e08c27b36a86d0f4a5859b192eb1c6b70 100644 (file)
@@ -66,10 +66,8 @@ libvlc_time_t private_mediacontrol_unit_convert( libvlc_media_player_t *p_media_
         if( to == mediacontrol_SampleCount )
         {
             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 )
                 return 0;
             else
@@ -82,10 +80,8 @@ libvlc_time_t private_mediacontrol_unit_convert( libvlc_media_player_t *p_media_
     case mediacontrol_SampleCount:
     {
         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 )
             return 0;
 
@@ -129,10 +125,8 @@ private_mediacontrol_position2microsecond( libvlc_media_player_t * p_media_playe
     {
         libvlc_time_t l_time = 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 */
 
         l_pos = private_mediacontrol_unit_convert( p_media_player,
@@ -147,14 +141,12 @@ private_mediacontrol_position2microsecond( libvlc_media_player_t * p_media_playe
         libvlc_time_t l_time = 0;
         libvlc_time_t l_length = 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 )
             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 */
 
         l_pos = private_mediacontrol_unit_convert( p_media_player,
index 415605c8deaf18ef71df62bb667fa27a6dd1ce48..7e070445165a688e38aeee5a258fa9e2a5e35d44 100644 (file)
@@ -47,7 +47,7 @@
 static vout_thread_t *GetVout( libvlc_media_player_t *p_mi,
                                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;
 
     if( p_input )
@@ -60,6 +60,11 @@ static vout_thread_t *GetVout( libvlc_media_player_t *p_mi,
         }
         vlc_object_release( p_input );
     }
+    else
+    {
+        libvlc_exception_raise( p_exception );
+        libvlc_printerr( "No active input" );
+    }
     return p_vout;
 }
 
@@ -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,
                                      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;
 
     if( p_input_thread )
@@ -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,
                           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;
     int i_spu = -1;
     int i_ret = -1;
     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 );
     if( i_ret < 0 )
@@ -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,
                                 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;
 
     if( !p_input_thread )
+    {
+        libvlc_exception_raise( p_e );
+        libvlc_printerr( "No active input" );
         return -1;
+    }
 
     i_spu_count = var_CountChoices( p_input_thread, "spu-es" );
 
@@ -314,18 +328,23 @@ libvlc_track_description_t *
         libvlc_video_get_spu_description( libvlc_media_player_t *p_mi,
                                           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,
                            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 newval;
     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 );
 
@@ -354,7 +373,7 @@ int libvlc_video_set_subtitle_file( libvlc_media_player_t *p_mi,
                                     const char *psz_subtitle,
                                     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;
 
     if( p_input_thread )
@@ -370,7 +389,7 @@ libvlc_track_description_t *
         libvlc_video_get_title_description( libvlc_media_player_t *p_mi,
                                             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 *
@@ -380,7 +399,7 @@ libvlc_track_description_t *
 {
     char psz_title[12];
     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,
@@ -419,7 +438,7 @@ void libvlc_toggle_teletext( libvlc_media_player_t *p_mi,
 {
     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( var_CountChoices( p_input_thread, "teletext-es" ) <= 0 )
@@ -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,
                                   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;
 
     if( !p_input_thread )
@@ -465,13 +484,13 @@ libvlc_track_description_t *
         libvlc_video_get_track_description( libvlc_media_player_t *p_mi,
                                             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,
                             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;
     int i_track = -1;
@@ -487,7 +506,7 @@ int libvlc_video_get_track( libvlc_media_player_t *p_mi,
         libvlc_exception_raise( p_e );
         libvlc_printerr( "Video track information not found" );
         vlc_object_release( p_input_thread );
-        return i_ret;
+        return -1;
     }
 
     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,
 void libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track,
                              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;
     int i_ret = -1;
     int i;
index 268278f521e492843d5dc16c559cb98e3d388cd3..bbe18b81ce855a5d6f933ea71c0470e17320a8e8 100644 (file)
@@ -78,8 +78,8 @@ static void test_events (const char ** argv, int argc)
     vlc = libvlc_new (argc, argv, &ex);
     catch ();
 
-    mi = libvlc_media_player_new (vlc, &ex);
-    catch ();
+    mi = libvlc_media_player_new (vlc);
+    assert (mi != NULL);
 
     em = libvlc_media_player_event_manager (mi);
 
index 8ebde89d2bed30061bc25af977ede7b4e7442a38..369eb8352db37c7677e189669329fd5427ed22a4 100644 (file)
@@ -39,13 +39,12 @@ static void test_media_player_play_stop(const char** argv, int argc)
     md = libvlc_media_new (vlc, file, &ex);
     catch ();
 
-    mi = libvlc_media_player_new_from_media (md, &ex);
-    catch ();
+    mi = libvlc_media_player_new_from_media (md);
+    assert (mi != NULL);
 
     libvlc_media_release (md);
 
-    libvlc_media_player_play (mi, &ex);
-    catch ();
+    libvlc_media_player_play (mi);
 
     /* Wait a correct state */
     libvlc_state_t state;
@@ -78,13 +77,12 @@ static void test_media_player_pause_stop(const char** argv, int argc)
     md = libvlc_media_new (vlc, file, &ex);
     catch ();
 
-    mi = libvlc_media_player_new_from_media (md, &ex);
-    catch ();
+    mi = libvlc_media_player_new_from_media (md);
+    assert (mi != NULL);
 
     libvlc_media_release (md);
 
-    libvlc_media_player_play (mi, &ex);
-    catch ();
+    libvlc_media_player_play (mi);
 
     log ("Waiting for playing\n");
 
@@ -102,8 +100,7 @@ static void test_media_player_pause_stop(const char** argv, int argc)
 #if 0
     /* This can't work because under some condition (short file, this is the case) this will be
      * equivalent to a play() */
-    libvlc_media_player_pause (mi, &ex);
-    catch();
+    libvlc_media_player_pause (mi);
 
     log ("Waiting for pause\n");