Ejemplo n.º 1
0
static int AddIntfCallback( vlc_object_t *p_this, char const *psz_cmd,
                         vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
    intf_thread_t *p_intf;
    char *psz_intf = malloc( strlen(newval.psz_string) + sizeof(",none") );

    (void)psz_cmd; (void)oldval; (void)p_data;

    /* Try to create the interface */
    sprintf( psz_intf, "%s,none", newval.psz_string );
    p_intf = intf_Create( p_this->p_libvlc, psz_intf );
    free( psz_intf );
    if( p_intf == NULL )
    {
        msg_Err( p_this, "interface \"%s\" initialization failed",
                 newval.psz_string );
        return VLC_EGENERIC;
    }

    /* Try to run the interface */
    if( intf_RunThread( p_intf ) != VLC_SUCCESS )
    {
        vlc_object_detach( p_intf );
        vlc_object_release( p_intf );
        return VLC_EGENERIC;
    }

    return VLC_SUCCESS;
}
Ejemplo n.º 2
0
/*****************************************************************************
 * OpenDecoder: probe the decoder and return score
 *****************************************************************************
 * Tries to launch a decoder and return score so that the interface is able
 * to chose.
 *****************************************************************************/
static int OpenDecoder( vlc_object_t *p_this )
{
    decoder_t *p_dec = (decoder_t*)p_this;
    input_thread_t * p_input;
    decoder_sys_t *p_sys;
    vlc_value_t val;

    if( p_dec->fmt_in.i_codec != VLC_FOURCC('c','m','m','l') )
    {
        return VLC_EGENERIC;
    }

    p_dec->pf_decode_sub = DecodeBlock;

#ifdef CMML_DEBUG
    msg_Dbg( p_dec, "i am at %p", p_dec );
#endif

    /* Allocate the memory needed to store the decoder's structure */
    if( ( p_dec->p_sys = p_sys =
          (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
    {
        msg_Err( p_dec, "out of memory" );
        return VLC_EGENERIC;
    }

    /* Let other interested modules know that we're a CMML decoder
     * We have to set this variable on the input thread, because there's
     * typically more than one decoder running so we can't find the CMML
     * decoder succesfully with vlc_object_find.  (Any hints on how to achieve
     * this would be rather appreciated ;) */
    p_input = vlc_object_find( p_dec, VLC_OBJECT_INPUT, FIND_ANYWHERE );
#ifdef CMML_DEBUG
    msg_Dbg( p_dec, "p_input is at %p", p_input );
#endif
    val.p_address = p_dec;
    var_Create( p_input, "has-cmml-decoder",
                VLC_VAR_ADDRESS|VLC_VAR_DOINHERIT );
    if( var_Set( p_input, "has-cmml-decoder", val ) != VLC_SUCCESS )
    {
        msg_Dbg( p_dec, "var_Set of has-cmml-decoder failed" );
    }
    vlc_object_release( p_input );

    /* initialise the CMML responder interface */
    p_sys->p_intf = intf_Create( p_dec, "cmml", 0, NULL );
    p_sys->p_intf->b_block = VLC_FALSE;
    intf_RunThread( p_sys->p_intf );

    return VLC_SUCCESS;
}
Ejemplo n.º 3
0
static int Intf( vlc_object_t *p_this, char const *psz_cmd,
                 vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
    intf_thread_t *p_newintf;

    p_newintf = intf_Create( p_this->p_vlc, newval.psz_string );

    if( p_newintf )
    {
        p_newintf->b_block = VLC_FALSE;
        if( intf_RunThread( p_newintf ) )
        {
            vlc_object_detach( p_newintf );
            intf_Destroy( p_newintf );
        }
    }

    return VLC_SUCCESS;
}