static AVCodecParser *av_first_parser = NULL;
-AVCodecParser *av_parser_next(AVCodecParser *p)
+AVCodecParser *av_parser_next(const AVCodecParser *p)
{
if (p)
return p->next;
s->dts_sync_point = INT_MIN;
s->dts_ref_dts_delta = INT_MIN;
s->pts_dts_delta = INT_MIN;
+ s->format = -1;
+
return s;
}
const uint8_t *buf, int buf_size, int keyframe)
{
if (s && s->parser->split) {
- if ((avctx->flags & CODEC_FLAG_GLOBAL_HEADER) ||
- (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER)) {
+ if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER ||
+ avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER) {
int i = s->parser->split(avctx, buf, buf_size);
buf += i;
buf_size -= i;
*poutbuf = (uint8_t *) buf;
*poutbuf_size = buf_size;
if (avctx->extradata) {
- if ((keyframe && (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER))) {
+ if (keyframe && (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER)) {
int size = buf_size + avctx->extradata_size;
*poutbuf_size = size;
*poutbuf = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!*poutbuf)
+ return AVERROR(ENOMEM);
memcpy(*poutbuf, avctx->extradata, avctx->extradata_size);
- memcpy((*poutbuf) + avctx->extradata_size, buf,
+ memcpy(*poutbuf + avctx->extradata_size, buf,
buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
return 1;
}
/* copy into buffer end return */
if (next == END_NOT_FOUND) {
void *new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size,
- (*buf_size) + pc->index +
+ *buf_size + pc->index +
FF_INPUT_BUFFER_PADDING_SIZE);
if (!new_buffer)
/* store overread bytes */
for (; next < 0; next++) {
- pc->state = (pc->state << 8) | pc->buffer[pc->last_index + next];
- pc->state64 = (pc->state64 << 8) | pc->buffer[pc->last_index + next];
+ pc->state = pc->state << 8 | pc->buffer[pc->last_index + next];
+ pc->state64 = pc->state64 << 8 | pc->buffer[pc->last_index + next];
pc->overread++;
}
uint32_t state = -1;
for (i = 0; i < buf_size; i++) {
- state = (state << 8) | buf[i];
+ state = state << 8 | buf[i];
if (state == 0x1B3 || state == 0x1B6)
return i - 3;
}