]> git.sesse.net Git - vlc/blobdiff - modules/codec/adpcm.c
macosx: Fix a race condition that causes a crash at exit because VLCIntf holds a...
[vlc] / modules / codec / adpcm.c
index 830093fbd0c2d47b860027b15b76e75ff20ba4cc..3b9fbd1509ab2af92acd751b1af26ce8894a5f35 100644 (file)
  *
  * Documentation: http://www.pcisys.net/~melanson/codecs/adpcm.txt
  *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <vlc/vlc.h>
 #include <vlc_aout.h>
 #include <vlc_codec.h>
@@ -64,8 +68,8 @@ struct decoder_sys_t
 {
     enum adpcm_codec_e codec;
 
-    int                 i_block;
-    int                 i_samplesperblock;
+    size_t              i_block;
+    size_t              i_samplesperblock;
 
     audio_date_t        end_date;
 };
@@ -77,7 +81,7 @@ static void DecodeAdpcmDk4   ( decoder_t *, int16_t *, uint8_t * );
 static void DecodeAdpcmDk3   ( decoder_t *, int16_t *, uint8_t * );
 static void DecodeAdpcmEA    ( decoder_t *, int16_t *, uint8_t * );
 
-static int pi_channels_maps[6] =
+static const int pi_channels_maps[6] =
 {
     0,
     AOUT_CHAN_CENTER,
@@ -89,13 +93,13 @@ static int pi_channels_maps[6] =
 };
 
 /* Various table from http://www.pcisys.net/~melanson/codecs/adpcm.txt */
-static int i_index_table[16] =
+static const int i_index_table[16] =
 {
     -1, -1, -1, -1, 2, 4, 6, 8,
     -1, -1, -1, -1, 2, 4, 6, 8
 };
 
-static int i_step_table[89] =
+static const int i_step_table[89] =
 {
     7, 8, 9, 10, 11, 12, 13, 14, 16, 17,
     19, 21, 23, 25, 28, 31, 34, 37, 41, 45,
@@ -108,18 +112,18 @@ static int i_step_table[89] =
     15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767
 };
 
-static int i_adaptation_table[16] =
+static const int i_adaptation_table[16] =
 {
     230, 230, 230, 230, 307, 409, 512, 614,
     768, 614, 512, 409, 307, 230, 230, 230
 };
 
-static int i_adaptation_coeff1[7] =
+static const int i_adaptation_coeff1[7] =
 {
     256, 512, 0, 192, 240, 460, 392
 };
 
-static int i_adaptation_coeff2[7] =
+static const int i_adaptation_coeff2[7] =
 {
     0, -256, 0, 64, 0, -208, -232
 };
@@ -614,7 +618,7 @@ static void DecodeAdpcmDk4( decoder_t *p_dec, int16_t *p_sample,
 {
     decoder_sys_t *p_sys  = p_dec->p_sys;
     adpcm_ima_wav_channel_t channel[2];
-    int                     i_nibbles;
+    size_t                  i_nibbles;
     int                     b_stereo;
 
     b_stereo = p_dec->fmt_in.audio.i_channels == 2 ? 1 : 0;