+ /* Create user specified video filters */
+ psz_chain = var_GetNonEmptyString( p_stream, CFG_PREFIX "vfilter" );
+ msg_Dbg( p_stream, "psz_chain: %s\n", psz_chain );
+ {
+ config_chain_t *p_cfg;
+ for( p_cfg = p_stream->p_cfg; p_cfg != NULL; p_cfg = p_cfg->p_next )
+ {
+ msg_Dbg( p_stream, " - %s\n", p_cfg->psz_value );
+ }
+ }
+ p_sys->i_vfilters = 0;
+ p_sys->pp_vfilters = NULL;
+ psz_parser = psz_chain;
+ while( psz_parser && *psz_parser )
+ {
+ config_chain_t *p_cfg;
+ char *psz_name;
+ filter_t **pp_vfilter;
+ psz_parser = config_ChainCreate( &psz_name, &p_cfg, psz_parser );
+ p_sys->i_vfilters++;
+ p_sys->pp_vfilters =
+ (filter_t **)realloc( p_sys->pp_vfilters,
+ p_sys->i_vfilters * sizeof(filter_t *) );
+ pp_vfilter = p_sys->pp_vfilters+(p_sys->i_vfilters - 1);
+ *pp_vfilter = vlc_object_create( p_stream, VLC_OBJECT_FILTER );
+ vlc_object_attach( *pp_vfilter, p_stream );
+ (*pp_vfilter)->pf_vout_buffer_new = video_new_buffer_filter;
+ (*pp_vfilter)->pf_vout_buffer_del = video_del_buffer_filter;
+ (*pp_vfilter)->fmt_in = p_sys->p_decoder->fmt_out;
+ if( p_sys->i_chroma )
+ (*pp_vfilter)->fmt_in.video.i_chroma = p_sys->i_chroma;
+ (*pp_vfilter)->fmt_out = (*pp_vfilter)->fmt_in;
+ (*pp_vfilter)->p_cfg = p_cfg;
+ (*pp_vfilter)->p_module =
+ module_Need( *pp_vfilter, "video filter2", psz_name, VLC_TRUE );
+ if( (*pp_vfilter)->p_module )
+ {
+ /* It worked! */
+ (*pp_vfilter)->p_owner = (filter_owner_sys_t *)
+ p_sys->p_decoder->p_owner;
+ msg_Err( p_stream, "Added video filter %s to the chain",
+ psz_name );
+ }
+ else
+ {
+ /* Crap ... we didn't find a filter */
+ msg_Warn( p_stream,
+ "no video filter matching name \"%s\" found",
+ psz_name );
+ vlc_object_detach( *pp_vfilter );
+ vlc_object_release( *pp_vfilter );
+ p_sys->i_vfilters--;
+ }
+ }
+ free( psz_chain );
+