aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2012-01-05 21:01:56 +0100
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2012-01-05 22:24:51 +0100
commit1d0d63052b82c76e10c45cd38cdd27677de72e81 (patch)
treef611996ed1966bbb6964d679ba19f74bf20567fd
parent96fc1f07332e58faf23d36263d3581620771fac6 (diff)
downloadffmpeg-1d0d63052b82c76e10c45cd38cdd27677de72e81.tar.gz
sipr: fall back to setting mode based on bit_rate.
Not all applications (e.g. MPlayer) set block_align, and when using a different demuxer it might not even be easily available. So fall back to selecting mode based on bit rate as before if block_align has not useful value. It can't be worse than failing to decode completely. Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
-rw-r--r--libavcodec/sipr.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/sipr.c b/libavcodec/sipr.c
index db9cda7742..65440db224 100644
--- a/libavcodec/sipr.c
+++ b/libavcodec/sipr.c
@@ -487,7 +487,10 @@ static av_cold int sipr_decoder_init(AVCodecContext * avctx)
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);
+ 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;
}
av_log(avctx, AV_LOG_DEBUG, "Mode: %s\n", modes[ctx->mode].mode_name);