static int twinvq_read_bitstream(AVCodecContext *avctx, TwinVQContext *tctx,
const uint8_t *buf, int buf_size)
{
- TwinVQFrameData *bits = &tctx->bits;
+ TwinVQFrameData *bits = &tctx->bits[0];
const TwinVQModeTab *mtab = tctx->mtab;
int channels = tctx->avctx->channels;
int sub;
return AVERROR_INVALIDDATA;
}
- bits->ftype = ff_twinvq_wtype_to_ftype_table[tctx->bits.window_type];
+ bits->ftype = ff_twinvq_wtype_to_ftype_table[tctx->bits[0].window_type];
sub = mtab->fmode[bits->ftype].sub;
return -1;
}
- avctx->block_align = (avctx->bit_rate * tctx->mtab->size
- / avctx->sample_rate + 15) / 8;
-
tctx->codec = TWINVQ_CODEC_VQF;
tctx->read_bitstream = twinvq_read_bitstream;
tctx->dec_bark_env = dec_bark_env;
tctx->decode_ppc = decode_ppc;
+ tctx->frame_size = avctx->bit_rate * tctx->mtab->size
+ / avctx->sample_rate + 8;
+ tctx->is_6kbps = 0;
+ if (avctx->block_align && avctx->block_align * 8 / tctx->frame_size > 1) {
+ av_log(avctx, AV_LOG_ERROR,
+ "VQF TwinVQ should have only one frame per packet\n");
+ return AVERROR_INVALIDDATA;
+ }
return ff_twinvq_decode_init(avctx);
}
AVCodec ff_twinvq_decoder = {
.name = "twinvq",
+ .long_name = NULL_IF_CONFIG_SMALL("VQF TwinVQ"),
.type = AVMEDIA_TYPE_AUDIO,
.id = AV_CODEC_ID_TWINVQ,
.priv_data_size = sizeof(TwinVQContext),
.close = ff_twinvq_decode_close,
.decode = ff_twinvq_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("VQF TwinVQ"),
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE },
};