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

📄 interface.cpp

📁 video linux conference
💻 CPP
📖 第 1 页 / 共 2 页
字号:
                fSlider->setValue( ( 10000 * p_area->i_tell )                                   / p_area->i_size );                vlc_mutex_lock( &p_input->stream.stream_lock );            }#undef p_area                        //         if( p_intf->p_sys->i_part !=            //    p_input->stream.p_selected_area->i_part )            //{                //      p_intf->p_sys->b_chapter_update = 1;                //GtkSetupMenus( p_intf );            //}        }        vlc_mutex_unlock( &p_input->stream.stream_lock );    }        else if( p_intf->p_sys->b_playing && !p_intf->b_die )    {        //E_(GtkModeManage)( p_intf );        p_intf->p_sys->b_playing = 0;    }    if( p_intf->b_die )    {        p_intf->p_sys->p_app->quit();    }    vlc_mutex_unlock( &p_intf->change_lock );    msleep( 100 );}void KInterface::slotSliderMoved( int position ){    if( p_intf->p_sys->p_input )    {        // XXX is this locking really useful ?        vlc_mutex_lock( &p_intf->change_lock );        var_SetFloat( p_intf->p_sys->p_input, "position",                       (double)position / 10000.0 );        vlc_mutex_unlock( &p_intf->change_lock );    }}void KInterface::slotUpdateLanguages(){    es_descriptor_t *   p_spu_es;    es_descriptor_t *   p_audio_es;    /* look for selected ES */    p_audio_es = NULL;    p_spu_es = NULL;    for( unsigned int i = 0 ;         i < p_intf->p_sys->p_input->stream.i_selected_es_number ;         i++        )    {        if( p_intf->p_sys->p_input->stream.pp_selected_es[i]->i_cat            == AUDIO_ES )        {            p_audio_es = p_intf->p_sys->p_input->stream.pp_selected_es[i];        }        if( p_intf->p_sys->p_input->stream.pp_selected_es[i]->i_cat == SPU_ES )        {            p_spu_es = p_intf->p_sys->p_input->stream.pp_selected_es[i];        }    }    languages->setEnabled( false );    subtitles->setEnabled( false );    languageCollection->clear();    subtitleCollection->clear();    languages->popupMenu()->clear();    subtitles->popupMenu()->clear();    /* audio menus */    /* find audio root menu */    languageMenus( languages, p_audio_es, AUDIO_ES );    /* sub picture menus */    /* find spu root menu */    languageMenus( subtitles, p_spu_es, SPU_ES );}/* * called with stream lock */void KInterface::languageMenus(KActionMenu *root, es_descriptor_t *p_es,                          int i_cat){    int i_item = 0;    if ( i_cat != AUDIO_ES )    {        KLanguageMenuAction *p_item =            new KLanguageMenuAction( p_intf, _( "Off" ), 0, this );        subtitleCollection->insert( p_item );        root->insert( p_item );        root->insert( new KActionSeparator( this ) );        p_item->setExclusiveGroup( QString().sprintf( "%d", i_cat ) );        p_item->setChecked( p_es == 0 );    }    #define ES p_intf->p_sys->p_input->stream.pp_es[i]    /* create a set of language buttons and append them to the container */    for( unsigned int i = 0 ;         i < p_intf->p_sys->p_input->stream.i_es_number ;         i++ )    {        if( ( ES->i_cat == i_cat ) &&            ( !ES->p_pgrm ||              ES->p_pgrm ==                 p_intf->p_sys->p_input->stream.p_selected_program ) )        {            i_item++;            QString name = p_intf->p_sys->p_input->stream.pp_es[i]->psz_desc;            if( name.isEmpty() )            {                name.sprintf( "Language %d", i_item );            }            KLanguageMenuAction *p_item;            if ( i_cat == AUDIO_ES )            {                p_item = new KLanguageMenuAction( p_intf, name, ES,                                                  this );                languageCollection->insert(p_item);            }            else            {                p_item = new KLanguageMenuAction( p_intf, name, ES,                                                  this );                subtitleCollection->insert(p_item);            }            p_item->setExclusiveGroup( QString().sprintf( "%d", i_cat ) );            root->insert( p_item );                        if( p_es == p_intf->p_sys->p_input->stream.pp_es[i] )            {                /* don't lose p_item when we append into menu */                //p_item_active = p_item;                p_item->setChecked( true );            }            connect( p_item, SIGNAL( toggled( bool, es_descriptor_t * ) ),                     this, SLOT( slotSetLanguage( bool, es_descriptor_t * ) ));        }    }    root->setEnabled( true );}void KInterface::slotSetLanguage( bool on, es_descriptor_t *p_es ){    if( p_es )        var_SetInteger( p_intf->p_sys->p_input, "audio-es", p_es->i_id );    else        var_SetInteger( p_intf->p_sys->p_input, "audio-es", -1 );}void KInterface::slotSliderChanged( int position ){    if( p_intf->p_sys->p_input != NULL )    {        char psz_time[ MSTRTIME_MAX_SIZE ];        int64_t i_seconds;        i_seconds = var_GetTime( p_intf->p_sys->p_input, "time" ) / I64C(1000000 );        secstotimestr( psz_time, i_seconds );        statusBar()->changeItem( psz_time, ID_DATE );     }}void KInterface::slotOpenDisk(){    playlist_t *p_playlist;    int r = fDiskDialog->exec();    if ( r )    {        // Build source name        QString source;        source += fDiskDialog->type();        source += ':';        source += fDiskDialog->device();        source += '@';        source += fDiskDialog->title();        source += ',';        source += fDiskDialog->chapter();        p_playlist = (playlist_t *)            vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );        if( p_playlist )        {            // add it to playlist            playlist_Add( p_playlist, source.latin1(), source.latin1(),                          PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );            vlc_object_release( p_playlist );        }    }}void KInterface::slotOpenStream(){    playlist_t *p_playlist;    int r = fNetDialog->exec();    if ( r )    {        // Build source name        QString source;        source += fNetDialog->protocol();        source += "://";        source += fNetDialog->server();        source += ":";        source += QString().setNum( fNetDialog->port() );        p_playlist = (playlist_t *)            vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );        if( p_playlist )        {            // add it to playlist            playlist_Add( p_playlist, source.latin1(), source.latin1(),                          PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );            vlc_object_release( p_playlist );        }    }}void KInterface::slotPlay(){    if( p_intf->p_sys->p_input )    {        var_SetInteger( p_intf->p_sys->p_input, "state", PLAYING_S );    }}void KInterface::slotPause(){    if ( p_intf->p_sys->p_input )    {        var_SetInteger( p_intf->p_sys->p_input, "state", PAUSE_S );    }}void KInterface::slotStop(){    playlist_t *p_playlist = (playlist_t *)            vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );    if( p_playlist )    {        playlist_Stop( p_playlist );        vlc_object_release( p_playlist );    }}void KInterface::slotBackward(){    msg_Err( p_intf, "KInterface::slotBackward() - Unimplemented" );}void KInterface::slotPrev(){    playlist_t *p_playlist = (playlist_t *)            vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );    if( p_playlist )    {        playlist_Prev( p_playlist );        vlc_object_release( p_playlist );    }}void KInterface::slotNext(){    playlist_t *p_playlist = (playlist_t *)            vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );    if( p_playlist )    {        playlist_Next( p_playlist );        vlc_object_release( p_playlist );    }}void KInterface::slotSlow(){    if( p_intf->p_sys->p_input != NULL )    {        var_SetVoid( p_intf->p_sys->p_input, "rate-slower" );    }}void KInterface::slotFast(){    if( p_intf->p_sys->p_input != NULL )    {        var_SetVoid( p_intf->p_sys->p_input, "rate-faster" );    }}void KInterface::dragEnterEvent( QDragEnterEvent *event ){    event->accept( QUriDrag::canDecode( event ) );}void KInterface::dropEvent( QDropEvent *event ){    KURL::List urlList;    playlist_t *p_playlist = (playlist_t *)            vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );    if( p_playlist == NULL )    {        return;    }    if ( KURLDrag::decode( event, urlList ) )    {        for ( KURL::List::ConstIterator i = urlList.begin(); i != urlList.end(); i++ )        {            // XXX add a private function to add a KURL with checking            // actually a whole class for core abstraction would be neat            if( !(*i).isEmpty() )            {                fileOpenRecent->addURL( *i );                playlist_Add( p_playlist, (*i).path(), (*i).path(),                          PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );            }        }    }    vlc_object_release( p_playlist );}

⌨️ 快捷键说明

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