X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fvideo_filter%2Fdistort.c;h=ab27a8280e322d9a17927d621a0981bb9c3e8548;hb=ffdca9af740e111153ab385cf00e887c652e7b4c;hp=02c9fdd76ea76882821992a7bb4564347e00068f;hpb=976a25d5c9f1d3ecc622209dc9d8ed85952adc6a;p=vlc diff --git a/modules/video_filter/distort.c b/modules/video_filter/distort.c index 02c9fdd76e..ab27a8280e 100644 --- a/modules/video_filter/distort.c +++ b/modules/video_filter/distort.c @@ -2,7 +2,7 @@ * distort.c : Misc video effects plugin for vlc ***************************************************************************** * Copyright (C) 2000, 2001, 2002, 2003 VideoLAN - * $Id: distort.c,v 1.8 2003/03/18 23:30:28 gbazin Exp $ + * $Id: distort.c,v 1.14 2004/01/25 20:05:28 hartman Exp $ * * Authors: Samuel Hocevar * @@ -56,17 +56,20 @@ static int SendEvents ( vlc_object_t *, char const *, /***************************************************************************** * Module descriptor *****************************************************************************/ -#define MODE_TEXT N_("distort mode") +#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 video effects module") ); + set_description( _("Distort video filter") ); set_capability( "video filter", 0 ); + + 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(); @@ -112,53 +115,30 @@ static int Create( vlc_object_t *p_this ) p_vout->pf_display = NULL; 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 ); @@ -201,6 +181,8 @@ static int Init( vout_thread_t *p_vout ) 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; @@ -235,6 +217,8 @@ static void Destroy( vlc_object_t *p_this ) 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 ); } @@ -437,3 +421,13 @@ static int SendEvents( vlc_object_t *p_this, char const *psz_var, 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; +}