+
+static int DeinterlaceCallback( vlc_object_t *p_this, char const *psz_cmd,
+ vlc_value_t oldval, vlc_value_t newval, void *p_data )
+{
+ vout_thread_t *p_vout = (vout_thread_t *)p_this;
+ input_thread_t *p_input;
+ vlc_value_t val;
+
+ char *psz_mode = newval.psz_string;
+ char *psz_filter;
+ unsigned int i;
+
+ psz_filter = config_GetPsz( p_vout, "filter" );
+
+ if( !psz_mode || !*psz_mode )
+ {
+ config_PutPsz( p_vout, "filter", "" );
+ }
+ else
+ {
+ if( !psz_filter || !*psz_filter )
+ {
+ config_PutPsz( p_vout, "filter", "deinterlace" );
+ }
+ else
+ {
+ if( strstr( psz_filter, "deinterlace" ) == NULL )
+ {
+ psz_filter = realloc( psz_filter, strlen( psz_filter ) + 20 );
+ strcat( psz_filter, ",deinterlace" );
+ }
+ config_PutPsz( p_vout, "filter", psz_filter );
+ }
+ }
+
+ if( psz_filter ) free( psz_filter );
+
+ /* now restart all video streams */
+ p_input = (input_thread_t *)vlc_object_find( p_this, VLC_OBJECT_INPUT,
+ FIND_PARENT );
+ if( p_input )
+ {
+ vlc_mutex_lock( &p_input->stream.stream_lock );
+
+ p_vout->b_filter_change = VLC_TRUE;
+
+#define ES p_input->stream.pp_es[i]
+
+ for( i = 0 ; i < p_input->stream.i_es_number ; i++ )
+ {
+ if( ( ES->i_cat == VIDEO_ES ) && ES->p_decoder_fifo != NULL )
+ {
+ input_UnselectES( p_input, ES );
+ input_SelectES( p_input, ES );
+ }
+#undef ES
+ }
+ vlc_mutex_unlock( &p_input->stream.stream_lock );
+
+ vlc_object_release( p_input );
+ }
+
+ if( psz_mode && *psz_mode )
+ {
+ val.psz_string = psz_mode;
+ if( var_Set( p_vout, "deinterlace-mode", val ) != VLC_SUCCESS )
+ config_PutPsz( p_vout, "deinterlace-mode", psz_mode );
+ }
+
+ val.b_bool = VLC_TRUE;
+ var_Set( p_vout, "intf-change", val );
+ return VLC_SUCCESS;
+}