Commit f1b163e0 authored by Aurelien Jacobs's avatar Aurelien Jacobs

set proper bits_per_sample value for ADPCM codecs

Originally committed as revision 5666 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent ab7e3153
...@@ -1306,11 +1306,13 @@ char av_get_pict_type_char(int pict_type){ ...@@ -1306,11 +1306,13 @@ char av_get_pict_type_char(int pict_type){
int av_get_bits_per_sample(enum CodecID codec_id){ int av_get_bits_per_sample(enum CodecID codec_id){
switch(codec_id){ switch(codec_id){
case CODEC_ID_ADPCM_CT:
case CODEC_ID_ADPCM_SBPRO_2: case CODEC_ID_ADPCM_SBPRO_2:
return 2;
case CODEC_ID_ADPCM_SBPRO_3: case CODEC_ID_ADPCM_SBPRO_3:
return 3;
case CODEC_ID_ADPCM_SBPRO_4: case CODEC_ID_ADPCM_SBPRO_4:
return 0; case CODEC_ID_ADPCM_CT:
return 4;
case CODEC_ID_PCM_ALAW: case CODEC_ID_PCM_ALAW:
case CODEC_ID_PCM_MULAW: case CODEC_ID_PCM_MULAW:
case CODEC_ID_PCM_S8: case CODEC_ID_PCM_S8:
......
...@@ -658,7 +658,7 @@ static int get_audio_frame_size(AVCodecContext *enc, int size) ...@@ -658,7 +658,7 @@ static int get_audio_frame_size(AVCodecContext *enc, int size)
if (bits_per_sample) { if (bits_per_sample) {
if (enc->channels == 0) if (enc->channels == 0)
return -1; return -1;
frame_size = size / ((bits_per_sample >> 3) * enc->channels); frame_size = (size << 3) / (bits_per_sample * enc->channels);
} else { } else {
/* used for example by ADPCM codecs */ /* used for example by ADPCM codecs */
if (enc->bit_rate == 0) if (enc->bit_rate == 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment