Commit 22a9f08b authored by Jakob Leben's avatar Jakob Leben

lua: vlclua_playlist_add_internal() should post an input item tree

parent b48252ea
...@@ -392,12 +392,14 @@ int __vlclua_playlist_add_internal( vlc_object_t *p_this, lua_State *L, ...@@ -392,12 +392,14 @@ int __vlclua_playlist_add_internal( vlc_object_t *p_this, lua_State *L,
input_item_t *p_parent, bool b_play ) input_item_t *p_parent, bool b_play )
{ {
int i_count = 0; int i_count = 0;
input_item_node_t *p_parent_node = NULL;
assert( p_parent || p_playlist ); assert( p_parent || p_playlist );
/* playlist */ /* playlist */
if( lua_istable( L, -1 ) ) if( lua_istable( L, -1 ) )
{ {
if( p_parent ) p_parent_node = input_item_node_Create( p_parent );
lua_pushnil( L ); lua_pushnil( L );
/* playlist nil */ /* playlist nil */
while( lua_next( L, -2 ) ) while( lua_next( L, -2 ) )
...@@ -472,7 +474,7 @@ int __vlclua_playlist_add_internal( vlc_object_t *p_this, lua_State *L, ...@@ -472,7 +474,7 @@ int __vlclua_playlist_add_internal( vlc_object_t *p_this, lua_State *L,
/* Append item to playlist */ /* Append item to playlist */
if( p_parent ) /* Add to node */ if( p_parent ) /* Add to node */
{ {
input_item_PostSubItem( p_parent, p_input ); input_item_node_AppendItem( p_parent_node, p_input );
} }
else /* Play or Enqueue (preparse) */ else /* Play or Enqueue (preparse) */
/* FIXME: playlist_AddInput() can fail */ /* FIXME: playlist_AddInput() can fail */
...@@ -504,6 +506,11 @@ int __vlclua_playlist_add_internal( vlc_object_t *p_this, lua_State *L, ...@@ -504,6 +506,11 @@ int __vlclua_playlist_add_internal( vlc_object_t *p_this, lua_State *L,
/* playlist key */ /* playlist key */
} }
/* playlist */ /* playlist */
if( p_parent )
{
if( i_count ) input_item_node_PostAndDelete( p_parent_node );
else input_item_node_Delete( p_parent_node );
}
} }
else else
{ {
......
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