Commit 9e7dd0b4 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

playlist: move i_nb_played to playlist item, not the input item

This is accessed with the playlock lock anyway.
parent 9c221023
......@@ -74,7 +74,6 @@ struct input_item_t
es_format_t **es; /**< Es formats */
input_stats_t *p_stats; /**< Statistics */
int i_nb_played; /**< Number of times played */
vlc_meta_t *p_meta;
......
......@@ -138,6 +138,7 @@ struct playlist_item_t
playlist_item_t **pp_children; /**< Children nodes/items */
playlist_item_t *p_parent; /**< Item parent */
int i_children; /**< Number of children, -1 if not a node */
unsigned i_nb_played; /**< Times played */
int i_id; /**< Playlist item specific id */
uint8_t i_flags; /**< Flags \see playlist_item_flags_e */
......
......@@ -233,7 +233,7 @@ static void push_playlist_item( lua_State *L, playlist_item_t *p_item )
else
lua_pushnumber( L, ((double)p_input->i_duration)*1e-6 );
lua_setfield( L, -2, "duration" );
lua_pushinteger( L, p_input->i_nb_played );
lua_pushinteger( L, p_item->i_nb_played );
lua_setfield( L, -2, "nb_played" );
luaopen_input_item( L, p_input );
/* TODO: add (optional) info categories, meta, options, es */
......
......@@ -851,7 +851,6 @@ input_item_NewWithType( const char *psz_uri, const char *psz_name,
TAB_INIT( p_input->i_categories, p_input->pp_categories );
TAB_INIT( p_input->i_es, p_input->es );
p_input->p_stats = NULL;
p_input->i_nb_played = 0;
p_input->p_meta = NULL;
TAB_INIT( p_input->i_epg, p_input->pp_epg );
......
......@@ -237,6 +237,7 @@ playlist_item_t *playlist_ItemNewFromInput( playlist_t *p_playlist,
p_item->p_parent = NULL;
p_item->i_children = -1;
p_item->pp_children = NULL;
p_item->i_nb_played = 0;
p_item->i_flags = 0;
p_item->p_playlist = p_playlist;
......
......@@ -201,7 +201,7 @@ static void PlayItem( playlist_t *p_playlist, playlist_item_t *p_item )
msg_Dbg( p_playlist, "creating new input thread" );
p_input->i_nb_played++;
p_item->i_nb_played++;
set_current_status_item( p_playlist, p_item );
p_sys->status.i_status = PLAYLIST_RUNNING;
......
......@@ -323,7 +323,7 @@ playlist_item_t *playlist_GetNextLeaf( playlist_t *p_playlist,
{
if( b_ena && p_next->i_flags & PLAYLIST_DBL_FLAG )
b_ena_ok = false;
if( b_unplayed && p_next->p_input->i_nb_played != 0 )
if( b_unplayed && p_next->i_nb_played != 0 )
b_unplayed_ok = false;
if( b_ena_ok && b_unplayed_ok ) break;
}
......@@ -364,7 +364,7 @@ playlist_item_t *playlist_GetPrevLeaf( playlist_t *p_playlist,
{
if( b_ena && p_prev->i_flags & PLAYLIST_DBL_FLAG )
b_ena_ok = false;
if( b_unplayed && p_prev->p_input->i_nb_played != 0 )
if( b_unplayed && p_prev->i_nb_played != 0 )
b_unplayed_ok = false;
if( b_ena_ok && b_unplayed_ok ) break;
}
......
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