]> git.sesse.net Git - vlc/blobdiff - src/playlist/search.c
Clean up
[vlc] / src / playlist / search.c
index 659b9a4f375bd41cab3b94492964ff35eefc9a24..c831566e3327ba24080e5c511e23fcc843da1d4f 100644 (file)
@@ -81,6 +81,29 @@ playlist_item_t * playlist_ItemGetByInput( playlist_t * p_playlist ,
     return NULL;
 }
 
+/** Find the playlist item matching the input id under the given node */
+playlist_item_t * playlist_ItemGetByInputId( playlist_t *p_playlist,
+                                             int i_input_id,
+                                             playlist_item_t *p_root )
+{
+    int i;
+    assert( p_root != NULL );
+    for( i = 0 ; i< p_root->i_children ; i++ )
+    {
+        if( p_root->pp_children[i]->i_children == -1 &&
+            p_root->pp_children[i]->p_input->i_id == i_input_id )
+        {
+            return p_root->pp_children[i];
+        }
+        else if( p_root->pp_children[i]->i_children >= 0 )
+        {
+            return playlist_ItemGetByInputId( p_playlist, i_input_id,
+                                              p_root->pp_children[i] );
+        }
+    }
+    return NULL;
+}
+
 /***************************************************************************
  * Live search handling
  ***************************************************************************/