⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 view.c

📁 uclinux 下的vlc播放器源代码
💻 C
📖 第 1 页 / 共 3 页
字号:
        return VLC_EGENERIC;    }    /* Delete the children */    for( i =  p_root->i_children-1 ; i >= 0 ;i-- )    {        if( p_root->pp_children[i]->i_children > -1 )        {            playlist_NodeDelete( p_playlist, p_root->pp_children[i],                                 b_delete_items , VLC_FALSE );        }        else if( b_delete_items )        {            /* Delete the item here */            playlist_Delete( p_playlist, p_root->pp_children[i]->input.i_id );        }    }    return VLC_SUCCESS;}/** * Remove all the children of a node and removes the node * * \param p_playlist the playlist * \param p_root the node * \param b_delete_items do we have to delete the children items ? * \return VLC_SUCCESS or an error */int playlist_NodeDelete( playlist_t *p_playlist, playlist_item_t *p_root,                         vlc_bool_t b_delete_items, vlc_bool_t b_force ){    int i, i_top, i_bottom;    if( p_root->i_children == -1 )    {        return VLC_EGENERIC;    }    /* Delete the children */    for( i =  p_root->i_children - 1 ; i >= 0; i-- )    {        if( p_root->pp_children[i]->i_children > -1 )        {            playlist_NodeDelete( p_playlist, p_root->pp_children[i],                                b_delete_items , b_force );        }        else if( b_delete_items )        {            /* Delete the item here */            playlist_Delete( p_playlist, p_root->pp_children[i]->input.i_id );        }    }    /* Delete the node */    if( p_root->i_flags & PLAYLIST_RO_FLAG && !b_force )    {    }    else    {        for( i = 0 ; i< p_root->i_parents; i++ )        {            playlist_NodeRemoveItem( p_playlist, p_root,                                     p_root->pp_parents[i]->p_parent );        }        var_SetInteger( p_playlist, "item-deleted", p_root->input.i_id );        i_bottom = 0; i_top = p_playlist->i_all_size - 1;        i = i_top / 2;        while( p_playlist->pp_all_items[i]->input.i_id != p_root->input.i_id &&               i_top > i_bottom )        {            if( p_playlist->pp_all_items[i]->input.i_id < p_root->input.i_id )            {                i_bottom = i + 1;            }            else            {                i_top = i - 1;            }            i = i_bottom + ( i_top - i_bottom ) / 2;        }        if( p_playlist->pp_all_items[i]->input.i_id == p_root->input.i_id )        {            REMOVE_ELEM( p_playlist->pp_all_items, p_playlist->i_all_size, i );        }        playlist_ItemDelete( p_root );    }    return VLC_SUCCESS;}/** * Adds an item to the childs of a node * * \param p_playlist the playlist * \param i_view the view of the node ( needed for parent search ) * \param p_item the item to append * \param p_parent the parent node * \return VLC_SUCCESS or an error */int playlist_NodeAppend( playlist_t *p_playlist,                         int i_view,                         playlist_item_t *p_item,                         playlist_item_t *p_parent ){    return playlist_NodeInsert( p_playlist, i_view, p_item, p_parent, -1 );}int playlist_NodeInsert( playlist_t *p_playlist,                         int i_view,                         playlist_item_t *p_item,                         playlist_item_t *p_parent,                         int i_position ){   int i;   vlc_bool_t b_found = VLC_FALSE;   if( !p_parent || p_parent->i_children == -1 )   {        msg_Err( p_playlist, "invalid node" );        return VLC_EGENERIC;   }   if( i_position == -1 ) i_position = p_parent->i_children ;   INSERT_ELEM( p_parent->pp_children,                p_parent->i_children,                i_position,                p_item );   /* Add the parent to the array */   for( i= 0; i< p_item->i_parents ; i++ )   {       if( p_item->pp_parents[i]->i_view == i_view )       {           b_found = VLC_TRUE;           break;       }   }   if( b_found == VLC_FALSE )   {        struct item_parent_t *p_ip = (struct item_parent_t *)                                     malloc(sizeof(struct item_parent_t) );        p_ip->i_view = i_view;        p_ip->p_parent = p_parent;        INSERT_ELEM( p_item->pp_parents,                     p_item->i_parents, p_item->i_parents,                     p_ip );   }   /* Let the interface know this has been updated */   p_parent->i_serial++;   return VLC_SUCCESS;}/** * Deletes a parent from the parent list of a node * * \param p_playlist the playlist * \param p_item the item to remove * \param p_parent the parent node * \return VLC_SUCCESS or an error */int playlist_NodeRemoveParent( playlist_t *p_playlist,                        playlist_item_t *p_item,                        playlist_item_t *p_parent ){   int i;   if( !p_parent || p_parent->i_children == -1 )   {        msg_Err( p_playlist, "invalid node" );   }   for( i = 0; i < p_item->i_parents; i++ )   {       if( p_item->pp_parents[i]->p_parent == p_parent )       {           if( p_item->pp_parents[i] )           {               free( p_item->pp_parents[i] );           }           REMOVE_ELEM( p_item->pp_parents, p_item->i_parents, i );       }   }   p_item->i_serial++;   return VLC_SUCCESS;}/** * Deletes an item from the children of a node * * \param p_playlist the playlist * \param p_item the item to remove * \param p_parent the parent node * \return VLC_SUCCESS or an error */int playlist_NodeRemoveItem( playlist_t *p_playlist,                        playlist_item_t *p_item,                        playlist_item_t *p_parent ){   int i;   for( i= 0; i< p_parent->i_children ; i++ )   {       if( p_parent->pp_children[i] == p_item )       {           REMOVE_ELEM( p_parent->pp_children, p_parent->i_children, i );       }   }   /* Let the interface know this has been updated */   p_parent->i_serial++;   return VLC_SUCCESS;}/** * Count the children of a node * * \param p_playlist the playlist * \param p_node the node * \return the number of children */int playlist_NodeChildrenCount( playlist_t *p_playlist, playlist_item_t*p_node){    int i;    int i_nb = 0;    if( p_node->i_children == -1 )    {        return 0;    }    i_nb += p_node->i_children;    for( i=0 ; i< p_node->i_children; i++ )    {        if( p_node->pp_children[i]->i_children == -1 )            break;        else        {            i_nb += playlist_NodeChildrenCount( p_playlist,                                                 p_node->pp_children[i] );        }    }    return i_nb;}/** * Search a child of a node by its name * * \param p_node the node * \param psz_search the name of the child to search * \return the child item or NULL if not found or error */playlist_item_t *playlist_ChildSearchName( playlist_item_t *p_node,                                           const char *psz_search ){    int i;    if( p_node->i_children < 0 )    {         return NULL;    }    for( i = 0 ; i< p_node->i_children; i++ )    {        if( !strcmp( p_node->pp_children[i]->input.psz_name, psz_search ) )        {            return p_node->pp_children[i];        }    }    return NULL;}/********************************************************************** * Tree functions **********************************************************************//** * Finds the next item to play * * \param p_playlist the playlist * \param i_view the view * \param p_root the root node * \param p_node the node we are playing from * \param p_item the item we were playing (NULL if none ) * \return the next item to play, or NULL if none found */playlist_item_t *playlist_FindNextFromParent( playlist_t *p_playlist,                                        int i_view, /* FIXME: useless */                                        playlist_item_t *p_root,                                        playlist_item_t *p_node,                                        playlist_item_t *p_item ){    playlist_item_t *p_search, *p_next;#ifdef PLAYLIST_DEBUG    if( p_item != NULL )    {        msg_Dbg( p_playlist, "finding next of %s within %s - root %s",                        p_item->input.psz_name, p_node->input.psz_name,                        p_root->input.psz_name );    }    else    {        msg_Dbg( p_playlist, "finding something to play within %s -root %s",                            p_node->input.psz_name, p_root->input.psz_name );    }#endif    if( !p_node  || p_node->i_children == -1 )    {        msg_Err( p_playlist,"invalid arguments for FindNextFromParent" );        return NULL;    }    /* Find the parent node of the item */    if( p_item != NULL )    {        p_search = playlist_FindDirectParent( p_playlist, p_item, i_view );        if( p_search == NULL )        {            msg_Err( p_playlist, "parent node not found" );            return NULL;        }    }    else    {        p_search = p_node;    }    /* Now, go up the tree until we find a suitable next item */    p_next = playlist_RecursiveFindNext( p_playlist,i_view,                                         p_node, p_item, p_search );    /* Not found, do we go past p_node ? */    if( p_next == NULL )    {        if( p_playlist->b_go_next )        {#ifdef PLAYLIST_DEBUG            msg_Dbg( p_playlist, "moving on to next node: search from %s",                            p_root->input.psz_name );#endif            p_next = playlist_RecursiveFindNext( p_playlist, i_view,                                p_root, p_item, p_search );            if( p_next == NULL )

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -