]> git.sesse.net Git - vlc/blobdiff - modules/audio_filter/normvol.c
- the creation of the audio filter pipeline when specifying user audio
[vlc] / modules / audio_filter / normvol.c
index 9dd60b25f41f789316adb1a7276616683383dda6..98ddfe34ad4a3aeda805e56236202bf45e38fd2a 100644 (file)
@@ -98,6 +98,7 @@ vlc_module_end();
 static int Open( vlc_object_t *p_this )
 {
     aout_filter_t *p_filter = (aout_filter_t*)p_this;
+    vlc_bool_t b_fit = VLC_TRUE;
     int i_channels;
     aout_filter_sys_t *p_sys = p_filter->p_sys =
         malloc( sizeof( aout_filter_sys_t ) );
@@ -105,13 +106,22 @@ static int Open( vlc_object_t *p_this )
     if( p_filter->input.i_format != VLC_FOURCC('f','l','3','2' ) ||
         p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
     {
-            msg_Warn( p_filter, "Bad input or output format" );
-            return VLC_EGENERIC;
+        b_fit = VLC_FALSE;
+        p_filter->input.i_format = VLC_FOURCC('f','l','3','2');
+        p_filter->output.i_format = VLC_FOURCC('f','l','3','2');
+        msg_Warn( p_filter, "Bad input or output format" );
     }
 
     if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
     {
+        b_fit = VLC_FALSE;
+        memcpy( &p_filter->output, &p_filter->input,
+                sizeof(audio_sample_format_t) );
         msg_Warn( p_filter, "input and output formats are not similar" );
+    }
+
+    if ( ! b_fit )
+    {
         return VLC_EGENERIC;
     }