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

📄 info_panels.cpp

📁 VLC Player Source Code
💻 CPP
📖 第 1 页 / 共 2 页
字号:
    if( b_editing )emit editing();}/* * Clear all the metadata widgets */void MetaPanel::clear(){    title_text->clear();    artist_text->clear();    genre_text->clear();    copyright_text->clear();    collection_text->clear();    seqnum_text->clear();    description_text->clear();    date_text->clear();    language_text->clear();    nowplaying_text->clear();    publisher_text->clear();    art_cover->update( NULL );    setEditMode( false );}/** * Second Panel - Shows the extra metadata in a tree, non editable. **/ExtraMetaPanel::ExtraMetaPanel( QWidget *parent,                                intf_thread_t *_p_intf )                                : QWidget( parent ), p_intf( _p_intf ){     QGridLayout *layout = new QGridLayout(this);     QLabel *topLabel = new QLabel( qtr( "Extra metadata and other information"                 " are shown in this panel.\n" ) );     topLabel->setWordWrap( true );     layout->addWidget( topLabel, 0, 0 );     extraMetaTree = new QTreeWidget( this );     extraMetaTree->setAlternatingRowColors( true );     extraMetaTree->setColumnCount( 2 );     extraMetaTree->resizeColumnToContents( 0 );     extraMetaTree->header()->hide();/*     QStringList headerList = ( QStringList() << qtr( "Type" ) *                                             << qtr( "Value" ) ); * Useless, add this header if you think it would help the user          ** */     layout->addWidget( extraMetaTree, 1, 0 );}/** * Update the Extra Metadata from p_meta->i_extras **/void ExtraMetaPanel::update( input_item_t *p_item ){    QStringList tempItem;    QList<QTreeWidgetItem *> items;    extraMetaTree->clear();    vlc_mutex_lock( &p_item->lock );    vlc_meta_t *p_meta = p_item->p_meta;    if( !p_meta )    {        vlc_mutex_unlock( &p_item->lock );        return;    }    vlc_dictionary_t * p_dict = &p_meta->extra_tags;    char ** ppsz_allkey = vlc_dictionary_all_keys( p_dict );    for( int i = 0; ppsz_allkey[i] ; i++ )    {        const char * psz_value = (const char *)vlc_dictionary_value_for_key(                p_dict, ppsz_allkey[i] );        tempItem.append( qfu( ppsz_allkey[i] ) + " : ");        tempItem.append( qfu( psz_value ) );        items.append( new QTreeWidgetItem ( extraMetaTree, tempItem ) );        free( ppsz_allkey[i] );    }    vlc_mutex_unlock( &p_item->lock );    free( ppsz_allkey );    extraMetaTree->addTopLevelItems( items );    extraMetaTree->resizeColumnToContents( 0 );}/** * Clear the ExtraMetaData Tree **/void ExtraMetaPanel::clear(){    extraMetaTree->clear();}/** * Third panel - Stream info * Display all codecs and muxers info that we could gather. **/InfoPanel::InfoPanel( QWidget *parent,                      intf_thread_t *_p_intf )                      : QWidget( parent ), p_intf( _p_intf ){     QGridLayout *layout = new QGridLayout(this);     QList<QTreeWidgetItem *> items;     QLabel *topLabel = new QLabel( qtr( "Information about what your media or"              " stream is made of.\nMuxer, Audio and Video Codecs, Subtitles "              "are shown." ) );     topLabel->setWordWrap( true );     layout->addWidget( topLabel, 0, 0 );     InfoTree = new QTreeWidget(this);     InfoTree->setColumnCount( 1 );     InfoTree->header()->hide();     layout->addWidget(InfoTree, 1, 0 );}InfoPanel::~InfoPanel(){}/** * Update the Codecs information on parent->update() **/void InfoPanel::update( input_item_t *p_item){    InfoTree->clear();    QTreeWidgetItem *current_item = NULL;    QTreeWidgetItem *child_item = NULL;    for( int i = 0; i< p_item->i_categories ; i++)    {        current_item = new QTreeWidgetItem();        current_item->setText( 0, qfu(p_item->pp_categories[i]->psz_name) );        InfoTree->addTopLevelItem( current_item );        for( int j = 0 ; j < p_item->pp_categories[i]->i_infos ; j++ )        {            child_item = new QTreeWidgetItem ();            child_item->setText( 0,                    qfu(p_item->pp_categories[i]->pp_infos[j]->psz_name)                    + ": "                    + qfu(p_item->pp_categories[i]->pp_infos[j]->psz_value));            current_item->addChild(child_item);        }         InfoTree->setItemExpanded( current_item, true);    }}/** * Clear the tree **/void InfoPanel::clear(){    InfoTree->clear();}/** * Save all the information to a file * Not yet implemented. **//*void InfoPanel::saveCodecsInfo(){}*//** * Fourth Panel - Stats * Displays the Statistics for reading/streaming/encoding/displaying in a tree */InputStatsPanel::InputStatsPanel( QWidget *parent,                                  intf_thread_t *_p_intf )                                  : QWidget( parent ), p_intf( _p_intf ){     QGridLayout *layout = new QGridLayout(this);     QList<QTreeWidgetItem *> items;     QLabel *topLabel = new QLabel( qtr( "Statistics about the currently "                 "playing media or stream." ) );     topLabel->setWordWrap( true );     layout->addWidget( topLabel, 0, 0 );     StatsTree = new QTreeWidget(this);     StatsTree->setColumnCount( 3 );     StatsTree->header()->hide();#define CREATE_TREE_ITEM( itemName, itemText, itemValue, unit ) {              \    itemName =                                                                 \      new QTreeWidgetItem((QStringList () << itemText << itemValue << unit )); \    itemName->setTextAlignment( 1 , Qt::AlignRight ) ; }#define CREATE_CATEGORY( catName, itemText ) {                           \    CREATE_TREE_ITEM( catName, itemText , "", "" );                      \    catName->setExpanded( true );                                        \    StatsTree->addTopLevelItem( catName );    }#define CREATE_AND_ADD_TO_CAT( itemName, itemText, itemValue, catName, unit ){ \    CREATE_TREE_ITEM( itemName, itemText, itemValue, unit );                   \    catName->addChild( itemName ); }    /* Create the main categories */    CREATE_CATEGORY( audio, qtr("Audio") );    CREATE_CATEGORY( video, qtr("Video") );    CREATE_CATEGORY( input, qtr("Input") );    CREATE_CATEGORY( streaming, qtr("Streaming") );    CREATE_AND_ADD_TO_CAT( read_media_stat, qtr("Read at media"),                           "0", input , "kB" );    CREATE_AND_ADD_TO_CAT( input_bitrate_stat, qtr("Input bitrate"),                           "0", input, "kb/s" );    CREATE_AND_ADD_TO_CAT( demuxed_stat, qtr("Demuxed"), "0", input, "kB") ;    CREATE_AND_ADD_TO_CAT( stream_bitrate_stat, qtr("Stream bitrate"),                           "0", input, "kb/s" );    CREATE_AND_ADD_TO_CAT( vdecoded_stat, qtr("Decoded blocks"),                           "0", video, "" );    CREATE_AND_ADD_TO_CAT( vdisplayed_stat, qtr("Displayed frames"),                           "0", video, "" );    CREATE_AND_ADD_TO_CAT( vlost_frames_stat, qtr("Lost frames"),                           "0", video, "" );    CREATE_AND_ADD_TO_CAT( vfps_stat, qtr("FPS"), "0", video, "" );    CREATE_AND_ADD_TO_CAT( send_stat, qtr("Sent packets"), "0", streaming, "" );    CREATE_AND_ADD_TO_CAT( send_bytes_stat, qtr("Sent bytes"),                           "0", streaming, "kB" );    CREATE_AND_ADD_TO_CAT( send_bitrate_stat, qtr("Sent bitrate"),                           "0", streaming, "kb/s" );    CREATE_AND_ADD_TO_CAT( adecoded_stat, qtr("Decoded blocks"),                           "0", audio, "" );    CREATE_AND_ADD_TO_CAT( aplayed_stat, qtr("Played buffers"),                           "0", audio, "" );    CREATE_AND_ADD_TO_CAT( alost_stat, qtr("Lost buffers"), "0", audio, "" );    input->setExpanded( true );    video->setExpanded( true );    streaming->setExpanded( true );    audio->setExpanded( true );    StatsTree->resizeColumnToContents( 0 );    StatsTree->setColumnWidth( 1 , 100 );    layout->addWidget(StatsTree, 1, 0 );}InputStatsPanel::~InputStatsPanel(){}/** * Update the Statistics **/void InputStatsPanel::update( input_item_t *p_item ){    vlc_mutex_lock( &p_item->p_stats->lock );#define UPDATE( widget, format, calc... ) \    { QString str; widget->setText( 1 , str.sprintf( format, ## calc ) );  }    UPDATE( read_media_stat, "%8.0f",            (float)(p_item->p_stats->i_read_bytes)/1000);    UPDATE( input_bitrate_stat, "%6.0f",                    (float)(p_item->p_stats->f_input_bitrate * 8000 ));    UPDATE( demuxed_stat, "%8.0f",                    (float)(p_item->p_stats->i_demux_read_bytes)/1000 );    UPDATE( stream_bitrate_stat, "%6.0f",                    (float)(p_item->p_stats->f_demux_bitrate * 8000 ));    /* Video */    UPDATE( vdecoded_stat, "%5i", p_item->p_stats->i_decoded_video );    UPDATE( vdisplayed_stat, "%5i", p_item->p_stats->i_displayed_pictures );    UPDATE( vlost_frames_stat, "%5i", p_item->p_stats->i_lost_pictures );/*  UPDATE( vfps_stat, "%5f", p_item->p_stats->i_lost_pictures );input_Control( p_input_thread, INPUT_GET_VIDEO_FPS, &f_fps */    /* Sout */    UPDATE( send_stat, "%5i", p_item->p_stats->i_sent_packets );    UPDATE( send_bytes_stat, "%8.0f",            (float)(p_item->p_stats->i_sent_bytes)/1000 );    UPDATE( send_bitrate_stat, "%6.0f",            (float)(p_item->p_stats->f_send_bitrate*8)*1000 );    /* Audio*/    UPDATE( adecoded_stat, "%5i", p_item->p_stats->i_decoded_audio );    UPDATE( aplayed_stat, "%5i", p_item->p_stats->i_played_abuffers );    UPDATE( alost_stat, "%5i", p_item->p_stats->i_lost_abuffers );    vlc_mutex_unlock(& p_item->p_stats->lock );}void InputStatsPanel::clear(){}

⌨️ 快捷键说明

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