FFmpeg
img2dec.c
Go to the documentation of this file.
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/bprint.h"
31 #include "libavutil/log.h"
32 #include "libavutil/mem.h"
33 #include "libavutil/opt.h"
34 #include "libavutil/pixdesc.h"
35 #include "libavutil/intreadwrite.h"
36 #include "libavcodec/gif.h"
37 #include "avformat.h"
38 #include "avio_internal.h"
39 #include "demux.h"
40 #include "internal.h"
41 #include "img2.h"
42 #include "os_support.h"
44 #include "libavcodec/mjpeg.h"
45 #include "libavcodec/vbn.h"
46 #include "libavcodec/xwd.h"
47 #include "subtitles.h"
48 
49 #if HAVE_GLOB
50 /* Locally define as 0 (bitwise-OR no-op) any missing glob options that
51  are non-posix glibc/bsd extensions. */
52 #ifndef GLOB_NOMAGIC
53 #define GLOB_NOMAGIC 0
54 #endif
55 #ifndef GLOB_BRACE
56 #define GLOB_BRACE 0
57 #endif
58 
59 #endif /* HAVE_GLOB */
60 
61 static const int sizes[][2] = {
62  { 640, 480 },
63  { 720, 480 },
64  { 720, 576 },
65  { 352, 288 },
66  { 352, 240 },
67  { 160, 128 },
68  { 512, 384 },
69  { 640, 352 },
70  { 640, 240 },
71 };
72 
73 static int infer_size(int *width_ptr, int *height_ptr, int size)
74 {
75  int i;
76 
77  for (i = 0; i < FF_ARRAY_ELEMS(sizes); i++) {
78  if ((sizes[i][0] * sizes[i][1]) == size) {
79  *width_ptr = sizes[i][0];
80  *height_ptr = sizes[i][1];
81  return 0;
82  }
83  }
84 
85  return -1;
86 }
87 
88 /**
89  * Get index range of image files matched by path.
90  *
91  * @param pfirst_index pointer to index updated with the first number in the range
92  * @param plast_index pointer to index updated with the last number in the range
93  * @param path path which has to be matched by the image files in the range
94  * @param start_index minimum accepted value for the first index in the range
95  * @return -1 if no image file could be found
96  */
97 static int find_image_range(int *pfirst_index, int *plast_index,
98  const char *path, int start_index, int start_index_range)
99 {
100  int range, last_index, range1, first_index, ret;
101  AVBPrint filename;
102 
104  /* find the first image */
105  for (first_index = start_index; first_index < start_index + start_index_range; first_index++) {
106  av_bprint_clear(&filename);
107  ret = ff_bprint_get_frame_filename(&filename, path, first_index, 0);
108  if (ret < 0)
109  goto fail;
110  if (avio_check(filename.str, AVIO_FLAG_READ) > 0)
111  break;
112  }
113  if (first_index == start_index + start_index_range) {
114  ret = AVERROR(EINVAL);
115  goto fail;
116  }
117 
118  /* find the last image */
119  last_index = first_index;
120  for (;;) {
121  range = 0;
122  for (;;) {
123  if (!range)
124  range1 = 1;
125  else
126  range1 = 2 * range;
127  av_bprint_clear(&filename);
128  ret = ff_bprint_get_frame_filename(&filename, path, last_index + range1, 0);
129  if (ret < 0)
130  goto fail;
131  if (avio_check(filename.str, AVIO_FLAG_READ) <= 0)
132  break;
133  range = range1;
134  /* just in case... */
135  if (range >= (1 << 30)) {
136  ret = AVERROR(EINVAL);
137  goto fail;
138  }
139  }
140  /* we are sure than image last_index + range exists */
141  if (!range)
142  break;
143  last_index += range;
144  }
145  *pfirst_index = first_index;
146  *plast_index = last_index;
147  ret = 0;
148 fail:
149  av_bprint_finalize(&filename, NULL);
150  return ret;
151 }
152 
153 static int img_read_probe(const AVProbeData *p)
154 {
155  if (p->filename && ff_guess_image2_codec(p->filename)) {
156  if (av_filename_number_test(p->filename))
157  return AVPROBE_SCORE_MAX;
158  else if (p->filename[strcspn(p->filename, "*?{")]) // probably PT_GLOB
159  return AVPROBE_SCORE_EXTENSION + 2; // score chosen to be a tad above the image pipes
160  else if (p->buf_size == 0)
161  return 0;
162  else if (av_match_ext(p->filename, "raw") || av_match_ext(p->filename, "gif"))
163  return 5;
164  else
166  }
167  return 0;
168 }
169 
171 {
172  VideoDemuxData *s = s1->priv_data;
173  int first_index = 1, last_index = 1;
174  AVStream *st;
176 
178 
179  st = avformat_new_stream(s1, NULL);
180  if (!st) {
181  return AVERROR(ENOMEM);
182  }
183 
184  if (s->pixel_format &&
185  (pix_fmt = av_get_pix_fmt(s->pixel_format)) == AV_PIX_FMT_NONE) {
186  av_log(s1, AV_LOG_ERROR, "No such pixel format: %s.\n",
187  s->pixel_format);
188  return AVERROR(EINVAL);
189  }
190 
191  s->img_number = 0;
192  s->img_count = 0;
193 
194  /* find format */
195  if (s1->iformat->flags & AVFMT_NOFILE)
196  s->is_pipe = 0;
197  else {
198  s->is_pipe = 1;
200  }
201 
202  if (s->ts_from_file == 2) {
203 #if !HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
204  av_log(s1, AV_LOG_ERROR, "POSIX.1-2008 not supported, nanosecond file timestamps unavailable\n");
205  return AVERROR(ENOSYS);
206 #endif
207  avpriv_set_pts_info(st, 64, 1, 1000000000);
208  } else if (s->ts_from_file)
209  avpriv_set_pts_info(st, 64, 1, 1);
210  else {
211  avpriv_set_pts_info(st, 64, s->framerate.den, s->framerate.num);
212  st->avg_frame_rate = st->r_frame_rate = s->framerate;
213  }
214 
215  if (s->width && s->height) {
216  st->codecpar->width = s->width;
217  st->codecpar->height = s->height;
218  }
219 
220  if (!s->is_pipe) {
221  if (s->pattern_type == PT_DEFAULT) {
222  if (s1->pb) {
223  s->pattern_type = PT_NONE;
224  } else
225  s->pattern_type = PT_SEQUENCE;
226  }
227  if (s->pattern_type == PT_SEQUENCE) {
228  if (find_image_range(&first_index, &last_index, s1->url,
229  s->start_number, s->start_number_range) < 0) {
230  if (s1->pb || avio_check(s1->url, AVIO_FLAG_READ) > 0) {
231  // Fallback to normal mode
232  s->pattern_type = PT_NONE;
233  } else {
234  av_log(s1, AV_LOG_ERROR,
235  "Could find no file or sequence with path '%s' and index in the range %d-%d\n",
236  s1->url, s->start_number, s->start_number + s->start_number_range - 1);
237  return AVERROR(ENOENT);
238  }
239  }
240  } else if (s->pattern_type == PT_GLOB) {
241 #if HAVE_GLOB
242  int gerr;
243  gerr = glob(s1->url, GLOB_NOCHECK|GLOB_BRACE|GLOB_NOMAGIC, NULL, &s->globstate);
244  if (gerr != 0) {
245  return AVERROR(ENOENT);
246  }
247  first_index = 0;
248  last_index = s->globstate.gl_pathc - 1;
249  s->use_glob = 1;
250 #else
251  av_log(s1, AV_LOG_ERROR,
252  "Pattern type 'glob' was selected but globbing "
253  "is not supported by this libavformat build\n");
254  return AVERROR(ENOSYS);
255 #endif
256  } else if (s->pattern_type != PT_NONE) {
257  av_log(s1, AV_LOG_ERROR,
258  "Unknown value '%d' for pattern_type option\n", s->pattern_type);
259  return AVERROR(EINVAL);
260  }
261  s->img_first = first_index;
262  s->img_last = last_index;
263  s->img_number = first_index;
264  /* compute duration */
265  if (!s->ts_from_file) {
266  st->start_time = 0;
267  st->duration = last_index - first_index + 1;
268  }
269  }
270 
271  if (s1->video_codec_id) {
273  st->codecpar->codec_id = s1->video_codec_id;
274  } else if (s1->audio_codec_id) {
276  st->codecpar->codec_id = s1->audio_codec_id;
277  } else if (ffifmt(s1->iformat)->raw_codec_id) {
280  } else {
281  const char *str = strrchr(s1->url, '.');
282  s->split_planes = str && !av_strcasecmp(str + 1, "y");
284  if (s1->pb) {
285  int probe_buffer_size = 2048;
286  uint8_t *probe_buffer = av_realloc(NULL, probe_buffer_size + AVPROBE_PADDING_SIZE);
287  const AVInputFormat *fmt = NULL;
288  void *fmt_iter = NULL;
289  AVProbeData pd = { 0 };
290 
291  if (!probe_buffer)
292  return AVERROR(ENOMEM);
293 
294  probe_buffer_size = avio_read(s1->pb, probe_buffer, probe_buffer_size);
295  if (probe_buffer_size < 0) {
296  av_free(probe_buffer);
297  return probe_buffer_size;
298  }
299  memset(probe_buffer + probe_buffer_size, 0, AVPROBE_PADDING_SIZE);
300 
301  pd.buf = probe_buffer;
302  pd.buf_size = probe_buffer_size;
303  pd.filename = s1->url;
304 
305  while ((fmt = av_demuxer_iterate(&fmt_iter))) {
306  const FFInputFormat *fmt2 = ffifmt(fmt);
307  if (fmt2->read_header != ff_img_read_header ||
308  !fmt2->read_probe ||
309  (fmt->flags & AVFMT_NOFILE) ||
310  !fmt2->raw_codec_id)
311  continue;
312  if (fmt2->read_probe(&pd) > 0) {
313  st->codecpar->codec_id = fmt2->raw_codec_id;
314  break;
315  }
316  }
317  if (s1->flags & AVFMT_FLAG_CUSTOM_IO) {
318  avio_seek(s1->pb, 0, SEEK_SET);
319  av_freep(&probe_buffer);
320  } else
321  ffio_rewind_with_probe_data(s1->pb, &probe_buffer, probe_buffer_size);
322  }
323  if (st->codecpar->codec_id == AV_CODEC_ID_NONE)
325  if (st->codecpar->codec_id == AV_CODEC_ID_LJPEG)
327  if (st->codecpar->codec_id == AV_CODEC_ID_ALIAS_PIX) // we cannot distinguish this from BRENDER_PIX
329  }
330  if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
332  st->codecpar->format = pix_fmt;
333 
334  return 0;
335 }
336 
337 /**
338  * Add this frame's source path and basename to packet's sidedata
339  * as a dictionary, so it can be used by filters like 'drawtext'.
340  */
341 static int add_filename_as_pkt_side_data(char *filename, AVPacket *pkt) {
342  AVDictionary *d = NULL;
343  char *packed_metadata = NULL;
344  size_t metadata_len;
345  int ret;
346 
347  av_dict_set(&d, "lavf.image2dec.source_path", filename, 0);
348  av_dict_set(&d, "lavf.image2dec.source_basename", av_basename(filename), 0);
349 
350  packed_metadata = av_packet_pack_dictionary(d, &metadata_len);
351  av_dict_free(&d);
352  if (!packed_metadata)
353  return AVERROR(ENOMEM);
355  packed_metadata, metadata_len);
356  if (ret < 0) {
357  av_freep(&packed_metadata);
358  return ret;
359  }
360  return 0;
361 }
362 
364 {
365  VideoDemuxData *s = s1->priv_data;
366  AVBPrint filename;
367  int i, res;
368  int ret[3] = { 0 };
369  int64_t size[3] = { 0 };
370  int64_t total_size;
371  AVIOContext *f[3] = { NULL };
372  AVCodecParameters *par = s1->streams[0]->codecpar;
373 
375  if (!s->is_pipe) {
376  /* loop over input */
377  if (s->loop && s->img_number > s->img_last) {
378  s->img_number = s->img_first;
379  }
380  if (s->img_number > s->img_last)
381  return AVERROR_EOF;
382  if (s->pattern_type == PT_NONE) {
383  av_bprintf(&filename, "%s", s1->url);
384  } else if (s->use_glob) {
385 #if HAVE_GLOB
386  av_bprintf(&filename, "%s", s->globstate.gl_pathv[s->img_number]);
387 #endif
388  } else {
389  int ret = ff_bprint_get_frame_filename(&filename, s1->url, s->img_number, 0);
390  if (ret < 0) {
391  av_bprint_finalize(&filename, NULL);
392  return ret;
393  }
394  }
395  if (!av_bprint_is_complete(&filename)) {
396  av_bprint_finalize(&filename, NULL);
397  return AVERROR(ENOMEM);
398  }
399  for (i = 0; i < 3; i++) {
400  if (s1->pb &&
401  !strcmp(filename.str, s1->url) &&
402  !s->loop &&
403  !s->split_planes) {
404  f[i] = s1->pb;
405  } else if ((res = s1->io_open(s1, &f[i], filename.str, AVIO_FLAG_READ, NULL)) < 0) {
406  if (i >= 1)
407  break;
408  av_log(s1, AV_LOG_ERROR, "Could not open file : %s\n",
409  filename.str);
410  av_bprint_finalize(&filename, NULL);
411  return res;
412  }
413  size[i] = avio_size(f[i]);
414 
415  if (!s->split_planes)
416  break;
417  filename.str[filename.len - 1] = 'U' + i;
418  }
419  av_bprint_finalize(&filename, NULL);
420 
421  if (par->codec_id == AV_CODEC_ID_NONE) {
422  AVProbeData pd = { 0 };
423  const FFInputFormat *ifmt;
425  int ret;
426  int score = 0;
427 
429  if (ret < 0) {
430  av_bprint_finalize(&filename, NULL);
431  return ret;
432  }
433  memset(header + ret, 0, sizeof(header) - ret);
434  avio_skip(f[0], -ret);
435  pd.buf = header;
436  pd.buf_size = ret;
437  pd.filename = filename.str;
438 
439  ifmt = ffifmt(av_probe_input_format3(&pd, 1, &score));
440  if (ifmt && ifmt->read_packet == ff_img_read_packet && ifmt->raw_codec_id)
441  par->codec_id = ifmt->raw_codec_id;
442  }
443 
444  if (par->codec_id == AV_CODEC_ID_RAWVIDEO && !par->width)
445  infer_size(&par->width, &par->height, size[0]);
446  } else {
447  f[0] = s1->pb;
448  if (avio_feof(f[0]) && s->loop && s->is_pipe)
449  avio_seek(f[0], 0, SEEK_SET);
450  if (avio_feof(f[0]))
451  return AVERROR_EOF;
452  if (s->frame_size > 0) {
453  size[0] = s->frame_size;
454  } else if (!ffstream(s1->streams[0])->parser) {
455  size[0] = avio_size(s1->pb);
456  } else {
457  size[0] = 4096;
458  }
459  }
460 
461  total_size = size[0];
462  if (total_size > INT64_MAX - size[1])
463  return AVERROR_INVALIDDATA;
464  total_size += size[1];
465  if (total_size > INT64_MAX - size[2])
466  return AVERROR_INVALIDDATA;
467  total_size += size[2];
468  if (total_size > INT_MAX)
469  return AVERROR_INVALIDDATA;
470 
471  res = av_new_packet(pkt, total_size);
472  if (res < 0) {
473  goto fail;
474  }
475  pkt->stream_index = 0;
477  if (s->ts_from_file) {
478  struct stat img_stat;
479  av_assert0(!s->is_pipe); // The ts_from_file option is not supported by piped input demuxers
480  if (stat(filename.str, &img_stat)) {
481  res = AVERROR(errno);
482  goto fail;
483  }
484  pkt->pts = (int64_t)img_stat.st_mtime;
485 #if HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
486  if (s->ts_from_file == 2)
487  pkt->pts = 1000000000*pkt->pts + img_stat.st_mtim.tv_nsec;
488 #endif
489  av_add_index_entry(s1->streams[0], s->img_number, pkt->pts, 0, 0, AVINDEX_KEYFRAME);
490  } else if (!s->is_pipe) {
491  pkt->pts = s->pts;
492  }
493 
494  if (s->is_pipe)
495  pkt->pos = avio_tell(f[0]);
496 
497  /*
498  * export_path_metadata must be explicitly enabled via
499  * command line options for path metadata to be exported
500  * as packet side_data.
501  */
502  if (!s->is_pipe && s->export_path_metadata == 1) {
503  res = add_filename_as_pkt_side_data(filename.str, pkt);
504  if (res < 0)
505  goto fail;
506  }
507  av_bprint_finalize(&filename, NULL);
508 
509  pkt->size = 0;
510  for (i = 0; i < 3; i++) {
511  if (f[i]) {
512  ret[i] = avio_read(f[i], pkt->data + pkt->size, size[i]);
513  if (s->loop && s->is_pipe && ret[i] == AVERROR_EOF) {
514  if (avio_seek(f[i], 0, SEEK_SET) >= 0) {
515  pkt->pos = 0;
516  ret[i] = avio_read(f[i], pkt->data + pkt->size, size[i]);
517  }
518  }
519  if (!s->is_pipe && f[i] != s1->pb)
520  ff_format_io_close(s1, &f[i]);
521  if (ret[i] > 0)
522  pkt->size += ret[i];
523  }
524  }
525 
526  if (ret[0] <= 0 || ret[1] < 0 || ret[2] < 0) {
527  if (ret[0] < 0) {
528  res = ret[0];
529  } else if (ret[1] < 0) {
530  res = ret[1];
531  } else if (ret[2] < 0) {
532  res = ret[2];
533  } else {
534  res = AVERROR_EOF;
535  }
536  goto fail;
537  } else {
538  memset(pkt->data + pkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
539  s->img_count++;
540  s->img_number++;
541  s->pts++;
542  return 0;
543  }
544 
545 fail:
546  av_bprint_finalize(&filename, NULL);
547  if (!s->is_pipe) {
548  for (i = 0; i < 3; i++) {
549  if (f[i] != s1->pb)
550  ff_format_io_close(s1, &f[i]);
551  }
552  }
553  return res;
554 }
555 
556 static int img_read_close(struct AVFormatContext* s1)
557 {
558 #if HAVE_GLOB
559  VideoDemuxData *s = s1->priv_data;
560  if (s->use_glob) {
561  globfree(&s->globstate);
562  }
563 #endif
564  return 0;
565 }
566 
567 static int img_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
568 {
569  VideoDemuxData *s1 = s->priv_data;
570  AVStream *st = s->streams[0];
571 
572  if (s1->ts_from_file) {
573  int index = av_index_search_timestamp(st, timestamp, flags);
574  if(index < 0)
575  return -1;
577  return 0;
578  }
579 
580  if (timestamp < 0 || !s1->loop && timestamp > s1->img_last - s1->img_first)
581  return -1;
582  s1->img_number = timestamp%(s1->img_last - s1->img_first + 1) + s1->img_first;
583  s1->pts = timestamp;
584  return 0;
585 }
586 
587 #define OFFSET(x) offsetof(VideoDemuxData, x)
588 #define DEC AV_OPT_FLAG_DECODING_PARAM
589 #define COMMON_OPTIONS \
590  { "framerate", "set the video framerate", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, DEC }, \
591  { "pixel_format", "set video pixel format", OFFSET(pixel_format), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, \
592  { "video_size", "set video size", OFFSET(width), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, DEC }, \
593  { "loop", "force loop over input file sequence", OFFSET(loop), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, DEC }, \
594  { NULL },
595 
596 #if CONFIG_IMAGE2_DEMUXER
597 const AVOption ff_img_options[] = {
598  { "pattern_type", "set pattern type", OFFSET(pattern_type), AV_OPT_TYPE_INT, {.i64=PT_DEFAULT}, 0, INT_MAX, DEC, .unit = "pattern_type"},
599  { "glob", "select glob pattern type", 0, AV_OPT_TYPE_CONST, {.i64=PT_GLOB }, INT_MIN, INT_MAX, DEC, .unit = "pattern_type" },
600  { "sequence", "select sequence pattern type", 0, AV_OPT_TYPE_CONST, {.i64=PT_SEQUENCE }, INT_MIN, INT_MAX, DEC, .unit = "pattern_type" },
601  { "none", "disable pattern matching", 0, AV_OPT_TYPE_CONST, {.i64=PT_NONE }, INT_MIN, INT_MAX, DEC, .unit = "pattern_type" },
602  { "start_number", "set first number in the sequence", OFFSET(start_number), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, DEC },
603  { "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 },
604  { "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" },
605  { "none", "none", 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, 0, 2, DEC, .unit = "ts_type" },
606  { "sec", "second precision", 0, AV_OPT_TYPE_CONST, {.i64 = 1 }, 0, 2, DEC, .unit = "ts_type" },
607  { "ns", "nano second precision", 0, AV_OPT_TYPE_CONST, {.i64 = 2 }, 0, 2, DEC, .unit = "ts_type" },
608  { "export_path_metadata", "enable metadata containing input path information", OFFSET(export_path_metadata), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, DEC }, \
609  COMMON_OPTIONS
610 };
611 
612 static const AVClass img2_class = {
613  .class_name = "image2 demuxer",
614  .item_name = av_default_item_name,
615  .option = ff_img_options,
616  .version = LIBAVUTIL_VERSION_INT,
617 };
619  .p.name = "image2",
620  .p.long_name = NULL_IF_CONFIG_SMALL("image2 sequence"),
621  .p.flags = AVFMT_NOFILE,
622  .p.priv_class = &img2_class,
623  .priv_data_size = sizeof(VideoDemuxData),
629 };
630 #endif
631 
632 static const AVOption img2pipe_options[] = {
633  { "frame_size", "force frame size in bytes", OFFSET(frame_size), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, DEC },
635 };
636 static const AVClass imagepipe_class = {
637  .class_name = "imagepipe demuxer",
638  .item_name = av_default_item_name,
639  .option = img2pipe_options,
640  .version = LIBAVUTIL_VERSION_INT,
641 };
642 
643 #if CONFIG_IMAGE2PIPE_DEMUXER
645  .p.name = "image2pipe",
646  .p.long_name = NULL_IF_CONFIG_SMALL("piped image2 sequence"),
647  .p.priv_class = &imagepipe_class,
648  .priv_data_size = sizeof(VideoDemuxData),
651 };
652 #endif
653 
654 static int bmp_probe(const AVProbeData *p)
655 {
656  const uint8_t *b = p->buf;
657  int ihsize;
658 
659  if (AV_RB16(b) != 0x424d)
660  return 0;
661 
662  ihsize = AV_RL32(b+14);
663  if (ihsize < 12 || ihsize > 255)
664  return 0;
665 
666  if (!AV_RN32(b + 6)) {
667  return AVPROBE_SCORE_EXTENSION + 1;
668  }
669  return AVPROBE_SCORE_EXTENSION / 4;
670 }
671 
672 static int cri_probe(const AVProbeData *p)
673 {
674  const uint8_t *b = p->buf;
675 
676  if ( AV_RL32(b) == 1
677  && AV_RL32(b + 4) == 4
678  && AV_RN32(b + 8) == AV_RN32("DVCC"))
679  return AVPROBE_SCORE_MAX - 1;
680  return 0;
681 }
682 
683 static int dds_probe(const AVProbeData *p)
684 {
685  const uint8_t *b = p->buf;
686 
687  if ( AV_RB64(b) == 0x444453207c000000
688  && AV_RL32(b + 8)
689  && AV_RL32(b + 12))
690  return AVPROBE_SCORE_MAX - 1;
691  return 0;
692 }
693 
694 static int dpx_probe(const AVProbeData *p)
695 {
696  const uint8_t *b = p->buf;
697  int w, h;
698  int is_big = (AV_RN32(b) == AV_RN32("SDPX"));
699 
700  if (p->buf_size < 0x304+8)
701  return 0;
702  w = is_big ? AV_RB32(p->buf + 0x304) : AV_RL32(p->buf + 0x304);
703  h = is_big ? AV_RB32(p->buf + 0x308) : AV_RL32(p->buf + 0x308);
704  if (w <= 0 || h <= 0)
705  return 0;
706 
707  if (is_big || AV_RN32(b) == AV_RN32("XPDS"))
708  return AVPROBE_SCORE_EXTENSION + 1;
709  return 0;
710 }
711 
712 static int exr_probe(const AVProbeData *p)
713 {
714  const uint8_t *b = p->buf;
715 
716  if (AV_RL32(b) == 20000630)
717  return AVPROBE_SCORE_EXTENSION + 1;
718  return 0;
719 }
720 
721 static int j2k_probe(const AVProbeData *p)
722 {
723  const uint8_t *b = p->buf;
724 
725  if (AV_RB64(b) == 0x0000000c6a502020 ||
726  AV_RB32(b) == 0xff4fff51)
727  return AVPROBE_SCORE_EXTENSION + 1;
728  return 0;
729 }
730 
731 static int jpeg_probe(const AVProbeData *p)
732 {
733  const uint8_t *b = p->buf;
734  int i, state = SOI, got_header = 0;
735 
736  if (AV_RB16(b) != 0xFFD8 ||
737  AV_RB32(b) == 0xFFD8FFF7)
738  return 0;
739 
740  b += 2;
741  for (i = 0; i < p->buf_size - 3; i++) {
742  int c;
743  if (b[i] != 0xFF)
744  continue;
745  c = b[i + 1];
746  switch (c) {
747  case SOI:
748  return 0;
749  case SOF0:
750  case SOF1:
751  case SOF2:
752  case SOF3:
753  case SOF5:
754  case SOF6:
755  case SOF7:
756  i += AV_RB16(&b[i + 2]) + 1;
757  if (state != SOI)
758  return 0;
759  state = SOF0;
760  break;
761  case SOS:
762  i += AV_RB16(&b[i + 2]) + 1;
763  if (state != SOF0 && state != SOS)
764  return 0;
765  state = SOS;
766  break;
767  case EOI:
768  if (state != SOS)
769  return 0;
770  state = EOI;
771  break;
772  case APP0:
773  if (c == APP0 && AV_RL32(&b[i + 4]) == MKTAG('J','F','I','F'))
774  got_header = 1;
775  /* fallthrough */
776  case APP1:
777  if (c == APP1 && AV_RL32(&b[i + 4]) == MKTAG('E','x','i','f'))
778  got_header = 1;
779  /* fallthrough */
780  case APP2:
781  case APP3:
782  case APP4:
783  case APP5:
784  case APP6:
785  case APP7:
786  case APP8:
787  case APP9:
788  case APP10:
789  case APP11:
790  case APP12:
791  case APP13:
792  case APP14:
793  case APP15:
794  case DQT: /* fallthrough */
795  case COM:
796  i += AV_RB16(&b[i + 2]) + 1;
797  break;
798  default:
799  if ( (c > TEM && c < SOF0)
800  || c == JPG)
801  return 0;
802  }
803  }
804 
805  if (state == EOI)
806  return AVPROBE_SCORE_EXTENSION + 1;
807  if (state == SOS)
808  return AVPROBE_SCORE_EXTENSION / 2 + got_header;
809  return AVPROBE_SCORE_EXTENSION / 8 + 1;
810 }
811 
812 static int jpegls_probe(const AVProbeData *p)
813 {
814  const uint8_t *b = p->buf;
815 
816  if (AV_RB32(b) == 0xffd8fff7)
817  return AVPROBE_SCORE_EXTENSION + 1;
818  return 0;
819 }
820 
821 static int jpegxl_probe(const AVProbeData *p)
822 {
823  const uint8_t *b = p->buf;
824 
825  /* ISOBMFF-based container */
826  /* 0x4a584c20 == "JXL " */
828  return AVPROBE_SCORE_EXTENSION + 1;
829  /* Raw codestreams all start with 0xff0a */
831  return 0;
832 #if CONFIG_IMAGE_JPEGXL_PIPE_DEMUXER
833  if (ff_jpegxl_parse_codestream_header(p->buf, p->buf_size, NULL, 5) >= 0)
834  return AVPROBE_SCORE_MAX - 2;
835 #endif
836  return 0;
837 }
838 
839 static int jpegxs_probe(const AVProbeData *p)
840 {
841  const uint8_t *b = p->buf;
842 
843  if (AV_RB32(b) == 0xff10ff50)
844  return AVPROBE_SCORE_EXTENSION + 1;
845  return 0;
846 }
847 
848 static int pcx_probe(const AVProbeData *p)
849 {
850  const uint8_t *b = p->buf;
851 
852  if ( p->buf_size < 128
853  || b[0] != 10
854  || b[1] > 5
855  || b[2] > 1
856  || av_popcount(b[3]) != 1 || b[3] > 8
857  || AV_RL16(&b[4]) > AV_RL16(&b[8])
858  || AV_RL16(&b[6]) > AV_RL16(&b[10])
859  || b[64])
860  return 0;
861  b += 73;
862  while (++b < p->buf + 128)
863  if (*b)
864  return AVPROBE_SCORE_EXTENSION / 4;
865 
866  return AVPROBE_SCORE_EXTENSION + 1;
867 }
868 
869 static int qdraw_probe(const AVProbeData *p)
870 {
871  const uint8_t *b = p->buf;
872 
873  if ( p->buf_size >= 528
874  && (AV_RB64(b + 520) & 0xFFFFFFFFFFFF) == 0x001102ff0c00
875  && AV_RB16(b + 520)
876  && AV_RB16(b + 518))
877  return AVPROBE_SCORE_MAX * 3 / 4;
878  if ( (AV_RB64(b + 8) & 0xFFFFFFFFFFFF) == 0x001102ff0c00
879  && AV_RB16(b + 8)
880  && AV_RB16(b + 6))
881  return AVPROBE_SCORE_EXTENSION / 4;
882  return 0;
883 }
884 
885 static int pictor_probe(const AVProbeData *p)
886 {
887  const uint8_t *b = p->buf;
888 
889  if (AV_RL16(b) == 0x1234)
890  return AVPROBE_SCORE_EXTENSION / 4;
891  return 0;
892 }
893 
894 static int png_probe(const AVProbeData *p)
895 {
896  const uint8_t *b = p->buf;
897 
898  if (AV_RB64(b) == 0x89504e470d0a1a0a)
899  return AVPROBE_SCORE_MAX - 1;
900  return 0;
901 }
902 
903 static int psd_probe(const AVProbeData *p)
904 {
905  const uint8_t *b = p->buf;
906  int ret = 0;
907  uint16_t color_mode;
908 
909  if (AV_RL32(b) == MKTAG('8','B','P','S')) {
910  ret += 1;
911  } else {
912  return 0;
913  }
914 
915  if ((b[4] == 0) && (b[5] == 1)) {/* version 1 is PSD, version 2 is PSB */
916  ret += 1;
917  } else {
918  return 0;
919  }
920 
921  if ((AV_RL32(b+6) == 0) && (AV_RL16(b+10) == 0))/* reserved must be 0 */
922  ret += 1;
923 
924  color_mode = AV_RB16(b+24);
925  if ((color_mode <= 9) && (color_mode != 5) && (color_mode != 6))
926  ret += 1;
927 
928  return AVPROBE_SCORE_EXTENSION + ret;
929 }
930 
931 static int sgi_probe(const AVProbeData *p)
932 {
933  const uint8_t *b = p->buf;
934 
935  if (AV_RB16(b) == 474 &&
936  (b[2] & ~1) == 0 &&
937  (b[3] & ~3) == 0 && b[3] &&
938  (AV_RB16(b + 4) & ~7) == 0 && AV_RB16(b + 4))
939  return AVPROBE_SCORE_EXTENSION + 1;
940  return 0;
941 }
942 
943 static int sunrast_probe(const AVProbeData *p)
944 {
945  const uint8_t *b = p->buf;
946 
947  if (AV_RB32(b) == 0x59a66a95)
948  return AVPROBE_SCORE_EXTENSION + 1;
949  return 0;
950 }
951 
952 static int svg_probe(const AVProbeData *p)
953 {
954  const uint8_t *b = p->buf;
955  const uint8_t *end = p->buf + p->buf_size;
956  while (b < end && av_isspace(*b))
957  b++;
958  if (b >= end - 5)
959  return 0;
960  if (!memcmp(b, "<svg", 4))
961  return AVPROBE_SCORE_EXTENSION + 1;
962  if (memcmp(p->buf, "<?xml", 5) && memcmp(b, "<!--", 4))
963  return 0;
964  while (b < end) {
966  if (!inc)
967  break;
968  b += inc;
969  if (b >= end - 4)
970  return 0;
971  if (!memcmp(b, "<svg", 4))
972  return AVPROBE_SCORE_EXTENSION + 1;
973  }
974  return 0;
975 }
976 
977 static int tiff_probe(const AVProbeData *p)
978 {
979  const uint8_t *b = p->buf;
980 
981  if (AV_RB32(b) == 0x49492a00 ||
982  AV_RB32(b) == 0x4D4D002a)
983  return AVPROBE_SCORE_EXTENSION + 1;
984  return 0;
985 }
986 
987 static int webp_probe(const AVProbeData *p)
988 {
989  const uint8_t *b = p->buf;
990 
991  if (AV_RB32(b) == 0x52494646 &&
992  AV_RB32(b + 8) == 0x57454250)
993  return AVPROBE_SCORE_MAX - 1;
994  return 0;
995 }
996 
997 static int pnm_magic_check(const AVProbeData *p, int magic)
998 {
999  const uint8_t *b = p->buf;
1000 
1001  return b[0] == 'P' && b[1] == magic + '0';
1002 }
1003 
1004 static inline int pnm_probe(const AVProbeData *p)
1005 {
1006  const uint8_t *b = p->buf;
1007 
1008  while (b[2] == '\r')
1009  b++;
1010  if (b[2] == '\n' && (b[3] == '#' || (b[3] >= '0' && b[3] <= '9')))
1011  return AVPROBE_SCORE_EXTENSION + 2;
1012  return 0;
1013 }
1014 
1015 static int pbm_probe(const AVProbeData *p)
1016 {
1017  return pnm_magic_check(p, 1) || pnm_magic_check(p, 4) ? pnm_probe(p) : 0;
1018 }
1019 
1020 static int pfm_probe(const AVProbeData *p)
1021 {
1022  return pnm_magic_check(p, 'F' - '0') ||
1023  pnm_magic_check(p, 'f' - '0') ? pnm_probe(p) : 0;
1024 }
1025 
1026 static int phm_probe(const AVProbeData *p)
1027 {
1028  return pnm_magic_check(p, 'H' - '0') ||
1029  pnm_magic_check(p, 'h' - '0') ? pnm_probe(p) : 0;
1030 }
1031 
1032 static inline int pgmx_probe(const AVProbeData *p)
1033 {
1034  return pnm_magic_check(p, 2) || pnm_magic_check(p, 5) ? pnm_probe(p) : 0;
1035 }
1036 
1037 static int pgm_probe(const AVProbeData *p)
1038 {
1039  int ret = pgmx_probe(p);
1040  return ret && !av_match_ext(p->filename, "pgmyuv") ? ret : 0;
1041 }
1042 
1043 static int pgmyuv_probe(const AVProbeData *p) // custom FFmpeg format recognized by file extension
1044 {
1045  int ret = pgmx_probe(p);
1046  return ret && av_match_ext(p->filename, "pgmyuv") ? ret : 0;
1047 }
1048 
1049 static int pgx_probe(const AVProbeData *p)
1050 {
1051  const uint8_t *b = p->buf;
1052  if (!memcmp(b, "PG ML ", 6))
1053  return AVPROBE_SCORE_EXTENSION + 1;
1054  return 0;
1055 }
1056 
1057 static int ppm_probe(const AVProbeData *p)
1058 {
1059  return pnm_magic_check(p, 3) || pnm_magic_check(p, 6) ? pnm_probe(p) : 0;
1060 }
1061 
1062 static int pam_probe(const AVProbeData *p)
1063 {
1064  return pnm_magic_check(p, 7) ? pnm_probe(p) : 0;
1065 }
1066 
1067 static int hdr_probe(const AVProbeData *p)
1068 {
1069  if (!memcmp(p->buf, "#?RADIANCE\n", 11))
1070  return AVPROBE_SCORE_MAX;
1071  return 0;
1072 }
1073 
1074 static int xbm_probe(const AVProbeData *p)
1075 {
1076  if (!memcmp(p->buf, "/* XBM X10 format */", 20))
1077  return AVPROBE_SCORE_MAX;
1078 
1079  if (!memcmp(p->buf, "#define", 7))
1080  return AVPROBE_SCORE_MAX - 1;
1081  return 0;
1082 }
1083 
1084 static int xpm_probe(const AVProbeData *p)
1085 {
1086  const uint8_t *b = p->buf;
1087 
1088  if (AV_RB64(b) == 0x2f2a2058504d202a && *(b+8) == '/')
1089  return AVPROBE_SCORE_MAX - 1;
1090  return 0;
1091 }
1092 
1093 static int xwd_probe(const AVProbeData *p)
1094 {
1095  const uint8_t *b = p->buf;
1096  unsigned width, bpp, bpad, lsize;
1097 
1098  if ( p->buf_size < XWD_HEADER_SIZE
1099  || AV_RB32(b ) < XWD_HEADER_SIZE // header size
1100  || AV_RB32(b + 4) != XWD_VERSION // version
1101  || AV_RB32(b + 8) != XWD_Z_PIXMAP // format
1102  || AV_RB32(b + 12) > 32 || !AV_RB32(b + 12) // depth
1103  || AV_RB32(b + 16) == 0 // width
1104  || AV_RB32(b + 20) == 0 // height
1105  || AV_RB32(b + 28) > 1 // byteorder
1106  || AV_RB32(b + 32) & ~56 || av_popcount(AV_RB32(b + 32)) != 1 // bitmap unit
1107  || AV_RB32(b + 36) > 1 // bitorder
1108  || AV_RB32(b + 40) & ~56 || av_popcount(AV_RB32(b + 40)) != 1 // padding
1109  || AV_RB32(b + 44) > 32 || !AV_RB32(b + 44) // bpp
1110  || AV_RB32(b + 68) > 256) // colours
1111  return 0;
1112 
1113  width = AV_RB32(b + 16);
1114  bpad = AV_RB32(b + 40);
1115  bpp = AV_RB32(b + 44);
1116  lsize = AV_RB32(b + 48);
1117  if (lsize < FFALIGN(width * bpp, bpad) >> 3)
1118  return 0;
1119 
1120  return AVPROBE_SCORE_MAX / 2 + 1;
1121 }
1122 
1123 static int gif_probe(const AVProbeData *p)
1124 {
1125  /* check magick */
1126  if (memcmp(p->buf, gif87a_sig, 6) && memcmp(p->buf, gif89a_sig, 6))
1127  return 0;
1128 
1129  /* width or height contains zero? */
1130  if (!AV_RL16(&p->buf[6]) || !AV_RL16(&p->buf[8]))
1131  return 0;
1132 
1133  return AVPROBE_SCORE_MAX - 1;
1134 }
1135 
1136 static int photocd_probe(const AVProbeData *p)
1137 {
1138  if (!memcmp(p->buf, "PCD_OPA", 7))
1139  return AVPROBE_SCORE_MAX - 1;
1140 
1141  if (p->buf_size < 0x807 || memcmp(p->buf + 0x800, "PCD_IPI", 7))
1142  return 0;
1143 
1144  return AVPROBE_SCORE_MAX - 1;
1145 }
1146 
1147 static int qoi_probe(const AVProbeData *p)
1148 {
1149  if (memcmp(p->buf, "qoif", 4))
1150  return 0;
1151 
1152  if (AV_RB32(p->buf + 4) == 0 || AV_RB32(p->buf + 8) == 0)
1153  return 0;
1154 
1155  if (p->buf[12] != 3 && p->buf[12] != 4)
1156  return 0;
1157 
1158  if (p->buf[13] > 1)
1159  return 0;
1160 
1161  return AVPROBE_SCORE_MAX - 1;
1162 }
1163 
1164 static int gem_probe(const AVProbeData *p)
1165 {
1166  const uint8_t *b = p->buf;
1167  if ( AV_RB16(b ) >= 1 && AV_RB16(b ) <= 3 &&
1168  AV_RB16(b + 2) >= 8 && AV_RB16(b + 2) <= 779 &&
1169  (AV_RB16(b + 4) > 0 && AV_RB16(b + 4) <= 32) && /* planes */
1170  (AV_RB16(b + 6) > 0 && AV_RB16(b + 6) <= 8) && /* pattern_size */
1171  AV_RB16(b + 8) &&
1172  AV_RB16(b + 10) &&
1173  AV_RB16(b + 12) &&
1174  AV_RB16(b + 14)) {
1175  if (AV_RN32(b + 16) == AV_RN32("STTT") ||
1176  AV_RN32(b + 16) == AV_RN32("TIMG") ||
1177  AV_RN32(b + 16) == AV_RN32("XIMG"))
1178  return AVPROBE_SCORE_EXTENSION + 1;
1179  return AVPROBE_SCORE_EXTENSION / 4;
1180  }
1181  return 0;
1182 }
1183 
1184 static int vbn_probe(const AVProbeData *p)
1185 {
1186  const uint8_t *b = p->buf;
1187  if (AV_RL32(b ) == VBN_MAGIC &&
1188  AV_RL32(b + 4) == VBN_MAJOR &&
1189  AV_RL32(b + 8) == VBN_MINOR)
1190  return AVPROBE_SCORE_MAX - 1;
1191  return 0;
1192 }
1193 
1194 #define IMAGEAUTO_DEMUXER_0(imgname, codecid)
1195 #define IMAGEAUTO_DEMUXER_1(imgname, codecid)\
1196 const FFInputFormat ff_image_ ## imgname ## _pipe_demuxer = {\
1197  .p.name = AV_STRINGIFY(imgname) "_pipe",\
1198  .p.long_name = NULL_IF_CONFIG_SMALL("piped " AV_STRINGIFY(imgname) " sequence"),\
1199  .p.priv_class = &imagepipe_class,\
1200  .p.flags = AVFMT_GENERIC_INDEX,\
1201  .priv_data_size = sizeof(VideoDemuxData),\
1202  .read_probe = imgname ## _probe,\
1203  .read_header = ff_img_read_header,\
1204  .read_packet = ff_img_read_packet,\
1205  .raw_codec_id = codecid,\
1206 };
1207 
1208 #define IMAGEAUTO_DEMUXER_2(imgname, codecid, enabled) \
1209  IMAGEAUTO_DEMUXER_ ## enabled(imgname, codecid)
1210 #define IMAGEAUTO_DEMUXER_3(imgname, codecid, config) \
1211  IMAGEAUTO_DEMUXER_2(imgname, codecid, config)
1212 #define IMAGEAUTO_DEMUXER_EXT(imgname, codecid, uppercase_name) \
1213  IMAGEAUTO_DEMUXER_3(imgname, AV_CODEC_ID_ ## codecid, \
1214  CONFIG_IMAGE_ ## uppercase_name ## _PIPE_DEMUXER)
1215 #define IMAGEAUTO_DEMUXER(imgname, codecid) \
1216  IMAGEAUTO_DEMUXER_EXT(imgname, codecid, codecid)
1217 
1218 IMAGEAUTO_DEMUXER(bmp, BMP)
1219 IMAGEAUTO_DEMUXER(cri, CRI)
1220 IMAGEAUTO_DEMUXER(dds, DDS)
1221 IMAGEAUTO_DEMUXER(dpx, DPX)
1222 IMAGEAUTO_DEMUXER(exr, EXR)
1223 IMAGEAUTO_DEMUXER(gem, GEM)
1224 IMAGEAUTO_DEMUXER(gif, GIF)
1225 IMAGEAUTO_DEMUXER_EXT(hdr, RADIANCE_HDR, HDR)
1226 IMAGEAUTO_DEMUXER_EXT(j2k, JPEG2000, J2K)
1227 IMAGEAUTO_DEMUXER_EXT(jpeg, MJPEG, JPEG)
1228 IMAGEAUTO_DEMUXER(jpegxs, JPEGXS)
1229 IMAGEAUTO_DEMUXER(jpegls, JPEGLS)
1230 IMAGEAUTO_DEMUXER(jpegxl, JPEGXL)
1231 IMAGEAUTO_DEMUXER(pam, PAM)
1232 IMAGEAUTO_DEMUXER(pbm, PBM)
1233 IMAGEAUTO_DEMUXER(pcx, PCX)
1234 IMAGEAUTO_DEMUXER(pfm, PFM)
1235 IMAGEAUTO_DEMUXER(pgm, PGM)
1236 IMAGEAUTO_DEMUXER(pgmyuv, PGMYUV)
1237 IMAGEAUTO_DEMUXER(pgx, PGX)
1238 IMAGEAUTO_DEMUXER(phm, PHM)
1239 IMAGEAUTO_DEMUXER(photocd, PHOTOCD)
1240 IMAGEAUTO_DEMUXER(pictor, PICTOR)
1241 IMAGEAUTO_DEMUXER(png, PNG)
1242 IMAGEAUTO_DEMUXER(ppm, PPM)
1243 IMAGEAUTO_DEMUXER(psd, PSD)
1244 IMAGEAUTO_DEMUXER(qdraw, QDRAW)
1245 IMAGEAUTO_DEMUXER(qoi, QOI)
1246 IMAGEAUTO_DEMUXER(sgi, SGI)
1247 IMAGEAUTO_DEMUXER(sunrast, SUNRAST)
1248 IMAGEAUTO_DEMUXER(svg, SVG)
1249 IMAGEAUTO_DEMUXER(tiff, TIFF)
1250 IMAGEAUTO_DEMUXER(vbn, VBN)
1251 IMAGEAUTO_DEMUXER(webp, WEBP)
1252 IMAGEAUTO_DEMUXER(xbm, XBM)
1253 IMAGEAUTO_DEMUXER(xpm, XPM)
1254 IMAGEAUTO_DEMUXER(xwd, XWD)
flags
const SwsFlags flags[]
Definition: swscale.c:61
AV_BPRINT_SIZE_UNLIMITED
#define AV_BPRINT_SIZE_UNLIMITED
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
FFInputFormat::read_probe
int(* read_probe)(const AVProbeData *)
Tell if a given file has a chance of being parsed as this format.
Definition: demux.h:73
mjpeg.h
av_bprint_is_complete
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated).
Definition: bprint.h:218
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
opt.h
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:51
pam_probe
static int pam_probe(const AVProbeData *p)
Definition: img2dec.c:1062
SOS
@ SOS
Definition: mjpeg.h:72
av_bprint_init
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
Definition: bprint.c:69
ff_jpegxl_parse_codestream_header
int ff_jpegxl_parse_codestream_header(const uint8_t *buf, int buflen, FFJXLMetadata *meta, int validate)
Definition: jpegxl_parse.c:258
APP1
@ APP1
Definition: mjpeg.h:80
AVCodecParameters
This struct describes the properties of an encoded stream.
Definition: codec_par.h:47
cri_probe
static int cri_probe(const AVProbeData *p)
Definition: img2dec.c:672
VideoDemuxData::img_number
int img_number
Definition: img2.h:44
avformat_new_stream
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
AV_RL64
uint64_t_TMPL AV_RL64
Definition: bytestream.h:91
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:57
SOF0
@ SOF0
Definition: mjpeg.h:39
pnm_magic_check
static int pnm_magic_check(const AVProbeData *p, int magic)
Definition: img2dec.c:997
VBN_MINOR
#define VBN_MINOR
Definition: vbn.h:31
OFFSET
#define OFFSET(x)
Definition: img2dec.c:587
int64_t
long long int64_t
Definition: coverity.c:34
av_strcasecmp
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
Definition: avstring.c:208
AV_CODEC_ID_RAWVIDEO
@ AV_CODEC_ID_RAWVIDEO
Definition: codec_id.h:65
av_isspace
static av_const int av_isspace(int c)
Locale-independent conversion of ASCII isspace.
Definition: avstring.h:218
pixdesc.h
AVFormatContext::streams
AVStream ** streams
A list of all streams in the file.
Definition: avformat.h:1332
webp_probe
static int webp_probe(const AVProbeData *p)
Definition: img2dec.c:987
ff_img_read_header
int ff_img_read_header(AVFormatContext *s1)
Definition: img2dec.c:170
AVPacket::data
uint8_t * data
Definition: packet.h:588
dds_probe
static int dds_probe(const AVProbeData *p)
Definition: img2dec.c:683
AVOption
AVOption.
Definition: opt.h:429
b
#define b
Definition: input.c:42
AVStream::avg_frame_rate
AVRational avg_frame_rate
Average framerate.
Definition: avformat.h:833
imagepipe_class
static const AVClass imagepipe_class
Definition: img2dec.c:636
AVFMT_FLAG_CUSTOM_IO
#define AVFMT_FLAG_CUSTOM_IO
The caller has supplied a custom AVIOContext, don't avio_close() it.
Definition: avformat.h:1423
psd_probe
static int psd_probe(const AVProbeData *p)
Definition: img2dec.c:903
ff_guess_image2_codec
enum AVCodecID ff_guess_image2_codec(const char *filename)
Definition: img2.c:126
qoi_probe
static int qoi_probe(const AVProbeData *p)
Definition: img2dec.c:1147
phm_probe
static int phm_probe(const AVProbeData *p)
Definition: img2dec.c:1026
pcx_probe
static int pcx_probe(const AVProbeData *p)
Definition: img2dec.c:848
AVDictionary
Definition: dict.c:32
AVProbeData::buf_size
int buf_size
Size of buf except extra allocated bytes.
Definition: avformat.h:454
img_read_seek
static int img_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
Definition: img2dec.c:567
AVFormatContext::video_codec_id
enum AVCodecID video_codec_id
Forced video codec_id.
Definition: avformat.h:1468
av_popcount
#define av_popcount
Definition: common.h:154
FFInputFormat::read_header
int(* read_header)(struct AVFormatContext *)
Read the format header and initialize the AVFormatContext structure.
Definition: demux.h:80
avio_size
int64_t avio_size(AVIOContext *s)
Get the filesize.
Definition: aviobuf.c:326
os_support.h
AV_PKT_FLAG_KEY
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: packet.h:643
XWD_Z_PIXMAP
#define XWD_Z_PIXMAP
Definition: xwd.h:32
av_basename
const char * av_basename(const char *path)
Thread safe basename.
Definition: avstring.c:253
AVINDEX_KEYFRAME
#define AVINDEX_KEYFRAME
Definition: avformat.h:606
APP15
@ APP15
Definition: mjpeg.h:94
av_filename_number_test
int av_filename_number_test(const char *filename)
Check whether filename actually is a numbered sequence generator.
Definition: utils.c:121
AVPROBE_SCORE_MAX
#define AVPROBE_SCORE_MAX
maximum score
Definition: avformat.h:463
FF_JPEGXL_CONTAINER_SIGNATURE_LE
#define FF_JPEGXL_CONTAINER_SIGNATURE_LE
Definition: jpegxl.h:26
avpriv_set_pts_info
void avpriv_set_pts_info(AVStream *st, int pts_wrap_bits, unsigned int pts_num, unsigned int pts_den)
Set the time base and wrapping info for a given stream.
Definition: avformat.c:777
av_packet_add_side_data
int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, uint8_t *data, size_t size)
Wrap an existing array as a packet side data.
Definition: packet.c:197
ffstream
static av_always_inline FFStream * ffstream(AVStream *st)
Definition: internal.h:347
APP4
@ APP4
Definition: mjpeg.h:83
fail
#define fail()
Definition: checkasm.h:214
svg_probe
static int svg_probe(const AVProbeData *p)
Definition: img2dec.c:952
read_seek
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
Definition: libcdio.c:151
av_add_index_entry
int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, int size, int distance, int flags)
Add an index entry into a sorted list.
Definition: seek.c:122
SOF3
@ SOF3
Definition: mjpeg.h:42
read_close
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:143
avio_tell
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition: avio.h:494
IMAGEAUTO_DEMUXER
#define IMAGEAUTO_DEMUXER(imgname, codecid)
Definition: img2dec.c:1215
pgmx_probe
static int pgmx_probe(const AVProbeData *p)
Definition: img2dec.c:1032
APP13
@ APP13
Definition: mjpeg.h:92
AVPROBE_PADDING_SIZE
#define AVPROBE_PADDING_SIZE
extra allocated bytes at the end of the probe buffer
Definition: avformat.h:465
img_read_close
static int img_read_close(struct AVFormatContext *s1)
Definition: img2dec.c:556
img2pipe_options
static const AVOption img2pipe_options[]
Definition: img2dec.c:632
ff_bprint_get_frame_filename
int ff_bprint_get_frame_filename(struct AVBPrint *buf, const char *path, int64_t number, int flags)
Return in 'buf' the path with 'd' replaced by a number.
Definition: utils.c:293
jpegxs_probe
static int jpegxs_probe(const AVProbeData *p)
Definition: img2dec.c:839
AVStream::duration
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:803
av_probe_input_format3
const AVInputFormat * av_probe_input_format3(const AVProbeData *pd, int is_opened, int *score_ret)
Guess the file format.
Definition: format.c:156
PT_NONE
@ PT_NONE
Definition: img2.h:36
loop
static int loop
Definition: ffplay.c:335
PT_GLOB
@ PT_GLOB
Definition: img2.h:34
gif89a_sig
static const uint8_t gif89a_sig[6]
Definition: gif.h:35
avassert.h
pictor_probe
static int pictor_probe(const AVProbeData *p)
Definition: img2dec.c:885
pkt
AVPacket * pkt
Definition: movenc.c:60
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:210
AVInputFormat
Definition: avformat.h:544
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
AVFormatContext::ctx_flags
int ctx_flags
Flags signalling stream properties.
Definition: avformat.h:1313
COM
@ COM
Definition: mjpeg.h:111
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_read_callback.c:42
SOF5
@ SOF5
Definition: mjpeg.h:44
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:198
av_new_packet
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
Definition: packet.c:98
APP12
@ APP12
Definition: mjpeg.h:91
img_read_probe
static int img_read_probe(const AVProbeData *p)
Definition: img2dec.c:153
AVFormatContext::flags
int flags
Flags modifying the (de)muxer behaviour.
Definition: avformat.h:1415
AVInputFormat::name
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:549
AVFormatContext::iformat
const struct AVInputFormat * iformat
The input container format.
Definition: avformat.h:1276
APP3
@ APP3
Definition: mjpeg.h:82
pix_fmt
static enum AVPixelFormat pix_fmt
Definition: demux_decode.c:41
AVProbeData::buf
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
Definition: avformat.h:453
PT_DEFAULT
@ PT_DEFAULT
Definition: img2.h:37
frame_size
int frame_size
Definition: mxfenc.c:2487
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:201
AVCodecParameters::width
int width
Video only.
Definition: codec_par.h:134
AVProbeData::filename
const char * filename
Definition: avformat.h:452
av_match_ext
int av_match_ext(const char *filename, const char *extensions)
Return a positive value if the given filename has one of the given extensions, 0 otherwise.
Definition: format.c:41
add_filename_as_pkt_side_data
static int add_filename_as_pkt_side_data(char *filename, AVPacket *pkt)
Add this frame's source path and basename to packet's sidedata as a dictionary, so it can be used by ...
Definition: img2dec.c:341
bmp_probe
static int bmp_probe(const AVProbeData *p)
Definition: img2dec.c:654
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:41
pgmyuv_probe
static int pgmyuv_probe(const AVProbeData *p)
Definition: img2dec.c:1043
AV_CODEC_ID_ALIAS_PIX
@ AV_CODEC_ID_ALIAS_PIX
Definition: codec_id.h:231
j2k_probe
static int j2k_probe(const AVProbeData *p)
Definition: img2dec.c:721
AV_RL16
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
Definition: bytestream.h:94
APP11
@ APP11
Definition: mjpeg.h:90
ff_image2_demuxer
const FFInputFormat ff_image2_demuxer
VideoDemuxData
Definition: img2.h:40
xpm_probe
static int xpm_probe(const AVProbeData *p)
Definition: img2dec.c:1084
APP5
@ APP5
Definition: mjpeg.h:84
if
if(ret)
Definition: filter_design.txt:179
xwd.h
FFStream::need_parsing
enum AVStreamParseType need_parsing
Definition: internal.h:314
AVFormatContext
Format I/O context.
Definition: avformat.h:1264
internal.h
AVFormatContext::audio_codec_id
enum AVCodecID audio_codec_id
Forced audio codec_id.
Definition: avformat.h:1474
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:767
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
gem_probe
static int gem_probe(const AVProbeData *p)
Definition: img2dec.c:1164
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:76
ff_img_options
const AVOption ff_img_options[]
NULL
#define NULL
Definition: coverity.c:32
sizes
static const int sizes[][2]
Definition: img2dec.c:61
APP9
@ APP9
Definition: mjpeg.h:88
xwd_probe
static int xwd_probe(const AVProbeData *p)
Definition: img2dec.c:1093
AVFMTCTX_NOHEADER
#define AVFMTCTX_NOHEADER
signal that no header is present (streams are added dynamically)
Definition: avformat.h:1215
photocd_probe
static int photocd_probe(const AVProbeData *p)
Definition: img2dec.c:1136
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:242
AVFormatContext::pb
AVIOContext * pb
I/O context.
Definition: avformat.h:1306
AV_RN32
#define AV_RN32(p)
Definition: intreadwrite.h:360
VBN_MAJOR
#define VBN_MAJOR
Definition: vbn.h:30
xbm_probe
static int xbm_probe(const AVProbeData *p)
Definition: img2dec.c:1074
AVProbeData
This structure contains the data a format has to probe a file.
Definition: avformat.h:451
VBN_MAGIC
#define VBN_MAGIC
Definition: vbn.h:29
TEM
@ TEM
Definition: mjpeg.h:113
jpegxl_probe
static int jpegxl_probe(const AVProbeData *p)
Definition: img2dec.c:821
index
int index
Definition: gxfenc.c:90
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
AVPROBE_SCORE_EXTENSION
#define AVPROBE_SCORE_EXTENSION
score for file extension
Definition: avformat.h:461
inc
static int inc(int num, int period)
Definition: perlin.c:34
DEC
#define DEC
Definition: img2dec.c:588
FFInputFormat::read_packet
int(* read_packet)(struct AVFormatContext *, AVPacket *pkt)
Read one packet and put it in 'pkt'.
Definition: demux.h:90
PT_SEQUENCE
@ PT_SEQUENCE
Definition: img2.h:35
sunrast_probe
static int sunrast_probe(const AVProbeData *p)
Definition: img2dec.c:943
f
f
Definition: af_crystalizer.c:122
AVIOContext
Bytestream IO Context.
Definition: avio.h:160
vbn_probe
static int vbn_probe(const AVProbeData *p)
Definition: img2dec.c:1184
AVPacket::size
int size
Definition: packet.h:589
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
av_bprint_finalize
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
Definition: bprint.c:235
XWD_HEADER_SIZE
#define XWD_HEADER_SIZE
Definition: xwd.h:27
VideoDemuxData::img_first
int img_first
Definition: img2.h:42
AVFormatContext::url
char * url
input or output URL.
Definition: avformat.h:1380
gif.h
size
int size
Definition: twinvq_data.h:10344
pfm_probe
static int pfm_probe(const AVProbeData *p)
Definition: img2dec.c:1020
dpx_probe
static int dpx_probe(const AVProbeData *p)
Definition: img2dec.c:694
AV_RB32
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
Definition: bytestream.h:96
IMAGEAUTO_DEMUXER_EXT
#define IMAGEAUTO_DEMUXER_EXT(imgname, codecid, uppercase_name)
Definition: img2dec.c:1212
VideoDemuxData::img_last
int img_last
Definition: img2.h:43
avio_check
int avio_check(const char *url, int flags)
Return AVIO_FLAG_* access flags corresponding to the access permissions of the resource in url,...
Definition: avio.c:665
AVFMT_NOFILE
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:468
ff_format_io_close
int ff_format_io_close(AVFormatContext *s, AVIOContext **pb)
Definition: avformat.c:868
av_demuxer_iterate
const AVInputFormat * av_demuxer_iterate(void **opaque)
Iterate over all registered demuxers.
Definition: allformats.c:614
state
static struct @547 state
range
enum AVColorRange range
Definition: mediacodec_wrapper.c:2594
FFInputFormat::p
AVInputFormat p
The public AVInputFormat.
Definition: demux.h:51
header
static const uint8_t header[24]
Definition: sdr2.c:68
av_packet_pack_dictionary
uint8_t * av_packet_pack_dictionary(AVDictionary *dict, size_t *size)
Pack a dictionary for use in side_data.
Definition: packet.c:317
AVPacket::flags
int flags
A combination of AV_PKT_FLAG values.
Definition: packet.h:594
av_dict_free
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
Definition: dict.c:233
read_header
static int read_header(FFV1Context *f, RangeCoder *c)
Definition: ffv1dec.c:498
DQT
@ DQT
Definition: mjpeg.h:73
APP6
@ APP6
Definition: mjpeg.h:85
AV_PKT_DATA_STRINGS_METADATA
@ AV_PKT_DATA_STRINGS_METADATA
A list of zero terminated key/value strings.
Definition: packet.h:169
AV_CODEC_ID_MJPEG
@ AV_CODEC_ID_MJPEG
Definition: codec_id.h:59
bprint.h
gif_probe
static int gif_probe(const AVProbeData *p)
Definition: img2dec.c:1123
log.h
AV_CODEC_ID_NONE
@ AV_CODEC_ID_NONE
Definition: codec_id.h:50
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
AVPacket::pts
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: packet.h:581
EOI
@ EOI
Definition: mjpeg.h:71
avio_internal.h
gif87a_sig
static const uint8_t gif87a_sig[6]
Definition: gif.h:34
AVCodecParameters::height
int height
Definition: codec_par.h:135
img2.h
APP8
@ APP8
Definition: mjpeg.h:87
FF_JPEGXL_CODESTREAM_SIGNATURE_LE
#define FF_JPEGXL_CODESTREAM_SIGNATURE_LE
Definition: jpegxl.h:25
pgm_probe
static int pgm_probe(const AVProbeData *p)
Definition: img2dec.c:1037
FFInputFormat::raw_codec_id
enum AVCodecID raw_codec_id
Raw demuxers store their codec ID here.
Definition: demux.h:56
demux.h
infer_size
static int infer_size(int *width_ptr, int *height_ptr, int size)
Definition: img2dec.c:73
APP7
@ APP7
Definition: mjpeg.h:86
sgi_probe
static int sgi_probe(const AVProbeData *p)
Definition: img2dec.c:931
ret
ret
Definition: filter_design.txt:187
AVStream
Stream structure.
Definition: avformat.h:744
avio_seek
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
Definition: aviobuf.c:236
AVClass::class_name
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:81
pgx_probe
static int pgx_probe(const AVProbeData *p)
Definition: img2dec.c:1049
SOF2
@ SOF2
Definition: mjpeg.h:41
pnm_probe
static int pnm_probe(const AVProbeData *p)
Definition: img2dec.c:1004
avformat.h
av_bprintf
void av_bprintf(AVBPrint *buf, const char *fmt,...)
Definition: bprint.c:122
AV_INPUT_BUFFER_PADDING_SIZE
#define AV_INPUT_BUFFER_PADDING_SIZE
Definition: defs.h:40
COMMON_OPTIONS
#define COMMON_OPTIONS
Definition: img2dec.c:589
APP14
@ APP14
Definition: mjpeg.h:93
AV_RL32
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
Definition: bytestream.h:92
av_get_pix_fmt
enum AVPixelFormat av_get_pix_fmt(const char *name)
Return the pixel format corresponding to name.
Definition: pixdesc.c:3388
ff_image2pipe_demuxer
const FFInputFormat ff_image2pipe_demuxer
jpeg_probe
static int jpeg_probe(const AVProbeData *p)
Definition: img2dec.c:731
subtitles.h
png_probe
static int png_probe(const AVProbeData *p)
Definition: img2dec.c:894
jpegls_probe
static int jpegls_probe(const AVProbeData *p)
Definition: img2dec.c:812
AVInputFormat::flags
int flags
Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS, AVFMT_NOTIMESTAMPS,...
Definition: avformat.h:563
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
hdr_probe
static int hdr_probe(const AVProbeData *p)
Definition: img2dec.c:1067
APP2
@ APP2
Definition: mjpeg.h:81
ffifmt
static const FFInputFormat * ffifmt(const AVInputFormat *fmt)
Definition: demux.h:143
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
av_bprint_clear
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
Definition: bprint.c:227
PROBE_BUF_MIN
#define PROBE_BUF_MIN
size of probe buffer, for guessing file type from file contents
Definition: internal.h:33
ppm_probe
static int ppm_probe(const AVProbeData *p)
Definition: img2dec.c:1057
avio_read
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:615
exr_probe
static int exr_probe(const AVProbeData *p)
Definition: img2dec.c:712
AVStream::r_frame_rate
AVRational r_frame_rate
Real base framerate of the stream.
Definition: avformat.h:878
AVFormatContext::io_open
int(* io_open)(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags, AVDictionary **options)
A callback for opening new IO streams.
Definition: avformat.h:1864
AVIndexEntry::pos
int64_t pos
Definition: avformat.h:599
VideoDemuxData::pts
int64_t pts
Definition: img2.h:45
Windows::Graphics::DirectX::Direct3D11::p
IDirect3DDxgiInterfaceAccess _COM_Outptr_ void ** p
Definition: vsrc_gfxcapture_winrt.hpp:53
AVPacket::stream_index
int stream_index
Definition: packet.h:590
find_image_range
static int find_image_range(int *pfirst_index, int *plast_index, const char *path, int start_index, int start_index_range)
Get index range of image files matched by path.
Definition: img2dec.c:97
avio_skip
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: aviobuf.c:321
ff_img_read_packet
int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt)
Definition: img2dec.c:363
APP0
@ APP0
Definition: mjpeg.h:79
FFStream::index_entries
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
Definition: internal.h:184
pbm_probe
static int pbm_probe(const AVProbeData *p)
Definition: img2dec.c:1015
AVIO_FLAG_READ
#define AVIO_FLAG_READ
read-only
Definition: avio.h:617
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:200
read_probe
static int read_probe(const AVProbeData *p)
Definition: cdg.c:30
mem.h
vbn.h
ffio_rewind_with_probe_data
int ffio_rewind_with_probe_data(AVIOContext *s, unsigned char **buf, int buf_size)
Rewind the AVIOContext using the specified buffer containing the first buf_size bytes of the file.
Definition: aviobuf.c:1151
SOI
@ SOI
Definition: mjpeg.h:70
AVCodecParameters::format
int format
Definition: codec_par.h:92
SOF1
@ SOF1
Definition: mjpeg.h:40
w
uint8_t w
Definition: llvidencdsp.c:39
VideoDemuxData::ts_from_file
int ts_from_file
Definition: img2.h:61
av_free
#define av_free(p)
Definition: tableprint_vlc.h:34
FFALIGN
#define FFALIGN(x, a)
Definition: macros.h:78
AVCodecParameters::codec_id
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:55
AVPacket
This structure stores compressed data.
Definition: packet.h:565
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition: opt.h:327
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
av_dict_set
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
Definition: dict.c:86
AVPacket::pos
int64_t pos
byte position in stream, -1 if unknown
Definition: packet.h:608
tiff_probe
static int tiff_probe(const AVProbeData *p)
Definition: img2dec.c:977
FFInputFormat
Definition: demux.h:47
XWD_VERSION
#define XWD_VERSION
Definition: xwd.h:26
AVSTREAM_PARSE_FULL
@ AVSTREAM_PARSE_FULL
full parsing and repack
Definition: avformat.h:589
jpegxl_parse.h
APP10
@ APP10
Definition: mjpeg.h:89
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
FFStream::parser
struct AVCodecParserContext * parser
Definition: internal.h:315
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
MKTAG
#define MKTAG(a, b, c, d)
Definition: macros.h:55
h
h
Definition: vp9dsp_template.c:2070
SOF7
@ SOF7
Definition: mjpeg.h:46
ff_subtitles_next_line
static av_always_inline int ff_subtitles_next_line(const char *ptr)
Get the number of characters to increment to jump to the next line, or to the end of the string.
Definition: subtitles.h:205
AVStream::start_time
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
Definition: avformat.h:793
avstring.h
width
#define width
Definition: dsp.h:89
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
AV_CODEC_ID_LJPEG
@ AV_CODEC_ID_LJPEG
Definition: codec_id.h:61
SOF6
@ SOF6
Definition: mjpeg.h:45
AVFormatContext::priv_data
void * priv_data
Format private data.
Definition: avformat.h:1292
qdraw_probe
static int qdraw_probe(const AVProbeData *p)
Definition: img2dec.c:869
AV_RB64
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_RB64
Definition: bytestream.h:95
JPG
@ JPG
Definition: mjpeg.h:47
AV_RB16
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16
Definition: bytestream.h:98
av_realloc
void * av_realloc(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory.
Definition: mem.c:155
av_index_search_timestamp
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
Get the index for a specific timestamp.
Definition: seek.c:245
avio_feof
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
Definition: aviobuf.c:349