- *** Improve random mode and fix loop<br />\r
- * "Name finder"<br />\r
- * "Protocol rollover" node<br />\r
- - *** Fix autodeletion<br />\r
- *** Item moving/copying facilities<br />\r
- *** Live directory representation<br /> \r
- Helper modules<br />\r
Status: Todo\r
\r
\r
-\r
# Do not remove me\r
Task\r
VLC_EXPORT( playlist_item_t* , __playlist_ItemNew, ( vlc_object_t *,const char *,const char * ) );
VLC_EXPORT( void, playlist_ItemDelete, ( playlist_item_t * ) );
VLC_EXPORT( void, playlist_ItemAddParent, ( playlist_item_t *, int,playlist_item_t *) );
+VLC_EXPORT( void, playlist_CopyParents, ( playlist_item_t *,playlist_item_t *) );
/* Item informations accessors */
VLC_EXPORT( int, playlist_ItemSetName, (playlist_item_t *, char * ) );
VLC_EXPORT( int, playlist_ItemSetDuration, (playlist_item_t *, mtime_t ) );
DIR * p_current_dir;
struct dirent * p_dir_content;
playlist_item_t *p_node;
- int i;
/* Change the item to a node */
if( p_parent->i_children == -1)
p_parent->pp_parents[0]->i_view,
psz_uri, p_parent );
+ playlist_CopyParents( p_parent, p_node );
+
p_node->input.i_type = ITEM_TYPE_DIRECTORY;
- /* We need to declare the parents of the node as the
- * same of the parent's ones */
- for( i= 1 ; i< p_parent->i_parents; i ++ )
- {
- playlist_ItemAddParent( p_node,
- p_parent->pp_parents[i]->i_view,
- p_parent );
- }
+
if( ReadDir( p_playlist, psz_uri , MODE_EXPAND,
pi_position, p_node ) != VLC_SUCCESS )
{
{
playlist_item_t *p_item = playlist_ItemNew( p_playlist,
psz_uri, p_dir_content->d_name );
- fprintf(stderr,"STARTTTTt\n");
playlist_NodeAddItem( p_playlist,p_item,
p_parent->pp_parents[0]->i_view,
p_parent,
PLAYLIST_APPEND, PLAYLIST_END );
- fprintf(stderr,"DONE\n");
- /* We need to declare the parents of the node as the
- * same of the parent's ones */
- for( i= 1 ; i< p_parent->i_parents; i ++ )
- {
- playlist_ItemAddParent( p_item,
- p_parent->pp_parents[i]->i_view,
- p_parent );
- }
+
+ playlist_CopyParents( p_parent, p_item );
}
}
free( psz_uri );
p_playlist = (playlist_t *)vlc_object_find( p_demux, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
+ p_playlist->status.p_item->i_flags |= PLAYLIST_DEL_FLAG;
+
playlist_Add( p_playlist, p_sdp->psz_uri, p_sdp->psz_sessionname,
PLAYLIST_APPEND, PLAYLIST_END );
}
}
+/**
+ * Copy all parents from parent to child
+ */
+void playlist_CopyParents( playlist_item_t *p_parent,
+ playlist_item_t *p_child )
+{
+ int i=0;
+ for( i= 0 ; i< p_parent->i_parents; i ++ )
+ {
+ playlist_ItemAddParent( p_child,
+ p_parent->pp_parents[i]->i_view,
+ p_parent );
+ }
+}
+
/**********************************************************************
* playlist_item_t structure accessors
mtime_t i_vout_destroyed_date = 0;
mtime_t i_sout_destroyed_date = 0;
- playlist_item_t *p_autodelete_item = 0;
+ playlist_item_t *p_autodelete_item = NULL;
/* Tell above that we're ready */
vlc_thread_ready( p_playlist );
i_vout_destroyed_date = 0;
i_sout_destroyed_date = 0;
- /* Check for autodeletion */
- if( p_autodelete_item )
- {
- playlist_ItemDelete( p_autodelete_item );
- p_autodelete_item = 0;
- }
-
continue;
}
/* This input is dying, let him do */
{
/* TODO FIXME XXX TODO FIXME XXX */
/* Check for autodeletion */
- input_StopThread( p_playlist->p_input );
if( p_playlist->status.p_item->i_flags & PLAYLIST_DEL_FLAG )
{
- /* This ain't pretty but hey it works */
p_autodelete_item = p_playlist->status.p_item;
- p_playlist->status.p_item =
- playlist_ItemNew( p_playlist,
- p_autodelete_item->input.psz_uri, 0);
-
- vlc_mutex_unlock( &p_playlist->object_lock );
-
- playlist_Delete( p_playlist,
- p_playlist->status.p_item->input.i_id );
- p_playlist->request.i_skip = 1;
- p_playlist->status.i_status = PLAYLIST_RUNNING;
-
- vlc_mutex_lock( &p_playlist->object_lock );
- }
- else
- {
- /* Select the next playlist item */
- input_StopThread( p_playlist->p_input );
- vlc_mutex_unlock( &p_playlist->object_lock );
- continue;
}
+ input_StopThread( p_playlist->p_input );
+ /* Select the next playlist item */
+ vlc_mutex_unlock( &p_playlist->object_lock );
+ continue;
}
else if( p_playlist->p_input->i_state != INIT_S )
{
* Get the next item to play */
p_item = NextItem( p_playlist );
+
/* We must stop */
if( p_item == NULL )
{
+ if( p_autodelete_item )
+ {
+ vlc_mutex_unlock( &p_playlist->object_lock );
+ playlist_Delete( p_playlist,
+ p_autodelete_item->input.i_id );
+ vlc_mutex_lock( &p_playlist->object_lock );
+ p_autodelete_item = NULL;
+ }
p_playlist->status.i_status = PLAYLIST_STOPPED;
vlc_mutex_unlock( &p_playlist->object_lock );
continue;
}
PlayItem( p_playlist, p_item );
+
+ if( p_autodelete_item )
+ {
+ vlc_mutex_unlock( &p_playlist->object_lock );
+ playlist_Delete( p_playlist, p_autodelete_item->input.i_id );
+ vlc_mutex_lock( &p_playlist->object_lock );
+ p_autodelete_item = NULL;
+ }
}
else if( p_playlist->status.i_status == PLAYLIST_STOPPED )
{