Commit 6fbe51ed authored by Clément Stenac's avatar Clément Stenac

Enqueue the item ID instead of pointer for preparse

Add a PLAYLIST_PREPARSE flag to tell that the item must be enqueued for preparse on add (not implemented yet).

Refs:#192
parent 42ad19a6
......@@ -142,6 +142,7 @@ struct vlc_list_t
#define PLAYLIST_APPEND 0x0004
#define PLAYLIST_GO 0x0008
#define PLAYLIST_CHECK_INSERT 0x0010
#define PLAYLIST_PREPARSE 0x0020
#define PLAYLIST_END -666
......
......@@ -136,7 +136,7 @@ struct playlist_preparse_t
VLC_COMMON_MEMBERS
vlc_mutex_t lock;
int i_waiting;
input_item_t **pp_waiting;
int *pi_waiting;
};
......
......@@ -558,7 +558,8 @@ static int ReadDir( playlist_t *p_playlist, const char *psz_name,
playlist_NodeAddItem( p_playlist,p_item,
p_parent->pp_parents[0]->i_view,
p_parent,
PLAYLIST_APPEND, PLAYLIST_END );
PLAYLIST_APPEND | PLAYLIST_PREPARSE,
PLAYLIST_END );
playlist_CopyParents( p_parent, p_item );
}
......
......@@ -198,7 +198,7 @@ playlist_t * __playlist_Create ( vlc_object_t *p_parent )
// Preparse
p_playlist->p_preparse->i_waiting = 0;
p_playlist->p_preparse->pp_waiting = NULL;
p_playlist->p_preparse->pi_waiting = NULL;
// Interaction
p_playlist->p_interaction = NULL;
......@@ -486,10 +486,10 @@ int playlist_PreparseEnqueue( playlist_t *p_playlist,
input_item_t *p_item )
{
vlc_mutex_lock( &p_playlist->p_preparse->object_lock );
INSERT_ELEM( p_playlist->p_preparse->pp_waiting,
INSERT_ELEM( p_playlist->p_preparse->pi_waiting,
p_playlist->p_preparse->i_waiting,
p_playlist->p_preparse->i_waiting,
p_item );
p_item->i_id );
vlc_mutex_unlock( &p_playlist->p_preparse->object_lock );
return VLC_SUCCESS;
}
......@@ -501,10 +501,10 @@ void playlist_PreparseEnqueueItemSub( playlist_t *p_playlist,
int i;
if( p_item->i_children == -1 )
{
INSERT_ELEM( p_playlist->p_preparse->pp_waiting,
INSERT_ELEM( p_playlist->p_preparse->pi_waiting,
p_playlist->p_preparse->i_waiting,
p_playlist->p_preparse->i_waiting,
&(p_item->input) );
(p_item->input.i_id) );
}
else
{
......@@ -842,11 +842,22 @@ static void RunPreparse ( playlist_preparse_t *p_obj )
if( p_obj->i_waiting > 0 )
{
input_item_t *p_current = p_obj->pp_waiting[0];
REMOVE_ELEM( p_obj->pp_waiting, p_obj->i_waiting, 0 );
int i_current_id = p_obj->pi_waiting[0];
playlist_item_t *p_current;
REMOVE_ELEM( p_obj->pi_waiting, p_obj->i_waiting, 0 );
vlc_mutex_unlock( &p_obj->object_lock );
input_Preparse( p_playlist, p_current );
var_SetInteger( p_playlist, "item-change", p_current->i_id );
vlc_mutex_lock( &p_playlist->object_lock );
p_current = playlist_ItemGetById( p_playlist, i_current_id );
if( p_current )
{
input_Preparse( p_playlist, &p_current->input );
vlc_mutex_unlock( &p_playlist->object_lock );
var_SetInteger( p_playlist, "item-change",
p_current->input.i_id );
}
else
vlc_mutex_unlock( &p_playlist->object_lock );
vlc_mutex_lock( &p_obj->object_lock );
}
b_sleep = ( p_obj->i_waiting == 0 );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment