1 /*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
20
22
25 const uint8_t **poutbuf,
int *poutbuf_size,
27 {
28 unsigned int frame_type;
30
31 if (buf_size < 3)
32 return buf_size;
33
34 frame_type = buf[0] & 1;
35 profile = (buf[0] >> 1) & 7;
36 if (profile > 3) {
38 return buf_size;
39 }
40
47
48 if (frame_type == 0) {
49 unsigned int sync_code;
51
52 if (buf_size < 10)
53 return buf_size;
54
56 if (sync_code != 0x2a019d) {
58 return buf_size;
59 }
60
61 width =
AV_RL16(buf + 6) & 0x3fff;
62 height =
AV_RL16(buf + 8) & 0x3fff;
63
68 }
69
71 *poutbuf_size = buf_size;
72 return buf_size;
73 }
74
77 .parser_parse =
parse,
78 };
int width
Dimensions of the decoded video intended for presentation.
enum AVFieldOrder field_order
int coded_width
Dimensions of the coded video.
AVCodecParser ff_vp8_parser
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
enum AVPictureStructure picture_structure
Indicate whether a picture is coded as a frame, top field or bottom field.
static int parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_RL24
Libavcodec external API header.
main external API structure.
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
int format
The format of the coded data, corresponds to enum AVPixelFormat for video and for enum AVSampleFormat...
int key_frame
Set by parser to 1 for key frames and 0 for non-key frames.