]> git.sesse.net Git - vlc/blobdiff - modules/codec/cmml/intf.c
The playlist is not lock at this stage so let it lock itself.
[vlc] / modules / codec / cmml / intf.c
index 2f25362c657b0bab75f556c276570a39ea0e2679..b57cd668a6b6084f3b8c5494974f8a6c302c424a 100644 (file)
@@ -31,7 +31,7 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
 
 #include <stdio.h>
 
@@ -79,8 +79,8 @@ struct navigation_history_t
  * Local prototypes.
  *****************************************************************************/
 
-int          E_(OpenIntf)               ( vlc_object_t * );
-void         E_(CloseIntf)              ( vlc_object_t * );
+int          OpenIntf               ( vlc_object_t * );
+void         CloseIntf              ( vlc_object_t * );
 
 static int   InitThread                 ( intf_thread_t * );
 static int   MouseEvent                 ( vlc_object_t *, char const *,
@@ -114,7 +114,7 @@ static void RunIntf        ( intf_thread_t *p_intf );
 /*****************************************************************************
  * OpenIntf: initialize CMML interface
  *****************************************************************************/
-int E_(OpenIntf) ( vlc_object_t *p_this )
+int OpenIntf ( vlc_object_t *p_this )
 {
     intf_thread_t *p_intf = (intf_thread_t *)p_this;
 
@@ -146,7 +146,7 @@ int E_(OpenIntf) ( vlc_object_t *p_this )
 /*****************************************************************************
  * CloseIntf: destroy dummy interface
  *****************************************************************************/
-void E_(CloseIntf) ( vlc_object_t *p_this )
+void CloseIntf ( vlc_object_t *p_this )
 {
     intf_thread_t * p_intf = (intf_thread_t *)p_this;
     vout_thread_t * p_vout;
@@ -188,17 +188,16 @@ static void RunIntf( intf_thread_t *p_intf )
     msg_Dbg( p_intf, "CMML intf initialized" );
 #endif
 
-    /* if video output is dying, disassociate ourselves from it */
-    if( p_vout && p_vout->b_die )
-    {
-        var_DelCallback( p_vout, "mouse-clicked", MouseEvent, p_intf );
-        vlc_object_release( p_vout );
-        p_vout = NULL;
-    }
-
     /* Main loop */
-    while( !p_intf->b_die )
+    while( vlc_object_alive (p_intf) )
     {
+        /* if video output is dying, disassociate ourselves from it */
+        if( p_vout && !vlc_object_alive (p_vout) )
+        {
+            var_DelCallback( p_vout, "mouse-clicked", MouseEvent, p_intf );
+            vlc_object_release( p_vout );
+            p_vout = NULL;
+        }
 
         /* find a video output if we currently don't have one */
         if( p_vout == NULL )
@@ -335,7 +334,7 @@ static int DisplayPendingAnchor( intf_thread_t *p_intf, vout_thread_t *p_vout )
 static int InitThread( intf_thread_t * p_intf )
 {
     /* We might need some locking here */
-    if( !p_intf->b_die )
+    if( vlc_object_alive (p_intf) )
     {
         input_thread_t * p_input;
         decoder_t *p_cmml_decoder;
@@ -436,13 +435,7 @@ static void FollowAnchor ( intf_thread_t *p_intf )
         mtime_t i_seconds;
         vlc_value_t time;
 
-        p_playlist = (playlist_t *) vlc_object_find( p_intf,
-                VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
-        if ( !p_playlist )
-        {
-            msg_Warn( p_intf, "can't find playlist" );
-            return;
-        }
+        p_playlist = pl_Yield( p_intf );
 
         /* Get new URL */
         p_current_item = p_playlist->status.p_item;
@@ -517,7 +510,7 @@ static void FollowAnchor ( intf_thread_t *p_intf )
             msg_Dbg( p_intf, "calling browser_Open with \"%s\"", psz_url );
 #endif
             (void) browser_Open( psz_url );
-            playlist_Control( p_playlist, PLAYLIST_PAUSE, true, 0 );
+            playlist_Control( p_playlist, PLAYLIST_PAUSE, false, 0 );
         }
 
         free( psz_uri_to_load );
@@ -645,13 +638,7 @@ void GoBack( intf_thread_t *p_intf )
 #endif
 
     /* Find the playlist */
-    p_playlist = (playlist_t *) vlc_object_find( p_intf,
-            VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
-    if ( !p_playlist )
-    {
-        msg_Warn( p_intf, "can't find playlist" );
-        return;
-    }
+    p_playlist = pl_Yield( p_intf );
 
     /* Retrieve navigation history from playlist */
     if( var_Get( p_playlist, "navigation-history", &history ) != VLC_SUCCESS ||
@@ -723,13 +710,7 @@ void GoForward( intf_thread_t *p_intf )
 #endif
 
     /* Find the playlist */
-    p_playlist = (playlist_t *) vlc_object_find( p_intf,
-            VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
-    if ( !p_playlist )
-    {
-        msg_Warn( p_intf, "can't find playlist" );
-        return;
-    }
+    p_playlist = pl_Yield( p_intf );
 
     /* Retrieve navigation history from playlist */
     if( var_Get( p_playlist, "navigation-history", &history ) != VLC_SUCCESS ||