]> git.sesse.net Git - vlc/commitdiff
Add error messages for unsupported rates or number of channels.
authorSteinar Gunderson <sgunderson@bigfoot.com>
Mon, 27 Sep 2010 11:20:41 +0000 (13:20 +0200)
committerSteinar Gunderson <sgunderson@bigfoot.com>
Mon, 27 Sep 2010 11:20:41 +0000 (13:20 +0200)
modules/codec/lpcm.c

index 8e62b152d41ac8bfefbc15afed91464ab9fb135e..839d463175200bb7a4c3b3c5f804007eed064f0c 100644 (file)
@@ -434,14 +434,24 @@ static int OpenEncoder( vlc_object_t *p_this )
     encoder_sys_t *p_sys;
 
     /* We only support DVD LPCM yet. */
-    if( p_enc->fmt_out.i_codec != VLC_CODEC_DVD_LPCM ||
-        ( p_enc->fmt_in.audio.i_rate != 48000 &&
-          p_enc->fmt_in.audio.i_rate != 96000 &&
-          p_enc->fmt_in.audio.i_rate != 44100 &&
-          p_enc->fmt_in.audio.i_rate != 32000 ) ||
-       p_enc->fmt_in.audio.i_channels > 8 )
+    if( p_enc->fmt_out.i_codec != VLC_CODEC_DVD_LPCM )
         return VLC_EGENERIC;
 
+    if( p_enc->fmt_in.audio.i_rate != 48000 &&
+        p_enc->fmt_in.audio.i_rate != 96000 &&
+        p_enc->fmt_in.audio.i_rate != 44100 &&
+        p_enc->fmt_in.audio.i_rate != 32000 )
+    {
+        msg_Err( p_enc, "DVD LPCM supports only sample rates of 48, 96, 44.1 or 32 kHz" );
+        return VLC_EGENERIC;
+    }
+
+    if( p_enc->fmt_in.audio.i_channels > 8 )
+    {
+        msg_Err( p_enc, "DVD LPCM supports a maximum of eight channels" );
+        return VLC_EGENERIC;
+    }
+
     /* Allocate the memory needed to store the encoder's structure */
     if( ( p_enc->p_sys = p_sys =
           (encoder_sys_t *)malloc(sizeof(encoder_sys_t)) ) == NULL )