set proper bits_per_sample value for ADPCM codecs
authorAurelien Jacobs <aurel@gnuage.org>
Sat, 8 Jul 2006 07:14:00 +0000 (07:14 +0000)
committerAurelien Jacobs <aurel@gnuage.org>
Sat, 8 Jul 2006 07:14:00 +0000 (07:14 +0000)
Originally committed as revision 5666 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/utils.c
libavformat/utils.c

index 574238e79fa754b106cab17588f6e03daef97014..30d9d17f63e57bedd4f13a11f6dcbb49d38341e5 100644 (file)
@@ -1306,11 +1306,13 @@ char av_get_pict_type_char(int pict_type){
 
 int av_get_bits_per_sample(enum CodecID codec_id){
     switch(codec_id){
-    case CODEC_ID_ADPCM_CT:
     case CODEC_ID_ADPCM_SBPRO_2:
+        return 2;
     case CODEC_ID_ADPCM_SBPRO_3:
+        return 3;
     case CODEC_ID_ADPCM_SBPRO_4:
-        return 0;
+    case CODEC_ID_ADPCM_CT:
+        return 4;
     case CODEC_ID_PCM_ALAW:
     case CODEC_ID_PCM_MULAW:
     case CODEC_ID_PCM_S8:
index d51e64ae48247e8877289d8f05dbb51a724b20d9..f5598e57d7b51165d9e2d0562c17c48e7cff99b5 100644 (file)
@@ -658,7 +658,7 @@ static int get_audio_frame_size(AVCodecContext *enc, int size)
         if (bits_per_sample) {
             if (enc->channels == 0)
                 return -1;
-            frame_size = size / ((bits_per_sample >> 3) * enc->channels);
+            frame_size = (size << 3) / (bits_per_sample * enc->channels);
         } else {
             /* used for example by ADPCM codecs */
             if (enc->bit_rate == 0)