avprobe.c
Go to the documentation of this file.
1 /*
2  * avprobe : Simple Media Prober based on the Libav libraries
3  * Copyright (c) 2007-2010 Stefano Sabatini
4  *
5  * This file is part of Libav.
6  *
7  * Libav is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * Libav is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with Libav; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include "config.h"
23 
24 #include "libavformat/avformat.h"
25 #include "libavcodec/avcodec.h"
26 #include "libavutil/opt.h"
27 #include "libavutil/pixdesc.h"
28 #include "libavutil/dict.h"
29 #include "libavutil/libm.h"
30 #include "libavdevice/avdevice.h"
31 #include "cmdutils.h"
32 
33 const char program_name[] = "avprobe";
34 const int program_birth_year = 2007;
35 
36 static int do_show_format = 0;
39 static int do_show_packets = 0;
40 static int do_show_streams = 0;
41 
42 static int show_value_unit = 0;
43 static int use_value_prefix = 0;
46 
47 /* globals */
48 static const OptionDef *options;
49 
50 /* AVprobe context */
51 static const char *input_filename;
53 
54 static const char *const binary_unit_prefixes [] = { "", "Ki", "Mi", "Gi", "Ti", "Pi" };
55 static const char *const decimal_unit_prefixes[] = { "", "K" , "M" , "G" , "T" , "P" };
56 
57 static const char unit_second_str[] = "s" ;
58 static const char unit_hertz_str[] = "Hz" ;
59 static const char unit_byte_str[] = "byte" ;
60 static const char unit_bit_per_second_str[] = "bit/s";
61 
62 static void exit_program(void)
63 {
64  av_dict_free(&fmt_entries_to_show);
65 }
66 
67 /*
68  * The output is structured in array and objects that might contain items
69  * Array could require the objects within to not be named.
70  * Object could require the items within to be named.
71  *
72  * For flat representation the name of each section is saved on prefix so it
73  * can be rendered in order to represent nested structures (e.g. array of
74  * objects for the packets list).
75  *
76  * Within an array each element can need an unique identifier or an index.
77  *
78  * Nesting level is accounted separately.
79  */
80 
81 typedef enum {
85 
86 typedef struct {
87  const char *name;
89  int64_t index;
90  int64_t nb_elems;
91 } ProbeElement;
92 
93 typedef struct {
95  int level;
96  void (*print_header)(void);
97  void (*print_footer)(void);
98 
99  void (*print_array_header) (const char *name);
100  void (*print_array_footer) (const char *name);
101  void (*print_object_header)(const char *name);
102  void (*print_object_footer)(const char *name);
103 
104  void (*print_integer) (const char *key, int64_t value);
105  void (*print_string) (const char *key, const char *value);
106 } OutputContext;
107 
110 #define AVP_INDENT() avio_printf(probe_out, "%*c", octx.level * 2, ' ')
111 
112 /*
113  * Default format, INI
114  *
115  * - all key and values are utf8
116  * - '.' is the subgroup separator
117  * - newlines and the following characters are escaped
118  * - '\' is the escape character
119  * - '#' is the comment
120  * - '=' is the key/value separators
121  * - ':' is not used but usually parsed as key/value separator
122  */
123 
124 static void ini_print_header(void)
125 {
126  avio_printf(probe_out, "# avprobe output\n\n");
127 }
128 static void ini_print_footer(void)
129 {
130  avio_w8(probe_out, '\n');
131 }
132 
133 static void ini_escape_print(const char *s)
134 {
135  int i = 0;
136  char c = 0;
137 
138  while (c = s[i++]) {
139  switch (c) {
140  case '\r': avio_printf(probe_out, "%s", "\\r"); break;
141  case '\n': avio_printf(probe_out, "%s", "\\n"); break;
142  case '\f': avio_printf(probe_out, "%s", "\\f"); break;
143  case '\b': avio_printf(probe_out, "%s", "\\b"); break;
144  case '\t': avio_printf(probe_out, "%s", "\\t"); break;
145  case '\\':
146  case '#' :
147  case '=' :
148  case ':' : avio_w8(probe_out, '\\');
149  default:
150  if ((unsigned char)c < 32)
151  avio_printf(probe_out, "\\x00%02x", c & 0xff);
152  else
153  avio_w8(probe_out, c);
154  break;
155  }
156  }
157 }
158 
159 static void ini_print_array_header(const char *name)
160 {
161  if (octx.prefix[octx.level -1].nb_elems)
162  avio_printf(probe_out, "\n");
163 }
164 
165 static void ini_print_object_header(const char *name)
166 {
167  int i;
168  ProbeElement *el = octx.prefix + octx.level -1;
169 
170  if (el->nb_elems)
171  avio_printf(probe_out, "\n");
172 
173  avio_printf(probe_out, "[");
174 
175  for (i = 1; i < octx.level; i++) {
176  el = octx.prefix + i;
177  avio_printf(probe_out, "%s.", el->name);
178  if (el->index >= 0)
179  avio_printf(probe_out, "%"PRId64".", el->index);
180  }
181 
182  avio_printf(probe_out, "%s", name);
183  if (el && el->type == ARRAY)
184  avio_printf(probe_out, ".%"PRId64"", el->nb_elems);
185  avio_printf(probe_out, "]\n");
186 }
187 
188 static void ini_print_integer(const char *key, int64_t value)
189 {
190  ini_escape_print(key);
191  avio_printf(probe_out, "=%"PRId64"\n", value);
192 }
193 
194 
195 static void ini_print_string(const char *key, const char *value)
196 {
197  ini_escape_print(key);
198  avio_printf(probe_out, "=");
199  ini_escape_print(value);
200  avio_w8(probe_out, '\n');
201 }
202 
203 /*
204  * Alternate format, JSON
205  */
206 
207 static void json_print_header(void)
208 {
209  avio_printf(probe_out, "{");
210 }
211 static void json_print_footer(void)
212 {
213  avio_printf(probe_out, "}\n");
214 }
215 
216 static void json_print_array_header(const char *name)
217 {
218  if (octx.prefix[octx.level -1].nb_elems)
219  avio_printf(probe_out, ",\n");
220  AVP_INDENT();
221  avio_printf(probe_out, "\"%s\" : ", name);
222  avio_printf(probe_out, "[\n");
223 }
224 
225 static void json_print_array_footer(const char *name)
226 {
227  avio_printf(probe_out, "\n");
228  AVP_INDENT();
229  avio_printf(probe_out, "]");
230 }
231 
232 static void json_print_object_header(const char *name)
233 {
234  if (octx.prefix[octx.level -1].nb_elems)
235  avio_printf(probe_out, ",\n");
236  AVP_INDENT();
237  if (octx.prefix[octx.level -1].type == OBJECT)
238  avio_printf(probe_out, "\"%s\" : ", name);
239  avio_printf(probe_out, "{\n");
240 }
241 
242 static void json_print_object_footer(const char *name)
243 {
244  avio_printf(probe_out, "\n");
245  AVP_INDENT();
246  avio_printf(probe_out, "}");
247 }
248 
249 static void json_print_integer(const char *key, int64_t value)
250 {
251  if (octx.prefix[octx.level -1].nb_elems)
252  avio_printf(probe_out, ",\n");
253  AVP_INDENT();
254  avio_printf(probe_out, "\"%s\" : %"PRId64"", key, value);
255 }
256 
257 static void json_escape_print(const char *s)
258 {
259  int i = 0;
260  char c = 0;
261 
262  while (c = s[i++]) {
263  switch (c) {
264  case '\r': avio_printf(probe_out, "%s", "\\r"); break;
265  case '\n': avio_printf(probe_out, "%s", "\\n"); break;
266  case '\f': avio_printf(probe_out, "%s", "\\f"); break;
267  case '\b': avio_printf(probe_out, "%s", "\\b"); break;
268  case '\t': avio_printf(probe_out, "%s", "\\t"); break;
269  case '\\':
270  case '"' : avio_w8(probe_out, '\\');
271  default:
272  if ((unsigned char)c < 32)
273  avio_printf(probe_out, "\\u00%02x", c & 0xff);
274  else
275  avio_w8(probe_out, c);
276  break;
277  }
278  }
279 }
280 
281 static void json_print_string(const char *key, const char *value)
282 {
283  if (octx.prefix[octx.level -1].nb_elems)
284  avio_printf(probe_out, ",\n");
285  AVP_INDENT();
286  avio_w8(probe_out, '\"');
287  json_escape_print(key);
288  avio_printf(probe_out, "\" : \"");
289  json_escape_print(value);
290  avio_w8(probe_out, '\"');
291 }
292 
293 /*
294  * old-style pseudo-INI
295  */
296 static void old_print_object_header(const char *name)
297 {
298  char *str, *p;
299 
300  if (!strcmp(name, "tags"))
301  return;
302 
303  str = p = av_strdup(name);
304  while (*p) {
305  *p = toupper(*p);
306  p++;
307  }
308 
309  avio_printf(probe_out, "[%s]\n", str);
310  av_freep(&str);
311 }
312 
313 static void old_print_object_footer(const char *name)
314 {
315  char *str, *p;
316 
317  if (!strcmp(name, "tags"))
318  return;
319 
320  str = p = av_strdup(name);
321  while (*p) {
322  *p = toupper(*p);
323  p++;
324  }
325 
326  avio_printf(probe_out, "[/%s]\n", str);
327  av_freep(&str);
328 }
329 
330 static void old_print_string(const char *key, const char *value)
331 {
332  if (!strcmp(octx.prefix[octx.level - 1].name, "tags"))
333  avio_printf(probe_out, "TAG:");
334  ini_print_string(key, value);
335 }
336 
337 /*
338  * Simple Formatter for single entries.
339  */
340 
341 static void show_format_entry_integer(const char *key, int64_t value)
342 {
343  if (key && av_dict_get(fmt_entries_to_show, key, NULL, 0)) {
344  if (nb_fmt_entries_to_show > 1)
345  avio_printf(probe_out, "%s=", key);
346  avio_printf(probe_out, "%"PRId64"\n", value);
347  }
348 }
349 
350 static void show_format_entry_string(const char *key, const char *value)
351 {
352  if (key && av_dict_get(fmt_entries_to_show, key, NULL, 0)) {
353  if (nb_fmt_entries_to_show > 1)
354  avio_printf(probe_out, "%s=", key);
355  avio_printf(probe_out, "%s\n", value);
356  }
357 }
358 
359 static void probe_group_enter(const char *name, int type)
360 {
361  int64_t count = -1;
362 
363  octx.prefix =
364  av_realloc(octx.prefix, sizeof(ProbeElement) * (octx.level + 1));
365 
366  if (!octx.prefix || !name) {
367  fprintf(stderr, "Out of memory\n");
368  exit(1);
369  }
370 
371  if (octx.level) {
372  ProbeElement *parent = octx.prefix + octx.level -1;
373  if (parent->type == ARRAY)
374  count = parent->nb_elems;
375  parent->nb_elems++;
376  }
377 
378  octx.prefix[octx.level++] = (ProbeElement){name, type, count, 0};
379 }
380 
381 static void probe_group_leave(void)
382 {
383  --octx.level;
384 }
385 
386 static void probe_header(void)
387 {
388  if (octx.print_header)
389  octx.print_header();
390  probe_group_enter("root", OBJECT);
391 }
392 
393 static void probe_footer(void)
394 {
395  if (octx.print_footer)
396  octx.print_footer();
398 }
399 
400 
401 static void probe_array_header(const char *name)
402 {
403  if (octx.print_array_header)
404  octx.print_array_header(name);
405 
406  probe_group_enter(name, ARRAY);
407 }
408 
409 static void probe_array_footer(const char *name)
410 {
412  if (octx.print_array_footer)
413  octx.print_array_footer(name);
414 }
415 
416 static void probe_object_header(const char *name)
417 {
418  if (octx.print_object_header)
419  octx.print_object_header(name);
420 
421  probe_group_enter(name, OBJECT);
422 }
423 
424 static void probe_object_footer(const char *name)
425 {
427  if (octx.print_object_footer)
428  octx.print_object_footer(name);
429 }
430 
431 static void probe_int(const char *key, int64_t value)
432 {
433  octx.print_integer(key, value);
434  octx.prefix[octx.level -1].nb_elems++;
435 }
436 
437 static void probe_str(const char *key, const char *value)
438 {
439  octx.print_string(key, value);
440  octx.prefix[octx.level -1].nb_elems++;
441 }
442 
443 static void probe_dict(AVDictionary *dict, const char *name)
444 {
445  AVDictionaryEntry *entry = NULL;
446  if (!dict)
447  return;
448  probe_object_header(name);
449  while ((entry = av_dict_get(dict, "", entry, AV_DICT_IGNORE_SUFFIX))) {
450  probe_str(entry->key, entry->value);
451  }
452  probe_object_footer(name);
453 }
454 
455 static char *value_string(char *buf, int buf_size, double val, const char *unit)
456 {
458  double secs;
459  int hours, mins;
460  secs = val;
461  mins = (int)secs / 60;
462  secs = secs - mins * 60;
463  hours = mins / 60;
464  mins %= 60;
465  snprintf(buf, buf_size, "%d:%02d:%09.6f", hours, mins, secs);
466  } else if (use_value_prefix) {
467  const char *prefix_string;
468  int index;
469 
471  index = (int) log2(val) / 10;
472  index = av_clip(index, 0, FF_ARRAY_ELEMS(binary_unit_prefixes) - 1);
473  val /= pow(2, index * 10);
474  prefix_string = binary_unit_prefixes[index];
475  } else {
476  index = (int) (log10(val)) / 3;
477  index = av_clip(index, 0, FF_ARRAY_ELEMS(decimal_unit_prefixes) - 1);
478  val /= pow(10, index * 3);
479  prefix_string = decimal_unit_prefixes[index];
480  }
481  snprintf(buf, buf_size, "%.*f%s%s",
482  index ? 3 : 0, val,
483  prefix_string,
484  show_value_unit ? unit : "");
485  } else {
486  snprintf(buf, buf_size, "%f%s", val, show_value_unit ? unit : "");
487  }
488 
489  return buf;
490 }
491 
492 static char *time_value_string(char *buf, int buf_size, int64_t val,
493  const AVRational *time_base)
494 {
495  if (val == AV_NOPTS_VALUE) {
496  snprintf(buf, buf_size, "N/A");
497  } else {
498  value_string(buf, buf_size, val * av_q2d(*time_base), unit_second_str);
499  }
500 
501  return buf;
502 }
503 
504 static char *ts_value_string(char *buf, int buf_size, int64_t ts)
505 {
506  if (ts == AV_NOPTS_VALUE) {
507  snprintf(buf, buf_size, "N/A");
508  } else {
509  snprintf(buf, buf_size, "%"PRId64, ts);
510  }
511 
512  return buf;
513 }
514 
515 static char *rational_string(char *buf, int buf_size, const char *sep,
516  const AVRational *rat)
517 {
518  snprintf(buf, buf_size, "%d%s%d", rat->num, sep, rat->den);
519  return buf;
520 }
521 
522 static char *tag_string(char *buf, int buf_size, int tag)
523 {
524  snprintf(buf, buf_size, "0x%04x", tag);
525  return buf;
526 }
527 
528 
529 
530 static const char *media_type_string(enum AVMediaType media_type)
531 {
532  switch (media_type) {
533  case AVMEDIA_TYPE_VIDEO: return "video";
534  case AVMEDIA_TYPE_AUDIO: return "audio";
535  case AVMEDIA_TYPE_DATA: return "data";
536  case AVMEDIA_TYPE_SUBTITLE: return "subtitle";
537  case AVMEDIA_TYPE_ATTACHMENT: return "attachment";
538  default: return "unknown";
539  }
540 }
541 
542 static void show_packet(AVFormatContext *fmt_ctx, AVPacket *pkt)
543 {
544  char val_str[128];
545  AVStream *st = fmt_ctx->streams[pkt->stream_index];
546 
547  probe_object_header("packet");
548  probe_str("codec_type", media_type_string(st->codec->codec_type));
549  probe_int("stream_index", pkt->stream_index);
550  probe_str("pts", ts_value_string(val_str, sizeof(val_str), pkt->pts));
551  probe_str("pts_time", time_value_string(val_str, sizeof(val_str),
552  pkt->pts, &st->time_base));
553  probe_str("dts", ts_value_string(val_str, sizeof(val_str), pkt->dts));
554  probe_str("dts_time", time_value_string(val_str, sizeof(val_str),
555  pkt->dts, &st->time_base));
556  probe_str("duration", ts_value_string(val_str, sizeof(val_str),
557  pkt->duration));
558  probe_str("duration_time", time_value_string(val_str, sizeof(val_str),
559  pkt->duration,
560  &st->time_base));
561  probe_str("size", value_string(val_str, sizeof(val_str),
562  pkt->size, unit_byte_str));
563  probe_int("pos", pkt->pos);
564  probe_str("flags", pkt->flags & AV_PKT_FLAG_KEY ? "K" : "_");
565  probe_object_footer("packet");
566 }
567 
568 static void show_packets(AVFormatContext *fmt_ctx)
569 {
570  AVPacket pkt;
571 
572  av_init_packet(&pkt);
573  probe_array_header("packets");
574  while (!av_read_frame(fmt_ctx, &pkt))
575  show_packet(fmt_ctx, &pkt);
576  probe_array_footer("packets");
577 }
578 
579 static void show_stream(AVFormatContext *fmt_ctx, int stream_idx)
580 {
581  AVStream *stream = fmt_ctx->streams[stream_idx];
582  AVCodecContext *dec_ctx;
583  const AVCodec *dec;
584  const char *profile;
585  char val_str[128];
586  AVRational display_aspect_ratio, *sar = NULL;
587  const AVPixFmtDescriptor *desc;
588 
589  probe_object_header("stream");
590 
591  probe_int("index", stream->index);
592 
593  if ((dec_ctx = stream->codec)) {
594  if ((dec = dec_ctx->codec)) {
595  probe_str("codec_name", dec->name);
596  probe_str("codec_long_name", dec->long_name);
597  } else {
598  probe_str("codec_name", "unknown");
599  }
600 
601  probe_str("codec_type", media_type_string(dec_ctx->codec_type));
602  probe_str("codec_time_base",
603  rational_string(val_str, sizeof(val_str),
604  "/", &dec_ctx->time_base));
605 
606  /* print AVI/FourCC tag */
607  av_get_codec_tag_string(val_str, sizeof(val_str), dec_ctx->codec_tag);
608  probe_str("codec_tag_string", val_str);
609  probe_str("codec_tag", tag_string(val_str, sizeof(val_str),
610  dec_ctx->codec_tag));
611 
612  /* print profile, if there is one */
613  if (dec && (profile = av_get_profile_name(dec, dec_ctx->profile)))
614  probe_str("profile", profile);
615 
616  switch (dec_ctx->codec_type) {
617  case AVMEDIA_TYPE_VIDEO:
618  probe_int("width", dec_ctx->width);
619  probe_int("height", dec_ctx->height);
620  probe_int("has_b_frames", dec_ctx->has_b_frames);
621  if (dec_ctx->sample_aspect_ratio.num)
622  sar = &dec_ctx->sample_aspect_ratio;
623  else if (stream->sample_aspect_ratio.num)
624  sar = &stream->sample_aspect_ratio;
625 
626  if (sar) {
627  probe_str("sample_aspect_ratio",
628  rational_string(val_str, sizeof(val_str), ":", sar));
629  av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
630  dec_ctx->width * sar->num, dec_ctx->height * sar->den,
631  1024*1024);
632  probe_str("display_aspect_ratio",
633  rational_string(val_str, sizeof(val_str), ":",
634  &display_aspect_ratio));
635  }
636  desc = av_pix_fmt_desc_get(dec_ctx->pix_fmt);
637  probe_str("pix_fmt", desc ? desc->name : "unknown");
638  probe_int("level", dec_ctx->level);
639  break;
640 
641  case AVMEDIA_TYPE_AUDIO:
642  probe_str("sample_rate",
643  value_string(val_str, sizeof(val_str),
644  dec_ctx->sample_rate,
645  unit_hertz_str));
646  probe_int("channels", dec_ctx->channels);
647  probe_int("bits_per_sample",
648  av_get_bits_per_sample(dec_ctx->codec_id));
649  break;
650  }
651  } else {
652  probe_str("codec_type", "unknown");
653  }
654 
655  if (fmt_ctx->iformat->flags & AVFMT_SHOW_IDS)
656  probe_int("id", stream->id);
657  probe_str("avg_frame_rate",
658  rational_string(val_str, sizeof(val_str), "/",
659  &stream->avg_frame_rate));
660  if (dec_ctx->bit_rate)
661  probe_str("bit_rate",
662  value_string(val_str, sizeof(val_str),
663  dec_ctx->bit_rate, unit_bit_per_second_str));
664  probe_str("time_base",
665  rational_string(val_str, sizeof(val_str), "/",
666  &stream->time_base));
667  probe_str("start_time",
668  time_value_string(val_str, sizeof(val_str),
669  stream->start_time, &stream->time_base));
670  probe_str("duration",
671  time_value_string(val_str, sizeof(val_str),
672  stream->duration, &stream->time_base));
673  if (stream->nb_frames)
674  probe_int("nb_frames", stream->nb_frames);
675 
676  probe_dict(stream->metadata, "tags");
677 
678  probe_object_footer("stream");
679 }
680 
681 static void show_format(AVFormatContext *fmt_ctx)
682 {
683  char val_str[128];
684  int64_t size = fmt_ctx->pb ? avio_size(fmt_ctx->pb) : -1;
685 
686  probe_object_header("format");
687  probe_str("filename", fmt_ctx->filename);
688  probe_int("nb_streams", fmt_ctx->nb_streams);
689  probe_str("format_name", fmt_ctx->iformat->name);
690  probe_str("format_long_name", fmt_ctx->iformat->long_name);
691  probe_str("start_time",
692  time_value_string(val_str, sizeof(val_str),
693  fmt_ctx->start_time, &AV_TIME_BASE_Q));
694  probe_str("duration",
695  time_value_string(val_str, sizeof(val_str),
696  fmt_ctx->duration, &AV_TIME_BASE_Q));
697  probe_str("size",
698  size >= 0 ? value_string(val_str, sizeof(val_str),
699  size, unit_byte_str)
700  : "unknown");
701  probe_str("bit_rate",
702  value_string(val_str, sizeof(val_str),
703  fmt_ctx->bit_rate, unit_bit_per_second_str));
704 
705  probe_dict(fmt_ctx->metadata, "tags");
706 
707  probe_object_footer("format");
708 }
709 
710 static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename)
711 {
712  int err, i;
713  AVFormatContext *fmt_ctx = NULL;
715 
716  if ((err = avformat_open_input(&fmt_ctx, filename,
717  iformat, &format_opts)) < 0) {
718  print_error(filename, err);
719  return err;
720  }
722  av_log(NULL, AV_LOG_ERROR, "Option %s not found.\n", t->key);
724  }
725 
726 
727  /* fill the streams in the format context */
728  if ((err = avformat_find_stream_info(fmt_ctx, NULL)) < 0) {
729  print_error(filename, err);
730  return err;
731  }
732 
733  av_dump_format(fmt_ctx, 0, filename, 0);
734 
735  /* bind a decoder to each input stream */
736  for (i = 0; i < fmt_ctx->nb_streams; i++) {
737  AVStream *stream = fmt_ctx->streams[i];
738  AVCodec *codec;
739 
740  if (stream->codec->codec_id == AV_CODEC_ID_PROBE) {
741  fprintf(stderr, "Failed to probe codec for input stream %d\n",
742  stream->index);
743  } else if (!(codec = avcodec_find_decoder(stream->codec->codec_id))) {
744  fprintf(stderr,
745  "Unsupported codec with id %d for input stream %d\n",
746  stream->codec->codec_id, stream->index);
747  } else if (avcodec_open2(stream->codec, codec, NULL) < 0) {
748  fprintf(stderr, "Error while opening codec for input stream %d\n",
749  stream->index);
750  }
751  }
752 
753  *fmt_ctx_ptr = fmt_ctx;
754  return 0;
755 }
756 
757 static void close_input_file(AVFormatContext **ctx_ptr)
758 {
759  int i;
760  AVFormatContext *fmt_ctx = *ctx_ptr;
761 
762  /* close decoder for each stream */
763  for (i = 0; i < fmt_ctx->nb_streams; i++) {
764  AVStream *stream = fmt_ctx->streams[i];
765 
766  avcodec_close(stream->codec);
767  }
768  avformat_close_input(ctx_ptr);
769 }
770 
771 static int probe_file(const char *filename)
772 {
773  AVFormatContext *fmt_ctx;
774  int ret, i;
775 
776  if ((ret = open_input_file(&fmt_ctx, filename)))
777  return ret;
778 
779  if (do_show_format)
780  show_format(fmt_ctx);
781 
782  if (do_show_streams) {
783  probe_array_header("streams");
784  for (i = 0; i < fmt_ctx->nb_streams; i++)
785  show_stream(fmt_ctx, i);
786  probe_array_footer("streams");
787  }
788 
789  if (do_show_packets)
790  show_packets(fmt_ctx);
791 
792  close_input_file(&fmt_ctx);
793  return 0;
794 }
795 
796 static void show_usage(void)
797 {
798  printf("Simple multimedia streams analyzer\n");
799  printf("usage: %s [OPTIONS] [INPUT_FILE]\n", program_name);
800  printf("\n");
801 }
802 
803 static int opt_format(void *optctx, const char *opt, const char *arg)
804 {
805  iformat = av_find_input_format(arg);
806  if (!iformat) {
807  fprintf(stderr, "Unknown input format: %s\n", arg);
808  return AVERROR(EINVAL);
809  }
810  return 0;
811 }
812 
813 static int opt_output_format(void *optctx, const char *opt, const char *arg)
814 {
815 
816  if (!strcmp(arg, "json")) {
823 
826  } else if (!strcmp(arg, "ini")) {
831 
834  } else if (!strcmp(arg, "old")) {
835  octx.print_header = NULL;
838 
840  } else {
841  av_log(NULL, AV_LOG_ERROR, "Unsupported formatter %s\n", arg);
842  return AVERROR(EINVAL);
843  }
844  return 0;
845 }
846 
847 static int opt_show_format_entry(void *optctx, const char *opt, const char *arg)
848 {
849  do_show_format = 1;
851  octx.print_header = NULL;
852  octx.print_footer = NULL;
853  octx.print_array_header = NULL;
854  octx.print_array_footer = NULL;
855  octx.print_object_header = NULL;
856  octx.print_object_footer = NULL;
857 
860  av_dict_set(&fmt_entries_to_show, arg, "", 0);
861  return 0;
862 }
863 
864 static void opt_input_file(void *optctx, const char *arg)
865 {
866  if (input_filename) {
867  fprintf(stderr,
868  "Argument '%s' provided as input filename, but '%s' was already specified.\n",
869  arg, input_filename);
870  exit(1);
871  }
872  if (!strcmp(arg, "-"))
873  arg = "pipe:";
874  input_filename = arg;
875 }
876 
877 void show_help_default(const char *opt, const char *arg)
878 {
880  show_usage();
881  show_help_options(options, "Main options:", 0, 0, 0);
882  printf("\n");
884 }
885 
886 static int opt_pretty(void *optctx, const char *opt, const char *arg)
887 {
888  show_value_unit = 1;
889  use_value_prefix = 1;
892  return 0;
893 }
894 
895 static const OptionDef real_options[] = {
896 #include "cmdutils_common_opts.h"
897  { "f", HAS_ARG, {.func_arg = opt_format}, "force format", "format" },
898  { "of", HAS_ARG, {.func_arg = opt_output_format}, "output the document either as ini or json", "output_format" },
899  { "unit", OPT_BOOL, {&show_value_unit},
900  "show unit of the displayed values" },
901  { "prefix", OPT_BOOL, {&use_value_prefix},
902  "use SI prefixes for the displayed values" },
903  { "byte_binary_prefix", OPT_BOOL, {&use_byte_value_binary_prefix},
904  "use binary prefixes for byte units" },
905  { "sexagesimal", OPT_BOOL, {&use_value_sexagesimal_format},
906  "use sexagesimal format HOURS:MM:SS.MICROSECONDS for time units" },
907  { "pretty", 0, {.func_arg = opt_pretty},
908  "prettify the format of displayed values, make it more human readable" },
909  { "show_format", OPT_BOOL, {&do_show_format} , "show format/container info" },
910  { "show_format_entry", HAS_ARG, {.func_arg = opt_show_format_entry},
911  "show a particular entry from the format/container info", "entry" },
912  { "show_packets", OPT_BOOL, {&do_show_packets}, "show packets info" },
913  { "show_streams", OPT_BOOL, {&do_show_streams}, "show streams info" },
914  { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {.func_arg = opt_default},
915  "generic catch all option", "" },
916  { NULL, },
917 };
918 
919 static int probe_buf_write(void *opaque, uint8_t *buf, int buf_size)
920 {
921  printf("%.*s", buf_size, buf);
922  return 0;
923 }
924 
925 #define AVP_BUFFSIZE 4096
926 
927 int main(int argc, char **argv)
928 {
929  int ret;
931 
932  if (!buffer)
933  exit(1);
934 
935  atexit(exit_program);
936 
937  options = real_options;
938  parse_loglevel(argc, argv, options);
939  av_register_all();
941  init_opts();
942 #if CONFIG_AVDEVICE
944 #endif
945 
946  show_banner();
947 
950 
953 
956 
957  parse_options(NULL, argc, argv, options, opt_input_file);
958 
959  if (!input_filename) {
960  show_usage();
961  fprintf(stderr, "You have to specify one input file.\n");
962  fprintf(stderr,
963  "Use -h to get full help or, even better, run 'man %s'.\n",
964  program_name);
965  exit(1);
966  }
967 
968  probe_out = avio_alloc_context(buffer, AVP_BUFFSIZE, 1, NULL, NULL,
970  if (!probe_out)
971  exit(1);
972 
973  probe_header();
974  ret = probe_file(input_filename);
975  probe_footer();
976  avio_flush(probe_out);
977  avio_close(probe_out);
978 
980 
981  return ret;
982 }
static void ini_print_integer(const char *key, int64_t value)
Definition: avprobe.c:188
codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it ...
Definition: avcodec.h:428
const struct AVCodec * codec
Definition: avcodec.h:1348
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
Definition: mem.c:61
Bytestream IO Context.
Definition: avio.h:68
#define OPT_EXPERT
Definition: cmdutils.h:129
static char * time_value_string(char *buf, int buf_size, int64_t val, const AVRational *time_base)
Definition: avprobe.c:492
int64_t avio_size(AVIOContext *s)
Get the filesize.
Definition: aviobuf.c:241
int size
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:1435
static void probe_header(void)
Definition: avprobe.c:386
static void probe_footer(void)
Definition: avprobe.c:393
#define OPT_VIDEO
Definition: cmdutils.h:131
int64_t pos
byte position in stream, -1 if unknown
Definition: avcodec.h:940
int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header.
Definition: utils.c:476
void show_banner(void)
Print the program banner to stderr.
Definition: cmdutils.c:762
static void show_format_entry_string(const char *key, const char *value)
Definition: avprobe.c:350
static void probe_group_enter(const char *name, int type)
Definition: avprobe.c:359
#define OPT_AUDIO
Definition: cmdutils.h:132
static const char *const binary_unit_prefixes[]
Definition: avprobe.c:54
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
Definition: avformat.h:697
Definition: avprobe.c:82
int num
numerator
Definition: rational.h:44
int index
stream index in AVFormatContext
Definition: avformat.h:623
int size
Definition: avcodec.h:916
static void probe_array_header(const char *name)
Definition: avprobe.c:401
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel...
Definition: avcodec.h:1724
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:1533
static const char * input_filename
Definition: avprobe.c:51
void avdevice_register_all(void)
Initialize libavdevice and register all the input and output devices.
Definition: alldevices.c:41
size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag)
Put a string representing the codec tag codec_tag in buf.
Definition: utils.c:1557
static void exit_program(void)
Definition: avprobe.c:62
static void json_print_integer(const char *key, int64_t value)
Definition: avprobe.c:249
void av_log_set_callback(void(*callback)(void *, int, const char *, va_list))
Definition: log.c:178
AVDictionaryEntry * av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
Definition: dict.c:40
int profile
profile
Definition: avcodec.h:2815
AVCodec.
Definition: avcodec.h:2960
static void json_print_array_footer(const char *name)
Definition: avprobe.c:225
int64_t index
Definition: avprobe.c:89
static void probe_int(const char *key, int64_t value)
Definition: avprobe.c:431
#define log2(x)
Definition: libm.h:111
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
Definition: avcodec.h:1465
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
Definition: mem.c:151
Format I/O context.
Definition: avformat.h:828
Public dictionary API.
void log_callback_help(void *ptr, int level, const char *fmt, va_list vl)
Trivial log callback.
Definition: cmdutils.c:79
uint8_t
static void ini_escape_print(const char *s)
Definition: avprobe.c:133
Opaque data information usually continuous.
Definition: avutil.h:181
int opt_default(void *optctx, const char *opt, const char *arg)
Fallback for options that are not explicitly handled, these will be parsed through AVOptions...
Definition: cmdutils.c:402
static char * ts_value_string(char *buf, int buf_size, int64_t ts)
Definition: avprobe.c:504
AVOptions.
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.
Definition: avformat.h:469
#define HAS_ARG
Definition: cmdutils.h:127
static int opt_format(void *optctx, const char *opt, const char *arg)
Definition: avprobe.c:803
static int opt_show_format_entry(void *optctx, const char *opt, const char *arg)
Definition: avprobe.c:847
int id
Format-specific stream ID.
Definition: avformat.h:629
static const char *const decimal_unit_prefixes[]
Definition: avprobe.c:55
static void json_escape_print(const char *s)
Definition: avprobe.c:257
const char * name
void init_opts(void)
Initialize the cmdutils option system, in particular allocate the *_opts contexts.
Definition: cmdutils.c:61
AVStream ** streams
Definition: avformat.h:876
static double av_q2d(AVRational a)
Convert rational to double.
Definition: rational.h:69
void parse_options(void *optctx, int argc, char **argv, const OptionDef *options, void(*parse_arg_function)(void *, const char *))
Definition: cmdutils.c:312
uint32_t tag
Definition: movenc.c:802
int avformat_network_init(void)
Do global initialization of network components.
Definition: utils.c:3528
const AVClass * avformat_get_class(void)
Get the AVClass for AVFormatContext.
Definition: options.c:106
void parse_loglevel(int argc, char **argv, const OptionDef *options)
Find the '-loglevel' option in the command line args and apply it.
Definition: cmdutils.c:392
void show_help_options(const OptionDef *options, const char *msg, int req_flags, int rej_flags, int alt_flags)
Print help for all options matching specified flags.
Definition: cmdutils.c:117
void(* print_array_footer)(const char *name)
Definition: avprobe.c:100
static void old_print_object_header(const char *name)
Definition: avprobe.c:296
int duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
Definition: avcodec.h:937
void(* print_integer)(const char *key, int64_t value)
Definition: avprobe.c:104
static float t
static void show_usage(void)
Definition: avprobe.c:796
const char * name
Definition: pixdesc.h:56
AVDictionary * format_opts
Definition: cmdutils.c:57
static void probe_dict(AVDictionary *dict, const char *name)
Definition: avprobe.c:443
void av_dump_format(AVFormatContext *ic, int index, const char *url, int is_output)
Definition: utils.c:2952
Main libavdevice API header.
Definition: avprobe.c:83
int avcodec_close(AVCodecContext *avctx)
Close a given AVCodecContext and free all the data associated with it (but not the AVCodecContext its...
Definition: utils.c:1437
static void probe_str(const char *key, const char *value)
Definition: avprobe.c:437
AVIOContext * avio_alloc_context(unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int(*read_packet)(void *opaque, uint8_t *buf, int buf_size), int(*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t(*seek)(void *opaque, int64_t offset, int whence))
Allocate and initialize an AVIOContext for buffered I/O.
Definition: aviobuf.c:107
static void json_print_object_footer(const char *name)
Definition: avprobe.c:242
static void ini_print_object_header(const char *name)
Definition: avprobe.c:165
static void json_print_array_header(const char *name)
Definition: avprobe.c:216
static const OptionDef real_options[]
Definition: avprobe.c:895
AVDictionary * metadata
Definition: avformat.h:972
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
Definition: utils.c:1813
int has_b_frames
Size of the frame reordering buffer in the decoder.
Definition: avcodec.h:1634
static int do_show_format
Definition: avprobe.c:36
static AVDictionary * fmt_entries_to_show
Definition: avprobe.c:37
int64_t nb_elems
Definition: avprobe.c:90
static int probe_buf_write(void *opaque, uint8_t *buf, int buf_size)
Definition: avprobe.c:919
static void show_format_entry_integer(const char *key, int64_t value)
Definition: avprobe.c:341
int avio_close(AVIOContext *s)
Close the resource accessed by the AVIOContext s and free it.
Definition: aviobuf.c:782
void(* print_object_header)(const char *name)
Definition: avprobe.c:101
static char * tag_string(char *buf, int buf_size, int tag)
Definition: avprobe.c:522
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values. ...
Definition: dict.c:113
void av_log(void *avcl, int level, const char *fmt,...)
Definition: log.c:146
const char * name
Name of the codec implementation.
Definition: avcodec.h:2967
AVRational avg_frame_rate
Average framerate.
Definition: avformat.h:704
int flags
A combination of AV_PKT_FLAG values.
Definition: avcodec.h:921
static int nb_fmt_entries_to_show
Definition: avprobe.c:38
AVCodecContext * codec
Codec context associated with this stream.
Definition: avformat.h:641
static void show_packets(AVFormatContext *fmt_ctx)
Definition: avprobe.c:568
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
Definition: rational.c:36
unsigned int nb_streams
A list of all streams in the file.
Definition: avformat.h:875
AVInputFormat * av_find_input_format(const char *short_name)
Find AVInputFormat based on the short name of the input format.
Definition: utils.c:207
int bit_rate
the average bitrate
Definition: avcodec.h:1404
int void avio_flush(AVIOContext *s)
Definition: aviobuf.c:180
static int use_value_sexagesimal_format
Definition: avprobe.c:45
char filename[1024]
input or output filename
Definition: avformat.h:878
#define AVP_BUFFSIZE
Definition: avprobe.c:925
void show_help_default(const char *opt, const char *arg)
Per-avtool specific help handler.
Definition: avprobe.c:877
int width
picture width / height.
Definition: avcodec.h:1508
static void probe_object_header(const char *name)
Definition: avprobe.c:416
int level
level
Definition: avcodec.h:2885
static char buffer[20]
Definition: seek-test.c:31
static const char unit_byte_str[]
Definition: avprobe.c:59
AVDictionary * metadata
Definition: avformat.h:699
const int program_birth_year
program birth year, defined by the program for show_banner()
Definition: avprobe.c:34
Opaque data information usually sparse.
Definition: avutil.h:183
static void opt_input_file(void *optctx, const char *arg)
Definition: avprobe.c:864
void(* print_array_header)(const char *name)
Definition: avprobe.c:99
static int opt_pretty(void *optctx, const char *opt, const char *arg)
Definition: avprobe.c:886
static char * value_string(char *buf, int buf_size, double val, const char *unit)
Definition: avprobe.c:455
static const OptionDef * options
Definition: avprobe.c:48
const char * long_name
Descriptive name for the format, meant to be more human-readable than name.
Definition: avformat.h:462
Stream structure.
Definition: avformat.h:622
const char * av_get_profile_name(const AVCodec *codec, int profile)
Return a name for the specified profile, if available.
Definition: utils.c:1690
int avformat_network_deinit(void)
Undo the initialization done by avformat_network_init.
Definition: utils.c:3540
const char * long_name
Descriptive name for the codec, meant to be more human readable than name.
Definition: avcodec.h:2972
NULL
Definition: eval.c:52
external API header
enum AVMediaType codec_type
Definition: avcodec.h:1347
static const char unit_second_str[]
Definition: avprobe.c:57
enum AVCodecID codec_id
Definition: avcodec.h:1350
char * av_strdup(const char *s)
Duplicate the string s.
Definition: mem.c:166
int sample_rate
samples per second
Definition: avcodec.h:2104
AVIOContext * pb
I/O context.
Definition: avformat.h:861
static const char * media_type_string(enum AVMediaType media_type)
Definition: avprobe.c:530
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:55
void avio_w8(AVIOContext *s, int b)
Definition: aviobuf.c:144
main external API structure.
Definition: avcodec.h:1339
AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
Definition: utils.c:1515
static void(WINAPI *cond_broadcast)(pthread_cond_t *cond)
static void show_format(AVFormatContext *fmt_ctx)
Definition: avprobe.c:681
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
Definition: avcodec.h:1365
void(* print_object_footer)(const char *name)
Definition: avprobe.c:102
static int use_byte_value_binary_prefix
Definition: avprobe.c:44
static void json_print_string(const char *key, const char *value)
Definition: avprobe.c:281
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:63
Replacements for frequently missing libm functions.
static void old_print_string(const char *key, const char *value)
Definition: avprobe.c:330
static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename)
Definition: avprobe.c:710
static const char unit_bit_per_second_str[]
Definition: avprobe.c:60
int index
Definition: gxfenc.c:72
const char * name
Definition: avprobe.c:87
rational number numerator/denominator
Definition: rational.h:43
static OutputContext octx
Definition: avprobe.c:109
AVMediaType
Definition: avutil.h:177
int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec.
Definition: utils.c:645
static void ini_print_string(const char *key, const char *value)
Definition: avprobe.c:195
static void json_print_footer(void)
Definition: avprobe.c:211
static void ini_print_header(void)
Definition: avprobe.c:124
static void json_print_object_header(const char *name)
Definition: avprobe.c:232
int av_read_frame(AVFormatContext *s, AVPacket *pkt)
Return the next frame of a stream.
Definition: utils.c:1206
int main(int argc, char **argv)
Definition: avprobe.c:927
static int probe_file(const char *filename)
Definition: avprobe.c:771
static AVIOContext * probe_out
Definition: avprobe.c:108
void(* print_header)(void)
Definition: avprobe.c:96
int64_t start_time
Decoding: position of the first frame of the component, in AV_TIME_BASE fractional seconds...
Definition: avformat.h:885
static void probe_array_footer(const char *name)
Definition: avprobe.c:409
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:684
#define OPT_BOOL
Definition: cmdutils.h:128
static int opt_output_format(void *optctx, const char *opt, const char *arg)
Definition: avprobe.c:813
const char program_name[]
program name, defined by the program for show_version().
Definition: avprobe.c:33
Main libavformat public API header.
void print_error(const char *filename, int err)
Print an error message to stderr, indicating filename and a human readable description of the error c...
Definition: cmdutils.c:705
static int do_show_streams
Definition: avprobe.c:40
static void old_print_object_footer(const char *name)
Definition: avprobe.c:313
void * av_realloc(void *ptr, size_t size)
Allocate or reallocate a block of memory.
Definition: mem.c:116
static AVInputFormat * iformat
Definition: avprobe.c:52
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
Read packets of a media file to get stream information.
Definition: utils.c:2236
int64_t start_time
Decoding: pts of the first frame of the stream, in stream time base.
Definition: avformat.h:677
static void probe_group_leave(void)
Definition: avprobe.c:381
void av_init_packet(AVPacket *pkt)
Initialize optional fields of a packet with default values.
Definition: avpacket.c:42
int64_t nb_frames
number of frames in this stream if known or 0
Definition: avformat.h:686
char * key
Definition: dict.h:75
int den
denominator
Definition: rational.h:45
struct AVInputFormat * iformat
Can only be iformat or oformat, not both at the same time.
Definition: avformat.h:841
void avformat_close_input(AVFormatContext **s)
Close an opened input AVFormatContext.
Definition: utils.c:2713
static void show_packet(AVFormatContext *fmt_ctx, AVPacket *pkt)
Definition: avprobe.c:542
#define AVP_INDENT()
Definition: avprobe.c:110
static void ini_print_footer(void)
Definition: avprobe.c:128
void(* print_footer)(void)
Definition: avprobe.c:97
char * value
Definition: dict.h:76
static void json_print_header(void)
Definition: avprobe.c:207
static const char unit_hertz_str[]
Definition: avprobe.c:58
static int show_value_unit
Definition: avprobe.c:42
int channels
number of audio channels
Definition: avcodec.h:2105
ProbeElementType type
Definition: avprobe.c:88
static void show_stream(AVFormatContext *fmt_ctx, int stream_idx)
Definition: avprobe.c:579
void show_help_children(const AVClass *class, int flags)
Show help for all options with given flags in class and all its children.
Definition: cmdutils.c:146
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
Definition: avcodec.h:914
int bit_rate
Decoding: total stream bitrate in bit/s, 0 if not available.
Definition: avformat.h:900
int64_t duration
Decoding: duration of the stream, in AV_TIME_BASE fractional seconds.
Definition: avformat.h:893
static void ini_print_array_header(const char *name)
Definition: avprobe.c:159
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:455
static void close_input_file(AVFormatContext **ctx_ptr)
Definition: avprobe.c:757
static char * rational_string(char *buf, int buf_size, const char *sep, const AVRational *rat)
Definition: avprobe.c:515
static int do_show_packets
Definition: avprobe.c:39
int stream_index
Definition: avcodec.h:917
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
Definition: avformat.h:669
static int use_value_prefix
Definition: avprobe.c:43
static void probe_object_footer(const char *name)
Definition: avprobe.c:424
void(* print_string)(const char *key, const char *value)
Definition: avprobe.c:105
This structure stores compressed data.
Definition: avcodec.h:898
void av_register_all(void)
Initialize libavformat and register all the muxers, demuxers and protocols.
Definition: allformats.c:52
ProbeElementType
Definition: avprobe.c:81
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: avcodec.h:908
ProbeElement * prefix
Definition: avprobe.c:94
int avio_printf(AVIOContext *s, const char *fmt,...) av_printf_format(2