- config_chain_t *p_cfg;
- char *psz_name;
-
- psz_parser = config_ChainCreate( &psz_name, &p_cfg, psz_parser );
-
- msg_Dbg( p_spu, "adding sub-filter: %s", psz_name );
-
- p_spu->pp_filter[p_spu->i_filter] =
- vlc_object_create( p_spu, VLC_OBJECT_FILTER );
- vlc_object_attach( p_spu->pp_filter[p_spu->i_filter], p_spu );
- p_spu->pp_filter[p_spu->i_filter]->pf_sub_buffer_new = sub_new_buffer;
- p_spu->pp_filter[p_spu->i_filter]->pf_sub_buffer_del = sub_del_buffer;
- p_spu->pp_filter[p_spu->i_filter]->p_cfg = p_cfg;
- p_spu->pp_filter[p_spu->i_filter]->p_module =
- module_Need( p_spu->pp_filter[p_spu->i_filter],
- "sub filter", psz_name, true );
- free( psz_name );
-
- if( p_spu->pp_filter[p_spu->i_filter]->p_module )
- {
- filter_owner_sys_t *p_sys = malloc( sizeof(filter_owner_sys_t) );
- if( p_sys )
- {
- p_spu->pp_filter[p_spu->i_filter]->p_owner = p_sys;
- spu_Control( p_spu, SPU_CHANNEL_REGISTER, &p_sys->i_channel );
- p_sys->p_spu = p_spu;
- p_spu->i_filter++;
- }
- }
- else
- {
- msg_Dbg( p_spu, "no sub filter found" );
- config_ChainDestroy( p_spu->pp_filter[p_spu->i_filter]->p_cfg );
- vlc_object_detach( p_spu->pp_filter[p_spu->i_filter] );
- vlc_object_release( p_spu->pp_filter[p_spu->i_filter] );
- }
-
- if( p_spu->i_filter >= 10 )
- {
- msg_Dbg( p_spu, "can't add anymore filters" );
- break;
- }
-