/*****************************************************************************
* visual.c : Visualisation system
*****************************************************************************
/*****************************************************************************
* visual.c : Visualisation system
*****************************************************************************
#define ELIST_TEXT N_( "Effects list" )
#define ELIST_LONGTEXT N_( \
"A list of visual effect, separated by commas.\n" \
#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." )
HEIGHT_TEXT, HEIGHT_LONGTEXT, false )
set_section( N_("Spectrum analyser") , NULL )
add_obsolete_integer( "visual-nbbands" ) /* Since 1.0.0 */
HEIGHT_TEXT, HEIGHT_LONGTEXT, false )
set_section( N_("Spectrum analyser") , NULL )
add_obsolete_integer( "visual-nbbands" ) /* Since 1.0.0 */
- add_bool("visual-80-bands", 1, NULL,
+ add_bool("visual-80-bands", true, NULL,
NBBANDS_TEXT, NBBANDS_LONGTEXT, true );
add_obsolete_integer( "visual-separ" ) /* Since 1.0.0 */
add_obsolete_integer( "visual-amp" ) /* Since 1.0.0 */
NBBANDS_TEXT, NBBANDS_LONGTEXT, true );
add_obsolete_integer( "visual-separ" ) /* Since 1.0.0 */
add_obsolete_integer( "visual-amp" ) /* Since 1.0.0 */
add_bool("spect-show-bands", true, NULL,
BANDS_TEXT, BANDS_LONGTEXT, true );
add_obsolete_integer( "spect-nbbands" ) /* Since 1.0.0 */
add_bool("spect-show-bands", true, NULL,
BANDS_TEXT, BANDS_LONGTEXT, true );
add_obsolete_integer( "spect-nbbands" ) /* Since 1.0.0 */
- add_bool("spect-80-bands", 1, NULL,
+ add_bool("spect-80-bands", true, NULL,
NBBANDS_TEXT, SPNBBANDS_LONGTEXT, true )
add_integer("spect-separ", 1, NULL,
SEPAR_TEXT, SEPAR_LONGTEXT, true )
NBBANDS_TEXT, SPNBBANDS_LONGTEXT, true )
add_integer("spect-separ", 1, NULL,
SEPAR_TEXT, SEPAR_LONGTEXT, true )
PEAK_WIDTH_TEXT, PEAK_WIDTH_LONGTEXT, true )
add_integer("spect-peak-height", 1, NULL,
PEAK_HEIGHT_TEXT, PEAK_HEIGHT_LONGTEXT, true )
PEAK_WIDTH_TEXT, PEAK_WIDTH_LONGTEXT, true )
add_integer("spect-peak-height", 1, NULL,
PEAK_HEIGHT_TEXT, PEAK_HEIGHT_LONGTEXT, true )
set_callbacks( Open, Close )
add_shortcut( "visualizer")
vlc_module_end ()
set_callbacks( Open, Close )
add_shortcut( "visualizer")
vlc_module_end ()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static void DoWork( aout_instance_t *, aout_filter_t *,
- aout_buffer_t *, aout_buffer_t * );
+static block_t *DoWork( filter_t *, block_t * );
static int FilterCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
static const struct
{
const char *psz_name;
static int FilterCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
static const struct
{
const char *psz_name;
- int (*pf_run)( visual_effect_t *, aout_instance_t *,
- aout_buffer_t *, picture_t *);
+ int (*pf_run)( visual_effect_t *, vlc_object_t *,
+ const block_t *, picture_t *);
- { "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}
*****************************************************************************/
static int Open( vlc_object_t *p_this )
{
*****************************************************************************/
static int Open( vlc_object_t *p_this )
{
- if( ( p_filter->input.i_format != VLC_CODEC_FL32 &&
- p_filter->input.i_format != VLC_CODEC_FI32 ) )
+ if( ( p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32 &&
+ p_filter->fmt_in.audio.i_format != VLC_CODEC_FI32 ) )
- p_sys->i_height = config_GetInt( p_filter , "effect-height");
- p_sys->i_width = config_GetInt( p_filter , "effect-width");
+ p_sys->i_height = var_InheritInteger( p_filter , "effect-height");
+ p_sys->i_width = var_InheritInteger( p_filter , "effect-width");
- 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 );
+
if( ( psz_eoa = strchr( psz_parser, '}') ) == NULL )
{
msg_Err( p_filter, "unable to parse effect list. Aborting");
if( ( psz_eoa = strchr( psz_parser, '}') ) == NULL )
{
msg_Err( p_filter, "unable to parse effect list. Aborting");
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_CODEC_I420;
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_CODEC_I420;
fmt.i_sar_num = fmt.i_sar_den = 1;
p_sys->p_vout = aout_filter_RequestVout( p_filter, NULL, &fmt );
fmt.i_sar_num = fmt.i_sar_den = 1;
p_sys->p_vout = aout_filter_RequestVout( p_filter, NULL, &fmt );
msg_Err( p_filter, "no suitable vout module" );
for( int i = 0; i < p_sys->i_effect; i++ )
{
msg_Err( p_filter, "no suitable vout module" );
for( int i = 0; i < p_sys->i_effect; i++ )
{
*****************************************************************************
* Audio part pasted from trivial.c
****************************************************************************/
*****************************************************************************
* Audio part pasted from trivial.c
****************************************************************************/
-static void DoWork( aout_instance_t *p_aout, aout_filter_t *p_filter,
- aout_buffer_t *p_in_buf, aout_buffer_t *p_out_buf )
+static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
- while( ( p_outpic = vout_CreatePicture( p_sys->p_vout, 0, 0, 3 ) ) == NULL)
- {
- if( !vlc_object_alive (p_aout) )
- {
- return;
- }
+ while( ( p_outpic = vout_GetPicture( p_sys->p_vout ) ) == NULL)
+ { /* XXX: This looks like a bad idea. Don't run to me for sympathy if it
+ * dead locks... */
+ if( !vlc_object_alive (p_sys->p_vout) )
+ return NULL;
- p_effect->pf_run( p_effect, p_aout, p_out_buf, p_outpic );
+ p_effect->pf_run( p_effect, VLC_OBJECT(p_filter),
+ p_in_buf, p_outpic );
*****************************************************************************/
static void Close( vlc_object_t *p_this )
{
*****************************************************************************/
static void Close( vlc_object_t *p_this )
{
#define p_effect p_sys->effect[i]
if( !strncmp( p_effect->psz_name, "spectrum", strlen( "spectrum" ) ) )
{
#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 );
+ spectrum_data *p_data = p_effect->p_data;
+ free( p_data->peaks );
+ free( p_data->prev_heights );
+ free( p_data->p_prev_s16_buff );
+ }
+ if( !strncmp( p_effect->psz_name, "spectrometer", strlen( "spectrometer" ) ) )
+ {
+ spectrometer_data *p_data = p_effect->p_data;
+ free( p_data->peaks );
+ free( p_data->p_prev_s16_buff );