/* */
DeinterlaceEnable( p_vout );
- vlc_object_set_destructor( p_vout, vout_Destructor );
+ if( p_vout->p->psz_filter_chain && *p_vout->p->psz_filter_chain )
+ p_vout->p->psz_module_type = "video filter";
+ else
+ p_vout->p->psz_module_type = "video output";
+ p_vout->p->psz_module_name = psz_name;
+ p_vout->p_module = NULL;
/* */
- p_vout->p_module = module_need( p_vout,
- ( p_vout->p->psz_filter_chain && *p_vout->p->psz_filter_chain ) ?
- "video filter" : "video output", psz_name, p_vout->p->psz_filter_chain && *p_vout->p->psz_filter_chain );
- free( psz_name );
-
- if( p_vout->p_module == NULL )
- {
- msg_Err( p_vout, "no suitable vout module" );
- spu_Attach( p_vout->p_spu, VLC_OBJECT(p_vout), false );
- spu_Destroy( p_vout->p_spu );
- p_vout->p_spu = NULL;
- vlc_object_release( p_vout );
- return NULL;
- }
+ vlc_object_set_destructor( p_vout, vout_Destructor );
/* */
vlc_cond_init( &p_vout->p->change_wait );
if( vlc_clone( &p_vout->p->thread, RunThread, p_vout,
VLC_THREAD_PRIORITY_OUTPUT ) )
{
- module_unneed( p_vout, p_vout->p_module );
- p_vout->p_module = NULL;
spu_Attach( p_vout->p_spu, VLC_OBJECT(p_vout), false );
spu_Destroy( p_vout->p_spu );
p_vout->p_spu = NULL;
vout_snapshot_End( &p_vout->p->snapshot );
vlc_join( p_vout->p->thread, NULL );
- module_unneed( p_vout, p_vout->p_module );
- p_vout->p_module = NULL;
}
/* */
/* Make sure the vout was stopped first */
assert( !p_vout->p_module );
+ free( p_vout->p->psz_module_name );
+
/* */
if( p_vout->p_spu )
spu_Destroy( p_vout->p_spu );
int i_idle_loops = 0; /* loops without displaying a picture */
int i_picture_qtype_last = QTYPE_NONE;
- bool b_drop_late;
+
+ vlc_mutex_lock( &p_vout->change_lock );
/*
* Initialize thread
*/
- vlc_mutex_lock( &p_vout->change_lock );
- p_vout->b_error = InitThread( p_vout );
-
- b_drop_late = var_CreateGetBool( p_vout, "drop-late-frames" );
+ p_vout->p_module = module_need( p_vout,
+ p_vout->p->psz_module_type,
+ p_vout->p->psz_module_name,
+ !strcmp(p_vout->p->psz_module_type, "video filter") );
+ if( p_vout->p_module )
+ p_vout->b_error = InitThread( p_vout );
+ else
+ p_vout->b_error = true;
/* signal the creation of the vout */
p_vout->p->b_ready = true;
vlc_cond_signal( &p_vout->p->change_wait );
if( p_vout->b_error )
- {
- EndThread( p_vout );
- vlc_mutex_unlock( &p_vout->change_lock );
- return NULL;
- }
+ goto exit_thread;
+
+ /* */
+ const bool b_drop_late = var_CreateGetBool( p_vout, "drop-late-frames" );
/*
* Main loop - it is not executed if an error occurred during
if( p_vout->pf_init( p_vout ) )
{
msg_Err( p_vout, "cannot resize display" );
- /* FIXME: pf_end will be called again in EndThread() */
+ /* FIXME: pf_end will be called again in CleanThread()? */
p_vout->b_error = 1;
}
if( p_vout->b_error )
ErrorThread( p_vout );
- /* End of thread */
+ /* Clean thread */
CleanThread( p_vout );
+
+exit_thread:
+ /* End of thread */
EndThread( p_vout );
vlc_mutex_unlock( &p_vout->change_lock );
+ if( p_vout->p_module )
+ module_unneed( p_vout, p_vout->p_module );
+ p_vout->p_module = NULL;
+
return NULL;
}
typedef struct
{
const char *psz_mode;
- const char *psz_description;
bool b_vout_filter;
} deinterlace_mode_t;
* same (width/height/chroma/fps), at least for now.
*/
static const deinterlace_mode_t p_deinterlace_mode[] = {
- { "", "Disable", false },
- { "discard", "Discard", true },
- { "blend", "Blend", false },
- { "mean", "Mean", true },
- { "bob", "Bob", true },
- { "linear", "Linear", true },
- { "x", "X", false },
- { NULL, NULL, true }
+ { "", false },
+ { "discard", true },
+ { "blend", false },
+ { "mean", true },
+ { "bob", true },
+ { "linear", true },
+ { "x", false },
+ { "yadif", true },
+ { "yadif2x", true },
+ { NULL, true }
};
static char *FilterFind( char *psz_filter_base, const char *psz_module )
input_thread_t *p_input = (input_thread_t *)vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_PARENT );
if( p_input )
{
- var_Create( p_input, "vout-deinterlace", VLC_VAR_STRING );
- var_SetString( p_input, "vout-deinterlace", p_mode->psz_mode );
-
var_Create( p_input, "deinterlace-mode", VLC_VAR_STRING );
- var_SetString( p_input, "deinterlace-mode", p_mode->psz_mode );
+ var_SetString( p_input, "deinterlace-mode", *p_mode->psz_mode ? p_mode->psz_mode : "disable" );
+
+ var_Create( p_input, "filter-deinterlace-mode", VLC_VAR_STRING );
+ var_SetString( p_input, "filter-deinterlace-mode", p_mode->psz_mode );
var_Create( p_input, "sout-deinterlace-mode", VLC_VAR_STRING );
var_SetString( p_input, "sout-deinterlace-mode", p_mode->psz_mode );
if( p_mode->b_vout_filter )
{
- psz_old = var_CreateGetString( p_vout, "deinterlace-mode" );
+ psz_old = var_CreateGetString( p_vout, "filter-deinterlace-mode" );
}
else
{
msg_Dbg( p_vout, "Deinterlacing available" );
/* Create the configuration variable */
- var_Create( p_vout, "deinterlace", VLC_VAR_STRING | VLC_VAR_HASCHOICE );
- text.psz_string = _("Deinterlace");
- var_Change( p_vout, "deinterlace", VLC_VAR_SETTEXT, &text, NULL );
+ var_Create( p_vout, "deinterlace-mode", VLC_VAR_STRING | VLC_VAR_DOINHERIT | VLC_VAR_HASCHOICE );
+ char *psz_deinterlace = var_GetNonEmptyString( p_vout, "deinterlace-mode" );
+
+ text.psz_string = _("Deinterlace mode");
+ var_Change( p_vout, "deinterlace-mode", VLC_VAR_SETTEXT, &text, NULL );
- for( int i = 0; p_deinterlace_mode[i].psz_mode; i++ )
+ const module_config_t *p_opt = config_FindConfig( VLC_OBJECT(p_vout), "deinterlace-mode" );
+ var_Change( p_vout, "deinterlace-mode", VLC_VAR_CLEARCHOICES, NULL, NULL );
+ for( int i = 0; p_opt && i < p_opt->i_list; i++ )
{
- val.psz_string = (char*)p_deinterlace_mode[i].psz_mode;
- text.psz_string = (char*)vlc_gettext(p_deinterlace_mode[i].psz_description);
- var_Change( p_vout, "deinterlace", VLC_VAR_ADDCHOICE, &val, &text );
+ val.psz_string = p_opt->ppsz_list[i];
+ text.psz_string = (char*)vlc_gettext(p_opt->ppsz_list_text[i]);
+ var_Change( p_vout, "deinterlace-mode", VLC_VAR_ADDCHOICE, &val, &text );
}
- var_AddCallback( p_vout, "deinterlace", DeinterlaceCallback, NULL );
+ var_AddCallback( p_vout, "deinterlace-mode", DeinterlaceCallback, NULL );
/* */
- char *psz_mode = NULL;
- if( var_Type( p_vout, "vout-deinterlace" ) != 0 )
- psz_mode = var_CreateGetNonEmptyString( p_vout, "vout-deinterlace" );
+ char *psz_mode = psz_deinterlace;
+ if( psz_mode && !strcmp( psz_mode, "disable" ) )
+ {
+ free( psz_mode );
+ psz_mode = strdup( "" );
+ }
if( !psz_mode )
{
- /* Get the initial value */
+ /* Get the initial value from filters if present */
if( DeinterlaceIsPresent( p_vout, true ) )
- psz_mode = var_CreateGetNonEmptyString( p_vout, "deinterlace-mode" );
+ psz_mode = var_CreateGetNonEmptyString( p_vout, "filter-deinterlace-mode" );
else if( DeinterlaceIsPresent( p_vout, false ) )
psz_mode = var_CreateGetNonEmptyString( p_vout, "sout-deinterlace-mode" );
}
- var_SetString( p_vout, "deinterlace", psz_mode ? psz_mode : "" );
+ var_SetString( p_vout, "deinterlace-mode", psz_mode ? psz_mode : "" );
free( psz_mode );
}