]> git.sesse.net Git - vlc/blobdiff - modules/visualization/visual/visual.c
aout_filter_t.(in|out)put -> aout_filter_t.fmt_(in|out).audio
[vlc] / modules / visualization / visual / visual.c
index c26d3b2612ddf888e934c20181b24573f1769452..8f883b3c89bcf79108d91041f80efdaf7c954b96 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * 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>
@@ -41,7 +41,8 @@
 #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_( \
@@ -122,7 +123,7 @@ vlc_module_begin ()
              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 */
@@ -142,7 +143,7 @@ vlc_module_begin ()
     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 )
@@ -174,12 +175,12 @@ static const struct
                     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}
 };
 
 /*****************************************************************************
@@ -193,8 +194,8 @@ static int Open( vlc_object_t *p_this )
     char *psz_effects, *psz_parser;
     video_format_t fmt;
 
-    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 ) )
     {
         return VLC_EGENERIC;
     }
@@ -228,7 +229,10 @@ static int Open( vlc_object_t *p_this )
             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;
 
@@ -242,7 +246,7 @@ static int Open( vlc_object_t *p_this )
                               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;
             }
         }
@@ -260,7 +264,6 @@ static int Open( vlc_object_t *p_this )
                 if( ( psz_eoa = strchr( psz_parser, '}') ) == NULL )
                 {
                    msg_Err( p_filter, "unable to parse effect list. Aborting");
-                   free( p_effect->psz_name );
                    free( p_effect );
                    break;
                 }
@@ -313,7 +316,6 @@ static int Open( vlc_object_t *p_this )
         msg_Err( p_filter, "no suitable vout module" );
         for( int i = 0; i < p_sys->i_effect; i++ )
         {
-            free( p_sys->effect[i]->psz_name );
             free( p_sys->effect[i]->psz_args );
             free( p_sys->effect[i] );
         }
@@ -341,9 +343,9 @@ static void DoWork( aout_instance_t *p_aout, aout_filter_t *p_filter,
     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)
@@ -373,7 +375,7 @@ static void DoWork( aout_instance_t *p_aout, aout_filter_t *p_filter,
 #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 );
 }
@@ -403,7 +405,6 @@ static void Close( vlc_object_t *p_this )
             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