diff options
author | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2006-10-11 10:15:05 +0000 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2006-10-11 10:15:05 +0000 |
commit | e27d92773eca7ee3f56dca1d4ed199f458374604 (patch) | |
tree | fcca5f407065cdb90123c412115b3c08b8e740fe /libavformat | |
parent | 8d41fe285bbf7385cde537e7c9a22109ab68204f (diff) | |
download | ffmpeg-e27d92773eca7ee3f56dca1d4ed199f458374604.tar.gz |
use av_get_bits_per_sample, compute block align if not set
Originally committed as revision 6644 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/aiff.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libavformat/aiff.c b/libavformat/aiff.c index efb4b28ee8..b1cc6625a6 100644 --- a/libavformat/aiff.c +++ b/libavformat/aiff.c @@ -208,7 +208,14 @@ static int aiff_write_header(AVFormatContext *s) 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); |