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

Francois Cartegnie git at videolan.org
Thu Sep 29 11:31:44 CEST 2016


vlc/vlc-2.2 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Sep 29 11:11:50 2016 +0200| [d171e2d7ea8ea2e71fc1850a04d10dccf66b1221] | committer: Jean-Baptiste Kempf

codec: adpcm: unify max channels checks

(cherry picked from commit 301753e2a012f501de915feeb7ad4360e50f73f1)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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 a3b9c6d..cc28a59 100644
--- a/modules/codec/adpcm.c
+++ b/modules/codec/adpcm.c
@@ -150,14 +150,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" );
@@ -171,7 +163,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 */
@@ -187,9 +179,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