FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavformat/img2dec.c
Date: 2024-11-20 23:03:26
Exec Total Coverage
Lines: 469 661 71.0%
Functions: 46 48 95.8%
Branches: 352 616 57.1%

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