FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavformat/img2dec.c
Date: 2022-12-05 03:11:11
Exec Total Coverage
Lines: 454 652 69.6%
Functions: 46 48 95.8%
Branches: 335 600 55.8%

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