vlc_linux/vlc-3.0.16/modules/gui/qt/input_manager.cpp
/* Define the Input used.
   Add the callbacks on input
   p_input is held once here */
Define the Input used.
Add the callbacks on input
p_input is held once here
Define the Input used . Add the callbacks on input p_input is held once here
void InputManager::setInput( input_thread_t *_p_input )
{
    delInput();
    p_input = _p_input;
    if( p_input != NULL )
    {
        msg_Dbg( p_intf, "IM: Setting an input" );
        vlc_object_hold( p_input );
        addCallbacks();
        UpdateStatus();
        UpdateName();
        UpdateArt();
        UpdateTeletext();
        UpdateNavigation();
        UpdateVout();
        p_item = input_GetItem( p_input );
        emit rateChanged( var_GetFloat( p_input, "rate" ) );
        if( p_item->i_type == ITEM_TYPE_FILE )
        {
            char *uri = input_item_GetURI( p_item );
            int i_time = RecentsMRL::getInstance( p_intf )->time( qfu(uri) );
            if( i_time > 0 && qfu( uri ) != lastURI &&
                    !var_GetFloat( p_input, "run-time" ) &&
                    !var_GetFloat( p_input, "start-time" ) &&
                    !var_GetFloat( p_input, "stop-time" ) )
            {
                emit resumePlayback( (int64_t)i_time * 1000 );
            }
            playlist_Lock( THEPL );
            playlist_item_t* p_node = playlist_CurrentPlayingItem( THEPL );
            if ( p_node != NULL && p_node->p_parent != NULL && p_node->p_parent->i_id == THEPL->p_playing->i_id )
            {
                lastURI = qfu( uri );
                RecentsMRL::getInstance( p_intf )->addRecent( lastURI );
            }
            playlist_Unlock( THEPL );
            free( uri );
        }
    }
    else
    {
        p_item = NULL;
        lastURI.clear();
        assert( !p_input_vbi );
        emit rateChanged( var_InheritFloat( p_intf, "rate" ) );
    }
}
void InputManager :: setInput ( input_thread_t * _p_input ) { delInput ( ) ; p_input = _p_input ; if ( p_input != NULL ) { msg_Dbg ( p_intf , " " ) ; vlc_object_hold ( p_input ) ; addCallbacks ( ) ; UpdateStatus ( ) ; UpdateName ( ) ; UpdateArt ( ) ; UpdateTeletext ( ) ; UpdateNavigation ( ) ; UpdateVout ( ) ; p_item = input_GetItem ( p_input ) ; emit rateChanged ( var_GetFloat ( p_input , " " ) ) ; if ( p_item -> i_type == ITEM_TYPE_FILE ) { char * uri = input_item_GetURI ( p_item ) ; int i_time = RecentsMRL :: getInstance ( p_intf ) -> time ( qfu ( uri ) ) ; if ( i_time > 0 && qfu ( uri ) != lastURI && ! var_GetFloat ( p_input , " " ) && ! var_GetFloat ( p_input , " " ) && ! var_GetFloat ( p_input , " " ) ) { emit resumePlayback ( ( int64_t ) i_time * 1000 ) ; } playlist_Lock ( THEPL ) ; playlist_item_t * p_node = playlist_CurrentPlayingItem ( THEPL ) ; if ( p_node != NULL && p_node -> p_parent != NULL && p_node -> p_parent -> i_id == THEPL -> p_playing -> i_id ) { lastURI = qfu ( uri ) ; RecentsMRL :: getInstance ( p_intf ) -> addRecent ( lastURI ) ; } playlist_Unlock ( THEPL ) ; free ( uri ) ; } } else { p_item = NULL ; lastURI . clear ( ) ; assert ( ! p_input_vbi ) ; emit rateChanged ( var_InheritFloat ( p_intf , " " ) ) ; } }
Define the Input used.
Define the Input used .
/* Get Saved Time */ // Add root items only // Save the latest URI to avoid asking to restore the // position on the same input file.