mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-12 10:15:22 +00:00
sipr: set mode based on block_align instead of bit_rate
the user is not required to set bit_rate
This commit is contained in:
parent
0005f9a35b
commit
3468ff1060
@ -480,10 +480,15 @@ static av_cold int sipr_decoder_init(AVCodecContext * avctx)
|
|||||||
SiprContext *ctx = avctx->priv_data;
|
SiprContext *ctx = avctx->priv_data;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (avctx->bit_rate > 12200) ctx->mode = MODE_16k;
|
switch (avctx->block_align) {
|
||||||
else if (avctx->bit_rate > 7500 ) ctx->mode = MODE_8k5;
|
case 20: ctx->mode = MODE_16k; break;
|
||||||
else if (avctx->bit_rate > 5750 ) ctx->mode = MODE_6k5;
|
case 19: ctx->mode = MODE_8k5; break;
|
||||||
else ctx->mode = MODE_5k0;
|
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);
|
av_log(avctx, AV_LOG_DEBUG, "Mode: %s\n", modes[ctx->mode].mode_name);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user