diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-11-14 15:42:05 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-11-14 15:42:05 +0100 |
commit | a24aef5dfa5117008c74ee2149346eebe325349d (patch) | |
tree | bd25d7a116836aed6fc274ba61415e199cb40e1e /libavcodec/twinvqdec.c | |
parent | 2cfdc2879a6cc2f956a8a1878a4a6490c58ad5c7 (diff) | |
parent | 1afa8a7568ba57ad0cd2923f6e641e10d32cded4 (diff) | |
download | ffmpeg-a24aef5dfa5117008c74ee2149346eebe325349d.tar.gz |
Merge commit '1afa8a7568ba57ad0cd2923f6e641e10d32cded4'
* commit '1afa8a7568ba57ad0cd2923f6e641e10d32cded4':
twinvq: support multiple frames per packet
Conflicts:
libavcodec/twinvq.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/twinvqdec.c')
-rw-r--r-- | libavcodec/twinvqdec.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libavcodec/twinvqdec.c b/libavcodec/twinvqdec.c index 5e565dbb9f..9fce3c39cf 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); } |