[SCM] libav/experimental: set proper bits_per_sample value for ADPCM codecs

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 15:48:51 UTC 2013


The following commit has been merged in the experimental branch:
commit f1b163e01e26e261890851c799fd508e99e2da46
Author: Aurelien Jacobs <aurel at gnuage.org>
Date:   Sat Jul 8 07:14:00 2006 +0000

    set proper bits_per_sample value for ADPCM codecs
    
    Originally committed as revision 5666 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 574238e..30d9d17 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -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:
diff --git a/libavformat/utils.c b/libavformat/utils.c
index d51e64a..f5598e5 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -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)

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list