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

📄 ncurses.c

📁 uclinux 下的vlc播放器源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
            /* Chapter */            if( !var_Get( p_input, "chapter", &val ) )            {                var_Change( p_input, "chapter", VLC_VAR_GETCHOICES, &val_list, NULL );                if( val_list.p_list->i_count > 0 )                {                    mvnprintw( y++, 0, COLS, " Chapter  : %d/%d", val.i_int, val_list.p_list->i_count );                }                var_Change( p_input, "chapter", VLC_VAR_FREELIST, &val_list, NULL );            }        }        else        {            y += 2;        }    }    else    {        mvnprintw( y++, 0, COLS, "Source: <no current item>" );        DrawEmptyLine( p_sys->w, y++, 0, COLS );        DrawEmptyLine( p_sys->w, y++, 0, COLS );        DrawEmptyLine( p_sys->w, y++, 0, COLS );    }    DrawBox( p_sys->w, y, 0, 3, COLS, "" );    DrawEmptyLine( p_sys->w, y+1, 1, COLS-2);    DrawLine( p_sys->w, y+1, 1, (int)(p_intf->p_sys->f_slider/100.0 * (COLS -2)) );    y += 3;    p_sys->i_box_y = y + 1;    p_sys->i_box_lines = LINES - y - 2;    h = LINES - y;    y_end = y + h - 1;    if( p_sys->i_box_type == BOX_HELP )    {        /* Help box */        int l = 0;        DrawBox( p_sys->w, y++, 0, h, COLS, " Help " );        MainBoxWrite( p_intf, l++, 1, "[Display]" );        MainBoxWrite( p_intf, l++, 1, "     h,H         Show/Hide help box" );        MainBoxWrite( p_intf, l++, 1, "     i           Show/Hide info box" );        MainBoxWrite( p_intf, l++, 1, "     L           Show/Hide messages box" );        MainBoxWrite( p_intf, l++, 1, "     P           Show/Hide playlist box" );        MainBoxWrite( p_intf, l++, 1, "     B           Show/Hide filebrowser" );        MainBoxWrite( p_intf, l++, 1, "" );        MainBoxWrite( p_intf, l++, 1, "[Global]" );        MainBoxWrite( p_intf, l++, 1, "     q, Q        Quit" );        MainBoxWrite( p_intf, l++, 1, "     s           Stop" );        MainBoxWrite( p_intf, l++, 1, "     <space>     Pause/Play" );        MainBoxWrite( p_intf, l++, 1, "     f           Toggle Fullscreen" );        MainBoxWrite( p_intf, l++, 1, "     n, p        Next/Previous playlist item" );        MainBoxWrite( p_intf, l++, 1, "     [, ]        Next/Previous title" );        MainBoxWrite( p_intf, l++, 1, "     <, >        Next/Previous chapter" );        MainBoxWrite( p_intf, l++, 1, "     <right>     Seek +1%%" );        MainBoxWrite( p_intf, l++, 1, "     <left>      Seek -1%%" );        MainBoxWrite( p_intf, l++, 1, "     a           Volume Up" );        MainBoxWrite( p_intf, l++, 1, "     z           Volume Down" );        MainBoxWrite( p_intf, l++, 1, "" );        MainBoxWrite( p_intf, l++, 1, "[Playlist]" );        MainBoxWrite( p_intf, l++, 1, "     r           Random" );        MainBoxWrite( p_intf, l++, 1, "     l           Loop Playlist" );        MainBoxWrite( p_intf, l++, 1, "     R           Repeat item" );        MainBoxWrite( p_intf, l++, 1, "     o           Order Playlist by title" );        MainBoxWrite( p_intf, l++, 1, "     O           Reverse order Playlist by title" );        MainBoxWrite( p_intf, l++, 1, "     /           Look for an item" );        MainBoxWrite( p_intf, l++, 1, "     A           Add an entry" );        MainBoxWrite( p_intf, l++, 1, "     D, <del>    Delete an entry" );        MainBoxWrite( p_intf, l++, 1, "     <backspace> Delete an entry" );        MainBoxWrite( p_intf, l++, 1, "" );        MainBoxWrite( p_intf, l++, 1, "[Filebrowser]" );        MainBoxWrite( p_intf, l++, 1, "     <enter>     Add the selected file to the playlist" );        MainBoxWrite( p_intf, l++, 1, "     <space>     Add the selected directory to the playlist" );        MainBoxWrite( p_intf, l++, 1, "     .           Show/Hide hidden files" );        MainBoxWrite( p_intf, l++, 1, "" );        MainBoxWrite( p_intf, l++, 1, "[Boxes]" );        MainBoxWrite( p_intf, l++, 1, "     <up>,<down>     Navigate through the box line by line" );        MainBoxWrite( p_intf, l++, 1, "     <pgup>,<pgdown> Navigate through the box page by page" );        MainBoxWrite( p_intf, l++, 1, "" );        MainBoxWrite( p_intf, l++, 1, "[Player]" );        MainBoxWrite( p_intf, l++, 1, "     <up>,<down>     Seek +/-5%%" );        MainBoxWrite( p_intf, l++, 1, "" );        MainBoxWrite( p_intf, l++, 1, "[Miscellaneous]" );        MainBoxWrite( p_intf, l++, 1, "     Ctrl-l          Refresh the screen" );        p_sys->i_box_lines_total = l;        if( p_sys->i_box_start >= p_sys->i_box_lines_total )        {            p_sys->i_box_start = p_sys->i_box_lines_total - 1;        }        if( l - p_sys->i_box_start < p_sys->i_box_lines )        {            y += l - p_sys->i_box_start;        }        else        {            y += p_sys->i_box_lines;        }    }    else if( p_sys->i_box_type == BOX_INFO )    {        /* Info box */        int l = 0;        DrawBox( p_sys->w, y++, 0, h, COLS, " Information " );        if( p_input )        {            int i,j;            vlc_mutex_lock( &p_input->input.p_item->lock );            for( i = 0; i < p_input->input.p_item->i_categories; i++ )            {                info_category_t *p_category = p_input->input.p_item->pp_categories[i];                if( y >= y_end ) break;                MainBoxWrite( p_intf, l++, 1, "  [%s]", p_category->psz_name );                for( j = 0; j < p_category->i_infos; j++ )                {                    info_t *p_info = p_category->pp_infos[j];                    if( y >= y_end ) break;                    MainBoxWrite( p_intf, l++, 1, "      %s: %s", p_info->psz_name, p_info->psz_value );                }            }            vlc_mutex_unlock( &p_input->input.p_item->lock );        }        else        {            MainBoxWrite( p_intf, l++, 1, "No item currently playing" );        }        p_sys->i_box_lines_total = l;        if( p_sys->i_box_start >= p_sys->i_box_lines_total )        {            p_sys->i_box_start = p_sys->i_box_lines_total - 1;        }        if( l - p_sys->i_box_start < p_sys->i_box_lines )        {            y += l - p_sys->i_box_start;        }        else        {            y += p_sys->i_box_lines;        }    }    else if( p_sys->i_box_type == BOX_LOG )    {        int i_line = 0;        int i_stop;        int i_start;        DrawBox( p_sys->w, y++, 0, h, COLS, " Logs " );        i_start = p_intf->p_sys->p_sub->i_start;        vlc_mutex_lock( p_intf->p_sys->p_sub->p_lock );        i_stop = *p_intf->p_sys->p_sub->pi_stop;        vlc_mutex_unlock( p_intf->p_sys->p_sub->p_lock );        for( ;; )        {            static const char *ppsz_type[4] = { "", "error", "warning", "debug" };            if( i_line >= h - 2 )            {                break;            }            i_stop--;            i_line++;            if( i_stop < 0 ) i_stop += VLC_MSG_QSIZE;            if( i_stop == i_start )            {                break;            }            mvnprintw( y + h-2-i_line, 1, COLS - 2, "   [%s] %s",                      ppsz_type[p_sys->p_sub->p_msg[i_stop].i_type],                      p_sys->p_sub->p_msg[i_stop].psz_msg );        }        vlc_mutex_lock( p_intf->p_sys->p_sub->p_lock );        p_intf->p_sys->p_sub->i_start = i_stop;        vlc_mutex_unlock( p_intf->p_sys->p_sub->p_lock );        y = y_end;    }    else if( p_sys->i_box_type == BOX_BROWSE )    {        /* Filebrowser box */        int        i_start, i_stop;        int        i_item;        DrawBox( p_sys->w, y++, 0, h, COLS, " Browse " );        if( p_sys->i_box_bidx >= p_sys->i_dir_entries ) p_sys->i_box_plidx = p_sys->i_dir_entries - 1;        if( p_sys->i_box_bidx < 0 ) p_sys->i_box_bidx = 0;        if( p_sys->i_box_bidx < (h - 2)/2 )        {            i_start = 0;            i_stop = h - 2;        }        else if( p_sys->i_dir_entries - p_sys->i_box_bidx > (h - 2)/2 )        {            i_start = p_sys->i_box_bidx - (h - 2)/2;            i_stop = i_start + h - 2;        }        else        {            i_stop = p_sys->i_dir_entries;            i_start = p_sys->i_dir_entries - (h - 2);        }        if( i_start < 0 )        {            i_start = 0;        }        if( i_stop > p_sys->i_dir_entries )        {            i_stop = p_sys->i_dir_entries;        }        for( i_item = i_start; i_item < i_stop; i_item++ )        {            vlc_bool_t b_selected = ( p_sys->i_box_bidx == i_item );            if( y >= y_end ) break;            if( b_selected )            {                attrset( A_REVERSE );            }            mvnprintw( y++, 1, COLS - 2, " %c %s", p_sys->pp_dir_entries[i_item]->b_file == VLC_TRUE ? ' ' : '+',                            p_sys->pp_dir_entries[i_item]->psz_path );            if( b_selected )            {                attroff( A_REVERSE );            }        }    }    else if( ( p_sys->i_box_type == BOX_PLAYLIST ||               p_sys->i_box_type == BOX_SEARCH ||               p_sys->i_box_type == BOX_OPEN  ) && p_sys->p_playlist )    {        /* Playlist box */        playlist_t *p_playlist = p_sys->p_playlist;        int        i_start, i_stop, i_max = p_sys->i_plist_entries;        int        i_item;        char       *psz_title;        switch( p_sys->i_current_view )        {            case VIEW_ALL:                psz_title = strdup( " Playlist (All, unsorted) " );                i_max = p_playlist->i_size;                break;            case VIEW_CATEGORY:                psz_title = strdup( " Playlist (By category) " );                break;            default:                psz_title = strdup( " Playlist (Manually added) " );        }        DrawBox( p_sys->w, y++, 0, h, COLS, psz_title );        if( p_sys->i_current_view != VIEW_ALL &&                ( p_sys->b_need_update || p_sys->pp_plist == NULL ) )        {            PlaylistRebuild( p_intf );        }        if( p_sys->b_box_plidx_follow )        {            FindIndex( p_intf );        }        if( p_sys->i_box_plidx < 0 ) p_sys->i_box_plidx = 0;        if( p_sys->i_box_plidx < (h - 2)/2 )        {            i_start = 0;            i_stop = h - 2;        }        else if( i_max - p_sys->i_box_plidx > (h - 2)/2 )        {            i_start = p_sys->i_box_plidx - (h - 2)/2;            i_stop = i_start + h - 2;        }        else        {            i_stop = i_max;            i_start = i_max - (h - 2);        }        if( i_start < 0 )        {            i_start = 0;        }        if( i_stop > i_max )        {            i_stop = i_max;        }       if( p_sys->i_current_view == VIEW_ALL )       {        for( i_item = i_start; i_item < i_stop; i_item++ )        {            vlc_bool_t b_selected = ( p_sys->i_box_plidx == i_item );            int c = p_playlist->i_index == i_item ? '>' : ' ';            if( y >= y_end ) break;            if( b_selected )            {                attrset( A_REVERSE );            }            if( !strcmp( p_playlist->pp_items[i_item]->input.psz_name,                         p_playlist->pp_items[i_item]->input.psz_uri ) )            {                mvnprintw( y++, 1, COLS - 2, "%c %d - '%s'",                           c,                           i_item,                           p_playlist->pp_items[i_item]->input.psz_uri );            }            else            {                mvnprintw( y++, 1, COLS - 2, "%c %d - '%s' (%s)",                          c,                          i_item,                          p_playlist->pp_items[i_item]->input.psz_uri,                          p_playlist->pp_items[i_item]->input.psz_name );            }            if( b_selected )            {                attroff( A_REVERSE );            }        }       }       else       {        for( i_item = i_start; i_item < i_stop; i_item++ )        {            vlc_bool_t b_selected = ( p_sys->i_box_plidx == i_item );            int c = ( p_playlist->status.p_item ==                          p_sys->pp_plist[i_item]->p_item ) ? '>' : ' ';            if( y >= y_end ) break;            if( b_selected )            {                attrset( A_REVERSE );            }            mvnprintw( y++, 1, COLS - 2, "%c%s", c,                       p_sys->pp_plist[i_item]->psz_display );            if( b_selected )            {                attroff( A_REVERSE );            }        }       }    }    else    {        y++;    }    if( p_sys->i_box_type == BOX_SEARCH )    {        DrawEmptyLine( p_sys->w, 7, 1, COLS-2 );        if( p_sys->psz_search_chain )        {            if( strlen( p_sys->psz_search_chain ) == 0 &&                p_sys->psz_old_search != NULL )            {                /* Searching next entry */                mvnprintw( 7, 1, COLS-2, "Find: %s", p_sys->psz_old_search );            }            else            {                mvnprintw( 7, 1, COLS-2, "Find: %s", p_sys->psz_search_chain );            }        }    }    if( p_sys->i_box_type == BOX_OPEN )    {        if( p_sys->psz_open_chain )        {            DrawEmptyLine( p_sys->w, 7, 1, COLS-2 );            mvnprintw( 7, 1, COLS-2, "Open: %s", p_sys->psz_open_chain );        }    }    while( y < y_end )    {        DrawEmptyLine( p_sys->w, y++, 1, COLS - 2 );    }    refresh();    *t_last_refresh = time( 0 );}static void PlaylistRebuild( intf_thread_t *p_intf ){    intf_sys_t *p_sys = p_intf->p_sys;    playlist_view_t *p_view;    playlist_t *p_playlist = p_sys->p_playlist;    if( p_playlist == NULL )    {        return;    }    vlc_mutex_lock( &p_playlist->object_lock );    p_view = playlist_ViewFind( p_playlist, p_intf->p_sys->i_current_view );    /* First clear the old one */    PlaylistDestroy( p_intf );

⌨️ 快捷键说明

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