mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +02:00
vorbis_parser: fix blocksize
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
441dce2169
commit
16db88a093
@ -164,7 +164,7 @@ static int parse_setup_header(AVCodecContext *avctx, VorbisParseContext *s,
|
|||||||
skip_bits_long(&gb, got_framing_bit);
|
skip_bits_long(&gb, got_framing_bit);
|
||||||
for (i = mode_count - 1; i >= 0; i--) {
|
for (i = mode_count - 1; i >= 0; i--) {
|
||||||
skip_bits_long(&gb, 40);
|
skip_bits_long(&gb, 40);
|
||||||
s->mode_blocksize[i] = s->blocksize[get_bits1(&gb)];
|
s->mode_blocksize[i] = get_bits1(&gb);
|
||||||
}
|
}
|
||||||
|
|
||||||
bad_header:
|
bad_header:
|
||||||
@ -195,7 +195,7 @@ int avpriv_vorbis_parse_extradata(AVCodecContext *avctx, VorbisParseContext *s)
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
s->valid_extradata = 1;
|
s->valid_extradata = 1;
|
||||||
s->previous_blocksize = s->mode_blocksize[0];
|
s->previous_blocksize = s->blocksize[s->mode_blocksize[0]];
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -221,11 +221,11 @@ int avpriv_vorbis_parse_frame(VorbisParseContext *s, const uint8_t *buf,
|
|||||||
av_log(s->avctx, AV_LOG_ERROR, "Invalid mode in packet\n");
|
av_log(s->avctx, AV_LOG_ERROR, "Invalid mode in packet\n");
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
if (mode) {
|
if(s->mode_blocksize[mode]){
|
||||||
int flag = !!(buf[0] & s->prev_mask);
|
int flag = !!(buf[0] & s->prev_mask);
|
||||||
previous_blocksize = s->blocksize[flag];
|
previous_blocksize = s->blocksize[flag];
|
||||||
}
|
}
|
||||||
current_blocksize = s->mode_blocksize[mode];
|
current_blocksize = s->blocksize[s->mode_blocksize[mode]];
|
||||||
duration = (previous_blocksize + current_blocksize) >> 2;
|
duration = (previous_blocksize + current_blocksize) >> 2;
|
||||||
s->previous_blocksize = current_blocksize;
|
s->previous_blocksize = current_blocksize;
|
||||||
}
|
}
|
||||||
@ -236,7 +236,7 @@ int avpriv_vorbis_parse_frame(VorbisParseContext *s, const uint8_t *buf,
|
|||||||
void avpriv_vorbis_parse_reset(VorbisParseContext *s)
|
void avpriv_vorbis_parse_reset(VorbisParseContext *s)
|
||||||
{
|
{
|
||||||
if (s->valid_extradata)
|
if (s->valid_extradata)
|
||||||
s->previous_blocksize = 0;
|
s->previous_blocksize = s->blocksize[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_VORBIS_PARSER
|
#if CONFIG_VORBIS_PARSER
|
||||||
|
Loading…
Reference in New Issue
Block a user