# HG changeset patch # User bcoudurier # Date 1160561705 0 # Node ID c42cb95fa0d40934b19a6877eb0701b402e17be7 # Parent 75e006876c5516c60d3891ac181f82be5627577f use av_get_bits_per_sample, compute block align if not set diff -r 75e006876c55 -r c42cb95fa0d4 aiff.c --- a/aiff.c Wed Oct 11 10:09:45 2006 +0000 +++ b/aiff.c Wed Oct 11 10:15:05 2006 +0000 @@ -208,7 +208,14 @@ put_be32(pb, 0); /* Number of frames */ if (!enc->bits_per_sample) - enc->bits_per_sample = (enc->block_align<<3) / enc->channels; + enc->bits_per_sample = av_get_bits_per_sample(enc->codec_id); + if (!enc->bits_per_sample) { + av_log(s, AV_LOG_ERROR, "could not compute bits per sample\n"); + return -1; + } + if (!enc->block_align) + enc->block_align = (enc->bits_per_sample * enc->channels) >> 3; + put_be16(pb, enc->bits_per_sample); /* Sample size */ sample_rate = av_dbl2ext((double)enc->sample_rate);