[vlc-commits] codec: adpcm: unify max channels checks

Francois Cartegnie git at videolan.org
Thu Sep 29 11:12:23 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Sep 29 11:11:50 2016 +0200| [301753e2a012f501de915feeb7ad4360e50f73f1] | committer: Francois Cartegnie

codec: adpcm: unify max channels checks

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=301753e2a012f501de915feeb7ad4360e50f73f1
---

 modules/codec/adpcm.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/modules/codec/adpcm.c b/modules/codec/adpcm.c
index e8f2f20..0e67855 100644
--- a/modules/codec/adpcm.c
+++ b/modules/codec/adpcm.c
@@ -151,14 +151,6 @@ static int OpenDecoder( vlc_object_t *p_this )
             return VLC_EGENERIC;
     }
 
-    if( p_dec->fmt_in.audio.i_channels <= 0 ||
-        p_dec->fmt_in.audio.i_channels > 5 )
-    {
-        msg_Err( p_dec, "invalid number of channel (not between 1 and 5): %i",
-                 p_dec->fmt_in.audio.i_channels );
-        return VLC_EGENERIC;
-    }
-
     if( p_dec->fmt_in.audio.i_rate <= 0 )
     {
         msg_Err( p_dec, "bad samplerate" );
@@ -172,7 +164,7 @@ static int OpenDecoder( vlc_object_t *p_this )
 
     p_sys->prev = NULL;
 
-    uint8_t i_max_channels = 32;
+    uint8_t i_max_channels = 5;
     switch( p_dec->fmt_in.i_codec )
     {
         case VLC_FOURCC('i','m','a', '4'): /* IMA ADPCM */
@@ -188,9 +180,11 @@ static int OpenDecoder( vlc_object_t *p_this )
             break;
         case VLC_CODEC_ADPCM_DK4: /* Duck DK4 ADPCM */
             p_sys->codec = ADPCM_DK4;
+            i_max_channels = 2;
             break;
         case VLC_CODEC_ADPCM_DK3: /* Duck DK3 ADPCM */
             p_sys->codec = ADPCM_DK3;
+            i_max_channels = 2;
             break;
         case VLC_FOURCC('X','A','J', 0): /* EA ADPCM */
             p_sys->codec = ADPCM_EA;



More information about the vlc-commits mailing list