vlc_linux/vlc-3.0.16/modules/access/dshow/dshow.cpp
/*****************************************************************************
 * AccessOpen: open direct show device as an access module
 *****************************************************************************/
open direct show device as an access module
open direct show device as an access module
static int AccessOpen( vlc_object_t *p_this )
{
    stream_t     *p_access = (stream_t*)p_this;
    access_sys_t *p_sys;
    p_access->p_sys = p_sys = (access_sys_t*)calloc( 1, sizeof( access_sys_t ) );
    if( !p_sys )
        return VLC_ENOMEM;
    ComContext ctx( COINIT_MULTITHREADED );
    if( vlc_mta_acquire( p_this ) == false )
    {
        msg_Err( p_this, "Failed to acquire MTA" );
        return VLC_EGENERIC;
    }
    if( CommonOpen( p_this, p_sys, false ) != VLC_SUCCESS )
    {
        CommonClose( p_this, p_sys );
        return VLC_EGENERIC;
    }
    p_access->pf_read = NULL;
    p_access->pf_block = ReadCompressed;
    p_access->pf_control = AccessControl;
    p_access->pf_seek = NULL;
    p_access->p_sys = p_sys;
    msg_Dbg( p_this, "Playing...");
    if( FAILED( p_sys->p_control->Run() ) )
    {
        msg_Err( p_this, "Failed to run graph. Capture device may be in use." );
        CommonClose( p_this, p_sys );
        return VLC_EGENERIC;
    }
    return VLC_SUCCESS;
}
static int AccessOpen ( vlc_object_t * p_this ) { stream_t * p_access = ( stream_t * ) p_this ; access_sys_t * p_sys ; p_access -> p_sys = p_sys = ( access_sys_t * ) calloc ( 1 , sizeof ( access_sys_t ) ) ; if ( ! p_sys ) return VLC_ENOMEM ; ComContext ctx ( COINIT_MULTITHREADED ) ; if ( vlc_mta_acquire ( p_this ) == false ) { msg_Err ( p_this , " " ) ; return VLC_EGENERIC ; } if ( CommonOpen ( p_this , p_sys , false ) != VLC_SUCCESS ) { CommonClose ( p_this , p_sys ) ; return VLC_EGENERIC ; } p_access -> pf_read = NULL ; p_access -> pf_block = ReadCompressed ; p_access -> pf_control = AccessControl ; p_access -> pf_seek = NULL ; p_access -> p_sys = p_sys ; msg_Dbg ( p_this , " " ) ; if ( FAILED ( p_sys -> p_control -> Run ( ) ) ) { msg_Err ( p_this , " " ) ; CommonClose ( p_this , p_sys ) ; return VLC_EGENERIC ; } return VLC_SUCCESS ; }
AccessOpen: open direct show device as an access module
AccessOpen : open direct show device as an access module
/* Setup Access */ /* Everything is ready. Let's rock baby */