demux_viv: fix unsafe code
[mplayer.git] / pnm_loader.h
blobe00cce2e63ec4f0e4f1b7286c20f97b7caac1d5b
1 /*
2 * PNM image files loader
4 * This file is part of MPlayer.
6 * MPlayer is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * MPlayer is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 * You can alternatively redistribute this file and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License as published by the Free Software Foundation; either
23 * version 2.1 of the License, or (at your option) any later version.
26 #ifndef MPLAYER_PNM_LOADER_H
27 #define MPLAYER_PNM_LOADER_H
29 #include <stdio.h>
30 #include <stdint.h>
32 /**
33 * Read a "portable anymap" image.
34 * Supports raw PGM (P5) and PNM (P6).
36 * @param[in] f input stream.
37 * @param[out] width width of the loaded image.
38 * @param[out] height height of the loaded image.
39 * @param[out] bytes_per_pixel format of the loaded image.
40 * @param[out] maxval maximum pixel value; possible values are:
41 * 1 for 8 bits gray,
42 * 2 for 16 bits gray,
43 * 3 for 8 bits per component RGB,
44 * 6 for 16 bits per component RGB.
45 * @return a newly allocated array of
46 * width*height*bytes_per_pixel bytes,
47 * or NULL in case of error.
49 uint8_t *read_pnm(FILE *f, int *width, int *height,
50 int *bytes_per_pixel, int *maxval);
52 #endif /* MPLAYER_PNM_LOADER_H */