FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 #define _DEFAULT_SOURCE
24 #define _BSD_SOURCE
25 #include <sys/stat.h>
26 #include "libavutil/avstring.h"
27 #include "libavutil/log.h"
28 #include "libavutil/opt.h"
29 #include "libavutil/pixdesc.h"
30 #include "libavutil/parseutils.h"
31 #include "libavutil/intreadwrite.h"
32 #include "avformat.h"
33 #include "avio_internal.h"
34 #include "internal.h"
35 #include "img2.h"
36 #include "libavcodec/mjpeg.h"
37 
38 #if HAVE_GLOB
39 /* Locally define as 0 (bitwise-OR no-op) any missing glob options that
40  are non-posix glibc/bsd extensions. */
41 #ifndef GLOB_NOMAGIC
42 #define GLOB_NOMAGIC 0
43 #endif
44 #ifndef GLOB_BRACE
45 #define GLOB_BRACE 0
46 #endif
47 
48 #endif /* HAVE_GLOB */
49 
50 static const int sizes[][2] = {
51  { 640, 480 },
52  { 720, 480 },
53  { 720, 576 },
54  { 352, 288 },
55  { 352, 240 },
56  { 160, 128 },
57  { 512, 384 },
58  { 640, 352 },
59  { 640, 240 },
60 };
61 
62 static int infer_size(int *width_ptr, int *height_ptr, int size)
63 {
64  int i;
65 
66  for (i = 0; i < FF_ARRAY_ELEMS(sizes); i++) {
67  if ((sizes[i][0] * sizes[i][1]) == size) {
68  *width_ptr = sizes[i][0];
69  *height_ptr = sizes[i][1];
70  return 0;
71  }
72  }
73 
74  return -1;
75 }
76 
77 static int is_glob(const char *path)
78 {
79 #if HAVE_GLOB
80  size_t span = 0;
81  const char *p = path;
82 
83  while (p = strchr(p, '%')) {
84  if (*(++p) == '%') {
85  ++p;
86  continue;
87  }
88  if (span = strspn(p, "*?[]{}"))
89  break;
90  }
91  /* Did we hit a glob char or get to the end? */
92  return span != 0;
93 #else
94  return 0;
95 #endif
96 }
97 
98 /**
99  * Get index range of image files matched by path.
100  *
101  * @param pfirst_index pointer to index updated with the first number in the range
102  * @param plast_index pointer to index updated with the last number in the range
103  * @param path path which has to be matched by the image files in the range
104  * @param start_index minimum accepted value for the first index in the range
105  * @return -1 if no image file could be found
106  */
107 static int find_image_range(AVIOContext *pb, int *pfirst_index, int *plast_index,
108  const char *path, int start_index, int start_index_range)
109 {
110  char buf[1024];
111  int range, last_index, range1, first_index;
112 
113  /* find the first image */
114  for (first_index = start_index; first_index < start_index + start_index_range; first_index++) {
115  if (av_get_frame_filename(buf, sizeof(buf), path, first_index) < 0) {
116  *pfirst_index =
117  *plast_index = 1;
118  if (pb || avio_check(buf, AVIO_FLAG_READ) > 0)
119  return 0;
120  return -1;
121  }
122  if (avio_check(buf, AVIO_FLAG_READ) > 0)
123  break;
124  }
125  if (first_index == start_index + start_index_range)
126  goto fail;
127 
128  /* find the last image */
129  last_index = first_index;
130  for (;;) {
131  range = 0;
132  for (;;) {
133  if (!range)
134  range1 = 1;
135  else
136  range1 = 2 * range;
137  if (av_get_frame_filename(buf, sizeof(buf), path,
138  last_index + range1) < 0)
139  goto fail;
140  if (avio_check(buf, AVIO_FLAG_READ) <= 0)
141  break;
142  range = range1;
143  /* just in case... */
144  if (range >= (1 << 30))
145  goto fail;
146  }
147  /* we are sure than image last_index + range exists */
148  if (!range)
149  break;
150  last_index += range;
151  }
152  *pfirst_index = first_index;
153  *plast_index = last_index;
154  return 0;
155 
156 fail:
157  return -1;
158 }
159 
161 {
162  if (p->filename && ff_guess_image2_codec(p->filename)) {
164  return AVPROBE_SCORE_MAX;
165  else if (is_glob(p->filename))
166  return AVPROBE_SCORE_MAX;
167  else if (p->filename[strcspn(p->filename, "*?{")]) // probably PT_GLOB
168  return AVPROBE_SCORE_EXTENSION + 2; // score chosen to be a tad above the image pipes
169  else if (p->buf_size == 0)
170  return 0;
171  else if (av_match_ext(p->filename, "raw") || av_match_ext(p->filename, "gif"))
172  return 5;
173  else
175  }
176  return 0;
177 }
178 
180 {
181  VideoDemuxData *s = s1->priv_data;
182  int first_index = 1, last_index = 1;
183  AVStream *st;
185 
187 
188  st = avformat_new_stream(s1, NULL);
189  if (!st) {
190  return AVERROR(ENOMEM);
191  }
192 
193  if (s->pixel_format &&
194  (pix_fmt = av_get_pix_fmt(s->pixel_format)) == AV_PIX_FMT_NONE) {
195  av_log(s1, AV_LOG_ERROR, "No such pixel format: %s.\n",
196  s->pixel_format);
197  return AVERROR(EINVAL);
198  }
199 
200  av_strlcpy(s->path, s1->filename, sizeof(s->path));
201  s->img_number = 0;
202  s->img_count = 0;
203 
204  /* find format */
205  if (s1->iformat->flags & AVFMT_NOFILE)
206  s->is_pipe = 0;
207  else {
208  s->is_pipe = 1;
210  }
211 
212  if (s->ts_from_file == 2) {
213 #if !HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
214  av_log(s1, AV_LOG_ERROR, "POSIX.1-2008 not supported, nanosecond file timestamps unavailable\n");
215  return AVERROR(ENOSYS);
216 #endif
217  avpriv_set_pts_info(st, 64, 1, 1000000000);
218  } else if (s->ts_from_file)
219  avpriv_set_pts_info(st, 64, 1, 1);
220  else
222 
223  if (s->width && s->height) {
224  st->codecpar->width = s->width;
225  st->codecpar->height = s->height;
226  }
227 
228  if (!s->is_pipe) {
229  if (s->pattern_type == PT_DEFAULT) {
230  if (s1->pb) {
231  s->pattern_type = PT_NONE;
232  } else
234  }
235 
236  if (s->pattern_type == PT_GLOB_SEQUENCE) {
237  s->use_glob = is_glob(s->path);
238  if (s->use_glob) {
239 #if HAVE_GLOB
240  char *p = s->path, *q, *dup;
241  int gerr;
242 #endif
243 
244  av_log(s1, AV_LOG_WARNING, "Pattern type 'glob_sequence' is deprecated: "
245  "use pattern_type 'glob' instead\n");
246 #if HAVE_GLOB
247  dup = q = av_strdup(p);
248  while (*q) {
249  /* Do we have room for the next char and a \ insertion? */
250  if ((p - s->path) >= (sizeof(s->path) - 2))
251  break;
252  if (*q == '%' && strspn(q + 1, "%*?[]{}"))
253  ++q;
254  else if (strspn(q, "\\*?[]{}"))
255  *p++ = '\\';
256  *p++ = *q++;
257  }
258  *p = 0;
259  av_free(dup);
260 
261  gerr = glob(s->path, GLOB_NOCHECK|GLOB_BRACE|GLOB_NOMAGIC, NULL, &s->globstate);
262  if (gerr != 0) {
263  return AVERROR(ENOENT);
264  }
265  first_index = 0;
266  last_index = s->globstate.gl_pathc - 1;
267 #endif
268  }
269  }
270  if ((s->pattern_type == PT_GLOB_SEQUENCE && !s->use_glob) || s->pattern_type == PT_SEQUENCE) {
271  if (find_image_range(s1->pb, &first_index, &last_index, s->path,
272  s->start_number, s->start_number_range) < 0) {
273  av_log(s1, AV_LOG_ERROR,
274  "Could find no file with path '%s' and index in the range %d-%d\n",
275  s->path, s->start_number, s->start_number + s->start_number_range - 1);
276  return AVERROR(ENOENT);
277  }
278  } else if (s->pattern_type == PT_GLOB) {
279 #if HAVE_GLOB
280  int gerr;
281  gerr = glob(s->path, GLOB_NOCHECK|GLOB_BRACE|GLOB_NOMAGIC, NULL, &s->globstate);
282  if (gerr != 0) {
283  return AVERROR(ENOENT);
284  }
285  first_index = 0;
286  last_index = s->globstate.gl_pathc - 1;
287  s->use_glob = 1;
288 #else
289  av_log(s1, AV_LOG_ERROR,
290  "Pattern type 'glob' was selected but globbing "
291  "is not supported by this libavformat build\n");
292  return AVERROR(ENOSYS);
293 #endif
294  } else if (s->pattern_type != PT_GLOB_SEQUENCE && s->pattern_type != PT_NONE) {
295  av_log(s1, AV_LOG_ERROR,
296  "Unknown value '%d' for pattern_type option\n", s->pattern_type);
297  return AVERROR(EINVAL);
298  }
299  s->img_first = first_index;
300  s->img_last = last_index;
301  s->img_number = first_index;
302  /* compute duration */
303  if (!s->ts_from_file) {
304  st->start_time = 0;
305  st->duration = last_index - first_index + 1;
306  }
307  }
308 
309  if (s1->video_codec_id) {
311  st->codecpar->codec_id = s1->video_codec_id;
312  } else if (s1->audio_codec_id) {
314  st->codecpar->codec_id = s1->audio_codec_id;
315  } else if (s1->iformat->raw_codec_id) {
318  } else {
319  const char *str = strrchr(s->path, '.');
320  s->split_planes = str && !av_strcasecmp(str + 1, "y");
322  if (s1->pb) {
323  int probe_buffer_size = 2048;
324  uint8_t *probe_buffer = av_realloc(NULL, probe_buffer_size + AVPROBE_PADDING_SIZE);
326  AVProbeData pd = { 0 };
327 
328  if (!probe_buffer)
329  return AVERROR(ENOMEM);
330 
331  probe_buffer_size = avio_read(s1->pb, probe_buffer, probe_buffer_size);
332  if (probe_buffer_size < 0) {
333  av_free(probe_buffer);
334  return probe_buffer_size;
335  }
336  memset(probe_buffer + probe_buffer_size, 0, AVPROBE_PADDING_SIZE);
337 
338  pd.buf = probe_buffer;
339  pd.buf_size = probe_buffer_size;
340  pd.filename = s1->filename;
341 
342  while ((fmt = av_iformat_next(fmt))) {
343  if (fmt->read_header != ff_img_read_header ||
344  !fmt->read_probe ||
345  (fmt->flags & AVFMT_NOFILE) ||
346  !fmt->raw_codec_id)
347  continue;
348  if (fmt->read_probe(&pd) > 0) {
349  st->codecpar->codec_id = fmt->raw_codec_id;
350  break;
351  }
352  }
353  if (s1->flags & AVFMT_FLAG_CUSTOM_IO) {
354  avio_seek(s1->pb, 0, SEEK_SET);
355  } else
356  ffio_rewind_with_probe_data(s1->pb, &probe_buffer, probe_buffer_size);
357  }
358  if (st->codecpar->codec_id == AV_CODEC_ID_NONE)
360  if (st->codecpar->codec_id == AV_CODEC_ID_LJPEG)
362  if (st->codecpar->codec_id == AV_CODEC_ID_ALIAS_PIX) // we cannot distingiush this from BRENDER_PIX
364  }
365  if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
366  pix_fmt != AV_PIX_FMT_NONE)
367  st->codecpar->format = pix_fmt;
368 
369  return 0;
370 }
371 
373 {
374  VideoDemuxData *s = s1->priv_data;
375  char filename_bytes[1024];
376  char *filename = filename_bytes;
377  int i, res;
378  int size[3] = { 0 }, ret[3] = { 0 };
379  AVIOContext *f[3] = { NULL };
380  AVCodecParameters *par = s1->streams[0]->codecpar;
381 
382  if (!s->is_pipe) {
383  /* loop over input */
384  if (s->loop && s->img_number > s->img_last) {
385  s->img_number = s->img_first;
386  }
387  if (s->img_number > s->img_last)
388  return AVERROR_EOF;
389  if (s->pattern_type == PT_NONE) {
390  av_strlcpy(filename_bytes, s->path, sizeof(filename_bytes));
391  } else if (s->use_glob) {
392 #if HAVE_GLOB
393  filename = s->globstate.gl_pathv[s->img_number];
394 #endif
395  } else {
396  if (av_get_frame_filename(filename_bytes, sizeof(filename_bytes),
397  s->path,
398  s->img_number) < 0 && s->img_number > 1)
399  return AVERROR(EIO);
400  }
401  for (i = 0; i < 3; i++) {
402  if (s1->pb &&
403  !strcmp(filename_bytes, s->path) &&
404  !s->loop &&
405  !s->split_planes) {
406  f[i] = s1->pb;
407  } else if (s1->io_open(s1, &f[i], filename, AVIO_FLAG_READ, NULL) < 0) {
408  if (i >= 1)
409  break;
410  av_log(s1, AV_LOG_ERROR, "Could not open file : %s\n",
411  filename);
412  return AVERROR(EIO);
413  }
414  size[i] = avio_size(f[i]);
415 
416  if (!s->split_planes)
417  break;
418  filename[strlen(filename) - 1] = 'U' + i;
419  }
420 
421  if (par->codec_id == AV_CODEC_ID_NONE) {
422  AVProbeData pd = { 0 };
423  AVInputFormat *ifmt;
425  int ret;
426  int score = 0;
427 
428  ret = avio_read(f[0], header, PROBE_BUF_MIN);
429  if (ret < 0)
430  return ret;
431  memset(header + ret, 0, sizeof(header) - ret);
432  avio_skip(f[0], -ret);
433  pd.buf = header;
434  pd.buf_size = ret;
435  pd.filename = filename;
436 
437  ifmt = av_probe_input_format3(&pd, 1, &score);
438  if (ifmt && ifmt->read_packet == ff_img_read_packet && ifmt->raw_codec_id)
439  par->codec_id = ifmt->raw_codec_id;
440  }
441 
442  if (par->codec_id == AV_CODEC_ID_RAWVIDEO && !par->width)
443  infer_size(&par->width, &par->height, size[0]);
444  } else {
445  f[0] = s1->pb;
446  if (avio_feof(f[0]) && s->loop && s->is_pipe)
447  avio_seek(f[0], 0, SEEK_SET);
448  if (avio_feof(f[0]))
449  return AVERROR_EOF;
450  if (s->frame_size > 0) {
451  size[0] = s->frame_size;
452  } else if (!s1->streams[0]->parser) {
453  size[0] = avio_size(s1->pb);
454  } else {
455  size[0] = 4096;
456  }
457  }
458 
459  res = av_new_packet(pkt, size[0] + size[1] + size[2]);
460  if (res < 0) {
461  goto fail;
462  }
463  pkt->stream_index = 0;
464  pkt->flags |= AV_PKT_FLAG_KEY;
465  if (s->ts_from_file) {
466  struct stat img_stat;
467  if (stat(filename, &img_stat)) {
468  res = AVERROR(EIO);
469  goto fail;
470  }
471  pkt->pts = (int64_t)img_stat.st_mtime;
472 #if HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
473  if (s->ts_from_file == 2)
474  pkt->pts = 1000000000*pkt->pts + img_stat.st_mtim.tv_nsec;
475 #endif
476  av_add_index_entry(s1->streams[0], s->img_number, pkt->pts, 0, 0, AVINDEX_KEYFRAME);
477  } else if (!s->is_pipe) {
478  pkt->pts = s->pts;
479  }
480 
481  if (s->is_pipe)
482  pkt->pos = avio_tell(f[0]);
483 
484  pkt->size = 0;
485  for (i = 0; i < 3; i++) {
486  if (f[i]) {
487  ret[i] = avio_read(f[i], pkt->data + pkt->size, size[i]);
488  if (s->loop && s->is_pipe && ret[i] == AVERROR_EOF) {
489  if (avio_seek(f[i], 0, SEEK_SET) >= 0) {
490  pkt->pos = 0;
491  ret[i] = avio_read(f[i], pkt->data + pkt->size, size[i]);
492  }
493  }
494  if (!s->is_pipe && f[i] != s1->pb)
495  ff_format_io_close(s1, &f[i]);
496  if (ret[i] > 0)
497  pkt->size += ret[i];
498  }
499  }
500 
501  if (ret[0] <= 0 || ret[1] < 0 || ret[2] < 0) {
502  av_packet_unref(pkt);
503  if (ret[0] < 0) {
504  res = ret[0];
505  } else if (ret[1] < 0) {
506  res = ret[1];
507  } else if (ret[2] < 0) {
508  res = ret[2];
509  } else {
510  res = AVERROR_EOF;
511  }
512  goto fail;
513  } else {
514  s->img_count++;
515  s->img_number++;
516  s->pts++;
517  return 0;
518  }
519 
520 fail:
521  if (!s->is_pipe) {
522  for (i = 0; i < 3; i++) {
523  if (f[i] != s1->pb)
524  ff_format_io_close(s1, &f[i]);
525  }
526  }
527  return res;
528 }
529 
530 static int img_read_close(struct AVFormatContext* s1)
531 {
532 #if HAVE_GLOB
533  VideoDemuxData *s = s1->priv_data;
534  if (s->use_glob) {
535  globfree(&s->globstate);
536  }
537 #endif
538  return 0;
539 }
540 
541 static int img_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
542 {
544  AVStream *st = s->streams[0];
545 
546  if (s1->ts_from_file) {
547  int index = av_index_search_timestamp(st, timestamp, flags);
548  if(index < 0)
549  return -1;
550  s1->img_number = st->index_entries[index].pos;
551  return 0;
552  }
553 
554  if (timestamp < 0 || !s1->loop && timestamp > s1->img_last - s1->img_first)
555  return -1;
556  s1->img_number = timestamp%(s1->img_last - s1->img_first + 1) + s1->img_first;
557  s1->pts = timestamp;
558  return 0;
559 }
560 
561 #define OFFSET(x) offsetof(VideoDemuxData, x)
562 #define DEC AV_OPT_FLAG_DECODING_PARAM
564  { "framerate", "set the video framerate", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, DEC },
565  { "loop", "force loop over input file sequence", OFFSET(loop), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, DEC },
566 
567  { "pattern_type", "set pattern type", OFFSET(pattern_type), AV_OPT_TYPE_INT, {.i64=PT_DEFAULT}, 0, INT_MAX, DEC, "pattern_type"},
568  { "glob_sequence","select glob/sequence pattern type", 0, AV_OPT_TYPE_CONST, {.i64=PT_GLOB_SEQUENCE}, INT_MIN, INT_MAX, DEC, "pattern_type" },
569  { "glob", "select glob pattern type", 0, AV_OPT_TYPE_CONST, {.i64=PT_GLOB }, INT_MIN, INT_MAX, DEC, "pattern_type" },
570  { "sequence", "select sequence pattern type", 0, AV_OPT_TYPE_CONST, {.i64=PT_SEQUENCE }, INT_MIN, INT_MAX, DEC, "pattern_type" },
571  { "none", "disable pattern matching", 0, AV_OPT_TYPE_CONST, {.i64=PT_NONE }, INT_MIN, INT_MAX, DEC, "pattern_type" },
572 
573  { "pixel_format", "set video pixel format", OFFSET(pixel_format), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
574  { "start_number", "set first number in the sequence", OFFSET(start_number), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, DEC },
575  { "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 },
576  { "video_size", "set video size", OFFSET(width), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, DEC },
577  { "frame_size", "force frame size in bytes", OFFSET(frame_size), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, DEC },
578  { "ts_from_file", "set frame timestamp from file's one", OFFSET(ts_from_file), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 2, DEC, "ts_type" },
579  { "none", "none", 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, 0, 2, DEC, "ts_type" },
580  { "sec", "second precision", 0, AV_OPT_TYPE_CONST, {.i64 = 1 }, 0, 2, DEC, "ts_type" },
581  { "ns", "nano second precision", 0, AV_OPT_TYPE_CONST, {.i64 = 2 }, 0, 2, DEC, "ts_type" },
582  { NULL },
583 };
584 
585 #if CONFIG_IMAGE2_DEMUXER
586 static const AVClass img2_class = {
587  .class_name = "image2 demuxer",
588  .item_name = av_default_item_name,
589  .option = ff_img_options,
590  .version = LIBAVUTIL_VERSION_INT,
591 };
592 AVInputFormat ff_image2_demuxer = {
593  .name = "image2",
594  .long_name = NULL_IF_CONFIG_SMALL("image2 sequence"),
595  .priv_data_size = sizeof(VideoDemuxData),
601  .flags = AVFMT_NOFILE,
602  .priv_class = &img2_class,
603 };
604 #endif
605 #if CONFIG_IMAGE2PIPE_DEMUXER
606 static const AVClass img2pipe_class = {
607  .class_name = "image2pipe demuxer",
608  .item_name = av_default_item_name,
609  .option = ff_img_options,
610  .version = LIBAVUTIL_VERSION_INT,
611 };
612 AVInputFormat ff_image2pipe_demuxer = {
613  .name = "image2pipe",
614  .long_name = NULL_IF_CONFIG_SMALL("piped image2 sequence"),
615  .priv_data_size = sizeof(VideoDemuxData),
618  .priv_class = &img2pipe_class,
619 };
620 #endif
621 
622 static int bmp_probe(AVProbeData *p)
623 {
624  const uint8_t *b = p->buf;
625  int ihsize;
626 
627  if (AV_RB16(b) != 0x424d)
628  return 0;
629 
630  ihsize = AV_RL32(b+14);
631  if (ihsize < 12 || ihsize > 255)
632  return 0;
633 
634  if (!AV_RN32(b + 6)) {
635  return AVPROBE_SCORE_EXTENSION + 1;
636  }
637  return AVPROBE_SCORE_EXTENSION / 4;
638 }
639 
640 static int dds_probe(AVProbeData *p)
641 {
642  const uint8_t *b = p->buf;
643 
644  if ( AV_RB64(b) == 0x444453207c000000
645  && AV_RL32(b + 8)
646  && AV_RL32(b + 12))
647  return AVPROBE_SCORE_MAX - 1;
648  return 0;
649 }
650 
651 static int dpx_probe(AVProbeData *p)
652 {
653  const uint8_t *b = p->buf;
654  int w, h;
655  int is_big = (AV_RN32(b) == AV_RN32("SDPX"));
656 
657  if (p->buf_size < 0x304+8)
658  return 0;
659  w = is_big ? AV_RB32(p->buf + 0x304) : AV_RL32(p->buf + 0x304);
660  h = is_big ? AV_RB32(p->buf + 0x308) : AV_RL32(p->buf + 0x308);
661  if (w <= 0 || h <= 0)
662  return 0;
663 
664  if (is_big || AV_RN32(b) == AV_RN32("XPDS"))
665  return AVPROBE_SCORE_EXTENSION + 1;
666  return 0;
667 }
668 
669 static int exr_probe(AVProbeData *p)
670 {
671  const uint8_t *b = p->buf;
672 
673  if (AV_RL32(b) == 20000630)
674  return AVPROBE_SCORE_EXTENSION + 1;
675  return 0;
676 }
677 
678 static int j2k_probe(AVProbeData *p)
679 {
680  const uint8_t *b = p->buf;
681 
682  if (AV_RB64(b) == 0x0000000c6a502020 ||
683  AV_RB32(b) == 0xff4fff51)
684  return AVPROBE_SCORE_EXTENSION + 1;
685  return 0;
686 }
687 
688 static int jpeg_probe(AVProbeData *p)
689 {
690  const uint8_t *b = p->buf;
691  int i, state = SOI;
692 
693  if (AV_RB16(b) != 0xFFD8 ||
694  AV_RB32(b) == 0xFFD8FFF7)
695  return 0;
696 
697  b += 2;
698  for (i = 0; i < p->buf_size - 3; i++) {
699  int c;
700  if (b[i] != 0xFF)
701  continue;
702  c = b[i + 1];
703  switch (c) {
704  case SOI:
705  return 0;
706  case SOF0:
707  case SOF1:
708  case SOF2:
709  case SOF3:
710  case SOF5:
711  case SOF6:
712  case SOF7:
713  i += AV_RB16(&b[i + 2]) + 1;
714  if (state != SOI)
715  return 0;
716  state = SOF0;
717  break;
718  case SOS:
719  i += AV_RB16(&b[i + 2]) + 1;
720  if (state != SOF0 && state != SOS)
721  return 0;
722  state = SOS;
723  break;
724  case EOI:
725  if (state != SOS)
726  return 0;
727  state = EOI;
728  break;
729  case DQT:
730  case APP0:
731  case APP1:
732  case APP2:
733  case APP3:
734  case APP4:
735  case APP5:
736  case APP6:
737  case APP7:
738  case APP8:
739  case APP9:
740  case APP10:
741  case APP11:
742  case APP12:
743  case APP13:
744  case APP14:
745  case APP15:
746  case COM:
747  i += AV_RB16(&b[i + 2]) + 1;
748  break;
749  default:
750  if ( (c > TEM && c < SOF0)
751  || c == JPG)
752  return 0;
753  }
754  }
755 
756  if (state == EOI)
757  return AVPROBE_SCORE_EXTENSION + 1;
758  return AVPROBE_SCORE_EXTENSION / 8;
759 }
760 
761 static int jpegls_probe(AVProbeData *p)
762 {
763  const uint8_t *b = p->buf;
764 
765  if (AV_RB32(b) == 0xffd8fff7)
766  return AVPROBE_SCORE_EXTENSION + 1;
767  return 0;
768 }
769 
770 static int pcx_probe(AVProbeData *p)
771 {
772  const uint8_t *b = p->buf;
773 
774  if ( p->buf_size < 128
775  || b[0] != 10
776  || b[1] > 5
777  || b[2] > 1
778  || av_popcount(b[3]) != 1 || b[3] > 8
779  || AV_RL16(&b[4]) > AV_RL16(&b[8])
780  || AV_RL16(&b[6]) > AV_RL16(&b[10])
781  || b[64])
782  return 0;
783  b += 73;
784  while (++b < p->buf + 128)
785  if (*b)
786  return AVPROBE_SCORE_EXTENSION / 4;
787 
788  return AVPROBE_SCORE_EXTENSION + 1;
789 }
790 
791 static int qdraw_probe(AVProbeData *p)
792 {
793  const uint8_t *b = p->buf;
794 
795  if ( p->buf_size >= 528
796  && (AV_RB64(b + 520) & 0xFFFFFFFFFFFF) == 0x001102ff0c00
797  && AV_RB16(b + 520)
798  && AV_RB16(b + 518))
799  return AVPROBE_SCORE_MAX * 3 / 4;
800  if ( (AV_RB64(b + 8) & 0xFFFFFFFFFFFF) == 0x001102ff0c00
801  && AV_RB16(b + 8)
802  && AV_RB16(b + 6))
803  return AVPROBE_SCORE_EXTENSION / 4;
804  return 0;
805 }
806 
807 static int pictor_probe(AVProbeData *p)
808 {
809  const uint8_t *b = p->buf;
810 
811  if (AV_RL16(b) == 0x1234)
812  return AVPROBE_SCORE_EXTENSION / 4;
813  return 0;
814 }
815 
816 static int png_probe(AVProbeData *p)
817 {
818  const uint8_t *b = p->buf;
819 
820  if (AV_RB64(b) == 0x89504e470d0a1a0a)
821  return AVPROBE_SCORE_MAX - 1;
822  return 0;
823 }
824 
825 static int sgi_probe(AVProbeData *p)
826 {
827  const uint8_t *b = p->buf;
828 
829  if (AV_RB16(b) == 474 &&
830  (b[2] & ~1) == 0 &&
831  (b[3] & ~3) == 0 && b[3] &&
832  (AV_RB16(b + 4) & ~7) == 0 && AV_RB16(b + 4))
833  return AVPROBE_SCORE_EXTENSION + 1;
834  return 0;
835 }
836 
838 {
839  const uint8_t *b = p->buf;
840 
841  if (AV_RB32(b) == 0x59a66a95)
842  return AVPROBE_SCORE_EXTENSION + 1;
843  return 0;
844 }
845 
846 static int tiff_probe(AVProbeData *p)
847 {
848  const uint8_t *b = p->buf;
849 
850  if (AV_RB32(b) == 0x49492a00 ||
851  AV_RB32(b) == 0x4D4D002a)
852  return AVPROBE_SCORE_EXTENSION + 1;
853  return 0;
854 }
855 
856 static int webp_probe(AVProbeData *p)
857 {
858  const uint8_t *b = p->buf;
859 
860  if (AV_RB32(b) == 0x52494646 &&
861  AV_RB32(b + 8) == 0x57454250)
862  return AVPROBE_SCORE_MAX - 1;
863  return 0;
864 }
865 
866 static int pnm_magic_check(const AVProbeData *p, int magic)
867 {
868  const uint8_t *b = p->buf;
869 
870  return b[0] == 'P' && b[1] == magic + '0';
871 }
872 
873 static inline int pnm_probe(const AVProbeData *p)
874 {
875  const uint8_t *b = p->buf;
876 
877  while (b[2] == '\r')
878  b++;
879  if (b[2] == '\n' && (b[3] == '#' || (b[3] >= '0' && b[3] <= '9')))
880  return AVPROBE_SCORE_EXTENSION + 2;
881  return 0;
882 }
883 
884 static int pbm_probe(AVProbeData *p)
885 {
886  return pnm_magic_check(p, 1) || pnm_magic_check(p, 4) ? pnm_probe(p) : 0;
887 }
888 
889 static inline int pgmx_probe(AVProbeData *p)
890 {
891  return pnm_magic_check(p, 2) || pnm_magic_check(p, 5) ? pnm_probe(p) : 0;
892 }
893 
894 static int pgm_probe(AVProbeData *p)
895 {
896  int ret = pgmx_probe(p);
897  return ret && !av_match_ext(p->filename, "pgmyuv") ? ret : 0;
898 }
899 
900 static int pgmyuv_probe(AVProbeData *p) // custom FFmpeg format recognized by file extension
901 {
902  int ret = pgmx_probe(p);
903  return ret && av_match_ext(p->filename, "pgmyuv") ? ret : 0;
904 }
905 
906 static int ppm_probe(AVProbeData *p)
907 {
908  return pnm_magic_check(p, 3) || pnm_magic_check(p, 6) ? pnm_probe(p) : 0;
909 }
910 
911 static int pam_probe(AVProbeData *p)
912 {
913  return pnm_magic_check(p, 7) ? pnm_probe(p) : 0;
914 }
915 
916 #define IMAGEAUTO_DEMUXER(imgname, codecid)\
917 static const AVClass imgname ## _class = {\
918  .class_name = AV_STRINGIFY(imgname) " demuxer",\
919  .item_name = av_default_item_name,\
920  .option = ff_img_options,\
921  .version = LIBAVUTIL_VERSION_INT,\
922 };\
923 AVInputFormat ff_image_ ## imgname ## _pipe_demuxer = {\
924  .name = AV_STRINGIFY(imgname) "_pipe",\
925  .long_name = NULL_IF_CONFIG_SMALL("piped " AV_STRINGIFY(imgname) " sequence"),\
926  .priv_data_size = sizeof(VideoDemuxData),\
927  .read_probe = imgname ## _probe,\
928  .read_header = ff_img_read_header,\
929  .read_packet = ff_img_read_packet,\
930  .priv_class = & imgname ## _class,\
931  .flags = AVFMT_GENERIC_INDEX, \
932  .raw_codec_id = codecid,\
933 };
934 
Definition: mjpeg.h:93
int img_number
Definition: img2.h:45
#define NULL
Definition: coverity.c:32
const char * s
Definition: avisynth_c.h:768
Bytestream IO Context.
Definition: avio.h:147
static enum AVPixelFormat pix_fmt
int height
Set by a private option.
Definition: img2.h:52
static int img_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
Definition: img2dec.c:541
int64_t avio_size(AVIOContext *s)
Get the filesize.
Definition: aviobuf.c:309
Definition: mjpeg.h:81
static int pcx_probe(AVProbeData *p)
Definition: img2dec.c:770
static int bmp_probe(AVProbeData *p)
Definition: img2dec.c:622
AVOption.
Definition: opt.h:245
void * av_realloc(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory.
Definition: mem.c:145
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: utils.c:1945
#define OFFSET(x)
Definition: img2dec.c:561
Definition: mjpeg.h:71
Definition: mjpeg.h:111
Definition: mjpeg.h:73
static int qdraw_probe(AVProbeData *p)
Definition: img2dec.c:791
const char * fmt
Definition: avisynth_c.h:769
Definition: mjpeg.h:40
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:182
Definition: mjpeg.h:42
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
const char * filename
Definition: avformat.h:462
int64_t pos
byte position in stream, -1 if unknown
Definition: avcodec.h:1621
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:989
void avpriv_set_pts_info(AVStream *s, int pts_wrap_bits, unsigned int pts_num, unsigned int pts_den)
Set the time base and wrapping info for a given stream.
Definition: utils.c:4560
int64_t pos
Definition: avformat.h:820
char path[1024]
Definition: img2.h:50
static int pgm_probe(AVProbeData *p)
Definition: img2dec.c:894
static int j2k_probe(AVProbeData *p)
Definition: img2dec.c:678
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
Definition: libcdio.c:153
static int img_read_close(struct AVFormatContext *s1)
Definition: img2dec.c:530
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: avcodec.h:3980
int num
Numerator.
Definition: rational.h:59
int size
Definition: avcodec.h:1602
const char * b
Definition: vf_curves.c:113
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
Definition: aviobuf.c:230
#define AVIO_FLAG_READ
read-only
Definition: avio.h:606
#define AVPROBE_PADDING_SIZE
extra allocated bytes at the end of the probe buffer
Definition: avformat.h:475
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
Definition: avformat.h:1087
int start_number_range
Definition: img2.h:61
Definition: img2.h:37
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: aviobuf.c:304
AVInputFormat * av_probe_input_format3(AVProbeData *pd, int is_opened, int *score_ret)
Guess the file format.
Definition: format.c:173
static AVPacket pkt
int ctx_flags
Flags signalling stream properties.
Definition: avformat.h:1387
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:87
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
Definition: bytestream.h:87
MJPEG encoder and decoder.
static int png_probe(AVProbeData *p)
Definition: img2dec.c:816
This struct describes the properties of an encoded stream.
Definition: avcodec.h:3972
int img_count
Definition: img2.h:47
char * pixel_format
Set by a private option.
Definition: img2.h:51
#define IMAGEAUTO_DEMUXER(imgname, codecid)
Definition: img2dec.c:916
Format I/O context.
Definition: avformat.h:1338
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:480
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:72
Definition: mjpeg.h:72
uint8_t
static int dds_probe(AVProbeData *p)
Definition: img2dec.c:640
int width
Video only.
Definition: avcodec.h:4046
#define AVFMTCTX_NOHEADER
signal that no header is present (streams are added dynamically)
Definition: avformat.h:1291
AVOptions.
int pattern_type
PatternType.
Definition: img2.h:55
int flags
Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS, AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH, AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK, AVFMT_SEEK_TO_PTS.
Definition: avformat.h:678
static int pictor_probe(AVProbeData *p)
Definition: img2dec.c:807
enum AVStreamParseType need_parsing
Definition: avformat.h:1076
void ff_format_io_close(AVFormatContext *s, AVIOContext **pb)
Definition: utils.c:5255
Definition: mjpeg.h:46
Definition: mjpeg.h:113
int ff_img_read_header(AVFormatContext *s1)
Definition: img2dec.c:179
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
Definition: utils.c:4193
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:87
AVStream ** streams
A list of all streams in the file.
Definition: avformat.h:1406
Definition: mjpeg.h:86
int flags
Flags modifying the (de)muxer behaviour.
Definition: avformat.h:1449
uint8_t * data
Definition: avcodec.h:1601
int(* read_header)(struct AVFormatContext *)
Read the format header and initialize the AVFormatContext structure.
Definition: avformat.h:729
static int img_read_probe(AVProbeData *p)
Definition: img2dec.c:160
#define AVERROR_EOF
End of file.
Definition: error.h:55
static int webp_probe(AVProbeData *p)
Definition: img2dec.c:856
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:145
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:85
const AVOption ff_img_options[]
Definition: img2dec.c:563
ptrdiff_t size
Definition: opengl_enc.c:101
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition: avio.h:511
static const uint8_t header[24]
Definition: sdr2.c:67
Definition: mjpeg.h:87
enum AVCodecID video_codec_id
Forced video codec_id.
Definition: avformat.h:1500
#define av_log(a,...)
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:604
static int exr_probe(AVProbeData *p)
Definition: img2dec.c:669
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: avcodec.h:1633
static int is_glob(const char *path)
Definition: img2dec.c:77
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
Definition: avpacket.c:86
#define AVINDEX_KEYFRAME
Definition: avformat.h:827
int64_t pts
Definition: img2.h:46
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
Get the index for a specific timestamp.
Definition: utils.c:2054
int(* read_probe)(AVProbeData *)
Tell if a given file has a chance of being parsed as this format.
Definition: avformat.h:722
Definition: mjpeg.h:89
av_default_item_name
static const int sizes[][2]
Definition: img2dec.c:50
int loop
Definition: img2.h:54
#define AVERROR(e)
Definition: error.h:43
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
static int pgmyuv_probe(AVProbeData *p)
Definition: img2dec.c:900
int ts_from_file
Definition: img2.h:63
enum AVMediaType codec_type
General type of the encoded data.
Definition: avcodec.h:3976
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
Definition: avstring.c:83
#define fail()
Definition: checkasm.h:83
Definition: mjpeg.h:39
Definition: mjpeg.h:70
int flags
A combination of AV_PKT_FLAG values.
Definition: avcodec.h:1607
int buf_size
Size of buf except extra allocated bytes.
Definition: avformat.h:464
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
Definition: avformat.h:463
Definition: mjpeg.h:79
Definition: mjpeg.h:80
static int find_image_range(AVIOContext *pb, 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:107
char filename[1024]
input or output filename
Definition: avformat.h:1414
static int jpeg_probe(AVProbeData *p)
Definition: img2dec.c:688
enum AVCodecID audio_codec_id
Forced audio codec_id.
Definition: avformat.h:1506
Definition: mjpeg.h:44
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
Definition: avstring.c:213
#define width
static int read_probe(AVProbeData *pd)
Definition: jvdec.c:55
int is_pipe
Definition: img2.h:48
Definition: mjpeg.h:91
Definition: mjpeg.h:41
int width
Definition: img2.h:52
Definition: img2.h:35
static int sgi_probe(AVProbeData *p)
Definition: img2dec.c:825
#define AVFMT_FLAG_CUSTOM_IO
The caller has supplied a custom AVIOContext, don't avio_close() it.
Definition: avformat.h:1457
Definition: mjpeg.h:83
int start_number
Definition: img2.h:60
#define FF_ARRAY_ELEMS(a)
int av_get_frame_filename(char *buf, int buf_size, const char *path, int number)
Definition: utils.c:4435
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:514
#define PROBE_BUF_MIN
size of probe buffer, for guessing file type from file contents
Definition: internal.h:33
Stream structure.
Definition: avformat.h:889
#define DEC
Definition: img2dec.c:562
int frame_size
Definition: img2.h:62
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_reading.c:42
Definition: mjpeg.h:88
int frame_size
Definition: mxfenc.c:1820
char * av_strdup(const char *s)
Duplicate a string.
Definition: mem.c:267
AVIOContext * pb
I/O context.
Definition: avformat.h:1380
static int loop
Definition: ffplay.c:335
int split_planes
use independent file for each Y, U, V plane
Definition: img2.h:49
static int pbm_probe(AVProbeData *p)
Definition: img2dec.c:884
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition: avpacket.c:567
int av_filename_number_test(const char *filename)
Check whether filename actually is a numbered sequence generator.
Definition: utils.c:306
static struct @246 state
int(* read_packet)(struct AVFormatContext *, AVPacket *pkt)
Read one packet and put it in 'pkt'.
Definition: avformat.h:740
void * buf
Definition: avisynth_c.h:690
Definition: mjpeg.h:84
Describe the class of an AVClass context structure.
Definition: log.h:67
int index
Definition: gxfenc.c:89
static int infer_size(int *width_ptr, int *height_ptr, int size)
Definition: img2dec.c:62
offset must point to AVRational
Definition: opt.h:235
Definition: mjpeg.h:45
#define s1
Definition: regdef.h:38
#define AVPROBE_SCORE_EXTENSION
score for file extension
Definition: avformat.h:471
offset must point to two consecutive integers
Definition: opt.h:232
This structure contains the data a format has to probe a file.
Definition: avformat.h:461
#define AV_RN32(p)
Definition: intreadwrite.h:364
misc parsing utilities
static int pnm_probe(const AVProbeData *p)
Definition: img2dec.c:873
static int ppm_probe(AVProbeData *p)
Definition: img2dec.c:906
int img_last
Definition: img2.h:44
static int sunrast_probe(AVProbeData *p)
Definition: img2dec.c:837
int raw_codec_id
Raw demuxers store their codec ID here.
Definition: avformat.h:710
Definition: mjpeg.h:47
static int flags
Definition: cpu.c:47
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:943
static int dpx_probe(AVProbeData *p)
Definition: img2dec.c:651
Definition: mjpeg.h:94
#define AVPROBE_SCORE_MAX
maximum score
Definition: avformat.h:473
static int tiff_probe(AVProbeData *p)
Definition: img2dec.c:846
full parsing and repack
Definition: avformat.h:810
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:87
Main libavformat public API header.
if(ret< 0)
Definition: vf_mcdeint.c:282
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:478
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base...
Definition: avformat.h:936
Definition: mjpeg.h:90
static double c[64]
int den
Denominator.
Definition: rational.h:60
Definition: mjpeg.h:92
struct AVInputFormat * iformat
The input container format.
Definition: avformat.h:1350
enum AVCodecID ff_guess_image2_codec(const char *filename)
Definition: img2.c:99
#define av_free(p)
Definition: mjpeg.h:85
AVRational framerate
Set by a private option.
Definition: img2.h:53
struct AVCodecParserContext * parser
Definition: avformat.h:1077
void * priv_data
Format private data.
Definition: avformat.h:1366
static int pam_probe(AVProbeData *p)
Definition: img2dec.c:911
static int jpegls_probe(AVProbeData *p)
Definition: img2dec.c:761
int use_glob
Definition: img2.h:56
static int pgmx_probe(AVProbeData *p)
Definition: img2dec.c:889
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:664
AVCodecParameters * codecpar
Definition: avformat.h:1241
Definition: mjpeg.h:82
int avio_feof(AVIOContext *s)
feof() equivalent for AVIOContext.
Definition: aviobuf.c:328
enum AVPixelFormat av_get_pix_fmt(const char *name)
Return the pixel format corresponding to name.
Definition: pixdesc.c:2194
static int pnm_magic_check(const AVProbeData *p, int magic)
Definition: img2dec.c:866
int stream_index
Definition: avcodec.h:1603
int img_first
Definition: img2.h:43
int(* io_open)(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags, AVDictionary **options)
Definition: avformat.h:1898
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
Definition: bytestream.h:87
AVPixelFormat
Pixel format.
Definition: pixfmt.h:60
This structure stores compressed data.
Definition: avcodec.h:1578
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: avcodec.h:1594
int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt)
Definition: img2dec.c:372
AVInputFormat * av_iformat_next(const AVInputFormat *f)
If f is NULL, returns the first registered input format, if f is non-NULL, returns the next registere...
Definition: format.c:45