use the configuration system, that is what it is there for

parent 7bb574fd
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* effects.c : Effects for the visualization system * effects.c : Effects for the visualization system
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: effects.c,v 1.3 2003/08/31 16:01:14 zorglub Exp $ * $Id: effects.c,v 1.4 2003/09/02 22:06:51 sigmunau Exp $
* *
* Authors: Clment Stenac <zorglub@via.ecp.fr> * Authors: Clment Stenac <zorglub@via.ecp.fr>
* *
...@@ -30,74 +30,6 @@ ...@@ -30,74 +30,6 @@
#include "fft.h" #include "fft.h"
#define PEAK_SPEED 1 #define PEAK_SPEED 1
/*****************************************************************************
* Argument list parsers *
*****************************************************************************/
int args_getint(char *psz_parse, char * name,const int defaut)
{
char *psz_eof;
int i_value;
if( psz_parse != NULL )
{
while(1)
{
if(!strncmp( psz_parse, name, strlen(name) ) )
{
psz_parse += strlen( name );
psz_eof = strchr( psz_parse , ',' );
if( !psz_eof)
psz_eof = psz_parse + strlen(psz_parse);
if( psz_eof )
{
*psz_eof = '\0' ;
}
i_value = atoi(++psz_parse);
psz_parse= psz_eof;
psz_parse++;
return i_value;
}
if( *psz_parse )
psz_parse ++;
else
break;
}
}
return defaut;
}
char * args_getpsz(char *psz_parse, char * name,const char * defaut)
{
char *psz_eof;
char *psz_value;
if( psz_parse != NULL )
{
while(1)
{
if(!strncmp( psz_parse, name, strlen(name) ) )
{
psz_parse += strlen( name );
psz_eof = strchr( psz_parse , ',' );
if( !psz_eof)
psz_eof = psz_parse + strlen(psz_parse);
if( psz_eof )
{
*psz_eof = '\0' ;
}
psz_value = strdup(++psz_parse);
psz_parse= psz_eof;
psz_parse++;
return psz_value;
}
if( *psz_parse )
psz_parse ++;
else
break;
}
}
return strdup(defaut);
}
/***************************************************************************** /*****************************************************************************
* dummy_Run * dummy_Run
...@@ -162,24 +94,10 @@ int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout, ...@@ -162,24 +94,10 @@ int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
} }
p_buffs = p_s16_buff; p_buffs = p_s16_buff;
if( p_effect->psz_args ) i_nb_bands = config_GetInt ( p_aout, "visual-nb" );
{ i_separ = config_GetInt( p_aout, "visual-separ" );
psz_parse = strdup( p_effect->psz_args ); i_amp = config_GetInt ( p_aout, "visual-amp" );
i_nb_bands = args_getint ( psz_parse , "nb" , 80 ); i_peak = config_GetInt ( p_aout, "visual-peaks" );
psz_parse = strdup( p_effect->psz_args );
i_separ = args_getint ( psz_parse , "separ", 1 );
psz_parse = strdup( p_effect->psz_args );
i_amp = args_getint ( psz_parse , "amp", 3 );
psz_parse = strdup( p_effect->psz_args );
i_peak = args_getint ( psz_parse , "peaks", 1 );
}
else
{
i_nb_bands = 80;
i_separ = 1;
i_amp = 3;
i_peak = 1;
}
if( i_nb_bands == 20) if( i_nb_bands == 20)
{ {
...@@ -468,7 +386,7 @@ int random_Run(visual_effect_t * p_effect, aout_instance_t *p_aout, ...@@ -468,7 +386,7 @@ int random_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
if( p_effect->psz_args ) if( p_effect->psz_args )
{ {
psz_parse = strdup( p_effect->psz_args ); psz_parse = strdup( p_effect->psz_args );
i_nb_plots = args_getint ( psz_parse , "nb" , 200 ); i_nb_plots = config_GetInt ( p_aout, "visual-nb" );
} }
else else
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* visual.c : Visualisation system * visual.c : Visualisation system
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: visual.c,v 1.2 2003/08/29 16:56:43 zorglub Exp $ * $Id: visual.c,v 1.3 2003/09/02 22:06:51 sigmunau Exp $
* *
* Authors: Clment Stenac <zorglub@via.ecp.fr> * Authors: Clment Stenac <zorglub@via.ecp.fr>
* *
...@@ -54,15 +54,28 @@ static void DoWork ( aout_instance_t *, aout_filter_t *, aout_buffer_t *, ...@@ -54,15 +54,28 @@ static void DoWork ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
#define WIDTH_LONGTEXT N_( \ #define WIDTH_LONGTEXT N_( \
"The width of the effects video window, in pixels." ) "The width of the effects video window, in pixels." )
#define NB_TEXT N_( "Number of bands" )
#define NB_LONGTEXT N_( \
"Number of bands used by spectrum analizer, should be 20 or 80" )
static char *effect_list[] = { "dummy", "random", "scope", "spectrum", NULL };
vlc_module_begin(); vlc_module_begin();
add_category_hint( N_("visualizer") , NULL , VLC_FALSE); add_category_hint( N_("visualizer") , NULL , VLC_FALSE);
set_description( _("visualizer filter") ); set_description( _("visualizer filter") );
add_string("effect-list", "dummy", NULL, add_string_from_list("effect-list", "dummy", effect_list, NULL,
ELIST_TEXT, ELIST_LONGTEXT, VLC_TRUE ); ELIST_TEXT, ELIST_LONGTEXT, VLC_TRUE );
add_integer("effect-width",VOUT_WIDTH,NULL, add_integer("effect-width",VOUT_WIDTH,NULL,
WIDTH_TEXT, WIDTH_LONGTEXT, VLC_FALSE ); WIDTH_TEXT, WIDTH_LONGTEXT, VLC_FALSE );
add_integer("effect-height" , VOUT_HEIGHT , NULL, add_integer("effect-height" , VOUT_HEIGHT , NULL,
HEIGHT_TEXT, HEIGHT_LONGTEXT, VLC_FALSE ); HEIGHT_TEXT, HEIGHT_LONGTEXT, VLC_FALSE );
add_integer("visual-nb", 80, NULL,
NB_TEXT, NB_LONGTEXT, VLC_FALSE );
add_integer("visual-separ", 1, NULL,
NB_TEXT, NB_LONGTEXT, VLC_FALSE );
add_integer("visual-amp", 3, NULL,
NB_TEXT, NB_LONGTEXT, VLC_FALSE );
add_bool("visual-peaks", VLC_TRUE, NULL,
NB_TEXT, NB_LONGTEXT, VLC_FALSE );
set_capability( "audio filter", 0 ); set_capability( "audio filter", 0 );
set_callbacks( Open, Close ); set_callbacks( Open, Close );
add_shortcut( "visualizer"); add_shortcut( "visualizer");
...@@ -313,7 +326,7 @@ static void DoWork( aout_instance_t *p_aout, aout_filter_t *p_filter, ...@@ -313,7 +326,7 @@ static void DoWork( aout_instance_t *p_aout, aout_filter_t *p_filter,
{ {
if(p_aout->b_die ) if(p_aout->b_die )
return; return;
msleep( VOUT_OUTMEM_SLEEP ); msleep( 2 );
} }
/* Blank the picture */ /* Blank the picture */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment