]> git.sesse.net Git - vlc/blobdiff - src/control/media_player.c
LibVLC logo/marquee: allow settings without video, remove exceptions
[vlc] / src / control / media_player.c
index 3bd4fa6411cb1e76f9ad28002f27f63d3be02072..678aab8e9e17d2761bd7c0c3dec6eb2280ffe2d8 100644 (file)
@@ -67,7 +67,7 @@ static void libvlc_media_player_destroy( libvlc_media_player_t *p_mi );
 #define register_event(a, b) __register_event(a, libvlc_MediaPlayer ## b)
 static inline void __register_event(libvlc_media_player_t *mp, libvlc_event_type_t type)
 {
-    libvlc_event_manager_register_event_type(mp->p_event_manager, type, NULL);
+    libvlc_event_manager_register_event_type(mp->p_event_manager, type);
 }
 
 static inline void lock(libvlc_media_player_t *mp)
@@ -111,10 +111,6 @@ static void release_input_thread( libvlc_media_player_t *p_mi, bool b_input_abor
     /* Store the input resource for future use. */
     p_mi->p_input_resource = input_DetachResource( p_input_thread );
 
-    var_Destroy( p_input_thread, "drawable-hwnd" );
-    var_Destroy( p_input_thread, "drawable-xid" );
-    var_Destroy( p_input_thread, "drawable-agl" );
-
     vlc_object_release( p_input_thread );
 
     p_mi->p_input_thread = NULL;
@@ -126,24 +122,18 @@ 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 );
+    else
+        libvlc_printerr( "No active input" );
     unlock(p_mi);
 
     return p_input_thread;
@@ -154,22 +144,25 @@ input_thread_t *libvlc_get_input_thread( libvlc_media_player_t *p_mi,
  *
  * Function will lock the media_player.
  */
-static void set_state( libvlc_media_player_t *p_mi, libvlc_state_t state )
-{    
-    lock(p_mi);
+static void set_state( libvlc_media_player_t *p_mi, libvlc_state_t state,
+    bool b_locked )
+{
+    if(!b_locked)
+        lock(p_mi);
     p_mi->state = state;
     libvlc_media_t *media = p_mi->p_md;
     if (media)
         libvlc_media_retain(media);
-    unlock(p_mi);
+    if(!b_locked)
+        unlock(p_mi);
 
 
     if (media) {
         // Also set the state of the corresponding media
         // This is strictly for convenience.
         libvlc_media_set_state(media, state);
-        
-        libvlc_media_release(media);        
+
+        libvlc_media_release(media);
     }
 }
 
@@ -255,8 +248,8 @@ input_event_changed( vlc_object_t * p_this, char const * psz_cmd,
             default:
                 return VLC_SUCCESS;
         }
-        
-        set_state( p_mi, libvlc_state );
+
+        set_state( p_mi, libvlc_state, false );
         libvlc_event_send( p_mi->p_event_manager, &event );
     }
     else if( newval.i_int == INPUT_EVENT_ABORT )
@@ -264,7 +257,7 @@ input_event_changed( vlc_object_t * p_this, char const * psz_cmd,
         libvlc_state_t libvlc_state = libvlc_Stopped;
         event.type = libvlc_MediaPlayerStopped;
 
-        set_state( p_mi, libvlc_state );
+        set_state( p_mi, libvlc_state, false );
         libvlc_event_send( p_mi->p_event_manager, &event );
     }
     else if( newval.i_int == INPUT_EVENT_POSITION )
@@ -334,38 +327,81 @@ static void libvlc_media_player_destroy( libvlc_media_player_t * );
  * - When attempting to destroy the object the lock is also held.
  **************************************************************************/
 libvlc_media_player_t *
-libvlc_media_player_new( libvlc_instance_t *instance, libvlc_exception_t *e )
+libvlc_media_player_new( libvlc_instance_t *instance )
 {
     libvlc_media_player_t * mp;
 
     assert(instance);
 
-    mp = malloc(sizeof(libvlc_media_player_t));
-    if (!mp)
+    mp = vlc_object_create (instance->p_libvlc_int, sizeof(*mp));
+    if (unlikely(mp == NULL))
     {
-        libvlc_exception_raise(e);
         libvlc_printerr("Not enough memory");
         return NULL;
     }
+    vlc_object_attach (mp, mp->p_libvlc);
+
+    /* Video */
+    var_Create (mp, "drawable-xid", VLC_VAR_INTEGER);
+#ifdef WIN32
+    var_Create (mp, "drawable-hwnd", VLC_VAR_ADDRESS);
+#endif
+#ifdef __APPLE__
+    var_Create (mp, "drawable-agl", VLC_VAR_INTEGER);
+    var_Create (mp, "drawable-nsobject", VLC_VAR_ADDRESS);
+#endif
+
+    var_Create (mp, "keyboard-events", VLC_VAR_BOOL);
+    var_SetBool (mp, "keyboard-events", true);
+    var_Create (mp, "mouse-events", VLC_VAR_BOOL);
+    var_SetBool (mp, "mouse-events", true);
+
+    var_Create (mp, "fullscreen", VLC_VAR_BOOL);
+    var_Create (mp, "autoscale", VLC_VAR_BOOL);
+    var_SetBool (mp, "autoscale", true);
+    var_Create (mp, "scale", VLC_VAR_FLOAT);
+    var_SetFloat (mp, "scale", 1.);
+    var_Create (mp, "aspect-ratio", VLC_VAR_STRING);
+    var_Create (mp, "crop", VLC_VAR_STRING);
+    var_Create (mp, "deinterlace", VLC_VAR_INTEGER);
+    var_Create (mp, "deinterlace-mode", VLC_VAR_STRING);
+
+    var_Create (mp, "vbi-page", VLC_VAR_INTEGER);
+
+    var_Create (mp, "marq-marquee", VLC_VAR_STRING);
+    var_Create (mp, "marq-color", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
+    var_Create (mp, "marq-opacity", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
+    var_Create (mp, "marq-position", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
+    var_Create (mp, "marq-refresh", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
+    var_Create (mp, "marq-size", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
+    var_Create (mp, "marq-timeout", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
+    var_Create (mp, "marq-x", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
+    var_Create (mp, "marq-y", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
+
+    var_Create (mp, "logo-file", VLC_VAR_STRING);
+    var_Create (mp, "logo-x", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
+    var_Create (mp, "logo-y", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
+    var_Create (mp, "logo-delay", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
+    var_Create (mp, "logo-repeat", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
+    var_Create (mp, "logo-opacity", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
+    var_Create (mp, "logo-position", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
+
+     /* Audio */
+    var_Create (mp, "aout", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
+
     mp->p_md = NULL;
-    mp->drawable.agl = 0;
-    mp->drawable.xid = 0;
-    mp->drawable.hwnd = NULL;
-    mp->drawable.nsobject = NULL;
-    mp->keyboard_events = mp->mouse_events = 1;
     mp->state = libvlc_NothingSpecial;
     mp->p_libvlc_instance = instance;
     mp->p_input_thread = NULL;
     mp->p_input_resource = NULL;
     mp->i_refcount = 1;
-    vlc_mutex_init(&mp->object_lock);
-    mp->p_event_manager = libvlc_event_manager_new(mp, instance, e);
-    if (libvlc_exception_raised(e))
+    mp->p_event_manager = libvlc_event_manager_new(mp, instance);
+    if (unlikely(mp->p_event_manager == NULL))
     {
-        vlc_mutex_destroy(&mp->object_lock);
-        free(mp);
+        vlc_object_release(mp);
         return NULL;
     }
+    vlc_mutex_init(&mp->object_lock);
 
     register_event(mp, NothingSpecial);
     register_event(mp, Opening);
@@ -397,8 +433,9 @@ libvlc_media_player_new( libvlc_instance_t *instance, libvlc_exception_t *e )
      * FIXME: It's unclear why we want to put this in public API, and why we
      * want to expose it in such a limiting and ugly way.
      */
-    var_AddCallback(instance->p_libvlc_int, "snapshot-file", snapshot_was_taken, mp);
+    var_AddCallback(mp->p_libvlc, "snapshot-file", snapshot_was_taken, mp);
 
+    libvlc_retain(instance);
     return mp;
 }
 
@@ -406,13 +443,11 @@ libvlc_media_player_new( libvlc_instance_t *instance, libvlc_exception_t *e )
  * Create a Media Instance object with a media descriptor.
  **************************************************************************/
 libvlc_media_player_t *
-libvlc_media_player_new_from_media(
-                                    libvlc_media_t * p_md,
-                                    libvlc_exception_t *p_e )
+libvlc_media_player_new_from_media( libvlc_media_t * p_md )
 {
     libvlc_media_player_t * p_mi;
 
-    p_mi = libvlc_media_player_new( p_md->p_libvlc_instance, p_e );
+    p_mi = libvlc_media_player_new( p_md->p_libvlc_instance );
     if( !p_mi )
         return NULL;
 
@@ -432,7 +467,7 @@ static void libvlc_media_player_destroy( libvlc_media_player_t *p_mi )
     assert( p_mi );
 
     /* Detach Callback from the main libvlc object */
-    var_DelCallback( p_mi->p_libvlc_instance->p_libvlc_int,
+    var_DelCallback( p_mi->p_libvlc,
                      "snapshot-file", snapshot_was_taken, p_mi );
 
     /* If the input thread hasn't been already deleted it means
@@ -446,13 +481,16 @@ static void libvlc_media_player_destroy( libvlc_media_player_t *p_mi )
     if( p_mi->p_input_resource )
     {
         input_resource_Delete( p_mi->p_input_resource );
-        p_mi->p_input_resource = NULL;    
+        p_mi->p_input_resource = NULL;
     }
 
     libvlc_event_manager_release( p_mi->p_event_manager );
     libvlc_media_release( p_mi->p_md );
     vlc_mutex_destroy( &p_mi->object_lock );
-    free( p_mi );
+
+    libvlc_instance_t *instance = p_mi->p_libvlc_instance;
+    vlc_object_release( p_mi );
+    libvlc_release(instance);
 }
 
 /**************************************************************************
@@ -494,11 +532,8 @@ void libvlc_media_player_retain( libvlc_media_player_t *p_mi )
  **************************************************************************/
 void libvlc_media_player_set_media(
                             libvlc_media_player_t *p_mi,
-                            libvlc_media_t *p_md,
-                            libvlc_exception_t *p_e )
+                            libvlc_media_t *p_md )
 {
-    VLC_UNUSED(p_e);
-
     lock(p_mi);
 
     /* FIXME I am not sure if it is a user request or on die(eof/error)
@@ -507,11 +542,8 @@ void libvlc_media_player_set_media(
                           p_mi->p_input_thread &&
                           !p_mi->p_input_thread->b_eof &&
                           !p_mi->p_input_thread->b_error );
-    unlock(p_mi);
 
-    set_state( p_mi, libvlc_NothingSpecial );
-
-    lock(p_mi);
+    set_state( p_mi, libvlc_NothingSpecial, true );
 
     libvlc_media_release( p_mi->p_md );
 
@@ -536,19 +568,16 @@ void libvlc_media_player_set_media(
     event.type = libvlc_MediaPlayerMediaChanged;
     event.u.media_player_media_changed.new_media = p_md;
     libvlc_event_send( p_mi->p_event_manager, &event );
-    
+
 }
 
 /**************************************************************************
  * Get the Media descriptor associated with the instance.
  **************************************************************************/
 libvlc_media_t *
-libvlc_media_player_get_media(
-                            libvlc_media_player_t *p_mi,
-                            libvlc_exception_t *p_e )
+libvlc_media_player_get_media( libvlc_media_player_t *p_mi )
 {
     libvlc_media_t *p_m;
-    VLC_UNUSED(p_e);
 
     lock(p_mi);
     p_m = p_mi->p_md;
@@ -562,77 +591,49 @@ libvlc_media_player_get_media(
  * Get the event Manager.
  **************************************************************************/
 libvlc_event_manager_t *
-libvlc_media_player_event_manager(
-                            libvlc_media_player_t *p_mi,
-                            libvlc_exception_t *p_e )
+libvlc_media_player_event_manager( libvlc_media_player_t *p_mi )
 {
-    VLC_UNUSED(p_e);
-
     return p_mi->p_event_manager;
 }
 
 /**************************************************************************
  * Tell media player to start playing.
  **************************************************************************/
-void libvlc_media_player_play( libvlc_media_player_t *p_mi,
-                                 libvlc_exception_t *p_e )
+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, p_e )) )
+    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 );
         vlc_object_release( p_input_thread );
-        return;
+        return 0;
     }
 
     /* Ignore previous exception */
-    libvlc_exception_clear( p_e );
-
     lock(p_mi);
 
     if( !p_mi->p_md )
     {
         unlock(p_mi);
-        libvlc_exception_raise( p_e );
         libvlc_printerr( "No associated media descriptor" );
-        return;
+        return -1;
     }
 
-    p_mi->p_input_thread = input_Create( p_mi->p_libvlc_instance->p_libvlc_int,
-                                         p_mi->p_md->p_input_item, NULL, p_mi->p_input_resource );
-
+    p_mi->p_input_thread = input_Create( p_mi,
+                                         p_mi->p_md->p_input_item, NULL,
+                                         p_mi->p_input_resource );
     if( !p_mi->p_input_thread )
     {
         unlock(p_mi);
-        return;
+        libvlc_printerr( "Not enough memory" );
+        return -1;
     }
 
     p_mi->p_input_resource = NULL;
     p_input_thread = p_mi->p_input_thread;
 
-    var_Create( p_input_thread, "drawable-agl", VLC_VAR_INTEGER );
-    if( p_mi->drawable.agl )
-        var_SetInteger( p_input_thread, "drawable-agl", p_mi->drawable.agl );
-
-    var_Create( p_input_thread, "drawable-xid", VLC_VAR_INTEGER );
-    if( p_mi->drawable.xid )
-        var_SetInteger( p_input_thread, "drawable-xid", p_mi->drawable.xid );
-
-    var_Create( p_input_thread, "drawable-hwnd", VLC_VAR_ADDRESS );
-    if( p_mi->drawable.hwnd != NULL )
-        var_SetAddress( p_input_thread, "drawable-hwnd", p_mi->drawable.hwnd );
-
-    var_Create( p_input_thread, "drawable-nsobject", VLC_VAR_ADDRESS );
-    if( p_mi->drawable.nsobject != NULL )
-        var_SetAddress( p_input_thread, "drawable-nsobject", p_mi->drawable.nsobject );
-
-    var_Create( p_input_thread, "keyboard-events", VLC_VAR_BOOL );
-    var_SetBool( p_input_thread, "keyboard-events", p_mi->keyboard_events );
-    var_Create( p_input_thread, "mouse-events", VLC_VAR_BOOL );
-    var_SetBool( p_input_thread, "mouse-events", p_mi->mouse_events );
-
     var_AddCallback( p_input_thread, "can-seek", input_seekable_changed, p_mi );
     var_AddCallback( p_input_thread, "can-pause", input_pausable_changed, p_mi );
     var_AddCallback( p_input_thread, "intf-event", input_event_changed, p_mi );
@@ -644,25 +645,25 @@ void libvlc_media_player_play( libvlc_media_player_t *p_mi,
     }
 
     unlock(p_mi);
+    return 0;
 }
 
 /**************************************************************************
  * Pause.
  **************************************************************************/
-void libvlc_media_player_pause( libvlc_media_player_t *p_mi,
-                                  libvlc_exception_t *p_e )
+void libvlc_media_player_pause( libvlc_media_player_t *p_mi )
 {
-    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 );
     if( !p_input_thread )
         return;
 
-    libvlc_state_t state = libvlc_media_player_get_state( p_mi, p_e );
+    libvlc_state_t state = libvlc_media_player_get_state( p_mi );
     if( state == libvlc_Playing || state == libvlc_Buffering )
     {
-        if( libvlc_media_player_can_pause( p_mi, p_e ) )
+        if( libvlc_media_player_can_pause( p_mi ) )
             input_Control( p_input_thread, INPUT_SET_STATE, PAUSE_S );
         else
-            libvlc_media_player_stop( p_mi, p_e );
+            libvlc_media_player_stop( p_mi );
     }
     else
         input_Control( p_input_thread, INPUT_SET_STATE, PLAYING_S );
@@ -675,20 +676,18 @@ void libvlc_media_player_pause( libvlc_media_player_t *p_mi,
  *
  * Enter with lock held.
  **************************************************************************/
-int libvlc_media_player_is_playing( libvlc_media_player_t *p_mi,
-                                     libvlc_exception_t *p_e )
+int libvlc_media_player_is_playing( libvlc_media_player_t *p_mi )
 {
-    libvlc_state_t state = libvlc_media_player_get_state( p_mi, p_e );
+    libvlc_state_t state = libvlc_media_player_get_state( p_mi );
     return (libvlc_Playing == state) || (libvlc_Buffering == state);
 }
 
 /**************************************************************************
  * Stop playing.
  **************************************************************************/
-void libvlc_media_player_stop( libvlc_media_player_t *p_mi,
-                                 libvlc_exception_t *p_e )
+void libvlc_media_player_stop( libvlc_media_player_t *p_mi )
 {
-    libvlc_state_t state = libvlc_media_player_get_state( p_mi, p_e );
+    libvlc_state_t state = libvlc_media_player_get_state( p_mi );
 
     lock(p_mi);
     release_input_thread( p_mi, true ); /* This will stop the input thread */
@@ -698,7 +697,7 @@ void libvlc_media_player_stop( libvlc_media_player_t *p_mi,
      * state. */
     if( state != libvlc_Stopped )
     {
-        set_state( p_mi, libvlc_Stopped );
+        set_state( p_mi, libvlc_Stopped, false );
 
         /* Construct and send the event */
         libvlc_event_t event;
@@ -711,11 +710,14 @@ void libvlc_media_player_stop( libvlc_media_player_t *p_mi,
  * set_nsobject
  **************************************************************************/
 void libvlc_media_player_set_nsobject( libvlc_media_player_t *p_mi,
-                                        void * drawable,
-                                        libvlc_exception_t *p_e )
+                                        void * drawable )
 {
-    (void) p_e;
-    p_mi->drawable.nsobject = drawable;
+    assert (p_mi != NULL);
+#ifdef __APPLE__
+    var_SetAddress (p_mi, "drawable-nsobject", drawable);
+#else
+    (void) p_mi; (void)drawable;
+#endif
 }
 
 /**************************************************************************
@@ -723,18 +725,25 @@ void libvlc_media_player_set_nsobject( libvlc_media_player_t *p_mi,
  **************************************************************************/
 void * libvlc_media_player_get_nsobject( libvlc_media_player_t *p_mi )
 {
-    return p_mi->drawable.nsobject;
+    assert (p_mi != NULL);
+#ifdef __APPLE__
+    return var_GetAddress (p_mi, "drawable-nsobject");
+#else
+    return NULL;
+#endif
 }
 
 /**************************************************************************
  * set_agl
  **************************************************************************/
 void libvlc_media_player_set_agl( libvlc_media_player_t *p_mi,
-                                      uint32_t drawable,
-                                      libvlc_exception_t *p_e )
+                                  uint32_t drawable )
 {
-    (void) p_e;
-    p_mi->drawable.agl = drawable;
+#ifdef __APPLE__
+    var_SetInteger (p_mi, "drawable-agl", drawable);
+#else
+    (void) p_mi; (void)drawable;
+#endif
 }
 
 /**************************************************************************
@@ -742,18 +751,22 @@ void libvlc_media_player_set_agl( libvlc_media_player_t *p_mi,
  **************************************************************************/
 uint32_t libvlc_media_player_get_agl( libvlc_media_player_t *p_mi )
 {
-    return p_mi->drawable.agl;
+    assert (p_mi != NULL);
+#ifdef __APPLE__
+    return var_GetInteger (p_mi, "drawable-agl");
+#else
+    return 0;
+#endif
 }
 
 /**************************************************************************
  * set_xwindow
  **************************************************************************/
 void libvlc_media_player_set_xwindow( libvlc_media_player_t *p_mi,
-                                      uint32_t drawable,
-                                      libvlc_exception_t *p_e )
+                                      uint32_t drawable )
 {
-    (void) p_e;
-    p_mi->drawable.xid = drawable;
+    assert (p_mi != NULL);
+    var_SetInteger (p_mi, "drawable-xid", drawable);
 }
 
 /**************************************************************************
@@ -761,18 +774,21 @@ void libvlc_media_player_set_xwindow( libvlc_media_player_t *p_mi,
  **************************************************************************/
 uint32_t libvlc_media_player_get_xwindow( libvlc_media_player_t *p_mi )
 {
-    return p_mi->drawable.xid;
+    return var_GetInteger (p_mi, "drawable-xid");
 }
 
 /**************************************************************************
  * set_hwnd
  **************************************************************************/
 void libvlc_media_player_set_hwnd( libvlc_media_player_t *p_mi,
-                                   void *drawable,
-                                   libvlc_exception_t *p_e )
+                                   void *drawable )
 {
-    (void) p_e;
-    p_mi->drawable.hwnd = drawable;
+    assert (p_mi != NULL);
+#ifdef WIN32
+    var_SetAddress (p_mi, "drawable-hwnd", drawable);
+#else
+    (void) p_mi; (void) drawable;
+#endif
 }
 
 /**************************************************************************
@@ -780,20 +796,24 @@ void libvlc_media_player_set_hwnd( libvlc_media_player_t *p_mi,
  **************************************************************************/
 void *libvlc_media_player_get_hwnd( libvlc_media_player_t *p_mi )
 {
-    return p_mi->drawable.hwnd;
+    assert (p_mi != NULL);
+#ifdef WIN32
+    return var_GetAddress (p_mi, "drawable-hwnd");
+#else
+    return NULL;
+#endif
 }
 
 /**************************************************************************
  * Getters for stream information
  **************************************************************************/
 libvlc_time_t libvlc_media_player_get_length(
-                             libvlc_media_player_t *p_mi,
-                             libvlc_exception_t *p_e )
+                             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, p_e);
+    p_input_thread = libvlc_get_input_thread ( p_mi );
     if( !p_input_thread )
         return -1;
 
@@ -803,14 +823,12 @@ libvlc_time_t libvlc_media_player_get_length(
     return i_time;
 }
 
-libvlc_time_t libvlc_media_player_get_time(
-                                   libvlc_media_player_t *p_mi,
-                                   libvlc_exception_t *p_e )
+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, p_e );
+    p_input_thread = libvlc_get_input_thread ( p_mi );
     if( !p_input_thread )
         return -1;
 
@@ -819,14 +837,12 @@ libvlc_time_t libvlc_media_player_get_time(
     return i_time;
 }
 
-void libvlc_media_player_set_time(
-                                 libvlc_media_player_t *p_mi,
-                                 libvlc_time_t i_time,
-                                 libvlc_exception_t *p_e )
+void libvlc_media_player_set_time( libvlc_media_player_t *p_mi,
+                                   libvlc_time_t i_time )
 {
     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;
 
@@ -834,14 +850,12 @@ void libvlc_media_player_set_time(
     vlc_object_release( p_input_thread );
 }
 
-void libvlc_media_player_set_position(
-                                libvlc_media_player_t *p_mi,
-                                float position,
-                                libvlc_exception_t *p_e )
+void libvlc_media_player_set_position( libvlc_media_player_t *p_mi,
+                                       float position )
 {
     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;
 
@@ -849,14 +863,12 @@ void libvlc_media_player_set_position(
     vlc_object_release( p_input_thread );
 }
 
-float libvlc_media_player_get_position(
-                                 libvlc_media_player_t *p_mi,
-                                 libvlc_exception_t *p_e )
+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, p_e );
+    p_input_thread = libvlc_get_input_thread ( p_mi );
     if( !p_input_thread )
         return -1.0;
 
@@ -866,14 +878,12 @@ float libvlc_media_player_get_position(
     return f_position;
 }
 
-void libvlc_media_player_set_chapter(
-                                 libvlc_media_player_t *p_mi,
-                                 int chapter,
-                                 libvlc_exception_t *p_e )
+void libvlc_media_player_set_chapter( libvlc_media_player_t *p_mi,
+                                      int chapter )
 {
     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;
 
@@ -881,14 +891,12 @@ void libvlc_media_player_set_chapter(
     vlc_object_release( p_input_thread );
 }
 
-int libvlc_media_player_get_chapter(
-                                 libvlc_media_player_t *p_mi,
-                                 libvlc_exception_t *p_e )
+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, p_e );
+    p_input_thread = libvlc_get_input_thread ( p_mi );
     if( !p_input_thread )
         return -1;
 
@@ -898,14 +906,12 @@ int libvlc_media_player_get_chapter(
     return i_chapter;
 }
 
-int libvlc_media_player_get_chapter_count(
-                                 libvlc_media_player_t *p_mi,
-                                 libvlc_exception_t *p_e )
+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, p_e );
+    p_input_thread = libvlc_get_input_thread ( p_mi );
     if( !p_input_thread )
         return -1;
 
@@ -917,13 +923,12 @@ int libvlc_media_player_get_chapter_count(
 
 int libvlc_media_player_get_chapter_count_for_title(
                                  libvlc_media_player_t *p_mi,
-                                 int i_title,
-                                 libvlc_exception_t *p_e )
+                                 int i_title )
 {
     input_thread_t *p_input_thread;
     vlc_value_t val;
 
-    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 -1;
 
@@ -940,14 +945,12 @@ int libvlc_media_player_get_chapter_count_for_title(
     return val.i_int;
 }
 
-void libvlc_media_player_set_title(
-                                 libvlc_media_player_t *p_mi,
-                                 int i_title,
-                                 libvlc_exception_t *p_e )
+void libvlc_media_player_set_title( libvlc_media_player_t *p_mi,
+                                    int i_title )
 {
     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;
 
@@ -961,14 +964,12 @@ void libvlc_media_player_set_title(
     libvlc_event_send( p_mi->p_event_manager, &event );
 }
 
-int libvlc_media_player_get_title(
-                                 libvlc_media_player_t *p_mi,
-                                 libvlc_exception_t *p_e )
+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, p_e );
+    p_input_thread = libvlc_get_input_thread ( p_mi );
     if( !p_input_thread )
         return -1;
 
@@ -978,14 +979,12 @@ int libvlc_media_player_get_title(
     return i_title;
 }
 
-int libvlc_media_player_get_title_count(
-                                 libvlc_media_player_t *p_mi,
-                                 libvlc_exception_t *p_e )
+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, p_e );
+    p_input_thread = libvlc_get_input_thread ( p_mi );
     if( !p_input_thread )
         return -1;
 
@@ -995,13 +994,11 @@ int libvlc_media_player_get_title_count(
     return val.i_int;
 }
 
-void libvlc_media_player_next_chapter(
-                                 libvlc_media_player_t *p_mi,
-                                 libvlc_exception_t *p_e )
+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, p_e);
+    p_input_thread = libvlc_get_input_thread ( p_mi );
     if( !p_input_thread )
         return;
 
@@ -1012,13 +1009,11 @@ void libvlc_media_player_next_chapter(
     vlc_object_release( p_input_thread );
 }
 
-void libvlc_media_player_previous_chapter(
-                                 libvlc_media_player_t *p_mi,
-                                 libvlc_exception_t *p_e )
+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, p_e);
+    p_input_thread = libvlc_get_input_thread ( p_mi );
     if( !p_input_thread )
         return;
 
@@ -1029,11 +1024,9 @@ void libvlc_media_player_previous_chapter(
     vlc_object_release( p_input_thread );
 }
 
-float libvlc_media_player_get_fps(
-                                 libvlc_media_player_t *p_mi,
-                                 libvlc_exception_t *p_e)
+float libvlc_media_player_get_fps( libvlc_media_player_t *p_mi )
 {
-    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 );
     double f_fps = 0.0;
 
     if( p_input_thread )
@@ -1045,12 +1038,11 @@ float libvlc_media_player_get_fps(
     return f_fps;
 }
 
-int libvlc_media_player_will_play( libvlc_media_player_t *p_mi,
-                                     libvlc_exception_t *p_e)
+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, p_e);
+                            libvlc_get_input_thread ( p_mi );
     if ( !p_input_thread )
         return false;
 
@@ -1060,40 +1052,35 @@ int libvlc_media_player_will_play( libvlc_media_player_t *p_mi,
     return b_will_play;
 }
 
-void libvlc_media_player_set_rate(
-                                 libvlc_media_player_t *p_mi,
-                                 float rate,
-                                 libvlc_exception_t *p_e )
+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, p_e );
+    p_input_thread = libvlc_get_input_thread ( p_mi );
     if( !p_input_thread )
-        return;
+        return -1;
 
     b_can_rewind = var_GetBool( p_input_thread, "can-rewind" );
     if( (rate < 0.0) && !b_can_rewind )
     {
         vlc_object_release( p_input_thread );
-        libvlc_exception_raise( p_e );
         libvlc_printerr( "Invalid playback rate" );
-        return;
+        return -1;
     }
 
     var_SetFloat( p_input_thread, "rate", rate );
     vlc_object_release( p_input_thread );
+    return 0;
 }
 
-float libvlc_media_player_get_rate(
-                                 libvlc_media_player_t *p_mi,
-                                 libvlc_exception_t *p_e )
+float libvlc_media_player_get_rate( libvlc_media_player_t *p_mi )
 {
     input_thread_t *p_input_thread;
     float f_rate;
     bool b_can_rewind;
 
-    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 0.0;  /* rate < 0 indicates rewind */
 
@@ -1110,28 +1097,22 @@ float libvlc_media_player_get_rate(
     return f_rate;
 }
 
-libvlc_state_t libvlc_media_player_get_state( libvlc_media_player_t *p_mi, libvlc_exception_t *p_e )
+libvlc_state_t libvlc_media_player_get_state( libvlc_media_player_t *p_mi )
 {
-    VLC_UNUSED(p_e);
     lock(p_mi);
     libvlc_state_t state = p_mi->state;
     unlock(p_mi);
     return state;
 }
 
-int libvlc_media_player_is_seekable( libvlc_media_player_t *p_mi,
-                                       libvlc_exception_t *p_e )
+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, p_e );
+    p_input_thread = libvlc_get_input_thread ( p_mi );
     if ( !p_input_thread )
-    {
-        /* We do return the right value, no need to throw an exception */
-        clear_if_needed(p_e);
         return false;
-    }
     b_seekable = var_GetBool( p_input_thread, "can-seek" );
     vlc_object_release( p_input_thread );
 
@@ -1141,10 +1122,9 @@ int libvlc_media_player_is_seekable( libvlc_media_player_t *p_mi,
 /* internal function, used by audio, video */
 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 )
 {
-    input_thread_t *p_input = libvlc_get_input_thread( p_mi, p_e );
+    input_thread_t *p_input = libvlc_get_input_thread( p_mi );
     libvlc_track_description_t *p_track_description = NULL,
                                *p_actual, *p_previous;
 
@@ -1162,7 +1142,6 @@ libvlc_track_description_t *
         malloc( sizeof( libvlc_track_description_t ) );
     if ( !p_track_description )
     {
-        libvlc_exception_raise( p_e );
         libvlc_printerr( "Not enough memory" );
         goto end;
     }
@@ -1177,7 +1156,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;
             }
@@ -1212,36 +1190,26 @@ void libvlc_track_description_release( libvlc_track_description_t *p_td )
     }
 }
 
-int libvlc_media_player_can_pause( libvlc_media_player_t *p_mi,
-                                     libvlc_exception_t *p_e )
+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, p_e );
+    p_input_thread = libvlc_get_input_thread ( p_mi );
     if ( !p_input_thread )
-    {
-        /* We do return the right value, no need to throw an exception */
-        clear_if_needed(p_e);
         return false;
-    }
     b_can_pause = var_GetBool( p_input_thread, "can-pause" );
     vlc_object_release( p_input_thread );
 
     return b_can_pause;
 }
 
-void libvlc_media_player_next_frame( libvlc_media_player_t *p_mi, libvlc_exception_t *p_e )
+void libvlc_media_player_next_frame( libvlc_media_player_t *p_mi )
 {
-    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 );
     if( p_input_thread != NULL )
     {
         var_TriggerCallback( p_input_thread, "frame-next" );
         vlc_object_release( p_input_thread );
     }
-    else
-    {
-        libvlc_exception_raise( p_e );
-        libvlc_printerr( "No active input" );
-    }
 }