/*****************************************************************************
* visual.c : Visualisation system
*****************************************************************************
- * Copyright (C) 2002-2006 the VideoLAN team
+ * Copyright (C) 2002-2009 the VideoLAN team
* $Id$
*
* Authors: Clément Stenac <zorglub@via.ecp.fr>
#define ELIST_TEXT N_( "Effects list" )
#define ELIST_LONGTEXT N_( \
"A list of visual effect, separated by commas.\n" \
- "Current effects include: dummy, scope, spectrum." )
+ "Current effects include: dummy, scope, spectrum, "\
+ "spectrometer and vuMeter." )
#define WIDTH_TEXT N_( "Video width" )
#define WIDTH_LONGTEXT N_( \
#define HEIGHT_LONGTEXT N_( \
"The height of the effects video window, in pixels." )
-#define NBBANDS_TEXT N_( "Number of bands" )
+#define NBBANDS_TEXT N_( "More bands : 80 / 20" )
#define NBBANDS_LONGTEXT N_( \
- "Number of bands used by spectrum analyzer, should be 20 or 80." )
+ "More bands for the spectrum analyzer : 80 if enabled else 20." )
#define SPNBBANDS_LONGTEXT N_( \
- "Number of bands used by the spectrometer, from 20 to 80." )
+ "More bands for the spectrometer : 80 if enabled else 20." )
#define SEPAR_TEXT N_( "Band separator" )
#define SEPAR_LONGTEXT N_( \
set_description( N_("Visualizer filter") )
set_section( N_( "General") , NULL )
add_string("effect-list", "spectrum", NULL,
- ELIST_TEXT, ELIST_LONGTEXT, true );
+ ELIST_TEXT, ELIST_LONGTEXT, true )
add_integer("effect-width",VOUT_WIDTH,NULL,
- WIDTH_TEXT, WIDTH_LONGTEXT, false );
+ WIDTH_TEXT, WIDTH_LONGTEXT, false )
add_integer("effect-height" , VOUT_HEIGHT , NULL,
- HEIGHT_TEXT, HEIGHT_LONGTEXT, false );
+ HEIGHT_TEXT, HEIGHT_LONGTEXT, false )
set_section( N_("Spectrum analyser") , NULL )
- add_integer("visual-nbbands", 80, NULL,
+ add_obsolete_integer( "visual-nbbands" ) /* Since 1.0.0 */
+ add_bool("visual-80-bands", true, NULL,
NBBANDS_TEXT, NBBANDS_LONGTEXT, true );
- add_integer("visual-separ", 1, NULL,
- SEPAR_TEXT, SEPAR_LONGTEXT, true );
- add_integer("visual-amp", 3, NULL,
- AMP_TEXT, AMP_LONGTEXT, true );
+ add_obsolete_integer( "visual-separ" ) /* Since 1.0.0 */
+ add_obsolete_integer( "visual-amp" ) /* Since 1.0.0 */
add_bool("visual-peaks", true, NULL,
- PEAKS_TEXT, PEAKS_LONGTEXT, true );
+ PEAKS_TEXT, PEAKS_LONGTEXT, true )
set_section( N_("Spectrometer") , NULL )
add_bool("spect-show-original", false, NULL,
- ORIG_TEXT, ORIG_LONGTEXT, true );
+ ORIG_TEXT, ORIG_LONGTEXT, true )
add_bool("spect-show-base", true, NULL,
- BASE_TEXT, BASE_LONGTEXT, true );
+ BASE_TEXT, BASE_LONGTEXT, true )
add_integer("spect-radius", 42, NULL,
- RADIUS_TEXT, RADIUS_LONGTEXT, true );
+ RADIUS_TEXT, RADIUS_LONGTEXT, true )
add_integer("spect-sections", 3, NULL,
- SSECT_TEXT, SSECT_LONGTEXT, true );
+ SSECT_TEXT, SSECT_LONGTEXT, true )
add_integer("spect-color", 80, NULL,
- COLOR1_TEXT, COLOR1_LONGTEXT, true );
+ COLOR1_TEXT, COLOR1_LONGTEXT, true )
add_bool("spect-show-bands", true, NULL,
BANDS_TEXT, BANDS_LONGTEXT, true );
- add_integer("spect-nbbands", 32, NULL,
- NBBANDS_TEXT, SPNBBANDS_LONGTEXT, true );
+ add_obsolete_integer( "spect-nbbands" ) /* Since 1.0.0 */
+ add_bool("spect-80-bands", true, NULL,
+ NBBANDS_TEXT, SPNBBANDS_LONGTEXT, true )
add_integer("spect-separ", 1, NULL,
- SEPAR_TEXT, SEPAR_LONGTEXT, true );
+ SEPAR_TEXT, SEPAR_LONGTEXT, true )
add_integer("spect-amp", 8, NULL,
- AMP_TEXT, AMP_LONGTEXT, true );
+ AMP_TEXT, AMP_LONGTEXT, true )
add_bool("spect-show-peaks", true, NULL,
- PEAKS_TEXT, PEAKS_LONGTEXT, true );
+ PEAKS_TEXT, PEAKS_LONGTEXT, true )
add_integer("spect-peak-width", 61, NULL,
- PEAK_WIDTH_TEXT, PEAK_WIDTH_LONGTEXT, true );
+ PEAK_WIDTH_TEXT, PEAK_WIDTH_LONGTEXT, true )
add_integer("spect-peak-height", 1, NULL,
- PEAK_HEIGHT_TEXT, PEAK_HEIGHT_LONGTEXT, true );
+ PEAK_HEIGHT_TEXT, PEAK_HEIGHT_LONGTEXT, true )
set_capability( "visualization", 0 )
set_callbacks( Open, Close )
add_shortcut( "visualizer")
aout_buffer_t *, picture_t *);
} pf_effect_run[]=
{
- { "scope", scope_Run },
- { "vuMeter", vuMeter_Run },
- { "spectrum", spectrum_Run },
- { "spectrometer", spectrometer_Run },
- { "dummy", dummy_Run},
- { NULL, dummy_Run}
+ { "scope", scope_Run },
+ { "vuMeter", vuMeter_Run },
+ { "spectrum", spectrum_Run },
+ { "spectrometer", spectrometer_Run },
+ { "dummy", dummy_Run},
+ { NULL, dummy_Run}
};
/*****************************************************************************
{
aout_filter_t *p_filter = (aout_filter_t *)p_this;
aout_filter_sys_t *p_sys;
- vlc_value_t val;
char *psz_effects, *psz_parser;
video_format_t fmt;
-
- if( ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2') &&
- p_filter->input.i_format != VLC_FOURCC('f','i','3','2') ) )
+ if( ( p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32 &&
+ p_filter->fmt_in.audio.i_format != VLC_CODEC_FI32 ) )
{
return VLC_EGENERIC;
}
p_sys->i_height = config_GetInt( p_filter , "effect-height");
p_sys->i_width = config_GetInt( p_filter , "effect-width");
- if( p_sys->i_height < 20 ) p_sys->i_height = 20;
- if( p_sys->i_width < 20 ) p_sys->i_width = 20;
+ if( p_sys->i_height < 400 ) p_sys->i_height = 400;
+ if( p_sys->i_width < 532 ) p_sys->i_width = 532;
if( (p_sys->i_height % 2 ) != 0 ) p_sys->i_height--;
if( (p_sys->i_width % 2 ) != 0 ) p_sys->i_width--;
p_sys->effect = NULL;
/* Parse the effect list */
- var_Create( p_filter, "effect-list", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
- var_Get( p_filter, "effect-list", &val);
- psz_parser = psz_effects = strdup( val.psz_string );
- free( val.psz_string );
-
+ psz_parser = psz_effects = var_CreateGetString( p_filter, "effect-list" );
var_AddCallback( p_filter, "effect-list", FilterCallback, NULL );
while( psz_parser && *psz_parser != '\0' )
break;
p_effect->i_width = p_sys->i_width;
p_effect->i_height= p_sys->i_height;
- p_effect->i_nb_chans = aout_FormatNbChannels( &p_filter->input);
+ p_effect->i_nb_chans = aout_FormatNbChannels( &p_filter->fmt_in.audio);
+ p_effect->i_idx_left = 0;
+ p_effect->i_idx_right = __MIN( 1, p_effect->i_nb_chans-1 );
+
p_effect->psz_args = NULL;
p_effect->p_data = NULL;
strlen( pf_effect_run[i].psz_name ) ) )
{
p_effect->pf_run = pf_effect_run[i].pf_run;
- p_effect->psz_name = strdup( pf_effect_run[i].psz_name );
+ p_effect->psz_name = pf_effect_run[i].psz_name;
break;
}
}
if( ( psz_eoa = strchr( psz_parser, '}') ) == NULL )
{
msg_Err( p_filter, "unable to parse effect list. Aborting");
+ free( p_effect );
break;
}
p_effect->psz_args =
fmt.i_width = fmt.i_visible_width = p_sys->i_width;
fmt.i_height = fmt.i_visible_height = p_sys->i_height;
- fmt.i_chroma = VLC_FOURCC('I','4','2','0');
+ fmt.i_chroma = VLC_CODEC_I420;
fmt.i_aspect = VOUT_ASPECT_FACTOR * p_sys->i_width/p_sys->i_height;
fmt.i_sar_num = fmt.i_sar_den = 1;
if( p_sys->p_vout == NULL )
{
msg_Err( p_filter, "no suitable vout module" );
+ for( int i = 0; i < p_sys->i_effect; i++ )
+ {
+ free( p_sys->effect[i]->psz_args );
+ free( p_sys->effect[i] );
+ }
+ free( p_sys->effect );
free( p_sys );
return VLC_EGENERIC;
}
int i;
p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
- p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes *
- aout_FormatNbChannels( &p_filter->output ) /
- aout_FormatNbChannels( &p_filter->input );
+ p_out_buf->i_buffer = p_in_buf->i_buffer *
+ aout_FormatNbChannels( &p_filter->fmt_out.audio ) /
+ aout_FormatNbChannels( &p_filter->fmt_in.audio );
/* First, get a new picture */
while( ( p_outpic = vout_CreatePicture( p_sys->p_vout, 0, 0, 3 ) ) == NULL)
#undef p_effect
}
- p_outpic->date = ( p_in_buf->start_date + p_in_buf->end_date ) / 2;
+ p_outpic->date = p_in_buf->i_pts + (p_in_buf->i_length / 2);
vout_DisplayPicture( p_sys->p_vout, p_outpic );
}
for( i = 0; i < p_sys->i_effect; i++ )
{
#define p_effect p_sys->effect[i]
+ if( !strncmp( p_effect->psz_name, "spectrum", strlen( "spectrum" ) ) )
+ {
+ free( ( ( spectrum_data * )p_effect->p_data )->peaks );
+ free( ( ( spectrum_data * )p_effect->p_data )->prev_heights );
+ }
free( p_effect->p_data );
- free( p_effect->psz_name );
free( p_effect->psz_args );
free( p_effect );
#undef p_effect