|
|
@ -873,9 +873,8 @@ static int ac3_parse(AVCodecParserContext *s1, |
|
|
|
len = s->inbuf_ptr - s->inbuf; |
|
|
|
len = s->inbuf_ptr - s->inbuf; |
|
|
|
if (s->frame_size == 0) { |
|
|
|
if (s->frame_size == 0) { |
|
|
|
/* no header seen : find one. We need at least 7 bytes to parse it */ |
|
|
|
/* no header seen : find one. We need at least 7 bytes to parse it */ |
|
|
|
len = AC3_HEADER_SIZE - len; |
|
|
|
len = FFMIN(AC3_HEADER_SIZE - len, buf_size); |
|
|
|
if (len > buf_size) |
|
|
|
|
|
|
|
len = buf_size; |
|
|
|
|
|
|
|
memcpy(s->inbuf_ptr, buf_ptr, len); |
|
|
|
memcpy(s->inbuf_ptr, buf_ptr, len); |
|
|
|
buf_ptr += len; |
|
|
|
buf_ptr += len; |
|
|
|
s->inbuf_ptr += len; |
|
|
|
s->inbuf_ptr += len; |
|
|
@ -898,16 +897,15 @@ static int ac3_parse(AVCodecParserContext *s1, |
|
|
|
avctx->frame_size = 6 * 256; |
|
|
|
avctx->frame_size = 6 * 256; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (len < s->frame_size) { |
|
|
|
} else { |
|
|
|
len = s->frame_size - len; |
|
|
|
len = FFMIN(s->frame_size - len, buf_size); |
|
|
|
if (len > buf_size) |
|
|
|
|
|
|
|
len = buf_size; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
memcpy(s->inbuf_ptr, buf_ptr, len); |
|
|
|
memcpy(s->inbuf_ptr, buf_ptr, len); |
|
|
|
buf_ptr += len; |
|
|
|
buf_ptr += len; |
|
|
|
s->inbuf_ptr += len; |
|
|
|
s->inbuf_ptr += len; |
|
|
|
buf_size -= len; |
|
|
|
buf_size -= len; |
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
|
|
if(s->inbuf_ptr - s->inbuf == s->frame_size){ |
|
|
|
*poutbuf = s->inbuf; |
|
|
|
*poutbuf = s->inbuf; |
|
|
|
*poutbuf_size = s->frame_size; |
|
|
|
*poutbuf_size = s->frame_size; |
|
|
|
s->inbuf_ptr = s->inbuf; |
|
|
|
s->inbuf_ptr = s->inbuf; |
|
|
@ -915,6 +913,7 @@ static int ac3_parse(AVCodecParserContext *s1, |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return buf_ptr - buf; |
|
|
|
return buf_ptr - buf; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|