FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavformat/img2dec.c
Date: 2026-04-29 21:31:38
Exec Total Coverage
Lines: 478 652 73.3%
Functions: 46 48 95.8%
Branches: 347 592 58.6%

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