[vlc-devel] commit: Pass input item through playlist item-change rather than its ID ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat May 16 19:27:53 CEST 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat May 16 18:43:51 2009 +0300| [b9a26cf148fce9059881792b396e643a2a3fb568] | committer: Rémi Denis-Courmont 

Pass input item through playlist item-change rather than its ID

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

 modules/gui/skins2/src/vlcproc.cpp |    3 ++-
 modules/misc/notify/telepathy.c    |    4 +++-
 src/playlist/engine.c              |    3 +--
 src/playlist/fetcher.c             |    2 +-
 src/playlist/item.c                |    4 ++--
 src/playlist/preparser.c           |    2 +-
 6 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/modules/gui/skins2/src/vlcproc.cpp b/modules/gui/skins2/src/vlcproc.cpp
index 4c89015..8558f39 100644
--- a/modules/gui/skins2/src/vlcproc.cpp
+++ b/modules/gui/skins2/src/vlcproc.cpp
@@ -414,13 +414,14 @@ int VlcProc::onItemChange( vlc_object_t *pObj, const char *pVariable,
                            void *pParam )
 {
     VlcProc *pThis = (VlcProc*)pParam;
+    input_item_t *p_item = newval.p_address;
 
     // Update the stream variable
     pThis->updateStreamName();
 
     // Create a playtree notify command
     CmdPlaytreeUpdate *pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(),
-                                                         newVal.i_int );
+                                                         p_item->i_id );
 
     // Push the command in the asynchronous command queue
     AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
diff --git a/modules/misc/notify/telepathy.c b/modules/misc/notify/telepathy.c
index 7b55a8a..b6c01c8 100644
--- a/modules/misc/notify/telepathy.c
+++ b/modules/misc/notify/telepathy.c
@@ -183,7 +183,9 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
     }
     else
     {
-        if( newval.i_int != p_intf->p_sys->i_id ) /* "item-change" */
+        input_item_t *p_item = newval.p_address;
+
+        if( p_item->i_id != p_intf->p_sys->i_id ) /* "item-change" */
             return VLC_SUCCESS;
         /* Some variable bitrate inputs call "item-change callbacks each time
          * their length is updated, that is several times per second.
diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index c1d8065..f5139fa 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -272,8 +272,7 @@ static void VariablesInit( playlist_t *p_playlist )
     var_Create( p_playlist, "intf-change", VLC_VAR_BOOL );
     var_SetBool( p_playlist, "intf-change", true );
 
-    var_Create( p_playlist, "item-change", VLC_VAR_INTEGER );
-    var_SetInteger( p_playlist, "item-change", -1 );
+    var_Create( p_playlist, "item-change", VLC_VAR_ADDRESS );
 
     var_Create( p_playlist, "playlist-item-deleted", VLC_VAR_INTEGER );
     var_SetInteger( p_playlist, "playlist-item-deleted", -1 );
diff --git a/src/playlist/fetcher.c b/src/playlist/fetcher.c
index c9384b4..f8d8a42 100644
--- a/src/playlist/fetcher.c
+++ b/src/playlist/fetcher.c
@@ -419,7 +419,7 @@ static void *Thread( void *p_data )
         {
             PL_DEBUG( "found art for %s in cache", psz_name );
             input_item_SetArtFetched( p_item, true );
-            var_SetInteger( p_playlist, "item-change", p_item->i_id );
+            var_SetAddress( p_playlist, "item-change", p_item );
         }
         else
         {
diff --git a/src/playlist/item.c b/src/playlist/item.c
index 212ee75..4f8b2cd 100644
--- a/src/playlist/item.c
+++ b/src/playlist/item.c
@@ -117,7 +117,7 @@ static void input_item_changed( const vlc_event_t * p_event,
 {
     playlist_item_t *p_item = user_data;
     VLC_UNUSED( p_event );
-    var_SetInteger( p_item->p_playlist, "item-change", p_item->p_input->i_id );
+    var_SetAddress( p_item->p_playlist, "item-change", p_item->p_input );
 }
 
 /*****************************************************************************
@@ -625,7 +625,7 @@ static playlist_item_t *ItemToNode( playlist_t *p_playlist,
         }
         pl_priv(p_playlist)->b_reset_currently_playing = true;
         vlc_cond_signal( &pl_priv(p_playlist)->signal );
-        var_SetInteger( p_playlist, "item-change", p_item_in_category->p_input->i_id );
+        var_SetAddress( p_playlist, "item-change", p_item_in_category->p_input );
         PL_UNLOCK_IF( !b_locked );
         return p_item_in_category;
     }
diff --git a/src/playlist/preparser.c b/src/playlist/preparser.c
index 74b3961..f2cb232 100644
--- a/src/playlist/preparser.c
+++ b/src/playlist/preparser.c
@@ -130,7 +130,7 @@ static void Preparse( playlist_t *p_playlist, input_item_t *p_item )
         input_Preparse( VLC_OBJECT(p_playlist), p_item );
         input_item_SetPreparsed( p_item, true );
 
-        var_SetInteger( p_playlist, "item-change", p_item->i_id );
+        var_SetAddress( p_playlist, "item-change", p_item );
     }
 
     stats_TimerStop( p_playlist, STATS_TIMER_PREPARSE );




More information about the vlc-devel mailing list