Commit d2604f92 authored by Justin Ruggles's avatar Justin Ruggles

wavpack: calculate bpp using av_get_bytes_per_sample()

parent ddfb8e1a
...@@ -808,15 +808,13 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no, ...@@ -808,15 +808,13 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
} }
s->frame_flags = AV_RL32(buf); buf += 4; s->frame_flags = AV_RL32(buf); buf += 4;
if(s->frame_flags&0x80){ if(s->frame_flags&0x80){
bpp = sizeof(float);
avctx->sample_fmt = AV_SAMPLE_FMT_FLT; avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
} else if((s->frame_flags&0x03) <= 1){ } else if((s->frame_flags&0x03) <= 1){
bpp = 2;
avctx->sample_fmt = AV_SAMPLE_FMT_S16; avctx->sample_fmt = AV_SAMPLE_FMT_S16;
} else { } else {
bpp = 4;
avctx->sample_fmt = AV_SAMPLE_FMT_S32; avctx->sample_fmt = AV_SAMPLE_FMT_S32;
} }
bpp = av_get_bytes_per_sample(avctx->sample_fmt);
samples = (uint8_t*)samples + bpp * wc->ch_offset; samples = (uint8_t*)samples + bpp * wc->ch_offset;
s->stereo = !(s->frame_flags & WV_MONO); s->stereo = !(s->frame_flags & WV_MONO);
......
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