annotate pnm.c @ 71:a803af1b10be libavformat

* compile PNG only when ZLIB is available
author kabi
date Thu, 27 Feb 2003 17:32:56 +0000
parents a58a8a53eb46
children c82a6062485e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
1 /*
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
2 * PNM image format
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
3 * Copyright (c) 2002, 2003 Fabrice Bellard.
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
4 *
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
5 * This library is free software; you can redistribute it and/or
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
7 * License as published by the Free Software Foundation; either
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
8 * version 2 of the License, or (at your option) any later version.
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
9 *
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
10 * This library is distributed in the hope that it will be useful,
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
13 * Lesser General Public License for more details.
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
14 *
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
16 * License along with this library; if not, write to the Free Software
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
18 */
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
19 #include "avformat.h"
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
20
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
21 static inline int pnm_space(int c)
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
22 {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
23 return (c == ' ' || c == '\n' || c == '\r' || c == '\t');
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
24 }
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
25
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
26 static void pnm_get(ByteIOContext *f, char *str, int buf_size)
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
27 {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
28 char *s;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
29 int c;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
30
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
31 /* skip spaces and comments */
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
32 for(;;) {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
33 c = url_fgetc(f);
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
34 if (c == '#') {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
35 do {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
36 c = url_fgetc(f);
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
37 } while (c != '\n' && c != URL_EOF);
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
38 } else if (!pnm_space(c)) {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
39 break;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
40 }
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
41 }
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
42
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
43 s = str;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
44 while (c != URL_EOF && !pnm_space(c)) {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
45 if ((s - str) < buf_size - 1)
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
46 *s++ = c;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
47 c = url_fgetc(f);
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
48 }
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
49 *s = '\0';
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
50 }
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
51
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
52 static int pnm_read1(ByteIOContext *f,
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
53 int (*alloc_cb)(void *opaque, AVImageInfo *info), void *opaque,
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
54 int allow_yuv)
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
55 {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
56 int i, n, linesize, h;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
57 char buf1[32];
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
58 unsigned char *ptr;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
59 AVImageInfo info1, *info = &info1;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
60 int ret;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
61
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
62 pnm_get(f, buf1, sizeof(buf1));
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
63 if (!strcmp(buf1, "P4")) {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
64 info->pix_fmt = PIX_FMT_MONOWHITE;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
65 } else if (!strcmp(buf1, "P5")) {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
66 if (allow_yuv)
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
67 info->pix_fmt = PIX_FMT_YUV420P;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
68 else
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
69 info->pix_fmt = PIX_FMT_GRAY8;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
70 } else if (!strcmp(buf1, "P6")) {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
71 info->pix_fmt = PIX_FMT_RGB24;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
72 } else {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
73 return AVERROR_INVALIDDATA;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
74 }
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
75 pnm_get(f, buf1, sizeof(buf1));
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
76 info->width = atoi(buf1);
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
77 if (info->width <= 0)
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
78 return AVERROR_INVALIDDATA;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
79 pnm_get(f, buf1, sizeof(buf1));
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
80 info->height = atoi(buf1);
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
81 if (info->height <= 0)
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
82 return AVERROR_INVALIDDATA;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
83 if (info->pix_fmt != PIX_FMT_MONOWHITE) {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
84 pnm_get(f, buf1, sizeof(buf1));
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
85 }
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
86
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
87 /* more check if YUV420 */
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
88 if (info->pix_fmt == PIX_FMT_YUV420P) {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
89 if ((info->width & 1) != 0)
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
90 return AVERROR_INVALIDDATA;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
91 h = (info->height * 2);
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
92 if ((h % 3) != 0)
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
93 return AVERROR_INVALIDDATA;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
94 h /= 3;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
95 info->height = h;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
96 }
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
97
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
98 ret = alloc_cb(opaque, info);
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
99 if (ret)
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
100 return ret;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
101
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
102 switch(info->pix_fmt) {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
103 default:
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
104 return AVERROR_INVALIDDATA;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
105 case PIX_FMT_RGB24:
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
106 n = info->width * 3;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
107 goto do_read;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
108 case PIX_FMT_GRAY8:
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
109 n = info->width;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
110 goto do_read;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
111 case PIX_FMT_MONOWHITE:
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
112 n = (info->width + 7) >> 3;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
113 do_read:
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
114 ptr = info->pict.data[0];
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
115 linesize = info->pict.linesize[0];
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
116 for(i = 0; i < info->height; i++) {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
117 get_buffer(f, ptr, n);
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
118 ptr += linesize;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
119 }
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
120 break;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
121 case PIX_FMT_YUV420P:
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
122 {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
123 unsigned char *ptr1, *ptr2;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
124
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
125 n = info->width;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
126 ptr = info->pict.data[0];
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
127 linesize = info->pict.linesize[0];
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
128 for(i = 0; i < info->height; i++) {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
129 get_buffer(f, ptr, n);
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
130 ptr += linesize;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
131 }
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
132 ptr1 = info->pict.data[1];
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
133 ptr2 = info->pict.data[2];
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
134 n >>= 1;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
135 h = info->height >> 1;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
136 for(i = 0; i < h; i++) {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
137 get_buffer(f, ptr1, n);
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
138 get_buffer(f, ptr2, n);
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
139 ptr1 += info->pict.linesize[1];
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
140 ptr2 += info->pict.linesize[2];
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
141 }
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
142 }
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
143 break;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
144 }
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
145 return 0;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
146 }
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
147
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
148 static int pnm_read(ByteIOContext *f,
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
149 int (*alloc_cb)(void *opaque, AVImageInfo *info), void *opaque)
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
150 {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
151 return pnm_read1(f, alloc_cb, opaque, 0);
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
152 }
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
153
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
154 static int pgmyuv_read(ByteIOContext *f,
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
155 int (*alloc_cb)(void *opaque, AVImageInfo *info), void *opaque)
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
156 {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
157 return pnm_read1(f, alloc_cb, opaque, 1);
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
158 }
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
159
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
160 static int pnm_write(ByteIOContext *pb, AVImageInfo *info)
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
161 {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
162 int i, h, h1, c, n, linesize;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
163 char buf[100];
65
a58a8a53eb46 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 20
diff changeset
164 uint8_t *ptr, *ptr1, *ptr2;
20
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
165
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
166 h = info->height;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
167 h1 = h;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
168 switch(info->pix_fmt) {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
169 case PIX_FMT_MONOWHITE:
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
170 c = '4';
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
171 n = (info->width + 7) >> 3;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
172 break;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
173 case PIX_FMT_GRAY8:
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
174 c = '5';
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
175 n = info->width;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
176 break;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
177 case PIX_FMT_RGB24:
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
178 c = '6';
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
179 n = info->width * 3;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
180 break;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
181 case PIX_FMT_YUV420P:
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
182 c = '5';
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
183 n = info->width;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
184 h1 = (h * 3) / 2;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
185 break;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
186 default:
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
187 return AVERROR_INVALIDDATA;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
188 }
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
189 snprintf(buf, sizeof(buf),
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
190 "P%c\n%d %d\n",
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
191 c, info->width, h1);
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
192 put_buffer(pb, buf, strlen(buf));
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
193 if (info->pix_fmt != PIX_FMT_MONOWHITE) {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
194 snprintf(buf, sizeof(buf),
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
195 "%d\n", 255);
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
196 put_buffer(pb, buf, strlen(buf));
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
197 }
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
198
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
199 ptr = info->pict.data[0];
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
200 linesize = info->pict.linesize[0];
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
201 for(i=0;i<h;i++) {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
202 put_buffer(pb, ptr, n);
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
203 ptr += linesize;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
204 }
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
205
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
206 if (info->pix_fmt == PIX_FMT_YUV420P) {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
207 h >>= 1;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
208 n >>= 1;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
209 ptr1 = info->pict.data[1];
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
210 ptr2 = info->pict.data[2];
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
211 for(i=0;i<h;i++) {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
212 put_buffer(pb, ptr1, n);
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
213 put_buffer(pb, ptr2, n);
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
214 ptr1 += info->pict.linesize[1];
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
215 ptr2 += info->pict.linesize[2];
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
216 }
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
217 }
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
218 put_flush_packet(pb);
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
219 return 0;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
220 }
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
221
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
222 static int pnm_probe(AVProbeData *pd)
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
223 {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
224 const char *p = pd->buf;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
225 if (pd->buf_size >= 8 &&
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
226 p[0] == 'P' &&
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
227 p[1] >= '4' && p[1] <= '6' &&
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
228 p[2] == '\n')
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
229 return AVPROBE_SCORE_MAX;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
230 else
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
231 return 0;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
232 }
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
233
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
234 static int pgmyuv_probe(AVProbeData *pd)
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
235 {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
236 if (match_ext(pd->filename, "pgmyuv"))
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
237 return AVPROBE_SCORE_MAX;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
238 else
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
239 return 0;
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
240 }
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
241
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
242 AVImageFormat pnm_image_format = {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
243 "pnm",
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
244 NULL,
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
245 pnm_probe,
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
246 pnm_read,
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
247 0,
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
248 NULL,
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
249 };
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
250
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
251 AVImageFormat pbm_image_format = {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
252 "pbm",
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
253 "pbm",
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
254 NULL,
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
255 NULL,
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
256 (1 << PIX_FMT_MONOWHITE),
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
257 pnm_write,
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
258 };
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
259
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
260 AVImageFormat pgm_image_format = {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
261 "pgm",
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
262 "pgm",
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
263 NULL,
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
264 NULL,
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
265 (1 << PIX_FMT_GRAY8),
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
266 pnm_write,
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
267 };
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
268
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
269 AVImageFormat ppm_image_format = {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
270 "ppm",
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
271 "ppm",
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
272 NULL,
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
273 NULL,
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
274 (1 << PIX_FMT_RGB24),
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
275 pnm_write,
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
276 };
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
277
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
278 AVImageFormat pgmyuv_image_format = {
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
279 "pgmyuv",
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
280 NULL,
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
281 pgmyuv_probe,
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
282 pgmyuv_read,
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
283 (1 << PIX_FMT_YUV420P),
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
284 pnm_write,
3d52de18ecc3 added still image support
bellard
parents:
diff changeset
285 };