From: Steinar Gunderson Date: Mon, 27 Sep 2010 11:20:41 +0000 (+0200) Subject: Add error messages for unsupported rates or number of channels. X-Git-Url: https://git.sesse.net/?p=vlc;a=commitdiff_plain;h=b6858433aa498c15b537c9af8d0e9766b89df626 Add error messages for unsupported rates or number of channels. --- diff --git a/modules/codec/lpcm.c b/modules/codec/lpcm.c index 8e62b152d4..839d463175 100644 --- a/modules/codec/lpcm.c +++ b/modules/codec/lpcm.c @@ -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 )