ibps = avctx->bit_rate / (1000 * avctx->channels);
- switch ((isampf << 8) + ibps) {
- case (8 <<8) + 8: tctx->mtab = &mode_08_08; break;
- case (11<<8) + 8: tctx->mtab = &mode_11_08; break;
- case (11<<8) + 10: tctx->mtab = &mode_11_10; break;
- case (16<<8) + 16: tctx->mtab = &mode_16_16; break;
- case (22<<8) + 20: tctx->mtab = &mode_22_20; break;
- case (22<<8) + 24: tctx->mtab = &mode_22_24; break;
- case (22<<8) + 32: tctx->mtab = &mode_22_32; break;
- case (44<<8) + 40: tctx->mtab = &mode_44_40; break;
- case (44<<8) + 48: tctx->mtab = &mode_44_48; break;
+ if (ibps > 255U) {
+ av_log(avctx, AV_LOG_ERROR, "unsupported per channel bitrate %dkbps\n", ibps);
+ return AVERROR_INVALIDDATA;
+ }
+
+ switch ((isampf << 8) + ibps) {
+ case (8 << 8) + 8:
+ tctx->mtab = &mode_08_08;
+ break;
+ case (11 << 8) + 8:
+ tctx->mtab = &mode_11_08;
+ break;
+ case (11 << 8) + 10:
+ tctx->mtab = &mode_11_10;
+ break;
+ case (16 << 8) + 16:
+ tctx->mtab = &mode_16_16;
+ break;
+ case (22 << 8) + 20:
+ tctx->mtab = &mode_22_20;
+ break;
+ case (22 << 8) + 24:
+ tctx->mtab = &mode_22_24;
+ break;
+ case (22 << 8) + 32:
+ tctx->mtab = &mode_22_32;
+ break;
+ case (44 << 8) + 40:
+ tctx->mtab = &mode_44_40;
+ break;
+ case (44 << 8) + 48:
+ tctx->mtab = &mode_44_48;
+ break;
default:
- av_log(avctx, AV_LOG_ERROR, "This version does not support %d kHz - %d kbit/s/ch mode.\n", isampf, isampf);
+ av_log(avctx, AV_LOG_ERROR,
+ "This version does not support %d kHz - %d kbit/s/ch mode.\n",
+ isampf, isampf);
return -1;
}