+static void input_item_subitem_added( const vlc_event_t * p_event,
+ void * user_data )
+{
+ playlist_item_t *p_parent_playlist_item = user_data;
+ playlist_t * p_playlist = p_parent_playlist_item->p_playlist;
+ input_item_t * p_parent, * p_child;
+ playlist_item_t * p_child_in_category;
+ playlist_item_t * p_item_in_category;
+ bool b_play;
+
+ p_parent = p_event->p_obj;
+ p_child = p_event->u.input_item_subitem_added.p_new_child;
+
+ PL_LOCK;
+ b_play = var_CreateGetBool( p_playlist, "playlist-autostart" );
+
+ /* This part is really hakish, but this playlist system isn't simple */
+ /* First check if we haven't already added the item as we are
+ * listening using the onelevel and the category representent
+ * (Because of the playlist design) */
+ p_child_in_category = playlist_ItemFindFromInputAndRoot(
+ p_playlist, p_child->i_id,
+ p_playlist->p_root_category,
+ false /* Only non-node */ );
+
+ if( !p_child_in_category )
+ {
+ /* Then, transform to a node if needed */
+ p_item_in_category = playlist_ItemFindFromInputAndRoot(
+ p_playlist, p_parent->i_id,
+ p_playlist->p_root_category,
+ false /* Only non-node */ );
+ if( !p_item_in_category )
+ {
+ /* Item may have been removed */
+ PL_UNLOCK;
+ return;
+ }
+
+ b_play = b_play &&
+ p_item_in_category == get_current_status_item( p_playlist );
+
+ /* If this item is already a node don't transform it */
+ if( p_item_in_category->i_children == -1 )
+ {
+ p_item_in_category = playlist_ItemToNode( p_playlist,
+ p_item_in_category, pl_Locked );
+ p_item_in_category->p_input->i_type = ITEM_TYPE_PLAYLIST;
+ }
+
+ int i_ret = playlist_BothAddInput( p_playlist, p_child,
+ p_item_in_category,
+ PLAYLIST_APPEND | PLAYLIST_SPREPARSE , PLAYLIST_END,
+ NULL, NULL, pl_Locked );
+
+ if( i_ret == VLC_SUCCESS && b_play )
+ {
+ playlist_Control( p_playlist, PLAYLIST_VIEWPLAY,
+ pl_Locked, p_item_in_category, NULL );
+ }
+ }
+
+ PL_UNLOCK;
+
+}
+
+/*****************************************************************************
+ * An input item's meta or duration has changed (Event Callback)
+ *****************************************************************************/
+static void input_item_changed( const vlc_event_t * p_event,
+ void * user_data )