]> git.sesse.net Git - vlc/commitdiff
playlist: Listen to duration changed events, and remove a vout->playlist dependency.
authorPierre d'Herbemont <pdherbemont@videolan.org>
Sun, 1 Jun 2008 19:47:49 +0000 (21:47 +0200)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Sun, 1 Jun 2008 19:47:49 +0000 (21:47 +0200)
src/input/input.c
src/playlist/item.c

index 4ab5b55225e9298ef35c528a8f5c7fb60f03a2d8..9914457420f191c61a33d5db502ceb11a5f11347 100644 (file)
@@ -2162,14 +2162,6 @@ static int UpdateFromAccess( input_thread_t *p_input )
 static void UpdateItemLength( input_thread_t *p_input, int64_t i_length )
 {
     input_item_SetDuration( p_input->p->input.p_item, (mtime_t) i_length );
-
-    if( !p_input->b_preparsing )
-    {
-        pl_Yield( p_input );
-        var_SetInteger( libvlc_priv (p_input->p_libvlc)->p_playlist,
-                        "item-change", p_input->p->input.p_item->i_id );
-        pl_Release( p_input );
-    }
 }
 
 /*****************************************************************************
index c2bc35c68e684201445ef3f141941838df7b1bc6..1dee00b5a52847ff5db5261dad1eeb84d1aa8aa2 100644 (file)
@@ -107,10 +107,10 @@ static void input_item_subitem_added( const vlc_event_t * p_event,
 }
 
 /*****************************************************************************
- * An input item's meta has changed (Event Callback)
+ * An input item's meta or duration has changed (Event Callback)
  *****************************************************************************/
-static void input_item_meta_changed( const vlc_event_t * p_event,
-                                      void * user_data )
+static void input_item_changed( const vlc_event_t * p_event,
+                                void * user_data )
 {
     playlist_item_t * p_item = user_data;
     var_SetInteger( p_item->p_playlist,
@@ -126,6 +126,10 @@ static void install_input_item_observer( playlist_item_t * p_item )
                       vlc_InputItemSubItemAdded,
                       input_item_subitem_added,
                       p_item );
+    vlc_event_attach( &p_item->p_input->event_manager,
+                      vlc_InputItemDurationChanged,
+                      input_item_meta_changed,
+                      p_item );
     vlc_event_attach( &p_item->p_input->event_manager,
                       vlc_InputItemMetaChanged,
                       input_item_meta_changed,
@@ -138,6 +142,10 @@ static void uninstall_input_item_observer( playlist_item_t * p_item )
                       vlc_InputItemMetaChanged,
                       input_item_meta_changed,
                       p_item );
+    vlc_event_detach( &p_item->p_input->event_manager,
+                      vlc_InputItemDurationChanged,
+                      input_item_meta_changed,
+                      p_item );
     vlc_event_detach( &p_item->p_input->event_manager,
                       vlc_InputItemSubItemAdded,
                       input_item_subitem_added,