* rc/video_output/video_output.c, modules/video_filter/deinterlace/deinterlace.c: fixes to the deinterlace object var.
* variables.h: variables handling
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: variables.h,v 1.13 2003/05/04 22:42:14 gbazin Exp $
+ * $Id: variables.h,v 1.14 2003/05/24 23:40:11 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
#define VLC_VAR_FREELIST 0x0027
#define VLC_VAR_CHOICESCOUNT 0x0028
+#define VLC_VAR_INHERITVALUE 0x0030
+
/*****************************************************************************
* Prototypes
*****************************************************************************/
* deinterlace.c : deinterlacer plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001, 2002, 2003 VideoLAN
- * $Id: deinterlace.c,v 1.12 2003/05/15 22:27:37 massiot Exp $
+ * $Id: deinterlace.c,v 1.13 2003/05/24 23:40:11 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
vlc_mutex_init( p_vout, &p_vout->p_sys->filter_lock );
/* Look what method was requested */
- val.psz_string = config_GetPsz( p_vout, "deinterlace-mode" );
-
var_Create( p_vout, "deinterlace-mode", VLC_VAR_STRING );
+ var_Change( p_vout, "deinterlace-mode", VLC_VAR_INHERITVALUE, NULL, NULL );
+ var_Get( p_vout, "deinterlace-mode", &val );
if( val.psz_string == NULL )
{
- msg_Err( p_vout, "configuration variable %s empty",
- "deinterlace-mode" );
+ msg_Err( p_vout, "configuration variable deinterlace-mode empty" );
msg_Err( p_vout, "no deinterlace mode provided, using \"discard\"" );
val.psz_string = strdup( "discard" );
}
- var_Set( p_vout, "deinterlace-mode", val );
+ msg_Dbg( p_vout, "using %s deinterlace mode", val.psz_string );
SetFilterMethod( p_vout, val.psz_string );
vout_thread_t * p_vout = (vout_thread_t *)p_this;
int i_old_mode = p_vout->p_sys->i_mode;
+ msg_Dbg( p_vout, "using %s deinterlace mode", newval.psz_string );
+
vlc_mutex_lock( &p_vout->p_sys->filter_lock );
SetFilterMethod( p_vout, newval.psz_string );
* variables.c: routines for object variables handling
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: variables.c,v 1.24 2003/05/11 18:43:19 gbazin Exp $
+ * $Id: variables.c,v 1.25 2003/05/24 23:40:11 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
static void CheckValue ( variable_t *, vlc_value_t * );
+static int InheritValue( vlc_object_t *, const char *, vlc_value_t *,
+ int );
+
/*****************************************************************************
* var_Create: initialize a vlc variable
*****************************************************************************
p_val->psz_string = strdup( p_var->psz_text );
}
break;
+ case VLC_VAR_INHERITVALUE:
+ {
+ vlc_value_t val;
+
+ if( InheritValue( p_this, psz_name, &val, p_var->i_type )
+ == VLC_SUCCESS );
+ {
+ /* Duplicate already done */
+
+ /* Backup needed stuff */
+ oldval = p_var->val;
+ /* Check boundaries and list */
+ CheckValue( p_var, &val );
+ /* Set the variable */
+ p_var->val = val;
+ /* Free data if needed */
+ p_var->pf_free( &oldval );
+ }
+ }
+ break;
default:
break;
break;
}
}
+
+/*****************************************************************************
+ * InheritValue: try to inherit the value of this variable from the same one
+ * in our closest parent.
+ *****************************************************************************/
+static int InheritValue( vlc_object_t *p_this, const char *psz_name,
+ vlc_value_t *p_val, int i_type )
+{
+ int i_var;
+ variable_t *p_var;
+
+ /* No need to take the structure lock,
+ * we are only looking for our parents */
+
+ if( !p_this->p_parent )
+ {
+ switch( i_type & VLC_VAR_TYPE )
+ {
+ case VLC_VAR_STRING:
+ p_val->psz_string = config_GetPsz( p_this, psz_name );
+ if( !p_val->psz_string ) p_val->psz_string = strdup("");
+ break;
+ case VLC_VAR_FLOAT:
+ p_val->f_float = config_GetFloat( p_this, psz_name );
+ break;
+ case VLC_VAR_INTEGER:
+ p_val->i_int = config_GetInt( p_this, psz_name );
+ break;
+ case VLC_VAR_BOOL:
+ p_val->b_bool = config_GetInt( p_this, psz_name );
+ break;
+ default:
+ return VLC_ENOOBJ;
+ break;
+ }
+
+ return VLC_SUCCESS;
+ }
+
+ /* Look for the variable */
+ vlc_mutex_lock( &p_this->p_parent->var_lock );
+
+ i_var = Lookup( p_this->p_parent->p_vars, p_this->p_parent->i_vars,
+ psz_name );
+
+ if( i_var >= 0 )
+ {
+ /* We found it! */
+
+ p_var = &p_this->p_parent->p_vars[i_var];
+
+ /* Really get the variable */
+ *p_val = p_var->val;
+
+ /* Duplicate value if needed */
+ p_var->pf_dup( p_val );
+
+ vlc_mutex_unlock( &p_this->p_parent->var_lock );
+
+ return VLC_SUCCESS;
+ }
+
+ vlc_mutex_unlock( &p_this->p_parent->var_lock );
+
+ /* We're still not there */
+
+ return InheritValue( p_this->p_parent, psz_name, p_val, i_type );
+}
* thread, and destroy a previously oppened video output thread.
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
- * $Id: video_output.c,v 1.223 2003/05/24 20:54:27 gbazin Exp $
+ * $Id: video_output.c,v 1.224 2003/05/24 23:40:11 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
InitWindowSize( p_vout, &p_vout->i_window_width,
&p_vout->i_window_height );
+ /* Create thread and set locks */
+ vlc_mutex_init( p_vout, &p_vout->picture_lock );
+ vlc_mutex_init( p_vout, &p_vout->subpicture_lock );
+ vlc_mutex_init( p_vout, &p_vout->change_lock );
+
+ vlc_object_attach( p_vout, p_parent );
p_vout->p_module = module_Need( p_vout,
( p_vout->psz_filter_chain &&
var_Change( p_vout, "deinterlace", VLC_VAR_SETTEXT, &text, NULL );
val.psz_string = ""; text.psz_string = _("Disable");
var_Change( p_vout, "deinterlace", VLC_VAR_ADDCHOICE, &val, &text );
- var_Set( p_vout, "deinterlace", val );
val.psz_string = "discard"; text.psz_string = _("Discard");
var_Change( p_vout, "deinterlace", VLC_VAR_ADDCHOICE, &val, &text );
val.psz_string = "blend"; text.psz_string = _("Blend");
var_Change( p_vout, "deinterlace", VLC_VAR_ADDCHOICE, &val, &text );
val.psz_string = "linear"; text.psz_string = _("Linear");
var_Change( p_vout, "deinterlace", VLC_VAR_ADDCHOICE, &val, &text );
- //var_Change( p_vout, "deinterlace", VLC_VAR_INHERITVALUE, NULL, NULL );
+ if( var_Get( p_vout, "deinterlace-mode", &val ) == VLC_SUCCESS )
+ {
+ var_Set( p_vout, "deinterlace", val );
+ }
var_AddCallback( p_vout, "deinterlace", DeinterlaceCallback, NULL );
/* Calculate delay created by internal caching */
p_vout->i_pts_delay = DEFAULT_PTS_DELAY;
}
- /* Create thread and set locks */
- vlc_mutex_init( p_vout, &p_vout->picture_lock );
- vlc_mutex_init( p_vout, &p_vout->subpicture_lock );
- vlc_mutex_init( p_vout, &p_vout->change_lock );
-
- vlc_object_attach( p_vout, p_parent );
-
if( vlc_thread_create( p_vout, "video output", RunThread,
VLC_THREAD_PRIORITY_OUTPUT, VLC_TRUE ) )
{
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 )
+ if( !p_input ) return VLC_EGENERIC;
+
+ if( psz_mode && *psz_mode )
{
- vlc_mutex_lock( &p_input->stream.stream_lock );
+ val.psz_string = psz_mode;
+ var_Set( p_vout, "deinterlace-mode", val );
+ /* Modify input as well because the vout might have to be restarted */
+ var_Create( p_input, "deinterlace-mode", VLC_VAR_STRING );
+ var_Set( p_input, "deinterlace-mode", val );
+ }
- p_vout->b_filter_change = VLC_TRUE;
+ /* now restart all video streams */
+ 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++ )
+ for( i = 0 ; i < p_input->stream.i_es_number ; i++ )
+ {
+ if( ( ES->i_cat == VIDEO_ES ) && ES->p_decoder_fifo != NULL )
{
- if( ( ES->i_cat == VIDEO_ES ) && ES->p_decoder_fifo != NULL )
- {
- input_UnselectES( p_input, ES );
- input_SelectES( p_input, ES );
- }
-#undef ES
+ input_UnselectES( p_input, ES );
+ input_SelectES( p_input, ES );
}
- vlc_mutex_unlock( &p_input->stream.stream_lock );
-
- vlc_object_release( p_input );
+#undef ES
}
+ vlc_mutex_unlock( &p_input->stream.stream_lock );
- 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 );
- }
+ vlc_object_release( p_input );
val.b_bool = VLC_TRUE;
var_Set( p_vout, "intf-change", val );