1 /*
2 * PNM image parser
3 * Copyright (c) 2002, 2003 Fabrice Bellard
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
23
24 #include "parser.h" //for ParseContext
26
27
29 const uint8_t **poutbuf,
int *poutbuf_size,
31 {
34 int next;
35
38 }
39 retry:
44 } else {
48 }
53 } else {
54 buf++;
55 buf_size--;
56 }
57 goto retry;
58 }
60 }
else if (pnmctx.
type < 4) {
62 } else {
67 if (next > buf_size)
69 }
70
73 *poutbuf_size = 0;
74 return buf_size;
75 }
77 *poutbuf_size = buf_size;
78 return next;
79 }
80
87 };
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
AVCodecParser ff_pnm_parser
int av_image_get_buffer_size(enum AVPixelFormat pix_fmt, int width, int height, int align)
Return the size in bytes of the amount of data required to store an image with the given parameters...
int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size)
Combine the (truncated) bitstream to a complete frame.
int overread_index
the index into ParseContext.buffer of the overread bytes
void ff_parse_close(AVCodecParserContext *s)
int overread
the number of bytes which where irreversibly read from the next frame
int width
picture width / height.
int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext *const s)
main external API structure.
static int pnm_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
uint8_t * bytestream_start