Mercurial > libavcodec.hg
comparison flacdec.c @ 9132:37bb2785a35b libavcodec
flacdec: cosmetics: Use a more descriptive variable name for the number
of bytes read, instead of reusing 'i'.
author | jbr |
---|---|
date | Wed, 04 Mar 2009 23:24:44 +0000 |
parents | dfa6b3358c61 |
children | c78af85f414d |
comparison
equal
deleted
inserted
replaced
9131:dfa6b3358c61 | 9132:37bb2785a35b |
---|---|
596 static int flac_decode_frame(AVCodecContext *avctx, | 596 static int flac_decode_frame(AVCodecContext *avctx, |
597 void *data, int *data_size, | 597 void *data, int *data_size, |
598 const uint8_t *buf, int buf_size) | 598 const uint8_t *buf, int buf_size) |
599 { | 599 { |
600 FLACContext *s = avctx->priv_data; | 600 FLACContext *s = avctx->priv_data; |
601 int tmp = 0, i, j = 0, input_buf_size = 0; | 601 int tmp = 0, i, j = 0, input_buf_size = 0, bytes_read = 0; |
602 int16_t *samples_16 = data; | 602 int16_t *samples_16 = data; |
603 int32_t *samples_32 = data; | 603 int32_t *samples_32 = data; |
604 int alloc_data_size= *data_size; | 604 int alloc_data_size= *data_size; |
605 | 605 |
606 *data_size=0; | 606 *data_size=0; |
698 } | 698 } |
699 | 699 |
700 *data_size = s->blocksize * s->channels * (s->is32 ? 4 : 2); | 700 *data_size = s->blocksize * s->channels * (s->is32 ? 4 : 2); |
701 | 701 |
702 end: | 702 end: |
703 i= (get_bits_count(&s->gb)+7)/8; | 703 bytes_read = (get_bits_count(&s->gb)+7)/8; |
704 if (i > buf_size) { | 704 if (bytes_read > buf_size) { |
705 av_log(s->avctx, AV_LOG_ERROR, "overread: %d\n", i - buf_size); | 705 av_log(s->avctx, AV_LOG_ERROR, "overread: %d\n", bytes_read - buf_size); |
706 s->bitstream_size=0; | 706 s->bitstream_size=0; |
707 s->bitstream_index=0; | 707 s->bitstream_index=0; |
708 return -1; | 708 return -1; |
709 } | 709 } |
710 | 710 |
711 if (s->bitstream_size) { | 711 if (s->bitstream_size) { |
712 s->bitstream_index += i; | 712 s->bitstream_index += bytes_read; |
713 s->bitstream_size -= i; | 713 s->bitstream_size -= bytes_read; |
714 return input_buf_size; | 714 return input_buf_size; |
715 } else | 715 } else |
716 return i; | 716 return bytes_read; |
717 } | 717 } |
718 | 718 |
719 static av_cold int flac_decode_close(AVCodecContext *avctx) | 719 static av_cold int flac_decode_close(AVCodecContext *avctx) |
720 { | 720 { |
721 FLACContext *s = avctx->priv_data; | 721 FLACContext *s = avctx->priv_data; |