GetBitContext gb;
int i, j, k;
- if (buf_size * 8 < avctx->bit_rate * mtab->size / avctx->sample_rate) {
- av_log(avctx, AV_LOG_ERROR,
- "Frame too small (%d bytes). Truncated file?\n", buf_size);
- return AVERROR(EINVAL);
- }
-
init_get_bits(&gb, buf, buf_size * 8);
bits->window_type = get_bits(&gb, TWINVQ_WINDOW_TYPE_BITS);
return AVERROR(ENOSYS);
}
+ avctx->block_align = (avctx->bit_rate * tctx->mtab->size
+ / avctx->sample_rate + 7) / 8;
+
tctx->codec = TWINVQ_CODEC_METASOUND;
tctx->read_bitstream = metasound_read_bitstream;
tctx->dec_bark_env = dec_bark_env;
out = (float **)frame->extended_data;
}
+ if (buf_size < avctx->block_align) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Frame too small (%d bytes). Truncated file?\n", buf_size);
+ return AVERROR(EINVAL);
+ }
+
if ((ret = tctx->read_bitstream(avctx, tctx, buf, buf_size)) < 0)
return ret;
*got_frame_ptr = 1;
- return buf_size;
+ return avctx->block_align;
}
/**
GetBitContext gb;
int i, j, k;
- if (buf_size * 8 < avctx->bit_rate * mtab->size / avctx->sample_rate + 8) {
- av_log(avctx, AV_LOG_ERROR,
- "Frame too small (%d bytes). Truncated file?\n", buf_size);
- return AVERROR(EINVAL);
- }
-
init_get_bits(&gb, buf, buf_size * 8);
skip_bits(&gb, get_bits(&gb, 8));
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;