]> git.sesse.net Git - vlc/commitdiff
Added new audio-time-strech option to insert scaletempo by default.
authorLaurent Aimar <fenrir@videolan.org>
Thu, 21 Aug 2008 22:18:13 +0000 (00:18 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Mon, 25 Aug 2008 20:32:44 +0000 (22:32 +0200)
src/audio_output/input.c
src/libvlc-module.c

index 24de3d31c9a9eafaedbe74e4a50fde50ea6dfa04..66bc0b383b8f08467bd49ae9489afe346d775533 100644 (file)
@@ -70,7 +70,7 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input )
     audio_sample_format_t chain_input_format;
     audio_sample_format_t chain_output_format;
     vlc_value_t val, text;
-    char * psz_filters, *psz_visual;
+    char *psz_filters, *psz_visual, *psz_scaletempo;
     int i_visual;
 
     aout_FormatPrint( p_aout, "input", &p_input->input );
@@ -211,17 +211,25 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input )
         var_Create( p_aout, "audio-replay-gain-peak-protection",
                     VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
     }
+    if( var_Type( p_aout, "audio-time-stretch" ) == 0 )
+    {
+        var_Create( p_aout, "audio-time-stretch",
+                    VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
+    }
 
     var_Get( p_aout, "audio-filter", &val );
     psz_filters = val.psz_string;
     var_Get( p_aout, "audio-visual", &val );
     psz_visual = val.psz_string;
 
+    psz_scaletempo = var_GetBool( p_aout, "audio-time-stretch" ) ? strdup( "scaletempo" ) : NULL;
+
     /* parse user filter lists */
     for( i_visual = 0; i_visual < 2; i_visual++ )
     {
+        char *ppsz_array[] = { psz_scaletempo, psz_filters, psz_visual };
         char *psz_next = NULL;
-        char *psz_parser = i_visual ? psz_visual : psz_filters;
+        char *psz_parser = ppsz_array[i_visual];
 
         if( psz_parser == NULL || !*psz_parser )
             continue;
@@ -264,7 +272,7 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input )
             vlc_object_attach( p_filter , p_aout );
 
             /* try to find the requested filter */
-            if( i_visual == 1 ) /* this can only be a visualization module */
+            if( i_visual == 2 ) /* this can only be a visualization module */
             {
                 /* request format */
                 memcpy( &p_filter->input, &chain_output_format,
@@ -357,8 +365,9 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input )
             psz_parser = psz_next;
         }
     }
-    free( psz_filters );
     free( psz_visual );
+    free( psz_filters );
+    free( psz_scaletempo );
 
     /* complete the filter chain if necessary */
     if ( !AOUT_FMTS_IDENTICAL( &chain_input_format, &chain_output_format ) )
index 624cdc7a51ea8f35f366e71675ab3fd4dcab45a7..fb69a12b23d4b19cf7629bf15055bcb60bdd4d0b 100644 (file)
@@ -313,6 +313,13 @@ static const char *const ppsz_force_dolby_descriptions[] = {
 #define AUDIO_REPLAY_GAIN_PEAK_PROTECTION_LONGTEXT N_( \
     "Protect against sound clipping" )
 
+#define AUDIO_TIME_STRETCH_TEXT N_( \
+    "Enable time streching audio" )
+#define AUDIO_TIME_STRETCH_LONGTEXT N_( \
+    "This allows to play audio at lower or higher speed without" \
+    "affecting the audio pitch" )
+
+
 static const char *const ppsz_replay_gain_mode[] = {
     "none", "track", "album" };
 static const char *const ppsz_replay_gain_mode_text[] = {
@@ -1463,6 +1470,9 @@ vlc_module_begin();
     add_bool( "audio-replay-gain-peak-protection", true, NULL,
               AUDIO_REPLAY_GAIN_PEAK_PROTECTION_TEXT, AUDIO_REPLAY_GAIN_PEAK_PROTECTION_LONGTEXT, true );
 
+    add_bool( "audio-time-stretch", true, NULL,
+              AUDIO_TIME_STRETCH_TEXT, AUDIO_TIME_STRETCH_LONGTEXT, false );
+
     set_subcategory( SUBCAT_AUDIO_AOUT );
     add_module( "aout", "audio output", NULL, NULL, AOUT_TEXT, AOUT_LONGTEXT,
                 true );