Ejemplo n.º 1
0
Archivo: chain.c Proyecto: mstorsjo/vlc
static int CreateChain( filter_t *p_parent, const es_format_t *p_fmt_mid )
{
    filter_sys_t *p_sys = p_parent->p_sys;
    filter_chain_Reset( p_sys->p_chain, &p_parent->fmt_in, &p_parent->fmt_out );

    filter_t *p_filter;

    if( p_parent->fmt_in.video.orientation != p_fmt_mid->video.orientation)
    {
        p_filter = AppendTransform( p_sys->p_chain, &p_parent->fmt_in, p_fmt_mid );
        // Check if filter was enough:
        if( p_filter == NULL )
            return VLC_EGENERIC;
        if( es_format_IsSimilar(&p_filter->fmt_out, &p_parent->fmt_out ))
           return VLC_SUCCESS;
    }
    else
    {
        if( filter_chain_AppendConverter( p_sys->p_chain,
                                          NULL, p_fmt_mid ) )
            return VLC_EGENERIC;
    }

    if( p_fmt_mid->video.orientation != p_parent->fmt_out.video.orientation)
    {
        if( AppendTransform( p_sys->p_chain, p_fmt_mid,
                             &p_parent->fmt_out ) == NULL )
            goto error;
    }
    else
    {
        if( filter_chain_AppendConverter( p_sys->p_chain,
                                          p_fmt_mid, &p_parent->fmt_out ) )
            goto error;
    }
    return VLC_SUCCESS;
error:
    //Clean up.
    filter_chain_Reset( p_sys->p_chain, NULL, NULL );
    return VLC_EGENERIC;
}
Ejemplo n.º 2
0
static int CreateChain( filter_t *p_parent, es_format_t *p_fmt_mid, config_chain_t *p_cfg )
{
    filter_chain_Reset( p_parent->p_sys->p_chain, &p_parent->fmt_in, &p_parent->fmt_out );

    filter_t *p_filter;

    if( p_parent->fmt_in.video.orientation != p_fmt_mid->video.orientation)
    {
        p_filter = AppendTransform( p_parent->p_sys->p_chain, &p_parent->fmt_in, p_fmt_mid );
    }
    else
    {
        p_filter = filter_chain_AppendFilter( p_parent->p_sys->p_chain, NULL, p_cfg, NULL, p_fmt_mid );
    }

    if( !p_filter )
        return VLC_EGENERIC;

    //Check if first filter was enough (transform filter most likely):
    if( es_format_IsSimilar(&p_filter->fmt_out, &p_parent->fmt_out ))
        return VLC_SUCCESS;

    if( p_fmt_mid->video.orientation != p_parent->fmt_out.video.orientation)
    {
        p_filter = AppendTransform( p_parent->p_sys->p_chain, p_fmt_mid, &p_parent->fmt_out );
    }
    else
    {
        p_filter = filter_chain_AppendFilter( p_parent->p_sys->p_chain, NULL, p_cfg, p_fmt_mid, NULL );
    }

    if( !p_filter )
    {
        //Clean up.
        filter_chain_Reset( p_parent->p_sys->p_chain, NULL, NULL );
        return VLC_EGENERIC;
    }

    return VLC_SUCCESS;
}