FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavformat/img2dec.c
Date: 2024-04-19 17:50:32
Exec Total Coverage
Lines: 468 659 71.0%
Functions: 46 48 95.8%
Branches: 350 610 57.4%

Line Branch Exec Source
1 /*
2 * Image format
3 * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
4 * Copyright (c) 2004 Michael Niedermayer
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23 #include "config_components.h"
24
25 #define _DEFAULT_SOURCE
26 #define _BSD_SOURCE
27 #include <sys/stat.h>
28 #include "libavutil/avstring.h"
29 #include "libavutil/log.h"
30 #include "libavutil/mem.h"
31 #include "libavutil/opt.h"
32 #include "libavutil/pixdesc.h"
33 #include "libavutil/intreadwrite.h"
34 #include "libavcodec/gif.h"
35 #include "avformat.h"
36 #include "avio_internal.h"
37 #include "demux.h"
38 #include "internal.h"
39 #include "img2.h"
40 #include "os_support.h"
41 #include "libavcodec/jpegxl_parse.h"
42 #include "libavcodec/mjpeg.h"
43 #include "libavcodec/vbn.h"
44 #include "libavcodec/xwd.h"
45 #include "subtitles.h"
46
47 #if HAVE_GLOB
48 /* Locally define as 0 (bitwise-OR no-op) any missing glob options that
49 are non-posix glibc/bsd extensions. */
50 #ifndef GLOB_NOMAGIC
51 #define GLOB_NOMAGIC 0
52 #endif
53 #ifndef GLOB_BRACE
54 #define GLOB_BRACE 0
55 #endif
56
57 #endif /* HAVE_GLOB */
58
59 static const int sizes[][2] = {
60 { 640, 480 },
61 { 720, 480 },
62 { 720, 576 },
63 { 352, 288 },
64 { 352, 240 },
65 { 160, 128 },
66 { 512, 384 },
67 { 640, 352 },
68 { 640, 240 },
69 };
70
71 static int infer_size(int *width_ptr, int *height_ptr, int size)
72 {
73 int i;
74
75 for (i = 0; i < FF_ARRAY_ELEMS(sizes); i++) {
76 if ((sizes[i][0] * sizes[i][1]) == size) {
77 *width_ptr = sizes[i][0];
78 *height_ptr = sizes[i][1];
79 return 0;
80 }
81 }
82
83 return -1;
84 }
85
86 3251 static int is_glob(const char *path)
87 {
88 #if HAVE_GLOB
89 3251 size_t span = 0;
90 3251 const char *p = path;
91
92
2/2
✓ Branch 0 taken 2687 times.
✓ Branch 1 taken 3251 times.
5938 while (p = strchr(p, '%')) {
93
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2687 times.
2687 if (*(++p) == '%') {
94 ++p;
95 continue;
96 }
97
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2687 times.
2687 if (span = strspn(p, "*?[]{}"))
98 break;
99 }
100 /* Did we hit a glob char or get to the end? */
101 3251 return span != 0;
102 #else
103 return 0;
104 #endif
105 }
106
107 /**
108 * Get index range of image files matched by path.
109 *
110 * @param pfirst_index pointer to index updated with the first number in the range
111 * @param plast_index pointer to index updated with the last number in the range
112 * @param path path which has to be matched by the image files in the range
113 * @param start_index minimum accepted value for the first index in the range
114 * @return -1 if no image file could be found
115 */
116 2691 static int find_image_range(AVIOContext *pb, int *pfirst_index, int *plast_index,
117 const char *path, int start_index, int start_index_range)
118 {
119 char buf[1024];
120 int range, last_index, range1, first_index;
121
122 /* find the first image */
123
1/2
✓ Branch 0 taken 2750 times.
✗ Branch 1 not taken.
2750 for (first_index = start_index; first_index < start_index + start_index_range; first_index++) {
124
2/2
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 2746 times.
2750 if (av_get_frame_filename(buf, sizeof(buf), path, first_index) < 0) {
125 4 *pfirst_index =
126 4 *plast_index = 1;
127
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
4 if (pb || avio_check(buf, AVIO_FLAG_READ) > 0)
128 4 return 0;
129 return -1;
130 }
131
2/2
✓ Branch 1 taken 2687 times.
✓ Branch 2 taken 59 times.
2746 if (avio_check(buf, AVIO_FLAG_READ) > 0)
132 2687 break;
133 }
134
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2687 times.
2687 if (first_index == start_index + start_index_range)
135 goto fail;
136
137 /* find the last image */
138 2687 last_index = first_index;
139 for (;;) {
140 10673 range = 0;
141 for (;;) {
142
2/2
✓ Branch 0 taken 10673 times.
✓ Branch 1 taken 31861 times.
42534 if (!range)
143 10673 range1 = 1;
144 else
145 31861 range1 = 2 * range;
146
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 42534 times.
42534 if (av_get_frame_filename(buf, sizeof(buf), path,
147 last_index + range1) < 0)
148 goto fail;
149
2/2
✓ Branch 1 taken 10673 times.
✓ Branch 2 taken 31861 times.
42534 if (avio_check(buf, AVIO_FLAG_READ) <= 0)
150 10673 break;
151 31861 range = range1;
152 /* just in case... */
153
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 31861 times.
31861 if (range >= (1 << 30))
154 goto fail;
155 }
156 /* we are sure than image last_index + range exists */
157
2/2
✓ Branch 0 taken 2687 times.
✓ Branch 1 taken 7986 times.
10673 if (!range)
158 2687 break;
159 7986 last_index += range;
160 }
161 2687 *pfirst_index = first_index;
162 2687 *plast_index = last_index;
163 2687 return 0;
164
165 fail:
166 return -1;
167 }
168
169 10917 static int img_read_probe(const AVProbeData *p)
170 {
171
4/4
✓ Branch 0 taken 7912 times.
✓ Branch 1 taken 3005 times.
✓ Branch 3 taken 750 times.
✓ Branch 4 taken 7162 times.
10917 if (p->filename && ff_guess_image2_codec(p->filename)) {
172
2/2
✓ Branch 1 taken 190 times.
✓ Branch 2 taken 560 times.
750 if (av_filename_number_test(p->filename))
173 190 return AVPROBE_SCORE_MAX;
174
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 560 times.
560 else if (is_glob(p->filename))
175 return AVPROBE_SCORE_MAX;
176
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 560 times.
560 else if (p->filename[strcspn(p->filename, "*?{")]) // probably PT_GLOB
177 return AVPROBE_SCORE_EXTENSION + 2; // score chosen to be a tad above the image pipes
178
2/2
✓ Branch 0 taken 280 times.
✓ Branch 1 taken 280 times.
560 else if (p->buf_size == 0)
179 280 return 0;
180
2/4
✓ Branch 1 taken 280 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 280 times.
280 else if (av_match_ext(p->filename, "raw") || av_match_ext(p->filename, "gif"))
181 return 5;
182 else
183 280 return AVPROBE_SCORE_EXTENSION;
184 }
185 10167 return 0;
186 }
187
188 2997 int ff_img_read_header(AVFormatContext *s1)
189 {
190 2997 VideoDemuxData *s = s1->priv_data;
191 2997 int first_index = 1, last_index = 1;
192 AVStream *st;
193 2997 enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE;
194
195 2997 s1->ctx_flags |= AVFMTCTX_NOHEADER;
196
197 2997 st = avformat_new_stream(s1, NULL);
198
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2997 times.
2997 if (!st) {
199 return AVERROR(ENOMEM);
200 }
201
202
3/4
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 2988 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 9 times.
3006 if (s->pixel_format &&
203 9 (pix_fmt = av_get_pix_fmt(s->pixel_format)) == AV_PIX_FMT_NONE) {
204 av_log(s1, AV_LOG_ERROR, "No such pixel format: %s.\n",
205 s->pixel_format);
206 return AVERROR(EINVAL);
207 }
208
209 2997 av_strlcpy(s->path, s1->url, sizeof(s->path));
210 2997 s->img_number = 0;
211 2997 s->img_count = 0;
212
213 /* find format */
214
2/2
✓ Branch 0 taken 2716 times.
✓ Branch 1 taken 281 times.
2997 if (s1->iformat->flags & AVFMT_NOFILE)
215 2716 s->is_pipe = 0;
216 else {
217 281 s->is_pipe = 1;
218 281 ffstream(st)->need_parsing = AVSTREAM_PARSE_FULL;
219 }
220
221
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2997 times.
2997 if (s->ts_from_file == 2) {
222 #if !HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
223 av_log(s1, AV_LOG_ERROR, "POSIX.1-2008 not supported, nanosecond file timestamps unavailable\n");
224 return AVERROR(ENOSYS);
225 #endif
226 avpriv_set_pts_info(st, 64, 1, 1000000000);
227
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2997 times.
2997 } else if (s->ts_from_file)
228 avpriv_set_pts_info(st, 64, 1, 1);
229 else {
230 2997 avpriv_set_pts_info(st, 64, s->framerate.den, s->framerate.num);
231 2997 st->avg_frame_rate = st->r_frame_rate = s->framerate;
232 }
233
234
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 2997 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
2997 if (s->width && s->height) {
235 st->codecpar->width = s->width;
236 st->codecpar->height = s->height;
237 }
238
239
2/2
✓ Branch 0 taken 2716 times.
✓ Branch 1 taken 281 times.
2997 if (!s->is_pipe) {
240
1/2
✓ Branch 0 taken 2716 times.
✗ Branch 1 not taken.
2716 if (s->pattern_type == PT_DEFAULT) {
241
2/2
✓ Branch 0 taken 25 times.
✓ Branch 1 taken 2691 times.
2716 if (s1->pb) {
242 25 s->pattern_type = PT_NONE;
243 } else
244 2691 s->pattern_type = PT_GLOB_SEQUENCE;
245 }
246
247
2/2
✓ Branch 0 taken 2691 times.
✓ Branch 1 taken 25 times.
2716 if (s->pattern_type == PT_GLOB_SEQUENCE) {
248 2691 s->use_glob = is_glob(s->path);
249
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2691 times.
2691 if (s->use_glob) {
250 #if HAVE_GLOB
251 char *p = s->path, *q, *dup;
252 int gerr;
253 #endif
254
255 av_log(s1, AV_LOG_WARNING, "Pattern type 'glob_sequence' is deprecated: "
256 "use pattern_type 'glob' instead\n");
257 #if HAVE_GLOB
258 dup = q = av_strdup(p);
259 while (*q) {
260 /* Do we have room for the next char and a \ insertion? */
261 if ((p - s->path) >= (sizeof(s->path) - 2))
262 break;
263 if (*q == '%' && strspn(q + 1, "%*?[]{}"))
264 ++q;
265 else if (strspn(q, "\\*?[]{}"))
266 *p++ = '\\';
267 *p++ = *q++;
268 }
269 *p = 0;
270 av_free(dup);
271
272 gerr = glob(s->path, GLOB_NOCHECK|GLOB_BRACE|GLOB_NOMAGIC, NULL, &s->globstate);
273 if (gerr != 0) {
274 return AVERROR(ENOENT);
275 }
276 first_index = 0;
277 last_index = s->globstate.gl_pathc - 1;
278 #endif
279 }
280 }
281
4/6
✓ Branch 0 taken 2691 times.
✓ Branch 1 taken 25 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2691 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 25 times.
2716 if ((s->pattern_type == PT_GLOB_SEQUENCE && !s->use_glob) || s->pattern_type == PT_SEQUENCE) {
282
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2691 times.
2691 if (find_image_range(s1->pb, &first_index, &last_index, s->path,
283 s->start_number, s->start_number_range) < 0) {
284 av_log(s1, AV_LOG_ERROR,
285 "Could find no file with path '%s' and index in the range %d-%d\n",
286 s->path, s->start_number, s->start_number + s->start_number_range - 1);
287 return AVERROR(ENOENT);
288 }
289
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 25 times.
25 } else if (s->pattern_type == PT_GLOB) {
290 #if HAVE_GLOB
291 int gerr;
292 gerr = glob(s->path, GLOB_NOCHECK|GLOB_BRACE|GLOB_NOMAGIC, NULL, &s->globstate);
293 if (gerr != 0) {
294 return AVERROR(ENOENT);
295 }
296 first_index = 0;
297 last_index = s->globstate.gl_pathc - 1;
298 s->use_glob = 1;
299 #else
300 av_log(s1, AV_LOG_ERROR,
301 "Pattern type 'glob' was selected but globbing "
302 "is not supported by this libavformat build\n");
303 return AVERROR(ENOSYS);
304 #endif
305
2/4
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 25 times.
25 } else if (s->pattern_type != PT_GLOB_SEQUENCE && s->pattern_type != PT_NONE) {
306 av_log(s1, AV_LOG_ERROR,
307 "Unknown value '%d' for pattern_type option\n", s->pattern_type);
308 return AVERROR(EINVAL);
309 }
310 2716 s->img_first = first_index;
311 2716 s->img_last = last_index;
312 2716 s->img_number = first_index;
313 /* compute duration */
314
1/2
✓ Branch 0 taken 2716 times.
✗ Branch 1 not taken.
2716 if (!s->ts_from_file) {
315 2716 st->start_time = 0;
316 2716 st->duration = last_index - first_index + 1;
317 }
318 }
319
320
2/2
✓ Branch 0 taken 2619 times.
✓ Branch 1 taken 378 times.
2997 if (s1->video_codec_id) {
321 2619 st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
322 2619 st->codecpar->codec_id = s1->video_codec_id;
323
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 378 times.
378 } else if (s1->audio_codec_id) {
324 st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
325 st->codecpar->codec_id = s1->audio_codec_id;
326
2/2
✓ Branch 1 taken 267 times.
✓ Branch 2 taken 111 times.
378 } else if (ffifmt(s1->iformat)->raw_codec_id) {
327 267 st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
328 267 st->codecpar->codec_id = ffifmt(s1->iformat)->raw_codec_id;
329 } else {
330 111 const char *str = strrchr(s->path, '.');
331
2/4
✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 111 times.
111 s->split_planes = str && !av_strcasecmp(str + 1, "y");
332 111 st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
333
2/2
✓ Branch 0 taken 34 times.
✓ Branch 1 taken 77 times.
111 if (s1->pb) {
334 34 int probe_buffer_size = 2048;
335 34 uint8_t *probe_buffer = av_realloc(NULL, probe_buffer_size + AVPROBE_PADDING_SIZE);
336 34 const AVInputFormat *fmt = NULL;
337 34 void *fmt_iter = NULL;
338 34 AVProbeData pd = { 0 };
339
340
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 34 times.
34 if (!probe_buffer)
341 return AVERROR(ENOMEM);
342
343 34 probe_buffer_size = avio_read(s1->pb, probe_buffer, probe_buffer_size);
344
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 34 times.
34 if (probe_buffer_size < 0) {
345 av_free(probe_buffer);
346 return probe_buffer_size;
347 }
348 34 memset(probe_buffer + probe_buffer_size, 0, AVPROBE_PADDING_SIZE);
349
350 34 pd.buf = probe_buffer;
351 34 pd.buf_size = probe_buffer_size;
352 34 pd.filename = s1->url;
353
354
2/2
✓ Branch 1 taken 11700 times.
✓ Branch 2 taken 13 times.
11713 while ((fmt = av_demuxer_iterate(&fmt_iter))) {
355 11700 const FFInputFormat *fmt2 = ffifmt(fmt);
356
2/2
✓ Branch 0 taken 933 times.
✓ Branch 1 taken 10767 times.
11700 if (fmt2->read_header != ff_img_read_header ||
357
2/2
✓ Branch 0 taken 899 times.
✓ Branch 1 taken 34 times.
933 !fmt2->read_probe ||
358
2/2
✓ Branch 0 taken 865 times.
✓ Branch 1 taken 34 times.
899 (fmt->flags & AVFMT_NOFILE) ||
359
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 865 times.
865 !fmt2->raw_codec_id)
360 10835 continue;
361
2/2
✓ Branch 1 taken 21 times.
✓ Branch 2 taken 844 times.
865 if (fmt2->read_probe(&pd) > 0) {
362 21 st->codecpar->codec_id = fmt2->raw_codec_id;
363 21 break;
364 }
365 }
366
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 34 times.
34 if (s1->flags & AVFMT_FLAG_CUSTOM_IO) {
367 avio_seek(s1->pb, 0, SEEK_SET);
368 av_freep(&probe_buffer);
369 } else
370 34 ffio_rewind_with_probe_data(s1->pb, &probe_buffer, probe_buffer_size);
371 }
372
2/2
✓ Branch 0 taken 90 times.
✓ Branch 1 taken 21 times.
111 if (st->codecpar->codec_id == AV_CODEC_ID_NONE)
373 90 st->codecpar->codec_id = ff_guess_image2_codec(s->path);
374
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 111 times.
111 if (st->codecpar->codec_id == AV_CODEC_ID_LJPEG)
375 st->codecpar->codec_id = AV_CODEC_ID_MJPEG;
376
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 111 times.
111 if (st->codecpar->codec_id == AV_CODEC_ID_ALIAS_PIX) // we cannot distingiush this from BRENDER_PIX
377 st->codecpar->codec_id = AV_CODEC_ID_NONE;
378 }
379
3/4
✓ Branch 0 taken 2997 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✓ Branch 3 taken 2988 times.
2997 if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
380 pix_fmt != AV_PIX_FMT_NONE)
381 9 st->codecpar->format = pix_fmt;
382
383 2997 return 0;
384 }
385
386 /**
387 * Add this frame's source path and basename to packet's sidedata
388 * as a dictionary, so it can be used by filters like 'drawtext'.
389 */
390 static int add_filename_as_pkt_side_data(char *filename, AVPacket *pkt) {
391 AVDictionary *d = NULL;
392 char *packed_metadata = NULL;
393 size_t metadata_len;
394 int ret;
395
396 av_dict_set(&d, "lavf.image2dec.source_path", filename, 0);
397 av_dict_set(&d, "lavf.image2dec.source_basename", av_basename(filename), 0);
398
399 packed_metadata = av_packet_pack_dictionary(d, &metadata_len);
400 av_dict_free(&d);
401 if (!packed_metadata)
402 return AVERROR(ENOMEM);
403 ret = av_packet_add_side_data(pkt, AV_PKT_DATA_STRINGS_METADATA,
404 packed_metadata, metadata_len);
405 if (ret < 0) {
406 av_freep(&packed_metadata);
407 return ret;
408 }
409 return 0;
410 }
411
412 103435 int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt)
413 {
414 103435 VideoDemuxData *s = s1->priv_data;
415 char filename_bytes[1024];
416 103435 char *filename = filename_bytes;
417 int i, res;
418 103435 int size[3] = { 0 }, ret[3] = { 0 };
419 103435 AVIOContext *f[3] = { NULL };
420 103435 AVCodecParameters *par = s1->streams[0]->codecpar;
421
422
2/2
✓ Branch 0 taken 89150 times.
✓ Branch 1 taken 14285 times.
103435 if (!s->is_pipe) {
423 /* loop over input */
424
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 89150 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
89150 if (s->loop && s->img_number > s->img_last) {
425 s->img_number = s->img_first;
426 }
427
2/2
✓ Branch 0 taken 225 times.
✓ Branch 1 taken 88925 times.
89150 if (s->img_number > s->img_last)
428 225 return AVERROR_EOF;
429
2/2
✓ Branch 0 taken 25 times.
✓ Branch 1 taken 88900 times.
88925 if (s->pattern_type == PT_NONE) {
430 25 av_strlcpy(filename_bytes, s->path, sizeof(filename_bytes));
431
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 88900 times.
88900 } else if (s->use_glob) {
432 #if HAVE_GLOB
433 filename = s->globstate.gl_pathv[s->img_number];
434 #endif
435 } else {
436
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 88896 times.
88900 if (av_get_frame_filename(filename_bytes, sizeof(filename_bytes),
437 88900 s->path,
438
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 s->img_number) < 0 && s->img_number > 1)
439 return AVERROR(EIO);
440 }
441
1/2
✓ Branch 0 taken 88925 times.
✗ Branch 1 not taken.
88925 for (i = 0; i < 3; i++) {
442
2/2
✓ Branch 0 taken 25 times.
✓ Branch 1 taken 88900 times.
88925 if (s1->pb &&
443
1/2
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
25 !strcmp(filename_bytes, s->path) &&
444
1/2
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
25 !s->loop &&
445
1/2
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
25 !s->split_planes) {
446 25 f[i] = s1->pb;
447
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 88900 times.
88900 } else if (s1->io_open(s1, &f[i], filename, AVIO_FLAG_READ, NULL) < 0) {
448 if (i >= 1)
449 break;
450 av_log(s1, AV_LOG_ERROR, "Could not open file : %s\n",
451 filename);
452 return AVERROR(EIO);
453 }
454 88925 size[i] = avio_size(f[i]);
455
456
1/2
✓ Branch 0 taken 88925 times.
✗ Branch 1 not taken.
88925 if (!s->split_planes)
457 88925 break;
458 filename[strlen(filename) - 1] = 'U' + i;
459 }
460
461
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 88925 times.
88925 if (par->codec_id == AV_CODEC_ID_NONE) {
462 AVProbeData pd = { 0 };
463 const FFInputFormat *ifmt;
464 uint8_t header[PROBE_BUF_MIN + AVPROBE_PADDING_SIZE];
465 int ret;
466 int score = 0;
467
468 ret = avio_read(f[0], header, PROBE_BUF_MIN);
469 if (ret < 0)
470 return ret;
471 memset(header + ret, 0, sizeof(header) - ret);
472 avio_skip(f[0], -ret);
473 pd.buf = header;
474 pd.buf_size = ret;
475 pd.filename = filename;
476
477 ifmt = ffifmt(av_probe_input_format3(&pd, 1, &score));
478 if (ifmt && ifmt->read_packet == ff_img_read_packet && ifmt->raw_codec_id)
479 par->codec_id = ifmt->raw_codec_id;
480 }
481
482
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 88925 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
88925 if (par->codec_id == AV_CODEC_ID_RAWVIDEO && !par->width)
483 infer_size(&par->width, &par->height, size[0]);
484 } else {
485 14285 f[0] = s1->pb;
486
3/6
✓ Branch 1 taken 411 times.
✓ Branch 2 taken 13874 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 411 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
14285 if (avio_feof(f[0]) && s->loop && s->is_pipe)
487 avio_seek(f[0], 0, SEEK_SET);
488
2/2
✓ Branch 1 taken 411 times.
✓ Branch 2 taken 13874 times.
14285 if (avio_feof(f[0]))
489 411 return AVERROR_EOF;
490
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 13874 times.
13874 if (s->frame_size > 0) {
491 size[0] = s->frame_size;
492
2/2
✓ Branch 1 taken 375 times.
✓ Branch 2 taken 13499 times.
13874 } else if (!ffstream(s1->streams[0])->parser) {
493 375 size[0] = avio_size(s1->pb);
494 } else {
495 13499 size[0] = 4096;
496 }
497 }
498
499 102799 res = av_new_packet(pkt, size[0] + size[1] + size[2]);
500
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 102799 times.
102799 if (res < 0) {
501 goto fail;
502 }
503 102799 pkt->stream_index = 0;
504 102799 pkt->flags |= AV_PKT_FLAG_KEY;
505
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 102799 times.
102799 if (s->ts_from_file) {
506 struct stat img_stat;
507 if (stat(filename, &img_stat)) {
508 res = AVERROR(EIO);
509 goto fail;
510 }
511 pkt->pts = (int64_t)img_stat.st_mtime;
512 #if HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
513 if (s->ts_from_file == 2)
514 pkt->pts = 1000000000*pkt->pts + img_stat.st_mtim.tv_nsec;
515 #endif
516 av_add_index_entry(s1->streams[0], s->img_number, pkt->pts, 0, 0, AVINDEX_KEYFRAME);
517
2/2
✓ Branch 0 taken 88925 times.
✓ Branch 1 taken 13874 times.
102799 } else if (!s->is_pipe) {
518 88925 pkt->pts = s->pts;
519 }
520
521
2/2
✓ Branch 0 taken 13874 times.
✓ Branch 1 taken 88925 times.
102799 if (s->is_pipe)
522 13874 pkt->pos = avio_tell(f[0]);
523
524 /*
525 * export_path_metadata must be explicitly enabled via
526 * command line options for path metadata to be exported
527 * as packet side_data.
528 */
529
3/4
✓ Branch 0 taken 88925 times.
✓ Branch 1 taken 13874 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 88925 times.
102799 if (!s->is_pipe && s->export_path_metadata == 1) {
530 res = add_filename_as_pkt_side_data(filename, pkt);
531 if (res < 0)
532 goto fail;
533 }
534
535 102799 pkt->size = 0;
536
2/2
✓ Branch 0 taken 308397 times.
✓ Branch 1 taken 102799 times.
411196 for (i = 0; i < 3; i++) {
537
2/2
✓ Branch 0 taken 102799 times.
✓ Branch 1 taken 205598 times.
308397 if (f[i]) {
538 102799 ret[i] = avio_read(f[i], pkt->data + pkt->size, size[i]);
539
1/6
✗ Branch 0 not taken.
✓ Branch 1 taken 102799 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
102799 if (s->loop && s->is_pipe && ret[i] == AVERROR_EOF) {
540 if (avio_seek(f[i], 0, SEEK_SET) >= 0) {
541 pkt->pos = 0;
542 ret[i] = avio_read(f[i], pkt->data + pkt->size, size[i]);
543 }
544 }
545
4/4
✓ Branch 0 taken 88925 times.
✓ Branch 1 taken 13874 times.
✓ Branch 2 taken 88900 times.
✓ Branch 3 taken 25 times.
102799 if (!s->is_pipe && f[i] != s1->pb)
546 88900 ff_format_io_close(s1, &f[i]);
547
2/2
✓ Branch 0 taken 102616 times.
✓ Branch 1 taken 183 times.
102799 if (ret[i] > 0)
548 102616 pkt->size += ret[i];
549 }
550 }
551
552
4/6
✓ Branch 0 taken 102616 times.
✓ Branch 1 taken 183 times.
✓ Branch 2 taken 102616 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 102616 times.
102799 if (ret[0] <= 0 || ret[1] < 0 || ret[2] < 0) {
553
1/2
✓ Branch 0 taken 183 times.
✗ Branch 1 not taken.
183 if (ret[0] < 0) {
554 183 res = ret[0];
555 } else if (ret[1] < 0) {
556 res = ret[1];
557 } else if (ret[2] < 0) {
558 res = ret[2];
559 } else {
560 res = AVERROR_EOF;
561 }
562 183 goto fail;
563 } else {
564 102616 s->img_count++;
565 102616 s->img_number++;
566 102616 s->pts++;
567 102616 return 0;
568 }
569
570 183 fail:
571
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 183 times.
183 if (!s->is_pipe) {
572 for (i = 0; i < 3; i++) {
573 if (f[i] != s1->pb)
574 ff_format_io_close(s1, &f[i]);
575 }
576 }
577 183 return res;
578 }
579
580 2716 static int img_read_close(struct AVFormatContext* s1)
581 {
582 #if HAVE_GLOB
583 2716 VideoDemuxData *s = s1->priv_data;
584
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2716 times.
2716 if (s->use_glob) {
585 globfree(&s->globstate);
586 }
587 #endif
588 2716 return 0;
589 }
590
591 208 static int img_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
592 {
593 208 VideoDemuxData *s1 = s->priv_data;
594 208 AVStream *st = s->streams[0];
595
596
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 208 times.
208 if (s1->ts_from_file) {
597 int index = av_index_search_timestamp(st, timestamp, flags);
598 if(index < 0)
599 return -1;
600 s1->img_number = ffstream(st)->index_entries[index].pos;
601 return 0;
602 }
603
604
5/6
✓ Branch 0 taken 144 times.
✓ Branch 1 taken 64 times.
✓ Branch 2 taken 144 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 120 times.
✓ Branch 5 taken 24 times.
208 if (timestamp < 0 || !s1->loop && timestamp > s1->img_last - s1->img_first)
605 184 return -1;
606 24 s1->img_number = timestamp%(s1->img_last - s1->img_first + 1) + s1->img_first;
607 24 s1->pts = timestamp;
608 24 return 0;
609 }
610
611 #define OFFSET(x) offsetof(VideoDemuxData, x)
612 #define DEC AV_OPT_FLAG_DECODING_PARAM
613 #define COMMON_OPTIONS \
614 { "framerate", "set the video framerate", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, DEC }, \
615 { "pixel_format", "set video pixel format", OFFSET(pixel_format), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, \
616 { "video_size", "set video size", OFFSET(width), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, DEC }, \
617 { "loop", "force loop over input file sequence", OFFSET(loop), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, DEC }, \
618 { NULL },
619
620 #if CONFIG_IMAGE2_DEMUXER
621 const AVOption ff_img_options[] = {
622 { "pattern_type", "set pattern type", OFFSET(pattern_type), AV_OPT_TYPE_INT, {.i64=PT_DEFAULT}, 0, INT_MAX, DEC, .unit = "pattern_type"},
623 { "glob_sequence","select glob/sequence pattern type", 0, AV_OPT_TYPE_CONST, {.i64=PT_GLOB_SEQUENCE}, INT_MIN, INT_MAX, DEC, .unit = "pattern_type" },
624 { "glob", "select glob pattern type", 0, AV_OPT_TYPE_CONST, {.i64=PT_GLOB }, INT_MIN, INT_MAX, DEC, .unit = "pattern_type" },
625 { "sequence", "select sequence pattern type", 0, AV_OPT_TYPE_CONST, {.i64=PT_SEQUENCE }, INT_MIN, INT_MAX, DEC, .unit = "pattern_type" },
626 { "none", "disable pattern matching", 0, AV_OPT_TYPE_CONST, {.i64=PT_NONE }, INT_MIN, INT_MAX, DEC, .unit = "pattern_type" },
627 { "start_number", "set first number in the sequence", OFFSET(start_number), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, DEC },
628 { "start_number_range", "set range for looking at the first sequence number", OFFSET(start_number_range), AV_OPT_TYPE_INT, {.i64 = 5}, 1, INT_MAX, DEC },
629 { "ts_from_file", "set frame timestamp from file's one", OFFSET(ts_from_file), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 2, DEC, .unit = "ts_type" },
630 { "none", "none", 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, 0, 2, DEC, .unit = "ts_type" },
631 { "sec", "second precision", 0, AV_OPT_TYPE_CONST, {.i64 = 1 }, 0, 2, DEC, .unit = "ts_type" },
632 { "ns", "nano second precision", 0, AV_OPT_TYPE_CONST, {.i64 = 2 }, 0, 2, DEC, .unit = "ts_type" },
633 { "export_path_metadata", "enable metadata containing input path information", OFFSET(export_path_metadata), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, DEC }, \
634 COMMON_OPTIONS
635 };
636
637 static const AVClass img2_class = {
638 .class_name = "image2 demuxer",
639 .item_name = av_default_item_name,
640 .option = ff_img_options,
641 .version = LIBAVUTIL_VERSION_INT,
642 };
643 const FFInputFormat ff_image2_demuxer = {
644 .p.name = "image2",
645 .p.long_name = NULL_IF_CONFIG_SMALL("image2 sequence"),
646 .p.flags = AVFMT_NOFILE,
647 .p.priv_class = &img2_class,
648 .priv_data_size = sizeof(VideoDemuxData),
649 .read_probe = img_read_probe,
650 .read_header = ff_img_read_header,
651 .read_packet = ff_img_read_packet,
652 .read_close = img_read_close,
653 .read_seek = img_read_seek,
654 };
655 #endif
656
657 static const AVOption img2pipe_options[] = {
658 { "frame_size", "force frame size in bytes", OFFSET(frame_size), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, DEC },
659 COMMON_OPTIONS
660 };
661 static const AVClass imagepipe_class = {
662 .class_name = "imagepipe demuxer",
663 .item_name = av_default_item_name,
664 .option = img2pipe_options,
665 .version = LIBAVUTIL_VERSION_INT,
666 };
667
668 #if CONFIG_IMAGE2PIPE_DEMUXER
669 const FFInputFormat ff_image2pipe_demuxer = {
670 .p.name = "image2pipe",
671 .p.long_name = NULL_IF_CONFIG_SMALL("piped image2 sequence"),
672 .p.priv_class = &imagepipe_class,
673 .priv_data_size = sizeof(VideoDemuxData),
674 .read_header = ff_img_read_header,
675 .read_packet = ff_img_read_packet,
676 };
677 #endif
678
679 7159 static int bmp_probe(const AVProbeData *p)
680 {
681 7159 const uint8_t *b = p->buf;
682 int ihsize;
683
684
2/2
✓ Branch 0 taken 7144 times.
✓ Branch 1 taken 15 times.
7159 if (AV_RB16(b) != 0x424d)
685 7144 return 0;
686
687 15 ihsize = AV_RL32(b+14);
688
2/4
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 15 times.
15 if (ihsize < 12 || ihsize > 255)
689 return 0;
690
691
1/2
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
15 if (!AV_RN32(b + 6)) {
692 15 return AVPROBE_SCORE_EXTENSION + 1;
693 }
694 return AVPROBE_SCORE_EXTENSION / 4;
695 }
696
697 7158 static int cri_probe(const AVProbeData *p)
698 {
699 7158 const uint8_t *b = p->buf;
700
701
2/2
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 7148 times.
7158 if ( AV_RL32(b) == 1
702
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
10 && AV_RL32(b + 4) == 4
703 && AV_RN32(b + 8) == AV_RN32("DVCC"))
704 return AVPROBE_SCORE_MAX - 1;
705 7158 return 0;
706 }
707
708 7158 static int dds_probe(const AVProbeData *p)
709 {
710 7158 const uint8_t *b = p->buf;
711
712
2/2
✓ Branch 0 taken 48 times.
✓ Branch 1 taken 7110 times.
7158 if ( AV_RB64(b) == 0x444453207c000000
713
1/2
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
48 && AV_RL32(b + 8)
714
1/2
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
48 && AV_RL32(b + 12))
715 48 return AVPROBE_SCORE_MAX - 1;
716 7110 return 0;
717 }
718
719 7158 static int dpx_probe(const AVProbeData *p)
720 {
721 7158 const uint8_t *b = p->buf;
722 int w, h;
723 7158 int is_big = (AV_RN32(b) == AV_RN32("SDPX"));
724
725
2/2
✓ Branch 0 taken 105 times.
✓ Branch 1 taken 7053 times.
7158 if (p->buf_size < 0x304+8)
726 105 return 0;
727
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 7052 times.
7053 w = is_big ? AV_RB32(p->buf + 0x304) : AV_RL32(p->buf + 0x304);
728
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 7052 times.
7053 h = is_big ? AV_RB32(p->buf + 0x308) : AV_RL32(p->buf + 0x308);
729
4/4
✓ Branch 0 taken 3304 times.
✓ Branch 1 taken 3749 times.
✓ Branch 2 taken 692 times.
✓ Branch 3 taken 2612 times.
7053 if (w <= 0 || h <= 0)
730 4441 return 0;
731
732
4/4
✓ Branch 0 taken 2611 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 2609 times.
2612 if (is_big || AV_RN32(b) == AV_RN32("XPDS"))
733 3 return AVPROBE_SCORE_EXTENSION + 1;
734 2609 return 0;
735 }
736
737 7157 static int exr_probe(const AVProbeData *p)
738 {
739 7157 const uint8_t *b = p->buf;
740
741
2/2
✓ Branch 0 taken 74 times.
✓ Branch 1 taken 7083 times.
7157 if (AV_RL32(b) == 20000630)
742 74 return AVPROBE_SCORE_EXTENSION + 1;
743 7083 return 0;
744 }
745
746 7157 static int j2k_probe(const AVProbeData *p)
747 {
748 7157 const uint8_t *b = p->buf;
749
750
1/2
✓ Branch 0 taken 7157 times.
✗ Branch 1 not taken.
7157 if (AV_RB64(b) == 0x0000000c6a502020 ||
751
2/2
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 7143 times.
7157 AV_RB32(b) == 0xff4fff51)
752 14 return AVPROBE_SCORE_EXTENSION + 1;
753 7143 return 0;
754 }
755
756 7157 static int jpeg_probe(const AVProbeData *p)
757 {
758 7157 const uint8_t *b = p->buf;
759 7157 int i, state = SOI, got_header = 0;
760
761
2/2
✓ Branch 0 taken 30 times.
✓ Branch 1 taken 7127 times.
7157 if (AV_RB16(b) != 0xFFD8 ||
762
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 26 times.
30 AV_RB32(b) == 0xFFD8FFF7)
763 7131 return 0;
764
765 26 b += 2;
766
2/2
✓ Branch 0 taken 27795 times.
✓ Branch 1 taken 26 times.
27821 for (i = 0; i < p->buf_size - 3; i++) {
767 int c;
768
2/2
✓ Branch 0 taken 27450 times.
✓ Branch 1 taken 345 times.
27795 if (b[i] != 0xFF)
769 27450 continue;
770 345 c = b[i + 1];
771
7/8
✗ Branch 0 not taken.
✓ Branch 1 taken 19 times.
✓ Branch 2 taken 114 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 39 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 20 times.
✓ Branch 7 taken 150 times.
345 switch (c) {
772 case SOI:
773 return 0;
774 19 case SOF0:
775 case SOF1:
776 case SOF2:
777 case SOF3:
778 case SOF5:
779 case SOF6:
780 case SOF7:
781 19 i += AV_RB16(&b[i + 2]) + 1;
782
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 19 times.
19 if (state != SOI)
783 return 0;
784 19 state = SOF0;
785 19 break;
786 114 case SOS:
787 114 i += AV_RB16(&b[i + 2]) + 1;
788
3/4
✓ Branch 0 taken 95 times.
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 95 times.
114 if (state != SOF0 && state != SOS)
789 return 0;
790 114 state = SOS;
791 114 break;
792 1 case EOI:
793
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 if (state != SOS)
794 return 0;
795 1 state = EOI;
796 1 break;
797 39 case DQT:
798 case APP0:
799
2/2
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 23 times.
39 if (AV_RL32(&b[i + 4]) == MKTAG('J','F','I','F'))
800 16 got_header = 1;
801 case APP1:
802
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 39 times.
41 if (AV_RL32(&b[i + 4]) == MKTAG('E','x','i','f'))
803 2 got_header = 1;
804 case APP2:
805 case APP3:
806 case APP4:
807 case APP5:
808 case APP6:
809 case APP7:
810 case APP8:
811 case APP9:
812 case APP10:
813 case APP11:
814 case APP12:
815 case APP13:
816 case APP14:
817 case APP15:
818 case COM:
819 61 i += AV_RB16(&b[i + 2]) + 1;
820 61 break;
821 150 default:
822
3/4
✓ Branch 0 taken 98 times.
✓ Branch 1 taken 52 times.
✓ Branch 2 taken 98 times.
✗ Branch 3 not taken.
150 if ( (c > TEM && c < SOF0)
823
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 150 times.
150 || c == JPG)
824 return 0;
825 }
826 }
827
828
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 25 times.
26 if (state == EOI)
829 1 return AVPROBE_SCORE_EXTENSION + 1;
830
2/2
✓ Branch 0 taken 18 times.
✓ Branch 1 taken 7 times.
25 if (state == SOS)
831 18 return AVPROBE_SCORE_EXTENSION / 2 + got_header;
832 7 return AVPROBE_SCORE_EXTENSION / 8 + 1;
833 }
834
835 7147 static int jpegls_probe(const AVProbeData *p)
836 {
837 7147 const uint8_t *b = p->buf;
838
839
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 7143 times.
7147 if (AV_RB32(b) == 0xffd8fff7)
840 4 return AVPROBE_SCORE_EXTENSION + 1;
841 7143 return 0;
842 }
843
844 7147 static int jpegxl_probe(const AVProbeData *p)
845 {
846 7147 const uint8_t *b = p->buf;
847
848 /* ISOBMFF-based container */
849 /* 0x4a584c20 == "JXL " */
850
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 7144 times.
7147 if (AV_RL64(b) == FF_JPEGXL_CONTAINER_SIGNATURE_LE)
851 3 return AVPROBE_SCORE_EXTENSION + 1;
852 /* Raw codestreams all start with 0xff0a */
853
2/2
✓ Branch 0 taken 7141 times.
✓ Branch 1 taken 3 times.
7144 if (AV_RL16(b) != FF_JPEGXL_CODESTREAM_SIGNATURE_LE)
854 7141 return 0;
855 #if CONFIG_IMAGE_JPEGXL_PIPE_DEMUXER
856
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
3 if (ff_jpegxl_parse_codestream_header(p->buf, p->buf_size, NULL, 5) >= 0)
857 3 return AVPROBE_SCORE_MAX - 2;
858 #endif
859 return 0;
860 }
861
862 7146 static int pcx_probe(const AVProbeData *p)
863 {
864 7146 const uint8_t *b = p->buf;
865
866
2/2
✓ Branch 0 taken 7140 times.
✓ Branch 1 taken 6 times.
7146 if ( p->buf_size < 128
867
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7140 times.
7140 || b[0] != 10
868 || b[1] > 5
869 || b[2] > 1
870 || av_popcount(b[3]) != 1 || b[3] > 8
871 || AV_RL16(&b[4]) > AV_RL16(&b[8])
872 || AV_RL16(&b[6]) > AV_RL16(&b[10])
873 || b[64])
874 7146 return 0;
875 b += 73;
876 while (++b < p->buf + 128)
877 if (*b)
878 return AVPROBE_SCORE_EXTENSION / 4;
879
880 return AVPROBE_SCORE_EXTENSION + 1;
881 }
882
883 7142 static int qdraw_probe(const AVProbeData *p)
884 {
885 7142 const uint8_t *b = p->buf;
886
887
2/2
✓ Branch 0 taken 7050 times.
✓ Branch 1 taken 92 times.
7142 if ( p->buf_size >= 528
888
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7050 times.
7050 && (AV_RB64(b + 520) & 0xFFFFFFFFFFFF) == 0x001102ff0c00
889 && AV_RB16(b + 520)
890 && AV_RB16(b + 518))
891 return AVPROBE_SCORE_MAX * 3 / 4;
892
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 7140 times.
7142 if ( (AV_RB64(b + 8) & 0xFFFFFFFFFFFF) == 0x001102ff0c00
893
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 && AV_RB16(b + 8)
894
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 && AV_RB16(b + 6))
895 2 return AVPROBE_SCORE_EXTENSION / 4;
896 7140 return 0;
897 }
898
899 7145 static int pictor_probe(const AVProbeData *p)
900 {
901 7145 const uint8_t *b = p->buf;
902
903
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 7143 times.
7145 if (AV_RL16(b) == 0x1234)
904 2 return AVPROBE_SCORE_EXTENSION / 4;
905 7143 return 0;
906 }
907
908 7144 static int png_probe(const AVProbeData *p)
909 {
910 7144 const uint8_t *b = p->buf;
911
912
2/2
✓ Branch 0 taken 46 times.
✓ Branch 1 taken 7098 times.
7144 if (AV_RB64(b) == 0x89504e470d0a1a0a)
913 46 return AVPROBE_SCORE_MAX - 1;
914 7098 return 0;
915 }
916
917 7142 static int psd_probe(const AVProbeData *p)
918 {
919 7142 const uint8_t *b = p->buf;
920 7142 int ret = 0;
921 uint16_t color_mode;
922
923
2/2
✓ Branch 0 taken 15 times.
✓ Branch 1 taken 7127 times.
7142 if (AV_RL32(b) == MKTAG('8','B','P','S')) {
924 15 ret += 1;
925 } else {
926 7127 return 0;
927 }
928
929
2/4
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
✗ Branch 3 not taken.
15 if ((b[4] == 0) && (b[5] == 1)) {/* version 1 is PSD, version 2 is PSB */
930 15 ret += 1;
931 } else {
932 return 0;
933 }
934
935
2/4
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
✗ Branch 3 not taken.
15 if ((AV_RL32(b+6) == 0) && (AV_RL16(b+10) == 0))/* reserved must be 0 */
936 15 ret += 1;
937
938 15 color_mode = AV_RB16(b+24);
939
3/6
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 15 times.
✗ Branch 5 not taken.
15 if ((color_mode <= 9) && (color_mode != 5) && (color_mode != 6))
940 15 ret += 1;
941
942 15 return AVPROBE_SCORE_EXTENSION + ret;
943 }
944
945 7140 static int sgi_probe(const AVProbeData *p)
946 {
947 7140 const uint8_t *b = p->buf;
948
949
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 7128 times.
7140 if (AV_RB16(b) == 474 &&
950
1/2
✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
12 (b[2] & ~1) == 0 &&
951
2/4
✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
12 (b[3] & ~3) == 0 && b[3] &&
952
2/4
✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
12 (AV_RB16(b + 4) & ~7) == 0 && AV_RB16(b + 4))
953 12 return AVPROBE_SCORE_EXTENSION + 1;
954 7128 return 0;
955 }
956
957 7140 static int sunrast_probe(const AVProbeData *p)
958 {
959 7140 const uint8_t *b = p->buf;
960
961
2/2
✓ Branch 0 taken 7 times.
✓ Branch 1 taken 7133 times.
7140 if (AV_RB32(b) == 0x59a66a95)
962 7 return AVPROBE_SCORE_EXTENSION + 1;
963 7133 return 0;
964 }
965
966 7140 static int svg_probe(const AVProbeData *p)
967 {
968 7140 const uint8_t *b = p->buf;
969 7140 const uint8_t *end = p->buf + p->buf_size;
970
3/4
✓ Branch 0 taken 7218 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 78 times.
✓ Branch 3 taken 7140 times.
7218 while (b < end && av_isspace(*b))
971 78 b++;
972
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7140 times.
7140 if (b >= end - 5)
973 return 0;
974
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7140 times.
7140 if (!memcmp(b, "<svg", 4))
975 return AVPROBE_SCORE_EXTENSION + 1;
976
2/4
✓ Branch 0 taken 7140 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7140 times.
✗ Branch 3 not taken.
7140 if (memcmp(p->buf, "<?xml", 5) && memcmp(b, "<!--", 4))
977 7140 return 0;
978 while (b < end) {
979 int inc = ff_subtitles_next_line(b);
980 if (!inc)
981 break;
982 b += inc;
983 if (b >= end - 4)
984 return 0;
985 if (!memcmp(b, "<svg", 4))
986 return AVPROBE_SCORE_EXTENSION + 1;
987 }
988 return 0;
989 }
990
991 7140 static int tiff_probe(const AVProbeData *p)
992 {
993 7140 const uint8_t *b = p->buf;
994
995
2/2
✓ Branch 0 taken 7133 times.
✓ Branch 1 taken 7 times.
7140 if (AV_RB32(b) == 0x49492a00 ||
996
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 7131 times.
7133 AV_RB32(b) == 0x4D4D002a)
997 9 return AVPROBE_SCORE_EXTENSION + 1;
998 7131 return 0;
999 }
1000
1001 7140 static int webp_probe(const AVProbeData *p)
1002 {
1003 7140 const uint8_t *b = p->buf;
1004
1005
2/2
✓ Branch 0 taken 949 times.
✓ Branch 1 taken 6191 times.
7140 if (AV_RB32(b) == 0x52494646 &&
1006
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 941 times.
949 AV_RB32(b + 8) == 0x57454250)
1007 8 return AVPROBE_SCORE_MAX - 1;
1008 7132 return 0;
1009 }
1010
1011 92893 static int pnm_magic_check(const AVProbeData *p, int magic)
1012 {
1013 92893 const uint8_t *b = p->buf;
1014
1015
4/4
✓ Branch 0 taken 246 times.
✓ Branch 1 taken 92647 times.
✓ Branch 2 taken 9 times.
✓ Branch 3 taken 237 times.
92893 return b[0] == 'P' && b[1] == magic + '0';
1016 }
1017
1018 9 static inline int pnm_probe(const AVProbeData *p)
1019 {
1020 9 const uint8_t *b = p->buf;
1021
1022
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
9 while (b[2] == '\r')
1023 b++;
1024
5/8
✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 8 times.
✗ Branch 7 not taken.
9 if (b[2] == '\n' && (b[3] == '#' || (b[3] >= '0' && b[3] <= '9')))
1025 9 return AVPROBE_SCORE_EXTENSION + 2;
1026 return 0;
1027 }
1028
1029 7147 static int pbm_probe(const AVProbeData *p)
1030 {
1031
3/4
✓ Branch 1 taken 7147 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 7145 times.
7147 return pnm_magic_check(p, 1) || pnm_magic_check(p, 4) ? pnm_probe(p) : 0;
1032 }
1033
1034 7146 static int pfm_probe(const AVProbeData *p)
1035 {
1036
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 7146 times.
14292 return pnm_magic_check(p, 'F' - '0') ||
1037
1/2
✓ Branch 0 taken 7146 times.
✗ Branch 1 not taken.
14292 pnm_magic_check(p, 'f' - '0') ? pnm_probe(p) : 0;
1038 }
1039
1040 7145 static int phm_probe(const AVProbeData *p)
1041 {
1042
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 7145 times.
14290 return pnm_magic_check(p, 'H' - '0') ||
1043
1/2
✓ Branch 0 taken 7145 times.
✗ Branch 1 not taken.
14290 pnm_magic_check(p, 'h' - '0') ? pnm_probe(p) : 0;
1044 }
1045
1046 14292 static inline int pgmx_probe(const AVProbeData *p)
1047 {
1048
3/4
✓ Branch 1 taken 14292 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 14288 times.
14292 return pnm_magic_check(p, 2) || pnm_magic_check(p, 5) ? pnm_probe(p) : 0;
1049 }
1050
1051 7146 static int pgm_probe(const AVProbeData *p)
1052 {
1053 7146 int ret = pgmx_probe(p);
1054
3/4
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 7144 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
7146 return ret && !av_match_ext(p->filename, "pgmyuv") ? ret : 0;
1055 }
1056
1057 7146 static int pgmyuv_probe(const AVProbeData *p) // custom FFmpeg format recognized by file extension
1058 {
1059 7146 int ret = pgmx_probe(p);
1060
3/4
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 7144 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
7146 return ret && av_match_ext(p->filename, "pgmyuv") ? ret : 0;
1061 }
1062
1063 7145 static int pgx_probe(const AVProbeData *p)
1064 {
1065 7145 const uint8_t *b = p->buf;
1066
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7145 times.
7145 if (!memcmp(b, "PG ML ", 6))
1067 return AVPROBE_SCORE_EXTENSION + 1;
1068 7145 return 0;
1069 }
1070
1071 7143 static int ppm_probe(const AVProbeData *p)
1072 {
1073
3/4
✓ Branch 1 taken 7143 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✓ Branch 5 taken 7140 times.
7143 return pnm_magic_check(p, 3) || pnm_magic_check(p, 6) ? pnm_probe(p) : 0;
1074 }
1075
1076 7147 static int pam_probe(const AVProbeData *p)
1077 {
1078
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 7147 times.
7147 return pnm_magic_check(p, 7) ? pnm_probe(p) : 0;
1079 }
1080
1081 7157 static int hdr_probe(const AVProbeData *p)
1082 {
1083
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7157 times.
7157 if (!memcmp(p->buf, "#?RADIANCE\n", 11))
1084 return AVPROBE_SCORE_MAX;
1085 7157 return 0;
1086 }
1087
1088 7140 static int xbm_probe(const AVProbeData *p)
1089 {
1090
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 7139 times.
7140 if (!memcmp(p->buf, "/* XBM X10 format */", 20))
1091 1 return AVPROBE_SCORE_MAX;
1092
1093
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 7137 times.
7139 if (!memcmp(p->buf, "#define", 7))
1094 2 return AVPROBE_SCORE_MAX - 1;
1095 7137 return 0;
1096 }
1097
1098 7139 static int xpm_probe(const AVProbeData *p)
1099 {
1100 7139 const uint8_t *b = p->buf;
1101
1102
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 7139 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
7139 if (AV_RB64(b) == 0x2f2a2058504d202a && *(b+8) == '/')
1103 return AVPROBE_SCORE_MAX - 1;
1104 7139 return 0;
1105 }
1106
1107 7139 static int xwd_probe(const AVProbeData *p)
1108 {
1109 7139 const uint8_t *b = p->buf;
1110 unsigned width, bpp, bpad, lsize;
1111
1112
2/2
✓ Branch 0 taken 7134 times.
✓ Branch 1 taken 5 times.
7139 if ( p->buf_size < XWD_HEADER_SIZE
1113
2/2
✓ Branch 0 taken 6167 times.
✓ Branch 1 taken 967 times.
7134 || AV_RB32(b ) < XWD_HEADER_SIZE // header size
1114
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 6166 times.
6167 || AV_RB32(b + 4) != XWD_VERSION // version
1115
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 || AV_RB32(b + 8) != XWD_Z_PIXMAP // format
1116
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 || AV_RB32(b + 12) > 32 || !AV_RB32(b + 12) // depth
1117
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 || AV_RB32(b + 16) == 0 // width
1118
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 || AV_RB32(b + 20) == 0 // height
1119
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 || AV_RB32(b + 28) > 1 // byteorder
1120
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 || AV_RB32(b + 32) & ~56 || av_popcount(AV_RB32(b + 32)) != 1 // bitmap unit
1121
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 || AV_RB32(b + 36) > 1 // bitorder
1122
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 || AV_RB32(b + 40) & ~56 || av_popcount(AV_RB32(b + 40)) != 1 // padding
1123
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 || AV_RB32(b + 44) > 32 || !AV_RB32(b + 44) // bpp
1124
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 || AV_RB32(b + 68) > 256) // colours
1125 7138 return 0;
1126
1127 1 width = AV_RB32(b + 16);
1128 1 bpad = AV_RB32(b + 40);
1129 1 bpp = AV_RB32(b + 44);
1130 1 lsize = AV_RB32(b + 48);
1131
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 if (lsize < FFALIGN(width * bpp, bpad) >> 3)
1132 return 0;
1133
1134 1 return AVPROBE_SCORE_MAX / 2 + 1;
1135 }
1136
1137 7157 static int gif_probe(const AVProbeData *p)
1138 {
1139 /* check magick */
1140
3/4
✓ Branch 0 taken 7157 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7142 times.
✓ Branch 3 taken 15 times.
7157 if (memcmp(p->buf, gif87a_sig, 6) && memcmp(p->buf, gif89a_sig, 6))
1141 7142 return 0;
1142
1143 /* width or height contains zero? */
1144
2/4
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 15 times.
15 if (!AV_RL16(&p->buf[6]) || !AV_RL16(&p->buf[8]))
1145 return 0;
1146
1147 15 return AVPROBE_SCORE_MAX - 1;
1148 }
1149
1150 7145 static int photocd_probe(const AVProbeData *p)
1151 {
1152
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7145 times.
7145 if (!memcmp(p->buf, "PCD_OPA", 7))
1153 return AVPROBE_SCORE_MAX - 1;
1154
1155
3/4
✓ Branch 0 taken 3188 times.
✓ Branch 1 taken 3957 times.
✓ Branch 2 taken 3188 times.
✗ Branch 3 not taken.
7145 if (p->buf_size < 0x807 || memcmp(p->buf + 0x800, "PCD_IPI", 7))
1156 7145 return 0;
1157
1158 return AVPROBE_SCORE_MAX - 1;
1159 }
1160
1161 7141 static int qoi_probe(const AVProbeData *p)
1162 {
1163
2/2
✓ Branch 0 taken 7140 times.
✓ Branch 1 taken 1 times.
7141 if (memcmp(p->buf, "qoif", 4))
1164 7140 return 0;
1165
1166
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
1 if (AV_RB32(p->buf + 4) == 0 || AV_RB32(p->buf + 8) == 0)
1167 return 0;
1168
1169
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
1 if (p->buf[12] != 3 && p->buf[12] != 4)
1170 return 0;
1171
1172
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 if (p->buf[13] > 1)
1173 return 0;
1174
1175 1 return AVPROBE_SCORE_MAX - 1;
1176 }
1177
1178 7157 static int gem_probe(const AVProbeData *p)
1179 {
1180 7157 const uint8_t *b = p->buf;
1181
4/4
✓ Branch 0 taken 5781 times.
✓ Branch 1 taken 1376 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 5780 times.
7157 if ( AV_RB16(b ) >= 1 && AV_RB16(b ) <= 3 &&
1182
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
1 AV_RB16(b + 2) >= 8 && AV_RB16(b + 2) <= 779 &&
1183 (AV_RB16(b + 4) > 0 && AV_RB16(b + 4) <= 32) && /* planes */
1184 (AV_RB16(b + 6) > 0 && AV_RB16(b + 6) <= 8) && /* pattern_size */
1185 AV_RB16(b + 8) &&
1186 AV_RB16(b + 10) &&
1187 AV_RB16(b + 12) &&
1188 AV_RB16(b + 14)) {
1189 if (AV_RN32(b + 16) == AV_RN32("STTT") ||
1190 AV_RN32(b + 16) == AV_RN32("TIMG") ||
1191 AV_RN32(b + 16) == AV_RN32("XIMG"))
1192 return AVPROBE_SCORE_EXTENSION + 1;
1193 return AVPROBE_SCORE_EXTENSION / 4;
1194 }
1195 7157 return 0;
1196 }
1197
1198 7140 static int vbn_probe(const AVProbeData *p)
1199 {
1200 7140 const uint8_t *b = p->buf;
1201
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 7136 times.
7140 if (AV_RL32(b ) == VBN_MAGIC &&
1202
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 AV_RL32(b + 4) == VBN_MAJOR &&
1203
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 AV_RL32(b + 8) == VBN_MINOR)
1204 4 return AVPROBE_SCORE_MAX - 1;
1205 7136 return 0;
1206 }
1207
1208 #define IMAGEAUTO_DEMUXER_0(imgname, codecid)
1209 #define IMAGEAUTO_DEMUXER_1(imgname, codecid)\
1210 const FFInputFormat ff_image_ ## imgname ## _pipe_demuxer = {\
1211 .p.name = AV_STRINGIFY(imgname) "_pipe",\
1212 .p.long_name = NULL_IF_CONFIG_SMALL("piped " AV_STRINGIFY(imgname) " sequence"),\
1213 .p.priv_class = &imagepipe_class,\
1214 .p.flags = AVFMT_GENERIC_INDEX,\
1215 .priv_data_size = sizeof(VideoDemuxData),\
1216 .read_probe = imgname ## _probe,\
1217 .read_header = ff_img_read_header,\
1218 .read_packet = ff_img_read_packet,\
1219 .raw_codec_id = codecid,\
1220 };
1221
1222 #define IMAGEAUTO_DEMUXER_2(imgname, codecid, enabled) \
1223 IMAGEAUTO_DEMUXER_ ## enabled(imgname, codecid)
1224 #define IMAGEAUTO_DEMUXER_3(imgname, codecid, config) \
1225 IMAGEAUTO_DEMUXER_2(imgname, codecid, config)
1226 #define IMAGEAUTO_DEMUXER_EXT(imgname, codecid, uppercase_name) \
1227 IMAGEAUTO_DEMUXER_3(imgname, AV_CODEC_ID_ ## codecid, \
1228 CONFIG_IMAGE_ ## uppercase_name ## _PIPE_DEMUXER)
1229 #define IMAGEAUTO_DEMUXER(imgname, codecid) \
1230 IMAGEAUTO_DEMUXER_EXT(imgname, codecid, codecid)
1231
1232 IMAGEAUTO_DEMUXER(bmp, BMP)
1233 IMAGEAUTO_DEMUXER(cri, CRI)
1234 IMAGEAUTO_DEMUXER(dds, DDS)
1235 IMAGEAUTO_DEMUXER(dpx, DPX)
1236 IMAGEAUTO_DEMUXER(exr, EXR)
1237 IMAGEAUTO_DEMUXER(gem, GEM)
1238 IMAGEAUTO_DEMUXER(gif, GIF)
1239 IMAGEAUTO_DEMUXER_EXT(hdr, RADIANCE_HDR, HDR)
1240 IMAGEAUTO_DEMUXER_EXT(j2k, JPEG2000, J2K)
1241 IMAGEAUTO_DEMUXER_EXT(jpeg, MJPEG, JPEG)
1242 IMAGEAUTO_DEMUXER(jpegls, JPEGLS)
1243 IMAGEAUTO_DEMUXER(jpegxl, JPEGXL)
1244 IMAGEAUTO_DEMUXER(pam, PAM)
1245 IMAGEAUTO_DEMUXER(pbm, PBM)
1246 IMAGEAUTO_DEMUXER(pcx, PCX)
1247 IMAGEAUTO_DEMUXER(pfm, PFM)
1248 IMAGEAUTO_DEMUXER(pgm, PGM)
1249 IMAGEAUTO_DEMUXER(pgmyuv, PGMYUV)
1250 IMAGEAUTO_DEMUXER(pgx, PGX)
1251 IMAGEAUTO_DEMUXER(phm, PHM)
1252 IMAGEAUTO_DEMUXER(photocd, PHOTOCD)
1253 IMAGEAUTO_DEMUXER(pictor, PICTOR)
1254 IMAGEAUTO_DEMUXER(png, PNG)
1255 IMAGEAUTO_DEMUXER(ppm, PPM)
1256 IMAGEAUTO_DEMUXER(psd, PSD)
1257 IMAGEAUTO_DEMUXER(qdraw, QDRAW)
1258 IMAGEAUTO_DEMUXER(qoi, QOI)
1259 IMAGEAUTO_DEMUXER(sgi, SGI)
1260 IMAGEAUTO_DEMUXER(sunrast, SUNRAST)
1261 IMAGEAUTO_DEMUXER(svg, SVG)
1262 IMAGEAUTO_DEMUXER(tiff, TIFF)
1263 IMAGEAUTO_DEMUXER(vbn, VBN)
1264 IMAGEAUTO_DEMUXER(webp, WEBP)
1265 IMAGEAUTO_DEMUXER(xbm, XBM)
1266 IMAGEAUTO_DEMUXER(xpm, XPM)
1267 IMAGEAUTO_DEMUXER(xwd, XWD)
1268