mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-10-19 18:03:17 +00:00
avcodec/wmaprodec: Avoid branch for setting block_align
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
66acbb92a3
commit
725563a731
1 changed files with 7 additions and 8 deletions
|
@ -370,14 +370,6 @@ static av_cold int decode_init(WMAProDecodeCtx *s, AVCodecContext *avctx, int nu
|
||||||
int log2_max_num_subframes;
|
int log2_max_num_subframes;
|
||||||
int num_possible_block_sizes;
|
int num_possible_block_sizes;
|
||||||
|
|
||||||
if (avctx->codec_id == AV_CODEC_ID_XMA1 || avctx->codec_id == AV_CODEC_ID_XMA2)
|
|
||||||
avctx->block_align = 2048;
|
|
||||||
|
|
||||||
if (!avctx->block_align) {
|
|
||||||
av_log(avctx, AV_LOG_ERROR, "block_align is not set\n");
|
|
||||||
return AVERROR(EINVAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
s->avctx = avctx;
|
s->avctx = avctx;
|
||||||
|
|
||||||
init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE);
|
init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE);
|
||||||
|
@ -603,6 +595,11 @@ static av_cold int wmapro_decode_init(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
WMAProDecodeCtx *s = avctx->priv_data;
|
WMAProDecodeCtx *s = avctx->priv_data;
|
||||||
|
|
||||||
|
if (!avctx->block_align) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "block_align is not set\n");
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
}
|
||||||
|
|
||||||
return decode_init(s, avctx, 0);
|
return decode_init(s, avctx, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1957,6 +1954,8 @@ static av_cold int xma_decode_init(AVCodecContext *avctx)
|
||||||
XMADecodeCtx *s = avctx->priv_data;
|
XMADecodeCtx *s = avctx->priv_data;
|
||||||
int i, ret, start_channels = 0;
|
int i, ret, start_channels = 0;
|
||||||
|
|
||||||
|
avctx->block_align = 2048;
|
||||||
|
|
||||||
if (avctx->ch_layout.nb_channels <= 0 || avctx->extradata_size == 0)
|
if (avctx->ch_layout.nb_channels <= 0 || avctx->extradata_size == 0)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue