+ spu_Init( p_vout->p_spu );
+
+ /* Take care of some "interface/control" related initialisations */
+ vout_IntfInit( p_vout );
+
+ /* If the parent is not a VOUT object, that means we are at the start of
+ * the video output pipe */
+ if( p_parent->i_object_type != VLC_OBJECT_VOUT )
+ {
+ /* Look for the default filter configuration */
+ p_vout->psz_filter_chain =
+ var_CreateGetStringCommand( p_vout, "vout-filter" );
+
+ /* Apply video filter2 objects on the first vout */
+ p_vout->psz_vf2 =
+ var_CreateGetStringCommand( p_vout, "video-filter" );
+ }
+ else
+ {
+ /* continue the parent's filter chain */
+ char *psz_tmp;
+
+ /* Ugly hack to jump to our configuration chain */
+ p_vout->psz_filter_chain
+ = ((vout_thread_t *)p_parent)->psz_filter_chain;
+ p_vout->psz_filter_chain
+ = config_ChainCreate( &psz_tmp, &p_cfg, p_vout->psz_filter_chain );
+ config_ChainDestroy( p_cfg );
+ free( psz_tmp );
+
+ /* Create a video filter2 var ... but don't inherit values */
+ var_Create( p_vout, "video-filter",
+ VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
+ p_vout->psz_vf2 = var_GetString( p_vout, "video-filter" );
+ }
+
+ var_AddCallback( p_vout, "video-filter", VideoFilter2Callback, NULL );
+ p_vout->p_vf2_chain = filter_chain_New( p_vout, "video filter2",
+ false, video_filter_buffer_allocation_init, NULL, p_vout );
+
+ /* Choose the video output module */
+ if( !p_vout->psz_filter_chain || !*p_vout->psz_filter_chain )
+ {
+ var_Create( p_vout, "vout", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
+ var_Get( p_vout, "vout", &val );
+ psz_parser = val.psz_string;
+ }
+ else
+ {
+ psz_parser = strdup( p_vout->psz_filter_chain );
+ }
+
+ /* Create the vout thread */
+ config_ChainCreate( &psz_name, &p_cfg, psz_parser );
+ free( psz_parser );
+ p_vout->p_cfg = p_cfg;