Ejemplo n.º 1
0
/**
 * Create a playlist node
 *
 * \param p_playlist the playlist
 * \param psz_name the name of the node
 * \param p_parent the parent node to attach to or NULL if no attach
 * \param i_pos position of the node in the parent, PLAYLIST_END to append to end.
 * \param p_flags miscellaneous flags
 * \param p_input the input_item to attach to or NULL if it has to be created
 * \return the new node
 */
playlist_item_t * playlist_NodeCreate( playlist_t *p_playlist,
                                       const char *psz_name,
                                       playlist_item_t *p_parent, int i_pos,
                                       int i_flags, input_item_t *p_input )
{
    input_item_t *p_new_input = NULL;
    playlist_item_t *p_item;

    PL_ASSERT_LOCKED;
    if( !psz_name ) psz_name = _("Undefined");

    if( !p_input )
        p_new_input = input_item_NewWithType( NULL, psz_name, 0, NULL, 0, -1,
                                              ITEM_TYPE_NODE );
    p_item = playlist_ItemNewFromInput( p_playlist,
                                        p_input ? p_input : p_new_input );
    if( p_new_input )
        vlc_gc_decref( p_new_input );

    if( p_item == NULL )  return NULL;
    p_item->i_children = 0;

    ARRAY_APPEND(p_playlist->all_items, p_item);

    if( p_parent != NULL )
        playlist_NodeInsert( p_playlist, p_item, p_parent,
                             i_pos == PLAYLIST_END ? -1 : i_pos );
    playlist_SendAddNotify( p_playlist, p_item->i_id,
                            p_parent ? p_parent->i_id : -1,
                            !( i_flags & PLAYLIST_NO_REBUILD ));

    p_item->i_flags |= i_flags;

    return p_item;
}
Ejemplo n.º 2
0
Archivo: item.c Proyecto: BossKing/vlc
/* Add the playlist item to the requested node and fire a notification */
static void AddItem( playlist_t *p_playlist, playlist_item_t *p_item,
                     playlist_item_t *p_node, int i_mode, int i_pos )
{
    PL_ASSERT_LOCKED;
    ARRAY_APPEND(p_playlist->items, p_item);
    ARRAY_APPEND(p_playlist->all_items, p_item);

    if( i_pos == PLAYLIST_END )
        playlist_NodeAppend( p_playlist, p_item, p_node );
    else
        playlist_NodeInsert( p_playlist, p_item, p_node, i_pos );

    playlist_SendAddNotify( p_playlist, p_item->i_id, p_node->i_id,
                            !( i_mode & PLAYLIST_NO_REBUILD ) );
}
Ejemplo n.º 3
0
/* Add the playlist item to the requested node and fire a notification */
static void AddItem( playlist_t *p_playlist, playlist_item_t *p_item,
                     playlist_item_t *p_node, int i_mode, int i_pos )
{
    PL_ASSERT_LOCKED;
    ARRAY_APPEND((playlist_item_t **), p_playlist->items, p_item);			// sunqueen modify
    ARRAY_APPEND((playlist_item_t **), p_playlist->all_items, p_item);			// sunqueen modify

    if( i_pos == PLAYLIST_END )
        playlist_NodeAppend( p_playlist, p_item, p_node );
    else
        playlist_NodeInsert( p_playlist, p_item, p_node, i_pos );

    if( !pl_priv(p_playlist)->b_doing_ml )
        playlist_SendAddNotify( p_playlist, p_item->i_id, p_node->i_id,
                                 !( i_mode & PLAYLIST_NO_REBUILD ) );
}