diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2011-10-29 01:20:39 -0400 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2011-11-09 14:59:51 -0500 |
commit | 3468ff106008da160b8cbb2d69d396a751fe8a08 (patch) | |
tree | d483e81ba8c95ba5540b1f06a36f0099c8e8a17f /libavcodec | |
parent | 0005f9a35bc4b755f79a5cd96c27c4dd312c18b2 (diff) | |
download | ffmpeg-3468ff106008da160b8cbb2d69d396a751fe8a08.tar.gz |
sipr: set mode based on block_align instead of bit_rate
the user is not required to set bit_rate
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/sipr.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libavcodec/sipr.c b/libavcodec/sipr.c index 70227c33a3..4257496e0e 100644 --- a/libavcodec/sipr.c +++ b/libavcodec/sipr.c @@ -480,10 +480,15 @@ static av_cold int sipr_decoder_init(AVCodecContext * avctx) SiprContext *ctx = avctx->priv_data; int i; - if (avctx->bit_rate > 12200) ctx->mode = MODE_16k; - else if (avctx->bit_rate > 7500 ) ctx->mode = MODE_8k5; - else if (avctx->bit_rate > 5750 ) ctx->mode = MODE_6k5; - else ctx->mode = MODE_5k0; + switch (avctx->block_align) { + case 20: ctx->mode = MODE_16k; break; + case 19: ctx->mode = MODE_8k5; break; + case 29: ctx->mode = MODE_6k5; break; + case 37: ctx->mode = MODE_5k0; break; + default: + av_log(avctx, AV_LOG_ERROR, "Invalid block_align: %d\n", avctx->block_align); + return AVERROR(EINVAL); + } av_log(avctx, AV_LOG_DEBUG, "Mode: %s\n", modes[ctx->mode].mode_name); |