[vlc-devel] commit: Make the playlist a generic object ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Jun 14 16:09:48 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sat Jun 14 17:08:58 2008 +0300| [d01611b8bf53f270ba24762b2db465ea38b196bb]

Make the playlist a generic object

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

 modules/misc/lua/objects.c |    1 -
 src/input/control.c        |   12 +++++-------
 src/input/es_out.c         |    7 +++----
 src/playlist/engine.c      |    2 +-
 4 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/modules/misc/lua/objects.c b/modules/misc/lua/objects.c
index 98cc772..c492d5a 100644
--- a/modules/misc/lua/objects.c
+++ b/modules/misc/lua/objects.c
@@ -110,7 +110,6 @@ static int vlc_object_type_from_string( const char *psz_name )
         { { VLC_OBJECT_LIBVLC, "libvlc" },
           { VLC_OBJECT_MODULE, "module" },
           { VLC_OBJECT_INTF, "intf" },
-          { VLC_OBJECT_PLAYLIST, "playlist" },
           { VLC_OBJECT_INPUT, "input" },
           { VLC_OBJECT_DECODER, "decoder" },
           { VLC_OBJECT_VOUT, "vout" },
diff --git a/src/input/control.c b/src/input/control.c
index 1cc08d5..50e196f 100644
--- a/src/input/control.c
+++ b/src/input/control.c
@@ -615,13 +615,11 @@ static void NotifyPlaylist( input_thread_t *p_input )
     /* FIXME: We need to avoid that dependency on the playlist
      * because it is a circular dependency:
      * ( playlist -> input -> playlist ) */
-    playlist_t *p_playlist = vlc_object_find( p_input,
-                    VLC_OBJECT_PLAYLIST, FIND_PARENT );
-    if( !p_playlist )
-        return;
-    var_SetInteger( p_playlist, "item-change",
-                    p_input->p->input.p_item->i_id );
-    vlc_object_release( p_playlist );
+    playlist_t *p_playlist = pl_Yield( p_input );
+    if( VLC_OBJECT(p_playlist) == p_input->p_parent )
+        var_SetInteger( p_playlist, "item-change",
+                        p_input->p->input.p_item->i_id );
+    pl_Release( p_input );
 }
 
 static void UpdateBookmarksOption( input_thread_t *p_input )
diff --git a/src/input/es_out.c b/src/input/es_out.c
index ef96547..3afcc2d 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -1690,16 +1690,15 @@ static int EsOutControl( es_out_t *out, int i_query, va_list args )
             }
             {
                 /* FIXME: we don't want to depend on the playlist */
-                playlist_t * p_playlist = vlc_object_find( p_sys->p_input,
-                    VLC_OBJECT_PLAYLIST, FIND_PARENT );
-                if( p_playlist )
+                playlist_t * p_playlist = pl_Yield( p_sys->p_input );
+                if( VLC_OBJECT(p_playlist) == p_sys->p_input )
                 {
                     PL_LOCK;
                     p_playlist->gc_date = mdate();
                     vlc_object_signal_unlocked( p_playlist );
                     PL_UNLOCK;
-                    vlc_object_release( p_playlist );
                 }
+                pl_Release( p_sys->p_input );
             }
             return VLC_SUCCESS;
  
diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index 6814480..00df03d 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -66,7 +66,7 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
 
     /* Allocate structure */
     p_playlist = vlc_custom_create( p_parent, sizeof( *p_playlist ),
-                                    VLC_OBJECT_PLAYLIST, playlist_name );
+                                    VLC_OBJECT_GENERIC, playlist_name );
     if( !p_playlist )
     {
         msg_Err( p_parent, "out of memory" );




More information about the vlc-devel mailing list