* distort.c : Misc video effects plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001, 2002, 2003 VideoLAN
- * $Id: distort.c,v 1.10 2003/05/15 22:27:37 massiot Exp $
+ * $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
#define MODE_TEXT N_("Distort mode")
#define MODE_LONGTEXT N_("Distort mode, one of \"wave\" and \"ripple\"")
-static char *mode_list[] = { "wave", "ripple", NULL };
+static char *mode_list[] = { "wave", "ripple" };
+static char *mode_list_text[] = { N_("Wave"), N_("Ripple") };
vlc_module_begin();
- add_category_hint( N_("Distort"), NULL, VLC_FALSE );
- add_string_from_list( "distort-mode", "wave", mode_list, NULL,
- MODE_TEXT, MODE_LONGTEXT, VLC_FALSE );
- set_description( _("miscellaneous distort video effects filter") );
+ set_description( _("Distort video filter") );
+ set_shortname( N_( "Distortion" ));
set_capability( "video filter", 0 );
+ set_category( CAT_VIDEO );
+ set_subcategory( SUBCAT_VIDEO_VFILTER );
+
+ add_string( "distort-mode", "wave", NULL, MODE_TEXT, MODE_LONGTEXT,
+ VLC_FALSE );
+ change_string_list( mode_list, mode_list_text, 0 );
+
add_shortcut( "distort" );
set_callbacks( Create, Destroy );
vlc_module_end();
mtime_t last_date;
};
+/*****************************************************************************
+ * Control: control facility for the vout (forwards to child vout)
+ *****************************************************************************/
+static int Control( vout_thread_t *p_vout, int i_query, va_list args )
+{
+ return vout_vaControl( p_vout->p_sys->p_vout, i_query, args );
+}
+
/*****************************************************************************
* Create: allocates Distort video thread output method
*****************************************************************************
p_vout->pf_manage = NULL;
p_vout->pf_render = Render;
p_vout->pf_display = NULL;
+ p_vout->pf_control = Control;
p_vout->p_sys->i_mode = 0;
- /* Look what method was requested from command line*/
- if( !(psz_method = psz_method_tmp = config_GetPsz( p_vout, "filter" )) )
- {
- msg_Err( p_vout, "configuration variable %s empty", "filter" );
- return VLC_EGENERIC;
- }
- while( *psz_method && *psz_method != ':' )
- {
- psz_method++;
- }
- if( !strcmp( psz_method, ":wave" ) )
+ if( !(psz_method = psz_method_tmp
+ = config_GetPsz( p_vout, "distort-mode" )) )
{
+ msg_Err( p_vout, "configuration variable %s empty, using 'wave'",
+ "distort-mode" );
p_vout->p_sys->i_mode = DISTORT_MODE_WAVE;
}
- else if( !strcmp( psz_method, ":ripple" ) )
- {
- p_vout->p_sys->i_mode = DISTORT_MODE_RIPPLE;
- }
- free( psz_method_tmp );
- if( !p_vout->p_sys->i_mode )
+ else
{
- /* No method given in commandline. Look what method was
- requested in configuration system */
- if( !(psz_method = psz_method_tmp
- = config_GetPsz( p_vout, "distort-mode" )) )
+
+ if( !strcmp( psz_method, "wave" ) )
{
- msg_Err( p_vout, "configuration variable %s empty, using 'wave'",
- "distort-mode" );
p_vout->p_sys->i_mode = DISTORT_MODE_WAVE;
}
- else {
-
- if( !strcmp( psz_method, "wave" ) )
- {
- p_vout->p_sys->i_mode = DISTORT_MODE_WAVE;
- }
- else if( !strcmp( psz_method, "ripple" ) )
- {
- p_vout->p_sys->i_mode = DISTORT_MODE_RIPPLE;
- }
- else
- {
- msg_Err( p_vout, "no valid distort mode provided, "
- "using wave" );
- p_vout->p_sys->i_mode = DISTORT_MODE_WAVE;
- }
+ else if( !strcmp( psz_method, "ripple" ) )
+ {
+ p_vout->p_sys->i_mode = DISTORT_MODE_RIPPLE;
+ }
+ else
+ {
+ msg_Err( p_vout, "no valid distort mode provided, "
+ "using wave" );
+ p_vout->p_sys->i_mode = DISTORT_MODE_WAVE;
}
}
free( psz_method_tmp );
if( p_vout->p_sys->p_vout == NULL )
{
msg_Err( p_vout, "cannot open vout, aborting" );
-
return VLC_EGENERIC;
}
ADD_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
+ ADD_PARENT_CALLBACKS( SendEventsToChild );
+
p_vout->p_sys->f_angle = 0.0;
p_vout->p_sys->last_date = 0;
{
vout_thread_t *p_vout = (vout_thread_t *)p_this;
- DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
- vlc_object_detach( p_vout->p_sys->p_vout );
- vout_Destroy( p_vout->p_sys->p_vout );
+ if( p_vout->p_sys->p_vout )
+ {
+ DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
+ vlc_object_detach( p_vout->p_sys->p_vout );
+ vout_Destroy( p_vout->p_sys->p_vout );
+ }
+
+ DEL_PARENT_CALLBACKS( SendEventsToChild );
free( p_vout->p_sys );
}
p_in = p_inpic->p[i_index].p_pixels;
p_out = p_outpic->p[i_index].p_pixels;
- i_num_lines = p_inpic->p[i_index].i_lines;
+ i_num_lines = p_inpic->p[i_index].i_visible_lines;
black_pixel = ( i_index == Y_PLANE ) ? 0x00 : 0x80;
black_pixel = ( i_index == Y_PLANE ) ? 0x00 : 0x80;
- i_num_lines = p_inpic->p[i_index].i_lines;
+ i_num_lines = p_inpic->p[i_index].i_visible_lines;
i_first_line = i_num_lines * 4 / 5;
return VLC_SUCCESS;
}
+/*****************************************************************************
+ * SendEventsToChild: forward events to the child/children vout
+ *****************************************************************************/
+static int SendEventsToChild( vlc_object_t *p_this, char const *psz_var,
+ vlc_value_t oldval, vlc_value_t newval, void *p_data )
+{
+ vout_thread_t *p_vout = (vout_thread_t *)p_this;
+ var_Set( p_vout->p_sys->p_vout, psz_var, newval );
+ return VLC_SUCCESS;
+}