[vlc-devel] commit: Attach the sout object to libvlc ( Rafaël Carré )

git version control git at videolan.org
Sun Apr 20 21:07:53 CEST 2008


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Sun Apr 20 21:08:35 2008 +0200| [42a0d047849f391a75432dfdf5d71523d6ec08c7]

Attach the sout object to libvlc

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=42a0d047849f391a75432dfdf5d71523d6ec08c7
---

 src/input/input.c |   44 ++++++++++++--------------------------------
 1 files changed, 12 insertions(+), 32 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index 0065b71..ad162a9 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1413,32 +1413,20 @@ static sout_instance_t *SoutFind( vlc_object_t *p_parent, input_item_t *p_item,
      * XXX it might be unusable but this will be checked later */
     if( b_keep_sout )
     {
-        /* Remove the sout from the playlist garbage collector */
-        /* FIXME: we don't want to depend on the playlist, sout
-         * should be attached to libvlc */
-        playlist_t * p_playlist = vlc_object_find( p_parent,
-            VLC_OBJECT_PLAYLIST, FIND_PARENT );
-        if( p_playlist )
+        p_sout = vlc_object_find( p_parent->p_libvlc, VLC_OBJECT_SOUT,
+                                                      FIND_CHILD );
+        if( p_sout )
         {
-            vlc_mutex_lock( &p_playlist->gc_lock );
-            p_sout = vlc_object_find( p_playlist, VLC_OBJECT_SOUT, FIND_CHILD );
-            if( p_sout )
+            if( p_sout->p_parent != VLC_OBJECT( p_sout->p_libvlc ) )
             {
-                if( p_sout->p_parent != VLC_OBJECT(p_playlist) )
-                {
-                    vlc_object_release( p_sout );
-                    p_sout = NULL;
-                }
-                else
-                {
-                    vlc_object_detach( p_sout );    /* Remove it from the GC */
-
-                    vlc_object_release( p_sout );
-                }
+                vlc_object_release( p_sout );
+                p_sout = NULL;
+            }
+            else
+            {
+                vlc_object_detach( p_sout );    /* Remove it from the GC */
+                vlc_object_release( p_sout );
             }
-            vlc_mutex_unlock( &p_playlist->gc_lock );
-
-            vlc_object_release( p_playlist );
         }
     }
 
@@ -1450,16 +1438,8 @@ static sout_instance_t *SoutFind( vlc_object_t *p_parent, input_item_t *p_item,
 
 static void SoutKeep( sout_instance_t *p_sout )
 {
-    /* FIXME: we don't want to depend on the playlist, sout
-     * should be attached to libvlc */
-    playlist_t * p_playlist = vlc_object_find( p_sout, VLC_OBJECT_PLAYLIST,
-                                               FIND_PARENT );
-    if( !p_playlist ) return;
-
     msg_Dbg( p_sout, "sout has been kept" );
-    vlc_object_attach( p_sout, p_playlist );
-
-    pl_Release( p_sout );
+    vlc_object_attach( p_sout, p_sout->p_libvlc );
 }
 
 /*****************************************************************************




More information about the vlc-devel mailing list