tta: use skip_bits_long()

Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
Paul B Mahol 2012-02-05 19:39:13 +00:00 committed by Anton Khirnov
parent e24167aae6
commit 9aff2d1753
1 changed files with 5 additions and 7 deletions

View File

@ -191,7 +191,6 @@ static int tta_get_unary(GetBitContext *gb)
static av_cold int tta_decode_init(AVCodecContext * avctx) static av_cold int tta_decode_init(AVCodecContext * avctx)
{ {
TTAContext *s = avctx->priv_data; TTAContext *s = avctx->priv_data;
int i;
s->avctx = avctx; s->avctx = avctx;
@ -203,7 +202,7 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
if (show_bits_long(&s->gb, 32) == AV_RL32("TTA1")) if (show_bits_long(&s->gb, 32) == AV_RL32("TTA1"))
{ {
/* signature */ /* signature */
skip_bits(&s->gb, 32); skip_bits_long(&s->gb, 32);
s->format = get_bits(&s->gb, 16); s->format = get_bits(&s->gb, 16);
if (s->format > 2) { if (s->format > 2) {
@ -219,7 +218,7 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
s->bps = (avctx->bits_per_coded_sample + 7) / 8; s->bps = (avctx->bits_per_coded_sample + 7) / 8;
avctx->sample_rate = get_bits_long(&s->gb, 32); avctx->sample_rate = get_bits_long(&s->gb, 32);
s->data_length = get_bits_long(&s->gb, 32); s->data_length = get_bits_long(&s->gb, 32);
skip_bits(&s->gb, 32); // CRC32 of header skip_bits_long(&s->gb, 32); // CRC32 of header
if (s->channels == 0) { if (s->channels == 0) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid number of channels\n"); av_log(s->avctx, AV_LOG_ERROR, "Invalid number of channels\n");
@ -258,9 +257,8 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
s->data_length, s->frame_length, s->last_frame_length, s->total_frames); s->data_length, s->frame_length, s->last_frame_length, s->total_frames);
// FIXME: seek table // FIXME: seek table
for (i = 0; i < s->total_frames; i++) skip_bits_long(&s->gb, 32 * s->total_frames);
skip_bits(&s->gb, 32); skip_bits_long(&s->gb, 32); // CRC32 of seektable
skip_bits(&s->gb, 32); // CRC32 of seektable
if(s->frame_length >= UINT_MAX / (s->channels * sizeof(int32_t))){ if(s->frame_length >= UINT_MAX / (s->channels * sizeof(int32_t))){
av_log(avctx, AV_LOG_ERROR, "frame_length too large\n"); av_log(avctx, AV_LOG_ERROR, "frame_length too large\n");
@ -401,7 +399,7 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data,
if (get_bits_left(&s->gb) < 32) if (get_bits_left(&s->gb) < 32)
return -1; return -1;
skip_bits(&s->gb, 32); // frame crc skip_bits_long(&s->gb, 32); // frame crc
// convert to output buffer // convert to output buffer
if (s->bps == 2) { if (s->bps == 2) {