annotate vp8_parser.c @ 12530:63edd10ad4bc libavcodec tip

Try to fix crashes introduced by r25218 r25218 made assumptions about the existence of past reference frames that weren't necessarily true.
author darkshikari
date Tue, 28 Sep 2010 09:06:22 +0000
parents 7912d72bea7c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11785
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
1 /*
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
2 * Copyright (C) 2008 Michael Niedermayer
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
3 *
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
4 * This file is part of FFmpeg.
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
5 *
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
6 * FFmpeg is free software; you can redistribute it and/or
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
8 * License as published by the Free Software Foundation; either
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
9 * version 2.1 of the License, or (at your option) any later version.
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
10 *
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
11 * FFmpeg is distributed in the hope that it will be useful,
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
14 * Lesser General Public License for more details.
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
15 *
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
17 * License along with FFmpeg; if not, write to the Free Software
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
19 */
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
20
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
21 #include "parser.h"
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
22
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
23 static int parse(AVCodecParserContext *s,
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
24 AVCodecContext *avctx,
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
25 const uint8_t **poutbuf, int *poutbuf_size,
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
26 const uint8_t *buf, int buf_size)
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
27 {
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
28 s->pict_type= (buf[0]&0x01) ? FF_P_TYPE : FF_I_TYPE;
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
29
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
30 *poutbuf = buf;
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
31 *poutbuf_size = buf_size;
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
32 return buf_size;
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
33 }
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
34
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
35 AVCodecParser vp8_parser = {
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
36 { CODEC_ID_VP8 },
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
37 0,
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
38 NULL,
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
39 parse,
7912d72bea7c VP8 parser
conrad
parents:
diff changeset
40 };