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

📄 vlcproc.cpp

📁 uclinux 下的vlc播放器源代码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
        // Get the input bitrate        int bitrate = var_GetInteger( pInput, "bit-rate" ) / 1000;        pBitrate->set( UString::fromInt( getIntf(), bitrate ) );        // Get the audio sample rate        int sampleRate = var_GetInteger( pInput, "sample-rate" ) / 1000;        pSampleRate->set( UString::fromInt( getIntf(), sampleRate ) );        // Do we have audio        vlc_value_t audio_es;        var_Change( pInput, "audio-es", VLC_VAR_CHOICESCOUNT,                        &audio_es, NULL );        pVarHasAudio->set( audio_es.i_int > 0 );        // Refresh fullscreen status        vout_thread_t *pVout = (vout_thread_t *)vlc_object_find( pInput,                                     VLC_OBJECT_VOUT, FIND_CHILD );        pVarHasVout->set( pVout != NULL );        if( pVout )        {            pVarFullscreen->set( pVout->b_fullscreen );            vlc_object_release( pVout );        }        // Refresh play/pause status        int state = var_GetInteger( pInput, "state" );        pVarStopped->set( false );        pVarPlaying->set( state != PAUSE_S );        pVarPaused->set( state == PAUSE_S );    }    else    {        pVarSeekable->set( false );        pVarDvdActive->set( false );        pTime->set( 0, false );        pVarFullscreen->set( false );        pVarHasAudio->set( false );        pVarHasVout->set( false );        pVarStopped->set( true );        pVarPlaying->set( false );        pVarPaused->set( false );    }}int VlcProc::onIntfChange( vlc_object_t *pObj, const char *pVariable,                           vlc_value_t oldVal, vlc_value_t newVal,                           void *pParam ){    VlcProc *pThis = (VlcProc*)pParam;    // Update the stream variable    playlist_t *p_playlist = (playlist_t*)pObj;    pThis->updateStreamName(p_playlist);    // Create a playlist notify command (for old style playlist)    CmdNotifyPlaylist *pCmd = new CmdNotifyPlaylist( pThis->getIntf() );    // Create a playtree notify command (for new style playtree)    CmdPlaytreeChanged *pCmdTree = new CmdPlaytreeChanged( pThis->getIntf() );    // Push the command in the asynchronous command queue    AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );    pQueue->push( CmdGenericPtr( pCmd ) );    pQueue->push( CmdGenericPtr( pCmdTree ) );    return VLC_SUCCESS;}int VlcProc::onIntfShow( vlc_object_t *pObj, const char *pVariable,                         vlc_value_t oldVal, vlc_value_t newVal,                         void *pParam ){    if (newVal.i_int)    {        VlcProc *pThis = (VlcProc*)pParam;        // Create a raise all command        CmdRaiseAll *pCmd = new CmdRaiseAll( pThis->getIntf(),            pThis->getIntf()->p_sys->p_theme->getWindowManager() );        // Push the command in the asynchronous command queue        AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );        pQueue->push( CmdGenericPtr( pCmd ) );    }    return VLC_SUCCESS;}int VlcProc::onItemChange( vlc_object_t *pObj, const char *pVariable,                           vlc_value_t oldVal, vlc_value_t newVal,                           void *pParam ){    VlcProc *pThis = (VlcProc*)pParam;    // Update the stream variable    playlist_t *p_playlist = (playlist_t*)pObj;    pThis->updateStreamName(p_playlist);    // Create a playlist notify command    // TODO: selective update    CmdNotifyPlaylist *pCmd = new CmdNotifyPlaylist( pThis->getIntf() );    // Create a playtree notify command    CmdPlaytreeUpdate *pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(),                                                         newVal.i_int );    // Push the command in the asynchronous command queue    AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );    pQueue->push( CmdGenericPtr( pCmd ) );    pQueue->push( CmdGenericPtr( pCmdTree ), true );    return VLC_SUCCESS;}int VlcProc::onItemAppend( vlc_object_t *pObj, const char *pVariable,                           vlc_value_t oldVal, vlc_value_t newVal,                           void *pParam ){    VlcProc *pThis = (VlcProc*)pParam;    playlist_add_t *p_add = (playlist_add_t*)malloc( sizeof(                                                playlist_add_t ) ) ;    memcpy( p_add, newVal.p_address, sizeof( playlist_add_t ) ) ;    CmdGenericPtr ptrTree;    CmdPlaytreeAppend *pCmdTree = new CmdPlaytreeAppend( pThis->getIntf(),                                                             p_add );    ptrTree = CmdGenericPtr( pCmdTree );    // Create a playlist notify command (for old style playlist)    CmdNotifyPlaylist *pCmd = new CmdNotifyPlaylist( pThis->getIntf() );    // Push the command in the asynchronous command queue    AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );    pQueue->push( CmdGenericPtr( pCmd ) );    pQueue->push( ptrTree , false );    return VLC_SUCCESS;}int VlcProc::onItemDelete( vlc_object_t *pObj, const char *pVariable,                           vlc_value_t oldVal, vlc_value_t newVal,                           void *pParam ){    VlcProc *pThis = (VlcProc*)pParam;    int i_id = newVal.i_int;    CmdGenericPtr ptrTree;    CmdPlaytreeDelete *pCmdTree = new CmdPlaytreeDelete( pThis->getIntf(),                                                         i_id);    ptrTree = CmdGenericPtr( pCmdTree );    // Create a playlist notify command (for old style playlist)    CmdNotifyPlaylist *pCmd = new CmdNotifyPlaylist( pThis->getIntf() );    // Push the command in the asynchronous command queue    AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );    pQueue->push( CmdGenericPtr( pCmd ) );    pQueue->push( ptrTree , false );    return VLC_SUCCESS;}int VlcProc::onPlaylistChange( vlc_object_t *pObj, const char *pVariable,                               vlc_value_t oldVal, vlc_value_t newVal,                               void *pParam ){    VlcProc *pThis = (VlcProc*)pParam;    AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );    // Update the stream variable    playlist_t *p_playlist = (playlist_t*)pObj;    pThis->updateStreamName(p_playlist);    // Create a playlist notify command (old style playlist)    // TODO: selective update    CmdNotifyPlaylist *pCmd = new CmdNotifyPlaylist( pThis->getIntf() );    pQueue->push( CmdGenericPtr( pCmd ) );    // Create two playtree notify commands: one for old item, one for new    CmdPlaytreeUpdate *pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(),                                                         oldVal.i_int );    pQueue->push( CmdGenericPtr( pCmdTree ) , true );    pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(), newVal.i_int );    pQueue->push( CmdGenericPtr( pCmdTree ) , true );    return VLC_SUCCESS;}int VlcProc::onSkinToLoad( vlc_object_t *pObj, const char *pVariable,                           vlc_value_t oldVal, vlc_value_t newVal,                           void *pParam ){    VlcProc *pThis = (VlcProc*)pParam;    // Create a playlist notify command    CmdChangeSkin *pCmd =        new CmdChangeSkin( pThis->getIntf(), newVal.psz_string );    // Push the command in the asynchronous command queue    AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );    pQueue->push( CmdGenericPtr( pCmd ) );    return VLC_SUCCESS;}int VlcProc::onInteraction( vlc_object_t *pObj, const char *pVariable,                            vlc_value_t oldVal, vlc_value_t newVal,                            void *pParam ){    VlcProc *pThis = (VlcProc*)pParam;    interaction_dialog_t *p_dialog = (interaction_dialog_t *)(newVal.p_address);    CmdInteraction *pCmd = new CmdInteraction( pThis->getIntf(), p_dialog );    AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );    pQueue->push( CmdGenericPtr( pCmd ) );    return VLC_SUCCESS;}void VlcProc::updateStreamName( playlist_t *p_playlist ){    if( p_playlist && p_playlist->p_input )    {        // Get playlist item information        input_item_t *pItem = p_playlist->p_input->input.p_item;        VarText &rStreamName = getStreamNameVar();        VarText &rStreamURI = getStreamURIVar();        // XXX: we should not need to access p_input->psz_source directly, a        // getter should be provided by VLC core        string name = pItem->psz_name;        // XXX: This should be done in VLC core, not here...        // Remove path information if any        OSFactory *pFactory = OSFactory::instance( getIntf() );        string::size_type pos = name.rfind( pFactory->getDirSeparator() );        if( pos != string::npos )        {            name = name.substr( pos + 1, name.size() - pos + 1 );        }        UString srcName( getIntf(), name.c_str() );        UString srcURI( getIntf(), pItem->psz_uri );       // Create commands to update the stream variables        CmdSetText *pCmd1 = new CmdSetText( getIntf(), rStreamName, srcName );        CmdSetText *pCmd2 = new CmdSetText( getIntf(), rStreamURI, srcURI );        // Push the commands in the asynchronous command queue        AsyncQueue *pQueue = AsyncQueue::instance( getIntf() );        pQueue->push( CmdGenericPtr( pCmd1 ), false );        pQueue->push( CmdGenericPtr( pCmd2 ), false );    }}void *VlcProc::getWindow( intf_thread_t *pIntf, vout_thread_t *pVout,                          int *pXHint, int *pYHint,                          unsigned int *pWidthHint,                          unsigned int *pHeightHint ){    VlcProc *pThis = pIntf->p_sys->p_vlcProc;    if( pThis->m_handleSet.empty() )    {        return NULL;    }    else    {        pThis->m_pVout = pVout;        // Get the window handle        void *pWindow = *pThis->m_handleSet.begin();        // Post a resize vout command        CmdResizeVout *pCmd = new CmdResizeVout( pThis->getIntf(), pWindow,                                                 *pWidthHint, *pHeightHint );        AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );        pQueue->push( CmdGenericPtr( pCmd ) );        return pWindow;    }}void VlcProc::releaseWindow( intf_thread_t *pIntf, void *pWindow ){    VlcProc *pThis = pIntf->p_sys->p_vlcProc;    pThis->m_pVout = NULL;}int VlcProc::controlWindow( intf_thread_t *pIntf, void *pWindow,                            int query, va_list args ){    VlcProc *pThis = pIntf->p_sys->p_vlcProc;    switch( query )    {        case VOUT_SET_SIZE:        {            if( pThis->m_pVout )            {                unsigned int i_width  = va_arg( args, unsigned int );                unsigned int i_height = va_arg( args, unsigned int );                if( !i_width ) i_width = pThis->m_pVout->i_window_width;                if( !i_height ) i_height = pThis->m_pVout->i_window_height;                // Post a resize vout command                CmdResizeVout *pCmd =                    new CmdResizeVout( pThis->getIntf(), pWindow,                                       i_width, i_height );                AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );                pQueue->push( CmdGenericPtr( pCmd ) );            }        }        default:            msg_Dbg( pIntf, "control query not supported" );            break;    }    return VLC_SUCCESS;}int VlcProc::onEqBandsChange( vlc_object_t *pObj, const char *pVariable,                              vlc_value_t oldVal, vlc_value_t newVal,                              void *pParam ){    VlcProc *pThis = (VlcProc*)pParam;    // Post a set equalizer bands command    CmdSetEqBands *pCmd = new CmdSetEqBands( pThis->getIntf(),                                             pThis->m_varEqBands,                                             newVal.psz_string );    AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );    pQueue->push( CmdGenericPtr( pCmd ) );    return VLC_SUCCESS;}int VlcProc::onEqPreampChange( vlc_object_t *pObj, const char *pVariable,                               vlc_value_t oldVal, vlc_value_t newVal,                               void *pParam ){    VlcProc *pThis = (VlcProc*)pParam;    EqualizerPreamp *pVarPreamp = (EqualizerPreamp*)(pThis->m_cVarEqPreamp.get());    // Post a set preamp command    CmdSetEqPreamp *pCmd = new CmdSetEqPreamp( pThis->getIntf(), *pVarPreamp,                                              (newVal.f_float + 20.0) / 40.0 );    AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );    pQueue->push( CmdGenericPtr( pCmd ) );    return VLC_SUCCESS;}

⌨️ 快捷键说明

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