FFmpeg
ffprobe.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007-2010 Stefano Sabatini
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /**
22  * @file
23  * simple media prober based on the FFmpeg libraries
24  */
25 
26 #include "config.h"
27 #include "libavutil/ffversion.h"
28 
29 #include <string.h>
30 
31 #include "libavformat/avformat.h"
32 #include "libavformat/version.h"
33 #include "libavcodec/avcodec.h"
34 #include "libavcodec/version.h"
35 #include "libavutil/avassert.h"
36 #include "libavutil/avstring.h"
37 #include "libavutil/bprint.h"
39 #include "libavutil/display.h"
40 #include "libavutil/hash.h"
44 #include "libavutil/dovi_meta.h"
45 #include "libavutil/opt.h"
46 #include "libavutil/pixdesc.h"
47 #include "libavutil/spherical.h"
48 #include "libavutil/stereo3d.h"
49 #include "libavutil/dict.h"
50 #include "libavutil/intreadwrite.h"
51 #include "libavutil/libm.h"
52 #include "libavutil/parseutils.h"
53 #include "libavutil/timecode.h"
54 #include "libavutil/timestamp.h"
55 #include "libavdevice/avdevice.h"
56 #include "libavdevice/version.h"
57 #include "libswscale/swscale.h"
58 #include "libswscale/version.h"
60 #include "libswresample/version.h"
62 #include "libpostproc/version.h"
63 #include "libavfilter/version.h"
64 #include "cmdutils.h"
65 #include "opt_common.h"
66 
67 #include "libavutil/thread.h"
68 
69 #if !HAVE_THREADS
70 # ifdef pthread_mutex_lock
71 # undef pthread_mutex_lock
72 # endif
73 # define pthread_mutex_lock(a) do{}while(0)
74 # ifdef pthread_mutex_unlock
75 # undef pthread_mutex_unlock
76 # endif
77 # define pthread_mutex_unlock(a) do{}while(0)
78 #endif
79 
80 typedef struct InputStream {
81  AVStream *st;
82 
84 } InputStream;
85 
86 typedef struct InputFile {
88 
90  int nb_streams;
91 } InputFile;
92 
93 const char program_name[] = "ffprobe";
94 const int program_birth_year = 2007;
95 
96 static int do_bitexact = 0;
97 static int do_count_frames = 0;
98 static int do_count_packets = 0;
99 static int do_read_frames = 0;
100 static int do_read_packets = 0;
101 static int do_show_chapters = 0;
102 static int do_show_error = 0;
103 static int do_show_format = 0;
104 static int do_show_frames = 0;
105 static int do_show_packets = 0;
106 static int do_show_programs = 0;
107 static int do_show_streams = 0;
109 static int do_show_data = 0;
110 static int do_show_program_version = 0;
112 static int do_show_pixel_formats = 0;
115 static int do_show_log = 0;
116 
117 static int do_show_chapter_tags = 0;
118 static int do_show_format_tags = 0;
119 static int do_show_frame_tags = 0;
120 static int do_show_program_tags = 0;
121 static int do_show_stream_tags = 0;
122 static int do_show_packet_tags = 0;
123 
124 static int show_value_unit = 0;
125 static int use_value_prefix = 0;
128 static int show_private_data = 1;
129 
130 #define SHOW_OPTIONAL_FIELDS_AUTO -1
131 #define SHOW_OPTIONAL_FIELDS_NEVER 0
132 #define SHOW_OPTIONAL_FIELDS_ALWAYS 1
134 
135 static char *print_format;
136 static char *stream_specifier;
137 static char *show_data_hash;
138 
139 typedef struct ReadInterval {
140  int id; ///< identifier
141  int64_t start, end; ///< start, end in second/AV_TIME_BASE units
145 } ReadInterval;
146 
148 static int read_intervals_nb = 0;
149 
150 static int find_stream_info = 1;
151 
152 /* section structure definition */
153 
154 #define SECTION_MAX_NB_CHILDREN 10
155 
156 struct section {
157  int id; ///< unique id identifying a section
158  const char *name;
159 
160 #define SECTION_FLAG_IS_WRAPPER 1 ///< the section only contains other sections, but has no data at its own level
161 #define SECTION_FLAG_IS_ARRAY 2 ///< the section contains an array of elements of the same type
162 #define SECTION_FLAG_HAS_VARIABLE_FIELDS 4 ///< the section may contain a variable number of fields with variable keys.
163  /// For these sections the element_name field is mandatory.
164  int flags;
165  int children_ids[SECTION_MAX_NB_CHILDREN+1]; ///< list of children section IDS, terminated by -1
166  const char *element_name; ///< name of the contained element, if provided
167  const char *unique_name; ///< unique section name, in case the name is ambiguous
170 };
171 
172 typedef enum {
222 } SectionID;
223 
224 static struct section sections[] = {
226  [SECTION_ID_CHAPTER] = { SECTION_ID_CHAPTER, "chapter", 0, { SECTION_ID_CHAPTER_TAGS, -1 } },
227  [SECTION_ID_CHAPTER_TAGS] = { SECTION_ID_CHAPTER_TAGS, "tags", SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "chapter_tags" },
228  [SECTION_ID_ERROR] = { SECTION_ID_ERROR, "error", 0, { -1 } },
229  [SECTION_ID_FORMAT] = { SECTION_ID_FORMAT, "format", 0, { SECTION_ID_FORMAT_TAGS, -1 } },
230  [SECTION_ID_FORMAT_TAGS] = { SECTION_ID_FORMAT_TAGS, "tags", SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "format_tags" },
233  [SECTION_ID_FRAME_TAGS] = { SECTION_ID_FRAME_TAGS, "tags", SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "frame_tags" },
234  [SECTION_ID_FRAME_SIDE_DATA_LIST] ={ SECTION_ID_FRAME_SIDE_DATA_LIST, "side_data_list", SECTION_FLAG_IS_ARRAY, { SECTION_ID_FRAME_SIDE_DATA, -1 }, .element_name = "side_data", .unique_name = "frame_side_data_list" },
243  [SECTION_ID_FRAME_LOG] = { SECTION_ID_FRAME_LOG, "log", 0, { -1 }, },
245  [SECTION_ID_LIBRARY_VERSION] = { SECTION_ID_LIBRARY_VERSION, "library_version", 0, { -1 } },
249  [SECTION_ID_PACKET_TAGS] = { SECTION_ID_PACKET_TAGS, "tags", SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "packet_tags" },
250  [SECTION_ID_PACKET_SIDE_DATA_LIST] ={ SECTION_ID_PACKET_SIDE_DATA_LIST, "side_data_list", SECTION_FLAG_IS_ARRAY, { SECTION_ID_PACKET_SIDE_DATA, -1 }, .element_name = "side_data", .unique_name = "packet_side_data_list" },
251  [SECTION_ID_PACKET_SIDE_DATA] = { SECTION_ID_PACKET_SIDE_DATA, "side_data", 0, { -1 }, .unique_name = "packet_side_data" },
254  [SECTION_ID_PIXEL_FORMAT_FLAGS] = { SECTION_ID_PIXEL_FORMAT_FLAGS, "flags", 0, { -1 }, .unique_name = "pixel_format_flags" },
255  [SECTION_ID_PIXEL_FORMAT_COMPONENTS] = { SECTION_ID_PIXEL_FORMAT_COMPONENTS, "components", SECTION_FLAG_IS_ARRAY, {SECTION_ID_PIXEL_FORMAT_COMPONENT, -1 }, .unique_name = "pixel_format_components" },
257  [SECTION_ID_PROGRAM_STREAM_DISPOSITION] = { SECTION_ID_PROGRAM_STREAM_DISPOSITION, "disposition", 0, { -1 }, .unique_name = "program_stream_disposition" },
258  [SECTION_ID_PROGRAM_STREAM_TAGS] = { SECTION_ID_PROGRAM_STREAM_TAGS, "tags", SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "program_stream_tags" },
260  [SECTION_ID_PROGRAM_STREAMS] = { SECTION_ID_PROGRAM_STREAMS, "streams", SECTION_FLAG_IS_ARRAY, { SECTION_ID_PROGRAM_STREAM, -1 }, .unique_name = "program_streams" },
262  [SECTION_ID_PROGRAM_TAGS] = { SECTION_ID_PROGRAM_TAGS, "tags", SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "program_tags" },
263  [SECTION_ID_PROGRAM_VERSION] = { SECTION_ID_PROGRAM_VERSION, "program_version", 0, { -1 } },
271  [SECTION_ID_STREAM_DISPOSITION] = { SECTION_ID_STREAM_DISPOSITION, "disposition", 0, { -1 }, .unique_name = "stream_disposition" },
272  [SECTION_ID_STREAM_TAGS] = { SECTION_ID_STREAM_TAGS, "tags", SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "stream_tags" },
273  [SECTION_ID_STREAM_SIDE_DATA_LIST] ={ SECTION_ID_STREAM_SIDE_DATA_LIST, "side_data_list", SECTION_FLAG_IS_ARRAY, { SECTION_ID_STREAM_SIDE_DATA, -1 }, .element_name = "side_data", .unique_name = "stream_side_data_list" },
274  [SECTION_ID_STREAM_SIDE_DATA] = { SECTION_ID_STREAM_SIDE_DATA, "side_data", 0, { -1 }, .unique_name = "stream_side_data" },
275  [SECTION_ID_SUBTITLE] = { SECTION_ID_SUBTITLE, "subtitle", 0, { -1 } },
276 };
277 
278 static const OptionDef *options;
279 
280 /* FFprobe context */
281 static const char *input_filename;
282 static const char *print_input_filename;
283 static const AVInputFormat *iformat = NULL;
284 static const char *output_filename = NULL;
285 
286 static struct AVHashContext *hash;
287 
288 static const struct {
289  double bin_val;
290  double dec_val;
291  const char *bin_str;
292  const char *dec_str;
293 } si_prefixes[] = {
294  { 1.0, 1.0, "", "" },
295  { 1.024e3, 1e3, "Ki", "K" },
296  { 1.048576e6, 1e6, "Mi", "M" },
297  { 1.073741824e9, 1e9, "Gi", "G" },
298  { 1.099511627776e12, 1e12, "Ti", "T" },
299  { 1.125899906842624e15, 1e15, "Pi", "P" },
300 };
301 
302 static const char unit_second_str[] = "s" ;
303 static const char unit_hertz_str[] = "Hz" ;
304 static const char unit_byte_str[] = "byte" ;
305 static const char unit_bit_per_second_str[] = "bit/s";
306 
307 static int nb_streams;
308 static uint64_t *nb_streams_packets;
309 static uint64_t *nb_streams_frames;
310 static int *selected_streams;
311 
312 #if HAVE_THREADS
313 pthread_mutex_t log_mutex;
314 #endif
315 typedef struct LogBuffer {
318  char *log_message;
320  char *parent_name;
322 }LogBuffer;
323 
325 static int log_buffer_size;
326 
327 static void log_callback(void *ptr, int level, const char *fmt, va_list vl)
328 {
329  AVClass* avc = ptr ? *(AVClass **) ptr : NULL;
330  va_list vl2;
331  char line[1024];
332  static int print_prefix = 1;
333  void *new_log_buffer;
334 
335  va_copy(vl2, vl);
336  av_log_default_callback(ptr, level, fmt, vl);
337  av_log_format_line(ptr, level, fmt, vl2, line, sizeof(line), &print_prefix);
338  va_end(vl2);
339 
340 #if HAVE_THREADS
341  pthread_mutex_lock(&log_mutex);
342 
343  new_log_buffer = av_realloc_array(log_buffer, log_buffer_size + 1, sizeof(*log_buffer));
344  if (new_log_buffer) {
345  char *msg;
346  int i;
347 
348  log_buffer = new_log_buffer;
349  memset(&log_buffer[log_buffer_size], 0, sizeof(log_buffer[log_buffer_size]));
351  if (avc) {
354  }
357  for (i=strlen(msg) - 1; i>=0 && msg[i] == '\n'; i--) {
358  msg[i] = 0;
359  }
360  if (avc && avc->parent_log_context_offset) {
361  AVClass** parent = *(AVClass ***) (((uint8_t *) ptr) +
363  if (parent && *parent) {
364  log_buffer[log_buffer_size].parent_name = av_strdup((*parent)->item_name(parent));
366  (*parent)->get_category ? (*parent)->get_category(parent) :(*parent)->category;
367  }
368  }
369  log_buffer_size ++;
370  }
371 
372  pthread_mutex_unlock(&log_mutex);
373 #endif
374 }
375 
376 static void ffprobe_cleanup(int ret)
377 {
378  int i;
379  for (i = 0; i < FF_ARRAY_ELEMS(sections); i++)
380  av_dict_free(&(sections[i].entries_to_show));
381 
382 #if HAVE_THREADS
383  pthread_mutex_destroy(&log_mutex);
384 #endif
385 }
386 
387 struct unit_value {
388  union { double d; long long int i; } val;
389  const char *unit;
390 };
391 
392 static char *value_string(char *buf, int buf_size, struct unit_value uv)
393 {
394  double vald;
395  long long int vali;
396  int show_float = 0;
397 
398  if (uv.unit == unit_second_str) {
399  vald = uv.val.d;
400  show_float = 1;
401  } else {
402  vald = vali = uv.val.i;
403  }
404 
406  double secs;
407  int hours, mins;
408  secs = vald;
409  mins = (int)secs / 60;
410  secs = secs - mins * 60;
411  hours = mins / 60;
412  mins %= 60;
413  snprintf(buf, buf_size, "%d:%02d:%09.6f", hours, mins, secs);
414  } else {
415  const char *prefix_string = "";
416 
417  if (use_value_prefix && vald > 1) {
418  long long int index;
419 
421  index = (long long int) (log2(vald)) / 10;
423  vald /= si_prefixes[index].bin_val;
424  prefix_string = si_prefixes[index].bin_str;
425  } else {
426  index = (long long int) (log10(vald)) / 3;
428  vald /= si_prefixes[index].dec_val;
429  prefix_string = si_prefixes[index].dec_str;
430  }
431  vali = vald;
432  }
433 
434  if (show_float || (use_value_prefix && vald != (long long int)vald))
435  snprintf(buf, buf_size, "%f", vald);
436  else
437  snprintf(buf, buf_size, "%lld", vali);
438  av_strlcatf(buf, buf_size, "%s%s%s", *prefix_string || show_value_unit ? " " : "",
439  prefix_string, show_value_unit ? uv.unit : "");
440  }
441 
442  return buf;
443 }
444 
445 /* WRITERS API */
446 
447 typedef struct WriterContext WriterContext;
448 
449 #define WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS 1
450 #define WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER 2
451 
452 typedef enum {
458 
459 typedef struct Writer {
460  const AVClass *priv_class; ///< private class of the writer, if any
461  int priv_size; ///< private size for the writer context
462  const char *name;
463 
464  int (*init) (WriterContext *wctx);
465  void (*uninit)(WriterContext *wctx);
466 
469  void (*print_integer) (WriterContext *wctx, const char *, long long int);
470  void (*print_rational) (WriterContext *wctx, AVRational *q, char *sep);
471  void (*print_string) (WriterContext *wctx, const char *, const char *);
472  int flags; ///< a combination or WRITER_FLAG_*
473 } Writer;
474 
475 #define SECTION_MAX_NB_LEVELS 10
476 
478  const AVClass *class; ///< class of the writer
479  const Writer *writer; ///< the Writer of which this is an instance
480  AVIOContext *avio; ///< the I/O context used to write
481 
482  void (* writer_w8)(WriterContext *wctx, int b);
483  void (* writer_put_str)(WriterContext *wctx, const char *str);
484  void (* writer_printf)(WriterContext *wctx, const char *fmt, ...);
485 
486  char *name; ///< name of this writer instance
487  void *priv; ///< private data for use by the filter
488 
489  const struct section *sections; ///< array containing all sections
490  int nb_sections; ///< number of sections
491 
492  int level; ///< current level, starting from 0
493 
494  /** number of the item printed in the given section, starting from 0 */
496 
497  /** section per each level */
499  AVBPrint section_pbuf[SECTION_MAX_NB_LEVELS]; ///< generic print buffer dedicated to each section,
500  /// used by various writers
501 
502  unsigned int nb_section_packet; ///< number of the packet section in case we are in "packets_and_frames" section
503  unsigned int nb_section_frame; ///< number of the frame section in case we are in "packets_and_frames" section
504  unsigned int nb_section_packet_frame; ///< nb_section_packet or nb_section_frame according if is_packets_and_frames
505 
509 };
510 
511 static const char *writer_get_name(void *p)
512 {
513  WriterContext *wctx = p;
514  return wctx->writer->name;
515 }
516 
517 #define OFFSET(x) offsetof(WriterContext, x)
518 
519 static const AVOption writer_options[] = {
520  { "string_validation", "set string validation mode",
521  OFFSET(string_validation), AV_OPT_TYPE_INT, {.i64=WRITER_STRING_VALIDATION_REPLACE}, 0, WRITER_STRING_VALIDATION_NB-1, .unit = "sv" },
522  { "sv", "set string validation mode",
523  OFFSET(string_validation), AV_OPT_TYPE_INT, {.i64=WRITER_STRING_VALIDATION_REPLACE}, 0, WRITER_STRING_VALIDATION_NB-1, .unit = "sv" },
524  { "ignore", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = WRITER_STRING_VALIDATION_IGNORE}, .unit = "sv" },
525  { "replace", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = WRITER_STRING_VALIDATION_REPLACE}, .unit = "sv" },
526  { "fail", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = WRITER_STRING_VALIDATION_FAIL}, .unit = "sv" },
527  { "string_validation_replacement", "set string validation replacement string", OFFSET(string_validation_replacement), AV_OPT_TYPE_STRING, {.str=""}},
528  { "svr", "set string validation replacement string", OFFSET(string_validation_replacement), AV_OPT_TYPE_STRING, {.str="\xEF\xBF\xBD"}},
529  { NULL }
530 };
531 
532 static void *writer_child_next(void *obj, void *prev)
533 {
534  WriterContext *ctx = obj;
535  if (!prev && ctx->writer && ctx->writer->priv_class && ctx->priv)
536  return ctx->priv;
537  return NULL;
538 }
539 
540 static const AVClass writer_class = {
541  .class_name = "Writer",
542  .item_name = writer_get_name,
543  .option = writer_options,
544  .version = LIBAVUTIL_VERSION_INT,
545  .child_next = writer_child_next,
546 };
547 
548 static int writer_close(WriterContext **wctx)
549 {
550  int i;
551  int ret = 0;
552 
553  if (!*wctx)
554  return -1;
555 
556  if ((*wctx)->writer->uninit)
557  (*wctx)->writer->uninit(*wctx);
558  for (i = 0; i < SECTION_MAX_NB_LEVELS; i++)
559  av_bprint_finalize(&(*wctx)->section_pbuf[i], NULL);
560  if ((*wctx)->writer->priv_class)
561  av_opt_free((*wctx)->priv);
562  av_freep(&((*wctx)->priv));
563  av_opt_free(*wctx);
564  if ((*wctx)->avio) {
565  avio_flush((*wctx)->avio);
566  ret = avio_close((*wctx)->avio);
567  }
568  av_freep(wctx);
569  return ret;
570 }
571 
572 static void bprint_bytes(AVBPrint *bp, const uint8_t *ubuf, size_t ubuf_size)
573 {
574  int i;
575  av_bprintf(bp, "0X");
576  for (i = 0; i < ubuf_size; i++)
577  av_bprintf(bp, "%02X", ubuf[i]);
578 }
579 
580 static inline void writer_w8_avio(WriterContext *wctx, int b)
581 {
582  avio_w8(wctx->avio, b);
583 }
584 
585 static inline void writer_put_str_avio(WriterContext *wctx, const char *str)
586 {
587  avio_write(wctx->avio, str, strlen(str));
588 }
589 
590 static inline void writer_printf_avio(WriterContext *wctx, const char *fmt, ...)
591 {
592  va_list ap;
593 
594  va_start(ap, fmt);
595  avio_vprintf(wctx->avio, fmt, ap);
596  va_end(ap);
597 }
598 
599 static inline void writer_w8_printf(WriterContext *wctx, int b)
600 {
601  printf("%c", b);
602 }
603 
604 static inline void writer_put_str_printf(WriterContext *wctx, const char *str)
605 {
606  printf("%s", str);
607 }
608 
609 static inline void writer_printf_printf(WriterContext *wctx, const char *fmt, ...)
610 {
611  va_list ap;
612 
613  va_start(ap, fmt);
614  vprintf(fmt, ap);
615  va_end(ap);
616 }
617 
618 static int writer_open(WriterContext **wctx, const Writer *writer, const char *args,
619  const struct section *sections, int nb_sections, const char *output)
620 {
621  int i, ret = 0;
622 
623  if (!(*wctx = av_mallocz(sizeof(WriterContext)))) {
624  ret = AVERROR(ENOMEM);
625  goto fail;
626  }
627 
628  if (!((*wctx)->priv = av_mallocz(writer->priv_size))) {
629  ret = AVERROR(ENOMEM);
630  goto fail;
631  }
632 
633  (*wctx)->class = &writer_class;
634  (*wctx)->writer = writer;
635  (*wctx)->level = -1;
636  (*wctx)->sections = sections;
637  (*wctx)->nb_sections = nb_sections;
638 
639  av_opt_set_defaults(*wctx);
640 
641  if (writer->priv_class) {
642  void *priv_ctx = (*wctx)->priv;
643  *((const AVClass **)priv_ctx) = writer->priv_class;
644  av_opt_set_defaults(priv_ctx);
645  }
646 
647  /* convert options to dictionary */
648  if (args) {
650  const AVDictionaryEntry *opt = NULL;
651 
652  if ((ret = av_dict_parse_string(&opts, args, "=", ":", 0)) < 0) {
653  av_log(*wctx, AV_LOG_ERROR, "Failed to parse option string '%s' provided to writer context\n", args);
654  av_dict_free(&opts);
655  goto fail;
656  }
657 
658  while ((opt = av_dict_get(opts, "", opt, AV_DICT_IGNORE_SUFFIX))) {
659  if ((ret = av_opt_set(*wctx, opt->key, opt->value, AV_OPT_SEARCH_CHILDREN)) < 0) {
660  av_log(*wctx, AV_LOG_ERROR, "Failed to set option '%s' with value '%s' provided to writer context\n",
661  opt->key, opt->value);
662  av_dict_free(&opts);
663  goto fail;
664  }
665  }
666 
667  av_dict_free(&opts);
668  }
669 
670  /* validate replace string */
671  {
672  const uint8_t *p = (*wctx)->string_validation_replacement;
673  const uint8_t *endp = p + strlen(p);
674  while (*p) {
675  const uint8_t *p0 = p;
676  int32_t code;
677  ret = av_utf8_decode(&code, &p, endp, (*wctx)->string_validation_utf8_flags);
678  if (ret < 0) {
679  AVBPrint bp;
681  bprint_bytes(&bp, p0, p-p0),
682  av_log(wctx, AV_LOG_ERROR,
683  "Invalid UTF8 sequence %s found in string validation replace '%s'\n",
684  bp.str, (*wctx)->string_validation_replacement);
685  return ret;
686  }
687  }
688  }
689 
690  if (!output_filename) {
691  (*wctx)->writer_w8 = writer_w8_printf;
692  (*wctx)->writer_put_str = writer_put_str_printf;
693  (*wctx)->writer_printf = writer_printf_printf;
694  } else {
695  if ((ret = avio_open(&(*wctx)->avio, output, AVIO_FLAG_WRITE)) < 0) {
696  av_log(*wctx, AV_LOG_ERROR,
697  "Failed to open output '%s' with error: %s\n", output, av_err2str(ret));
698  goto fail;
699  }
700  (*wctx)->writer_w8 = writer_w8_avio;
701  (*wctx)->writer_put_str = writer_put_str_avio;
702  (*wctx)->writer_printf = writer_printf_avio;
703  }
704 
705  for (i = 0; i < SECTION_MAX_NB_LEVELS; i++)
706  av_bprint_init(&(*wctx)->section_pbuf[i], 1, AV_BPRINT_SIZE_UNLIMITED);
707 
708  if ((*wctx)->writer->init)
709  ret = (*wctx)->writer->init(*wctx);
710  if (ret < 0)
711  goto fail;
712 
713  return 0;
714 
715 fail:
716  writer_close(wctx);
717  return ret;
718 }
719 
721  int section_id)
722 {
723  int parent_section_id;
724  wctx->level++;
726  parent_section_id = wctx->level ?
727  (wctx->section[wctx->level-1])->id : SECTION_ID_NONE;
728 
729  wctx->nb_item[wctx->level] = 0;
730  wctx->section[wctx->level] = &wctx->sections[section_id];
731 
732  if (section_id == SECTION_ID_PACKETS_AND_FRAMES) {
733  wctx->nb_section_packet = wctx->nb_section_frame =
734  wctx->nb_section_packet_frame = 0;
735  } else if (parent_section_id == SECTION_ID_PACKETS_AND_FRAMES) {
736  wctx->nb_section_packet_frame = section_id == SECTION_ID_PACKET ?
737  wctx->nb_section_packet : wctx->nb_section_frame;
738  }
739 
740  if (wctx->writer->print_section_header)
741  wctx->writer->print_section_header(wctx);
742 }
743 
745 {
746  int section_id = wctx->section[wctx->level]->id;
747  int parent_section_id = wctx->level ?
748  wctx->section[wctx->level-1]->id : SECTION_ID_NONE;
749 
750  if (parent_section_id != SECTION_ID_NONE)
751  wctx->nb_item[wctx->level-1]++;
752  if (parent_section_id == SECTION_ID_PACKETS_AND_FRAMES) {
753  if (section_id == SECTION_ID_PACKET) wctx->nb_section_packet++;
754  else wctx->nb_section_frame++;
755  }
756  if (wctx->writer->print_section_footer)
757  wctx->writer->print_section_footer(wctx);
758  wctx->level--;
759 }
760 
761 static inline void writer_print_integer(WriterContext *wctx,
762  const char *key, long long int val)
763 {
764  const struct section *section = wctx->section[wctx->level];
765 
767  wctx->writer->print_integer(wctx, key, val);
768  wctx->nb_item[wctx->level]++;
769  }
770 }
771 
772 static inline int validate_string(WriterContext *wctx, char **dstp, const char *src)
773 {
774  const uint8_t *p, *endp;
775  AVBPrint dstbuf;
776  int invalid_chars_nb = 0, ret = 0;
777 
779 
780  endp = src + strlen(src);
781  for (p = (uint8_t *)src; *p;) {
782  uint32_t code;
783  int invalid = 0;
784  const uint8_t *p0 = p;
785 
786  if (av_utf8_decode(&code, &p, endp, wctx->string_validation_utf8_flags) < 0) {
787  AVBPrint bp;
789  bprint_bytes(&bp, p0, p-p0);
790  av_log(wctx, AV_LOG_DEBUG,
791  "Invalid UTF-8 sequence %s found in string '%s'\n", bp.str, src);
792  invalid = 1;
793  }
794 
795  if (invalid) {
796  invalid_chars_nb++;
797 
798  switch (wctx->string_validation) {
800  av_log(wctx, AV_LOG_ERROR,
801  "Invalid UTF-8 sequence found in string '%s'\n", src);
803  goto end;
804  break;
805 
807  av_bprintf(&dstbuf, "%s", wctx->string_validation_replacement);
808  break;
809  }
810  }
811 
812  if (!invalid || wctx->string_validation == WRITER_STRING_VALIDATION_IGNORE)
813  av_bprint_append_data(&dstbuf, p0, p-p0);
814  }
815 
816  if (invalid_chars_nb && wctx->string_validation == WRITER_STRING_VALIDATION_REPLACE) {
817  av_log(wctx, AV_LOG_WARNING,
818  "%d invalid UTF-8 sequence(s) found in string '%s', replaced with '%s'\n",
819  invalid_chars_nb, src, wctx->string_validation_replacement);
820  }
821 
822 end:
823  av_bprint_finalize(&dstbuf, dstp);
824  return ret;
825 }
826 
827 #define PRINT_STRING_OPT 1
828 #define PRINT_STRING_VALIDATE 2
829 
830 static inline int writer_print_string(WriterContext *wctx,
831  const char *key, const char *val, int flags)
832 {
833  const struct section *section = wctx->section[wctx->level];
834  int ret = 0;
835 
838  && (flags & PRINT_STRING_OPT)
840  return 0;
841 
844  char *key1 = NULL, *val1 = NULL;
845  ret = validate_string(wctx, &key1, key);
846  if (ret < 0) goto end;
847  ret = validate_string(wctx, &val1, val);
848  if (ret < 0) goto end;
849  wctx->writer->print_string(wctx, key1, val1);
850  end:
851  if (ret < 0) {
852  av_log(wctx, AV_LOG_ERROR,
853  "Invalid key=value string combination %s=%s in section %s\n",
855  }
856  av_free(key1);
857  av_free(val1);
858  } else {
859  wctx->writer->print_string(wctx, key, val);
860  }
861 
862  wctx->nb_item[wctx->level]++;
863  }
864 
865  return ret;
866 }
867 
868 static inline void writer_print_rational(WriterContext *wctx,
869  const char *key, AVRational q, char sep)
870 {
871  AVBPrint buf;
873  av_bprintf(&buf, "%d%c%d", q.num, sep, q.den);
874  writer_print_string(wctx, key, buf.str, 0);
875 }
876 
877 static void writer_print_time(WriterContext *wctx, const char *key,
878  int64_t ts, const AVRational *time_base, int is_duration)
879 {
880  char buf[128];
881 
882  if ((!is_duration && ts == AV_NOPTS_VALUE) || (is_duration && ts == 0)) {
884  } else {
885  double d = ts * av_q2d(*time_base);
886  struct unit_value uv;
887  uv.val.d = d;
888  uv.unit = unit_second_str;
889  value_string(buf, sizeof(buf), uv);
890  writer_print_string(wctx, key, buf, 0);
891  }
892 }
893 
894 static void writer_print_ts(WriterContext *wctx, const char *key, int64_t ts, int is_duration)
895 {
896  if ((!is_duration && ts == AV_NOPTS_VALUE) || (is_duration && ts == 0)) {
898  } else {
899  writer_print_integer(wctx, key, ts);
900  }
901 }
902 
903 static void writer_print_data(WriterContext *wctx, const char *name,
904  const uint8_t *data, int size)
905 {
906  AVBPrint bp;
907  int offset = 0, l, i;
908 
910  av_bprintf(&bp, "\n");
911  while (size) {
912  av_bprintf(&bp, "%08x: ", offset);
913  l = FFMIN(size, 16);
914  for (i = 0; i < l; i++) {
915  av_bprintf(&bp, "%02x", data[i]);
916  if (i & 1)
917  av_bprintf(&bp, " ");
918  }
919  av_bprint_chars(&bp, ' ', 41 - 2 * i - i / 2);
920  for (i = 0; i < l; i++)
921  av_bprint_chars(&bp, data[i] - 32U < 95 ? data[i] : '.', 1);
922  av_bprintf(&bp, "\n");
923  offset += l;
924  data += l;
925  size -= l;
926  }
927  writer_print_string(wctx, name, bp.str, 0);
928  av_bprint_finalize(&bp, NULL);
929 }
930 
931 static void writer_print_data_hash(WriterContext *wctx, const char *name,
932  const uint8_t *data, int size)
933 {
934  char *p, buf[AV_HASH_MAX_SIZE * 2 + 64] = { 0 };
935 
936  if (!hash)
937  return;
940  snprintf(buf, sizeof(buf), "%s:", av_hash_get_name(hash));
941  p = buf + strlen(buf);
942  av_hash_final_hex(hash, p, buf + sizeof(buf) - p);
943  writer_print_string(wctx, name, buf, 0);
944 }
945 
946 static void writer_print_integers(WriterContext *wctx, const char *name,
947  uint8_t *data, int size, const char *format,
948  int columns, int bytes, int offset_add)
949 {
950  AVBPrint bp;
951  int offset = 0, l, i;
952 
954  av_bprintf(&bp, "\n");
955  while (size) {
956  av_bprintf(&bp, "%08x: ", offset);
957  l = FFMIN(size, columns);
958  for (i = 0; i < l; i++) {
959  if (bytes == 1) av_bprintf(&bp, format, *data);
960  else if (bytes == 2) av_bprintf(&bp, format, AV_RN16(data));
961  else if (bytes == 4) av_bprintf(&bp, format, AV_RN32(data));
962  data += bytes;
963  size --;
964  }
965  av_bprintf(&bp, "\n");
966  offset += offset_add;
967  }
968  writer_print_string(wctx, name, bp.str, 0);
969  av_bprint_finalize(&bp, NULL);
970 }
971 
972 #define writer_w8(wctx_, b_) (wctx_)->writer_w8(wctx_, b_)
973 #define writer_put_str(wctx_, str_) (wctx_)->writer_put_str(wctx_, str_)
974 #define writer_printf(wctx_, fmt_, ...) (wctx_)->writer_printf(wctx_, fmt_, __VA_ARGS__)
975 
976 #define MAX_REGISTERED_WRITERS_NB 64
977 
979 
980 static int writer_register(const Writer *writer)
981 {
982  static int next_registered_writer_idx = 0;
983 
984  if (next_registered_writer_idx == MAX_REGISTERED_WRITERS_NB)
985  return AVERROR(ENOMEM);
986 
987  registered_writers[next_registered_writer_idx++] = writer;
988  return 0;
989 }
990 
991 static const Writer *writer_get_by_name(const char *name)
992 {
993  int i;
994 
995  for (i = 0; registered_writers[i]; i++)
996  if (!strcmp(registered_writers[i]->name, name))
997  return registered_writers[i];
998 
999  return NULL;
1000 }
1001 
1002 
1003 /* WRITERS */
1004 
1005 #define DEFINE_WRITER_CLASS(name) \
1006 static const char *name##_get_name(void *ctx) \
1007 { \
1008  return #name ; \
1009 } \
1010 static const AVClass name##_class = { \
1011  .class_name = #name, \
1012  .item_name = name##_get_name, \
1013  .option = name##_options \
1014 }
1015 
1016 /* Default output */
1017 
1018 typedef struct DefaultContext {
1019  const AVClass *class;
1020  int nokey;
1023 } DefaultContext;
1024 
1025 #undef OFFSET
1026 #define OFFSET(x) offsetof(DefaultContext, x)
1027 
1028 static const AVOption default_options[] = {
1029  { "noprint_wrappers", "do not print headers and footers", OFFSET(noprint_wrappers), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1030  { "nw", "do not print headers and footers", OFFSET(noprint_wrappers), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1031  { "nokey", "force no key printing", OFFSET(nokey), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1032  { "nk", "force no key printing", OFFSET(nokey), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1033  {NULL},
1034 };
1035 
1036 DEFINE_WRITER_CLASS(default);
1037 
1038 /* lame uppercasing routine, assumes the string is lower case ASCII */
1039 static inline char *upcase_string(char *dst, size_t dst_size, const char *src)
1040 {
1041  int i;
1042  for (i = 0; src[i] && i < dst_size-1; i++)
1043  dst[i] = av_toupper(src[i]);
1044  dst[i] = 0;
1045  return dst;
1046 }
1047 
1049 {
1050  DefaultContext *def = wctx->priv;
1051  char buf[32];
1052  const struct section *section = wctx->section[wctx->level];
1053  const struct section *parent_section = wctx->level ?
1054  wctx->section[wctx->level-1] : NULL;
1055 
1056  av_bprint_clear(&wctx->section_pbuf[wctx->level]);
1057  if (parent_section &&
1058  !(parent_section->flags & (SECTION_FLAG_IS_WRAPPER|SECTION_FLAG_IS_ARRAY))) {
1059  def->nested_section[wctx->level] = 1;
1060  av_bprintf(&wctx->section_pbuf[wctx->level], "%s%s:",
1061  wctx->section_pbuf[wctx->level-1].str,
1062  upcase_string(buf, sizeof(buf),
1064  }
1065 
1066  if (def->noprint_wrappers || def->nested_section[wctx->level])
1067  return;
1068 
1070  writer_printf(wctx, "[%s]\n", upcase_string(buf, sizeof(buf), section->name));
1071 }
1072 
1074 {
1075  DefaultContext *def = wctx->priv;
1076  const struct section *section = wctx->section[wctx->level];
1077  char buf[32];
1078 
1079  if (def->noprint_wrappers || def->nested_section[wctx->level])
1080  return;
1081 
1083  writer_printf(wctx, "[/%s]\n", upcase_string(buf, sizeof(buf), section->name));
1084 }
1085 
1086 static void default_print_str(WriterContext *wctx, const char *key, const char *value)
1087 {
1088  DefaultContext *def = wctx->priv;
1089 
1090  if (!def->nokey)
1091  writer_printf(wctx, "%s%s=", wctx->section_pbuf[wctx->level].str, key);
1092  writer_printf(wctx, "%s\n", value);
1093 }
1094 
1095 static void default_print_int(WriterContext *wctx, const char *key, long long int value)
1096 {
1097  DefaultContext *def = wctx->priv;
1098 
1099  if (!def->nokey)
1100  writer_printf(wctx, "%s%s=", wctx->section_pbuf[wctx->level].str, key);
1101  writer_printf(wctx, "%lld\n", value);
1102 }
1103 
1104 static const Writer default_writer = {
1105  .name = "default",
1106  .priv_size = sizeof(DefaultContext),
1109  .print_integer = default_print_int,
1110  .print_string = default_print_str,
1112  .priv_class = &default_class,
1113 };
1114 
1115 /* Compact output */
1116 
1117 /**
1118  * Apply C-language-like string escaping.
1119  */
1120 static const char *c_escape_str(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
1121 {
1122  const char *p;
1123 
1124  for (p = src; *p; p++) {
1125  switch (*p) {
1126  case '\b': av_bprintf(dst, "%s", "\\b"); break;
1127  case '\f': av_bprintf(dst, "%s", "\\f"); break;
1128  case '\n': av_bprintf(dst, "%s", "\\n"); break;
1129  case '\r': av_bprintf(dst, "%s", "\\r"); break;
1130  case '\\': av_bprintf(dst, "%s", "\\\\"); break;
1131  default:
1132  if (*p == sep)
1133  av_bprint_chars(dst, '\\', 1);
1134  av_bprint_chars(dst, *p, 1);
1135  }
1136  }
1137  return dst->str;
1138 }
1139 
1140 /**
1141  * Quote fields containing special characters, check RFC4180.
1142  */
1143 static const char *csv_escape_str(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
1144 {
1145  char meta_chars[] = { sep, '"', '\n', '\r', '\0' };
1146  int needs_quoting = !!src[strcspn(src, meta_chars)];
1147 
1148  if (needs_quoting)
1149  av_bprint_chars(dst, '"', 1);
1150 
1151  for (; *src; src++) {
1152  if (*src == '"')
1153  av_bprint_chars(dst, '"', 1);
1154  av_bprint_chars(dst, *src, 1);
1155  }
1156  if (needs_quoting)
1157  av_bprint_chars(dst, '"', 1);
1158  return dst->str;
1159 }
1160 
1161 static const char *none_escape_str(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
1162 {
1163  return src;
1164 }
1165 
1166 typedef struct CompactContext {
1167  const AVClass *class;
1169  char item_sep;
1170  int nokey;
1173  const char * (*escape_str)(AVBPrint *dst, const char *src, const char sep, void *log_ctx);
1177 } CompactContext;
1178 
1179 #undef OFFSET
1180 #define OFFSET(x) offsetof(CompactContext, x)
1181 
1182 static const AVOption compact_options[]= {
1183  {"item_sep", "set item separator", OFFSET(item_sep_str), AV_OPT_TYPE_STRING, {.str="|"}, 0, 0 },
1184  {"s", "set item separator", OFFSET(item_sep_str), AV_OPT_TYPE_STRING, {.str="|"}, 0, 0 },
1185  {"nokey", "force no key printing", OFFSET(nokey), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1186  {"nk", "force no key printing", OFFSET(nokey), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1187  {"escape", "set escape mode", OFFSET(escape_mode_str), AV_OPT_TYPE_STRING, {.str="c"}, 0, 0 },
1188  {"e", "set escape mode", OFFSET(escape_mode_str), AV_OPT_TYPE_STRING, {.str="c"}, 0, 0 },
1189  {"print_section", "print section name", OFFSET(print_section), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1190  {"p", "print section name", OFFSET(print_section), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1191  {NULL},
1192 };
1193 
1194 DEFINE_WRITER_CLASS(compact);
1195 
1197 {
1198  CompactContext *compact = wctx->priv;
1199 
1200  if (strlen(compact->item_sep_str) != 1) {
1201  av_log(wctx, AV_LOG_ERROR, "Item separator '%s' specified, but must contain a single character\n",
1202  compact->item_sep_str);
1203  return AVERROR(EINVAL);
1204  }
1205  compact->item_sep = compact->item_sep_str[0];
1206 
1207  if (!strcmp(compact->escape_mode_str, "none")) compact->escape_str = none_escape_str;
1208  else if (!strcmp(compact->escape_mode_str, "c" )) compact->escape_str = c_escape_str;
1209  else if (!strcmp(compact->escape_mode_str, "csv" )) compact->escape_str = csv_escape_str;
1210  else {
1211  av_log(wctx, AV_LOG_ERROR, "Unknown escape mode '%s'\n", compact->escape_mode_str);
1212  return AVERROR(EINVAL);
1213  }
1214 
1215  return 0;
1216 }
1217 
1219 {
1220  CompactContext *compact = wctx->priv;
1221  const struct section *section = wctx->section[wctx->level];
1222  const struct section *parent_section = wctx->level ?
1223  wctx->section[wctx->level-1] : NULL;
1224  compact->terminate_line[wctx->level] = 1;
1225  compact->has_nested_elems[wctx->level] = 0;
1226 
1227  av_bprint_clear(&wctx->section_pbuf[wctx->level]);
1228  if (!(section->flags & SECTION_FLAG_IS_ARRAY) && parent_section &&
1229  !(parent_section->flags & (SECTION_FLAG_IS_WRAPPER|SECTION_FLAG_IS_ARRAY))) {
1230  compact->nested_section[wctx->level] = 1;
1231  compact->has_nested_elems[wctx->level-1] = 1;
1232  av_bprintf(&wctx->section_pbuf[wctx->level], "%s%s:",
1233  wctx->section_pbuf[wctx->level-1].str,
1235  wctx->nb_item[wctx->level] = wctx->nb_item[wctx->level-1];
1236  } else {
1237  if (parent_section && compact->has_nested_elems[wctx->level-1] &&
1239  compact->terminate_line[wctx->level-1] = 0;
1240  }
1241  if (parent_section && !(parent_section->flags & (SECTION_FLAG_IS_WRAPPER|SECTION_FLAG_IS_ARRAY)) &&
1242  wctx->level && wctx->nb_item[wctx->level-1])
1243  writer_w8(wctx, compact->item_sep);
1244  if (compact->print_section &&
1246  writer_printf(wctx, "%s%c", section->name, compact->item_sep);
1247  }
1248 }
1249 
1251 {
1252  CompactContext *compact = wctx->priv;
1253 
1254  if (!compact->nested_section[wctx->level] &&
1255  compact->terminate_line[wctx->level] &&
1257  writer_w8(wctx, '\n');
1258 }
1259 
1260 static void compact_print_str(WriterContext *wctx, const char *key, const char *value)
1261 {
1262  CompactContext *compact = wctx->priv;
1263  AVBPrint buf;
1264 
1265  if (wctx->nb_item[wctx->level]) writer_w8(wctx, compact->item_sep);
1266  if (!compact->nokey)
1267  writer_printf(wctx, "%s%s=", wctx->section_pbuf[wctx->level].str, key);
1269  writer_put_str(wctx, compact->escape_str(&buf, value, compact->item_sep, wctx));
1270  av_bprint_finalize(&buf, NULL);
1271 }
1272 
1273 static void compact_print_int(WriterContext *wctx, const char *key, long long int value)
1274 {
1275  CompactContext *compact = wctx->priv;
1276 
1277  if (wctx->nb_item[wctx->level]) writer_w8(wctx, compact->item_sep);
1278  if (!compact->nokey)
1279  writer_printf(wctx, "%s%s=", wctx->section_pbuf[wctx->level].str, key);
1280  writer_printf(wctx, "%lld", value);
1281 }
1282 
1283 static const Writer compact_writer = {
1284  .name = "compact",
1285  .priv_size = sizeof(CompactContext),
1286  .init = compact_init,
1289  .print_integer = compact_print_int,
1290  .print_string = compact_print_str,
1292  .priv_class = &compact_class,
1293 };
1294 
1295 /* CSV output */
1296 
1297 #undef OFFSET
1298 #define OFFSET(x) offsetof(CompactContext, x)
1299 
1300 static const AVOption csv_options[] = {
1301  {"item_sep", "set item separator", OFFSET(item_sep_str), AV_OPT_TYPE_STRING, {.str=","}, 0, 0 },
1302  {"s", "set item separator", OFFSET(item_sep_str), AV_OPT_TYPE_STRING, {.str=","}, 0, 0 },
1303  {"nokey", "force no key printing", OFFSET(nokey), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1304  {"nk", "force no key printing", OFFSET(nokey), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1305  {"escape", "set escape mode", OFFSET(escape_mode_str), AV_OPT_TYPE_STRING, {.str="csv"}, 0, 0 },
1306  {"e", "set escape mode", OFFSET(escape_mode_str), AV_OPT_TYPE_STRING, {.str="csv"}, 0, 0 },
1307  {"print_section", "print section name", OFFSET(print_section), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1308  {"p", "print section name", OFFSET(print_section), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1309  {NULL},
1310 };
1311 
1312 DEFINE_WRITER_CLASS(csv);
1313 
1314 static const Writer csv_writer = {
1315  .name = "csv",
1316  .priv_size = sizeof(CompactContext),
1317  .init = compact_init,
1320  .print_integer = compact_print_int,
1321  .print_string = compact_print_str,
1323  .priv_class = &csv_class,
1324 };
1325 
1326 /* Flat output */
1327 
1328 typedef struct FlatContext {
1329  const AVClass *class;
1330  const char *sep_str;
1331  char sep;
1333 } FlatContext;
1334 
1335 #undef OFFSET
1336 #define OFFSET(x) offsetof(FlatContext, x)
1337 
1338 static const AVOption flat_options[]= {
1339  {"sep_char", "set separator", OFFSET(sep_str), AV_OPT_TYPE_STRING, {.str="."}, 0, 0 },
1340  {"s", "set separator", OFFSET(sep_str), AV_OPT_TYPE_STRING, {.str="."}, 0, 0 },
1341  {"hierarchical", "specify if the section specification should be hierarchical", OFFSET(hierarchical), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1342  {"h", "specify if the section specification should be hierarchical", OFFSET(hierarchical), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1343  {NULL},
1344 };
1345 
1347 
1349 {
1350  FlatContext *flat = wctx->priv;
1351 
1352  if (strlen(flat->sep_str) != 1) {
1353  av_log(wctx, AV_LOG_ERROR, "Item separator '%s' specified, but must contain a single character\n",
1354  flat->sep_str);
1355  return AVERROR(EINVAL);
1356  }
1357  flat->sep = flat->sep_str[0];
1358 
1359  return 0;
1360 }
1361 
1362 static const char *flat_escape_key_str(AVBPrint *dst, const char *src, const char sep)
1363 {
1364  const char *p;
1365 
1366  for (p = src; *p; p++) {
1367  if (!((*p >= '0' && *p <= '9') ||
1368  (*p >= 'a' && *p <= 'z') ||
1369  (*p >= 'A' && *p <= 'Z')))
1370  av_bprint_chars(dst, '_', 1);
1371  else
1372  av_bprint_chars(dst, *p, 1);
1373  }
1374  return dst->str;
1375 }
1376 
1377 static const char *flat_escape_value_str(AVBPrint *dst, const char *src)
1378 {
1379  const char *p;
1380 
1381  for (p = src; *p; p++) {
1382  switch (*p) {
1383  case '\n': av_bprintf(dst, "%s", "\\n"); break;
1384  case '\r': av_bprintf(dst, "%s", "\\r"); break;
1385  case '\\': av_bprintf(dst, "%s", "\\\\"); break;
1386  case '"': av_bprintf(dst, "%s", "\\\""); break;
1387  case '`': av_bprintf(dst, "%s", "\\`"); break;
1388  case '$': av_bprintf(dst, "%s", "\\$"); break;
1389  default: av_bprint_chars(dst, *p, 1); break;
1390  }
1391  }
1392  return dst->str;
1393 }
1394 
1396 {
1397  FlatContext *flat = wctx->priv;
1398  AVBPrint *buf = &wctx->section_pbuf[wctx->level];
1399  const struct section *section = wctx->section[wctx->level];
1400  const struct section *parent_section = wctx->level ?
1401  wctx->section[wctx->level-1] : NULL;
1402 
1403  /* build section header */
1404  av_bprint_clear(buf);
1405  if (!parent_section)
1406  return;
1407  av_bprintf(buf, "%s", wctx->section_pbuf[wctx->level-1].str);
1408 
1409  if (flat->hierarchical ||
1411  av_bprintf(buf, "%s%s", wctx->section[wctx->level]->name, flat->sep_str);
1412 
1413  if (parent_section->flags & SECTION_FLAG_IS_ARRAY) {
1414  int n = parent_section->id == SECTION_ID_PACKETS_AND_FRAMES ?
1415  wctx->nb_section_packet_frame : wctx->nb_item[wctx->level-1];
1416  av_bprintf(buf, "%d%s", n, flat->sep_str);
1417  }
1418  }
1419 }
1420 
1421 static void flat_print_int(WriterContext *wctx, const char *key, long long int value)
1422 {
1423  writer_printf(wctx, "%s%s=%lld\n", wctx->section_pbuf[wctx->level].str, key, value);
1424 }
1425 
1426 static void flat_print_str(WriterContext *wctx, const char *key, const char *value)
1427 {
1428  FlatContext *flat = wctx->priv;
1429  AVBPrint buf;
1430 
1431  writer_put_str(wctx, wctx->section_pbuf[wctx->level].str);
1433  writer_printf(wctx, "%s=", flat_escape_key_str(&buf, key, flat->sep));
1434  av_bprint_clear(&buf);
1435  writer_printf(wctx, "\"%s\"\n", flat_escape_value_str(&buf, value));
1436  av_bprint_finalize(&buf, NULL);
1437 }
1438 
1439 static const Writer flat_writer = {
1440  .name = "flat",
1441  .priv_size = sizeof(FlatContext),
1442  .init = flat_init,
1444  .print_integer = flat_print_int,
1445  .print_string = flat_print_str,
1447  .priv_class = &flat_class,
1448 };
1449 
1450 /* INI format output */
1451 
1452 typedef struct INIContext {
1453  const AVClass *class;
1455 } INIContext;
1456 
1457 #undef OFFSET
1458 #define OFFSET(x) offsetof(INIContext, x)
1459 
1460 static const AVOption ini_options[] = {
1461  {"hierarchical", "specify if the section specification should be hierarchical", OFFSET(hierarchical), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1462  {"h", "specify if the section specification should be hierarchical", OFFSET(hierarchical), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1463  {NULL},
1464 };
1465 
1466 DEFINE_WRITER_CLASS(ini);
1467 
1468 static char *ini_escape_str(AVBPrint *dst, const char *src)
1469 {
1470  int i = 0;
1471  char c = 0;
1472 
1473  while (c = src[i++]) {
1474  switch (c) {
1475  case '\b': av_bprintf(dst, "%s", "\\b"); break;
1476  case '\f': av_bprintf(dst, "%s", "\\f"); break;
1477  case '\n': av_bprintf(dst, "%s", "\\n"); break;
1478  case '\r': av_bprintf(dst, "%s", "\\r"); break;
1479  case '\t': av_bprintf(dst, "%s", "\\t"); break;
1480  case '\\':
1481  case '#' :
1482  case '=' :
1483  case ':' : av_bprint_chars(dst, '\\', 1);
1484  default:
1485  if ((unsigned char)c < 32)
1486  av_bprintf(dst, "\\x00%02x", c & 0xff);
1487  else
1488  av_bprint_chars(dst, c, 1);
1489  break;
1490  }
1491  }
1492  return dst->str;
1493 }
1494 
1496 {
1497  INIContext *ini = wctx->priv;
1498  AVBPrint *buf = &wctx->section_pbuf[wctx->level];
1499  const struct section *section = wctx->section[wctx->level];
1500  const struct section *parent_section = wctx->level ?
1501  wctx->section[wctx->level-1] : NULL;
1502 
1503  av_bprint_clear(buf);
1504  if (!parent_section) {
1505  writer_put_str(wctx, "# ffprobe output\n\n");
1506  return;
1507  }
1508 
1509  if (wctx->nb_item[wctx->level-1])
1510  writer_w8(wctx, '\n');
1511 
1512  av_bprintf(buf, "%s", wctx->section_pbuf[wctx->level-1].str);
1513  if (ini->hierarchical ||
1515  av_bprintf(buf, "%s%s", buf->str[0] ? "." : "", wctx->section[wctx->level]->name);
1516 
1517  if (parent_section->flags & SECTION_FLAG_IS_ARRAY) {
1518  int n = parent_section->id == SECTION_ID_PACKETS_AND_FRAMES ?
1519  wctx->nb_section_packet_frame : wctx->nb_item[wctx->level-1];
1520  av_bprintf(buf, ".%d", n);
1521  }
1522  }
1523 
1525  writer_printf(wctx, "[%s]\n", buf->str);
1526 }
1527 
1528 static void ini_print_str(WriterContext *wctx, const char *key, const char *value)
1529 {
1530  AVBPrint buf;
1531 
1533  writer_printf(wctx, "%s=", ini_escape_str(&buf, key));
1534  av_bprint_clear(&buf);
1535  writer_printf(wctx, "%s\n", ini_escape_str(&buf, value));
1536  av_bprint_finalize(&buf, NULL);
1537 }
1538 
1539 static void ini_print_int(WriterContext *wctx, const char *key, long long int value)
1540 {
1541  writer_printf(wctx, "%s=%lld\n", key, value);
1542 }
1543 
1544 static const Writer ini_writer = {
1545  .name = "ini",
1546  .priv_size = sizeof(INIContext),
1548  .print_integer = ini_print_int,
1549  .print_string = ini_print_str,
1551  .priv_class = &ini_class,
1552 };
1553 
1554 /* JSON output */
1555 
1556 typedef struct JSONContext {
1557  const AVClass *class;
1559  int compact;
1560  const char *item_sep, *item_start_end;
1561 } JSONContext;
1562 
1563 #undef OFFSET
1564 #define OFFSET(x) offsetof(JSONContext, x)
1565 
1566 static const AVOption json_options[]= {
1567  { "compact", "enable compact output", OFFSET(compact), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1568  { "c", "enable compact output", OFFSET(compact), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1569  { NULL }
1570 };
1571 
1572 DEFINE_WRITER_CLASS(json);
1573 
1575 {
1576  JSONContext *json = wctx->priv;
1577 
1578  json->item_sep = json->compact ? ", " : ",\n";
1579  json->item_start_end = json->compact ? " " : "\n";
1580 
1581  return 0;
1582 }
1583 
1584 static const char *json_escape_str(AVBPrint *dst, const char *src, void *log_ctx)
1585 {
1586  static const char json_escape[] = {'"', '\\', '\b', '\f', '\n', '\r', '\t', 0};
1587  static const char json_subst[] = {'"', '\\', 'b', 'f', 'n', 'r', 't', 0};
1588  const char *p;
1589 
1590  for (p = src; *p; p++) {
1591  char *s = strchr(json_escape, *p);
1592  if (s) {
1593  av_bprint_chars(dst, '\\', 1);
1594  av_bprint_chars(dst, json_subst[s - json_escape], 1);
1595  } else if ((unsigned char)*p < 32) {
1596  av_bprintf(dst, "\\u00%02x", *p & 0xff);
1597  } else {
1598  av_bprint_chars(dst, *p, 1);
1599  }
1600  }
1601  return dst->str;
1602 }
1603 
1604 #define JSON_INDENT() writer_printf(wctx, "%*c", json->indent_level * 4, ' ')
1605 
1607 {
1608  JSONContext *json = wctx->priv;
1609  AVBPrint buf;
1610  const struct section *section = wctx->section[wctx->level];
1611  const struct section *parent_section = wctx->level ?
1612  wctx->section[wctx->level-1] : NULL;
1613 
1614  if (wctx->level && wctx->nb_item[wctx->level-1])
1615  writer_put_str(wctx, ",\n");
1616 
1618  writer_put_str(wctx, "{\n");
1619  json->indent_level++;
1620  } else {
1622  json_escape_str(&buf, section->name, wctx);
1623  JSON_INDENT();
1624 
1625  json->indent_level++;
1627  writer_printf(wctx, "\"%s\": [\n", buf.str);
1628  } else if (parent_section && !(parent_section->flags & SECTION_FLAG_IS_ARRAY)) {
1629  writer_printf(wctx, "\"%s\": {%s", buf.str, json->item_start_end);
1630  } else {
1631  writer_printf(wctx, "{%s", json->item_start_end);
1632 
1633  /* this is required so the parser can distinguish between packets and frames */
1634  if (parent_section && parent_section->id == SECTION_ID_PACKETS_AND_FRAMES) {
1635  if (!json->compact)
1636  JSON_INDENT();
1637  writer_printf(wctx, "\"type\": \"%s\"", section->name);
1638  wctx->nb_item[wctx->level]++;
1639  }
1640  }
1641  av_bprint_finalize(&buf, NULL);
1642  }
1643 }
1644 
1646 {
1647  JSONContext *json = wctx->priv;
1648  const struct section *section = wctx->section[wctx->level];
1649 
1650  if (wctx->level == 0) {
1651  json->indent_level--;
1652  writer_put_str(wctx, "\n}\n");
1653  } else if (section->flags & SECTION_FLAG_IS_ARRAY) {
1654  writer_w8(wctx, '\n');
1655  json->indent_level--;
1656  JSON_INDENT();
1657  writer_w8(wctx, ']');
1658  } else {
1659  writer_put_str(wctx, json->item_start_end);
1660  json->indent_level--;
1661  if (!json->compact)
1662  JSON_INDENT();
1663  writer_w8(wctx, '}');
1664  }
1665 }
1666 
1667 static inline void json_print_item_str(WriterContext *wctx,
1668  const char *key, const char *value)
1669 {
1670  AVBPrint buf;
1671 
1673  writer_printf(wctx, "\"%s\":", json_escape_str(&buf, key, wctx));
1674  av_bprint_clear(&buf);
1675  writer_printf(wctx, " \"%s\"", json_escape_str(&buf, value, wctx));
1676  av_bprint_finalize(&buf, NULL);
1677 }
1678 
1679 static void json_print_str(WriterContext *wctx, const char *key, const char *value)
1680 {
1681  JSONContext *json = wctx->priv;
1682  const struct section *parent_section = wctx->level ?
1683  wctx->section[wctx->level-1] : NULL;
1684 
1685  if (wctx->nb_item[wctx->level] || (parent_section && parent_section->id == SECTION_ID_PACKETS_AND_FRAMES))
1686  writer_put_str(wctx, json->item_sep);
1687  if (!json->compact)
1688  JSON_INDENT();
1689  json_print_item_str(wctx, key, value);
1690 }
1691 
1692 static void json_print_int(WriterContext *wctx, const char *key, long long int value)
1693 {
1694  JSONContext *json = wctx->priv;
1695  const struct section *parent_section = wctx->level ?
1696  wctx->section[wctx->level-1] : NULL;
1697  AVBPrint buf;
1698 
1699  if (wctx->nb_item[wctx->level] || (parent_section && parent_section->id == SECTION_ID_PACKETS_AND_FRAMES))
1700  writer_put_str(wctx, json->item_sep);
1701  if (!json->compact)
1702  JSON_INDENT();
1703 
1705  writer_printf(wctx, "\"%s\": %lld", json_escape_str(&buf, key, wctx), value);
1706  av_bprint_finalize(&buf, NULL);
1707 }
1708 
1709 static const Writer json_writer = {
1710  .name = "json",
1711  .priv_size = sizeof(JSONContext),
1712  .init = json_init,
1715  .print_integer = json_print_int,
1716  .print_string = json_print_str,
1718  .priv_class = &json_class,
1719 };
1720 
1721 /* XML output */
1722 
1723 typedef struct XMLContext {
1724  const AVClass *class;
1729 } XMLContext;
1730 
1731 #undef OFFSET
1732 #define OFFSET(x) offsetof(XMLContext, x)
1733 
1734 static const AVOption xml_options[] = {
1735  {"fully_qualified", "specify if the output should be fully qualified", OFFSET(fully_qualified), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1736  {"q", "specify if the output should be fully qualified", OFFSET(fully_qualified), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1737  {"xsd_strict", "ensure that the output is XSD compliant", OFFSET(xsd_strict), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1738  {"x", "ensure that the output is XSD compliant", OFFSET(xsd_strict), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1739  {NULL},
1740 };
1741 
1742 DEFINE_WRITER_CLASS(xml);
1743 
1744 static av_cold int xml_init(WriterContext *wctx)
1745 {
1746  XMLContext *xml = wctx->priv;
1747 
1748  if (xml->xsd_strict) {
1749  xml->fully_qualified = 1;
1750 #define CHECK_COMPLIANCE(opt, opt_name) \
1751  if (opt) { \
1752  av_log(wctx, AV_LOG_ERROR, \
1753  "XSD-compliant output selected but option '%s' was selected, XML output may be non-compliant.\n" \
1754  "You need to disable such option with '-no%s'\n", opt_name, opt_name); \
1755  return AVERROR(EINVAL); \
1756  }
1757  CHECK_COMPLIANCE(show_private_data, "private");
1760  }
1761 
1762  return 0;
1763 }
1764 
1765 #define XML_INDENT() writer_printf(wctx, "%*c", xml->indent_level * 4, ' ')
1766 
1768 {
1769  XMLContext *xml = wctx->priv;
1770  const struct section *section = wctx->section[wctx->level];
1771  const struct section *parent_section = wctx->level ?
1772  wctx->section[wctx->level-1] : NULL;
1773 
1774  if (wctx->level == 0) {
1775  const char *qual = " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
1776  "xmlns:ffprobe=\"http://www.ffmpeg.org/schema/ffprobe\" "
1777  "xsi:schemaLocation=\"http://www.ffmpeg.org/schema/ffprobe ffprobe.xsd\"";
1778 
1779  writer_put_str(wctx, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
1780  writer_printf(wctx, "<%sffprobe%s>\n",
1781  xml->fully_qualified ? "ffprobe:" : "",
1782  xml->fully_qualified ? qual : "");
1783  return;
1784  }
1785 
1786  if (xml->within_tag) {
1787  xml->within_tag = 0;
1788  writer_put_str(wctx, ">\n");
1789  }
1791  xml->indent_level++;
1792  } else {
1793  if (parent_section && (parent_section->flags & SECTION_FLAG_IS_WRAPPER) &&
1794  wctx->level && wctx->nb_item[wctx->level-1])
1795  writer_w8(wctx, '\n');
1796  xml->indent_level++;
1797 
1799  XML_INDENT(); writer_printf(wctx, "<%s>\n", section->name);
1800  } else {
1801  XML_INDENT(); writer_printf(wctx, "<%s ", section->name);
1802  xml->within_tag = 1;
1803  }
1804  }
1805 }
1806 
1808 {
1809  XMLContext *xml = wctx->priv;
1810  const struct section *section = wctx->section[wctx->level];
1811 
1812  if (wctx->level == 0) {
1813  writer_printf(wctx, "</%sffprobe>\n", xml->fully_qualified ? "ffprobe:" : "");
1814  } else if (xml->within_tag) {
1815  xml->within_tag = 0;
1816  writer_put_str(wctx, "/>\n");
1817  xml->indent_level--;
1819  xml->indent_level--;
1820  } else {
1821  XML_INDENT(); writer_printf(wctx, "</%s>\n", section->name);
1822  xml->indent_level--;
1823  }
1824 }
1825 
1826 static void xml_print_str(WriterContext *wctx, const char *key, const char *value)
1827 {
1828  AVBPrint buf;
1829  XMLContext *xml = wctx->priv;
1830  const struct section *section = wctx->section[wctx->level];
1831 
1833 
1835  XML_INDENT();
1836  av_bprint_escape(&buf, key, NULL,
1838  writer_printf(wctx, "<%s key=\"%s\"",
1839  section->element_name, buf.str);
1840  av_bprint_clear(&buf);
1841 
1842  av_bprint_escape(&buf, value, NULL,
1844  writer_printf(wctx, " value=\"%s\"/>\n", buf.str);
1845  } else {
1846  if (wctx->nb_item[wctx->level])
1847  writer_w8(wctx, ' ');
1848 
1849  av_bprint_escape(&buf, value, NULL,
1851  writer_printf(wctx, "%s=\"%s\"", key, buf.str);
1852  }
1853 
1854  av_bprint_finalize(&buf, NULL);
1855 }
1856 
1857 static void xml_print_int(WriterContext *wctx, const char *key, long long int value)
1858 {
1859  if (wctx->nb_item[wctx->level])
1860  writer_w8(wctx, ' ');
1861  writer_printf(wctx, "%s=\"%lld\"", key, value);
1862 }
1863 
1864 static Writer xml_writer = {
1865  .name = "xml",
1866  .priv_size = sizeof(XMLContext),
1867  .init = xml_init,
1870  .print_integer = xml_print_int,
1871  .print_string = xml_print_str,
1873  .priv_class = &xml_class,
1874 };
1875 
1876 static void writer_register_all(void)
1877 {
1878  static int initialized;
1879 
1880  if (initialized)
1881  return;
1882  initialized = 1;
1883 
1891 }
1892 
1893 #define print_fmt(k, f, ...) do { \
1894  av_bprint_clear(&pbuf); \
1895  av_bprintf(&pbuf, f, __VA_ARGS__); \
1896  writer_print_string(w, k, pbuf.str, 0); \
1897 } while (0)
1898 
1899 #define print_list_fmt(k, f, n, ...) do { \
1900  av_bprint_clear(&pbuf); \
1901  for (int idx = 0; idx < n; idx++) { \
1902  if (idx > 0) \
1903  av_bprint_chars(&pbuf, ' ', 1); \
1904  av_bprintf(&pbuf, f, __VA_ARGS__); \
1905  } \
1906  writer_print_string(w, k, pbuf.str, 0); \
1907 } while (0)
1908 
1909 #define print_int(k, v) writer_print_integer(w, k, v)
1910 #define print_q(k, v, s) writer_print_rational(w, k, v, s)
1911 #define print_str(k, v) writer_print_string(w, k, v, 0)
1912 #define print_str_opt(k, v) writer_print_string(w, k, v, PRINT_STRING_OPT)
1913 #define print_str_validate(k, v) writer_print_string(w, k, v, PRINT_STRING_VALIDATE)
1914 #define print_time(k, v, tb) writer_print_time(w, k, v, tb, 0)
1915 #define print_ts(k, v) writer_print_ts(w, k, v, 0)
1916 #define print_duration_time(k, v, tb) writer_print_time(w, k, v, tb, 1)
1917 #define print_duration_ts(k, v) writer_print_ts(w, k, v, 1)
1918 #define print_val(k, v, u) do { \
1919  struct unit_value uv; \
1920  uv.val.i = v; \
1921  uv.unit = u; \
1922  writer_print_string(w, k, value_string(val_str, sizeof(val_str), uv), 0); \
1923 } while (0)
1924 
1925 #define print_section_header(s) writer_print_section_header(w, s)
1926 #define print_section_footer(s) writer_print_section_footer(w, s)
1927 
1928 #define REALLOCZ_ARRAY_STREAM(ptr, cur_n, new_n) \
1929 { \
1930  ret = av_reallocp_array(&(ptr), (new_n), sizeof(*(ptr))); \
1931  if (ret < 0) \
1932  goto end; \
1933  memset( (ptr) + (cur_n), 0, ((new_n) - (cur_n)) * sizeof(*(ptr)) ); \
1934 }
1935 
1936 static inline int show_tags(WriterContext *w, AVDictionary *tags, int section_id)
1937 {
1938  const AVDictionaryEntry *tag = NULL;
1939  int ret = 0;
1940 
1941  if (!tags)
1942  return 0;
1943  writer_print_section_header(w, section_id);
1944 
1945  while ((tag = av_dict_get(tags, "", tag, AV_DICT_IGNORE_SUFFIX))) {
1946  if ((ret = print_str_validate(tag->key, tag->value)) < 0)
1947  break;
1948  }
1950 
1951  return ret;
1952 }
1953 
1955 {
1956  if (!dovi)
1957  return;
1958 
1959  {
1960  const AVDOVIRpuDataHeader *hdr = av_dovi_get_header(dovi);
1961  const AVDOVIDataMapping *mapping = av_dovi_get_mapping(dovi);
1963  AVBPrint pbuf;
1964 
1966 
1967  // header
1968  print_int("rpu_type", hdr->rpu_type);
1969  print_int("rpu_format", hdr->rpu_format);
1970  print_int("vdr_rpu_profile", hdr->vdr_rpu_profile);
1971  print_int("vdr_rpu_level", hdr->vdr_rpu_level);
1972  print_int("chroma_resampling_explicit_filter_flag",
1974  print_int("coef_data_type", hdr->coef_data_type);
1975  print_int("coef_log2_denom", hdr->coef_log2_denom);
1976  print_int("vdr_rpu_normalized_idc", hdr->vdr_rpu_normalized_idc);
1977  print_int("bl_video_full_range_flag", hdr->bl_video_full_range_flag);
1978  print_int("bl_bit_depth", hdr->bl_bit_depth);
1979  print_int("el_bit_depth", hdr->el_bit_depth);
1980  print_int("vdr_bit_depth", hdr->vdr_bit_depth);
1981  print_int("spatial_resampling_filter_flag",
1983  print_int("el_spatial_resampling_filter_flag",
1985  print_int("disable_residual_flag", hdr->disable_residual_flag);
1986 
1987  // data mapping values
1988  print_int("vdr_rpu_id", mapping->vdr_rpu_id);
1989  print_int("mapping_color_space", mapping->mapping_color_space);
1990  print_int("mapping_chroma_format_idc",
1991  mapping->mapping_chroma_format_idc);
1992 
1993  print_int("nlq_method_idc", mapping->nlq_method_idc);
1994  switch (mapping->nlq_method_idc) {
1995  case AV_DOVI_NLQ_NONE:
1996  print_str("nlq_method_idc_name", "none");
1997  break;
1998  case AV_DOVI_NLQ_LINEAR_DZ:
1999  print_str("nlq_method_idc_name", "linear_dz");
2000  break;
2001  default:
2002  print_str("nlq_method_idc_name", "unknown");
2003  break;
2004  }
2005 
2006  print_int("num_x_partitions", mapping->num_x_partitions);
2007  print_int("num_y_partitions", mapping->num_y_partitions);
2008 
2010 
2011  for (int c = 0; c < 3; c++) {
2012  const AVDOVIReshapingCurve *curve = &mapping->curves[c];
2014 
2015  print_list_fmt("pivots", "%"PRIu16, curve->num_pivots, curve->pivots[idx]);
2016 
2018  for (int i = 0; i < curve->num_pivots - 1; i++) {
2019 
2021  print_int("mapping_idc", curve->mapping_idc[i]);
2022  switch (curve->mapping_idc[i]) {
2024  print_str("mapping_idc_name", "polynomial");
2025  print_int("poly_order", curve->poly_order[i]);
2026  print_list_fmt("poly_coef", "%"PRIi64,
2027  curve->poly_order[i] + 1,
2028  curve->poly_coef[i][idx]);
2029  break;
2030  case AV_DOVI_MAPPING_MMR:
2031  print_str("mapping_idc_name", "mmr");
2032  print_int("mmr_order", curve->mmr_order[i]);
2033  print_int("mmr_constant", curve->mmr_constant[i]);
2034  print_list_fmt("mmr_coef", "%"PRIi64,
2035  curve->mmr_order[i] * 7,
2036  curve->mmr_coef[i][0][idx]);
2037  break;
2038  default:
2039  print_str("mapping_idc_name", "unknown");
2040  break;
2041  }
2042 
2043  // SECTION_ID_FRAME_SIDE_DATA_PIECE
2045  }
2046 
2047  // SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST
2049 
2050  if (mapping->nlq_method_idc != AV_DOVI_NLQ_NONE) {
2051  const AVDOVINLQParams *nlq = &mapping->nlq[c];
2052  print_int("nlq_offset", nlq->nlq_offset);
2053  print_int("vdr_in_max", nlq->vdr_in_max);
2054 
2055  switch (mapping->nlq_method_idc) {
2056  case AV_DOVI_NLQ_LINEAR_DZ:
2057  print_int("linear_deadzone_slope", nlq->linear_deadzone_slope);
2058  print_int("linear_deadzone_threshold", nlq->linear_deadzone_threshold);
2059  break;
2060  }
2061  }
2062 
2063  // SECTION_ID_FRAME_SIDE_DATA_COMPONENT
2065  }
2066 
2067  // SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST
2069 
2070  // color metadata
2071  print_int("dm_metadata_id", color->dm_metadata_id);
2072  print_int("scene_refresh_flag", color->scene_refresh_flag);
2073  print_list_fmt("ycc_to_rgb_matrix", "%d/%d",
2074  FF_ARRAY_ELEMS(color->ycc_to_rgb_matrix),
2075  color->ycc_to_rgb_matrix[idx].num,
2076  color->ycc_to_rgb_matrix[idx].den);
2077  print_list_fmt("ycc_to_rgb_offset", "%d/%d",
2078  FF_ARRAY_ELEMS(color->ycc_to_rgb_offset),
2079  color->ycc_to_rgb_offset[idx].num,
2080  color->ycc_to_rgb_offset[idx].den);
2081  print_list_fmt("rgb_to_lms_matrix", "%d/%d",
2082  FF_ARRAY_ELEMS(color->rgb_to_lms_matrix),
2083  color->rgb_to_lms_matrix[idx].num,
2084  color->rgb_to_lms_matrix[idx].den);
2085  print_int("signal_eotf", color->signal_eotf);
2086  print_int("signal_eotf_param0", color->signal_eotf_param0);
2087  print_int("signal_eotf_param1", color->signal_eotf_param1);
2088  print_int("signal_eotf_param2", color->signal_eotf_param2);
2089  print_int("signal_bit_depth", color->signal_bit_depth);
2090  print_int("signal_color_space", color->signal_color_space);
2091  print_int("signal_chroma_format", color->signal_chroma_format);
2092  print_int("signal_full_range_flag", color->signal_full_range_flag);
2093  print_int("source_min_pq", color->source_min_pq);
2094  print_int("source_max_pq", color->source_max_pq);
2095  print_int("source_diagonal", color->source_diagonal);
2096 
2097  av_bprint_finalize(&pbuf, NULL);
2098  }
2099 }
2100 
2102 {
2103  if (!metadata)
2104  return;
2105  print_int("application version", metadata->application_version);
2106  print_int("num_windows", metadata->num_windows);
2107  for (int n = 1; n < metadata->num_windows; n++) {
2108  const AVHDRPlusColorTransformParams *params = &metadata->params[n];
2109  print_q("window_upper_left_corner_x",
2110  params->window_upper_left_corner_x,'/');
2111  print_q("window_upper_left_corner_y",
2112  params->window_upper_left_corner_y,'/');
2113  print_q("window_lower_right_corner_x",
2114  params->window_lower_right_corner_x,'/');
2115  print_q("window_lower_right_corner_y",
2116  params->window_lower_right_corner_y,'/');
2117  print_q("window_upper_left_corner_x",
2118  params->window_upper_left_corner_x,'/');
2119  print_q("window_upper_left_corner_y",
2120  params->window_upper_left_corner_y,'/');
2121  print_int("center_of_ellipse_x",
2122  params->center_of_ellipse_x ) ;
2123  print_int("center_of_ellipse_y",
2124  params->center_of_ellipse_y );
2125  print_int("rotation_angle",
2126  params->rotation_angle);
2127  print_int("semimajor_axis_internal_ellipse",
2129  print_int("semimajor_axis_external_ellipse",
2131  print_int("semiminor_axis_external_ellipse",
2133  print_int("overlap_process_option",
2134  params->overlap_process_option);
2135  }
2136  print_q("targeted_system_display_maximum_luminance",
2139  print_int("num_rows_targeted_system_display_actual_peak_luminance",
2141  print_int("num_cols_targeted_system_display_actual_peak_luminance",
2143  for (int i = 0; i < metadata->num_rows_targeted_system_display_actual_peak_luminance; i++) {
2144  for (int j = 0; j < metadata->num_cols_targeted_system_display_actual_peak_luminance; j++) {
2145  print_q("targeted_system_display_actual_peak_luminance",
2147  }
2148  }
2149  }
2150  for (int n = 0; n < metadata->num_windows; n++) {
2151  const AVHDRPlusColorTransformParams *params = &metadata->params[n];
2152  for (int i = 0; i < 3; i++) {
2153  print_q("maxscl",params->maxscl[i],'/');
2154  }
2155  print_q("average_maxrgb",
2156  params->average_maxrgb,'/');
2157  print_int("num_distribution_maxrgb_percentiles",
2159  for (int i = 0; i < params->num_distribution_maxrgb_percentiles; i++) {
2160  print_int("distribution_maxrgb_percentage",
2161  params->distribution_maxrgb[i].percentage);
2162  print_q("distribution_maxrgb_percentile",
2163  params->distribution_maxrgb[i].percentile,'/');
2164  }
2165  print_q("fraction_bright_pixels",
2166  params->fraction_bright_pixels,'/');
2167  }
2169  print_int("num_rows_mastering_display_actual_peak_luminance",
2171  print_int("num_cols_mastering_display_actual_peak_luminance",
2173  for (int i = 0; i < metadata->num_rows_mastering_display_actual_peak_luminance; i++) {
2174  for (int j = 0; j < metadata->num_cols_mastering_display_actual_peak_luminance; j++) {
2175  print_q("mastering_display_actual_peak_luminance",
2176  metadata->mastering_display_actual_peak_luminance[i][j],'/');
2177  }
2178  }
2179  }
2180 
2181  for (int n = 0; n < metadata->num_windows; n++) {
2182  const AVHDRPlusColorTransformParams *params = &metadata->params[n];
2183  if (params->tone_mapping_flag) {
2184  print_q("knee_point_x", params->knee_point_x,'/');
2185  print_q("knee_point_y", params->knee_point_y,'/');
2186  print_int("num_bezier_curve_anchors",
2187  params->num_bezier_curve_anchors );
2188  for (int i = 0; i < params->num_bezier_curve_anchors; i++) {
2189  print_q("bezier_curve_anchors",
2190  params->bezier_curve_anchors[i],'/');
2191  }
2192  }
2193  if (params->color_saturation_mapping_flag) {
2194  print_q("color_saturation_weight",
2195  params->color_saturation_weight,'/');
2196  }
2197  }
2198 }
2199 
2201 {
2202  if (!metadata)
2203  return;
2204  print_int("system_start_code", metadata->system_start_code);
2205  print_int("num_windows", metadata->num_windows);
2206 
2207  for (int n = 0; n < metadata->num_windows; n++) {
2208  const AVHDRVividColorTransformParams *params = &metadata->params[n];
2209 
2210  print_q("minimum_maxrgb", params->minimum_maxrgb, '/');
2211  print_q("average_maxrgb", params->average_maxrgb, '/');
2212  print_q("variance_maxrgb", params->variance_maxrgb, '/');
2213  print_q("maximum_maxrgb", params->maximum_maxrgb, '/');
2214  }
2215 
2216  for (int n = 0; n < metadata->num_windows; n++) {
2217  const AVHDRVividColorTransformParams *params = &metadata->params[n];
2218 
2219  print_int("tone_mapping_mode_flag", params->tone_mapping_mode_flag);
2220  print_int("tone_mapping_param_num", params->tone_mapping_param_num);
2221  if (params->tone_mapping_mode_flag) {
2222  for (int i = 0; i < params->tone_mapping_param_num; i++) {
2223  const AVHDRVividColorToneMappingParams *tm_params = &params->tm_params[i];
2224 
2225  print_q("targeted_system_display_maximum_luminance",
2227  print_int("base_enable_flag", tm_params->base_enable_flag);
2228  if (tm_params->base_enable_flag) {
2229  print_q("base_param_m_p", tm_params->base_param_m_p, '/');
2230  print_q("base_param_m_m", tm_params->base_param_m_m, '/');
2231  print_q("base_param_m_a", tm_params->base_param_m_a, '/');
2232  print_q("base_param_m_b", tm_params->base_param_m_b, '/');
2233  print_q("base_param_m_n", tm_params->base_param_m_n, '/');
2234 
2235  print_int("base_param_k1", tm_params->base_param_k1);
2236  print_int("base_param_k2", tm_params->base_param_k2);
2237  print_int("base_param_k3", tm_params->base_param_k3);
2238  print_int("base_param_Delta_enable_mode",
2239  tm_params->base_param_Delta_enable_mode);
2240  print_q("base_param_Delta", tm_params->base_param_Delta, '/');
2241  }
2242  print_int("3Spline_enable_flag", tm_params->three_Spline_enable_flag);
2243  if (tm_params->three_Spline_enable_flag) {
2244  print_int("3Spline_num", tm_params->three_Spline_num);
2245  print_int("3Spline_TH_mode", tm_params->three_Spline_TH_mode);
2246 
2247  for (int j = 0; j < tm_params->three_Spline_num; j++) {
2248  print_q("3Spline_TH_enable_MB", tm_params->three_Spline_TH_enable_MB, '/');
2249  print_q("3Spline_TH_enable", tm_params->three_Spline_TH_enable, '/');
2250  print_q("3Spline_TH_Delta1", tm_params->three_Spline_TH_Delta1, '/');
2251  print_q("3Spline_TH_Delta2", tm_params->three_Spline_TH_Delta2, '/');
2252  print_q("3Spline_enable_Strength", tm_params->three_Spline_enable_Strength, '/');
2253  }
2254  }
2255  }
2256  }
2257 
2258  print_int("color_saturation_mapping_flag", params->color_saturation_mapping_flag);
2259  if (params->color_saturation_mapping_flag) {
2260  print_int("color_saturation_num", params->color_saturation_num);
2261  for (int i = 0; i < params->color_saturation_num; i++) {
2262  print_q("color_saturation_gain", params->color_saturation_gain[i], '/');
2263  }
2264  }
2265  }
2266 }
2267 
2269  AVCodecParameters *par,
2270  const AVPacketSideData *side_data,
2271  int nb_side_data,
2272  SectionID id_data_list,
2273  SectionID id_data)
2274 {
2275  int i;
2276 
2277  writer_print_section_header(w, id_data_list);
2278  for (i = 0; i < nb_side_data; i++) {
2279  const AVPacketSideData *sd = &side_data[i];
2280  const char *name = av_packet_side_data_name(sd->type);
2281 
2282  writer_print_section_header(w, id_data);
2283  print_str("side_data_type", name ? name : "unknown");
2284  if (sd->type == AV_PKT_DATA_DISPLAYMATRIX && sd->size >= 9*4) {
2285  writer_print_integers(w, "displaymatrix", sd->data, 9, " %11d", 3, 4, 1);
2286  print_int("rotation", av_display_rotation_get((int32_t *)sd->data));
2287  } else if (sd->type == AV_PKT_DATA_STEREO3D) {
2288  const AVStereo3D *stereo = (AVStereo3D *)sd->data;
2289  print_str("type", av_stereo3d_type_name(stereo->type));
2290  print_int("inverted", !!(stereo->flags & AV_STEREO3D_FLAG_INVERT));
2291  } else if (sd->type == AV_PKT_DATA_SPHERICAL) {
2292  const AVSphericalMapping *spherical = (AVSphericalMapping *)sd->data;
2293  print_str("projection", av_spherical_projection_name(spherical->projection));
2294  if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
2295  print_int("padding", spherical->padding);
2296  } else if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
2297  size_t l, t, r, b;
2298  av_spherical_tile_bounds(spherical, par->width, par->height,
2299  &l, &t, &r, &b);
2300  print_int("bound_left", l);
2301  print_int("bound_top", t);
2302  print_int("bound_right", r);
2303  print_int("bound_bottom", b);
2304  }
2305 
2306  print_int("yaw", (double) spherical->yaw / (1 << 16));
2307  print_int("pitch", (double) spherical->pitch / (1 << 16));
2308  print_int("roll", (double) spherical->roll / (1 << 16));
2309  } else if (sd->type == AV_PKT_DATA_SKIP_SAMPLES && sd->size == 10) {
2310  print_int("skip_samples", AV_RL32(sd->data));
2311  print_int("discard_padding", AV_RL32(sd->data + 4));
2312  print_int("skip_reason", AV_RL8(sd->data + 8));
2313  print_int("discard_reason", AV_RL8(sd->data + 9));
2314  } else if (sd->type == AV_PKT_DATA_MASTERING_DISPLAY_METADATA) {
2316 
2317  if (metadata->has_primaries) {
2318  print_q("red_x", metadata->display_primaries[0][0], '/');
2319  print_q("red_y", metadata->display_primaries[0][1], '/');
2320  print_q("green_x", metadata->display_primaries[1][0], '/');
2321  print_q("green_y", metadata->display_primaries[1][1], '/');
2322  print_q("blue_x", metadata->display_primaries[2][0], '/');
2323  print_q("blue_y", metadata->display_primaries[2][1], '/');
2324 
2325  print_q("white_point_x", metadata->white_point[0], '/');
2326  print_q("white_point_y", metadata->white_point[1], '/');
2327  }
2328 
2329  if (metadata->has_luminance) {
2330  print_q("min_luminance", metadata->min_luminance, '/');
2331  print_q("max_luminance", metadata->max_luminance, '/');
2332  }
2333  } else if (sd->type == AV_PKT_DATA_CONTENT_LIGHT_LEVEL) {
2335  print_int("max_content", metadata->MaxCLL);
2336  print_int("max_average", metadata->MaxFALL);
2337  } else if (sd->type == AV_PKT_DATA_DOVI_CONF) {
2339  print_int("dv_version_major", dovi->dv_version_major);
2340  print_int("dv_version_minor", dovi->dv_version_minor);
2341  print_int("dv_profile", dovi->dv_profile);
2342  print_int("dv_level", dovi->dv_level);
2343  print_int("rpu_present_flag", dovi->rpu_present_flag);
2344  print_int("el_present_flag", dovi->el_present_flag);
2345  print_int("bl_present_flag", dovi->bl_present_flag);
2346  print_int("dv_bl_signal_compatibility_id", dovi->dv_bl_signal_compatibility_id);
2347  } else if (sd->type == AV_PKT_DATA_AUDIO_SERVICE_TYPE) {
2348  enum AVAudioServiceType *t = (enum AVAudioServiceType *)sd->data;
2349  print_int("service_type", *t);
2350  } else if (sd->type == AV_PKT_DATA_MPEGTS_STREAM_ID) {
2351  print_int("id", *sd->data);
2352  } else if (sd->type == AV_PKT_DATA_CPB_PROPERTIES) {
2353  const AVCPBProperties *prop = (AVCPBProperties *)sd->data;
2354  print_int("max_bitrate", prop->max_bitrate);
2355  print_int("min_bitrate", prop->min_bitrate);
2356  print_int("avg_bitrate", prop->avg_bitrate);
2357  print_int("buffer_size", prop->buffer_size);
2358  print_int("vbv_delay", prop->vbv_delay);
2359  } else if (sd->type == AV_PKT_DATA_WEBVTT_IDENTIFIER ||
2361  if (do_show_data)
2362  writer_print_data(w, "data", sd->data, sd->size);
2363  writer_print_data_hash(w, "data_hash", sd->data, sd->size);
2364  } else if (sd->type == AV_PKT_DATA_AFD && sd->size > 0) {
2365  print_int("active_format", *sd->data);
2366  }
2368  }
2370 }
2371 
2373 {
2374  const char *val = av_color_range_name(color_range);
2376  print_str_opt("color_range", "unknown");
2377  } else {
2378  print_str("color_range", val);
2379  }
2380 }
2381 
2382 static void print_color_space(WriterContext *w, enum AVColorSpace color_space)
2383 {
2384  const char *val = av_color_space_name(color_space);
2385  if (!val || color_space == AVCOL_SPC_UNSPECIFIED) {
2386  print_str_opt("color_space", "unknown");
2387  } else {
2388  print_str("color_space", val);
2389  }
2390 }
2391 
2393 {
2396  print_str_opt("color_primaries", "unknown");
2397  } else {
2398  print_str("color_primaries", val);
2399  }
2400 }
2401 
2403 {
2404  const char *val = av_color_transfer_name(color_trc);
2405  if (!val || color_trc == AVCOL_TRC_UNSPECIFIED) {
2406  print_str_opt("color_transfer", "unknown");
2407  } else {
2408  print_str("color_transfer", val);
2409  }
2410 }
2411 
2412 static void print_chroma_location(WriterContext *w, enum AVChromaLocation chroma_location)
2413 {
2414  const char *val = av_chroma_location_name(chroma_location);
2415  if (!val || chroma_location == AVCHROMA_LOC_UNSPECIFIED) {
2416  print_str_opt("chroma_location", "unspecified");
2417  } else {
2418  print_str("chroma_location", val);
2419  }
2420 }
2421 
2422 
2423 static void clear_log(int need_lock)
2424 {
2425  int i;
2426 
2427  if (need_lock)
2428  pthread_mutex_lock(&log_mutex);
2429  for (i=0; i<log_buffer_size; i++) {
2430  av_freep(&log_buffer[i].context_name);
2431  av_freep(&log_buffer[i].parent_name);
2432  av_freep(&log_buffer[i].log_message);
2433  }
2434  log_buffer_size = 0;
2435  if(need_lock)
2436  pthread_mutex_unlock(&log_mutex);
2437 }
2438 
2439 static int show_log(WriterContext *w, int section_ids, int section_id, int log_level)
2440 {
2441  int i;
2442  pthread_mutex_lock(&log_mutex);
2443  if (!log_buffer_size) {
2444  pthread_mutex_unlock(&log_mutex);
2445  return 0;
2446  }
2447  writer_print_section_header(w, section_ids);
2448 
2449  for (i=0; i<log_buffer_size; i++) {
2450  if (log_buffer[i].log_level <= log_level) {
2451  writer_print_section_header(w, section_id);
2452  print_str("context", log_buffer[i].context_name);
2453  print_int("level", log_buffer[i].log_level);
2454  print_int("category", log_buffer[i].category);
2455  if (log_buffer[i].parent_name) {
2456  print_str("parent_context", log_buffer[i].parent_name);
2457  print_int("parent_category", log_buffer[i].parent_category);
2458  } else {
2459  print_str_opt("parent_context", "N/A");
2460  print_str_opt("parent_category", "N/A");
2461  }
2462  print_str("message", log_buffer[i].log_message);
2464  }
2465  }
2466  clear_log(0);
2467  pthread_mutex_unlock(&log_mutex);
2468 
2470 
2471  return 0;
2472 }
2473 
2474 static void show_packet(WriterContext *w, InputFile *ifile, AVPacket *pkt, int packet_idx)
2475 {
2476  char val_str[128];
2477  AVStream *st = ifile->streams[pkt->stream_index].st;
2478  AVBPrint pbuf;
2479  const char *s;
2480 
2482 
2484 
2486  if (s) print_str ("codec_type", s);
2487  else print_str_opt("codec_type", "unknown");
2488  print_int("stream_index", pkt->stream_index);
2489  print_ts ("pts", pkt->pts);
2490  print_time("pts_time", pkt->pts, &st->time_base);
2491  print_ts ("dts", pkt->dts);
2492  print_time("dts_time", pkt->dts, &st->time_base);
2493  print_duration_ts("duration", pkt->duration);
2494  print_duration_time("duration_time", pkt->duration, &st->time_base);
2495  print_val("size", pkt->size, unit_byte_str);
2496  if (pkt->pos != -1) print_fmt ("pos", "%"PRId64, pkt->pos);
2497  else print_str_opt("pos", "N/A");
2498  print_fmt("flags", "%c%c", pkt->flags & AV_PKT_FLAG_KEY ? 'K' : '_',
2499  pkt->flags & AV_PKT_FLAG_DISCARD ? 'D' : '_');
2500 
2501  if (pkt->side_data_elems) {
2502  size_t size;
2503  const uint8_t *side_metadata;
2504 
2506  if (side_metadata && size && do_show_packet_tags) {
2507  AVDictionary *dict = NULL;
2508  if (av_packet_unpack_dictionary(side_metadata, size, &dict) >= 0)
2510  av_dict_free(&dict);
2511  }
2512 
2516  }
2517 
2518  if (do_show_data)
2519  writer_print_data(w, "data", pkt->data, pkt->size);
2520  writer_print_data_hash(w, "data_hash", pkt->data, pkt->size);
2522 
2523  av_bprint_finalize(&pbuf, NULL);
2524  fflush(stdout);
2525 }
2526 
2529 {
2530  AVBPrint pbuf;
2531 
2533 
2535 
2536  print_str ("media_type", "subtitle");
2537  print_ts ("pts", sub->pts);
2538  print_time("pts_time", sub->pts, &AV_TIME_BASE_Q);
2539  print_int ("format", sub->format);
2540  print_int ("start_display_time", sub->start_display_time);
2541  print_int ("end_display_time", sub->end_display_time);
2542  print_int ("num_rects", sub->num_rects);
2543 
2545 
2546  av_bprint_finalize(&pbuf, NULL);
2547  fflush(stdout);
2548 }
2549 
2552 {
2553  AVBPrint pbuf;
2554  char val_str[128];
2555  const char *s;
2556  int i;
2557 
2559 
2561 
2563  if (s) print_str ("media_type", s);
2564  else print_str_opt("media_type", "unknown");
2565  print_int("stream_index", stream->index);
2566  print_int("key_frame", frame->key_frame);
2567  print_ts ("pts", frame->pts);
2568  print_time("pts_time", frame->pts, &stream->time_base);
2569  print_ts ("pkt_dts", frame->pkt_dts);
2570  print_time("pkt_dts_time", frame->pkt_dts, &stream->time_base);
2571  print_ts ("best_effort_timestamp", frame->best_effort_timestamp);
2572  print_time("best_effort_timestamp_time", frame->best_effort_timestamp, &stream->time_base);
2573  print_duration_ts ("pkt_duration", frame->pkt_duration);
2574  print_duration_time("pkt_duration_time", frame->pkt_duration, &stream->time_base);
2575  if (frame->pkt_pos != -1) print_fmt ("pkt_pos", "%"PRId64, frame->pkt_pos);
2576  else print_str_opt("pkt_pos", "N/A");
2577  if (frame->pkt_size != -1) print_val ("pkt_size", frame->pkt_size, unit_byte_str);
2578  else print_str_opt("pkt_size", "N/A");
2579 
2580  switch (stream->codecpar->codec_type) {
2581  AVRational sar;
2582 
2583  case AVMEDIA_TYPE_VIDEO:
2584  print_int("width", frame->width);
2585  print_int("height", frame->height);
2586  s = av_get_pix_fmt_name(frame->format);
2587  if (s) print_str ("pix_fmt", s);
2588  else print_str_opt("pix_fmt", "unknown");
2589  sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, frame);
2590  if (sar.num) {
2591  print_q("sample_aspect_ratio", sar, ':');
2592  } else {
2593  print_str_opt("sample_aspect_ratio", "N/A");
2594  }
2595  print_fmt("pict_type", "%c", av_get_picture_type_char(frame->pict_type));
2596  print_int("coded_picture_number", frame->coded_picture_number);
2597  print_int("display_picture_number", frame->display_picture_number);
2598  print_int("interlaced_frame", frame->interlaced_frame);
2599  print_int("top_field_first", frame->top_field_first);
2600  print_int("repeat_pict", frame->repeat_pict);
2601 
2602  print_color_range(w, frame->color_range);
2603  print_color_space(w, frame->colorspace);
2604  print_primaries(w, frame->color_primaries);
2605  print_color_trc(w, frame->color_trc);
2606  print_chroma_location(w, frame->chroma_location);
2607  break;
2608 
2609  case AVMEDIA_TYPE_AUDIO:
2610  s = av_get_sample_fmt_name(frame->format);
2611  if (s) print_str ("sample_fmt", s);
2612  else print_str_opt("sample_fmt", "unknown");
2613  print_int("nb_samples", frame->nb_samples);
2614  print_int("channels", frame->ch_layout.nb_channels);
2615  if (frame->ch_layout.order != AV_CHANNEL_ORDER_UNSPEC) {
2616  av_channel_layout_describe(&frame->ch_layout, val_str, sizeof(val_str));
2617  print_str ("channel_layout", val_str);
2618  } else
2619  print_str_opt("channel_layout", "unknown");
2620  break;
2621  }
2622  if (do_show_frame_tags)
2623  show_tags(w, frame->metadata, SECTION_ID_FRAME_TAGS);
2624  if (do_show_log)
2626  if (frame->nb_side_data) {
2628  for (i = 0; i < frame->nb_side_data; i++) {
2629  AVFrameSideData *sd = frame->side_data[i];
2630  const char *name;
2631 
2634  print_str("side_data_type", name ? name : "unknown");
2635  if (sd->type == AV_FRAME_DATA_DISPLAYMATRIX && sd->size >= 9*4) {
2636  writer_print_integers(w, "displaymatrix", sd->data, 9, " %11d", 3, 4, 1);
2637  print_int("rotation", av_display_rotation_get((int32_t *)sd->data));
2638  } else if (sd->type == AV_FRAME_DATA_AFD && sd->size > 0) {
2639  print_int("active_format", *sd->data);
2640  } else if (sd->type == AV_FRAME_DATA_GOP_TIMECODE && sd->size >= 8) {
2641  char tcbuf[AV_TIMECODE_STR_SIZE];
2642  av_timecode_make_mpeg_tc_string(tcbuf, *(int64_t *)(sd->data));
2643  print_str("timecode", tcbuf);
2644  } else if (sd->type == AV_FRAME_DATA_S12M_TIMECODE && sd->size == 16) {
2645  uint32_t *tc = (uint32_t*)sd->data;
2646  int m = FFMIN(tc[0],3);
2648  for (int j = 1; j <= m ; j++) {
2649  char tcbuf[AV_TIMECODE_STR_SIZE];
2650  av_timecode_make_smpte_tc_string2(tcbuf, stream->avg_frame_rate, tc[j], 0, 0);
2652  print_str("value", tcbuf);
2654  }
2656  } else if (sd->type == AV_FRAME_DATA_MASTERING_DISPLAY_METADATA) {
2658 
2659  if (metadata->has_primaries) {
2660  print_q("red_x", metadata->display_primaries[0][0], '/');
2661  print_q("red_y", metadata->display_primaries[0][1], '/');
2662  print_q("green_x", metadata->display_primaries[1][0], '/');
2663  print_q("green_y", metadata->display_primaries[1][1], '/');
2664  print_q("blue_x", metadata->display_primaries[2][0], '/');
2665  print_q("blue_y", metadata->display_primaries[2][1], '/');
2666 
2667  print_q("white_point_x", metadata->white_point[0], '/');
2668  print_q("white_point_y", metadata->white_point[1], '/');
2669  }
2670 
2671  if (metadata->has_luminance) {
2672  print_q("min_luminance", metadata->min_luminance, '/');
2673  print_q("max_luminance", metadata->max_luminance, '/');
2674  }
2675  } else if (sd->type == AV_FRAME_DATA_DYNAMIC_HDR_PLUS) {
2676  AVDynamicHDRPlus *metadata = (AVDynamicHDRPlus *)sd->data;
2677  print_dynamic_hdr10_plus(w, metadata);
2678  } else if (sd->type == AV_FRAME_DATA_CONTENT_LIGHT_LEVEL) {
2680  print_int("max_content", metadata->MaxCLL);
2681  print_int("max_average", metadata->MaxFALL);
2682  } else if (sd->type == AV_FRAME_DATA_ICC_PROFILE) {
2684  if (tag)
2685  print_str(tag->key, tag->value);
2686  print_int("size", sd->size);
2687  } else if (sd->type == AV_FRAME_DATA_DOVI_METADATA) {
2688  print_dovi_metadata(w, (const AVDOVIMetadata *)sd->data);
2689  } else if (sd->type == AV_FRAME_DATA_DYNAMIC_HDR_VIVID) {
2690  AVDynamicHDRVivid *metadata = (AVDynamicHDRVivid *)sd->data;
2691  print_dynamic_hdr_vivid(w, metadata);
2692  }
2694  }
2696  }
2697 
2699 
2700  av_bprint_finalize(&pbuf, NULL);
2701  fflush(stdout);
2702 }
2703 
2705  InputFile *ifile,
2707  int *packet_new)
2708 {
2709  AVFormatContext *fmt_ctx = ifile->fmt_ctx;
2710  AVCodecContext *dec_ctx = ifile->streams[pkt->stream_index].dec_ctx;
2711  AVCodecParameters *par = ifile->streams[pkt->stream_index].st->codecpar;
2712  AVSubtitle sub;
2713  int ret = 0, got_frame = 0;
2714 
2715  clear_log(1);
2716  if (dec_ctx) {
2717  switch (par->codec_type) {
2718  case AVMEDIA_TYPE_VIDEO:
2719  case AVMEDIA_TYPE_AUDIO:
2720  if (*packet_new) {
2722  if (ret == AVERROR(EAGAIN)) {
2723  ret = 0;
2724  } else if (ret >= 0 || ret == AVERROR_EOF) {
2725  ret = 0;
2726  *packet_new = 0;
2727  }
2728  }
2729  if (ret >= 0) {
2731  if (ret >= 0) {
2732  got_frame = 1;
2733  } else if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
2734  ret = 0;
2735  }
2736  }
2737  break;
2738 
2739  case AVMEDIA_TYPE_SUBTITLE:
2740  if (*packet_new)
2741  ret = avcodec_decode_subtitle2(dec_ctx, &sub, &got_frame, pkt);
2742  *packet_new = 0;
2743  break;
2744  default:
2745  *packet_new = 0;
2746  }
2747  } else {
2748  *packet_new = 0;
2749  }
2750 
2751  if (ret < 0)
2752  return ret;
2753  if (got_frame) {
2754  int is_sub = (par->codec_type == AVMEDIA_TYPE_SUBTITLE);
2756  if (do_show_frames)
2757  if (is_sub)
2758  show_subtitle(w, &sub, ifile->streams[pkt->stream_index].st, fmt_ctx);
2759  else
2760  show_frame(w, frame, ifile->streams[pkt->stream_index].st, fmt_ctx);
2761  if (is_sub)
2762  avsubtitle_free(&sub);
2763  }
2764  return got_frame || *packet_new;
2765 }
2766 
2767 static void log_read_interval(const ReadInterval *interval, void *log_ctx, int log_level)
2768 {
2769  av_log(log_ctx, log_level, "id:%d", interval->id);
2770 
2771  if (interval->has_start) {
2772  av_log(log_ctx, log_level, " start:%s%s", interval->start_is_offset ? "+" : "",
2773  av_ts2timestr(interval->start, &AV_TIME_BASE_Q));
2774  } else {
2775  av_log(log_ctx, log_level, " start:N/A");
2776  }
2777 
2778  if (interval->has_end) {
2779  av_log(log_ctx, log_level, " end:%s", interval->end_is_offset ? "+" : "");
2780  if (interval->duration_frames)
2781  av_log(log_ctx, log_level, "#%"PRId64, interval->end);
2782  else
2783  av_log(log_ctx, log_level, "%s", av_ts2timestr(interval->end, &AV_TIME_BASE_Q));
2784  } else {
2785  av_log(log_ctx, log_level, " end:N/A");
2786  }
2787 
2788  av_log(log_ctx, log_level, "\n");
2789 }
2790 
2792  const ReadInterval *interval, int64_t *cur_ts)
2793 {
2794  AVFormatContext *fmt_ctx = ifile->fmt_ctx;
2795  AVPacket *pkt = NULL;
2796  AVFrame *frame = NULL;
2797  int ret = 0, i = 0, frame_count = 0;
2798  int64_t start = -INT64_MAX, end = interval->end;
2799  int has_start = 0, has_end = interval->has_end && !interval->end_is_offset;
2800 
2801  av_log(NULL, AV_LOG_VERBOSE, "Processing read interval ");
2803 
2804  if (interval->has_start) {
2805  int64_t target;
2806  if (interval->start_is_offset) {
2807  if (*cur_ts == AV_NOPTS_VALUE) {
2809  "Could not seek to relative position since current "
2810  "timestamp is not defined\n");
2811  ret = AVERROR(EINVAL);
2812  goto end;
2813  }
2814  target = *cur_ts + interval->start;
2815  } else {
2816  target = interval->start;
2817  }
2818 
2819  av_log(NULL, AV_LOG_VERBOSE, "Seeking to read interval start point %s\n",
2820  av_ts2timestr(target, &AV_TIME_BASE_Q));
2821  if ((ret = avformat_seek_file(fmt_ctx, -1, -INT64_MAX, target, INT64_MAX, 0)) < 0) {
2822  av_log(NULL, AV_LOG_ERROR, "Could not seek to position %"PRId64": %s\n",
2823  interval->start, av_err2str(ret));
2824  goto end;
2825  }
2826  }
2827 
2828  frame = av_frame_alloc();
2829  if (!frame) {
2830  ret = AVERROR(ENOMEM);
2831  goto end;
2832  }
2833  pkt = av_packet_alloc();
2834  if (!pkt) {
2835  ret = AVERROR(ENOMEM);
2836  goto end;
2837  }
2838  while (!av_read_frame(fmt_ctx, pkt)) {
2839  if (fmt_ctx->nb_streams > nb_streams) {
2844  }
2846  AVRational tb = ifile->streams[pkt->stream_index].st->time_base;
2847 
2848  if (pkt->pts != AV_NOPTS_VALUE)
2849  *cur_ts = av_rescale_q(pkt->pts, tb, AV_TIME_BASE_Q);
2850 
2851  if (!has_start && *cur_ts != AV_NOPTS_VALUE) {
2852  start = *cur_ts;
2853  has_start = 1;
2854  }
2855 
2856  if (has_start && !has_end && interval->end_is_offset) {
2857  end = start + interval->end;
2858  has_end = 1;
2859  }
2860 
2861  if (interval->end_is_offset && interval->duration_frames) {
2862  if (frame_count >= interval->end)
2863  break;
2864  } else if (has_end && *cur_ts != AV_NOPTS_VALUE && *cur_ts >= end) {
2865  break;
2866  }
2867 
2868  frame_count++;
2869  if (do_read_packets) {
2870  if (do_show_packets)
2871  show_packet(w, ifile, pkt, i++);
2873  }
2874  if (do_read_frames) {
2875  int packet_new = 1;
2876  while (process_frame(w, ifile, frame, pkt, &packet_new) > 0);
2877  }
2878  }
2880  }
2882  //Flush remaining frames that are cached in the decoder
2883  for (i = 0; i < fmt_ctx->nb_streams; i++) {
2884  pkt->stream_index = i;
2885  if (do_read_frames) {
2886  while (process_frame(w, ifile, frame, pkt, &(int){1}) > 0);
2887  if (ifile->streams[i].dec_ctx)
2888  avcodec_flush_buffers(ifile->streams[i].dec_ctx);
2889  }
2890  }
2891 
2892 end:
2893  av_frame_free(&frame);
2894  av_packet_free(&pkt);
2895  if (ret < 0) {
2896  av_log(NULL, AV_LOG_ERROR, "Could not read packets in interval ");
2897  log_read_interval(interval, NULL, AV_LOG_ERROR);
2898  }
2899  return ret;
2900 }
2901 
2903 {
2904  AVFormatContext *fmt_ctx = ifile->fmt_ctx;
2905  int i, ret = 0;
2906  int64_t cur_ts = fmt_ctx->start_time;
2907 
2908  if (read_intervals_nb == 0) {
2909  ReadInterval interval = (ReadInterval) { .has_start = 0, .has_end = 0 };
2910  ret = read_interval_packets(w, ifile, &interval, &cur_ts);
2911  } else {
2912  for (i = 0; i < read_intervals_nb; i++) {
2913  ret = read_interval_packets(w, ifile, &read_intervals[i], &cur_ts);
2914  if (ret < 0)
2915  break;
2916  }
2917  }
2918 
2919  return ret;
2920 }
2921 
2922 static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_idx, InputStream *ist, int in_program)
2923 {
2924  AVStream *stream = ist->st;
2925  AVCodecParameters *par;
2927  char val_str[128];
2928  const char *s;
2929  AVRational sar, dar;
2930  AVBPrint pbuf;
2931  const AVCodecDescriptor *cd;
2932  int ret = 0;
2933  const char *profile = NULL;
2934 
2936 
2938 
2939  print_int("index", stream->index);
2940 
2941  par = stream->codecpar;
2942  dec_ctx = ist->dec_ctx;
2943  if (cd = avcodec_descriptor_get(par->codec_id)) {
2944  print_str("codec_name", cd->name);
2945  if (!do_bitexact) {
2946  print_str("codec_long_name",
2947  cd->long_name ? cd->long_name : "unknown");
2948  }
2949  } else {
2950  print_str_opt("codec_name", "unknown");
2951  if (!do_bitexact) {
2952  print_str_opt("codec_long_name", "unknown");
2953  }
2954  }
2955 
2956  if (!do_bitexact && (profile = avcodec_profile_name(par->codec_id, par->profile)))
2957  print_str("profile", profile);
2958  else {
2959  if (par->profile != FF_PROFILE_UNKNOWN) {
2960  char profile_num[12];
2961  snprintf(profile_num, sizeof(profile_num), "%d", par->profile);
2962  print_str("profile", profile_num);
2963  } else
2964  print_str_opt("profile", "unknown");
2965  }
2966 
2968  if (s) print_str ("codec_type", s);
2969  else print_str_opt("codec_type", "unknown");
2970 
2971  /* print AVI/FourCC tag */
2972  print_str("codec_tag_string", av_fourcc2str(par->codec_tag));
2973  print_fmt("codec_tag", "0x%04"PRIx32, par->codec_tag);
2974 
2975  switch (par->codec_type) {
2976  case AVMEDIA_TYPE_VIDEO:
2977  print_int("width", par->width);
2978  print_int("height", par->height);
2979  if (dec_ctx) {
2980  print_int("coded_width", dec_ctx->coded_width);
2981  print_int("coded_height", dec_ctx->coded_height);
2984  }
2985  print_int("has_b_frames", par->video_delay);
2986  sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, NULL);
2987  if (sar.num) {
2988  print_q("sample_aspect_ratio", sar, ':');
2989  av_reduce(&dar.num, &dar.den,
2990  par->width * sar.num,
2991  par->height * sar.den,
2992  1024*1024);
2993  print_q("display_aspect_ratio", dar, ':');
2994  } else {
2995  print_str_opt("sample_aspect_ratio", "N/A");
2996  print_str_opt("display_aspect_ratio", "N/A");
2997  }
2998  s = av_get_pix_fmt_name(par->format);
2999  if (s) print_str ("pix_fmt", s);
3000  else print_str_opt("pix_fmt", "unknown");
3001  print_int("level", par->level);
3002 
3005  print_color_trc(w, par->color_trc);
3008 
3009  if (par->field_order == AV_FIELD_PROGRESSIVE)
3010  print_str("field_order", "progressive");
3011  else if (par->field_order == AV_FIELD_TT)
3012  print_str("field_order", "tt");
3013  else if (par->field_order == AV_FIELD_BB)
3014  print_str("field_order", "bb");
3015  else if (par->field_order == AV_FIELD_TB)
3016  print_str("field_order", "tb");
3017  else if (par->field_order == AV_FIELD_BT)
3018  print_str("field_order", "bt");
3019  else
3020  print_str_opt("field_order", "unknown");
3021 
3022  if (dec_ctx)
3023  print_int("refs", dec_ctx->refs);
3024  break;
3025 
3026  case AVMEDIA_TYPE_AUDIO:
3028  if (s) print_str ("sample_fmt", s);
3029  else print_str_opt("sample_fmt", "unknown");
3030  print_val("sample_rate", par->sample_rate, unit_hertz_str);
3031  print_int("channels", par->ch_layout.nb_channels);
3032 
3033  if (par->ch_layout.order != AV_CHANNEL_ORDER_UNSPEC) {
3034  av_channel_layout_describe(&par->ch_layout, val_str, sizeof(val_str));
3035  print_str ("channel_layout", val_str);
3036  } else {
3037  print_str_opt("channel_layout", "unknown");
3038  }
3039 
3040  print_int("bits_per_sample", av_get_bits_per_sample(par->codec_id));
3041  break;
3042 
3043  case AVMEDIA_TYPE_SUBTITLE:
3044  if (par->width)
3045  print_int("width", par->width);
3046  else
3047  print_str_opt("width", "N/A");
3048  if (par->height)
3049  print_int("height", par->height);
3050  else
3051  print_str_opt("height", "N/A");
3052  break;
3053  }
3054 
3056  const AVOption *opt = NULL;
3057  while (opt = av_opt_next(dec_ctx->priv_data,opt)) {
3058  uint8_t *str;
3059  if (!(opt->flags & AV_OPT_FLAG_EXPORT)) continue;
3060  if (av_opt_get(dec_ctx->priv_data, opt->name, 0, &str) >= 0) {
3061  print_str(opt->name, str);
3062  av_free(str);
3063  }
3064  }
3065  }
3066 
3067  if (fmt_ctx->iformat->flags & AVFMT_SHOW_IDS) print_fmt ("id", "0x%x", stream->id);
3068  else print_str_opt("id", "N/A");
3069  print_q("r_frame_rate", stream->r_frame_rate, '/');
3070  print_q("avg_frame_rate", stream->avg_frame_rate, '/');
3071  print_q("time_base", stream->time_base, '/');
3072  print_ts ("start_pts", stream->start_time);
3073  print_time("start_time", stream->start_time, &stream->time_base);
3074  print_ts ("duration_ts", stream->duration);
3075  print_time("duration", stream->duration, &stream->time_base);
3076  if (par->bit_rate > 0) print_val ("bit_rate", par->bit_rate, unit_bit_per_second_str);
3077  else print_str_opt("bit_rate", "N/A");
3078  if (dec_ctx && dec_ctx->rc_max_rate > 0)
3080  else
3081  print_str_opt("max_bit_rate", "N/A");
3082  if (dec_ctx && dec_ctx->bits_per_raw_sample > 0) print_fmt("bits_per_raw_sample", "%d", dec_ctx->bits_per_raw_sample);
3083  else print_str_opt("bits_per_raw_sample", "N/A");
3084  if (stream->nb_frames) print_fmt ("nb_frames", "%"PRId64, stream->nb_frames);
3085  else print_str_opt("nb_frames", "N/A");
3086  if (nb_streams_frames[stream_idx]) print_fmt ("nb_read_frames", "%"PRIu64, nb_streams_frames[stream_idx]);
3087  else print_str_opt("nb_read_frames", "N/A");
3088  if (nb_streams_packets[stream_idx]) print_fmt ("nb_read_packets", "%"PRIu64, nb_streams_packets[stream_idx]);
3089  else print_str_opt("nb_read_packets", "N/A");
3090  if (do_show_data)
3091  writer_print_data(w, "extradata", par->extradata,
3092  par->extradata_size);
3093 
3094  if (par->extradata_size > 0) {
3095  print_int("extradata_size", par->extradata_size);
3096  writer_print_data_hash(w, "extradata_hash", par->extradata,
3097  par->extradata_size);
3098  }
3099 
3100  /* Print disposition information */
3101 #define PRINT_DISPOSITION(flagname, name) do { \
3102  print_int(name, !!(stream->disposition & AV_DISPOSITION_##flagname)); \
3103  } while (0)
3104 
3107  PRINT_DISPOSITION(DEFAULT, "default");
3108  PRINT_DISPOSITION(DUB, "dub");
3109  PRINT_DISPOSITION(ORIGINAL, "original");
3110  PRINT_DISPOSITION(COMMENT, "comment");
3111  PRINT_DISPOSITION(LYRICS, "lyrics");
3112  PRINT_DISPOSITION(KARAOKE, "karaoke");
3113  PRINT_DISPOSITION(FORCED, "forced");
3114  PRINT_DISPOSITION(HEARING_IMPAIRED, "hearing_impaired");
3115  PRINT_DISPOSITION(VISUAL_IMPAIRED, "visual_impaired");
3116  PRINT_DISPOSITION(CLEAN_EFFECTS, "clean_effects");
3117  PRINT_DISPOSITION(ATTACHED_PIC, "attached_pic");
3118  PRINT_DISPOSITION(TIMED_THUMBNAILS, "timed_thumbnails");
3119  PRINT_DISPOSITION(CAPTIONS, "captions");
3120  PRINT_DISPOSITION(DESCRIPTIONS, "descriptions");
3121  PRINT_DISPOSITION(METADATA, "metadata");
3122  PRINT_DISPOSITION(DEPENDENT, "dependent");
3123  PRINT_DISPOSITION(STILL_IMAGE, "still_image");
3125  }
3126 
3127  if (do_show_stream_tags)
3129 
3130  if (stream->nb_side_data) {
3131  print_pkt_side_data(w, stream->codecpar, stream->side_data, stream->nb_side_data,
3134  }
3135 
3137  av_bprint_finalize(&pbuf, NULL);
3138  fflush(stdout);
3139 
3140  return ret;
3141 }
3142 
3144 {
3145  AVFormatContext *fmt_ctx = ifile->fmt_ctx;
3146  int i, ret = 0;
3147 
3149  for (i = 0; i < ifile->nb_streams; i++)
3150  if (selected_streams[i]) {
3151  ret = show_stream(w, fmt_ctx, i, &ifile->streams[i], 0);
3152  if (ret < 0)
3153  break;
3154  }
3156 
3157  return ret;
3158 }
3159 
3161 {
3162  AVFormatContext *fmt_ctx = ifile->fmt_ctx;
3163  int i, ret = 0;
3164 
3166  print_int("program_id", program->id);
3167  print_int("program_num", program->program_num);
3168  print_int("nb_streams", program->nb_stream_indexes);
3169  print_int("pmt_pid", program->pmt_pid);
3170  print_int("pcr_pid", program->pcr_pid);
3173  if (ret < 0)
3174  goto end;
3175 
3177  for (i = 0; i < program->nb_stream_indexes; i++) {
3178  if (selected_streams[program->stream_index[i]]) {
3179  ret = show_stream(w, fmt_ctx, program->stream_index[i], &ifile->streams[program->stream_index[i]], 1);
3180  if (ret < 0)
3181  break;
3182  }
3183  }
3185 
3186 end:
3188  return ret;
3189 }
3190 
3192 {
3193  AVFormatContext *fmt_ctx = ifile->fmt_ctx;
3194  int i, ret = 0;
3195 
3197  for (i = 0; i < fmt_ctx->nb_programs; i++) {
3199  if (!program)
3200  continue;
3202  if (ret < 0)
3203  break;
3204  }
3206  return ret;
3207 }
3208 
3210 {
3211  AVFormatContext *fmt_ctx = ifile->fmt_ctx;
3212  int i, ret = 0;
3213 
3215  for (i = 0; i < fmt_ctx->nb_chapters; i++) {
3216  AVChapter *chapter = fmt_ctx->chapters[i];
3217 
3219  print_int("id", chapter->id);
3220  print_q ("time_base", chapter->time_base, '/');
3221  print_int("start", chapter->start);
3222  print_time("start_time", chapter->start, &chapter->time_base);
3223  print_int("end", chapter->end);
3224  print_time("end_time", chapter->end, &chapter->time_base);
3228  }
3230 
3231  return ret;
3232 }
3233 
3235 {
3236  AVFormatContext *fmt_ctx = ifile->fmt_ctx;
3237  char val_str[128];
3238  int64_t size = fmt_ctx->pb ? avio_size(fmt_ctx->pb) : -1;
3239  int ret = 0;
3240 
3242  print_str_validate("filename", fmt_ctx->url);
3243  print_int("nb_streams", fmt_ctx->nb_streams);
3244  print_int("nb_programs", fmt_ctx->nb_programs);
3245  print_str("format_name", fmt_ctx->iformat->name);
3246  if (!do_bitexact) {
3247  if (fmt_ctx->iformat->long_name) print_str ("format_long_name", fmt_ctx->iformat->long_name);
3248  else print_str_opt("format_long_name", "unknown");
3249  }
3250  print_time("start_time", fmt_ctx->start_time, &AV_TIME_BASE_Q);
3251  print_time("duration", fmt_ctx->duration, &AV_TIME_BASE_Q);
3252  if (size >= 0) print_val ("size", size, unit_byte_str);
3253  else print_str_opt("size", "N/A");
3255  else print_str_opt("bit_rate", "N/A");
3256  print_int("probe_score", fmt_ctx->probe_score);
3257  if (do_show_format_tags)
3259 
3261  fflush(stdout);
3262  return ret;
3263 }
3264 
3265 static void show_error(WriterContext *w, int err)
3266 {
3267  char errbuf[128];
3268  const char *errbuf_ptr = errbuf;
3269 
3270  if (av_strerror(err, errbuf, sizeof(errbuf)) < 0)
3271  errbuf_ptr = strerror(AVUNERROR(err));
3272 
3274  print_int("code", err);
3275  print_str("string", errbuf_ptr);
3277 }
3278 
3279 static int open_input_file(InputFile *ifile, const char *filename,
3280  const char *print_filename)
3281 {
3282  int err, i;
3284  const AVDictionaryEntry *t = NULL;
3285  int scan_all_pmts_set = 0;
3286 
3288  if (!fmt_ctx) {
3289  print_error(filename, AVERROR(ENOMEM));
3290  exit_program(1);
3291  }
3292 
3293  if (!av_dict_get(format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE)) {
3294  av_dict_set(&format_opts, "scan_all_pmts", "1", AV_DICT_DONT_OVERWRITE);
3295  scan_all_pmts_set = 1;
3296  }
3297  if ((err = avformat_open_input(&fmt_ctx, filename,
3298  iformat, &format_opts)) < 0) {
3299  print_error(filename, err);
3300  return err;
3301  }
3302  if (print_filename) {
3303  av_freep(&fmt_ctx->url);
3304  fmt_ctx->url = av_strdup(print_filename);
3305  }
3306  ifile->fmt_ctx = fmt_ctx;
3307  if (scan_all_pmts_set)
3308  av_dict_set(&format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE);
3309  while ((t = av_dict_get(format_opts, "", t, AV_DICT_IGNORE_SUFFIX)))
3310  av_log(NULL, AV_LOG_WARNING, "Option %s skipped - not known to demuxer.\n", t->key);
3311 
3312  if (find_stream_info) {
3314  int orig_nb_streams = fmt_ctx->nb_streams;
3315 
3317 
3318  for (i = 0; i < orig_nb_streams; i++)
3319  av_dict_free(&opts[i]);
3320  av_freep(&opts);
3321 
3322  if (err < 0) {
3323  print_error(filename, err);
3324  return err;
3325  }
3326  }
3327 
3328  av_dump_format(fmt_ctx, 0, filename, 0);
3329 
3330  ifile->streams = av_calloc(fmt_ctx->nb_streams, sizeof(*ifile->streams));
3331  if (!ifile->streams)
3332  exit(1);
3333  ifile->nb_streams = fmt_ctx->nb_streams;
3334 
3335  /* bind a decoder to each input stream */
3336  for (i = 0; i < fmt_ctx->nb_streams; i++) {
3337  InputStream *ist = &ifile->streams[i];
3338  AVStream *stream = fmt_ctx->streams[i];
3339  const AVCodec *codec;
3340 
3341  ist->st = stream;
3342 
3343  if (stream->codecpar->codec_id == AV_CODEC_ID_PROBE) {
3345  "Failed to probe codec for input stream %d\n",
3346  stream->index);
3347  continue;
3348  }
3349 
3350  codec = avcodec_find_decoder(stream->codecpar->codec_id);
3351  if (!codec) {
3353  "Unsupported codec with id %d for input stream %d\n",
3354  stream->codecpar->codec_id, stream->index);
3355  continue;
3356  }
3357  {
3359  fmt_ctx, stream, codec);
3360 
3361  ist->dec_ctx = avcodec_alloc_context3(codec);
3362  if (!ist->dec_ctx)
3363  exit(1);
3364 
3365  err = avcodec_parameters_to_context(ist->dec_ctx, stream->codecpar);
3366  if (err < 0)
3367  exit(1);
3368 
3369  if (do_show_log) {
3370  // For loging it is needed to disable at least frame threads as otherwise
3371  // the log information would need to be reordered and matches up to contexts and frames
3372  // That is in fact possible but not trivial
3373  av_dict_set(&codec_opts, "threads", "1", 0);
3374  }
3375 
3376  ist->dec_ctx->pkt_timebase = stream->time_base;
3377 
3378  if (avcodec_open2(ist->dec_ctx, codec, &opts) < 0) {
3379  av_log(NULL, AV_LOG_WARNING, "Could not open codec for input stream %d\n",
3380  stream->index);
3381  exit(1);
3382  }
3383 
3384  if ((t = av_dict_get(opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
3385  av_log(NULL, AV_LOG_ERROR, "Option %s for input stream %d not found\n",
3386  t->key, stream->index);
3387  return AVERROR_OPTION_NOT_FOUND;
3388  }
3389  }
3390  }
3391 
3392  ifile->fmt_ctx = fmt_ctx;
3393  return 0;
3394 }
3395 
3397 {
3398  int i;
3399 
3400  /* close decoder for each stream */
3401  for (i = 0; i < ifile->nb_streams; i++)
3402  avcodec_free_context(&ifile->streams[i].dec_ctx);
3403 
3404  av_freep(&ifile->streams);
3405  ifile->nb_streams = 0;
3406 
3407  avformat_close_input(&ifile->fmt_ctx);
3408 }
3409 
3410 static int probe_file(WriterContext *wctx, const char *filename,
3411  const char *print_filename)
3412 {
3413  InputFile ifile = { 0 };
3414  int ret, i;
3415  int section_id;
3416 
3419 
3420  ret = open_input_file(&ifile, filename, print_filename);
3421  if (ret < 0)
3422  goto end;
3423 
3424 #define CHECK_END if (ret < 0) goto end
3425 
3426  nb_streams = ifile.fmt_ctx->nb_streams;
3427  REALLOCZ_ARRAY_STREAM(nb_streams_frames,0,ifile.fmt_ctx->nb_streams);
3428  REALLOCZ_ARRAY_STREAM(nb_streams_packets,0,ifile.fmt_ctx->nb_streams);
3429  REALLOCZ_ARRAY_STREAM(selected_streams,0,ifile.fmt_ctx->nb_streams);
3430 
3431  for (i = 0; i < ifile.fmt_ctx->nb_streams; i++) {
3432  if (stream_specifier) {
3434  ifile.fmt_ctx->streams[i],
3436  CHECK_END;
3437  else
3438  selected_streams[i] = ret;
3439  ret = 0;
3440  } else {
3441  selected_streams[i] = 1;
3442  }
3443  if (!selected_streams[i])
3444  ifile.fmt_ctx->streams[i]->discard = AVDISCARD_ALL;
3445  }
3446 
3450  section_id = SECTION_ID_PACKETS_AND_FRAMES;
3451  else if (do_show_packets && !do_show_frames)
3452  section_id = SECTION_ID_PACKETS;
3453  else // (!do_show_packets && do_show_frames)
3454  section_id = SECTION_ID_FRAMES;
3456  writer_print_section_header(wctx, section_id);
3457  ret = read_packets(wctx, &ifile);
3460  CHECK_END;
3461  }
3462 
3463  if (do_show_programs) {
3464  ret = show_programs(wctx, &ifile);
3465  CHECK_END;
3466  }
3467 
3468  if (do_show_streams) {
3469  ret = show_streams(wctx, &ifile);
3470  CHECK_END;
3471  }
3472  if (do_show_chapters) {
3473  ret = show_chapters(wctx, &ifile);
3474  CHECK_END;
3475  }
3476  if (do_show_format) {
3477  ret = show_format(wctx, &ifile);
3478  CHECK_END;
3479  }
3480 
3481 end:
3482  if (ifile.fmt_ctx)
3487 
3488  return ret;
3489 }
3490 
3491 static void show_usage(void)
3492 {
3493  av_log(NULL, AV_LOG_INFO, "Simple multimedia streams analyzer\n");
3494  av_log(NULL, AV_LOG_INFO, "usage: %s [OPTIONS] INPUT_FILE\n", program_name);
3495  av_log(NULL, AV_LOG_INFO, "\n");
3496 }
3497 
3499 {
3500  AVBPrint pbuf;
3502 
3504  print_str("version", FFMPEG_VERSION);
3505  print_fmt("copyright", "Copyright (c) %d-%d the FFmpeg developers",
3506  program_birth_year, CONFIG_THIS_YEAR);
3507  print_str("compiler_ident", CC_IDENT);
3508  print_str("configuration", FFMPEG_CONFIGURATION);
3510 
3511  av_bprint_finalize(&pbuf, NULL);
3512 }
3513 
3514 #define SHOW_LIB_VERSION(libname, LIBNAME) \
3515  do { \
3516  if (CONFIG_##LIBNAME) { \
3517  unsigned int version = libname##_version(); \
3518  writer_print_section_header(w, SECTION_ID_LIBRARY_VERSION); \
3519  print_str("name", "lib" #libname); \
3520  print_int("major", LIB##LIBNAME##_VERSION_MAJOR); \
3521  print_int("minor", LIB##LIBNAME##_VERSION_MINOR); \
3522  print_int("micro", LIB##LIBNAME##_VERSION_MICRO); \
3523  print_int("version", version); \
3524  print_str("ident", LIB##LIBNAME##_IDENT); \
3525  writer_print_section_footer(w); \
3526  } \
3527  } while (0)
3528 
3530 {
3532  SHOW_LIB_VERSION(avutil, AVUTIL);
3533  SHOW_LIB_VERSION(avcodec, AVCODEC);
3534  SHOW_LIB_VERSION(avformat, AVFORMAT);
3535  SHOW_LIB_VERSION(avdevice, AVDEVICE);
3536  SHOW_LIB_VERSION(avfilter, AVFILTER);
3537  SHOW_LIB_VERSION(swscale, SWSCALE);
3538  SHOW_LIB_VERSION(swresample, SWRESAMPLE);
3539  SHOW_LIB_VERSION(postproc, POSTPROC);
3541 }
3542 
3543 #define PRINT_PIX_FMT_FLAG(flagname, name) \
3544  do { \
3545  print_int(name, !!(pixdesc->flags & AV_PIX_FMT_FLAG_##flagname)); \
3546  } while (0)
3547 
3549 {
3550  const AVPixFmtDescriptor *pixdesc = NULL;
3551  int i, n;
3552 
3554  while (pixdesc = av_pix_fmt_desc_next(pixdesc)) {
3556  print_str("name", pixdesc->name);
3557  print_int("nb_components", pixdesc->nb_components);
3558  if ((pixdesc->nb_components >= 3) && !(pixdesc->flags & AV_PIX_FMT_FLAG_RGB)) {
3559  print_int ("log2_chroma_w", pixdesc->log2_chroma_w);
3560  print_int ("log2_chroma_h", pixdesc->log2_chroma_h);
3561  } else {
3562  print_str_opt("log2_chroma_w", "N/A");
3563  print_str_opt("log2_chroma_h", "N/A");
3564  }
3565  n = av_get_bits_per_pixel(pixdesc);
3566  if (n) print_int ("bits_per_pixel", n);
3567  else print_str_opt("bits_per_pixel", "N/A");
3570  PRINT_PIX_FMT_FLAG(BE, "big_endian");
3571  PRINT_PIX_FMT_FLAG(PAL, "palette");
3572  PRINT_PIX_FMT_FLAG(BITSTREAM, "bitstream");
3573  PRINT_PIX_FMT_FLAG(HWACCEL, "hwaccel");
3574  PRINT_PIX_FMT_FLAG(PLANAR, "planar");
3575  PRINT_PIX_FMT_FLAG(RGB, "rgb");
3576  PRINT_PIX_FMT_FLAG(ALPHA, "alpha");
3578  }
3579  if (do_show_pixel_format_components && (pixdesc->nb_components > 0)) {
3581  for (i = 0; i < pixdesc->nb_components; i++) {
3583  print_int("index", i + 1);
3584  print_int("bit_depth", pixdesc->comp[i].depth);
3586  }
3588  }
3590  }
3592 }
3593 
3594 static int opt_show_optional_fields(void *optctx, const char *opt, const char *arg)
3595 {
3599 
3602  return 0;
3603 }
3604 
3605 static int opt_format(void *optctx, const char *opt, const char *arg)
3606 {
3608  if (!iformat) {
3609  av_log(NULL, AV_LOG_ERROR, "Unknown input format: %s\n", arg);
3610  return AVERROR(EINVAL);
3611  }
3612  return 0;
3613 }
3614 
3615 static inline void mark_section_show_entries(SectionID section_id,
3616  int show_all_entries, AVDictionary *entries)
3617 {
3618  struct section *section = &sections[section_id];
3619 
3621  if (show_all_entries) {
3622  SectionID *id;
3623  for (id = section->children_ids; *id != -1; id++)
3625  } else {
3626  av_dict_copy(&section->entries_to_show, entries, 0);
3627  }
3628 }
3629 
3630 static int match_section(const char *section_name,
3631  int show_all_entries, AVDictionary *entries)
3632 {
3633  int i, ret = 0;
3634 
3635  for (i = 0; i < FF_ARRAY_ELEMS(sections); i++) {
3636  const struct section *section = &sections[i];
3637  if (!strcmp(section_name, section->name) ||
3638  (section->unique_name && !strcmp(section_name, section->unique_name))) {
3640  "'%s' matches section with unique name '%s'\n", section_name,
3642  ret++;
3644  }
3645  }
3646  return ret;
3647 }
3648 
3649 static int opt_show_entries(void *optctx, const char *opt, const char *arg)
3650 {
3651  const char *p = arg;
3652  int ret = 0;
3653 
3654  while (*p) {
3655  AVDictionary *entries = NULL;
3656  char *section_name = av_get_token(&p, "=:");
3657  int show_all_entries = 0;
3658 
3659  if (!section_name) {
3661  "Missing section name for option '%s'\n", opt);
3662  return AVERROR(EINVAL);
3663  }
3664 
3665  if (*p == '=') {
3666  p++;
3667  while (*p && *p != ':') {
3668  char *entry = av_get_token(&p, ",:");
3669  if (!entry)
3670  break;
3672  "Adding '%s' to the entries to show in section '%s'\n",
3673  entry, section_name);
3674  av_dict_set(&entries, entry, "", AV_DICT_DONT_STRDUP_KEY);
3675  if (*p == ',')
3676  p++;
3677  }
3678  } else {
3679  show_all_entries = 1;
3680  }
3681 
3682  ret = match_section(section_name, show_all_entries, entries);
3683  if (ret == 0) {
3684  av_log(NULL, AV_LOG_ERROR, "No match for section '%s'\n", section_name);
3685  ret = AVERROR(EINVAL);
3686  }
3687  av_dict_free(&entries);
3688  av_free(section_name);
3689 
3690  if (ret <= 0)
3691  break;
3692  if (*p)
3693  p++;
3694  }
3695 
3696  return ret;
3697 }
3698 
3699 static void opt_input_file(void *optctx, const char *arg)
3700 {
3701  if (input_filename) {
3703  "Argument '%s' provided as input filename, but '%s' was already specified.\n",
3704  arg, input_filename);
3705  exit_program(1);
3706  }
3707  if (!strcmp(arg, "-"))
3708  arg = "pipe:";
3709  input_filename = arg;
3710 }
3711 
3712 static int opt_input_file_i(void *optctx, const char *opt, const char *arg)
3713 {
3714  opt_input_file(optctx, arg);
3715  return 0;
3716 }
3717 
3718 static void opt_output_file(void *optctx, const char *arg)
3719 {
3720  if (output_filename) {
3722  "Argument '%s' provided as output filename, but '%s' was already specified.\n",
3723  arg, output_filename);
3724  exit_program(1);
3725  }
3726  if (!strcmp(arg, "-"))
3727  arg = "pipe:";
3728  output_filename = arg;
3729 }
3730 
3731 static int opt_output_file_o(void *optctx, const char *opt, const char *arg)
3732 {
3733  opt_output_file(optctx, arg);
3734  return 0;
3735 }
3736 
3737 static int opt_print_filename(void *optctx, const char *opt, const char *arg)
3738 {
3740  return 0;
3741 }
3742 
3743 void show_help_default(const char *opt, const char *arg)
3744 {
3746  show_usage();
3747  show_help_options(options, "Main options:", 0, 0, 0);
3748  printf("\n");
3749 
3752 }
3753 
3754 /**
3755  * Parse interval specification, according to the format:
3756  * INTERVAL ::= [START|+START_OFFSET][%[END|+END_OFFSET]]
3757  * INTERVALS ::= INTERVAL[,INTERVALS]
3758 */
3759 static int parse_read_interval(const char *interval_spec,
3760  ReadInterval *interval)
3761 {
3762  int ret = 0;
3763  char *next, *p, *spec = av_strdup(interval_spec);
3764  if (!spec)
3765  return AVERROR(ENOMEM);
3766 
3767  if (!*spec) {
3768  av_log(NULL, AV_LOG_ERROR, "Invalid empty interval specification\n");
3769  ret = AVERROR(EINVAL);
3770  goto end;
3771  }
3772 
3773  p = spec;
3774  next = strchr(spec, '%');
3775  if (next)
3776  *next++ = 0;
3777 
3778  /* parse first part */
3779  if (*p) {
3780  interval->has_start = 1;
3781 
3782  if (*p == '+') {
3783  interval->start_is_offset = 1;
3784  p++;
3785  } else {
3786  interval->start_is_offset = 0;
3787  }
3788 
3789  ret = av_parse_time(&interval->start, p, 1);
3790  if (ret < 0) {
3791  av_log(NULL, AV_LOG_ERROR, "Invalid interval start specification '%s'\n", p);
3792  goto end;
3793  }
3794  } else {
3795  interval->has_start = 0;
3796  }
3797 
3798  /* parse second part */
3799  p = next;
3800  if (p && *p) {
3801  int64_t us;
3802  interval->has_end = 1;
3803 
3804  if (*p == '+') {
3805  interval->end_is_offset = 1;
3806  p++;
3807  } else {
3808  interval->end_is_offset = 0;
3809  }
3810 
3811  if (interval->end_is_offset && *p == '#') {
3812  long long int lli;
3813  char *tail;
3814  interval->duration_frames = 1;
3815  p++;
3816  lli = strtoll(p, &tail, 10);
3817  if (*tail || lli < 0) {
3819  "Invalid or negative value '%s' for duration number of frames\n", p);
3820  goto end;
3821  }
3822  interval->end = lli;
3823  } else {
3824  interval->duration_frames = 0;
3825  ret = av_parse_time(&us, p, 1);
3826  if (ret < 0) {
3827  av_log(NULL, AV_LOG_ERROR, "Invalid interval end/duration specification '%s'\n", p);
3828  goto end;
3829  }
3830  interval->end = us;
3831  }
3832  } else {
3833  interval->has_end = 0;
3834  }
3835 
3836 end:
3837  av_free(spec);
3838  return ret;
3839 }
3840 
3841 static int parse_read_intervals(const char *intervals_spec)
3842 {
3843  int ret, n, i;
3844  char *p, *spec = av_strdup(intervals_spec);
3845  if (!spec)
3846  return AVERROR(ENOMEM);
3847 
3848  /* preparse specification, get number of intervals */
3849  for (n = 0, p = spec; *p; p++)
3850  if (*p == ',')
3851  n++;
3852  n++;
3853 
3855  if (!read_intervals) {
3856  ret = AVERROR(ENOMEM);
3857  goto end;
3858  }
3859  read_intervals_nb = n;
3860 
3861  /* parse intervals */
3862  p = spec;
3863  for (i = 0; p; i++) {
3864  char *next;
3865 
3867  next = strchr(p, ',');
3868  if (next)
3869  *next++ = 0;
3870 
3871  read_intervals[i].id = i;
3873  if (ret < 0) {
3874  av_log(NULL, AV_LOG_ERROR, "Error parsing read interval #%d '%s'\n",
3875  i, p);
3876  goto end;
3877  }
3878  av_log(NULL, AV_LOG_VERBOSE, "Parsed log interval ");
3880  p = next;
3881  }
3883 
3884 end:
3885  av_free(spec);
3886  return ret;
3887 }
3888 
3889 static int opt_read_intervals(void *optctx, const char *opt, const char *arg)
3890 {
3891  return parse_read_intervals(arg);
3892 }
3893 
3894 static int opt_pretty(void *optctx, const char *opt, const char *arg)
3895 {
3896  show_value_unit = 1;
3897  use_value_prefix = 1;
3900  return 0;
3901 }
3902 
3903 static void print_section(SectionID id, int level)
3904 {
3905  const SectionID *pid;
3906  const struct section *section = &sections[id];
3907  printf("%c%c%c",
3908  section->flags & SECTION_FLAG_IS_WRAPPER ? 'W' : '.',
3909  section->flags & SECTION_FLAG_IS_ARRAY ? 'A' : '.',
3911  printf("%*c %s", level * 4, ' ', section->name);
3912  if (section->unique_name)
3913  printf("/%s", section->unique_name);
3914  printf("\n");
3915 
3916  for (pid = section->children_ids; *pid != -1; pid++)
3917  print_section(*pid, level+1);
3918 }
3919 
3920 static int opt_sections(void *optctx, const char *opt, const char *arg)
3921 {
3922  printf("Sections:\n"
3923  "W.. = Section is a wrapper (contains other sections, no local entries)\n"
3924  ".A. = Section contains an array of elements of the same type\n"
3925  "..V = Section may contain a variable number of fields with variable keys\n"
3926  "FLAGS NAME/UNIQUE_NAME\n"
3927  "---\n");
3929  return 0;
3930 }
3931 
3932 static int opt_show_versions(void *optctx, const char *opt, const char *arg)
3933 {
3936  return 0;
3937 }
3938 
3939 #define DEFINE_OPT_SHOW_SECTION(section, target_section_id) \
3940  static int opt_show_##section(void *optctx, const char *opt, const char *arg) \
3941  { \
3942  mark_section_show_entries(SECTION_ID_##target_section_id, 1, NULL); \
3943  return 0; \
3944  }
3945 
3946 DEFINE_OPT_SHOW_SECTION(chapters, CHAPTERS)
3950 DEFINE_OPT_SHOW_SECTION(library_versions, LIBRARY_VERSIONS)
3951 DEFINE_OPT_SHOW_SECTION(packets, PACKETS)
3952 DEFINE_OPT_SHOW_SECTION(pixel_formats, PIXEL_FORMATS)
3953 DEFINE_OPT_SHOW_SECTION(program_version, PROGRAM_VERSION)
3954 DEFINE_OPT_SHOW_SECTION(streams, STREAMS)
3955 DEFINE_OPT_SHOW_SECTION(programs, PROGRAMS)
3956 
3957 static const OptionDef real_options[] = {
3959  { "f", HAS_ARG, {.func_arg = opt_format}, "force format", "format" },
3960  { "unit", OPT_BOOL, {&show_value_unit}, "show unit of the displayed values" },
3961  { "prefix", OPT_BOOL, {&use_value_prefix}, "use SI prefixes for the displayed values" },
3962  { "byte_binary_prefix", OPT_BOOL, {&use_byte_value_binary_prefix},
3963  "use binary prefixes for byte units" },
3964  { "sexagesimal", OPT_BOOL, {&use_value_sexagesimal_format},
3965  "use sexagesimal format HOURS:MM:SS.MICROSECONDS for time units" },
3966  { "pretty", 0, {.func_arg = opt_pretty},
3967  "prettify the format of displayed values, make it more human readable" },
3968  { "print_format", OPT_STRING | HAS_ARG, { &print_format },
3969  "set the output printing format (available formats are: default, compact, csv, flat, ini, json, xml)", "format" },
3970  { "of", OPT_STRING | HAS_ARG, { &print_format }, "alias for -print_format", "format" },
3971  { "select_streams", OPT_STRING | HAS_ARG, { &stream_specifier }, "select the specified streams", "stream_specifier" },
3972  { "sections", OPT_EXIT, {.func_arg = opt_sections}, "print sections structure and section information, and exit" },
3973  { "show_data", OPT_BOOL, { &do_show_data }, "show packets data" },
3974  { "show_data_hash", OPT_STRING | HAS_ARG, { &show_data_hash }, "show packets data hash" },
3975  { "show_error", 0, { .func_arg = &opt_show_error }, "show probing error" },
3976  { "show_format", 0, { .func_arg = &opt_show_format }, "show format/container info" },
3977  { "show_frames", 0, { .func_arg = &opt_show_frames }, "show frames info" },
3978  { "show_entries", HAS_ARG, {.func_arg = opt_show_entries},
3979  "show a set of specified entries", "entry_list" },
3980 #if HAVE_THREADS
3981  { "show_log", OPT_INT|HAS_ARG, { &do_show_log }, "show log" },
3982 #endif
3983  { "show_packets", 0, { .func_arg = &opt_show_packets }, "show packets info" },
3984  { "show_programs", 0, { .func_arg = &opt_show_programs }, "show programs info" },
3985  { "show_streams", 0, { .func_arg = &opt_show_streams }, "show streams info" },
3986  { "show_chapters", 0, { .func_arg = &opt_show_chapters }, "show chapters info" },
3987  { "count_frames", OPT_BOOL, { &do_count_frames }, "count the number of frames per stream" },
3988  { "count_packets", OPT_BOOL, { &do_count_packets }, "count the number of packets per stream" },
3989  { "show_program_version", 0, { .func_arg = &opt_show_program_version }, "show ffprobe version" },
3990  { "show_library_versions", 0, { .func_arg = &opt_show_library_versions }, "show library versions" },
3991  { "show_versions", 0, { .func_arg = &opt_show_versions }, "show program and library versions" },
3992  { "show_pixel_formats", 0, { .func_arg = &opt_show_pixel_formats }, "show pixel format descriptions" },
3993  { "show_optional_fields", HAS_ARG, { .func_arg = &opt_show_optional_fields }, "show optional fields" },
3994  { "show_private_data", OPT_BOOL, { &show_private_data }, "show private data" },
3995  { "private", OPT_BOOL, { &show_private_data }, "same as show_private_data" },
3996  { "bitexact", OPT_BOOL, {&do_bitexact}, "force bitexact output" },
3997  { "read_intervals", HAS_ARG, {.func_arg = opt_read_intervals}, "set read intervals", "read_intervals" },
3998  { "i", HAS_ARG, {.func_arg = opt_input_file_i}, "read specified file", "input_file"},
3999  { "o", HAS_ARG, {.func_arg = opt_output_file_o}, "write to specified output", "output_file"},
4000  { "print_filename", HAS_ARG, {.func_arg = opt_print_filename}, "override the printed input filename", "print_file"},
4001  { "find_stream_info", OPT_BOOL | OPT_INPUT | OPT_EXPERT, { &find_stream_info },
4002  "read and decode the streams to fill missing information with heuristics" },
4003  { NULL, },
4004 };
4005 
4006 static inline int check_section_show_entries(int section_id)
4007 {
4008  int *id;
4009  struct section *section = &sections[section_id];
4010  if (sections[section_id].show_all_entries || sections[section_id].entries_to_show)
4011  return 1;
4012  for (id = section->children_ids; *id != -1; id++)
4013  if (check_section_show_entries(*id))
4014  return 1;
4015  return 0;
4016 }
4017 
4018 #define SET_DO_SHOW(id, varname) do { \
4019  if (check_section_show_entries(SECTION_ID_##id)) \
4020  do_show_##varname = 1; \
4021  } while (0)
4022 
4023 int main(int argc, char **argv)
4024 {
4025  const Writer *w;
4026  WriterContext *wctx;
4027  char *buf;
4028  char *w_name = NULL, *w_args = NULL;
4029  int ret, input_ret, i;
4030 
4031  init_dynload();
4032 
4033 #if HAVE_THREADS
4034  ret = pthread_mutex_init(&log_mutex, NULL);
4035  if (ret != 0) {
4036  goto end;
4037  }
4038 #endif
4041 
4043  parse_loglevel(argc, argv, options);
4045 #if CONFIG_AVDEVICE
4047 #endif
4048 
4049  show_banner(argc, argv, options);
4050  parse_options(NULL, argc, argv, options, opt_input_file);
4051 
4052  if (do_show_log)
4054 
4055  /* mark things to show, based on -show_entries */
4056  SET_DO_SHOW(CHAPTERS, chapters);
4058  SET_DO_SHOW(FORMAT, format);
4059  SET_DO_SHOW(FRAMES, frames);
4060  SET_DO_SHOW(LIBRARY_VERSIONS, library_versions);
4061  SET_DO_SHOW(PACKETS, packets);
4062  SET_DO_SHOW(PIXEL_FORMATS, pixel_formats);
4063  SET_DO_SHOW(PIXEL_FORMAT_FLAGS, pixel_format_flags);
4064  SET_DO_SHOW(PIXEL_FORMAT_COMPONENTS, pixel_format_components);
4065  SET_DO_SHOW(PROGRAM_VERSION, program_version);
4066  SET_DO_SHOW(PROGRAMS, programs);
4067  SET_DO_SHOW(STREAMS, streams);
4068  SET_DO_SHOW(STREAM_DISPOSITION, stream_disposition);
4069  SET_DO_SHOW(PROGRAM_STREAM_DISPOSITION, stream_disposition);
4070 
4071  SET_DO_SHOW(CHAPTER_TAGS, chapter_tags);
4072  SET_DO_SHOW(FORMAT_TAGS, format_tags);
4073  SET_DO_SHOW(FRAME_TAGS, frame_tags);
4074  SET_DO_SHOW(PROGRAM_TAGS, program_tags);
4075  SET_DO_SHOW(STREAM_TAGS, stream_tags);
4076  SET_DO_SHOW(PROGRAM_STREAM_TAGS, stream_tags);
4077  SET_DO_SHOW(PACKET_TAGS, packet_tags);
4078 
4081  "-bitexact and -show_program_version or -show_library_versions "
4082  "options are incompatible\n");
4083  ret = AVERROR(EINVAL);
4084  goto end;
4085  }
4086 
4088 
4089  if (!print_format)
4090  print_format = av_strdup("default");
4091  if (!print_format) {
4092  ret = AVERROR(ENOMEM);
4093  goto end;
4094  }
4095  w_name = av_strtok(print_format, "=", &buf);
4096  if (!w_name) {
4098  "No name specified for the output format\n");
4099  ret = AVERROR(EINVAL);
4100  goto end;
4101  }
4102  w_args = buf;
4103 
4104  if (show_data_hash) {
4105  if ((ret = av_hash_alloc(&hash, show_data_hash)) < 0) {
4106  if (ret == AVERROR(EINVAL)) {
4107  const char *n;
4109  "Unknown hash algorithm '%s'\nKnown algorithms:",
4110  show_data_hash);
4111  for (i = 0; (n = av_hash_names(i)); i++)
4112  av_log(NULL, AV_LOG_ERROR, " %s", n);
4113  av_log(NULL, AV_LOG_ERROR, "\n");
4114  }
4115  goto end;
4116  }
4117  }
4118 
4119  w = writer_get_by_name(w_name);
4120  if (!w) {
4121  av_log(NULL, AV_LOG_ERROR, "Unknown output format with name '%s'\n", w_name);
4122  ret = AVERROR(EINVAL);
4123  goto end;
4124  }
4125 
4126  if ((ret = writer_open(&wctx, w, w_args,
4128  if (w == &xml_writer)
4130 
4132 
4139 
4140  if (!input_filename &&
4143  show_usage();
4144  av_log(NULL, AV_LOG_ERROR, "You have to specify one input file.\n");
4145  av_log(NULL, AV_LOG_ERROR, "Use -h to get full help or, even better, run 'man %s'.\n", program_name);
4146  ret = AVERROR(EINVAL);
4147  } else if (input_filename) {
4149  if (ret < 0 && do_show_error)
4150  show_error(wctx, ret);
4151  }
4152 
4153  input_ret = ret;
4154 
4156  ret = writer_close(&wctx);
4157  if (ret < 0)
4158  av_log(NULL, AV_LOG_ERROR, "Writing output failed: %s\n", av_err2str(ret));
4159 
4160  ret = FFMIN(ret, input_ret);
4161  }
4162 
4163 end:
4166  av_hash_freep(&hash);
4167 
4168  uninit_opts();
4169  for (i = 0; i < FF_ARRAY_ELEMS(sections); i++)
4171 
4173 
4174  return ret < 0;
4175 }
error
static void error(const char *err)
Definition: target_bsf_fuzzer.c:31
flat_escape_key_str
static const char * flat_escape_key_str(AVBPrint *dst, const char *src, const char sep)
Definition: ffprobe.c:1362
main
int main(int argc, char **argv)
Definition: ffprobe.c:4023
AVSubtitle
Definition: avcodec.h:2305
SECTION_ID_STREAM_SIDE_DATA_LIST
@ SECTION_ID_STREAM_SIDE_DATA_LIST
Definition: ffprobe.c:219
opt_format
static int opt_format(void *optctx, const char *opt, const char *arg)
Definition: ffprobe.c:3605
AVHDRVividColorTransformParams::maximum_maxrgb
AVRational maximum_maxrgb
Indicates the maximum brightness of the displayed content.
Definition: hdr_dynamic_vivid_metadata.h:199
pthread_mutex_t
_fmutex pthread_mutex_t
Definition: os2threads.h:53
clear_log
static void clear_log(int need_lock)
Definition: ffprobe.c:2423
AVMasteringDisplayMetadata::has_primaries
int has_primaries
Flag indicating whether the display primaries (and white point) are set.
Definition: mastering_display_metadata.h:62
AVHDRPlusColorTransformParams::average_maxrgb
AVRational average_maxrgb
The average of linearized maxRGB values in the processing window in the scene.
Definition: hdr_dynamic_metadata.h:164
mark_section_show_entries
static void mark_section_show_entries(SectionID section_id, int show_all_entries, AVDictionary *entries)
Definition: ffprobe.c:3615
av_packet_unref
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition: avpacket.c:422
OPT_EXIT
#define OPT_EXIT
Definition: cmdutils.h:148
AVCodec
AVCodec.
Definition: codec.h:196
writer_get_by_name
static const Writer * writer_get_by_name(const char *name)
Definition: ffprobe.c:991
av_utf8_decode
int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end, unsigned int flags)
Read and decode a single UTF-8 code point (character) from the buffer in *buf, and update *buf to poi...
Definition: avstring.c:379
AVDynamicHDRPlus::params
AVHDRPlusColorTransformParams params[3]
The color transform parameters for every processing window.
Definition: hdr_dynamic_metadata.h:264
AVMEDIA_TYPE_SUBTITLE
@ AVMEDIA_TYPE_SUBTITLE
Definition: avutil.h:204
flat_options
static const AVOption flat_options[]
Definition: ffprobe.c:1338
WriterContext::section_pbuf
AVBPrint section_pbuf[SECTION_MAX_NB_LEVELS]
generic print buffer dedicated to each section, used by various writers
Definition: ffprobe.c:499
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
AV_BPRINT_SIZE_UNLIMITED
#define AV_BPRINT_SIZE_UNLIMITED
AV_TIMECODE_STR_SIZE
#define AV_TIMECODE_STR_SIZE
Definition: timecode.h:33
AVDOVIDataMapping::nlq_method_idc
enum AVDOVINLQMethod nlq_method_idc
Definition: dovi_meta.h:146
use_byte_value_binary_prefix
static int use_byte_value_binary_prefix
Definition: ffprobe.c:126
WriterContext::level
int level
current level, starting from 0
Definition: ffprobe.c:492
WriterContext::string_validation
int string_validation
Definition: ffprobe.c:506
AVMasteringDisplayMetadata::max_luminance
AVRational max_luminance
Max luminance of mastering display (cd/m^2).
Definition: mastering_display_metadata.h:57
AVCodecParameters::extradata
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
Definition: codec_par.h:75
MAX_REGISTERED_WRITERS_NB
#define MAX_REGISTERED_WRITERS_NB
Definition: ffprobe.c:976
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
AVHDRVividColorToneMappingParams::base_param_k2
int base_param_k2
indicates k2_0 in the base parameter, base_param_k2 <= 1: k2_0 = base_param_k2 base_param_k2 > 1: res...
Definition: hdr_dynamic_vivid_metadata.h:91
level
uint8_t level
Definition: svq3.c:206
do_show_log
static int do_show_log
Definition: ffprobe.c:115
program
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C program
Definition: undefined.txt:6
av_clip
#define av_clip
Definition: common.h:95
InputFile::fmt_ctx
AVFormatContext * fmt_ctx
Definition: ffprobe.c:87
SECTION_MAX_NB_LEVELS
#define SECTION_MAX_NB_LEVELS
Definition: ffprobe.c:475
SECTION_ID_STREAM_SIDE_DATA
@ SECTION_ID_STREAM_SIDE_DATA
Definition: ffprobe.c:220
do_show_frame_tags
static int do_show_frame_tags
Definition: ffprobe.c:119
PLANAR
#define PLANAR
Definition: flacdsp.c:44
AVChapter::metadata
AVDictionary * metadata
Definition: avformat.h:1176
r
const char * r
Definition: vf_curves.c:116
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_show_optional_fields
static int opt_show_optional_fields(void *optctx, const char *opt, const char *arg)
Definition: ffprobe.c:3594
SECTION_ID_NONE
@ SECTION_ID_NONE
Definition: ffprobe.c:173
opt.h
read_intervals_nb
static int read_intervals_nb
Definition: ffprobe.c:148
opt_output_file_o
static int opt_output_file_o(void *optctx, const char *opt, const char *arg)
Definition: ffprobe.c:3731
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:57
AVFMT_SHOW_IDS
#define AVFMT_SHOW_IDS
Show format stream IDs numbers.
Definition: avformat.h:479
AVSphericalMapping::projection
enum AVSphericalProjection projection
Projection type.
Definition: spherical.h:86
av_opt_set_defaults
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
Definition: opt.c:1458
ReadInterval::end_is_offset
int end_is_offset
Definition: ffprobe.c:143
LogBuffer::log_message
char * log_message
Definition: ffprobe.c:318
AVColorTransferCharacteristic
AVColorTransferCharacteristic
Color Transfer Characteristic.
Definition: pixfmt.h:496
libm.h
AVHDRVividColorToneMappingParams::base_param_Delta
AVRational base_param_Delta
base_param_Delta in the base parameter, in multiples of 1.0/127.
Definition: hdr_dynamic_vivid_metadata.h:111
av_bprint_finalize
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
Definition: bprint.c:235
show_streams
static int show_streams(WriterContext *w, InputFile *ifile)
Definition: ffprobe.c:3143
AV_PKT_DATA_MPEGTS_STREAM_ID
@ AV_PKT_DATA_MPEGTS_STREAM_ID
MPEGTS stream ID as uint8_t, this is required to pass the stream ID information from the demuxer to t...
Definition: packet.h:216
avio_close
int avio_close(AVIOContext *s)
Close the resource accessed by the AVIOContext s and free it.
Definition: aviobuf.c:1255
Writer::name
const char * name
Definition: ffprobe.c:462
writer_put_str_printf
static void writer_put_str_printf(WriterContext *wctx, const char *str)
Definition: ffprobe.c:604
AVHDRVividColorToneMappingParams::base_enable_flag
int base_enable_flag
This flag indicates that transfer the base paramter(for value of 1)
Definition: hdr_dynamic_vivid_metadata.h:42
print_str
#define print_str(k, v)
Definition: ffprobe.c:1911
LogBuffer::context_name
char * context_name
Definition: ffprobe.c:316
writer_print_section_header
static void writer_print_section_header(WriterContext *wctx, int section_id)
Definition: ffprobe.c:720
color
Definition: vf_paletteuse.c:600
av_bprint_init
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
Definition: bprint.c:69
av_get_token
char * av_get_token(const char **buf, const char *term)
Unescape the given string until a non escaped terminating char, and return the token corresponding to...
Definition: avstring.c:154
AV_HASH_MAX_SIZE
#define AV_HASH_MAX_SIZE
Maximum value that av_hash_get_size() will currently return.
Definition: hash.h:156
AVHDRPlusColorTransformParams::rotation_angle
uint8_t rotation_angle
The clockwise rotation angle in degree of arc with respect to the positive direction of the x-axis of...
Definition: hdr_dynamic_metadata.h:118
print_val
#define print_val(k, v, u)
Definition: ffprobe.c:1918
compact_print_section_footer
static void compact_print_section_footer(WriterContext *wctx)
Definition: ffprobe.c:1250
SECTION_ID_PACKET_SIDE_DATA_LIST
@ SECTION_ID_PACKET_SIDE_DATA_LIST
Definition: ffprobe.c:199
AVFormatContext::nb_chapters
unsigned int nb_chapters
Number of chapters in AVChapter array.
Definition: avformat.h:1431
AVCodecParameters
This struct describes the properties of an encoded stream.
Definition: codec_par.h:53
AVHDRPlusPercentile::percentile
AVRational percentile
The linearized maxRGB value at a specific percentile in the processing window in the scene.
Definition: hdr_dynamic_metadata.h:52
AVCodec::priv_class
const AVClass * priv_class
AVClass for the private context.
Definition: codec.h:228
show_stream
static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_idx, InputStream *ist, int in_program)
Definition: ffprobe.c:2922
print_list_fmt
#define print_list_fmt(k, f, n,...)
Definition: ffprobe.c:1899
sub
static float sub(float src0, float src1)
Definition: dnn_backend_native_layer_mathbinary.c:31
AVCodecParameters::color_space
enum AVColorSpace color_space
Definition: codec_par.h:150
Writer::init
int(* init)(WriterContext *wctx)
Definition: ffprobe.c:464
thread.h
value_string
static char * value_string(char *buf, int buf_size, struct unit_value uv)
Definition: ffprobe.c:392
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:57
read_packets
static int read_packets(WriterContext *w, InputFile *ifile)
Definition: ffprobe.c:2902
pthread_mutex_init
static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
Definition: os2threads.h:104
AVCodecDescriptor::long_name
const char * long_name
A more descriptive name for this codec.
Definition: codec_desc.h:50
AVMasteringDisplayMetadata::display_primaries
AVRational display_primaries[3][2]
CIE 1931 xy chromaticity coords of color primaries (r, g, b order).
Definition: mastering_display_metadata.h:42
show_packet
static void show_packet(WriterContext *w, InputFile *ifile, AVPacket *pkt, int packet_idx)
Definition: ffprobe.c:2474
AV_PKT_FLAG_DISCARD
#define AV_PKT_FLAG_DISCARD
Flag is used to discard packets which are required to maintain valid decoder state but are not requir...
Definition: packet.h:436
CompactContext::print_section
int print_section
Definition: ffprobe.c:1171
AVMasteringDisplayMetadata::has_luminance
int has_luminance
Flag indicating whether the luminance (min_ and max_) have been set.
Definition: mastering_display_metadata.h:67
version.h
AVHDRVividColorToneMappingParams::three_Spline_num
int three_Spline_num
The number of three Spline.
Definition: hdr_dynamic_vivid_metadata.h:123
AV_FRAME_DATA_DOVI_METADATA
@ AV_FRAME_DATA_DOVI_METADATA
Parsed Dolby Vision metadata, suitable for passing to a software implementation.
Definition: frame.h:204
InputStream::dec_ctx
AVCodecContext * dec_ctx
Definition: ffmpeg.h:316
AV_TIME_BASE_Q
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
Definition: avutil.h:260
Writer::print_section_footer
void(* print_section_footer)(WriterContext *wctx)
Definition: ffprobe.c:468
AVCodecDescriptor::name
const char * name
Name of the codec described by this descriptor.
Definition: codec_desc.h:46
output
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
Definition: filter_design.txt:225
selected_streams
static int * selected_streams
Definition: ffprobe.c:310
SECTION_ID_PROGRAM_TAGS
@ SECTION_ID_PROGRAM_TAGS
Definition: ffprobe.c:211
av_strcasecmp
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
Definition: avstring.c:218
AVHDRPlusColorTransformParams::semimajor_axis_external_ellipse
uint16_t semimajor_axis_external_ellipse
The semi-major axis value of the external ellipse of the elliptical pixel selector in amount of pixel...
Definition: hdr_dynamic_metadata.h:134
avformat_get_class
const AVClass * avformat_get_class(void)
Get the AVClass for AVFormatContext.
Definition: options.c:197
AV_FRAME_DATA_S12M_TIMECODE
@ AV_FRAME_DATA_S12M_TIMECODE
Timecode which conforms to SMPTE ST 12-1.
Definition: frame.h:152
DefaultContext
Definition: ffprobe.c:1018
AVHDRVividColorTransformParams::tone_mapping_param_num
int tone_mapping_param_num
The number of tone mapping param.
Definition: hdr_dynamic_vivid_metadata.h:211
Writer::priv_class
const AVClass * priv_class
private class of the writer, if any
Definition: ffprobe.c:460
AVHDRPlusColorTransformParams
Color transform parameters at a processing window in a dynamic metadata for SMPTE 2094-40.
Definition: hdr_dynamic_metadata.h:59
AV_RN16
#define AV_RN16(p)
Definition: intreadwrite.h:360
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:111
AVContentLightMetadata::MaxCLL
unsigned MaxCLL
Max content light level (cd/m^2).
Definition: mastering_display_metadata.h:102
WriterContext::section
const struct section * section[SECTION_MAX_NB_LEVELS]
section per each level
Definition: ffprobe.c:498
json_escape_str
static const char * json_escape_str(AVBPrint *dst, const char *src, void *log_ctx)
Definition: ffprobe.c:1584
print_ts
#define print_ts(k, v)
Definition: ffprobe.c:1915
opt_input_file_i
static int opt_input_file_i(void *optctx, const char *opt, const char *arg)
Definition: ffprobe.c:3712
WriterContext::nb_section_packet_frame
unsigned int nb_section_packet_frame
nb_section_packet or nb_section_frame according if is_packets_and_frames
Definition: ffprobe.c:504
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:325
pixdesc.h
AVFormatContext::streams
AVStream ** streams
A list of all streams in the file.
Definition: avformat.h:1281
writer_put_str
#define writer_put_str(wctx_, str_)
Definition: ffprobe.c:973
AVPacketSideData
Definition: packet.h:315
w
uint8_t w
Definition: llviddspenc.c:38
validate_string
static int validate_string(WriterContext *wctx, char **dstp, const char *src)
Definition: ffprobe.c:772
OPT_INPUT
#define OPT_INPUT
Definition: cmdutils.h:155
AVHDRVividColorTransformParams::variance_maxrgb
AVRational variance_maxrgb
Indicates the variance brightness of the displayed content.
Definition: hdr_dynamic_vivid_metadata.h:192
avcodec_decode_subtitle2
int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, AVPacket *avpkt)
Decode a subtitle message.
Definition: decode.c:816
AVDOVIReshapingCurve::mmr_coef
int64_t mmr_coef[AV_DOVI_MAX_PIECES][3][7]
Definition: dovi_meta.h:114
SECTION_ID_FRAME_SIDE_DATA_COMPONENT
@ SECTION_ID_FRAME_SIDE_DATA_COMPONENT
Definition: ffprobe.c:188
SECTION_ID_PIXEL_FORMAT_COMPONENTS
@ SECTION_ID_PIXEL_FORMAT_COMPONENTS
Definition: ffprobe.c:204
AVDynamicHDRPlus::num_cols_targeted_system_display_actual_peak_luminance
uint8_t num_cols_targeted_system_display_actual_peak_luminance
The number of columns in the targeted_system_display_actual_peak_luminance array.
Definition: hdr_dynamic_metadata.h:290
AVPacket::data
uint8_t * data
Definition: packet.h:374
ReadInterval::duration_frames
int duration_frames
Definition: ffprobe.c:144
AVComponentDescriptor::depth
int depth
Number of bits in the component.
Definition: pixdesc.h:57
av_spherical_tile_bounds
void av_spherical_tile_bounds(const AVSphericalMapping *map, size_t width, size_t height, size_t *left, size_t *top, size_t *right, size_t *bottom)
Convert the bounding fields from an AVSphericalVideo from 0.32 fixed point to pixels.
Definition: spherical.c:37
AVPixFmtDescriptor::name
const char * name
Definition: pixdesc.h:70
AVOption
AVOption.
Definition: opt.h:251
HAS_ARG
#define HAS_ARG
Definition: cmdutils.h:138
b
#define b
Definition: input.c:34
AVCOL_TRC_UNSPECIFIED
@ AVCOL_TRC_UNSPECIFIED
Definition: pixfmt.h:499
SECTION_ID_STREAM
@ SECTION_ID_STREAM
Definition: ffprobe.c:215
section::element_name
const char * element_name
name of the contained element, if provided
Definition: ffprobe.c:166
SECTION_ID_PIXEL_FORMAT_FLAGS
@ SECTION_ID_PIXEL_FORMAT_FLAGS
Definition: ffprobe.c:202
LogBuffer
Definition: ffprobe.c:315
AVStream::avg_frame_rate
AVRational avg_frame_rate
Average framerate.
Definition: avformat.h:1028
spherical.h
AVChapter::start
int64_t start
Definition: avformat.h:1175
data
const char data[16]
Definition: mxf.c:143
av_pix_fmt_desc_next
const AVPixFmtDescriptor * av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
Iterate over all pixel format descriptors known to libavutil.
Definition: pixdesc.c:2669
print_dovi_metadata
static void print_dovi_metadata(WriterContext *w, const AVDOVIMetadata *dovi)
Definition: ffprobe.c:1954
format_opts
AVDictionary * format_opts
Definition: cmdutils.c:60
AV_DOVI_NLQ_NONE
@ AV_DOVI_NLQ_NONE
Definition: dovi_meta.h:118
writer_print_integer
static void writer_print_integer(WriterContext *wctx, const char *key, long long int val)
Definition: ffprobe.c:761
PRINT_DISPOSITION
#define PRINT_DISPOSITION(flagname, name)
XMLContext::within_tag
int within_tag
Definition: ffprobe.c:1725
SECTION_MAX_NB_CHILDREN
#define SECTION_MAX_NB_CHILDREN
Definition: ffprobe.c:154
AV_DICT_IGNORE_SUFFIX
#define AV_DICT_IGNORE_SUFFIX
Return first entry in a dictionary whose first part corresponds to the search key,...
Definition: dict.h:68
do_show_stream_tags
static int do_show_stream_tags
Definition: ffprobe.c:121
ini_escape_str
static char * ini_escape_str(AVBPrint *dst, const char *src)
Definition: ffprobe.c:1468
AVDOVIReshapingCurve::mapping_idc
enum AVDOVIMappingMethod mapping_idc[AV_DOVI_MAX_PIECES]
Definition: dovi_meta.h:107
print_section_header
#define print_section_header(s)
Definition: ffprobe.c:1925
SECTION_ID_PIXEL_FORMAT
@ SECTION_ID_PIXEL_FORMAT
Definition: ffprobe.c:201
writer_printf_printf
static void writer_printf_printf(WriterContext *wctx, const char *fmt,...)
Definition: ffprobe.c:609
version.h
AVHDRPlusColorTransformParams::tone_mapping_flag
uint8_t tone_mapping_flag
This flag indicates that the metadata for the tone mapping function in the processing window is prese...
Definition: hdr_dynamic_metadata.h:189
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:196
AV_PKT_DATA_AFD
@ AV_PKT_DATA_AFD
Active Format Description data consisting of a single byte as specified in ETSI TS 101 154 using AVAc...
Definition: packet.h:262
SECTION_ID_PROGRAM_STREAM
@ SECTION_ID_PROGRAM_STREAM
Definition: ffprobe.c:210
print_format
static char * print_format
Definition: ffprobe.c:135
category
category
Definition: openal-dec.c:248
AVFormatContext::programs
AVProgram ** programs
Definition: avformat.h:1382
OFFSET
#define OFFSET(x)
Definition: ffprobe.c:1732
SECTION_ID_FORMAT
@ SECTION_ID_FORMAT
Definition: ffprobe.c:178
show_help_children
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:163
AVOption::flags
int flags
Definition: opt.h:280
AV_FRAME_DATA_DISPLAYMATRIX
@ AV_FRAME_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
Definition: frame.h:85
av_get_bits_per_pixel
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel used by the pixel format described by pixdesc.
Definition: pixdesc.c:2614
AVPacket::duration
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
Definition: packet.h:392
AVCodecParameters::codec_tag
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
Definition: codec_par.h:65
AV_SPHERICAL_EQUIRECTANGULAR_TILE
@ AV_SPHERICAL_EQUIRECTANGULAR_TILE
Video represents a portion of a sphere mapped on a flat surface using equirectangular projection.
Definition: spherical.h:72
check_section_show_entries
static int check_section_show_entries(int section_id)
Definition: ffprobe.c:4006
print_section
static void print_section(SectionID id, int level)
Definition: ffprobe.c:3903
section::id
int id
unique id identifying a section
Definition: ffprobe.c:157
AVHDRPlusColorTransformParams::distribution_maxrgb
AVHDRPlusPercentile distribution_maxrgb[15]
The linearized maxRGB values at given percentiles in the processing window in the scene.
Definition: hdr_dynamic_metadata.h:176
AVDictionary
Definition: dict.c:30
writer_options
static const AVOption writer_options[]
Definition: ffprobe.c:519
av_bprint_append_data
void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size)
Append data to a print buffer.
Definition: bprint.c:158
AVChannelLayout::order
enum AVChannelOrder order
Channel order used in this layout.
Definition: channel_layout.h:295
AVColorPrimaries
AVColorPrimaries
Chromaticity coordinates of the source primaries.
Definition: pixfmt.h:471
AVDOVIRpuDataHeader::rpu_format
uint16_t rpu_format
Definition: dovi_meta.h:78
DefaultContext::nokey
int nokey
Definition: ffprobe.c:1020
avcodec_profile_name
const char * avcodec_profile_name(enum AVCodecID codec_id, int profile)
Return a name for the specified profile, if available.
Definition: utils.c:480
av_read_frame
int av_read_frame(AVFormatContext *s, AVPacket *pkt)
Return the next frame of a stream.
Definition: demux.c:1438
writer_register_all
static void writer_register_all(void)
Definition: ffprobe.c:1876
AVDOVIDataMapping::mapping_color_space
uint8_t mapping_color_space
Definition: dovi_meta.h:141
AV_PKT_DATA_SPHERICAL
@ AV_PKT_DATA_SPHERICAL
This side data should be associated with a video stream and corresponds to the AVSphericalMapping str...
Definition: packet.h:229
CompactContext
Definition: ffprobe.c:1166
AVDOVIRpuDataHeader
Dolby Vision RPU data header.
Definition: dovi_meta.h:76
AVHDRPlusColorTransformParams::knee_point_x
AVRational knee_point_x
The x coordinate of the separation point between the linear part and the curved part of the tone mapp...
Definition: hdr_dynamic_metadata.h:196
output_filename
static const char * output_filename
Definition: ffprobe.c:284
AVHDRVividColorTransformParams::color_saturation_num
int color_saturation_num
The number of color saturation param.
Definition: hdr_dynamic_vivid_metadata.h:228
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:300
dec_val
double dec_val
Definition: ffprobe.c:290
show_tags
static int show_tags(WriterContext *w, AVDictionary *tags, int section_id)
Definition: ffprobe.c:1936
AV_RL8
#define AV_RL8(x)
Definition: intreadwrite.h:398
avio_size
int64_t avio_size(AVIOContext *s)
Get the filesize.
Definition: aviobuf.c:352
av_strlcatf
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
Definition: avstring.c:104
AV_PKT_FLAG_KEY
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: packet.h:429
do_show_format_tags
static int do_show_format_tags
Definition: ffprobe.c:118
av_packet_free
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
Definition: avpacket.c:73
av_chroma_location_name
const char * av_chroma_location_name(enum AVChromaLocation location)
Definition: pixdesc.c:3071
hdr_dynamic_vivid_metadata.h
section::unique_name
const char * unique_name
unique section name, in case the name is ambiguous
Definition: ffprobe.c:167
Writer::print_string
void(* print_string)(WriterContext *wctx, const char *, const char *)
Definition: ffprobe.c:471
do_show_frames
static int do_show_frames
Definition: ffprobe.c:104
json_print_int
static void json_print_int(WriterContext *wctx, const char *key, long long int value)
Definition: ffprobe.c:1692
OptionDef
Definition: cmdutils.h:135
AVUNERROR
#define AVUNERROR(e)
Definition: error.h:46
compact_init
static av_cold int compact_init(WriterContext *wctx)
Definition: ffprobe.c:1196
AVInputFormat::long_name
const char * long_name
Descriptive name for the format, meant to be more human-readable than name.
Definition: avformat.h:668
xml_print_section_footer
static void xml_print_section_footer(WriterContext *wctx)
Definition: ffprobe.c:1807
SECTION_ID_FRAME_TAGS
@ SECTION_ID_FRAME_TAGS
Definition: ffprobe.c:182
init
static int init
Definition: av_tx.c:47
ReadInterval::id
int id
identifier
Definition: ffprobe.c:140
AVContentLightMetadata
Content light level needed by to transmit HDR over HDMI (CTA-861.3).
Definition: mastering_display_metadata.h:98
AVDOVIRpuDataHeader::coef_data_type
uint8_t coef_data_type
Definition: dovi_meta.h:82
do_show_library_versions
static int do_show_library_versions
Definition: ffprobe.c:111
exit_program
void exit_program(int ret)
Wraps exit with a program-specific cleanup routine.
Definition: cmdutils.c:93
AVCodecParameters::color_primaries
enum AVColorPrimaries color_primaries
Definition: codec_par.h:148
InputStream
Definition: ffmpeg.h:306
writer_print_data
static void writer_print_data(WriterContext *wctx, const char *name, const uint8_t *data, int size)
Definition: ffprobe.c:903
avformat_close_input
void avformat_close_input(AVFormatContext **s)
Close an opened input AVFormatContext.
Definition: demux.c:368
AVPacketSideData::size
size_t size
Definition: packet.h:317
parse_number_or_die
double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max)
Parse a string and return its corresponding value as a double.
Definition: cmdutils.c:101
match_section
static int match_section(const char *section_name, int show_all_entries, AVDictionary *entries)
Definition: ffprobe.c:3630
AVHDRPlusColorTransformParams::color_saturation_mapping_flag
uint8_t color_saturation_mapping_flag
This flag shall be equal to 0 in bitstreams conforming to this version of this Specification.
Definition: hdr_dynamic_metadata.h:222
INIContext
Definition: ffprobe.c:1452
unit_hertz_str
static const char unit_hertz_str[]
Definition: ffprobe.c:303
AV_UTF8_FLAG_EXCLUDE_XML_INVALID_CONTROL_CODES
#define AV_UTF8_FLAG_EXCLUDE_XML_INVALID_CONTROL_CODES
exclude control codes not accepted by XML
Definition: avstring.h:383
writer_close
static int writer_close(WriterContext **wctx)
Definition: ffprobe.c:548
SHOW_OPTIONAL_FIELDS_NEVER
#define SHOW_OPTIONAL_FIELDS_NEVER
Definition: ffprobe.c:131
SECTION_ID_STREAMS
@ SECTION_ID_STREAMS
Definition: ffprobe.c:217
print_error
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:793
AVHDRVividColorToneMappingParams::three_Spline_enable_flag
int three_Spline_enable_flag
indicates 3Spline_enable_flag in the base parameter, This flag indicates that transfer three Spline o...
Definition: hdr_dynamic_vivid_metadata.h:117
AV_FIELD_TT
@ AV_FIELD_TT
Definition: codec_par.h:40
writer_print_data_hash
static void writer_print_data_hash(WriterContext *wctx, const char *name, const uint8_t *data, int size)
Definition: ffprobe.c:931
show_optional_fields
static int show_optional_fields
Definition: ffprobe.c:133
json_print_section_footer
static void json_print_section_footer(WriterContext *wctx)
Definition: ffprobe.c:1645
av_color_space_name
const char * av_color_space_name(enum AVColorSpace space)
Definition: pixdesc.c:3050
unit_value::val
union unit_value::@5 val
AVHDRPlusColorTransformParams::center_of_ellipse_x
uint16_t center_of_ellipse_x
The x coordinate of the center position of the concentric internal and external ellipses of the ellip...
Definition: hdr_dynamic_metadata.h:102
opt_pretty
static int opt_pretty(void *optctx, const char *opt, const char *arg)
Definition: ffprobe.c:3894
AVCodecContext::codec
const struct AVCodec * codec
Definition: avcodec.h:398
U
#define U(x)
Definition: vp56_arith.h:37
json_options
static const AVOption json_options[]
Definition: ffprobe.c:1566
default_options
static const AVOption default_options[]
Definition: ffprobe.c:1028
fail
#define fail()
Definition: checkasm.h:131
writer_get_name
static const char * writer_get_name(void *p)
Definition: ffprobe.c:511
AVHDRVividColorTransformParams::tm_params
AVHDRVividColorToneMappingParams tm_params[2]
The color tone mapping parameters.
Definition: hdr_dynamic_vivid_metadata.h:216
av_hash_get_name
const char * av_hash_get_name(const AVHashContext *ctx)
Definition: hash.c:92
process_frame
static av_always_inline int process_frame(WriterContext *w, InputFile *ifile, AVFrame *frame, AVPacket *pkt, int *packet_new)
Definition: ffprobe.c:2704
LogBuffer::log_level
int log_level
Definition: ffprobe.c:317
print_chroma_location
static void print_chroma_location(WriterContext *w, enum AVChromaLocation chroma_location)
Definition: ffprobe.c:2412
av_strerror
int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
Put a description of the AVERROR code errnum in errbuf.
Definition: error.c:108
AVDOVIRpuDataHeader::el_bit_depth
uint8_t el_bit_depth
Definition: dovi_meta.h:87
Writer::uninit
void(* uninit)(WriterContext *wctx)
Definition: ffprobe.c:465
frames
if it could not because there are no more frames
Definition: filter_design.txt:266
timecode.h
SECTION_FLAG_HAS_VARIABLE_FIELDS
#define SECTION_FLAG_HAS_VARIABLE_FIELDS
the section may contain a variable number of fields with variable keys.
Definition: ffprobe.c:162
json_writer
static const Writer json_writer
Definition: ffprobe.c:1709
AVCodecContext::refs
int refs
number of reference frames
Definition: avcodec.h:938
AVERROR_OPTION_NOT_FOUND
#define AVERROR_OPTION_NOT_FOUND
Option not found.
Definition: error.h:63
AVDynamicHDRVivid::num_windows
uint8_t num_windows
The number of processing windows.
Definition: hdr_dynamic_vivid_metadata.h:259
AV_BPRINT_SIZE_AUTOMATIC
#define AV_BPRINT_SIZE_AUTOMATIC
AVChapter
Definition: avformat.h:1172
default_print_int
static void default_print_int(WriterContext *wctx, const char *key, long long int value)
Definition: ffprobe.c:1095
val
static double val(void *priv, double ch)
Definition: aeval.c:77
json_init
static av_cold int json_init(WriterContext *wctx)
Definition: ffprobe.c:1574
show_help_default
void show_help_default(const char *opt, const char *arg)
Per-fftool specific help handler.
Definition: ffprobe.c:3743
c_escape_str
static const char * c_escape_str(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
Apply C-language-like string escaping.
Definition: ffprobe.c:1120
SECTION_ID_FRAME_SIDE_DATA_PIECE
@ SECTION_ID_FRAME_SIDE_DATA_PIECE
Definition: ffprobe.c:190
AVCodecContext::coded_height
int coded_height
Definition: avcodec.h:577
us
#define us(width, name, range_min, range_max, subs,...)
Definition: cbs_h2645.c:276
ini_print_section_header
static void ini_print_section_header(WriterContext *wctx)
Definition: ffprobe.c:1495
AV_PKT_DATA_DISPLAYMATRIX
@ AV_PKT_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
Definition: packet.h:109
av_opt_set
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
Definition: opt.c:487
show_log
static int show_log(WriterContext *w, int section_ids, int section_id, int log_level)
Definition: ffprobe.c:2439
OPT_STRING
#define OPT_STRING
Definition: cmdutils.h:141
AVStream::duration
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:998
AV_FIELD_TB
@ AV_FIELD_TB
Definition: codec_par.h:42
input_filename
static const char * input_filename
Definition: ffprobe.c:281
print_duration_ts
#define print_duration_ts(k, v)
Definition: ffprobe.c:1917
av_reduce
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
Definition: rational.c:35
json_print_section_header
static void json_print_section_header(WriterContext *wctx)
Definition: ffprobe.c:1606
AVRational::num
int num
Numerator.
Definition: rational.h:59
avformat_network_init
int avformat_network_init(void)
Do global initialization of network libraries.
Definition: utils.c:557
ALPHA
@ ALPHA
Definition: drawutils.c:33
InputFile
Definition: ffmpeg.h:404
AVHDRPlusColorTransformParams::knee_point_y
AVRational knee_point_y
The y coordinate of the separation point between the linear part and the curved part of the tone mapp...
Definition: hdr_dynamic_metadata.h:203
AVDOVIRpuDataHeader::vdr_rpu_normalized_idc
uint8_t vdr_rpu_normalized_idc
Definition: dovi_meta.h:84
AVDOVIRpuDataHeader::el_spatial_resampling_filter_flag
uint8_t el_spatial_resampling_filter_flag
Definition: dovi_meta.h:90
do_read_packets
static int do_read_packets
Definition: ffprobe.c:100
AVHDRPlusColorTransformParams::num_bezier_curve_anchors
uint8_t num_bezier_curve_anchors
The number of the intermediate anchor parameters of the tone mapping function in the processing windo...
Definition: hdr_dynamic_metadata.h:209
opt_read_intervals
static int opt_read_intervals(void *optctx, const char *opt, const char *arg)
Definition: ffprobe.c:3889
avsubtitle_free
void avsubtitle_free(AVSubtitle *sub)
Free all allocated data in the given subtitle struct.
Definition: avcodec.c:418
close_input_file
static void close_input_file(InputFile *ifile)
Definition: ffprobe.c:3396
av_frame_alloc
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition: frame.c:99
AV_PKT_DATA_STRINGS_METADATA
@ AV_PKT_DATA_STRINGS_METADATA
A list of zero terminated key/value strings.
Definition: packet.h:173
parse_read_intervals
static int parse_read_intervals(const char *intervals_spec)
Definition: ffprobe.c:3841
AVFormatContext::bit_rate
int64_t bit_rate
Total stream bitrate in bit/s, 0 if not available.
Definition: avformat.h:1322
av_get_bits_per_sample
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
Definition: utils.c:586
AVCodecParameters::color_trc
enum AVColorTransferCharacteristic color_trc
Definition: codec_par.h:149
json_print_item_str
static void json_print_item_str(WriterContext *wctx, const char *key, const char *value)
Definition: ffprobe.c:1667
av_packet_side_data_name
const char * av_packet_side_data_name(enum AVPacketSideDataType type)
Definition: avpacket.c:268
default_writer
static const Writer default_writer
Definition: ffprobe.c:1104
avassert.h
writer_print_time
static void writer_print_time(WriterContext *wctx, const char *key, int64_t ts, const AVRational *time_base, int is_duration)
Definition: ffprobe.c:877
show_frame
static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream, AVFormatContext *fmt_ctx)
Definition: ffprobe.c:2550
av_guess_sample_aspect_ratio
AVRational av_guess_sample_aspect_ratio(AVFormatContext *format, AVStream *stream, AVFrame *frame)
Guess the sample aspect ratio of a frame, based on both the stream and the frame aspect ratio.
Definition: avformat.c:589
do_show_error
static int do_show_error
Definition: ffprobe.c:102
AV_PKT_DATA_WEBVTT_SETTINGS
@ AV_PKT_DATA_WEBVTT_SETTINGS
The optional settings (rendering instructions) that immediately follow the timestamp specifier of a W...
Definition: packet.h:203
pkt
AVPacket * pkt
Definition: movenc.c:59
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
CHECK_END
#define CHECK_END
AVFormatContext::metadata
AVDictionary * metadata
Metadata that applies to the whole file.
Definition: avformat.h:1442
AVFrameSideData::size
size_t size
Definition: frame.h:234
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
AVInputFormat
Definition: avformat.h:656
av_cold
#define av_cold
Definition: attributes.h:90
AVDOVIRpuDataHeader::chroma_resampling_explicit_filter_flag
uint8_t chroma_resampling_explicit_filter_flag
Definition: dovi_meta.h:81
av_dump_format
void av_dump_format(AVFormatContext *ic, int index, const char *url, int is_output)
Print detailed information about the input or output format, such as duration, bitrate,...
Definition: dump.c:630
nb_streams_frames
static uint64_t * nb_streams_frames
Definition: ffprobe.c:309
AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES
#define AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES
Within AV_ESCAPE_MODE_XML, additionally escape double quotes for double quoted attributes.
Definition: avstring.h:357
avformat_open_input
int avformat_open_input(AVFormatContext **ps, const char *url, const AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header.
Definition: demux.c:220
AV_PKT_DATA_AUDIO_SERVICE_TYPE
@ AV_PKT_DATA_AUDIO_SERVICE_TYPE
This side data should be associated with an audio stream and corresponds to enum AVAudioServiceType.
Definition: packet.h:121
av_dict_get
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
Definition: dict.c:40
postprocess.h
av_log_format_line
void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl, char *line, int line_size, int *print_prefix)
Format a line of log the same way as the default callback.
Definition: log.c:330
SECTION_ID_FORMAT_TAGS
@ SECTION_ID_FORMAT_TAGS
Definition: ffprobe.c:179
AVDOVIRpuDataHeader::vdr_bit_depth
uint8_t vdr_bit_depth
Definition: dovi_meta.h:88
Writer::print_rational
void(* print_rational)(WriterContext *wctx, AVRational *q, char *sep)
Definition: ffprobe.c:470
OPT_INT
#define OPT_INT
Definition: cmdutils.h:144
AVDOVIRpuDataHeader::rpu_type
uint8_t rpu_type
Definition: dovi_meta.h:77
initialized
static int initialized
Definition: vaapi_transcode.c:46
avcodec_alloc_context3
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
Definition: options.c:149
do_count_frames
static int do_count_frames
Definition: ffprobe.c:97
AVChapter::end
int64_t end
chapter start/end time in time_base units
Definition: avformat.h:1175
writer_child_next
static void * writer_child_next(void *obj, void *prev)
Definition: ffprobe.c:532
print_section_footer
#define print_section_footer(s)
Definition: ffprobe.c:1926
AVDOVIMetadata
Combined struct representing a combination of header, mapping and color metadata, for attaching to fr...
Definition: dovi_meta.h:197
ReadInterval::end
int64_t end
start, end in second/AV_TIME_BASE units
Definition: ffprobe.c:141
AVCodecDescriptor
This struct describes the properties of a single codec described by an AVCodecID.
Definition: codec_desc.h:38
stereo3d.h
AVMasteringDisplayMetadata::white_point
AVRational white_point[2]
CIE 1931 xy chromaticity coords of white point.
Definition: mastering_display_metadata.h:47
log_read_interval
static void log_read_interval(const ReadInterval *interval, void *log_ctx, int log_level)
Definition: ffprobe.c:2767
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:256
AVDOVIReshapingCurve::mmr_order
uint8_t mmr_order[AV_DOVI_MAX_PIECES]
Definition: dovi_meta.h:112
AVHDRPlusColorTransformParams::semiminor_axis_external_ellipse
uint16_t semiminor_axis_external_ellipse
The semi-minor axis value of the external ellipse of the elliptical pixel selector in amount of pixel...
Definition: hdr_dynamic_metadata.h:141
AV_PKT_DATA_STEREO3D
@ AV_PKT_DATA_STEREO3D
This side data should be associated with a video stream and contains Stereoscopic 3D information in f...
Definition: packet.h:115
unit_bit_per_second_str
static const char unit_bit_per_second_str[]
Definition: ffprobe.c:305
show_program
static int show_program(WriterContext *w, InputFile *ifile, AVProgram *program)
Definition: ffprobe.c:3160
av_realloc_array
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
Definition: mem.c:225
AV_PKT_DATA_MASTERING_DISPLAY_METADATA
@ AV_PKT_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata (based on SMPTE-2086:2014).
Definition: packet.h:223
xml_options
static const AVOption xml_options[]
Definition: ffprobe.c:1734
format
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 format(the sample packing is implied by the sample format) and sample rate. The lists are not just lists
AVFormatContext::nb_programs
unsigned int nb_programs
Definition: avformat.h:1381
AVHDRPlusColorTransformParams::window_upper_left_corner_y
AVRational window_upper_left_corner_y
The relative y coordinate of the top left pixel of the processing window.
Definition: hdr_dynamic_metadata.h:76
AVInputFormat::name
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:661
AVFormatContext::iformat
const struct AVInputFormat * iformat
The input container format.
Definition: avformat.h:1225
AVFormatContext::chapters
AVChapter ** chapters
Definition: avformat.h:1432
AVHDRPlusColorTransformParams::window_lower_right_corner_x
AVRational window_lower_right_corner_x
The relative x coordinate of the bottom right pixel of the processing window.
Definition: hdr_dynamic_metadata.h:85
SECTION_ID_SUBTITLE
@ SECTION_ID_SUBTITLE
Definition: ffprobe.c:221
AV_CHANNEL_ORDER_UNSPEC
@ AV_CHANNEL_ORDER_UNSPEC
Only the channel count is specified, without any further information about the channel order.
Definition: channel_layout.h:106
AVDictionaryEntry::key
char * key
Definition: dict.h:80
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AVDOVIRpuDataHeader::spatial_resampling_filter_flag
uint8_t spatial_resampling_filter_flag
Definition: dovi_meta.h:89
AVCodecParameters::width
int width
Video only.
Definition: codec_par.h:127
av_q2d
static double av_q2d(AVRational a)
Convert an AVRational to a double.
Definition: rational.h:104
av_hash_alloc
int av_hash_alloc(AVHashContext **ctx, const char *name)
Allocate a hash context for the algorithm specified by name.
Definition: hash.c:102
av_strtok
char * av_strtok(char *s, const char *delim, char **saveptr)
Split the string into several tokens which can be accessed by successive calls to av_strtok().
Definition: avstring.c:189
AVDynamicHDRPlus::targeted_system_display_maximum_luminance
AVRational targeted_system_display_maximum_luminance
The nominal maximum display luminance of the targeted system display, in units of 0....
Definition: hdr_dynamic_metadata.h:271
CompactContext::item_sep
char item_sep
Definition: ffprobe.c:1169
print_fmt
#define print_fmt(k, f,...)
Definition: ffprobe.c:1893
FlatContext
Definition: ffprobe.c:1328
avcodec_receive_frame
int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
Return decoded output data from a decoder.
Definition: decode.c:639
FF_PROFILE_UNKNOWN
#define FF_PROFILE_UNKNOWN
Definition: avcodec.h:1548
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
xml_print_str
static void xml_print_str(WriterContext *wctx, const char *key, const char *value)
Definition: ffprobe.c:1826
AVIO_FLAG_WRITE
#define AVIO_FLAG_WRITE
write-only
Definition: avio.h:629
probe_file
static int probe_file(WriterContext *wctx, const char *filename, const char *print_filename)
Definition: ffprobe.c:3410
AVDynamicHDRPlus::mastering_display_actual_peak_luminance_flag
uint8_t mastering_display_actual_peak_luminance_flag
This flag shall be equal to 0 in bitstreams conforming to this version of this Specification.
Definition: hdr_dynamic_metadata.h:303
JSON_INDENT
#define JSON_INDENT()
Definition: ffprobe.c:1604
AVCodecContext::bits_per_raw_sample
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
Definition: avcodec.h:1448
WriterContext::writer_w8
void(* writer_w8)(WriterContext *wctx, int b)
Definition: ffprobe.c:482
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:201
AVPacketSideData::data
uint8_t * data
Definition: packet.h:316
section::show_all_entries
int show_all_entries
Definition: ffprobe.c:169
AVDOVIDecoderConfigurationRecord::dv_profile
uint8_t dv_profile
Definition: dovi_meta.h:55
print_pkt_side_data
static void print_pkt_side_data(WriterContext *w, AVCodecParameters *par, const AVPacketSideData *side_data, int nb_side_data, SectionID id_data_list, SectionID id_data)
Definition: ffprobe.c:2268
ctx
AVFormatContext * ctx
Definition: movenc.c:48
flat_print_str
static void flat_print_str(WriterContext *wctx, const char *key, const char *value)
Definition: ffprobe.c:1426
SECTION_ID_ROOT
@ SECTION_ID_ROOT
Definition: ffprobe.c:214
nb_streams
static int nb_streams
Definition: ffprobe.c:307
ffprobe_show_program_version
static void ffprobe_show_program_version(WriterContext *w)
Definition: ffprobe.c:3498
av_rescale_q
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
Definition: mathematics.c:142
pixel_formats
static enum AVPixelFormat pixel_formats[]
Definition: vf_sr.c:69
do_show_chapter_tags
static int do_show_chapter_tags
Definition: ffprobe.c:117
AVPixFmtDescriptor::log2_chroma_w
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
Definition: pixdesc.h:80
do_show_pixel_format_components
static int do_show_pixel_format_components
Definition: ffprobe.c:114
AV_DOVI_MAPPING_POLYNOMIAL
@ AV_DOVI_MAPPING_POLYNOMIAL
Definition: dovi_meta.h:95
parse_options
void parse_options(void *optctx, int argc, char **argv, const OptionDef *options, void(*parse_arg_function)(void *, const char *))
Definition: cmdutils.c:345
CompactContext::nested_section
int nested_section[SECTION_MAX_NB_LEVELS]
Definition: ffprobe.c:1174
AVCodecContext::rc_max_rate
int64_t rc_max_rate
maximum bitrate
Definition: avcodec.h:1214
flat_writer
static const Writer flat_writer
Definition: ffprobe.c:1439
av_get_sample_fmt_name
const char * av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
Return the name of sample_fmt, or NULL if sample_fmt is not recognized.
Definition: samplefmt.c:51
key
const char * key
Definition: hwcontext_opencl.c:174
color_range
color_range
Definition: vf_selectivecolor.c:44
flat_escape_value_str
static const char * flat_escape_value_str(AVBPrint *dst, const char *src)
Definition: ffprobe.c:1377
do_show_chapters
static int do_show_chapters
Definition: ffprobe.c:101
AVCOL_PRI_UNSPECIFIED
@ AVCOL_PRI_UNSPECIFIED
Definition: pixfmt.h:474
AVCPBProperties
This structure describes the bitrate properties of an encoded bitstream.
Definition: defs.h:104
AVFormatContext::probe_score
int probe_score
format probing score.
Definition: avformat.h:1639
AV_FIELD_BT
@ AV_FIELD_BT
Definition: codec_par.h:43
show_chapters
static int show_chapters(WriterContext *w, InputFile *ifile)
Definition: ffprobe.c:3209
AVDOVIDecoderConfigurationRecord::dv_version_major
uint8_t dv_version_major
Definition: dovi_meta.h:53
av_dovi_get_header
static av_always_inline AVDOVIRpuDataHeader * av_dovi_get_header(const AVDOVIMetadata *data)
Definition: dovi_meta.h:208
AVDOVIReshapingCurve::poly_order
uint8_t poly_order[AV_DOVI_MAX_PIECES]
Definition: dovi_meta.h:109
AV_FRAME_DATA_DYNAMIC_HDR_VIVID
@ AV_FRAME_DATA_DYNAMIC_HDR_VIVID
HDR Vivid dynamic metadata associated with a video frame.
Definition: frame.h:211
find_stream_info
static int find_stream_info
Definition: ffprobe.c:150
SECTION_ID_FRAME_LOGS
@ SECTION_ID_FRAME_LOGS
Definition: ffprobe.c:192
FF_CODEC_PROPERTY_FILM_GRAIN
#define FF_CODEC_PROPERTY_FILM_GRAIN
Definition: avcodec.h:1847
arg
const char * arg
Definition: jacosubdec.c:67
AVStereo3D::flags
int flags
Additional information about the frame packing.
Definition: stereo3d.h:185
do_show_pixel_format_flags
static int do_show_pixel_format_flags
Definition: ffprobe.c:113
AVHDRPlusPercentile::percentage
uint8_t percentage
The percentage value corresponding to a specific percentile linearized RGB value in the processing wi...
Definition: hdr_dynamic_metadata.h:45
if
if(ret)
Definition: filter_design.txt:179
compact_print_section_header
static void compact_print_section_header(WriterContext *wctx)
Definition: ffprobe.c:1218
SECTION_FLAG_IS_WRAPPER
#define SECTION_FLAG_IS_WRAPPER
the section only contains other sections, but has no data at its own level
Definition: ffprobe.c:160
section::name
const char * name
Definition: ffprobe.c:158
avio_flush
void avio_flush(AVIOContext *s)
Force flushing of buffered data.
Definition: aviobuf.c:252
open_input_file
static int open_input_file(InputFile *ifile, const char *filename, const char *print_filename)
Definition: ffprobe.c:3279
AVDOVINLQParams::linear_deadzone_threshold
uint64_t linear_deadzone_threshold
Definition: dovi_meta.h:131
InputFile::streams
InputStream * streams
Definition: ffprobe.c:89
av_color_range_name
const char * av_color_range_name(enum AVColorRange range)
Definition: pixdesc.c:2990
ReadInterval::start
int64_t start
Definition: ffprobe.c:141
AVDISCARD_ALL
@ AVDISCARD_ALL
discard all
Definition: defs.h:54
AVFormatContext
Format I/O context.
Definition: avformat.h:1213
print_int
#define print_int(k, v)
Definition: ffprobe.c:1909
init_dynload
void init_dynload(void)
Initialize dynamic library loading.
Definition: cmdutils.c:77
opts
AVDictionary * opts
Definition: movenc.c:50
read_intervals
static ReadInterval * read_intervals
Definition: ffprobe.c:147
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:1108
opt_input_file
static void opt_input_file(void *optctx, const char *arg)
Definition: ffprobe.c:3699
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
WriterContext::avio
AVIOContext * avio
the I/O context used to write
Definition: ffprobe.c:480
AVDynamicHDRPlus::application_version
uint8_t application_version
Application version in the application defining document in ST-2094 suite.
Definition: hdr_dynamic_metadata.h:253
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
ReadInterval::has_end
int has_end
Definition: ffprobe.c:142
avcodec_get_class
const AVClass * avcodec_get_class(void)
Get the AVClass for AVCodecContext.
Definition: options.c:183
SECTION_ID_FRAME_LOG
@ SECTION_ID_FRAME_LOG
Definition: ffprobe.c:191
AVStream::time_base
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
Definition: avformat.h:978
NULL
#define NULL
Definition: coverity.c:32
section::children_ids
int children_ids[SECTION_MAX_NB_CHILDREN+1]
list of children section IDS, terminated by -1
Definition: ffprobe.c:165
compact_print_str
static void compact_print_str(WriterContext *wctx, const char *key, const char *value)
Definition: ffprobe.c:1260
av_hash_names
const char * av_hash_names(int i)
Get the names of available hash algorithms.
Definition: hash.c:86
SET_DO_SHOW
#define SET_DO_SHOW(id, varname)
Definition: ffprobe.c:4018
print_color_range
static void print_color_range(WriterContext *w, enum AVColorRange color_range)
Definition: ffprobe.c:2372
AVDOVIDecoderConfigurationRecord::dv_level
uint8_t dv_level
Definition: dovi_meta.h:56
program_name
const char program_name[]
program name, defined by the program for show_version().
Definition: ffprobe.c:93
compact_writer
static const Writer compact_writer
Definition: ffprobe.c:1283
StringValidation
StringValidation
Definition: ffprobe.c:452
AVDOVIDecoderConfigurationRecord::dv_bl_signal_compatibility_id
uint8_t dv_bl_signal_compatibility_id
Definition: dovi_meta.h:60
FlatContext::hierarchical
int hierarchical
Definition: ffprobe.c:1332
InputStream::st
AVStream * st
Definition: ffmpeg.h:308
AVHDRVividColorTransformParams::color_saturation_gain
AVRational color_saturation_gain[8]
Indicates the color correction strength parameter.
Definition: hdr_dynamic_vivid_metadata.h:235
AVPixFmtDescriptor::nb_components
uint8_t nb_components
The number of components each pixel has, (1-4)
Definition: pixdesc.h:71
av_hash_init
void av_hash_init(AVHashContext *ctx)
Initialize or reset a hash context.
Definition: hash.c:139
fmt_ctx
static AVFormatContext * fmt_ctx
Definition: demuxing_decoding.c:38
AV_DOVI_MAPPING_MMR
@ AV_DOVI_MAPPING_MMR
Definition: dovi_meta.h:96
AVHDRVividColorToneMappingParams::three_Spline_TH_enable_MB
AVRational three_Spline_TH_enable_MB
three_Spline_TH_enable_MB is in the range of 0.0 to 1.0, inclusive and in multiples of 1....
Definition: hdr_dynamic_vivid_metadata.h:136
compact_print_int
static void compact_print_int(WriterContext *wctx, const char *key, long long int value)
Definition: ffprobe.c:1273
OPT_EXPERT
#define OPT_EXPERT
Definition: cmdutils.h:140
ERROR
static void ERROR(const char *str)
Definition: audio_fifo.c:58
do_read_frames
static int do_read_frames
Definition: ffprobe.c:99
SECTION_ID_LIBRARY_VERSION
@ SECTION_ID_LIBRARY_VERSION
Definition: ffprobe.c:193
avcodec_free_context
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer.
Definition: options.c:164
hash
static struct AVHashContext * hash
Definition: ffprobe.c:286
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
version.h
SECTION_ID_STREAM_TAGS
@ SECTION_ID_STREAM_TAGS
Definition: ffprobe.c:218
writer_printf
#define writer_printf(wctx_, fmt_,...)
Definition: ffprobe.c:974
SHOW_OPTIONAL_FIELDS_ALWAYS
#define SHOW_OPTIONAL_FIELDS_ALWAYS
Definition: ffprobe.c:132
AVPacketSideData::type
enum AVPacketSideDataType type
Definition: packet.h:318
print_q
#define print_q(k, v, s)
Definition: ffprobe.c:1910
AVFormatContext::pb
AVIOContext * pb
I/O context.
Definition: avformat.h:1255
av_log_set_flags
void av_log_set_flags(int arg)
Definition: log.c:447
AV_RN32
#define AV_RN32(p)
Definition: intreadwrite.h:364
parseutils.h
AV_FRAME_DATA_ICC_PROFILE
@ AV_FRAME_DATA_ICC_PROFILE
The data contains an ICC profile as an opaque octet buffer following the format described by ISO 1507...
Definition: frame.h:144
AVDynamicHDRVivid
This struct represents dynamic metadata for color volume transform - CUVA 005.1:2021 standard.
Definition: hdr_dynamic_vivid_metadata.h:249
WriterContext::name
char * name
name of this writer instance
Definition: ffprobe.c:486
AVHDRVividColorTransformParams::color_saturation_mapping_flag
int color_saturation_mapping_flag
This flag indicates that the metadata for the color saturation mapping in the processing window is pr...
Definition: hdr_dynamic_vivid_metadata.h:222
AV_FRAME_DATA_MASTERING_DISPLAY_METADATA
@ AV_FRAME_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata associated with a video frame.
Definition: frame.h:120
AVStream::metadata
AVDictionary * metadata
Definition: avformat.h:1019
av_color_primaries_name
const char * av_color_primaries_name(enum AVColorPrimaries primaries)
Definition: pixdesc.c:3008
AVHDRPlusColorTransformParams::fraction_bright_pixels
AVRational fraction_bright_pixels
The fraction of selected pixels in the image that contains the brightest pixel in the scene.
Definition: hdr_dynamic_metadata.h:183
av_opt_free
void av_opt_free(void *obj)
Free all allocated objects in obj.
Definition: opt.c:1718
av_parse_time
int av_parse_time(int64_t *timeval, const char *timestr, int duration)
Parse timestr and return in *time a corresponding number of microseconds.
Definition: parseutils.c:589
AV_DICT_DONT_OVERWRITE
#define AV_DICT_DONT_OVERWRITE
Don't overwrite existing entries.
Definition: dict.h:74
avcodec_open2
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec.
Definition: avcodec.c:115
xml_init
static av_cold int xml_init(WriterContext *wctx)
Definition: ffprobe.c:1744
WriterContext::sections
const struct section * sections
array containing all sections
Definition: ffprobe.c:489
avio_w8
void avio_w8(AVIOContext *s, int b)
Definition: aviobuf.c:210
av_hash_update
void av_hash_update(AVHashContext *ctx, const uint8_t *src, size_t len)
Update a hash context with additional data.
Definition: hash.c:160
csv_writer
static const Writer csv_writer
Definition: ffprobe.c:1314
print_color_trc
static void print_color_trc(WriterContext *w, enum AVColorTransferCharacteristic color_trc)
Definition: ffprobe.c:2402
Writer::print_integer
void(* print_integer)(WriterContext *wctx, const char *, long long int)
Definition: ffprobe.c:469
AVCodecParameters::ch_layout
AVChannelLayout ch_layout
Audio only.
Definition: codec_par.h:212
AVDOVIReshapingCurve::mmr_constant
int64_t mmr_constant[AV_DOVI_MAX_PIECES]
Definition: dovi_meta.h:113
do_show_programs
static int do_show_programs
Definition: ffprobe.c:106
AVHDRPlusColorTransformParams::color_saturation_weight
AVRational color_saturation_weight
The color saturation gain in the processing window in the scene.
Definition: hdr_dynamic_metadata.h:229
AVHDRVividColorTransformParams::tone_mapping_mode_flag
int tone_mapping_mode_flag
This flag indicates that the metadata for the tone mapping function in the processing window is prese...
Definition: hdr_dynamic_vivid_metadata.h:205
bin_str
const char * bin_str
Definition: ffprobe.c:291
AV_FRAME_DATA_AFD
@ AV_FRAME_DATA_AFD
Active Format Description data consisting of a single byte as specified in ETSI TS 101 154 using AVAc...
Definition: frame.h:90
AVPixFmtDescriptor::flags
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
Definition: pixdesc.h:94
read_interval_packets
static int read_interval_packets(WriterContext *w, InputFile *ifile, const ReadInterval *interval, int64_t *cur_ts)
Definition: ffprobe.c:2791
real_options
static const OptionDef real_options[]
Definition: ffprobe.c:3957
AVCOL_RANGE_UNSPECIFIED
@ AVCOL_RANGE_UNSPECIFIED
Definition: pixfmt.h:565
WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER
#define WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER
Definition: ffprobe.c:450
AVCodecParameters::level
int level
Definition: codec_par.h:122
WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS
#define WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS
Definition: ffprobe.c:449
swresample.h
index
int index
Definition: gxfenc.c:89
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
unit_byte_str
static const char unit_byte_str[]
Definition: ffprobe.c:304
program_birth_year
const int program_birth_year
program birth year, defined by the program for show_banner()
Definition: ffprobe.c:94
AVCodecParameters::sample_rate
int sample_rate
Audio only.
Definition: codec_par.h:177
pthread_mutex_unlock
#define pthread_mutex_unlock(a)
Definition: ffprobe.c:77
AVAudioServiceType
AVAudioServiceType
Definition: defs.h:57
av_hash_freep
void av_hash_freep(AVHashContext **ctx)
Free hash context and set hash context pointer to NULL.
Definition: hash.c:236
show_format
static int show_format(WriterContext *w, InputFile *ifile)
Definition: ffprobe.c:3234
AVStream::nb_frames
int64_t nb_frames
number of frames in this stream if known or 0
Definition: avformat.h:1000
SECTION_ID_CHAPTER
@ SECTION_ID_CHAPTER
Definition: ffprobe.c:174
avcodec_find_decoder
const AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
Definition: allcodecs.c:935
print_duration_time
#define print_duration_time(k, v, tb)
Definition: ffprobe.c:1916
AVCodecParameters::extradata_size
int extradata_size
Size of the extradata content in bytes.
Definition: codec_par.h:79
show_value_unit
static int show_value_unit
Definition: ffprobe.c:124
AVFormatContext::nb_streams
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
Definition: avformat.h:1269
color_primaries
static const AVColorPrimariesDesc color_primaries[AVCOL_PRI_NB]
Definition: csp.c:71
print_input_filename
static const char * print_input_filename
Definition: ffprobe.c:282
SECTION_ID_FRAMES
@ SECTION_ID_FRAMES
Definition: ffprobe.c:181
codec_opts
AVDictionary * codec_opts
Definition: cmdutils.c:60
csv_escape_str
static const char * csv_escape_str(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
Quote fields containing special characters, check RFC4180.
Definition: ffprobe.c:1143
avformat_find_stream_info
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
Read packets of a media file to get stream information.
Definition: demux.c:2415
writer_open
static int writer_open(WriterContext **wctx, const Writer *writer, const char *args, const struct section *sections, int nb_sections, const char *output)
Definition: ffprobe.c:618
WRITER_STRING_VALIDATION_IGNORE
@ WRITER_STRING_VALIDATION_IGNORE
Definition: ffprobe.c:455
writer_w8
#define writer_w8(wctx_, b_)
Definition: ffprobe.c:972
av_spherical_projection_name
const char * av_spherical_projection_name(enum AVSphericalProjection projection)
Provide a human-readable name of a given AVSphericalProjection.
Definition: spherical.c:61
AVHDRVividColorToneMappingParams::three_Spline_TH_enable
AVRational three_Spline_TH_enable
3Spline_TH_enable of three Spline.
Definition: hdr_dynamic_vivid_metadata.h:143
AVHDRVividColorToneMappingParams::three_Spline_enable_Strength
AVRational three_Spline_enable_Strength
3Spline_enable_Strength of three Spline.
Definition: hdr_dynamic_vivid_metadata.h:164
AVIOContext
Bytestream IO Context.
Definition: avio.h:162
AV_SPHERICAL_CUBEMAP
@ AV_SPHERICAL_CUBEMAP
Video frame is split into 6 faces of a cube, and arranged on a 3x2 layout.
Definition: spherical.h:65
av_ts2timestr
#define av_ts2timestr(ts, tb)
Convenience macro, the return value should be used only directly in function arguments but never stan...
Definition: timestamp.h:76
WriterContext::string_validation_utf8_flags
unsigned int string_validation_utf8_flags
Definition: ffprobe.c:508
DefaultContext::noprint_wrappers
int noprint_wrappers
Definition: ffprobe.c:1021
av_log_set_callback
void av_log_set_callback(void(*callback)(void *, int, const char *, va_list))
Set the logging callback.
Definition: log.c:457
AVDynamicHDRPlus::num_rows_mastering_display_actual_peak_luminance
uint8_t num_rows_mastering_display_actual_peak_luminance
The number of rows in the mastering_display_actual_peak_luminance array.
Definition: hdr_dynamic_metadata.h:309
AVPacket::size
int size
Definition: packet.h:375
ReadInterval::start_is_offset
int start_is_offset
Definition: ffprobe.c:143
do_show_packet_tags
static int do_show_packet_tags
Definition: ffprobe.c:122
avformat_match_stream_specifier
int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
Check if the stream st contained in s is matched by the stream specifier spec.
Definition: avformat.c:545
id
enum AVCodecID id
Definition: extract_extradata_bsf.c:324
SECTION_ID_STREAM_DISPOSITION
@ SECTION_ID_STREAM_DISPOSITION
Definition: ffprobe.c:216
avformat_alloc_context
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
Definition: options.c:164
PRINT_PIX_FMT_FLAG
#define PRINT_PIX_FMT_FLAG(flagname, name)
Definition: ffprobe.c:3543
writer_w8_avio
static void writer_w8_avio(WriterContext *wctx, int b)
Definition: ffprobe.c:580
AV_PIX_FMT_FLAG_RGB
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
Definition: pixdesc.h:136
AVClass::category
AVClassCategory category
Category used for visualization (like color) This is only set if the category is equal for all object...
Definition: log.h:114
AV_DOVI_NLQ_LINEAR_DZ
@ AV_DOVI_NLQ_LINEAR_DZ
Definition: dovi_meta.h:119
AVDOVIRpuDataHeader::vdr_rpu_profile
uint8_t vdr_rpu_profile
Definition: dovi_meta.h:79
AVDynamicHDRPlus::num_windows
uint8_t num_windows
The number of processing windows.
Definition: hdr_dynamic_metadata.h:259
av_err2str
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
Definition: error.h:121
XMLContext::fully_qualified
int fully_qualified
Definition: ffprobe.c:1727
AVFormatContext::url
char * url
input or output URL.
Definition: avformat.h:1296
si_prefixes
static const struct @4 si_prefixes[]
SECTION_FLAG_IS_ARRAY
#define SECTION_FLAG_IS_ARRAY
the section contains an array of elements of the same type
Definition: ffprobe.c:161
AVCodecContext::pkt_timebase
AVRational pkt_timebase
Timebase in which pkt_dts/pts and AVPacket.dts/pts are.
Definition: avcodec.h:1746
SectionID
SectionID
Definition: ffprobe.c:172
REALLOCZ_ARRAY_STREAM
#define REALLOCZ_ARRAY_STREAM(ptr, cur_n, new_n)
Definition: ffprobe.c:1928
uninit_opts
void uninit_opts(void)
Uninitialize the cmdutils option system, in particular free the *_opts contexts and their contents.
Definition: cmdutils.c:64
AVClass::get_category
AVClassCategory(* get_category)(void *ctx)
Callback to return the category.
Definition: log.h:120
size
int size
Definition: twinvq_data.h:10344
SECTION_ID_CHAPTER_TAGS
@ SECTION_ID_CHAPTER_TAGS
Definition: ffprobe.c:175
AV_ESCAPE_MODE_XML
@ AV_ESCAPE_MODE_XML
Use XML non-markup character data escaping.
Definition: avstring.h:327
AVHDRVividColorTransformParams::average_maxrgb
AVRational average_maxrgb
Indicates the average brightness of the displayed content.
Definition: hdr_dynamic_vivid_metadata.h:185
show_private_data
static int show_private_data
Definition: ffprobe.c:128
avformat_seek_file
int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
Seek to timestamp ts.
Definition: seek.c:657
AV_NOPTS_VALUE
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:248
AVDynamicHDRPlus::mastering_display_actual_peak_luminance
AVRational mastering_display_actual_peak_luminance[25][25]
The normalized actual peak luminance of the mastering display used for mastering the image essence.
Definition: hdr_dynamic_metadata.h:322
section
Definition: ffprobe.c:156
xml_print_int
static void xml_print_int(WriterContext *wctx, const char *key, long long int value)
Definition: ffprobe.c:1857
opt_show_versions
static int opt_show_versions(void *optctx, const char *opt, const char *arg)
Definition: ffprobe.c:3932
AVFrameSideData::data
uint8_t * data
Definition: frame.h:233
AVCodecParameters::profile
int profile
Codec-specific bitstream restrictions that the stream conforms to.
Definition: codec_par.h:121
PAL
#define PAL
Definition: bktr.c:65
setup_find_stream_info_opts
AVDictionary ** setup_find_stream_info_opts(AVFormatContext *s, AVDictionary *codec_opts)
Setup AVCodecContext options for avformat_find_stream_info().
Definition: cmdutils.c:952
AVCHROMA_LOC_UNSPECIFIED
@ AVCHROMA_LOC_UNSPECIFIED
Definition: pixfmt.h:619
ffprobe_show_library_versions
static void ffprobe_show_library_versions(WriterContext *w)
Definition: ffprobe.c:3529
printf
printf("static const uint8_t my_array[100] = {\n")
SECTION_ID_PACKETS_AND_FRAMES
@ SECTION_ID_PACKETS_AND_FRAMES
Definition: ffprobe.c:198
AVOption::name
const char * name
Definition: opt.h:252
use_value_prefix
static int use_value_prefix
Definition: ffprobe.c:125
SECTION_ID_ERROR
@ SECTION_ID_ERROR
Definition: ffprobe.c:177
DefaultContext::nested_section
int nested_section[SECTION_MAX_NB_LEVELS]
Definition: ffprobe.c:1022
AVCPBProperties::min_bitrate
int64_t min_bitrate
Minimum bitrate of the stream, in bits per second.
Definition: defs.h:114
unit_value
Definition: ffprobe.c:387
flat_print_int
static void flat_print_int(WriterContext *wctx, const char *key, long long int value)
Definition: ffprobe.c:1421
avdevice.h
show_error
static void show_error(WriterContext *w, int err)
Definition: ffprobe.c:3265
Writer::flags
int flags
a combination or WRITER_FLAG_*
Definition: ffprobe.c:472
av_packet_unpack_dictionary
int av_packet_unpack_dictionary(const uint8_t *data, size_t size, AVDictionary **dict)
Unpack a dictionary from side_data.
Definition: avpacket.c:342
show_banner
void show_banner(int argc, char **argv, const OptionDef *options)
Print the program banner to stderr.
Definition: opt_common.c:237
ini_print_str
static void ini_print_str(WriterContext *wctx, const char *key, const char *value)
Definition: ffprobe.c:1528
AVHDRPlusColorTransformParams::window_lower_right_corner_y
AVRational window_lower_right_corner_y
The relative y coordinate of the bottom right pixel of the processing window.
Definition: hdr_dynamic_metadata.h:94
writer_put_str_avio
static void writer_put_str_avio(WriterContext *wctx, const char *str)
Definition: ffprobe.c:585
AV_OPT_SEARCH_CHILDREN
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
Definition: opt.h:563
AVDOVIRpuDataHeader::coef_log2_denom
uint8_t coef_log2_denom
Definition: dovi_meta.h:83
AVDOVIRpuDataHeader::bl_video_full_range_flag
uint8_t bl_video_full_range_flag
Definition: dovi_meta.h:85
AVHDRVividColorToneMappingParams::base_param_k1
int base_param_k1
indicates k1_0 in the base parameter, base_param_k1 <= 1: k1_0 = base_param_k1 base_param_k1 > 1: res...
Definition: hdr_dynamic_vivid_metadata.h:84
AVPacket::dts
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
Definition: packet.h:373
avio_write
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
Definition: aviobuf.c:232
AVSphericalMapping::padding
uint32_t padding
Number of pixels to pad from the edge of each cube face.
Definition: spherical.h:182
WriterContext::nb_section_frame
unsigned int nb_section_frame
number of the frame section in case we are in "packets_and_frames" section
Definition: ffprobe.c:503
AVDOVIReshapingCurve::poly_coef
int64_t poly_coef[AV_DOVI_MAX_PIECES][3]
Definition: dovi_meta.h:110
SECTION_ID_FRAME_SIDE_DATA_LIST
@ SECTION_ID_FRAME_SIDE_DATA_LIST
Definition: ffprobe.c:183
SECTION_ID_PACKET_TAGS
@ SECTION_ID_PACKET_TAGS
Definition: ffprobe.c:196
offset
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
Definition: writing_filters.txt:86
AVHashContext
Definition: hash.c:58
line
Definition: graph2dot.c:48
AV_PKT_DATA_CONTENT_LIGHT_LEVEL
@ AV_PKT_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
Definition: packet.h:236
AVPacket::flags
int flags
A combination of AV_PKT_FLAG values.
Definition: packet.h:380
av_packet_alloc
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
Definition: avpacket.c:62
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:203
do_show_format
static int do_show_format
Definition: ffprobe.c:103
AVCPBProperties::avg_bitrate
int64_t avg_bitrate
Average bitrate of the stream, in bits per second.
Definition: defs.h:119
ReadInterval
Definition: ffprobe.c:139
va_copy
#define va_copy(dst, src)
Definition: va_copy.h:31
writer_print_string
static int writer_print_string(WriterContext *wctx, const char *key, const char *val, int flags)
Definition: ffprobe.c:830
AV_STEREO3D_FLAG_INVERT
#define AV_STEREO3D_FLAG_INVERT
Inverted views, Right/Bottom represents the left view.
Definition: stereo3d.h:167
Writer
Definition: ffprobe.c:459
section::entries_to_show
AVDictionary * entries_to_show
Definition: ffprobe.c:168
do_show_stream_disposition
static int do_show_stream_disposition
Definition: ffprobe.c:108
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:191
xml_print_section_header
static void xml_print_section_header(WriterContext *wctx)
Definition: ffprobe.c:1767
AVDynamicHDRPlus::num_rows_targeted_system_display_actual_peak_luminance
uint8_t num_rows_targeted_system_display_actual_peak_luminance
The number of rows in the targeted system_display_actual_peak_luminance array.
Definition: hdr_dynamic_metadata.h:283
Writer::priv_size
int priv_size
private size for the writer context
Definition: ffprobe.c:461
AVStream::side_data
AVPacketSideData * side_data
An array of side data that applies to the whole stream (i.e.
Definition: avformat.h:1057
AVChromaLocation
AVChromaLocation
Location of chroma samples.
Definition: pixfmt.h:618
registered_writers
static const Writer * registered_writers[MAX_REGISTERED_WRITERS_NB+1]
Definition: ffprobe.c:978
AVHDRPlusColorTransformParams::window_upper_left_corner_x
AVRational window_upper_left_corner_x
The relative x coordinate of the top left pixel of the processing window.
Definition: hdr_dynamic_metadata.h:67
WriterContext::writer_printf
void(* writer_printf)(WriterContext *wctx, const char *fmt,...)
Definition: ffprobe.c:484
do_count_packets
static int do_count_packets
Definition: ffprobe.c:98
iformat
static const AVInputFormat * iformat
Definition: ffprobe.c:283
SHOW_OPTIONAL_FIELDS_AUTO
#define SHOW_OPTIONAL_FIELDS_AUTO
Definition: ffprobe.c:130
pthread_mutex_destroy
static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
Definition: os2threads.h:112
ReadInterval::has_start
int has_start
Definition: ffprobe.c:142
sections
static struct section sections[]
Definition: ffprobe.c:224
av_get_picture_type_char
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
Definition: utils.c:40
register_exit
void register_exit(void(*cb)(int ret))
Register a program-specific cleanup routine.
Definition: cmdutils.c:88
AVCPBProperties::vbv_delay
uint64_t vbv_delay
The delay between the time the packet this structure is associated with is received and the time when...
Definition: defs.h:134
unit_value::unit
const char * unit
Definition: ffprobe.c:389
AV_FIELD_BB
@ AV_FIELD_BB
Definition: codec_par.h:41
WriterContext::writer_put_str
void(* writer_put_str)(WriterContext *wctx, const char *str)
Definition: ffprobe.c:483
SECTION_ID_PROGRAM_STREAM_TAGS
@ SECTION_ID_PROGRAM_STREAM_TAGS
Definition: ffprobe.c:207
JSONContext::indent_level
int indent_level
Definition: ffprobe.c:1558
section::flags
int flags
For these sections the element_name field is mandatory.
Definition: ffprobe.c:164
avcodec_send_packet
int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt)
Supply raw packet data as input to a decoder.
Definition: decode.c:576
bprint.h
AV_FRAME_DATA_CONTENT_LIGHT_LEVEL
@ AV_FRAME_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
Definition: frame.h:137
AVHDRPlusColorTransformParams::semimajor_axis_internal_ellipse
uint16_t semimajor_axis_internal_ellipse
The semi-major axis value of the internal ellipse of the elliptical pixel selector in amount of pixel...
Definition: hdr_dynamic_metadata.h:125
AVSphericalMapping::roll
int32_t roll
Rotation around the forward vector [-180, 180].
Definition: spherical.h:128
AVClassCategory
AVClassCategory
Definition: log.h:28
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
AVPacket::pts
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: packet.h:367
av_timecode_make_smpte_tc_string2
char * av_timecode_make_smpte_tc_string2(char *buf, AVRational rate, uint32_t tcsmpte, int prevent_df, int skip_field)
Get the timecode string from the SMPTE timecode format.
Definition: timecode.c:138
code
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some it can consider them to be part of the FIFO and delay acknowledging a status change accordingly Example code
Definition: filter_design.txt:178
AVCodecContext::properties
unsigned properties
Properties of the stream that gets decoded.
Definition: avcodec.h:1844
SECTION_ID_PROGRAM
@ SECTION_ID_PROGRAM
Definition: ffprobe.c:208
AVChapter::id
int64_t id
unique ID to identify the chapter
Definition: avformat.h:1173
print_color_space
static void print_color_space(WriterContext *w, enum AVColorSpace color_space)
Definition: ffprobe.c:2382
ffprobe_show_pixel_formats
static void ffprobe_show_pixel_formats(WriterContext *w)
Definition: ffprobe.c:3548
WRITER_STRING_VALIDATION_NB
@ WRITER_STRING_VALIDATION_NB
Definition: ffprobe.c:456
av_packet_get_side_data
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, size_t *size)
Get side information from packet.
Definition: avpacket.c:251
show_usage
static void show_usage(void)
Definition: ffprobe.c:3491
WriterContext::nb_item
unsigned int nb_item[SECTION_MAX_NB_LEVELS]
number of the item printed in the given section, starting from 0
Definition: ffprobe.c:495
csv_options
static const AVOption csv_options[]
Definition: ffprobe.c:1300
AVHDRVividColorToneMappingParams::targeted_system_display_maximum_luminance
AVRational targeted_system_display_maximum_luminance
The nominal maximum display luminance of the targeted system display, in multiples of 1....
Definition: hdr_dynamic_vivid_metadata.h:37
show_subtitle
static void show_subtitle(WriterContext *w, AVSubtitle *sub, AVStream *stream, AVFormatContext *fmt_ctx)
Definition: ffprobe.c:2527
AVCodecParameters::height
int height
Definition: codec_par.h:128
avcodec_parameters_to_context
int avcodec_parameters_to_context(AVCodecContext *codec, const AVCodecParameters *par)
Fill the codec context based on the values from the supplied codec parameters.
Definition: codec_par.c:182
XMLContext::xsd_strict
int xsd_strict
Definition: ffprobe.c:1728
do_bitexact
static int do_bitexact
Definition: ffprobe.c:96
av_malloc_array
#define av_malloc_array(a, b)
Definition: tableprint_vlc.h:31
AVColorSpace
AVColorSpace
YUV colorspace type.
Definition: pixfmt.h:525
display.h
SECTION_ID_PACKETS
@ SECTION_ID_PACKETS
Definition: ffprobe.c:197
xml_writer
static Writer xml_writer
Definition: ffprobe.c:1864
AVCPBProperties::max_bitrate
int64_t max_bitrate
Maximum bitrate of the stream, in bits per second.
Definition: defs.h:109
AVDOVIDataMapping::num_y_partitions
uint32_t num_y_partitions
Definition: dovi_meta.h:148
LogBuffer::category
AVClassCategory category
Definition: ffprobe.c:319
writer_print_ts
static void writer_print_ts(WriterContext *wctx, const char *key, int64_t ts, int is_duration)
Definition: ffprobe.c:894
filter_codec_opts
AVDictionary * filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id, AVFormatContext *s, AVStream *st, const AVCodec *codec)
Filter out options for given codec.
Definition: cmdutils.c:894
opt_show_entries
static int opt_show_entries(void *optctx, const char *opt, const char *arg)
Definition: ffprobe.c:3649
av_always_inline
#define av_always_inline
Definition: attributes.h:49
value
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
Definition: writing_filters.txt:86
av_toupper
static av_const int av_toupper(int c)
Locale-independent conversion of ASCII characters to uppercase.
Definition: avstring.h:236
AV_OPT_FLAG_DECODING_PARAM
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
Definition: opt.h:282
SECTION_ID_FRAME_SIDE_DATA
@ SECTION_ID_FRAME_SIDE_DATA
Definition: ffprobe.c:184
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST
@ SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST
Definition: ffprobe.c:187
opt_sections
static int opt_sections(void *optctx, const char *opt, const char *arg)
Definition: ffprobe.c:3920
CompactContext::escape_str
const char *(* escape_str)(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
Definition: ffprobe.c:1173
WriterContext::priv
void * priv
private data for use by the filter
Definition: ffprobe.c:487
AVHDRPlusColorTransformParams::overlap_process_option
enum AVHDRPlusOverlapProcessOption overlap_process_option
Overlap process option indicates one of the two methods of combining rendered pixels in the processin...
Definition: hdr_dynamic_metadata.h:149
tb
#define tb
Definition: regdef.h:68
av_mallocz
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:264
AVHDRVividColorTransformParams
Color transform parameters at a processing window in a dynamic metadata for CUVA 005....
Definition: hdr_dynamic_vivid_metadata.h:172
AVProgram
New fields can be added to the end with minor version bumps.
Definition: avformat.h:1137
AV_PKT_DATA_CPB_PROPERTIES
@ AV_PKT_DATA_CPB_PROPERTIES
This side data corresponds to the AVCPBProperties struct.
Definition: packet.h:146
AV_PKT_DATA_SKIP_SAMPLES
@ AV_PKT_DATA_SKIP_SAMPLES
Recommmends skipping the specified number of samples.
Definition: packet.h:157
AVCodecParameters::color_range
enum AVColorRange color_range
Video only.
Definition: codec_par.h:147
AVMasteringDisplayMetadata
Mastering display metadata capable of representing the color volume of the display used to master the...
Definition: mastering_display_metadata.h:38
upcase_string
static char * upcase_string(char *dst, size_t dst_size, const char *src)
Definition: ffprobe.c:1039
profile
int profile
Definition: mxfenc.c:2005
AVCOL_SPC_UNSPECIFIED
@ AVCOL_SPC_UNSPECIFIED
Definition: pixfmt.h:528
AVDOVINLQParams
Coefficients of the non-linear inverse quantization.
Definition: dovi_meta.h:126
dec_str
const char * dec_str
Definition: ffprobe.c:292
AVHDRVividColorToneMappingParams::base_param_Delta_enable_mode
int base_param_Delta_enable_mode
This flag indicates that delta mode of base paramter(for value of 1)
Definition: hdr_dynamic_vivid_metadata.h:104
SECTION_ID_PACKET_SIDE_DATA
@ SECTION_ID_PACKET_SIDE_DATA
Definition: ffprobe.c:200
av_opt_next
const AVOption * av_opt_next(const void *obj, const AVOption *last)
Iterate over all AVOptions belonging to obj.
Definition: opt.c:46
use_value_sexagesimal_format
static int use_value_sexagesimal_format
Definition: ffprobe.c:127
SECTION_ID_LIBRARY_VERSIONS
@ SECTION_ID_LIBRARY_VERSIONS
Definition: ffprobe.c:194
av_calloc
void * av_calloc(size_t nmemb, size_t size)
Definition: mem.c:272
SECTION_ID_FRAME_SIDE_DATA_TIMECODE
@ SECTION_ID_FRAME_SIDE_DATA_TIMECODE
Definition: ffprobe.c:186
LogBuffer::parent_name
char * parent_name
Definition: ffprobe.c:320
log2
#define log2(x)
Definition: libm.h:404
AVCodecParameters::field_order
enum AVFieldOrder field_order
Video only.
Definition: codec_par.h:142
SECTION_ID_PROGRAM_VERSION
@ SECTION_ID_PROGRAM_VERSION
Definition: ffprobe.c:212
AVDynamicHDRPlus
This struct represents dynamic metadata for color volume transform - application 4 of SMPTE 2094-40:2...
Definition: hdr_dynamic_metadata.h:243
none_escape_str
static const char * none_escape_str(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
Definition: ffprobe.c:1161
AVDOVIDataMapping::curves
AVDOVIReshapingCurve curves[3]
Definition: dovi_meta.h:143
ini_writer
static const Writer ini_writer
Definition: ffprobe.c:1544
avcodec.h
parse_loglevel
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:468
PRINT_STRING_OPT
#define PRINT_STRING_OPT
Definition: ffprobe.c:827
AVDOVINLQParams::linear_deadzone_slope
uint64_t linear_deadzone_slope
Definition: dovi_meta.h:130
SECTION_ID_PROGRAMS
@ SECTION_ID_PROGRAMS
Definition: ffprobe.c:213
version.h
json_print_str
static void json_print_str(WriterContext *wctx, const char *key, const char *value)
Definition: ffprobe.c:1679
ini_print_int
static void ini_print_int(WriterContext *wctx, const char *key, long long int value)
Definition: ffprobe.c:1539
WriterContext::string_validation_replacement
char * string_validation_replacement
Definition: ffprobe.c:507
AVDOVIReshapingCurve
Definition: dovi_meta.h:104
version.h
tag
uint32_t tag
Definition: movenc.c:1646
AVStream::id
int id
Format-specific stream ID.
Definition: avformat.h:962
ret
ret
Definition: filter_design.txt:187
AVStream
Stream structure.
Definition: avformat.h:948
AV_PKT_DATA_DOVI_CONF
@ AV_PKT_DATA_DOVI_CONF
DOVI configuration ref: dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2....
Definition: packet.h:284
AV_FRAME_DATA_GOP_TIMECODE
@ AV_FRAME_DATA_GOP_TIMECODE
The GOP timecode in 25 bit timecode format.
Definition: frame.h:125
log_buffer
static LogBuffer * log_buffer
Definition: ffprobe.c:324
AVHDRVividColorToneMappingParams::three_Spline_TH_mode
int three_Spline_TH_mode
The mode of three Spline.
Definition: hdr_dynamic_vivid_metadata.h:129
avcodec_flush_buffers
void avcodec_flush_buffers(AVCodecContext *avctx)
Reset the internal codec state / flush internal buffers.
Definition: avcodec.c:377
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:71
frame
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Definition: filter_design.txt:264
AVCPBProperties::buffer_size
int64_t buffer_size
The size of the buffer to which the ratecontrol is applied, in bits.
Definition: defs.h:125
normalize.ifile
ifile
Definition: normalize.py:6
AVSphericalMapping::pitch
int32_t pitch
Rotation around the right vector [-90, 90].
Definition: spherical.h:127
AVDOVINLQParams::vdr_in_max
uint64_t vdr_in_max
Definition: dovi_meta.h:128
log_callback_help
void log_callback_help(void *ptr, int level, const char *fmt, va_list vl)
Trivial log callback.
Definition: cmdutils.c:72
AVStream::nb_side_data
int nb_side_data
The number of elements in the AVStream.side_data array.
Definition: avformat.h:1061
AVStereo3D::type
enum AVStereo3DType type
How views are packed within the video.
Definition: stereo3d.h:180
parse_read_interval
static int parse_read_interval(const char *interval_spec, ReadInterval *interval)
Parse interval specification, according to the format: INTERVAL ::= [START|+START_OFFSET][%[END|+END_...
Definition: ffprobe.c:3759
avformat.h
dovi_meta.h
av_bprintf
void av_bprintf(AVBPrint *buf, const char *fmt,...)
Definition: bprint.c:94
AVHDRVividColorTransformParams::minimum_maxrgb
AVRational minimum_maxrgb
Indicates the minimum brightness of the displayed content.
Definition: hdr_dynamic_vivid_metadata.h:178
dict.h
AVPacket::side_data
AVPacketSideData * side_data
Additional packet data that can be provided by the container.
Definition: packet.h:385
av_bprint_escape
void av_bprint_escape(AVBPrint *dstbuf, const char *src, const char *special_chars, enum AVEscapeMode mode, int flags)
Escape the content in src and append it to dstbuf.
Definition: bprint.c:263
flat_init
static av_cold int flat_init(WriterContext *wctx)
Definition: ffprobe.c:1348
AV_LOG_SKIP_REPEATED
#define AV_LOG_SKIP_REPEATED
Skip repeated messages, this requires the user app to use av_log() instead of (f)printf as the 2 woul...
Definition: log.h:370
CMDUTILS_COMMON_OPTIONS
#define CMDUTILS_COMMON_OPTIONS
Definition: opt_common.h:199
AV_DICT_MATCH_CASE
#define AV_DICT_MATCH_CASE
Only get an entry with exact-case key match.
Definition: dict.h:67
AV_RL32
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
Definition: bytestream.h:92
avio_vprintf
int avio_vprintf(AVIOContext *s, const char *fmt, va_list ap)
Writes a formatted string to the context taking a va_list.
Definition: aviobuf.c:1295
log_buffer_size
static int log_buffer_size
Definition: ffprobe.c:325
AVCodecParameters::chroma_location
enum AVChromaLocation chroma_location
Definition: codec_par.h:151
AVDOVIReshapingCurve::num_pivots
uint8_t num_pivots
Definition: dovi_meta.h:105
avformat_network_deinit
int avformat_network_deinit(void)
Undo the initialization done by avformat_network_init.
Definition: utils.c:569
AVDOVIRpuDataHeader::vdr_rpu_level
uint8_t vdr_rpu_level
Definition: dovi_meta.h:80
WriterContext::writer
const Writer * writer
the Writer of which this is an instance
Definition: ffprobe.c:479
SECTION_ID_FRAME
@ SECTION_ID_FRAME
Definition: ffprobe.c:180
av_dovi_get_color
static av_always_inline AVDOVIColorMetadata * av_dovi_get_color(const AVDOVIMetadata *data)
Definition: dovi_meta.h:220
AVHDRVividColorToneMappingParams::base_param_m_n
AVRational base_param_m_n
base_param_m_n in the base parameter, in multiples of 1.0/10.
Definition: hdr_dynamic_vivid_metadata.h:77
XML_INDENT
#define XML_INDENT()
Definition: ffprobe.c:1765
av_get_media_type_string
const char * av_get_media_type_string(enum AVMediaType media_type)
Return a string describing the media_type enum, NULL if media_type is unknown.
Definition: utils.c:28
AV_FRAME_DATA_DYNAMIC_HDR_PLUS
@ AV_FRAME_DATA_DYNAMIC_HDR_PLUS
HDR dynamic metadata associated with a video frame.
Definition: frame.h:159
AVHDRVividColorToneMappingParams::base_param_m_a
AVRational base_param_m_a
base_param_m_a in the base parameter, in multiples of 1.0/1023.
Definition: hdr_dynamic_vivid_metadata.h:63
AVCodecContext
main external API structure.
Definition: avcodec.h:389
AVStream::index
int index
stream index in AVFormatContext
Definition: avformat.h:956
av_timecode_make_mpeg_tc_string
char * av_timecode_make_mpeg_tc_string(char *buf, uint32_t tc25bit)
Get the timecode string from the 25-bit timecode format (MPEG GOP format).
Definition: timecode.c:167
av_bprint_clear
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
Definition: bprint.c:227
hash.h
CompactContext::nokey
int nokey
Definition: ffprobe.c:1170
WriterContext
Definition: ffprobe.c:477
AVDOVIDataMapping::mapping_chroma_format_idc
uint8_t mapping_chroma_format_idc
Definition: dovi_meta.h:142
AVHDRVividColorToneMappingParams::three_Spline_TH_Delta1
AVRational three_Spline_TH_Delta1
3Spline_TH_Delta1 of three Spline.
Definition: hdr_dynamic_vivid_metadata.h:150
opt_output_file
static void opt_output_file(void *optctx, const char *arg)
Definition: ffprobe.c:3718
channel_layout.h
AV_OPT_FLAG_EXPORT
#define AV_OPT_FLAG_EXPORT
The option is intended for exporting values to the caller.
Definition: opt.h:289
JSONContext::item_sep
const char * item_sep
Definition: ffprobe.c:1560
nb_streams_packets
static uint64_t * nb_streams_packets
Definition: ffprobe.c:308
AVDynamicHDRPlus::targeted_system_display_actual_peak_luminance_flag
uint8_t targeted_system_display_actual_peak_luminance_flag
This flag shall be equal to 0 in bit streams conforming to this version of this Specification.
Definition: hdr_dynamic_metadata.h:277
do_show_program_version
static int do_show_program_version
Definition: ffprobe.c:110
opt_common.h
DEFINE_OPT_SHOW_SECTION
#define DEFINE_OPT_SHOW_SECTION(section, target_section_id)
Definition: ffprobe.c:3939
AVInputFormat::flags
int flags
Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS, AVFMT_NOTIMESTAMPS,...
Definition: avformat.h:675
AVRational::den
int den
Denominator.
Definition: rational.h:60
PRINT_STRING_VALIDATE
#define PRINT_STRING_VALIDATE
Definition: ffprobe.c:828
AVDOVIDecoderConfigurationRecord::bl_present_flag
uint8_t bl_present_flag
Definition: dovi_meta.h:59
AVDOVIRpuDataHeader::bl_bit_depth
uint8_t bl_bit_depth
Definition: dovi_meta.h:86
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
version.h
AVHDRPlusColorTransformParams::num_distribution_maxrgb_percentiles
uint8_t num_distribution_maxrgb_percentiles
The number of linearized maxRGB values at given percentiles in the processing window in the scene.
Definition: hdr_dynamic_metadata.h:170
AVHDRPlusColorTransformParams::maxscl
AVRational maxscl[3]
The maximum of the color components of linearized RGB values in the processing window in the scene.
Definition: hdr_dynamic_metadata.h:157
SECTION_ID_PIXEL_FORMATS
@ SECTION_ID_PIXEL_FORMATS
Definition: ffprobe.c:205
av_dict_parse_string
int av_dict_parse_string(AVDictionary **pm, const char *str, const char *key_val_sep, const char *pairs_sep, int flags)
Parse the key/value pairs list and add the parsed entries to a dictionary.
Definition: dict.c:180
print_str_validate
#define print_str_validate(k, v)
Definition: ffprobe.c:1913
AVFrameSideData::type
enum AVFrameSideDataType type
Definition: frame.h:232
AVDOVIColorMetadata
Dolby Vision RPU colorspace metadata parameters.
Definition: dovi_meta.h:157
swscale
static int swscale(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[], int dstSliceY, int dstSliceH)
Definition: swscale.c:234
hdr_dynamic_metadata.h
AVPixFmtDescriptor::comp
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
Definition: pixdesc.h:105
ini_options
static const AVOption ini_options[]
Definition: ffprobe.c:1460
AVStream::r_frame_rate
AVRational r_frame_rate
Real base framerate of the stream.
Definition: avformat.h:1097
print_dynamic_hdr10_plus
static void print_dynamic_hdr10_plus(WriterContext *w, const AVDynamicHDRPlus *metadata)
Definition: ffprobe.c:2101
CHECK_COMPLIANCE
#define CHECK_COMPLIANCE(opt, opt_name)
AVDOVIDecoderConfigurationRecord::rpu_present_flag
uint8_t rpu_present_flag
Definition: dovi_meta.h:57
options
static const OptionDef * options
Definition: ffprobe.c:278
do_show_pixel_formats
static int do_show_pixel_formats
Definition: ffprobe.c:112
AVDOVIDecoderConfigurationRecord::el_present_flag
uint8_t el_present_flag
Definition: dovi_meta.h:58
AV_CODEC_ID_PROBE
@ AV_CODEC_ID_PROBE
codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it
Definition: codec_id.h:570
av_channel_layout_describe
int av_channel_layout_describe(const AVChannelLayout *channel_layout, char *buf, size_t buf_size)
Get a human-readable string describing the channel layout properties.
Definition: channel_layout.c:776
av_find_input_format
const AVInputFormat * av_find_input_format(const char *short_name)
Find AVInputFormat based on the short name of the input format.
Definition: format.c:120
AVMasteringDisplayMetadata::min_luminance
AVRational min_luminance
Min luminance of mastering display (cd/m^2).
Definition: mastering_display_metadata.h:52
FF_CODEC_PROPERTY_CLOSED_CAPTIONS
#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS
Definition: avcodec.h:1846
avio_open
int avio_open(AVIOContext **s, const char *url, int flags)
Create and initialize a AVIOContext for accessing the resource indicated by url.
Definition: aviobuf.c:1223
AVFormatContext::duration
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds.
Definition: avformat.h:1315
AVHDRVividColorToneMappingParams
Color tone mapping parameters at a processing window in a dynamic metadata for CUVA 005....
Definition: hdr_dynamic_vivid_metadata.h:31
AVPacket::stream_index
int stream_index
Definition: packet.h:376
FlatContext::sep_str
const char * sep_str
Definition: ffprobe.c:1330
DEFINE_WRITER_CLASS
#define DEFINE_WRITER_CLASS(name)
Definition: ffprobe.c:1005
opt_print_filename
static int opt_print_filename(void *optctx, const char *opt, const char *arg)
Definition: ffprobe.c:3737
AVCodecContext::coded_width
int coded_width
Bitstream width / height, may be different from width/height e.g.
Definition: avcodec.h:577
tc
#define tc
Definition: regdef.h:69
av_strdup
char * av_strdup(const char *s)
Duplicate a string.
Definition: mem.c:280
XMLContext
Definition: ffprobe.c:1723
AVDOVIDecoderConfigurationRecord::dv_version_minor
uint8_t dv_version_minor
Definition: dovi_meta.h:54
do_show_program_tags
static int do_show_program_tags
Definition: ffprobe.c:120
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
WRITER_STRING_VALIDATION_REPLACE
@ WRITER_STRING_VALIDATION_REPLACE
Definition: ffprobe.c:454
AVHDRPlusColorTransformParams::center_of_ellipse_y
uint16_t center_of_ellipse_y
The y coordinate of the center position of the concentric internal and external ellipses of the ellip...
Definition: hdr_dynamic_metadata.h:110
av_log_default_callback
void av_log_default_callback(void *ptr, int level, const char *fmt, va_list vl)
Default logging callback.
Definition: log.c:348
unit_value::i
long long int i
Definition: ffprobe.c:388
writer_printf_avio
static void writer_printf_avio(WriterContext *wctx, const char *fmt,...)
Definition: ffprobe.c:590
CompactContext::item_sep_str
char * item_sep_str
Definition: ffprobe.c:1168
CompactContext::escape_mode_str
char * escape_mode_str
Definition: ffprobe.c:1172
mastering_display_metadata.h
av_dovi_get_mapping
static av_always_inline AVDOVIDataMapping * av_dovi_get_mapping(const AVDOVIMetadata *data)
Definition: dovi_meta.h:214
av_hash_final_hex
void av_hash_final_hex(struct AVHashContext *ctx, uint8_t *dst, int size)
Finalize a hash context and store the hexadecimal representation of the actual hash value as a string...
Definition: hash.c:213
AVCodecParameters::video_delay
int video_delay
Video only.
Definition: codec_par.h:156
FlatContext::sep
char sep
Definition: ffprobe.c:1331
AV_FIELD_PROGRESSIVE
@ AV_FIELD_PROGRESSIVE
Definition: codec_par.h:39
JSONContext::item_start_end
const char * item_start_end
Definition: ffprobe.c:1560
AVFrameSideData
Structure to hold side data for an AVFrame.
Definition: frame.h:231
AVCodecParameters::format
int format
Definition: codec_par.h:85
AVDynamicHDRVivid::params
AVHDRVividColorTransformParams params[3]
The color transform parameters for every processing window.
Definition: hdr_dynamic_vivid_metadata.h:264
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
bin_val
double bin_val
Definition: ffprobe.c:289
ffprobe_cleanup
static void ffprobe_cleanup(int ret)
Definition: ffprobe.c:376
SECTION_ID_FRAME_SIDE_DATA_TIMECODE_LIST
@ SECTION_ID_FRAME_SIDE_DATA_TIMECODE_LIST
Definition: ffprobe.c:185
WRITER_STRING_VALIDATION_FAIL
@ WRITER_STRING_VALIDATION_FAIL
Definition: ffprobe.c:453
av_free
#define av_free(p)
Definition: tableprint_vlc.h:33
AVDictionaryEntry
Definition: dict.h:79
compact_options
static const AVOption compact_options[]
Definition: ffprobe.c:1182
CompactContext::has_nested_elems
int has_nested_elems[SECTION_MAX_NB_LEVELS]
Definition: ffprobe.c:1175
default_print_section_header
static void default_print_section_header(WriterContext *wctx)
Definition: ffprobe.c:1048
AVCodecParameters::codec_id
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:61
DEFAULT
#define DEFAULT
Definition: avdct.c:28
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:416
AVPacket
This structure stores compressed data.
Definition: packet.h:351
AVContentLightMetadata::MaxFALL
unsigned MaxFALL
Max average light level per frame (cd/m^2).
Definition: mastering_display_metadata.h:107
AVDOVIReshapingCurve::pivots
uint16_t pivots[AV_DOVI_MAX_PIECES+1]
Definition: dovi_meta.h:106
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:244
WriterContext::nb_sections
int nb_sections
number of sections
Definition: ffprobe.c:490
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
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:70
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
av_dict_copy
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
Definition: dict.c:217
cmdutils.h
AVPacket::pos
int64_t pos
byte position in stream, -1 if unknown
Definition: packet.h:394
AVDynamicHDRPlus::targeted_system_display_actual_peak_luminance
AVRational targeted_system_display_actual_peak_luminance[25][25]
The normalized actual peak luminance of the targeted system display.
Definition: hdr_dynamic_metadata.h:297
print_dynamic_hdr_vivid
static void print_dynamic_hdr_vivid(WriterContext *w, const AVDynamicHDRVivid *metadata)
Definition: ffprobe.c:2200
av_frame_side_data_name
const char * av_frame_side_data_name(enum AVFrameSideDataType type)
Definition: frame.c:798
SHOW_LIB_VERSION
#define SHOW_LIB_VERSION(libname, LIBNAME)
Definition: ffprobe.c:3514
OPT_BOOL
#define OPT_BOOL
Definition: cmdutils.h:139
writer_print_rational
static void writer_print_rational(WriterContext *wctx, const char *key, AVRational q, char sep)
Definition: ffprobe.c:868
d
d
Definition: ffmpeg_filter.c:153
XMLContext::indent_level
int indent_level
Definition: ffprobe.c:1726
int32_t
int32_t
Definition: audioconvert.c:56
convert_header.str
string str
Definition: convert_header.py:20
AVDOVINLQParams::nlq_offset
uint16_t nlq_offset
Definition: dovi_meta.h:127
timestamp.h
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
AVFrameSideData::metadata
AVDictionary * metadata
Definition: frame.h:235
AVCodecParameters::bit_rate
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
Definition: codec_par.h:90
av_opt_get
int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
Definition: opt.c:837
AVDOVIDataMapping::vdr_rpu_id
uint8_t vdr_rpu_id
Definition: dovi_meta.h:140
AVDynamicHDRVivid::system_start_code
uint8_t system_start_code
The system start code.
Definition: hdr_dynamic_vivid_metadata.h:253
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVFormatContext::start_time
int64_t start_time
Position of the first frame of the component, in AV_TIME_BASE fractional seconds.
Definition: avformat.h:1305
writer_print_section_footer
static void writer_print_section_footer(WriterContext *wctx)
Definition: ffprobe.c:744
flat
static av_always_inline void flat(WaveformContext *s, AVFrame *in, AVFrame *out, int component, int intensity, int offset_y, int offset_x, int column, int mirror, int jobnr, int nb_jobs)
Definition: vf_waveform.c:1100
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST
@ SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST
Definition: ffprobe.c:189
AVHDRVividColorToneMappingParams::base_param_k3
int base_param_k3
indicates k3_0 in the base parameter, base_param_k3 == 1: k3_0 = base_param_k3 base_param_k3 == 2: k3...
Definition: hdr_dynamic_vivid_metadata.h:99
SECTION_ID_PROGRAM_STREAMS
@ SECTION_ID_PROGRAM_STREAMS
Definition: ffprobe.c:209
av_stereo3d_type_name
const char * av_stereo3d_type_name(unsigned int type)
Provide a human-readable name of a given stereo3d type.
Definition: stereo3d.c:58
do_show_data
static int do_show_data
Definition: ffprobe.c:109
AVDOVIRpuDataHeader::disable_residual_flag
uint8_t disable_residual_flag
Definition: dovi_meta.h:91
flat_print_section_header
static void flat_print_section_header(WriterContext *wctx)
Definition: ffprobe.c:1395
AVClass::parent_log_context_offset
int parent_log_context_offset
Offset in the structure where a pointer to the parent context for logging is stored.
Definition: log.h:107
AVHDRVividColorToneMappingParams::three_Spline_TH_Delta2
AVRational three_Spline_TH_Delta2
3Spline_TH_Delta2 of three Spline.
Definition: hdr_dynamic_vivid_metadata.h:157
LogBuffer::parent_category
AVClassCategory parent_category
Definition: ffprobe.c:321
AV_PKT_DATA_WEBVTT_IDENTIFIER
@ AV_PKT_DATA_WEBVTT_IDENTIFIER
The optional first identifier line of a WebVTT cue.
Definition: packet.h:197
SECTION_ID_PROGRAM_STREAM_DISPOSITION
@ SECTION_ID_PROGRAM_STREAM_DISPOSITION
Definition: ffprobe.c:206
avcodec_descriptor_get
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
Definition: codec_desc.c:3559
AVStereo3D
Stereo 3D type: this structure describes how two videos are packed within a single video surface,...
Definition: stereo3d.h:176
AVDictionaryEntry::value
char * value
Definition: dict.h:81
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:988
show_data_hash
static char * show_data_hash
Definition: ffprobe.c:137
avstring.h
AVClass::item_name
const char *(* item_name)(void *ctx)
A pointer to a function which returns the name of a context instance ctx associated with the class.
Definition: log.h:77
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:229
print_primaries
static void print_primaries(WriterContext *w, enum AVColorPrimaries color_primaries)
Definition: ffprobe.c:2392
show_help_options
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:134
do_show_streams
static int do_show_streams
Definition: ffprobe.c:107
unit_value::d
double d
Definition: ffprobe.c:388
InputFile::nb_streams
int nb_streams
Definition: ffmpeg.h:420
AVColorRange
AVColorRange
Visual content value range.
Definition: pixfmt.h:564
AVChapter::time_base
AVRational time_base
time base in which the start/end timestamps are specified
Definition: avformat.h:1174
int
int
Definition: ffmpeg_filter.c:153
AVHDRVividColorToneMappingParams::base_param_m_p
AVRational base_param_m_p
base_param_m_p in the base parameter, in multiples of 1.0/16383.
Definition: hdr_dynamic_vivid_metadata.h:49
AVDOVIDataMapping::nlq
AVDOVINLQParams nlq[3]
Definition: dovi_meta.h:149
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
snprintf
#define snprintf
Definition: snprintf.h:34
stream_specifier
static char * stream_specifier
Definition: ffprobe.c:136
writer_print_integers
static void writer_print_integers(WriterContext *wctx, const char *name, uint8_t *data, int size, const char *format, int columns, int bytes, int offset_add)
Definition: ffprobe.c:946
log_callback
static void log_callback(void *ptr, int level, const char *fmt, va_list vl)
Definition: ffprobe.c:327
AVDOVIDataMapping
Dolby Vision RPU data mapping parameters.
Definition: dovi_meta.h:139
SECTION_ID_CHAPTERS
@ SECTION_ID_CHAPTERS
Definition: ffprobe.c:176
print_time
#define print_time(k, v, tb)
Definition: ffprobe.c:1914
default_print_str
static void default_print_str(WriterContext *wctx, const char *key, const char *value)
Definition: ffprobe.c:1086
AVSphericalMapping
This structure describes how to handle spherical videos, outlining information about projection,...
Definition: spherical.h:82
av_color_transfer_name
const char * av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
Definition: pixdesc.c:3029
print_str_opt
#define print_str_opt(k, v)
Definition: ffprobe.c:1912
WriterContext::nb_section_packet
unsigned int nb_section_packet
number of the packet section in case we are in "packets_and_frames" section
Definition: ffprobe.c:502
CompactContext::terminate_line
int terminate_line[SECTION_MAX_NB_LEVELS]
Definition: ffprobe.c:1176
av_bprint_chars
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
Append char c n times to a print buffer.
Definition: bprint.c:140
default_print_section_footer
static void default_print_section_footer(WriterContext *wctx)
Definition: ffprobe.c:1073
AVPixFmtDescriptor::log2_chroma_h
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition: pixdesc.h:89
SECTION_ID_PIXEL_FORMAT_COMPONENT
@ SECTION_ID_PIXEL_FORMAT_COMPONENT
Definition: ffprobe.c:203
INIContext::hierarchical
int hierarchical
Definition: ffprobe.c:1454
AVSphericalMapping::yaw
int32_t yaw
Rotation around the up vector [-180, 180].
Definition: spherical.h:126
AVHDRVividColorToneMappingParams::base_param_m_b
AVRational base_param_m_b
base_param_m_b in the base parameter, in multiples of 1/1023.
Definition: hdr_dynamic_vivid_metadata.h:70
SECTION_ID_PACKET
@ SECTION_ID_PACKET
Definition: ffprobe.c:195
swscale.h
AV_DICT_DONT_STRDUP_KEY
#define AV_DICT_DONT_STRDUP_KEY
Take ownership of a key that's been allocated with av_malloc() or another memory allocation function.
Definition: dict.h:70
JSONContext::compact
int compact
Definition: ffprobe.c:1559
AVHDRVividColorToneMappingParams::base_param_m_m
AVRational base_param_m_m
base_param_m_m in the base parameter, in multiples of 1.0/10.
Definition: hdr_dynamic_vivid_metadata.h:56
unit_second_str
static const char unit_second_str[]
Definition: ffprobe.c:302
AVHDRPlusColorTransformParams::bezier_curve_anchors
AVRational bezier_curve_anchors[15]
The intermediate anchor parameters of the tone mapping function in the processing window in the scene...
Definition: hdr_dynamic_metadata.h:216
av_x_if_null
static void * av_x_if_null(const void *p, const void *x)
Return x default pointer in case p is NULL.
Definition: avutil.h:308
AVDynamicHDRPlus::num_cols_mastering_display_actual_peak_luminance
uint8_t num_cols_mastering_display_actual_peak_luminance
The number of columns in the mastering_display_actual_peak_luminance array.
Definition: hdr_dynamic_metadata.h:315
dec_ctx
static AVCodecContext * dec_ctx
Definition: filtering_audio.c:44
AVDOVIDataMapping::num_x_partitions
uint32_t num_x_partitions
Definition: dovi_meta.h:147
AVPacket::side_data_elems
int side_data_elems
Definition: packet.h:386
av_display_rotation_get
double av_display_rotation_get(const int32_t matrix[9])
Extract the rotation component of the transformation matrix.
Definition: display.c:35
version.h
writer_class
static const AVClass writer_class
Definition: ffprobe.c:540
av_get_pix_fmt_name
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
Definition: pixdesc.c:2582
do_show_packets
static int do_show_packets
Definition: ffprobe.c:105
show_programs
static int show_programs(WriterContext *w, InputFile *ifile)
Definition: ffprobe.c:3191
JSONContext
Definition: ffprobe.c:1556
av_fourcc2str
#define av_fourcc2str(fourcc)
Definition: avutil.h:354
pthread_mutex_lock
#define pthread_mutex_lock(a)
Definition: ffprobe.c:73
writer_w8_printf
static void writer_w8_printf(WriterContext *wctx, int b)
Definition: ffprobe.c:599
bprint_bytes
static void bprint_bytes(AVBPrint *bp, const uint8_t *ubuf, size_t ubuf_size)
Definition: ffprobe.c:572
avdevice_register_all
void avdevice_register_all(void)
Initialize libavdevice and register all the input and output devices.
Definition: alldevices.c:64
Writer::print_section_header
void(* print_section_header)(WriterContext *wctx)
Definition: ffprobe.c:467
AVDOVIDecoderConfigurationRecord
Definition: dovi_meta.h:52
writer_register
static int writer_register(const Writer *writer)
Definition: ffprobe.c:980