summaryrefslogtreecommitdiff
path: root/libavcodec/twinvqdec.c
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2013-10-20 16:15:03 +0200
committerDiego Biurrun <diego@biurrun.de>2013-11-14 13:38:10 +0100
commit1afa8a7568ba57ad0cd2923f6e641e10d32cded4 (patch)
treee0e8b4180f44f7618768fe2726ba723d3a00698e /libavcodec/twinvqdec.c
parentddb839e9286594ff7a862a956402106fca7055c9 (diff)
downloadffmpeg-1afa8a7568ba57ad0cd2923f6e641e10d32cded4.tar.gz
twinvq: support multiple frames per packet
Signed-off-by: Diego Biurrun <diego@biurrun.de>
Diffstat (limited to 'libavcodec/twinvqdec.c')
-rw-r--r--libavcodec/twinvqdec.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/libavcodec/twinvqdec.c b/libavcodec/twinvqdec.c
index 3b889f5bec..6f4decb939 100644
--- a/libavcodec/twinvqdec.c
+++ b/libavcodec/twinvqdec.c
@@ -251,7 +251,7 @@ static void read_cb_data(TwinVQContext *tctx, GetBitContext *gb,
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;
@@ -268,7 +268,7 @@ static int twinvq_read_bitstream(AVCodecContext *avctx, TwinVQContext *tctx,
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;
@@ -396,13 +396,17 @@ static av_cold int twinvq_decode_init(AVCodecContext *avctx)
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;
+ 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);
}