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 #include <math.h>
31 
32 #include "libavformat/avformat.h"
33 #include "libavformat/version.h"
34 #include "libavcodec/avcodec.h"
35 #include "libavcodec/version.h"
37 #include "libavutil/avassert.h"
38 #include "libavutil/avstring.h"
39 #include "libavutil/bprint.h"
41 #include "libavutil/display.h"
43 #include "libavutil/hash.h"
45 #include "libavutil/iamf.h"
48 #include "libavutil/dovi_meta.h"
49 #include "libavutil/opt.h"
50 #include "libavutil/pixdesc.h"
51 #include "libavutil/spherical.h"
52 #include "libavutil/stereo3d.h"
53 #include "libavutil/dict.h"
54 #include "libavutil/intreadwrite.h"
55 #include "libavutil/libm.h"
56 #include "libavutil/parseutils.h"
57 #include "libavutil/timecode.h"
58 #include "libavutil/timestamp.h"
59 #include "libavdevice/avdevice.h"
60 #include "libavdevice/version.h"
61 #include "libswscale/swscale.h"
62 #include "libswscale/version.h"
64 #include "libswresample/version.h"
66 #include "libpostproc/version.h"
67 #include "libavfilter/version.h"
68 #include "cmdutils.h"
69 #include "opt_common.h"
70 
71 #include "libavutil/thread.h"
72 
73 #if !HAVE_THREADS
74 # ifdef pthread_mutex_lock
75 # undef pthread_mutex_lock
76 # endif
77 # define pthread_mutex_lock(a) do{}while(0)
78 # ifdef pthread_mutex_unlock
79 # undef pthread_mutex_unlock
80 # endif
81 # define pthread_mutex_unlock(a) do{}while(0)
82 #endif
83 
84 // attached as opaque_ref to packets/frames
85 typedef struct FrameData {
86  int64_t pkt_pos;
87  int pkt_size;
88 } FrameData;
89 
90 typedef struct InputStream {
91  AVStream *st;
92 
94 } InputStream;
95 
96 typedef struct InputFile {
98 
100  int nb_streams;
101 } InputFile;
102 
103 const char program_name[] = "ffprobe";
104 const int program_birth_year = 2007;
105 
106 static int do_bitexact = 0;
107 static int do_count_frames = 0;
108 static int do_count_packets = 0;
109 static int do_read_frames = 0;
110 static int do_read_packets = 0;
111 static int do_show_chapters = 0;
112 static int do_show_error = 0;
113 static int do_show_format = 0;
114 static int do_show_frames = 0;
115 static int do_show_packets = 0;
116 static int do_show_programs = 0;
117 static int do_show_stream_groups = 0;
119 static int do_show_streams = 0;
122 static int do_show_data = 0;
123 static int do_show_program_version = 0;
125 static int do_show_pixel_formats = 0;
128 static int do_show_log = 0;
129 
130 static int do_show_chapter_tags = 0;
131 static int do_show_format_tags = 0;
132 static int do_show_frame_tags = 0;
133 static int do_show_program_tags = 0;
135 static int do_show_stream_tags = 0;
136 static int do_show_packet_tags = 0;
137 
138 static int show_value_unit = 0;
139 static int use_value_prefix = 0;
142 static int show_private_data = 1;
143 
144 #define SHOW_OPTIONAL_FIELDS_AUTO -1
145 #define SHOW_OPTIONAL_FIELDS_NEVER 0
146 #define SHOW_OPTIONAL_FIELDS_ALWAYS 1
148 
149 static char *output_format;
150 static char *stream_specifier;
151 static char *show_data_hash;
152 
153 typedef struct ReadInterval {
154  int id; ///< identifier
155  int64_t start, end; ///< start, end in second/AV_TIME_BASE units
159 } ReadInterval;
160 
162 static int read_intervals_nb = 0;
163 
164 static int find_stream_info = 1;
165 
166 /* section structure definition */
167 
168 #define SECTION_MAX_NB_CHILDREN 11
169 
170 typedef enum {
238 } SectionID;
239 
240 struct section {
241  int id; ///< unique id identifying a section
242  const char *name;
243 
244 #define SECTION_FLAG_IS_WRAPPER 1 ///< the section only contains other sections, but has no data at its own level
245 #define SECTION_FLAG_IS_ARRAY 2 ///< the section contains an array of elements of the same type
246 #define SECTION_FLAG_HAS_VARIABLE_FIELDS 4 ///< the section may contain a variable number of fields with variable keys.
247  /// For these sections the element_name field is mandatory.
248 #define SECTION_FLAG_HAS_TYPE 8 ///< the section contains a type to distinguish multiple nested elements
249 
250  int flags;
251  const SectionID children_ids[SECTION_MAX_NB_CHILDREN+1]; ///< list of children section IDS, terminated by -1
252  const char *element_name; ///< name of the contained element, if provided
253  const char *unique_name; ///< unique section name, in case the name is ambiguous
255  const char *(* get_type)(const void *data); ///< function returning a type if defined, must be defined when SECTION_FLAG_HAS_TYPE is defined
257 };
258 
259 static const char *get_packet_side_data_type(const void *data)
260 {
261  const AVPacketSideData *sd = (const AVPacketSideData *)data;
262  return av_x_if_null(av_packet_side_data_name(sd->type), "unknown");
263 }
264 
265 static const char *get_frame_side_data_type(const void *data)
266 {
267  const AVFrameSideData *sd = (const AVFrameSideData *)data;
268  return av_x_if_null(av_frame_side_data_name(sd->type), "unknown");
269 }
270 
271 static const char *get_raw_string_type(const void *data)
272 {
273  return data;
274 }
275 
276 static const char *get_stream_group_type(const void *data)
277 {
278  const AVStreamGroup *stg = (const AVStreamGroup *)data;
279  return av_x_if_null(avformat_stream_group_name(stg->type), "unknown");
280 }
281 
282 static struct section sections[] = {
284  [SECTION_ID_CHAPTER] = { SECTION_ID_CHAPTER, "chapter", 0, { SECTION_ID_CHAPTER_TAGS, -1 } },
285  [SECTION_ID_CHAPTER_TAGS] = { SECTION_ID_CHAPTER_TAGS, "tags", SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "chapter_tags" },
286  [SECTION_ID_ERROR] = { SECTION_ID_ERROR, "error", 0, { -1 } },
287  [SECTION_ID_FORMAT] = { SECTION_ID_FORMAT, "format", 0, { SECTION_ID_FORMAT_TAGS, -1 } },
288  [SECTION_ID_FORMAT_TAGS] = { SECTION_ID_FORMAT_TAGS, "tags", SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "format_tags" },
291  [SECTION_ID_FRAME_TAGS] = { SECTION_ID_FRAME_TAGS, "tags", SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "frame_tags" },
292  [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" },
296  [SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST] = { SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST, "components", SECTION_FLAG_IS_ARRAY, { SECTION_ID_FRAME_SIDE_DATA_COMPONENT, -1 }, .element_name = "component", .unique_name = "frame_side_data_components" },
297  [SECTION_ID_FRAME_SIDE_DATA_COMPONENT] = { SECTION_ID_FRAME_SIDE_DATA_COMPONENT, "component", SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST, -1 }, .unique_name = "frame_side_data_component", .element_name = "component_entry", .get_type = get_raw_string_type },
298  [SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST] = { SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST, "pieces", SECTION_FLAG_IS_ARRAY, { SECTION_ID_FRAME_SIDE_DATA_PIECE, -1 }, .element_name = "piece", .unique_name = "frame_side_data_pieces" },
299  [SECTION_ID_FRAME_SIDE_DATA_PIECE] = { SECTION_ID_FRAME_SIDE_DATA_PIECE, "piece", SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { -1 }, .element_name = "piece_entry", .unique_name = "frame_side_data_piece", .get_type = get_raw_string_type },
301  [SECTION_ID_FRAME_LOG] = { SECTION_ID_FRAME_LOG, "log", 0, { -1 }, },
303  [SECTION_ID_LIBRARY_VERSION] = { SECTION_ID_LIBRARY_VERSION, "library_version", 0, { -1 } },
307  [SECTION_ID_PACKET_TAGS] = { SECTION_ID_PACKET_TAGS, "tags", SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "packet_tags" },
308  [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" },
309  [SECTION_ID_PACKET_SIDE_DATA] = { SECTION_ID_PACKET_SIDE_DATA, "side_data", SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { -1 }, .unique_name = "packet_side_data", .element_name = "side_datum", .get_type = get_packet_side_data_type },
312  [SECTION_ID_PIXEL_FORMAT_FLAGS] = { SECTION_ID_PIXEL_FORMAT_FLAGS, "flags", 0, { -1 }, .unique_name = "pixel_format_flags" },
313  [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" },
315  [SECTION_ID_PROGRAM_STREAM_DISPOSITION] = { SECTION_ID_PROGRAM_STREAM_DISPOSITION, "disposition", 0, { -1 }, .unique_name = "program_stream_disposition" },
316  [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" },
318  [SECTION_ID_PROGRAM_STREAMS] = { SECTION_ID_PROGRAM_STREAMS, "streams", SECTION_FLAG_IS_ARRAY, { SECTION_ID_PROGRAM_STREAM, -1 }, .unique_name = "program_streams" },
320  [SECTION_ID_PROGRAM_TAGS] = { SECTION_ID_PROGRAM_TAGS, "tags", SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "program_tags" },
321  [SECTION_ID_PROGRAM_VERSION] = { SECTION_ID_PROGRAM_VERSION, "program_version", 0, { -1 } },
323  [SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION] = { SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION, "disposition", 0, { -1 }, .unique_name = "stream_group_stream_disposition" },
324  [SECTION_ID_STREAM_GROUP_STREAM_TAGS] = { SECTION_ID_STREAM_GROUP_STREAM_TAGS, "tags", SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "stream_group_stream_tags" },
326  [SECTION_ID_STREAM_GROUP_COMPONENTS] = { SECTION_ID_STREAM_GROUP_COMPONENTS, "components", SECTION_FLAG_IS_ARRAY, { SECTION_ID_STREAM_GROUP_COMPONENT, -1 }, .element_name = "component", .unique_name = "stream_group_components" },
327  [SECTION_ID_STREAM_GROUP_COMPONENT] = { SECTION_ID_STREAM_GROUP_COMPONENT, "component", SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { SECTION_ID_STREAM_GROUP_SUBCOMPONENTS, -1 }, .unique_name = "stream_group_component", .element_name = "component_entry", .get_type = get_stream_group_type },
330  [SECTION_ID_STREAM_GROUP_PIECES] = { SECTION_ID_STREAM_GROUP_PIECES, "pieces", SECTION_FLAG_IS_ARRAY, { SECTION_ID_STREAM_GROUP_PIECE, -1 }, .element_name = "piece", .unique_name = "stream_group_pieces" },
331  [SECTION_ID_STREAM_GROUP_PIECE] = { SECTION_ID_STREAM_GROUP_PIECE, "piece", SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { SECTION_ID_STREAM_GROUP_SUBPIECES, -1 }, .unique_name = "stream_group_piece", .element_name = "piece_entry", .get_type = get_raw_string_type },
336  [SECTION_ID_STREAM_GROUP_STREAMS] = { SECTION_ID_STREAM_GROUP_STREAMS, "streams", SECTION_FLAG_IS_ARRAY, { SECTION_ID_STREAM_GROUP_STREAM, -1 }, .unique_name = "stream_group_streams" },
338  [SECTION_ID_STREAM_GROUP_DISPOSITION] = { SECTION_ID_STREAM_GROUP_DISPOSITION, "disposition", 0, { -1 }, .unique_name = "stream_group_disposition" },
339  [SECTION_ID_STREAM_GROUP_TAGS] = { SECTION_ID_STREAM_GROUP_TAGS, "tags", SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "stream_group_tags" },
347  [SECTION_ID_STREAM_DISPOSITION] = { SECTION_ID_STREAM_DISPOSITION, "disposition", 0, { -1 }, .unique_name = "stream_disposition" },
348  [SECTION_ID_STREAM_TAGS] = { SECTION_ID_STREAM_TAGS, "tags", SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "stream_tags" },
349  [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" },
350  [SECTION_ID_STREAM_SIDE_DATA] = { SECTION_ID_STREAM_SIDE_DATA, "side_data", SECTION_FLAG_HAS_TYPE|SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .unique_name = "stream_side_data", .element_name = "side_datum", .get_type = get_packet_side_data_type },
351  [SECTION_ID_SUBTITLE] = { SECTION_ID_SUBTITLE, "subtitle", 0, { -1 } },
352 };
353 
354 static const OptionDef *options;
355 
356 /* FFprobe context */
357 static const char *input_filename;
358 static const char *print_input_filename;
359 static const AVInputFormat *iformat = NULL;
360 static const char *output_filename = NULL;
361 
362 static struct AVHashContext *hash;
363 
364 static const struct {
365  double bin_val;
366  double dec_val;
367  const char *bin_str;
368  const char *dec_str;
369 } si_prefixes[] = {
370  { 1.0, 1.0, "", "" },
371  { 1.024e3, 1e3, "Ki", "K" },
372  { 1.048576e6, 1e6, "Mi", "M" },
373  { 1.073741824e9, 1e9, "Gi", "G" },
374  { 1.099511627776e12, 1e12, "Ti", "T" },
375  { 1.125899906842624e15, 1e15, "Pi", "P" },
376 };
377 
378 static const char unit_second_str[] = "s" ;
379 static const char unit_hertz_str[] = "Hz" ;
380 static const char unit_byte_str[] = "byte" ;
381 static const char unit_bit_per_second_str[] = "bit/s";
382 
383 static int nb_streams;
384 static uint64_t *nb_streams_packets;
385 static uint64_t *nb_streams_frames;
386 static int *selected_streams;
387 
388 #if HAVE_THREADS
389 pthread_mutex_t log_mutex;
390 #endif
391 typedef struct LogBuffer {
394  char *log_message;
396  char *parent_name;
398 }LogBuffer;
399 
401 static int log_buffer_size;
402 
403 static void log_callback(void *ptr, int level, const char *fmt, va_list vl)
404 {
405  AVClass* avc = ptr ? *(AVClass **) ptr : NULL;
406  va_list vl2;
407  char line[1024];
408  static int print_prefix = 1;
409  void *new_log_buffer;
410 
411  va_copy(vl2, vl);
412  av_log_default_callback(ptr, level, fmt, vl);
413  av_log_format_line(ptr, level, fmt, vl2, line, sizeof(line), &print_prefix);
414  va_end(vl2);
415 
416 #if HAVE_THREADS
417  pthread_mutex_lock(&log_mutex);
418 
419  new_log_buffer = av_realloc_array(log_buffer, log_buffer_size + 1, sizeof(*log_buffer));
420  if (new_log_buffer) {
421  char *msg;
422  int i;
423 
424  log_buffer = new_log_buffer;
425  memset(&log_buffer[log_buffer_size], 0, sizeof(log_buffer[log_buffer_size]));
427  if (avc) {
430  }
433  for (i=strlen(msg) - 1; i>=0 && msg[i] == '\n'; i--) {
434  msg[i] = 0;
435  }
436  if (avc && avc->parent_log_context_offset) {
437  AVClass** parent = *(AVClass ***) (((uint8_t *) ptr) +
439  if (parent && *parent) {
440  log_buffer[log_buffer_size].parent_name = av_strdup((*parent)->item_name(parent));
442  (*parent)->get_category ? (*parent)->get_category(parent) :(*parent)->category;
443  }
444  }
445  log_buffer_size ++;
446  }
447 
448  pthread_mutex_unlock(&log_mutex);
449 #endif
450 }
451 
452 struct unit_value {
453  union { double d; int64_t i; } val;
454  const char *unit;
455 };
456 
457 static char *value_string(char *buf, int buf_size, struct unit_value uv)
458 {
459  double vald;
460  int64_t vali;
461  int show_float = 0;
462 
463  if (uv.unit == unit_second_str) {
464  vald = uv.val.d;
465  show_float = 1;
466  } else {
467  vald = vali = uv.val.i;
468  }
469 
471  double secs;
472  int hours, mins;
473  secs = vald;
474  mins = (int)secs / 60;
475  secs = secs - mins * 60;
476  hours = mins / 60;
477  mins %= 60;
478  snprintf(buf, buf_size, "%d:%02d:%09.6f", hours, mins, secs);
479  } else {
480  const char *prefix_string = "";
481 
482  if (use_value_prefix && vald > 1) {
483  int64_t index;
484 
486  index = (int64_t) (log2(vald)) / 10;
488  vald /= si_prefixes[index].bin_val;
489  prefix_string = si_prefixes[index].bin_str;
490  } else {
491  index = (int64_t) (log10(vald)) / 3;
493  vald /= si_prefixes[index].dec_val;
494  prefix_string = si_prefixes[index].dec_str;
495  }
496  vali = vald;
497  }
498 
499  if (show_float || (use_value_prefix && vald != (int64_t)vald))
500  snprintf(buf, buf_size, "%f", vald);
501  else
502  snprintf(buf, buf_size, "%"PRId64, vali);
503  av_strlcatf(buf, buf_size, "%s%s%s", *prefix_string || show_value_unit ? " " : "",
504  prefix_string, show_value_unit ? uv.unit : "");
505  }
506 
507  return buf;
508 }
509 
510 /* WRITERS API */
511 
512 typedef struct WriterContext WriterContext;
513 
514 #define WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS 1
515 #define WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER 2
516 
517 typedef enum {
523 
524 typedef struct Writer {
525  const AVClass *priv_class; ///< private class of the writer, if any
526  int priv_size; ///< private size for the writer context
527  const char *name;
528 
529  int (*init) (WriterContext *wctx);
530  void (*uninit)(WriterContext *wctx);
531 
532  void (*print_section_header)(WriterContext *wctx, const void *data);
534  void (*print_integer) (WriterContext *wctx, const char *, int64_t);
535  void (*print_rational) (WriterContext *wctx, AVRational *q, char *sep);
536  void (*print_string) (WriterContext *wctx, const char *, const char *);
537  int flags; ///< a combination or WRITER_FLAG_*
538 } Writer;
539 
540 #define SECTION_MAX_NB_LEVELS 12
541 
543  const AVClass *class; ///< class of the writer
544  const Writer *writer; ///< the Writer of which this is an instance
545  AVIOContext *avio; ///< the I/O context used to write
546 
547  void (* writer_w8)(WriterContext *wctx, int b);
548  void (* writer_put_str)(WriterContext *wctx, const char *str);
549  void (* writer_printf)(WriterContext *wctx, const char *fmt, ...);
550 
551  char *name; ///< name of this writer instance
552  void *priv; ///< private data for use by the filter
553 
554  const struct section *sections; ///< array containing all sections
555  int nb_sections; ///< number of sections
556 
557  int level; ///< current level, starting from 0
558 
559  /** number of the item printed in the given section, starting from 0 */
561 
562  /** section per each level */
564  AVBPrint section_pbuf[SECTION_MAX_NB_LEVELS]; ///< generic print buffer dedicated to each section,
565  /// used by various writers
566 
567  unsigned int nb_section_packet; ///< number of the packet section in case we are in "packets_and_frames" section
568  unsigned int nb_section_frame; ///< number of the frame section in case we are in "packets_and_frames" section
569  unsigned int nb_section_packet_frame; ///< nb_section_packet or nb_section_frame according if is_packets_and_frames
570 
574 };
575 
576 static const char *writer_get_name(void *p)
577 {
578  WriterContext *wctx = p;
579  return wctx->writer->name;
580 }
581 
582 #define OFFSET(x) offsetof(WriterContext, x)
583 
584 static const AVOption writer_options[] = {
585  { "string_validation", "set string validation mode",
586  OFFSET(string_validation), AV_OPT_TYPE_INT, {.i64=WRITER_STRING_VALIDATION_REPLACE}, 0, WRITER_STRING_VALIDATION_NB-1, .unit = "sv" },
587  { "sv", "set string validation mode",
588  OFFSET(string_validation), AV_OPT_TYPE_INT, {.i64=WRITER_STRING_VALIDATION_REPLACE}, 0, WRITER_STRING_VALIDATION_NB-1, .unit = "sv" },
589  { "ignore", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = WRITER_STRING_VALIDATION_IGNORE}, .unit = "sv" },
590  { "replace", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = WRITER_STRING_VALIDATION_REPLACE}, .unit = "sv" },
591  { "fail", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = WRITER_STRING_VALIDATION_FAIL}, .unit = "sv" },
592  { "string_validation_replacement", "set string validation replacement string", OFFSET(string_validation_replacement), AV_OPT_TYPE_STRING, {.str=""}},
593  { "svr", "set string validation replacement string", OFFSET(string_validation_replacement), AV_OPT_TYPE_STRING, {.str="\xEF\xBF\xBD"}},
594  { NULL }
595 };
596 
597 static void *writer_child_next(void *obj, void *prev)
598 {
599  WriterContext *ctx = obj;
600  if (!prev && ctx->writer && ctx->writer->priv_class && ctx->priv)
601  return ctx->priv;
602  return NULL;
603 }
604 
605 static const AVClass writer_class = {
606  .class_name = "Writer",
607  .item_name = writer_get_name,
608  .option = writer_options,
609  .version = LIBAVUTIL_VERSION_INT,
610  .child_next = writer_child_next,
611 };
612 
613 static int writer_close(WriterContext **wctx)
614 {
615  int i;
616  int ret = 0;
617 
618  if (!*wctx)
619  return -1;
620 
621  if ((*wctx)->writer->uninit)
622  (*wctx)->writer->uninit(*wctx);
623  for (i = 0; i < SECTION_MAX_NB_LEVELS; i++)
624  av_bprint_finalize(&(*wctx)->section_pbuf[i], NULL);
625  if ((*wctx)->writer->priv_class)
626  av_opt_free((*wctx)->priv);
627  av_freep(&((*wctx)->priv));
628  av_opt_free(*wctx);
629  if ((*wctx)->avio) {
630  avio_flush((*wctx)->avio);
631  ret = avio_close((*wctx)->avio);
632  }
633  av_freep(wctx);
634  return ret;
635 }
636 
637 static void bprint_bytes(AVBPrint *bp, const uint8_t *ubuf, size_t ubuf_size)
638 {
639  int i;
640  av_bprintf(bp, "0X");
641  for (i = 0; i < ubuf_size; i++)
642  av_bprintf(bp, "%02X", ubuf[i]);
643 }
644 
645 static inline void writer_w8_avio(WriterContext *wctx, int b)
646 {
647  avio_w8(wctx->avio, b);
648 }
649 
650 static inline void writer_put_str_avio(WriterContext *wctx, const char *str)
651 {
652  avio_write(wctx->avio, str, strlen(str));
653 }
654 
655 static inline void writer_printf_avio(WriterContext *wctx, const char *fmt, ...)
656 {
657  va_list ap;
658 
659  va_start(ap, fmt);
660  avio_vprintf(wctx->avio, fmt, ap);
661  va_end(ap);
662 }
663 
664 static inline void writer_w8_printf(WriterContext *wctx, int b)
665 {
666  printf("%c", b);
667 }
668 
669 static inline void writer_put_str_printf(WriterContext *wctx, const char *str)
670 {
671  printf("%s", str);
672 }
673 
674 static inline void writer_printf_printf(WriterContext *wctx, const char *fmt, ...)
675 {
676  va_list ap;
677 
678  va_start(ap, fmt);
679  vprintf(fmt, ap);
680  va_end(ap);
681 }
682 
683 static int writer_open(WriterContext **wctx, const Writer *writer, const char *args,
684  const struct section *sections, int nb_sections, const char *output)
685 {
686  int i, ret = 0;
687 
688  if (!(*wctx = av_mallocz(sizeof(WriterContext)))) {
689  ret = AVERROR(ENOMEM);
690  goto fail;
691  }
692 
693  if (!((*wctx)->priv = av_mallocz(writer->priv_size))) {
694  ret = AVERROR(ENOMEM);
695  goto fail;
696  }
697 
698  (*wctx)->class = &writer_class;
699  (*wctx)->writer = writer;
700  (*wctx)->level = -1;
701  (*wctx)->sections = sections;
702  (*wctx)->nb_sections = nb_sections;
703 
704  av_opt_set_defaults(*wctx);
705 
706  if (writer->priv_class) {
707  void *priv_ctx = (*wctx)->priv;
708  *((const AVClass **)priv_ctx) = writer->priv_class;
709  av_opt_set_defaults(priv_ctx);
710  }
711 
712  /* convert options to dictionary */
713  if (args) {
715  const AVDictionaryEntry *opt = NULL;
716 
717  if ((ret = av_dict_parse_string(&opts, args, "=", ":", 0)) < 0) {
718  av_log(*wctx, AV_LOG_ERROR, "Failed to parse option string '%s' provided to writer context\n", args);
719  av_dict_free(&opts);
720  goto fail;
721  }
722 
723  while ((opt = av_dict_iterate(opts, opt))) {
724  if ((ret = av_opt_set(*wctx, opt->key, opt->value, AV_OPT_SEARCH_CHILDREN)) < 0) {
725  av_log(*wctx, AV_LOG_ERROR, "Failed to set option '%s' with value '%s' provided to writer context\n",
726  opt->key, opt->value);
727  av_dict_free(&opts);
728  goto fail;
729  }
730  }
731 
732  av_dict_free(&opts);
733  }
734 
735  /* validate replace string */
736  {
737  const uint8_t *p = (*wctx)->string_validation_replacement;
738  const uint8_t *endp = p + strlen(p);
739  while (*p) {
740  const uint8_t *p0 = p;
741  int32_t code;
742  ret = av_utf8_decode(&code, &p, endp, (*wctx)->string_validation_utf8_flags);
743  if (ret < 0) {
744  AVBPrint bp;
746  bprint_bytes(&bp, p0, p-p0),
747  av_log(wctx, AV_LOG_ERROR,
748  "Invalid UTF8 sequence %s found in string validation replace '%s'\n",
749  bp.str, (*wctx)->string_validation_replacement);
750  return ret;
751  }
752  }
753  }
754 
755  if (!output_filename) {
756  (*wctx)->writer_w8 = writer_w8_printf;
757  (*wctx)->writer_put_str = writer_put_str_printf;
758  (*wctx)->writer_printf = writer_printf_printf;
759  } else {
760  if ((ret = avio_open(&(*wctx)->avio, output, AVIO_FLAG_WRITE)) < 0) {
761  av_log(*wctx, AV_LOG_ERROR,
762  "Failed to open output '%s' with error: %s\n", output, av_err2str(ret));
763  goto fail;
764  }
765  (*wctx)->writer_w8 = writer_w8_avio;
766  (*wctx)->writer_put_str = writer_put_str_avio;
767  (*wctx)->writer_printf = writer_printf_avio;
768  }
769 
770  for (i = 0; i < SECTION_MAX_NB_LEVELS; i++)
771  av_bprint_init(&(*wctx)->section_pbuf[i], 1, AV_BPRINT_SIZE_UNLIMITED);
772 
773  if ((*wctx)->writer->init)
774  ret = (*wctx)->writer->init(*wctx);
775  if (ret < 0)
776  goto fail;
777 
778  return 0;
779 
780 fail:
781  writer_close(wctx);
782  return ret;
783 }
784 
786  const void *data,
787  int section_id)
788 {
789  int parent_section_id;
790  wctx->level++;
792  parent_section_id = wctx->level ?
793  (wctx->section[wctx->level-1])->id : SECTION_ID_NONE;
794 
795  wctx->nb_item[wctx->level] = 0;
796  wctx->section[wctx->level] = &wctx->sections[section_id];
797 
798  if (section_id == SECTION_ID_PACKETS_AND_FRAMES) {
799  wctx->nb_section_packet = wctx->nb_section_frame =
800  wctx->nb_section_packet_frame = 0;
801  } else if (parent_section_id == SECTION_ID_PACKETS_AND_FRAMES) {
802  wctx->nb_section_packet_frame = section_id == SECTION_ID_PACKET ?
803  wctx->nb_section_packet : wctx->nb_section_frame;
804  }
805 
806  if (wctx->writer->print_section_header)
807  wctx->writer->print_section_header(wctx, data);
808 }
809 
811 {
812  int section_id = wctx->section[wctx->level]->id;
813  int parent_section_id = wctx->level ?
814  wctx->section[wctx->level-1]->id : SECTION_ID_NONE;
815 
816  if (parent_section_id != SECTION_ID_NONE)
817  wctx->nb_item[wctx->level-1]++;
818  if (parent_section_id == SECTION_ID_PACKETS_AND_FRAMES) {
819  if (section_id == SECTION_ID_PACKET) wctx->nb_section_packet++;
820  else wctx->nb_section_frame++;
821  }
822  if (wctx->writer->print_section_footer)
823  wctx->writer->print_section_footer(wctx);
824  wctx->level--;
825 }
826 
827 static inline void writer_print_integer(WriterContext *wctx,
828  const char *key, int64_t val)
829 {
830  const struct section *section = wctx->section[wctx->level];
831 
833  wctx->writer->print_integer(wctx, key, val);
834  wctx->nb_item[wctx->level]++;
835  }
836 }
837 
838 static inline int validate_string(WriterContext *wctx, char **dstp, const char *src)
839 {
840  const uint8_t *p, *endp;
841  AVBPrint dstbuf;
842  int invalid_chars_nb = 0, ret = 0;
843 
845 
846  endp = src + strlen(src);
847  for (p = src; *p;) {
848  uint32_t code;
849  int invalid = 0;
850  const uint8_t *p0 = p;
851 
852  if (av_utf8_decode(&code, &p, endp, wctx->string_validation_utf8_flags) < 0) {
853  AVBPrint bp;
855  bprint_bytes(&bp, p0, p-p0);
856  av_log(wctx, AV_LOG_DEBUG,
857  "Invalid UTF-8 sequence %s found in string '%s'\n", bp.str, src);
858  invalid = 1;
859  }
860 
861  if (invalid) {
862  invalid_chars_nb++;
863 
864  switch (wctx->string_validation) {
866  av_log(wctx, AV_LOG_ERROR,
867  "Invalid UTF-8 sequence found in string '%s'\n", src);
869  goto end;
870  break;
871 
873  av_bprintf(&dstbuf, "%s", wctx->string_validation_replacement);
874  break;
875  }
876  }
877 
878  if (!invalid || wctx->string_validation == WRITER_STRING_VALIDATION_IGNORE)
879  av_bprint_append_data(&dstbuf, p0, p-p0);
880  }
881 
882  if (invalid_chars_nb && wctx->string_validation == WRITER_STRING_VALIDATION_REPLACE) {
883  av_log(wctx, AV_LOG_WARNING,
884  "%d invalid UTF-8 sequence(s) found in string '%s', replaced with '%s'\n",
885  invalid_chars_nb, src, wctx->string_validation_replacement);
886  }
887 
888 end:
889  av_bprint_finalize(&dstbuf, dstp);
890  return ret;
891 }
892 
893 #define PRINT_STRING_OPT 1
894 #define PRINT_STRING_VALIDATE 2
895 
896 static inline int writer_print_string(WriterContext *wctx,
897  const char *key, const char *val, int flags)
898 {
899  const struct section *section = wctx->section[wctx->level];
900  int ret = 0;
901 
904  && (flags & PRINT_STRING_OPT)
906  return 0;
907 
910  char *key1 = NULL, *val1 = NULL;
911  ret = validate_string(wctx, &key1, key);
912  if (ret < 0) goto end;
913  ret = validate_string(wctx, &val1, val);
914  if (ret < 0) goto end;
915  wctx->writer->print_string(wctx, key1, val1);
916  end:
917  if (ret < 0) {
918  av_log(wctx, AV_LOG_ERROR,
919  "Invalid key=value string combination %s=%s in section %s\n",
921  }
922  av_free(key1);
923  av_free(val1);
924  } else {
925  wctx->writer->print_string(wctx, key, val);
926  }
927 
928  wctx->nb_item[wctx->level]++;
929  }
930 
931  return ret;
932 }
933 
934 static inline void writer_print_rational(WriterContext *wctx,
935  const char *key, AVRational q, char sep)
936 {
937  AVBPrint buf;
939  av_bprintf(&buf, "%d%c%d", q.num, sep, q.den);
940  writer_print_string(wctx, key, buf.str, 0);
941 }
942 
943 static void writer_print_time(WriterContext *wctx, const char *key,
944  int64_t ts, const AVRational *time_base, int is_duration)
945 {
946  char buf[128];
947 
948  if ((!is_duration && ts == AV_NOPTS_VALUE) || (is_duration && ts == 0)) {
950  } else {
951  double d = ts * av_q2d(*time_base);
952  struct unit_value uv;
953  uv.val.d = d;
954  uv.unit = unit_second_str;
955  value_string(buf, sizeof(buf), uv);
956  writer_print_string(wctx, key, buf, 0);
957  }
958 }
959 
960 static void writer_print_ts(WriterContext *wctx, const char *key, int64_t ts, int is_duration)
961 {
962  if ((!is_duration && ts == AV_NOPTS_VALUE) || (is_duration && ts == 0)) {
964  } else {
965  writer_print_integer(wctx, key, ts);
966  }
967 }
968 
969 static void writer_print_data(WriterContext *wctx, const char *name,
970  const uint8_t *data, int size)
971 {
972  AVBPrint bp;
973  int offset = 0, l, i;
974 
976  av_bprintf(&bp, "\n");
977  while (size) {
978  av_bprintf(&bp, "%08x: ", offset);
979  l = FFMIN(size, 16);
980  for (i = 0; i < l; i++) {
981  av_bprintf(&bp, "%02x", data[i]);
982  if (i & 1)
983  av_bprintf(&bp, " ");
984  }
985  av_bprint_chars(&bp, ' ', 41 - 2 * i - i / 2);
986  for (i = 0; i < l; i++)
987  av_bprint_chars(&bp, data[i] - 32U < 95 ? data[i] : '.', 1);
988  av_bprintf(&bp, "\n");
989  offset += l;
990  data += l;
991  size -= l;
992  }
993  writer_print_string(wctx, name, bp.str, 0);
994  av_bprint_finalize(&bp, NULL);
995 }
996 
997 static void writer_print_data_hash(WriterContext *wctx, const char *name,
998  const uint8_t *data, int size)
999 {
1000  char *p, buf[AV_HASH_MAX_SIZE * 2 + 64] = { 0 };
1001 
1002  if (!hash)
1003  return;
1004  av_hash_init(hash);
1006  snprintf(buf, sizeof(buf), "%s:", av_hash_get_name(hash));
1007  p = buf + strlen(buf);
1008  av_hash_final_hex(hash, p, buf + sizeof(buf) - p);
1009  writer_print_string(wctx, name, buf, 0);
1010 }
1011 
1012 static void writer_print_integers(WriterContext *wctx, const char *name,
1013  uint8_t *data, int size, const char *format,
1014  int columns, int bytes, int offset_add)
1015 {
1016  AVBPrint bp;
1017  int offset = 0, l, i;
1018 
1020  av_bprintf(&bp, "\n");
1021  while (size) {
1022  av_bprintf(&bp, "%08x: ", offset);
1023  l = FFMIN(size, columns);
1024  for (i = 0; i < l; i++) {
1025  if (bytes == 1) av_bprintf(&bp, format, *data);
1026  else if (bytes == 2) av_bprintf(&bp, format, AV_RN16(data));
1027  else if (bytes == 4) av_bprintf(&bp, format, AV_RN32(data));
1028  data += bytes;
1029  size --;
1030  }
1031  av_bprintf(&bp, "\n");
1032  offset += offset_add;
1033  }
1034  writer_print_string(wctx, name, bp.str, 0);
1035  av_bprint_finalize(&bp, NULL);
1036 }
1037 
1038 #define writer_w8(wctx_, b_) (wctx_)->writer_w8(wctx_, b_)
1039 #define writer_put_str(wctx_, str_) (wctx_)->writer_put_str(wctx_, str_)
1040 #define writer_printf(wctx_, fmt_, ...) (wctx_)->writer_printf(wctx_, fmt_, __VA_ARGS__)
1041 
1042 #define MAX_REGISTERED_WRITERS_NB 64
1043 
1045 
1046 static int writer_register(const Writer *writer)
1047 {
1048  static int next_registered_writer_idx = 0;
1049 
1050  if (next_registered_writer_idx == MAX_REGISTERED_WRITERS_NB)
1051  return AVERROR(ENOMEM);
1052 
1053  registered_writers[next_registered_writer_idx++] = writer;
1054  return 0;
1055 }
1056 
1057 static const Writer *writer_get_by_name(const char *name)
1058 {
1059  int i;
1060 
1061  for (i = 0; registered_writers[i]; i++)
1062  if (!strcmp(registered_writers[i]->name, name))
1063  return registered_writers[i];
1064 
1065  return NULL;
1066 }
1067 
1068 
1069 /* WRITERS */
1070 
1071 #define DEFINE_WRITER_CLASS(name) \
1072 static const char *name##_get_name(void *ctx) \
1073 { \
1074  return #name ; \
1075 } \
1076 static const AVClass name##_class = { \
1077  .class_name = #name, \
1078  .item_name = name##_get_name, \
1079  .option = name##_options \
1080 }
1081 
1082 /* Default output */
1083 
1084 typedef struct DefaultContext {
1085  const AVClass *class;
1086  int nokey;
1089 } DefaultContext;
1090 
1091 #undef OFFSET
1092 #define OFFSET(x) offsetof(DefaultContext, x)
1093 
1094 static const AVOption default_options[] = {
1095  { "noprint_wrappers", "do not print headers and footers", OFFSET(noprint_wrappers), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1096  { "nw", "do not print headers and footers", OFFSET(noprint_wrappers), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1097  { "nokey", "force no key printing", OFFSET(nokey), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1098  { "nk", "force no key printing", OFFSET(nokey), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1099  {NULL},
1100 };
1101 
1102 DEFINE_WRITER_CLASS(default);
1103 
1104 /* lame uppercasing routine, assumes the string is lower case ASCII */
1105 static inline char *upcase_string(char *dst, size_t dst_size, const char *src)
1106 {
1107  int i;
1108  for (i = 0; src[i] && i < dst_size-1; i++)
1109  dst[i] = av_toupper(src[i]);
1110  dst[i] = 0;
1111  return dst;
1112 }
1113 
1114 static void default_print_section_header(WriterContext *wctx, const void *data)
1115 {
1116  DefaultContext *def = wctx->priv;
1117  char buf[32];
1118  const struct section *section = wctx->section[wctx->level];
1119  const struct section *parent_section = wctx->level ?
1120  wctx->section[wctx->level-1] : NULL;
1121 
1122  av_bprint_clear(&wctx->section_pbuf[wctx->level]);
1123  if (parent_section &&
1124  !(parent_section->flags & (SECTION_FLAG_IS_WRAPPER|SECTION_FLAG_IS_ARRAY))) {
1125  def->nested_section[wctx->level] = 1;
1126  av_bprintf(&wctx->section_pbuf[wctx->level], "%s%s:",
1127  wctx->section_pbuf[wctx->level-1].str,
1128  upcase_string(buf, sizeof(buf),
1130  }
1131 
1132  if (def->noprint_wrappers || def->nested_section[wctx->level])
1133  return;
1134 
1136  writer_printf(wctx, "[%s]\n", upcase_string(buf, sizeof(buf), section->name));
1137 }
1138 
1140 {
1141  DefaultContext *def = wctx->priv;
1142  const struct section *section = wctx->section[wctx->level];
1143  char buf[32];
1144 
1145  if (def->noprint_wrappers || def->nested_section[wctx->level])
1146  return;
1147 
1149  writer_printf(wctx, "[/%s]\n", upcase_string(buf, sizeof(buf), section->name));
1150 }
1151 
1152 static void default_print_str(WriterContext *wctx, const char *key, const char *value)
1153 {
1154  DefaultContext *def = wctx->priv;
1155 
1156  if (!def->nokey)
1157  writer_printf(wctx, "%s%s=", wctx->section_pbuf[wctx->level].str, key);
1158  writer_printf(wctx, "%s\n", value);
1159 }
1160 
1161 static void default_print_int(WriterContext *wctx, const char *key, int64_t value)
1162 {
1163  DefaultContext *def = wctx->priv;
1164 
1165  if (!def->nokey)
1166  writer_printf(wctx, "%s%s=", wctx->section_pbuf[wctx->level].str, key);
1167  writer_printf(wctx, "%"PRId64"\n", value);
1168 }
1169 
1170 static const Writer default_writer = {
1171  .name = "default",
1172  .priv_size = sizeof(DefaultContext),
1175  .print_integer = default_print_int,
1176  .print_string = default_print_str,
1178  .priv_class = &default_class,
1179 };
1180 
1181 /* Compact output */
1182 
1183 /**
1184  * Apply C-language-like string escaping.
1185  */
1186 static const char *c_escape_str(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
1187 {
1188  const char *p;
1189 
1190  for (p = src; *p; p++) {
1191  switch (*p) {
1192  case '\b': av_bprintf(dst, "%s", "\\b"); break;
1193  case '\f': av_bprintf(dst, "%s", "\\f"); break;
1194  case '\n': av_bprintf(dst, "%s", "\\n"); break;
1195  case '\r': av_bprintf(dst, "%s", "\\r"); break;
1196  case '\\': av_bprintf(dst, "%s", "\\\\"); break;
1197  default:
1198  if (*p == sep)
1199  av_bprint_chars(dst, '\\', 1);
1200  av_bprint_chars(dst, *p, 1);
1201  }
1202  }
1203  return dst->str;
1204 }
1205 
1206 /**
1207  * Quote fields containing special characters, check RFC4180.
1208  */
1209 static const char *csv_escape_str(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
1210 {
1211  char meta_chars[] = { sep, '"', '\n', '\r', '\0' };
1212  int needs_quoting = !!src[strcspn(src, meta_chars)];
1213 
1214  if (needs_quoting)
1215  av_bprint_chars(dst, '"', 1);
1216 
1217  for (; *src; src++) {
1218  if (*src == '"')
1219  av_bprint_chars(dst, '"', 1);
1220  av_bprint_chars(dst, *src, 1);
1221  }
1222  if (needs_quoting)
1223  av_bprint_chars(dst, '"', 1);
1224  return dst->str;
1225 }
1226 
1227 static const char *none_escape_str(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
1228 {
1229  return src;
1230 }
1231 
1232 typedef struct CompactContext {
1233  const AVClass *class;
1235  char item_sep;
1236  int nokey;
1239  const char * (*escape_str)(AVBPrint *dst, const char *src, const char sep, void *log_ctx);
1243 } CompactContext;
1244 
1245 #undef OFFSET
1246 #define OFFSET(x) offsetof(CompactContext, x)
1247 
1248 static const AVOption compact_options[]= {
1249  {"item_sep", "set item separator", OFFSET(item_sep_str), AV_OPT_TYPE_STRING, {.str="|"}, 0, 0 },
1250  {"s", "set item separator", OFFSET(item_sep_str), AV_OPT_TYPE_STRING, {.str="|"}, 0, 0 },
1251  {"nokey", "force no key printing", OFFSET(nokey), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1252  {"nk", "force no key printing", OFFSET(nokey), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1253  {"escape", "set escape mode", OFFSET(escape_mode_str), AV_OPT_TYPE_STRING, {.str="c"}, 0, 0 },
1254  {"e", "set escape mode", OFFSET(escape_mode_str), AV_OPT_TYPE_STRING, {.str="c"}, 0, 0 },
1255  {"print_section", "print section name", OFFSET(print_section), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1256  {"p", "print section name", OFFSET(print_section), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1257  {NULL},
1258 };
1259 
1260 DEFINE_WRITER_CLASS(compact);
1261 
1263 {
1264  CompactContext *compact = wctx->priv;
1265 
1266  if (strlen(compact->item_sep_str) != 1) {
1267  av_log(wctx, AV_LOG_ERROR, "Item separator '%s' specified, but must contain a single character\n",
1268  compact->item_sep_str);
1269  return AVERROR(EINVAL);
1270  }
1271  compact->item_sep = compact->item_sep_str[0];
1272 
1273  if (!strcmp(compact->escape_mode_str, "none")) compact->escape_str = none_escape_str;
1274  else if (!strcmp(compact->escape_mode_str, "c" )) compact->escape_str = c_escape_str;
1275  else if (!strcmp(compact->escape_mode_str, "csv" )) compact->escape_str = csv_escape_str;
1276  else {
1277  av_log(wctx, AV_LOG_ERROR, "Unknown escape mode '%s'\n", compact->escape_mode_str);
1278  return AVERROR(EINVAL);
1279  }
1280 
1281  return 0;
1282 }
1283 
1284 static void compact_print_section_header(WriterContext *wctx, const void *data)
1285 {
1286  CompactContext *compact = wctx->priv;
1287  const struct section *section = wctx->section[wctx->level];
1288  const struct section *parent_section = wctx->level ?
1289  wctx->section[wctx->level-1] : NULL;
1290  compact->terminate_line[wctx->level] = 1;
1291  compact->has_nested_elems[wctx->level] = 0;
1292 
1293  av_bprint_clear(&wctx->section_pbuf[wctx->level]);
1294  if (parent_section &&
1297  !(parent_section->flags & (SECTION_FLAG_IS_WRAPPER|SECTION_FLAG_IS_ARRAY))))) {
1298 
1299  /* define a prefix for elements not contained in an array or
1300  in a wrapper, or for array elements with a type */
1301  const char *element_name = (char *)av_x_if_null(section->element_name, section->name);
1302  AVBPrint *section_pbuf = &wctx->section_pbuf[wctx->level];
1303 
1304  compact->nested_section[wctx->level] = 1;
1305  compact->has_nested_elems[wctx->level-1] = 1;
1306 
1307  av_bprintf(section_pbuf, "%s%s",
1308  wctx->section_pbuf[wctx->level-1].str, element_name);
1309 
1311  // add /TYPE to prefix
1312  av_bprint_chars(section_pbuf, '/', 1);
1313 
1314  // normalize section type, replace special characters and lower case
1315  for (const char *p = section->get_type(data); *p; p++) {
1316  char c =
1317  (*p >= '0' && *p <= '9') ||
1318  (*p >= 'a' && *p <= 'z') ||
1319  (*p >= 'A' && *p <= 'Z') ? av_tolower(*p) : '_';
1320  av_bprint_chars(section_pbuf, c, 1);
1321  }
1322  }
1323  av_bprint_chars(section_pbuf, ':', 1);
1324 
1325  wctx->nb_item[wctx->level] = wctx->nb_item[wctx->level-1];
1326  } else {
1327  if (parent_section && !(parent_section->flags & (SECTION_FLAG_IS_WRAPPER|SECTION_FLAG_IS_ARRAY)) &&
1328  wctx->level && wctx->nb_item[wctx->level-1])
1329  writer_w8(wctx, compact->item_sep);
1330  if (compact->print_section &&
1332  writer_printf(wctx, "%s%c", section->name, compact->item_sep);
1333  }
1334 }
1335 
1337 {
1338  CompactContext *compact = wctx->priv;
1339 
1340  if (!compact->nested_section[wctx->level] &&
1341  compact->terminate_line[wctx->level] &&
1343  writer_w8(wctx, '\n');
1344 }
1345 
1346 static void compact_print_str(WriterContext *wctx, const char *key, const char *value)
1347 {
1348  CompactContext *compact = wctx->priv;
1349  AVBPrint buf;
1350 
1351  if (wctx->nb_item[wctx->level]) writer_w8(wctx, compact->item_sep);
1352  if (!compact->nokey)
1353  writer_printf(wctx, "%s%s=", wctx->section_pbuf[wctx->level].str, key);
1355  writer_put_str(wctx, compact->escape_str(&buf, value, compact->item_sep, wctx));
1356  av_bprint_finalize(&buf, NULL);
1357 }
1358 
1359 static void compact_print_int(WriterContext *wctx, const char *key, int64_t value)
1360 {
1361  CompactContext *compact = wctx->priv;
1362 
1363  if (wctx->nb_item[wctx->level]) writer_w8(wctx, compact->item_sep);
1364  if (!compact->nokey)
1365  writer_printf(wctx, "%s%s=", wctx->section_pbuf[wctx->level].str, key);
1366  writer_printf(wctx, "%"PRId64, value);
1367 }
1368 
1369 static const Writer compact_writer = {
1370  .name = "compact",
1371  .priv_size = sizeof(CompactContext),
1372  .init = compact_init,
1375  .print_integer = compact_print_int,
1376  .print_string = compact_print_str,
1378  .priv_class = &compact_class,
1379 };
1380 
1381 /* CSV output */
1382 
1383 #undef OFFSET
1384 #define OFFSET(x) offsetof(CompactContext, x)
1385 
1386 static const AVOption csv_options[] = {
1387  {"item_sep", "set item separator", OFFSET(item_sep_str), AV_OPT_TYPE_STRING, {.str=","}, 0, 0 },
1388  {"s", "set item separator", OFFSET(item_sep_str), AV_OPT_TYPE_STRING, {.str=","}, 0, 0 },
1389  {"nokey", "force no key printing", OFFSET(nokey), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1390  {"nk", "force no key printing", OFFSET(nokey), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1391  {"escape", "set escape mode", OFFSET(escape_mode_str), AV_OPT_TYPE_STRING, {.str="csv"}, 0, 0 },
1392  {"e", "set escape mode", OFFSET(escape_mode_str), AV_OPT_TYPE_STRING, {.str="csv"}, 0, 0 },
1393  {"print_section", "print section name", OFFSET(print_section), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1394  {"p", "print section name", OFFSET(print_section), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1395  {NULL},
1396 };
1397 
1398 DEFINE_WRITER_CLASS(csv);
1399 
1400 static const Writer csv_writer = {
1401  .name = "csv",
1402  .priv_size = sizeof(CompactContext),
1403  .init = compact_init,
1406  .print_integer = compact_print_int,
1407  .print_string = compact_print_str,
1409  .priv_class = &csv_class,
1410 };
1411 
1412 /* Flat output */
1413 
1414 typedef struct FlatContext {
1415  const AVClass *class;
1416  const char *sep_str;
1417  char sep;
1419 } FlatContext;
1420 
1421 #undef OFFSET
1422 #define OFFSET(x) offsetof(FlatContext, x)
1423 
1424 static const AVOption flat_options[]= {
1425  {"sep_char", "set separator", OFFSET(sep_str), AV_OPT_TYPE_STRING, {.str="."}, 0, 0 },
1426  {"s", "set separator", OFFSET(sep_str), AV_OPT_TYPE_STRING, {.str="."}, 0, 0 },
1427  {"hierarchical", "specify if the section specification should be hierarchical", OFFSET(hierarchical), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1428  {"h", "specify if the section specification should be hierarchical", OFFSET(hierarchical), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1429  {NULL},
1430 };
1431 
1433 
1435 {
1436  FlatContext *flat = wctx->priv;
1437 
1438  if (strlen(flat->sep_str) != 1) {
1439  av_log(wctx, AV_LOG_ERROR, "Item separator '%s' specified, but must contain a single character\n",
1440  flat->sep_str);
1441  return AVERROR(EINVAL);
1442  }
1443  flat->sep = flat->sep_str[0];
1444 
1445  return 0;
1446 }
1447 
1448 static const char *flat_escape_key_str(AVBPrint *dst, const char *src, const char sep)
1449 {
1450  const char *p;
1451 
1452  for (p = src; *p; p++) {
1453  if (!((*p >= '0' && *p <= '9') ||
1454  (*p >= 'a' && *p <= 'z') ||
1455  (*p >= 'A' && *p <= 'Z')))
1456  av_bprint_chars(dst, '_', 1);
1457  else
1458  av_bprint_chars(dst, *p, 1);
1459  }
1460  return dst->str;
1461 }
1462 
1463 static const char *flat_escape_value_str(AVBPrint *dst, const char *src)
1464 {
1465  const char *p;
1466 
1467  for (p = src; *p; p++) {
1468  switch (*p) {
1469  case '\n': av_bprintf(dst, "%s", "\\n"); break;
1470  case '\r': av_bprintf(dst, "%s", "\\r"); break;
1471  case '\\': av_bprintf(dst, "%s", "\\\\"); break;
1472  case '"': av_bprintf(dst, "%s", "\\\""); break;
1473  case '`': av_bprintf(dst, "%s", "\\`"); break;
1474  case '$': av_bprintf(dst, "%s", "\\$"); break;
1475  default: av_bprint_chars(dst, *p, 1); break;
1476  }
1477  }
1478  return dst->str;
1479 }
1480 
1481 static void flat_print_section_header(WriterContext *wctx, const void *data)
1482 {
1483  FlatContext *flat = wctx->priv;
1484  AVBPrint *buf = &wctx->section_pbuf[wctx->level];
1485  const struct section *section = wctx->section[wctx->level];
1486  const struct section *parent_section = wctx->level ?
1487  wctx->section[wctx->level-1] : NULL;
1488 
1489  /* build section header */
1490  av_bprint_clear(buf);
1491  if (!parent_section)
1492  return;
1493  av_bprintf(buf, "%s", wctx->section_pbuf[wctx->level-1].str);
1494 
1495  if (flat->hierarchical ||
1497  av_bprintf(buf, "%s%s", wctx->section[wctx->level]->name, flat->sep_str);
1498 
1499  if (parent_section->flags & SECTION_FLAG_IS_ARRAY) {
1500  int n = parent_section->id == SECTION_ID_PACKETS_AND_FRAMES ?
1501  wctx->nb_section_packet_frame : wctx->nb_item[wctx->level-1];
1502  av_bprintf(buf, "%d%s", n, flat->sep_str);
1503  }
1504  }
1505 }
1506 
1507 static void flat_print_int(WriterContext *wctx, const char *key, int64_t value)
1508 {
1509  writer_printf(wctx, "%s%s=%"PRId64"\n", wctx->section_pbuf[wctx->level].str, key, value);
1510 }
1511 
1512 static void flat_print_str(WriterContext *wctx, const char *key, const char *value)
1513 {
1514  FlatContext *flat = wctx->priv;
1515  AVBPrint buf;
1516 
1517  writer_put_str(wctx, wctx->section_pbuf[wctx->level].str);
1519  writer_printf(wctx, "%s=", flat_escape_key_str(&buf, key, flat->sep));
1520  av_bprint_clear(&buf);
1521  writer_printf(wctx, "\"%s\"\n", flat_escape_value_str(&buf, value));
1522  av_bprint_finalize(&buf, NULL);
1523 }
1524 
1525 static const Writer flat_writer = {
1526  .name = "flat",
1527  .priv_size = sizeof(FlatContext),
1528  .init = flat_init,
1530  .print_integer = flat_print_int,
1531  .print_string = flat_print_str,
1533  .priv_class = &flat_class,
1534 };
1535 
1536 /* INI format output */
1537 
1538 typedef struct INIContext {
1539  const AVClass *class;
1541 } INIContext;
1542 
1543 #undef OFFSET
1544 #define OFFSET(x) offsetof(INIContext, x)
1545 
1546 static const AVOption ini_options[] = {
1547  {"hierarchical", "specify if the section specification should be hierarchical", OFFSET(hierarchical), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1548  {"h", "specify if the section specification should be hierarchical", OFFSET(hierarchical), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
1549  {NULL},
1550 };
1551 
1552 DEFINE_WRITER_CLASS(ini);
1553 
1554 static char *ini_escape_str(AVBPrint *dst, const char *src)
1555 {
1556  int i = 0;
1557  char c = 0;
1558 
1559  while (c = src[i++]) {
1560  switch (c) {
1561  case '\b': av_bprintf(dst, "%s", "\\b"); break;
1562  case '\f': av_bprintf(dst, "%s", "\\f"); break;
1563  case '\n': av_bprintf(dst, "%s", "\\n"); break;
1564  case '\r': av_bprintf(dst, "%s", "\\r"); break;
1565  case '\t': av_bprintf(dst, "%s", "\\t"); break;
1566  case '\\':
1567  case '#' :
1568  case '=' :
1569  case ':' : av_bprint_chars(dst, '\\', 1);
1570  default:
1571  if ((unsigned char)c < 32)
1572  av_bprintf(dst, "\\x00%02x", c & 0xff);
1573  else
1574  av_bprint_chars(dst, c, 1);
1575  break;
1576  }
1577  }
1578  return dst->str;
1579 }
1580 
1581 static void ini_print_section_header(WriterContext *wctx, const void *data)
1582 {
1583  INIContext *ini = wctx->priv;
1584  AVBPrint *buf = &wctx->section_pbuf[wctx->level];
1585  const struct section *section = wctx->section[wctx->level];
1586  const struct section *parent_section = wctx->level ?
1587  wctx->section[wctx->level-1] : NULL;
1588 
1589  av_bprint_clear(buf);
1590  if (!parent_section) {
1591  writer_put_str(wctx, "# ffprobe output\n\n");
1592  return;
1593  }
1594 
1595  if (wctx->nb_item[wctx->level-1])
1596  writer_w8(wctx, '\n');
1597 
1598  av_bprintf(buf, "%s", wctx->section_pbuf[wctx->level-1].str);
1599  if (ini->hierarchical ||
1601  av_bprintf(buf, "%s%s", buf->str[0] ? "." : "", wctx->section[wctx->level]->name);
1602 
1603  if (parent_section->flags & SECTION_FLAG_IS_ARRAY) {
1604  int n = parent_section->id == SECTION_ID_PACKETS_AND_FRAMES ?
1605  wctx->nb_section_packet_frame : wctx->nb_item[wctx->level-1];
1606  av_bprintf(buf, ".%d", n);
1607  }
1608  }
1609 
1611  writer_printf(wctx, "[%s]\n", buf->str);
1612 }
1613 
1614 static void ini_print_str(WriterContext *wctx, const char *key, const char *value)
1615 {
1616  AVBPrint buf;
1617 
1619  writer_printf(wctx, "%s=", ini_escape_str(&buf, key));
1620  av_bprint_clear(&buf);
1621  writer_printf(wctx, "%s\n", ini_escape_str(&buf, value));
1622  av_bprint_finalize(&buf, NULL);
1623 }
1624 
1625 static void ini_print_int(WriterContext *wctx, const char *key, int64_t value)
1626 {
1627  writer_printf(wctx, "%s=%"PRId64"\n", key, value);
1628 }
1629 
1630 static const Writer ini_writer = {
1631  .name = "ini",
1632  .priv_size = sizeof(INIContext),
1634  .print_integer = ini_print_int,
1635  .print_string = ini_print_str,
1637  .priv_class = &ini_class,
1638 };
1639 
1640 /* JSON output */
1641 
1642 typedef struct JSONContext {
1643  const AVClass *class;
1645  int compact;
1646  const char *item_sep, *item_start_end;
1647 } JSONContext;
1648 
1649 #undef OFFSET
1650 #define OFFSET(x) offsetof(JSONContext, x)
1651 
1652 static const AVOption json_options[]= {
1653  { "compact", "enable compact output", OFFSET(compact), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1654  { "c", "enable compact output", OFFSET(compact), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1655  { NULL }
1656 };
1657 
1658 DEFINE_WRITER_CLASS(json);
1659 
1661 {
1662  JSONContext *json = wctx->priv;
1663 
1664  json->item_sep = json->compact ? ", " : ",\n";
1665  json->item_start_end = json->compact ? " " : "\n";
1666 
1667  return 0;
1668 }
1669 
1670 static const char *json_escape_str(AVBPrint *dst, const char *src, void *log_ctx)
1671 {
1672  static const char json_escape[] = {'"', '\\', '\b', '\f', '\n', '\r', '\t', 0};
1673  static const char json_subst[] = {'"', '\\', 'b', 'f', 'n', 'r', 't', 0};
1674  const char *p;
1675 
1676  for (p = src; *p; p++) {
1677  char *s = strchr(json_escape, *p);
1678  if (s) {
1679  av_bprint_chars(dst, '\\', 1);
1680  av_bprint_chars(dst, json_subst[s - json_escape], 1);
1681  } else if ((unsigned char)*p < 32) {
1682  av_bprintf(dst, "\\u00%02x", *p & 0xff);
1683  } else {
1684  av_bprint_chars(dst, *p, 1);
1685  }
1686  }
1687  return dst->str;
1688 }
1689 
1690 #define JSON_INDENT() writer_printf(wctx, "%*c", json->indent_level * 4, ' ')
1691 
1692 static void json_print_section_header(WriterContext *wctx, const void *data)
1693 {
1694  JSONContext *json = wctx->priv;
1695  AVBPrint buf;
1696  const struct section *section = wctx->section[wctx->level];
1697  const struct section *parent_section = wctx->level ?
1698  wctx->section[wctx->level-1] : NULL;
1699 
1700  if (wctx->level && wctx->nb_item[wctx->level-1])
1701  writer_put_str(wctx, ",\n");
1702 
1704  writer_put_str(wctx, "{\n");
1705  json->indent_level++;
1706  } else {
1708  json_escape_str(&buf, section->name, wctx);
1709  JSON_INDENT();
1710 
1711  json->indent_level++;
1713  writer_printf(wctx, "\"%s\": [\n", buf.str);
1714  } else if (parent_section && !(parent_section->flags & SECTION_FLAG_IS_ARRAY)) {
1715  writer_printf(wctx, "\"%s\": {%s", buf.str, json->item_start_end);
1716  } else {
1717  writer_printf(wctx, "{%s", json->item_start_end);
1718 
1719  /* this is required so the parser can distinguish between packets and frames */
1720  if (parent_section && parent_section->id == SECTION_ID_PACKETS_AND_FRAMES) {
1721  if (!json->compact)
1722  JSON_INDENT();
1723  writer_printf(wctx, "\"type\": \"%s\"", section->name);
1724  wctx->nb_item[wctx->level]++;
1725  }
1726  }
1727  av_bprint_finalize(&buf, NULL);
1728  }
1729 }
1730 
1732 {
1733  JSONContext *json = wctx->priv;
1734  const struct section *section = wctx->section[wctx->level];
1735 
1736  if (wctx->level == 0) {
1737  json->indent_level--;
1738  writer_put_str(wctx, "\n}\n");
1739  } else if (section->flags & SECTION_FLAG_IS_ARRAY) {
1740  writer_w8(wctx, '\n');
1741  json->indent_level--;
1742  JSON_INDENT();
1743  writer_w8(wctx, ']');
1744  } else {
1745  writer_put_str(wctx, json->item_start_end);
1746  json->indent_level--;
1747  if (!json->compact)
1748  JSON_INDENT();
1749  writer_w8(wctx, '}');
1750  }
1751 }
1752 
1753 static inline void json_print_item_str(WriterContext *wctx,
1754  const char *key, const char *value)
1755 {
1756  AVBPrint buf;
1757 
1759  writer_printf(wctx, "\"%s\":", json_escape_str(&buf, key, wctx));
1760  av_bprint_clear(&buf);
1761  writer_printf(wctx, " \"%s\"", json_escape_str(&buf, value, wctx));
1762  av_bprint_finalize(&buf, NULL);
1763 }
1764 
1765 static void json_print_str(WriterContext *wctx, const char *key, const char *value)
1766 {
1767  JSONContext *json = wctx->priv;
1768  const struct section *parent_section = wctx->level ?
1769  wctx->section[wctx->level-1] : NULL;
1770 
1771  if (wctx->nb_item[wctx->level] || (parent_section && parent_section->id == SECTION_ID_PACKETS_AND_FRAMES))
1772  writer_put_str(wctx, json->item_sep);
1773  if (!json->compact)
1774  JSON_INDENT();
1775  json_print_item_str(wctx, key, value);
1776 }
1777 
1778 static void json_print_int(WriterContext *wctx, const char *key, int64_t value)
1779 {
1780  JSONContext *json = wctx->priv;
1781  const struct section *parent_section = wctx->level ?
1782  wctx->section[wctx->level-1] : NULL;
1783  AVBPrint buf;
1784 
1785  if (wctx->nb_item[wctx->level] || (parent_section && parent_section->id == SECTION_ID_PACKETS_AND_FRAMES))
1786  writer_put_str(wctx, json->item_sep);
1787  if (!json->compact)
1788  JSON_INDENT();
1789 
1791  writer_printf(wctx, "\"%s\": %"PRId64, json_escape_str(&buf, key, wctx), value);
1792  av_bprint_finalize(&buf, NULL);
1793 }
1794 
1795 static const Writer json_writer = {
1796  .name = "json",
1797  .priv_size = sizeof(JSONContext),
1798  .init = json_init,
1801  .print_integer = json_print_int,
1802  .print_string = json_print_str,
1804  .priv_class = &json_class,
1805 };
1806 
1807 /* XML output */
1808 
1809 typedef struct XMLContext {
1810  const AVClass *class;
1815 } XMLContext;
1816 
1817 #undef OFFSET
1818 #define OFFSET(x) offsetof(XMLContext, x)
1819 
1820 static const AVOption xml_options[] = {
1821  {"fully_qualified", "specify if the output should be fully qualified", OFFSET(fully_qualified), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1822  {"q", "specify if the output should be fully qualified", OFFSET(fully_qualified), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1823  {"xsd_strict", "ensure that the output is XSD compliant", OFFSET(xsd_strict), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1824  {"x", "ensure that the output is XSD compliant", OFFSET(xsd_strict), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
1825  {NULL},
1826 };
1827 
1828 DEFINE_WRITER_CLASS(xml);
1829 
1830 static av_cold int xml_init(WriterContext *wctx)
1831 {
1832  XMLContext *xml = wctx->priv;
1833 
1834  if (xml->xsd_strict) {
1835  xml->fully_qualified = 1;
1836 #define CHECK_COMPLIANCE(opt, opt_name) \
1837  if (opt) { \
1838  av_log(wctx, AV_LOG_ERROR, \
1839  "XSD-compliant output selected but option '%s' was selected, XML output may be non-compliant.\n" \
1840  "You need to disable such option with '-no%s'\n", opt_name, opt_name); \
1841  return AVERROR(EINVAL); \
1842  }
1843  CHECK_COMPLIANCE(show_private_data, "private");
1846  }
1847 
1848  return 0;
1849 }
1850 
1851 #define XML_INDENT() writer_printf(wctx, "%*c", xml->indent_level * 4, ' ')
1852 
1853 static void xml_print_section_header(WriterContext *wctx, const void *data)
1854 {
1855  XMLContext *xml = wctx->priv;
1856  const struct section *section = wctx->section[wctx->level];
1857  const struct section *parent_section = wctx->level ?
1858  wctx->section[wctx->level-1] : NULL;
1859 
1860  if (wctx->level == 0) {
1861  const char *qual = " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
1862  "xmlns:ffprobe=\"http://www.ffmpeg.org/schema/ffprobe\" "
1863  "xsi:schemaLocation=\"http://www.ffmpeg.org/schema/ffprobe ffprobe.xsd\"";
1864 
1865  writer_put_str(wctx, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
1866  writer_printf(wctx, "<%sffprobe%s>\n",
1867  xml->fully_qualified ? "ffprobe:" : "",
1868  xml->fully_qualified ? qual : "");
1869  return;
1870  }
1871 
1872  if (xml->within_tag) {
1873  xml->within_tag = 0;
1874  writer_put_str(wctx, ">\n");
1875  }
1876 
1877  if (parent_section && (parent_section->flags & SECTION_FLAG_IS_WRAPPER) &&
1878  wctx->level && wctx->nb_item[wctx->level-1])
1879  writer_w8(wctx, '\n');
1880  xml->indent_level++;
1881 
1883  XML_INDENT(); writer_printf(wctx, "<%s", section->name);
1884 
1886  AVBPrint buf;
1890  writer_printf(wctx, " type=\"%s\"", buf.str);
1891  }
1892  writer_printf(wctx, ">\n", section->name);
1893  } else {
1894  XML_INDENT(); writer_printf(wctx, "<%s ", section->name);
1895  xml->within_tag = 1;
1896  }
1897 }
1898 
1900 {
1901  XMLContext *xml = wctx->priv;
1902  const struct section *section = wctx->section[wctx->level];
1903 
1904  if (wctx->level == 0) {
1905  writer_printf(wctx, "</%sffprobe>\n", xml->fully_qualified ? "ffprobe:" : "");
1906  } else if (xml->within_tag) {
1907  xml->within_tag = 0;
1908  writer_put_str(wctx, "/>\n");
1909  xml->indent_level--;
1910  } else {
1911  XML_INDENT(); writer_printf(wctx, "</%s>\n", section->name);
1912  xml->indent_level--;
1913  }
1914 }
1915 
1916 static void xml_print_value(WriterContext *wctx, const char *key,
1917  const char *str, int64_t num, const int is_int)
1918 {
1919  AVBPrint buf;
1920  XMLContext *xml = wctx->priv;
1921  const struct section *section = wctx->section[wctx->level];
1922 
1924 
1926  xml->indent_level++;
1927  XML_INDENT();
1928  av_bprint_escape(&buf, key, NULL,
1930  writer_printf(wctx, "<%s key=\"%s\"",
1931  section->element_name, buf.str);
1932  av_bprint_clear(&buf);
1933 
1934  if (is_int) {
1935  writer_printf(wctx, " value=\"%"PRId64"\"/>\n", num);
1936  } else {
1937  av_bprint_escape(&buf, str, NULL,
1939  writer_printf(wctx, " value=\"%s\"/>\n", buf.str);
1940  }
1941  xml->indent_level--;
1942  } else {
1943  if (wctx->nb_item[wctx->level])
1944  writer_w8(wctx, ' ');
1945 
1946  if (is_int) {
1947  writer_printf(wctx, "%s=\"%"PRId64"\"", key, num);
1948  } else {
1949  av_bprint_escape(&buf, str, NULL,
1951  writer_printf(wctx, "%s=\"%s\"", key, buf.str);
1952  }
1953  }
1954 
1955  av_bprint_finalize(&buf, NULL);
1956 }
1957 
1958 static inline void xml_print_str(WriterContext *wctx, const char *key, const char *value) {
1959  xml_print_value(wctx, key, value, 0, 0);
1960 }
1961 
1962 static void xml_print_int(WriterContext *wctx, const char *key, int64_t value)
1963 {
1964  xml_print_value(wctx, key, NULL, value, 1);
1965 }
1966 
1967 static Writer xml_writer = {
1968  .name = "xml",
1969  .priv_size = sizeof(XMLContext),
1970  .init = xml_init,
1973  .print_integer = xml_print_int,
1974  .print_string = xml_print_str,
1976  .priv_class = &xml_class,
1977 };
1978 
1979 static void writer_register_all(void)
1980 {
1981  static int initialized;
1982 
1983  if (initialized)
1984  return;
1985  initialized = 1;
1986 
1994 }
1995 
1996 #define print_fmt(k, f, ...) do { \
1997  av_bprint_clear(&pbuf); \
1998  av_bprintf(&pbuf, f, __VA_ARGS__); \
1999  writer_print_string(w, k, pbuf.str, 0); \
2000 } while (0)
2001 
2002 #define print_list_fmt(k, f, n, m, ...) do { \
2003  av_bprint_clear(&pbuf); \
2004  for (int idx = 0; idx < n; idx++) { \
2005  for (int idx2 = 0; idx2 < m; idx2++) { \
2006  if (idx > 0 || idx2 > 0) \
2007  av_bprint_chars(&pbuf, ' ', 1); \
2008  av_bprintf(&pbuf, f, __VA_ARGS__); \
2009  } \
2010  } \
2011  writer_print_string(w, k, pbuf.str, 0); \
2012 } while (0)
2013 
2014 #define print_int(k, v) writer_print_integer(w, k, v)
2015 #define print_q(k, v, s) writer_print_rational(w, k, v, s)
2016 #define print_str(k, v) writer_print_string(w, k, v, 0)
2017 #define print_str_opt(k, v) writer_print_string(w, k, v, PRINT_STRING_OPT)
2018 #define print_str_validate(k, v) writer_print_string(w, k, v, PRINT_STRING_VALIDATE)
2019 #define print_time(k, v, tb) writer_print_time(w, k, v, tb, 0)
2020 #define print_ts(k, v) writer_print_ts(w, k, v, 0)
2021 #define print_duration_time(k, v, tb) writer_print_time(w, k, v, tb, 1)
2022 #define print_duration_ts(k, v) writer_print_ts(w, k, v, 1)
2023 #define print_val(k, v, u) do { \
2024  struct unit_value uv; \
2025  uv.val.i = v; \
2026  uv.unit = u; \
2027  writer_print_string(w, k, value_string(val_str, sizeof(val_str), uv), 0); \
2028 } while (0)
2029 
2030 #define print_section_header(s) writer_print_section_header(w, NULL, s)
2031 #define print_section_header_data(s, d) writer_print_section_header(w, d, s)
2032 #define print_section_footer(s) writer_print_section_footer(w, s)
2033 
2034 #define REALLOCZ_ARRAY_STREAM(ptr, cur_n, new_n) \
2035 { \
2036  ret = av_reallocp_array(&(ptr), (new_n), sizeof(*(ptr))); \
2037  if (ret < 0) \
2038  goto end; \
2039  memset( (ptr) + (cur_n), 0, ((new_n) - (cur_n)) * sizeof(*(ptr)) ); \
2040 }
2041 
2042 static inline int show_tags(WriterContext *w, AVDictionary *tags, int section_id)
2043 {
2044  const AVDictionaryEntry *tag = NULL;
2045  int ret = 0;
2046 
2047  if (!tags)
2048  return 0;
2049  writer_print_section_header(w, NULL, section_id);
2050 
2051  while ((tag = av_dict_iterate(tags, tag))) {
2052  if ((ret = print_str_validate(tag->key, tag->value)) < 0)
2053  break;
2054  }
2056 
2057  return ret;
2058 }
2059 
2061 {
2062  if (!dovi)
2063  return;
2064 
2065  {
2066  const AVDOVIRpuDataHeader *hdr = av_dovi_get_header(dovi);
2067  const AVDOVIDataMapping *mapping = av_dovi_get_mapping(dovi);
2069  AVBPrint pbuf;
2070 
2072 
2073  // header
2074  print_int("rpu_type", hdr->rpu_type);
2075  print_int("rpu_format", hdr->rpu_format);
2076  print_int("vdr_rpu_profile", hdr->vdr_rpu_profile);
2077  print_int("vdr_rpu_level", hdr->vdr_rpu_level);
2078  print_int("chroma_resampling_explicit_filter_flag",
2080  print_int("coef_data_type", hdr->coef_data_type);
2081  print_int("coef_log2_denom", hdr->coef_log2_denom);
2082  print_int("vdr_rpu_normalized_idc", hdr->vdr_rpu_normalized_idc);
2083  print_int("bl_video_full_range_flag", hdr->bl_video_full_range_flag);
2084  print_int("bl_bit_depth", hdr->bl_bit_depth);
2085  print_int("el_bit_depth", hdr->el_bit_depth);
2086  print_int("vdr_bit_depth", hdr->vdr_bit_depth);
2087  print_int("spatial_resampling_filter_flag",
2089  print_int("el_spatial_resampling_filter_flag",
2091  print_int("disable_residual_flag", hdr->disable_residual_flag);
2092 
2093  // data mapping values
2094  print_int("vdr_rpu_id", mapping->vdr_rpu_id);
2095  print_int("mapping_color_space", mapping->mapping_color_space);
2096  print_int("mapping_chroma_format_idc",
2097  mapping->mapping_chroma_format_idc);
2098 
2099  print_int("nlq_method_idc", mapping->nlq_method_idc);
2100  switch (mapping->nlq_method_idc) {
2101  case AV_DOVI_NLQ_NONE:
2102  print_str("nlq_method_idc_name", "none");
2103  break;
2104  case AV_DOVI_NLQ_LINEAR_DZ:
2105  print_str("nlq_method_idc_name", "linear_dz");
2106  break;
2107  default:
2108  print_str("nlq_method_idc_name", "unknown");
2109  break;
2110  }
2111 
2112  print_int("num_x_partitions", mapping->num_x_partitions);
2113  print_int("num_y_partitions", mapping->num_y_partitions);
2114 
2116 
2117  for (int c = 0; c < 3; c++) {
2118  const AVDOVIReshapingCurve *curve = &mapping->curves[c];
2120 
2121  print_list_fmt("pivots", "%"PRIu16, curve->num_pivots, 1, curve->pivots[idx]);
2122 
2124  for (int i = 0; i < curve->num_pivots - 1; i++) {
2125  AVBPrint piece_buf;
2126 
2127  av_bprint_init(&piece_buf, 0, AV_BPRINT_SIZE_AUTOMATIC);
2128  switch (curve->mapping_idc[i]) {
2130  av_bprintf(&piece_buf, "Polynomial");
2131  break;
2132  case AV_DOVI_MAPPING_MMR:
2133  av_bprintf(&piece_buf, "MMR");
2134  break;
2135  default:
2136  av_bprintf(&piece_buf, "Unknown");
2137  break;
2138  }
2139  av_bprintf(&piece_buf, " mapping");
2140 
2142  print_int("mapping_idc", curve->mapping_idc[i]);
2143  switch (curve->mapping_idc[i]) {
2145  print_str("mapping_idc_name", "polynomial");
2146  print_int("poly_order", curve->poly_order[i]);
2147  print_list_fmt("poly_coef", "%"PRIi64,
2148  curve->poly_order[i] + 1, 1,
2149  curve->poly_coef[i][idx]);
2150  break;
2151  case AV_DOVI_MAPPING_MMR:
2152  print_str("mapping_idc_name", "mmr");
2153  print_int("mmr_order", curve->mmr_order[i]);
2154  print_int("mmr_constant", curve->mmr_constant[i]);
2155  print_list_fmt("mmr_coef", "%"PRIi64,
2156  curve->mmr_order[i], 7,
2157  curve->mmr_coef[i][idx][idx2]);
2158  break;
2159  default:
2160  print_str("mapping_idc_name", "unknown");
2161  break;
2162  }
2163 
2164  // SECTION_ID_FRAME_SIDE_DATA_PIECE
2166  }
2167 
2168  // SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST
2170 
2171  if (mapping->nlq_method_idc != AV_DOVI_NLQ_NONE) {
2172  const AVDOVINLQParams *nlq = &mapping->nlq[c];
2173  print_int("nlq_offset", nlq->nlq_offset);
2174  print_int("vdr_in_max", nlq->vdr_in_max);
2175 
2176  switch (mapping->nlq_method_idc) {
2177  case AV_DOVI_NLQ_LINEAR_DZ:
2178  print_int("linear_deadzone_slope", nlq->linear_deadzone_slope);
2179  print_int("linear_deadzone_threshold", nlq->linear_deadzone_threshold);
2180  break;
2181  }
2182  }
2183 
2184  // SECTION_ID_FRAME_SIDE_DATA_COMPONENT
2186  }
2187 
2188  // SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST
2190 
2191  // color metadata
2192  print_int("dm_metadata_id", color->dm_metadata_id);
2193  print_int("scene_refresh_flag", color->scene_refresh_flag);
2194  print_list_fmt("ycc_to_rgb_matrix", "%d/%d",
2195  FF_ARRAY_ELEMS(color->ycc_to_rgb_matrix), 1,
2196  color->ycc_to_rgb_matrix[idx].num,
2197  color->ycc_to_rgb_matrix[idx].den);
2198  print_list_fmt("ycc_to_rgb_offset", "%d/%d",
2199  FF_ARRAY_ELEMS(color->ycc_to_rgb_offset), 1,
2200  color->ycc_to_rgb_offset[idx].num,
2201  color->ycc_to_rgb_offset[idx].den);
2202  print_list_fmt("rgb_to_lms_matrix", "%d/%d",
2203  FF_ARRAY_ELEMS(color->rgb_to_lms_matrix), 1,
2204  color->rgb_to_lms_matrix[idx].num,
2205  color->rgb_to_lms_matrix[idx].den);
2206  print_int("signal_eotf", color->signal_eotf);
2207  print_int("signal_eotf_param0", color->signal_eotf_param0);
2208  print_int("signal_eotf_param1", color->signal_eotf_param1);
2209  print_int("signal_eotf_param2", color->signal_eotf_param2);
2210  print_int("signal_bit_depth", color->signal_bit_depth);
2211  print_int("signal_color_space", color->signal_color_space);
2212  print_int("signal_chroma_format", color->signal_chroma_format);
2213  print_int("signal_full_range_flag", color->signal_full_range_flag);
2214  print_int("source_min_pq", color->source_min_pq);
2215  print_int("source_max_pq", color->source_max_pq);
2216  print_int("source_diagonal", color->source_diagonal);
2217 
2218  av_bprint_finalize(&pbuf, NULL);
2219  }
2220 }
2221 
2223 {
2224  if (!metadata)
2225  return;
2226  print_int("application version", metadata->application_version);
2227  print_int("num_windows", metadata->num_windows);
2228  for (int n = 1; n < metadata->num_windows; n++) {
2229  const AVHDRPlusColorTransformParams *params = &metadata->params[n];
2230  print_q("window_upper_left_corner_x",
2231  params->window_upper_left_corner_x,'/');
2232  print_q("window_upper_left_corner_y",
2233  params->window_upper_left_corner_y,'/');
2234  print_q("window_lower_right_corner_x",
2235  params->window_lower_right_corner_x,'/');
2236  print_q("window_lower_right_corner_y",
2237  params->window_lower_right_corner_y,'/');
2238  print_q("window_upper_left_corner_x",
2239  params->window_upper_left_corner_x,'/');
2240  print_q("window_upper_left_corner_y",
2241  params->window_upper_left_corner_y,'/');
2242  print_int("center_of_ellipse_x",
2243  params->center_of_ellipse_x ) ;
2244  print_int("center_of_ellipse_y",
2245  params->center_of_ellipse_y );
2246  print_int("rotation_angle",
2247  params->rotation_angle);
2248  print_int("semimajor_axis_internal_ellipse",
2250  print_int("semimajor_axis_external_ellipse",
2252  print_int("semiminor_axis_external_ellipse",
2254  print_int("overlap_process_option",
2255  params->overlap_process_option);
2256  }
2257  print_q("targeted_system_display_maximum_luminance",
2260  print_int("num_rows_targeted_system_display_actual_peak_luminance",
2262  print_int("num_cols_targeted_system_display_actual_peak_luminance",
2264  for (int i = 0; i < metadata->num_rows_targeted_system_display_actual_peak_luminance; i++) {
2265  for (int j = 0; j < metadata->num_cols_targeted_system_display_actual_peak_luminance; j++) {
2266  print_q("targeted_system_display_actual_peak_luminance",
2268  }
2269  }
2270  }
2271  for (int n = 0; n < metadata->num_windows; n++) {
2272  const AVHDRPlusColorTransformParams *params = &metadata->params[n];
2273  for (int i = 0; i < 3; i++) {
2274  print_q("maxscl",params->maxscl[i],'/');
2275  }
2276  print_q("average_maxrgb",
2277  params->average_maxrgb,'/');
2278  print_int("num_distribution_maxrgb_percentiles",
2280  for (int i = 0; i < params->num_distribution_maxrgb_percentiles; i++) {
2281  print_int("distribution_maxrgb_percentage",
2282  params->distribution_maxrgb[i].percentage);
2283  print_q("distribution_maxrgb_percentile",
2284  params->distribution_maxrgb[i].percentile,'/');
2285  }
2286  print_q("fraction_bright_pixels",
2287  params->fraction_bright_pixels,'/');
2288  }
2290  print_int("num_rows_mastering_display_actual_peak_luminance",
2292  print_int("num_cols_mastering_display_actual_peak_luminance",
2294  for (int i = 0; i < metadata->num_rows_mastering_display_actual_peak_luminance; i++) {
2295  for (int j = 0; j < metadata->num_cols_mastering_display_actual_peak_luminance; j++) {
2296  print_q("mastering_display_actual_peak_luminance",
2297  metadata->mastering_display_actual_peak_luminance[i][j],'/');
2298  }
2299  }
2300  }
2301 
2302  for (int n = 0; n < metadata->num_windows; n++) {
2303  const AVHDRPlusColorTransformParams *params = &metadata->params[n];
2304  if (params->tone_mapping_flag) {
2305  print_q("knee_point_x", params->knee_point_x,'/');
2306  print_q("knee_point_y", params->knee_point_y,'/');
2307  print_int("num_bezier_curve_anchors",
2308  params->num_bezier_curve_anchors );
2309  for (int i = 0; i < params->num_bezier_curve_anchors; i++) {
2310  print_q("bezier_curve_anchors",
2311  params->bezier_curve_anchors[i],'/');
2312  }
2313  }
2314  if (params->color_saturation_mapping_flag) {
2315  print_q("color_saturation_weight",
2316  params->color_saturation_weight,'/');
2317  }
2318  }
2319 }
2320 
2322 {
2323  if (!metadata)
2324  return;
2325  print_int("system_start_code", metadata->system_start_code);
2326  print_int("num_windows", metadata->num_windows);
2327 
2328  for (int n = 0; n < metadata->num_windows; n++) {
2329  const AVHDRVividColorTransformParams *params = &metadata->params[n];
2330 
2331  print_q("minimum_maxrgb", params->minimum_maxrgb, '/');
2332  print_q("average_maxrgb", params->average_maxrgb, '/');
2333  print_q("variance_maxrgb", params->variance_maxrgb, '/');
2334  print_q("maximum_maxrgb", params->maximum_maxrgb, '/');
2335  }
2336 
2337  for (int n = 0; n < metadata->num_windows; n++) {
2338  const AVHDRVividColorTransformParams *params = &metadata->params[n];
2339 
2340  print_int("tone_mapping_mode_flag", params->tone_mapping_mode_flag);
2341  if (params->tone_mapping_mode_flag) {
2342  print_int("tone_mapping_param_num", params->tone_mapping_param_num);
2343  for (int i = 0; i < params->tone_mapping_param_num; i++) {
2344  const AVHDRVividColorToneMappingParams *tm_params = &params->tm_params[i];
2345 
2346  print_q("targeted_system_display_maximum_luminance",
2348  print_int("base_enable_flag", tm_params->base_enable_flag);
2349  if (tm_params->base_enable_flag) {
2350  print_q("base_param_m_p", tm_params->base_param_m_p, '/');
2351  print_q("base_param_m_m", tm_params->base_param_m_m, '/');
2352  print_q("base_param_m_a", tm_params->base_param_m_a, '/');
2353  print_q("base_param_m_b", tm_params->base_param_m_b, '/');
2354  print_q("base_param_m_n", tm_params->base_param_m_n, '/');
2355 
2356  print_int("base_param_k1", tm_params->base_param_k1);
2357  print_int("base_param_k2", tm_params->base_param_k2);
2358  print_int("base_param_k3", tm_params->base_param_k3);
2359  print_int("base_param_Delta_enable_mode",
2360  tm_params->base_param_Delta_enable_mode);
2361  print_q("base_param_Delta", tm_params->base_param_Delta, '/');
2362  }
2363  print_int("3Spline_enable_flag", tm_params->three_Spline_enable_flag);
2364  if (tm_params->three_Spline_enable_flag) {
2365  print_int("3Spline_num", tm_params->three_Spline_num);
2366 
2367  for (int j = 0; j < tm_params->three_Spline_num; j++) {
2368  const AVHDRVivid3SplineParams *three_spline = &tm_params->three_spline[j];
2369  print_int("3Spline_TH_mode", three_spline->th_mode);
2370  if (three_spline->th_mode == 0 || three_spline->th_mode == 2)
2371  print_q("3Spline_TH_enable_MB", three_spline->th_enable_mb, '/');
2372  print_q("3Spline_TH_enable", three_spline->th_enable, '/');
2373  print_q("3Spline_TH_Delta1", three_spline->th_delta1, '/');
2374  print_q("3Spline_TH_Delta2", three_spline->th_delta2, '/');
2375  print_q("3Spline_enable_Strength", three_spline->enable_strength, '/');
2376  }
2377  }
2378  }
2379  }
2380 
2381  print_int("color_saturation_mapping_flag", params->color_saturation_mapping_flag);
2382  if (params->color_saturation_mapping_flag) {
2383  print_int("color_saturation_num", params->color_saturation_num);
2384  for (int i = 0; i < params->color_saturation_num; i++) {
2385  print_q("color_saturation_gain", params->color_saturation_gain[i], '/');
2386  }
2387  }
2388  }
2389 }
2390 
2392  const AVAmbientViewingEnvironment *env)
2393 {
2394  if (!env)
2395  return;
2396 
2397  print_q("ambient_illuminance", env->ambient_illuminance, '/');
2398  print_q("ambient_light_x", env->ambient_light_x, '/');
2399  print_q("ambient_light_y", env->ambient_light_y, '/');
2400 }
2401 
2403  const AVFilmGrainParams *fgp)
2404 {
2405  const char *color_range, *color_primaries, *color_trc, *color_space;
2406  const char *const film_grain_type_names[] = {
2407  [AV_FILM_GRAIN_PARAMS_NONE] = "none",
2408  [AV_FILM_GRAIN_PARAMS_AV1] = "av1",
2409  [AV_FILM_GRAIN_PARAMS_H274] = "h274",
2410  };
2411 
2412  AVBPrint pbuf;
2413  if (!fgp || fgp->type >= FF_ARRAY_ELEMS(film_grain_type_names))
2414  return;
2415 
2418  color_trc = av_color_transfer_name(fgp->color_trc);
2419  color_space = av_color_space_name(fgp->color_space);
2420 
2422  print_str("type", film_grain_type_names[fgp->type]);
2423  print_fmt("seed", "%"PRIu64, fgp->seed);
2424  print_int("width", fgp->width);
2425  print_int("height", fgp->height);
2426  print_int("subsampling_x", fgp->subsampling_x);
2427  print_int("subsampling_y", fgp->subsampling_y);
2428  print_str("color_range", color_range ? color_range : "unknown");
2429  print_str("color_primaries", color_primaries ? color_primaries : "unknown");
2430  print_str("color_trc", color_trc ? color_trc : "unknown");
2431  print_str("color_space", color_space ? color_space : "unknown");
2432 
2433  switch (fgp->type) {
2435  break;
2436  case AV_FILM_GRAIN_PARAMS_AV1: {
2437  const AVFilmGrainAOMParams *aom = &fgp->codec.aom;
2438  const int num_ar_coeffs_y = 2 * aom->ar_coeff_lag * (aom->ar_coeff_lag + 1);
2439  const int num_ar_coeffs_uv = num_ar_coeffs_y + !!aom->num_y_points;
2440  print_int("chroma_scaling_from_luma", aom->chroma_scaling_from_luma);
2441  print_int("scaling_shift", aom->scaling_shift);
2442  print_int("ar_coeff_lag", aom->ar_coeff_lag);
2443  print_int("ar_coeff_shift", aom->ar_coeff_shift);
2444  print_int("grain_scale_shift", aom->grain_scale_shift);
2445  print_int("overlap_flag", aom->overlap_flag);
2446  print_int("limit_output_range", aom->limit_output_range);
2447 
2449 
2450  if (aom->num_y_points) {
2452 
2453  print_int("bit_depth_luma", fgp->bit_depth_luma);
2454  print_list_fmt("y_points_value", "%"PRIu8, aom->num_y_points, 1, aom->y_points[idx][0]);
2455  print_list_fmt("y_points_scaling", "%"PRIu8, aom->num_y_points, 1, aom->y_points[idx][1]);
2456  print_list_fmt("ar_coeffs_y", "%"PRId8, num_ar_coeffs_y, 1, aom->ar_coeffs_y[idx]);
2457 
2458  // SECTION_ID_FRAME_SIDE_DATA_COMPONENT
2460  }
2461 
2462  for (int uv = 0; uv < 2; uv++) {
2463  if (!aom->num_uv_points[uv] && !aom->chroma_scaling_from_luma)
2464  continue;
2465 
2467 
2468  print_int("bit_depth_chroma", fgp->bit_depth_chroma);
2469  print_list_fmt("uv_points_value", "%"PRIu8, aom->num_uv_points[uv], 1, aom->uv_points[uv][idx][0]);
2470  print_list_fmt("uv_points_scaling", "%"PRIu8, aom->num_uv_points[uv], 1, aom->uv_points[uv][idx][1]);
2471  print_list_fmt("ar_coeffs_uv", "%"PRId8, num_ar_coeffs_uv, 1, aom->ar_coeffs_uv[uv][idx]);
2472  print_int("uv_mult", aom->uv_mult[uv]);
2473  print_int("uv_mult_luma", aom->uv_mult_luma[uv]);
2474  print_int("uv_offset", aom->uv_offset[uv]);
2475 
2476  // SECTION_ID_FRAME_SIDE_DATA_COMPONENT
2478  }
2479 
2480  // SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST
2482  break;
2483  }
2485  const AVFilmGrainH274Params *h274 = &fgp->codec.h274;
2486  print_int("model_id", h274->model_id);
2487  print_int("blending_mode_id", h274->blending_mode_id);
2488  print_int("log2_scale_factor", h274->log2_scale_factor);
2489 
2491 
2492  for (int c = 0; c < 3; c++) {
2493  if (!h274->component_model_present[c])
2494  continue;
2495 
2497  print_int(c ? "bit_depth_chroma" : "bit_depth_luma", c ? fgp->bit_depth_chroma : fgp->bit_depth_luma);
2498 
2500  for (int i = 0; i < h274->num_intensity_intervals[c]; i++) {
2501 
2503  print_int("intensity_interval_lower_bound", h274->intensity_interval_lower_bound[c][i]);
2504  print_int("intensity_interval_upper_bound", h274->intensity_interval_upper_bound[c][i]);
2505  print_list_fmt("comp_model_value", "%"PRId16, h274->num_model_values[c], 1, h274->comp_model_value[c][i][idx]);
2506 
2507  // SECTION_ID_FRAME_SIDE_DATA_PIECE
2509  }
2510 
2511  // SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST
2513 
2514  // SECTION_ID_FRAME_SIDE_DATA_COMPONENT
2516  }
2517 
2518  // SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST
2520  break;
2521  }
2522  }
2523 
2524  av_bprint_finalize(&pbuf, NULL);
2525 }
2526 
2528  AVCodecParameters *par,
2529  const AVPacketSideData *sd,
2530  SectionID id_data)
2531 {
2532  const char *name = av_packet_side_data_name(sd->type);
2533 
2534  writer_print_section_header(w, sd, id_data);
2535  print_str("side_data_type", name ? name : "unknown");
2536  if (sd->type == AV_PKT_DATA_DISPLAYMATRIX && sd->size >= 9*4) {
2537  double rotation = av_display_rotation_get((int32_t *)sd->data);
2538  if (isnan(rotation))
2539  rotation = 0;
2540  writer_print_integers(w, "displaymatrix", sd->data, 9, " %11d", 3, 4, 1);
2541  print_int("rotation", rotation);
2542  } else if (sd->type == AV_PKT_DATA_STEREO3D) {
2543  const AVStereo3D *stereo = (AVStereo3D *)sd->data;
2544  print_str("type", av_stereo3d_type_name(stereo->type));
2545  print_int("inverted", !!(stereo->flags & AV_STEREO3D_FLAG_INVERT));
2546  } else if (sd->type == AV_PKT_DATA_SPHERICAL) {
2547  const AVSphericalMapping *spherical = (AVSphericalMapping *)sd->data;
2548  print_str("projection", av_spherical_projection_name(spherical->projection));
2549  if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
2550  print_int("padding", spherical->padding);
2551  } else if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
2552  size_t l, t, r, b;
2553  av_spherical_tile_bounds(spherical, par->width, par->height,
2554  &l, &t, &r, &b);
2555  print_int("bound_left", l);
2556  print_int("bound_top", t);
2557  print_int("bound_right", r);
2558  print_int("bound_bottom", b);
2559  }
2560 
2561  print_int("yaw", (double) spherical->yaw / (1 << 16));
2562  print_int("pitch", (double) spherical->pitch / (1 << 16));
2563  print_int("roll", (double) spherical->roll / (1 << 16));
2564  } else if (sd->type == AV_PKT_DATA_SKIP_SAMPLES && sd->size == 10) {
2565  print_int("skip_samples", AV_RL32(sd->data));
2566  print_int("discard_padding", AV_RL32(sd->data + 4));
2567  print_int("skip_reason", AV_RL8(sd->data + 8));
2568  print_int("discard_reason", AV_RL8(sd->data + 9));
2569  } else if (sd->type == AV_PKT_DATA_MASTERING_DISPLAY_METADATA) {
2571 
2572  if (metadata->has_primaries) {
2573  print_q("red_x", metadata->display_primaries[0][0], '/');
2574  print_q("red_y", metadata->display_primaries[0][1], '/');
2575  print_q("green_x", metadata->display_primaries[1][0], '/');
2576  print_q("green_y", metadata->display_primaries[1][1], '/');
2577  print_q("blue_x", metadata->display_primaries[2][0], '/');
2578  print_q("blue_y", metadata->display_primaries[2][1], '/');
2579 
2580  print_q("white_point_x", metadata->white_point[0], '/');
2581  print_q("white_point_y", metadata->white_point[1], '/');
2582  }
2583 
2584  if (metadata->has_luminance) {
2585  print_q("min_luminance", metadata->min_luminance, '/');
2586  print_q("max_luminance", metadata->max_luminance, '/');
2587  }
2588  } else if (sd->type == AV_PKT_DATA_CONTENT_LIGHT_LEVEL) {
2590  print_int("max_content", metadata->MaxCLL);
2591  print_int("max_average", metadata->MaxFALL);
2592  } else if (sd->type == AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT) {
2594  w, (const AVAmbientViewingEnvironment *)sd->data);
2595  } else if (sd->type == AV_PKT_DATA_DYNAMIC_HDR10_PLUS) {
2596  AVDynamicHDRPlus *metadata = (AVDynamicHDRPlus *)sd->data;
2597  print_dynamic_hdr10_plus(w, metadata);
2598  } else if (sd->type == AV_PKT_DATA_DOVI_CONF) {
2600  print_int("dv_version_major", dovi->dv_version_major);
2601  print_int("dv_version_minor", dovi->dv_version_minor);
2602  print_int("dv_profile", dovi->dv_profile);
2603  print_int("dv_level", dovi->dv_level);
2604  print_int("rpu_present_flag", dovi->rpu_present_flag);
2605  print_int("el_present_flag", dovi->el_present_flag);
2606  print_int("bl_present_flag", dovi->bl_present_flag);
2607  print_int("dv_bl_signal_compatibility_id", dovi->dv_bl_signal_compatibility_id);
2608  } else if (sd->type == AV_PKT_DATA_AUDIO_SERVICE_TYPE) {
2609  enum AVAudioServiceType *t = (enum AVAudioServiceType *)sd->data;
2610  print_int("service_type", *t);
2611  } else if (sd->type == AV_PKT_DATA_MPEGTS_STREAM_ID) {
2612  print_int("id", *sd->data);
2613  } else if (sd->type == AV_PKT_DATA_CPB_PROPERTIES) {
2614  const AVCPBProperties *prop = (AVCPBProperties *)sd->data;
2615  print_int("max_bitrate", prop->max_bitrate);
2616  print_int("min_bitrate", prop->min_bitrate);
2617  print_int("avg_bitrate", prop->avg_bitrate);
2618  print_int("buffer_size", prop->buffer_size);
2619  print_int("vbv_delay", prop->vbv_delay);
2620  } else if (sd->type == AV_PKT_DATA_WEBVTT_IDENTIFIER ||
2622  if (do_show_data)
2623  writer_print_data(w, "data", sd->data, sd->size);
2624  writer_print_data_hash(w, "data_hash", sd->data, sd->size);
2625  } else if (sd->type == AV_PKT_DATA_AFD && sd->size > 0) {
2626  print_int("active_format", *sd->data);
2627  }
2628 }
2629 
2630 static void print_private_data(WriterContext *w, void *priv_data)
2631 {
2632  const AVOption *opt = NULL;
2633  while (opt = av_opt_next(priv_data, opt)) {
2634  uint8_t *str;
2635  if (!(opt->flags & AV_OPT_FLAG_EXPORT)) continue;
2636  if (av_opt_get(priv_data, opt->name, 0, &str) >= 0) {
2637  print_str(opt->name, str);
2638  av_free(str);
2639  }
2640  }
2641 }
2642 
2644 {
2645  const char *val = av_color_range_name(color_range);
2647  print_str_opt("color_range", "unknown");
2648  } else {
2649  print_str("color_range", val);
2650  }
2651 }
2652 
2653 static void print_color_space(WriterContext *w, enum AVColorSpace color_space)
2654 {
2655  const char *val = av_color_space_name(color_space);
2656  if (!val || color_space == AVCOL_SPC_UNSPECIFIED) {
2657  print_str_opt("color_space", "unknown");
2658  } else {
2659  print_str("color_space", val);
2660  }
2661 }
2662 
2664 {
2667  print_str_opt("color_primaries", "unknown");
2668  } else {
2669  print_str("color_primaries", val);
2670  }
2671 }
2672 
2674 {
2675  const char *val = av_color_transfer_name(color_trc);
2676  if (!val || color_trc == AVCOL_TRC_UNSPECIFIED) {
2677  print_str_opt("color_transfer", "unknown");
2678  } else {
2679  print_str("color_transfer", val);
2680  }
2681 }
2682 
2683 static void print_chroma_location(WriterContext *w, enum AVChromaLocation chroma_location)
2684 {
2685  const char *val = av_chroma_location_name(chroma_location);
2686  if (!val || chroma_location == AVCHROMA_LOC_UNSPECIFIED) {
2687  print_str_opt("chroma_location", "unspecified");
2688  } else {
2689  print_str("chroma_location", val);
2690  }
2691 }
2692 
2693 static void clear_log(int need_lock)
2694 {
2695  int i;
2696 
2697  if (need_lock)
2698  pthread_mutex_lock(&log_mutex);
2699  for (i=0; i<log_buffer_size; i++) {
2700  av_freep(&log_buffer[i].context_name);
2701  av_freep(&log_buffer[i].parent_name);
2702  av_freep(&log_buffer[i].log_message);
2703  }
2704  log_buffer_size = 0;
2705  if(need_lock)
2706  pthread_mutex_unlock(&log_mutex);
2707 }
2708 
2709 static int show_log(WriterContext *w, int section_ids, int section_id, int log_level)
2710 {
2711  int i;
2712  pthread_mutex_lock(&log_mutex);
2713  if (!log_buffer_size) {
2714  pthread_mutex_unlock(&log_mutex);
2715  return 0;
2716  }
2717  writer_print_section_header(w, NULL, section_ids);
2718 
2719  for (i=0; i<log_buffer_size; i++) {
2720  if (log_buffer[i].log_level <= log_level) {
2721  writer_print_section_header(w, NULL, section_id);
2722  print_str("context", log_buffer[i].context_name);
2723  print_int("level", log_buffer[i].log_level);
2724  print_int("category", log_buffer[i].category);
2725  if (log_buffer[i].parent_name) {
2726  print_str("parent_context", log_buffer[i].parent_name);
2727  print_int("parent_category", log_buffer[i].parent_category);
2728  } else {
2729  print_str_opt("parent_context", "N/A");
2730  print_str_opt("parent_category", "N/A");
2731  }
2732  print_str("message", log_buffer[i].log_message);
2734  }
2735  }
2736  clear_log(0);
2737  pthread_mutex_unlock(&log_mutex);
2738 
2740 
2741  return 0;
2742 }
2743 
2744 static void show_packet(WriterContext *w, InputFile *ifile, AVPacket *pkt, int packet_idx)
2745 {
2746  char val_str[128];
2747  AVStream *st = ifile->streams[pkt->stream_index].st;
2748  AVBPrint pbuf;
2749  const char *s;
2750 
2752 
2754 
2756  if (s) print_str ("codec_type", s);
2757  else print_str_opt("codec_type", "unknown");
2758  print_int("stream_index", pkt->stream_index);
2759  print_ts ("pts", pkt->pts);
2760  print_time("pts_time", pkt->pts, &st->time_base);
2761  print_ts ("dts", pkt->dts);
2762  print_time("dts_time", pkt->dts, &st->time_base);
2763  print_duration_ts("duration", pkt->duration);
2764  print_duration_time("duration_time", pkt->duration, &st->time_base);
2765  print_val("size", pkt->size, unit_byte_str);
2766  if (pkt->pos != -1) print_fmt ("pos", "%"PRId64, pkt->pos);
2767  else print_str_opt("pos", "N/A");
2768  print_fmt("flags", "%c%c%c", pkt->flags & AV_PKT_FLAG_KEY ? 'K' : '_',
2769  pkt->flags & AV_PKT_FLAG_DISCARD ? 'D' : '_',
2770  pkt->flags & AV_PKT_FLAG_CORRUPT ? 'C' : '_');
2771  if (do_show_data)
2772  writer_print_data(w, "data", pkt->data, pkt->size);
2773  writer_print_data_hash(w, "data_hash", pkt->data, pkt->size);
2774 
2775  if (pkt->side_data_elems) {
2776  size_t size;
2777  const uint8_t *side_metadata;
2778 
2780  if (side_metadata && size && do_show_packet_tags) {
2781  AVDictionary *dict = NULL;
2782  if (av_packet_unpack_dictionary(side_metadata, size, &dict) >= 0)
2784  av_dict_free(&dict);
2785  }
2786 
2788  for (int i = 0; i < pkt->side_data_elems; i++) {
2792  }
2794  }
2795 
2797 
2798  av_bprint_finalize(&pbuf, NULL);
2799  fflush(stdout);
2800 }
2801 
2802 static void show_subtitle(WriterContext *w, AVSubtitle *sub, AVStream *stream,
2804 {
2805  AVBPrint pbuf;
2806 
2808 
2810 
2811  print_str ("media_type", "subtitle");
2812  print_ts ("pts", sub->pts);
2813  print_time("pts_time", sub->pts, &AV_TIME_BASE_Q);
2814  print_int ("format", sub->format);
2815  print_int ("start_display_time", sub->start_display_time);
2816  print_int ("end_display_time", sub->end_display_time);
2817  print_int ("num_rects", sub->num_rects);
2818 
2820 
2821  av_bprint_finalize(&pbuf, NULL);
2822  fflush(stdout);
2823 }
2824 
2826  const AVFrame *frame,
2827  const AVStream *stream)
2828 {
2830 
2831  for (int i = 0; i < frame->nb_side_data; i++) {
2832  const AVFrameSideData *sd = frame->side_data[i];
2833  const char *name;
2834 
2837  print_str("side_data_type", name ? name : "unknown");
2838  if (sd->type == AV_FRAME_DATA_DISPLAYMATRIX && sd->size >= 9*4) {
2839  double rotation = av_display_rotation_get((int32_t *)sd->data);
2840  if (isnan(rotation))
2841  rotation = 0;
2842  writer_print_integers(w, "displaymatrix", sd->data, 9, " %11d", 3, 4, 1);
2843  print_int("rotation", rotation);
2844  } else if (sd->type == AV_FRAME_DATA_AFD && sd->size > 0) {
2845  print_int("active_format", *sd->data);
2846  } else if (sd->type == AV_FRAME_DATA_GOP_TIMECODE && sd->size >= 8) {
2847  char tcbuf[AV_TIMECODE_STR_SIZE];
2848  av_timecode_make_mpeg_tc_string(tcbuf, *(int64_t *)(sd->data));
2849  print_str("timecode", tcbuf);
2850  } else if (sd->type == AV_FRAME_DATA_S12M_TIMECODE && sd->size == 16) {
2851  uint32_t *tc = (uint32_t*)sd->data;
2852  int m = FFMIN(tc[0],3);
2854  for (int j = 1; j <= m ; j++) {
2855  char tcbuf[AV_TIMECODE_STR_SIZE];
2856  av_timecode_make_smpte_tc_string2(tcbuf, stream->avg_frame_rate, tc[j], 0, 0);
2858  print_str("value", tcbuf);
2860  }
2862  } else if (sd->type == AV_FRAME_DATA_MASTERING_DISPLAY_METADATA) {
2864 
2865  if (metadata->has_primaries) {
2866  print_q("red_x", metadata->display_primaries[0][0], '/');
2867  print_q("red_y", metadata->display_primaries[0][1], '/');
2868  print_q("green_x", metadata->display_primaries[1][0], '/');
2869  print_q("green_y", metadata->display_primaries[1][1], '/');
2870  print_q("blue_x", metadata->display_primaries[2][0], '/');
2871  print_q("blue_y", metadata->display_primaries[2][1], '/');
2872 
2873  print_q("white_point_x", metadata->white_point[0], '/');
2874  print_q("white_point_y", metadata->white_point[1], '/');
2875  }
2876 
2877  if (metadata->has_luminance) {
2878  print_q("min_luminance", metadata->min_luminance, '/');
2879  print_q("max_luminance", metadata->max_luminance, '/');
2880  }
2881  } else if (sd->type == AV_FRAME_DATA_DYNAMIC_HDR_PLUS) {
2882  AVDynamicHDRPlus *metadata = (AVDynamicHDRPlus *)sd->data;
2883  print_dynamic_hdr10_plus(w, metadata);
2884  } else if (sd->type == AV_FRAME_DATA_CONTENT_LIGHT_LEVEL) {
2886  print_int("max_content", metadata->MaxCLL);
2887  print_int("max_average", metadata->MaxFALL);
2888  } else if (sd->type == AV_FRAME_DATA_ICC_PROFILE) {
2890  if (tag)
2891  print_str(tag->key, tag->value);
2892  print_int("size", sd->size);
2893  } else if (sd->type == AV_FRAME_DATA_DOVI_METADATA) {
2894  print_dovi_metadata(w, (const AVDOVIMetadata *)sd->data);
2895  } else if (sd->type == AV_FRAME_DATA_DYNAMIC_HDR_VIVID) {
2896  AVDynamicHDRVivid *metadata = (AVDynamicHDRVivid *)sd->data;
2897  print_dynamic_hdr_vivid(w, metadata);
2898  } else if (sd->type == AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT) {
2900  } else if (sd->type == AV_FRAME_DATA_FILM_GRAIN_PARAMS) {
2902  print_film_grain_params(w, fgp);
2903  }
2905  }
2907 }
2908 
2911 {
2913  AVBPrint pbuf;
2914  char val_str[128];
2915  const char *s;
2916 
2918 
2920 
2922  if (s) print_str ("media_type", s);
2923  else print_str_opt("media_type", "unknown");
2924  print_int("stream_index", stream->index);
2925  print_int("key_frame", !!(frame->flags & AV_FRAME_FLAG_KEY));
2926  print_ts ("pts", frame->pts);
2927  print_time("pts_time", frame->pts, &stream->time_base);
2928  print_ts ("pkt_dts", frame->pkt_dts);
2929  print_time("pkt_dts_time", frame->pkt_dts, &stream->time_base);
2930  print_ts ("best_effort_timestamp", frame->best_effort_timestamp);
2931  print_time("best_effort_timestamp_time", frame->best_effort_timestamp, &stream->time_base);
2932  print_duration_ts ("duration", frame->duration);
2933  print_duration_time("duration_time", frame->duration, &stream->time_base);
2934  if (fd && fd->pkt_pos != -1) print_fmt ("pkt_pos", "%"PRId64, fd->pkt_pos);
2935  else print_str_opt("pkt_pos", "N/A");
2936  if (fd && fd->pkt_size != -1) print_val ("pkt_size", fd->pkt_size, unit_byte_str);
2937  else print_str_opt("pkt_size", "N/A");
2938 
2939  switch (stream->codecpar->codec_type) {
2940  AVRational sar;
2941 
2942  case AVMEDIA_TYPE_VIDEO:
2943  print_int("width", frame->width);
2944  print_int("height", frame->height);
2945  print_int("crop_top", frame->crop_top);
2946  print_int("crop_bottom", frame->crop_bottom);
2947  print_int("crop_left", frame->crop_left);
2948  print_int("crop_right", frame->crop_right);
2950  if (s) print_str ("pix_fmt", s);
2951  else print_str_opt("pix_fmt", "unknown");
2952  sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, frame);
2953  if (sar.num) {
2954  print_q("sample_aspect_ratio", sar, ':');
2955  } else {
2956  print_str_opt("sample_aspect_ratio", "N/A");
2957  }
2958  print_fmt("pict_type", "%c", av_get_picture_type_char(frame->pict_type));
2959  print_int("interlaced_frame", !!(frame->flags & AV_FRAME_FLAG_INTERLACED));
2960  print_int("top_field_first", !!(frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST));
2961  print_int("repeat_pict", frame->repeat_pict);
2962 
2968  break;
2969 
2970  case AVMEDIA_TYPE_AUDIO:
2972  if (s) print_str ("sample_fmt", s);
2973  else print_str_opt("sample_fmt", "unknown");
2974  print_int("nb_samples", frame->nb_samples);
2975  print_int("channels", frame->ch_layout.nb_channels);
2977  av_channel_layout_describe(&frame->ch_layout, val_str, sizeof(val_str));
2978  print_str ("channel_layout", val_str);
2979  } else
2980  print_str_opt("channel_layout", "unknown");
2981  break;
2982  }
2983  if (do_show_frame_tags)
2985  if (do_show_log)
2987  if (frame->nb_side_data)
2988  print_frame_side_data(w, frame, stream);
2989 
2991 
2992  av_bprint_finalize(&pbuf, NULL);
2993  fflush(stdout);
2994 }
2995 
2997  InputFile *ifile,
2998  AVFrame *frame, const AVPacket *pkt,
2999  int *packet_new)
3000 {
3001  AVFormatContext *fmt_ctx = ifile->fmt_ctx;
3004  AVSubtitle sub;
3005  int ret = 0, got_frame = 0;
3006 
3007  clear_log(1);
3008  if (dec_ctx) {
3009  switch (par->codec_type) {
3010  case AVMEDIA_TYPE_VIDEO:
3011  case AVMEDIA_TYPE_AUDIO:
3012  if (*packet_new) {
3014  if (ret == AVERROR(EAGAIN)) {
3015  ret = 0;
3016  } else if (ret >= 0 || ret == AVERROR_EOF) {
3017  ret = 0;
3018  *packet_new = 0;
3019  }
3020  }
3021  if (ret >= 0) {
3023  if (ret >= 0) {
3024  got_frame = 1;
3025  } else if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
3026  ret = 0;
3027  }
3028  }
3029  break;
3030 
3031  case AVMEDIA_TYPE_SUBTITLE:
3032  if (*packet_new)
3033  ret = avcodec_decode_subtitle2(dec_ctx, &sub, &got_frame, pkt);
3034  *packet_new = 0;
3035  break;
3036  default:
3037  *packet_new = 0;
3038  }
3039  } else {
3040  *packet_new = 0;
3041  }
3042 
3043  if (ret < 0)
3044  return ret;
3045  if (got_frame) {
3046  int is_sub = (par->codec_type == AVMEDIA_TYPE_SUBTITLE);
3048  if (do_show_frames)
3049  if (is_sub)
3050  show_subtitle(w, &sub, ifile->streams[pkt->stream_index].st, fmt_ctx);
3051  else
3053  if (is_sub)
3054  avsubtitle_free(&sub);
3055  }
3056  return got_frame || *packet_new;
3057 }
3058 
3059 static void log_read_interval(const ReadInterval *interval, void *log_ctx, int log_level)
3060 {
3061  av_log(log_ctx, log_level, "id:%d", interval->id);
3062 
3063  if (interval->has_start) {
3064  av_log(log_ctx, log_level, " start:%s%s", interval->start_is_offset ? "+" : "",
3065  av_ts2timestr(interval->start, &AV_TIME_BASE_Q));
3066  } else {
3067  av_log(log_ctx, log_level, " start:N/A");
3068  }
3069 
3070  if (interval->has_end) {
3071  av_log(log_ctx, log_level, " end:%s", interval->end_is_offset ? "+" : "");
3072  if (interval->duration_frames)
3073  av_log(log_ctx, log_level, "#%"PRId64, interval->end);
3074  else
3075  av_log(log_ctx, log_level, "%s", av_ts2timestr(interval->end, &AV_TIME_BASE_Q));
3076  } else {
3077  av_log(log_ctx, log_level, " end:N/A");
3078  }
3079 
3080  av_log(log_ctx, log_level, "\n");
3081 }
3082 
3084  const ReadInterval *interval, int64_t *cur_ts)
3085 {
3086  AVFormatContext *fmt_ctx = ifile->fmt_ctx;
3087  AVPacket *pkt = NULL;
3088  AVFrame *frame = NULL;
3089  int ret = 0, i = 0, frame_count = 0;
3090  int64_t start = -INT64_MAX, end = interval->end;
3091  int has_start = 0, has_end = interval->has_end && !interval->end_is_offset;
3092 
3093  av_log(NULL, AV_LOG_VERBOSE, "Processing read interval ");
3095 
3096  if (interval->has_start) {
3097  int64_t target;
3098  if (interval->start_is_offset) {
3099  if (*cur_ts == AV_NOPTS_VALUE) {
3101  "Could not seek to relative position since current "
3102  "timestamp is not defined\n");
3103  ret = AVERROR(EINVAL);
3104  goto end;
3105  }
3106  target = *cur_ts + interval->start;
3107  } else {
3108  target = interval->start;
3109  }
3110 
3111  av_log(NULL, AV_LOG_VERBOSE, "Seeking to read interval start point %s\n",
3112  av_ts2timestr(target, &AV_TIME_BASE_Q));
3113  if ((ret = avformat_seek_file(fmt_ctx, -1, -INT64_MAX, target, INT64_MAX, 0)) < 0) {
3114  av_log(NULL, AV_LOG_ERROR, "Could not seek to position %"PRId64": %s\n",
3115  interval->start, av_err2str(ret));
3116  goto end;
3117  }
3118  }
3119 
3120  frame = av_frame_alloc();
3121  if (!frame) {
3122  ret = AVERROR(ENOMEM);
3123  goto end;
3124  }
3125  pkt = av_packet_alloc();
3126  if (!pkt) {
3127  ret = AVERROR(ENOMEM);
3128  goto end;
3129  }
3130  while (!av_read_frame(fmt_ctx, pkt)) {
3131  if (fmt_ctx->nb_streams > nb_streams) {
3136  }
3139  int64_t pts = pkt->pts != AV_NOPTS_VALUE ? pkt->pts : pkt->dts;
3140 
3141  if (pts != AV_NOPTS_VALUE)
3142  *cur_ts = av_rescale_q(pts, tb, AV_TIME_BASE_Q);
3143 
3144  if (!has_start && *cur_ts != AV_NOPTS_VALUE) {
3145  start = *cur_ts;
3146  has_start = 1;
3147  }
3148 
3149  if (has_start && !has_end && interval->end_is_offset) {
3150  end = start + interval->end;
3151  has_end = 1;
3152  }
3153 
3154  if (interval->end_is_offset && interval->duration_frames) {
3155  if (frame_count >= interval->end)
3156  break;
3157  } else if (has_end && *cur_ts != AV_NOPTS_VALUE && *cur_ts >= end) {
3158  break;
3159  }
3160 
3161  frame_count++;
3162  if (do_read_packets) {
3163  if (do_show_packets)
3164  show_packet(w, ifile, pkt, i++);
3166  }
3167  if (do_read_frames) {
3168  int packet_new = 1;
3169  FrameData *fd;
3170 
3171  pkt->opaque_ref = av_buffer_allocz(sizeof(*fd));
3172  if (!pkt->opaque_ref) {
3173  ret = AVERROR(ENOMEM);
3174  goto end;
3175  }
3176  fd = (FrameData*)pkt->opaque_ref->data;
3177  fd->pkt_pos = pkt->pos;
3178  fd->pkt_size = pkt->size;
3179 
3180  while (process_frame(w, ifile, frame, pkt, &packet_new) > 0);
3181  }
3182  }
3184  }
3186  //Flush remaining frames that are cached in the decoder
3187  for (i = 0; i < ifile->nb_streams; i++) {
3188  pkt->stream_index = i;
3189  if (do_read_frames) {
3190  while (process_frame(w, ifile, frame, pkt, &(int){1}) > 0);
3191  if (ifile->streams[i].dec_ctx)
3193  }
3194  }
3195 
3196 end:
3197  av_frame_free(&frame);
3198  av_packet_free(&pkt);
3199  if (ret < 0) {
3200  av_log(NULL, AV_LOG_ERROR, "Could not read packets in interval ");
3201  log_read_interval(interval, NULL, AV_LOG_ERROR);
3202  }
3203  return ret;
3204 }
3205 
3207 {
3208  AVFormatContext *fmt_ctx = ifile->fmt_ctx;
3209  int i, ret = 0;
3210  int64_t cur_ts = fmt_ctx->start_time;
3211 
3212  if (read_intervals_nb == 0) {
3213  ReadInterval interval = (ReadInterval) { .has_start = 0, .has_end = 0 };
3214  ret = read_interval_packets(w, ifile, &interval, &cur_ts);
3215  } else {
3216  for (i = 0; i < read_intervals_nb; i++) {
3217  ret = read_interval_packets(w, ifile, &read_intervals[i], &cur_ts);
3218  if (ret < 0)
3219  break;
3220  }
3221  }
3222 
3223  return ret;
3224 }
3225 
3226 static void print_dispositions(WriterContext *w, uint32_t disposition, SectionID section_id)
3227 {
3228  writer_print_section_header(w, NULL, section_id);
3229  for (int i = 0; i < sizeof(disposition) * CHAR_BIT; i++) {
3230  const char *disposition_str = av_disposition_to_string(1U << i);
3231 
3232  if (disposition_str)
3233  print_int(disposition_str, !!(disposition & (1U << i)));
3234  }
3236 }
3237 
3238 #define IN_PROGRAM 1
3239 #define IN_STREAM_GROUP 2
3240 
3241 static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_idx, InputStream *ist, int container)
3242 {
3243  AVStream *stream = ist->st;
3244  AVCodecParameters *par;
3246  char val_str[128];
3247  const char *s;
3248  AVRational sar, dar;
3249  AVBPrint pbuf;
3250  const AVCodecDescriptor *cd;
3251  const SectionID section_header[] = {
3255  };
3256  const SectionID section_disposition[] = {
3260  };
3261  const SectionID section_tags[] = {
3265  };
3266  int ret = 0;
3267  const char *profile = NULL;
3268 
3269  av_assert0(container < FF_ARRAY_ELEMS(section_header));
3270 
3272 
3273  writer_print_section_header(w, NULL, section_header[container]);
3274 
3275  print_int("index", stream->index);
3276 
3277  par = stream->codecpar;
3278  dec_ctx = ist->dec_ctx;
3279  if (cd = avcodec_descriptor_get(par->codec_id)) {
3280  print_str("codec_name", cd->name);
3281  if (!do_bitexact) {
3282  print_str("codec_long_name",
3283  cd->long_name ? cd->long_name : "unknown");
3284  }
3285  } else {
3286  print_str_opt("codec_name", "unknown");
3287  if (!do_bitexact) {
3288  print_str_opt("codec_long_name", "unknown");
3289  }
3290  }
3291 
3292  if (!do_bitexact && (profile = avcodec_profile_name(par->codec_id, par->profile)))
3293  print_str("profile", profile);
3294  else {
3295  if (par->profile != AV_PROFILE_UNKNOWN) {
3296  char profile_num[12];
3297  snprintf(profile_num, sizeof(profile_num), "%d", par->profile);
3298  print_str("profile", profile_num);
3299  } else
3300  print_str_opt("profile", "unknown");
3301  }
3302 
3304  if (s) print_str ("codec_type", s);
3305  else print_str_opt("codec_type", "unknown");
3306 
3307  /* print AVI/FourCC tag */
3308  print_str("codec_tag_string", av_fourcc2str(par->codec_tag));
3309  print_fmt("codec_tag", "0x%04"PRIx32, par->codec_tag);
3310 
3311  switch (par->codec_type) {
3312  case AVMEDIA_TYPE_VIDEO:
3313  print_int("width", par->width);
3314  print_int("height", par->height);
3315  if (dec_ctx) {
3316  print_int("coded_width", dec_ctx->coded_width);
3317  print_int("coded_height", dec_ctx->coded_height);
3320  }
3321  print_int("has_b_frames", par->video_delay);
3322  sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, NULL);
3323  if (sar.num) {
3324  print_q("sample_aspect_ratio", sar, ':');
3325  av_reduce(&dar.num, &dar.den,
3326  par->width * sar.num,
3327  par->height * sar.den,
3328  1024*1024);
3329  print_q("display_aspect_ratio", dar, ':');
3330  } else {
3331  print_str_opt("sample_aspect_ratio", "N/A");
3332  print_str_opt("display_aspect_ratio", "N/A");
3333  }
3334  s = av_get_pix_fmt_name(par->format);
3335  if (s) print_str ("pix_fmt", s);
3336  else print_str_opt("pix_fmt", "unknown");
3337  print_int("level", par->level);
3338 
3341  print_color_trc(w, par->color_trc);
3344 
3345  if (par->field_order == AV_FIELD_PROGRESSIVE)
3346  print_str("field_order", "progressive");
3347  else if (par->field_order == AV_FIELD_TT)
3348  print_str("field_order", "tt");
3349  else if (par->field_order == AV_FIELD_BB)
3350  print_str("field_order", "bb");
3351  else if (par->field_order == AV_FIELD_TB)
3352  print_str("field_order", "tb");
3353  else if (par->field_order == AV_FIELD_BT)
3354  print_str("field_order", "bt");
3355  else
3356  print_str_opt("field_order", "unknown");
3357 
3358  if (dec_ctx)
3359  print_int("refs", dec_ctx->refs);
3360  break;
3361 
3362  case AVMEDIA_TYPE_AUDIO:
3364  if (s) print_str ("sample_fmt", s);
3365  else print_str_opt("sample_fmt", "unknown");
3366  print_val("sample_rate", par->sample_rate, unit_hertz_str);
3367  print_int("channels", par->ch_layout.nb_channels);
3368 
3369  if (par->ch_layout.order != AV_CHANNEL_ORDER_UNSPEC) {
3370  av_channel_layout_describe(&par->ch_layout, val_str, sizeof(val_str));
3371  print_str ("channel_layout", val_str);
3372  } else {
3373  print_str_opt("channel_layout", "unknown");
3374  }
3375 
3376  print_int("bits_per_sample", av_get_bits_per_sample(par->codec_id));
3377 
3378  print_int("initial_padding", par->initial_padding);
3379  break;
3380 
3381  case AVMEDIA_TYPE_SUBTITLE:
3382  if (par->width)
3383  print_int("width", par->width);
3384  else
3385  print_str_opt("width", "N/A");
3386  if (par->height)
3387  print_int("height", par->height);
3388  else
3389  print_str_opt("height", "N/A");
3390  break;
3391  }
3392 
3393  if (show_private_data) {
3394  if (dec_ctx && dec_ctx->codec->priv_class)
3396  if (fmt_ctx->iformat->priv_class)
3398  }
3399 
3400  if (fmt_ctx->iformat->flags & AVFMT_SHOW_IDS) print_fmt ("id", "0x%x", stream->id);
3401  else print_str_opt("id", "N/A");
3402  print_q("r_frame_rate", stream->r_frame_rate, '/');
3403  print_q("avg_frame_rate", stream->avg_frame_rate, '/');
3404  print_q("time_base", stream->time_base, '/');
3405  print_ts ("start_pts", stream->start_time);
3406  print_time("start_time", stream->start_time, &stream->time_base);
3407  print_ts ("duration_ts", stream->duration);
3408  print_time("duration", stream->duration, &stream->time_base);
3409  if (par->bit_rate > 0) print_val ("bit_rate", par->bit_rate, unit_bit_per_second_str);
3410  else print_str_opt("bit_rate", "N/A");
3411  if (dec_ctx && dec_ctx->rc_max_rate > 0)
3413  else
3414  print_str_opt("max_bit_rate", "N/A");
3415  if (dec_ctx && dec_ctx->bits_per_raw_sample > 0) print_fmt("bits_per_raw_sample", "%d", dec_ctx->bits_per_raw_sample);
3416  else print_str_opt("bits_per_raw_sample", "N/A");
3417  if (stream->nb_frames) print_fmt ("nb_frames", "%"PRId64, stream->nb_frames);
3418  else print_str_opt("nb_frames", "N/A");
3419  if (nb_streams_frames[stream_idx]) print_fmt ("nb_read_frames", "%"PRIu64, nb_streams_frames[stream_idx]);
3420  else print_str_opt("nb_read_frames", "N/A");
3421  if (nb_streams_packets[stream_idx]) print_fmt ("nb_read_packets", "%"PRIu64, nb_streams_packets[stream_idx]);
3422  else print_str_opt("nb_read_packets", "N/A");
3423  if (do_show_data)
3424  writer_print_data(w, "extradata", par->extradata,
3425  par->extradata_size);
3426 
3427  if (par->extradata_size > 0) {
3428  print_int("extradata_size", par->extradata_size);
3429  writer_print_data_hash(w, "extradata_hash", par->extradata,
3430  par->extradata_size);
3431  }
3432 
3433  /* Print disposition information */
3435  av_assert0(container < FF_ARRAY_ELEMS(section_disposition));
3436  print_dispositions(w, stream->disposition, section_disposition[container]);
3437  }
3438 
3439  if (do_show_stream_tags) {
3440  av_assert0(container < FF_ARRAY_ELEMS(section_tags));
3441  ret = show_tags(w, stream->metadata, section_tags[container]);
3442  }
3443 
3444  if (stream->codecpar->nb_coded_side_data) {
3446  for (int i = 0; i < stream->codecpar->nb_coded_side_data; i++) {
3447  print_pkt_side_data(w, stream->codecpar, &stream->codecpar->coded_side_data[i],
3450  }
3452  }
3453 
3455  av_bprint_finalize(&pbuf, NULL);
3456  fflush(stdout);
3457 
3458  return ret;
3459 }
3460 
3462 {
3463  AVFormatContext *fmt_ctx = ifile->fmt_ctx;
3464  int i, ret = 0;
3465 
3467  for (i = 0; i < ifile->nb_streams; i++)
3468  if (selected_streams[i]) {
3469  ret = show_stream(w, fmt_ctx, i, &ifile->streams[i], 0);
3470  if (ret < 0)
3471  break;
3472  }
3474 
3475  return ret;
3476 }
3477 
3479 {
3480  AVFormatContext *fmt_ctx = ifile->fmt_ctx;
3481  int i, ret = 0;
3482 
3484  print_int("program_id", program->id);
3485  print_int("program_num", program->program_num);
3486  print_int("nb_streams", program->nb_stream_indexes);
3487  print_int("pmt_pid", program->pmt_pid);
3488  print_int("pcr_pid", program->pcr_pid);
3491  if (ret < 0)
3492  goto end;
3493 
3495  for (i = 0; i < program->nb_stream_indexes; i++) {
3496  if (selected_streams[program->stream_index[i]]) {
3497  ret = show_stream(w, fmt_ctx, program->stream_index[i], &ifile->streams[program->stream_index[i]], IN_PROGRAM);
3498  if (ret < 0)
3499  break;
3500  }
3501  }
3503 
3504 end:
3506  return ret;
3507 }
3508 
3510 {
3511  AVFormatContext *fmt_ctx = ifile->fmt_ctx;
3512  int i, ret = 0;
3513 
3515  for (i = 0; i < fmt_ctx->nb_programs; i++) {
3517  if (!program)
3518  continue;
3519  ret = show_program(w, ifile, program);
3520  if (ret < 0)
3521  break;
3522  }
3524  return ret;
3525 }
3526 
3528  const AVStreamGroupTileGrid *tile_grid)
3529 {
3531  print_int("nb_tiles", tile_grid->nb_tiles);
3532  print_int("coded_width", tile_grid->coded_width);
3533  print_int("coded_height", tile_grid->coded_height);
3534  print_int("horizontal_offset", tile_grid->horizontal_offset);
3535  print_int("vertical_offset", tile_grid->vertical_offset);
3536  print_int("width", tile_grid->width);
3537  print_int("height", tile_grid->height);
3539  for (int i = 0; i < tile_grid->nb_tiles; i++) {
3541  print_int("stream_index", tile_grid->offsets[i].idx);
3542  print_int("tile_horizontal_offset", tile_grid->offsets[i].horizontal);
3543  print_int("tile_vertical_offset", tile_grid->offsets[i].vertical);
3545  }
3548 }
3549 
3551  const AVIAMFParamDefinition *param, SectionID section_id)
3552 {
3553  SectionID subsection_id, parameter_section_id;
3554  subsection_id = sections[section_id].children_ids[0];
3555  av_assert0(subsection_id != -1);
3556  parameter_section_id = sections[subsection_id].children_ids[0];
3557  av_assert0(parameter_section_id != -1);
3558  writer_print_section_header(w, "IAMF Param Definition", section_id);
3559  print_str("name", name);
3560  print_int("nb_subblocks", param->nb_subblocks);
3561  print_int("type", param->type);
3562  print_int("parameter_id", param->parameter_id);
3563  print_int("parameter_rate", param->parameter_rate);
3564  print_int("duration", param->duration);
3565  print_int("constant_subblock_duration", param->constant_subblock_duration);
3566  if (param->nb_subblocks > 0)
3567  writer_print_section_header(w, NULL, subsection_id);
3568  for (int i = 0; i < param->nb_subblocks; i++) {
3569  const void *subblock = av_iamf_param_definition_get_subblock(param, i);
3570  switch(param->type) {
3572  const AVIAMFMixGain *mix = subblock;
3573  writer_print_section_header(w, "IAMF Mix Gain Parameters", parameter_section_id);
3574  print_int("subblock_duration", mix->subblock_duration);
3575  print_int("animation_type", mix->animation_type);
3576  print_q("start_point_value", mix->start_point_value, '/');
3577  print_q("end_point_value", mix->end_point_value, '/');
3578  print_q("control_point_value", mix->control_point_value, '/');
3579  print_q("control_point_relative_time", mix->control_point_relative_time, '/');
3580  writer_print_section_footer(w); // parameter_section_id
3581  break;
3582  }
3584  const AVIAMFDemixingInfo *demix = subblock;
3585  writer_print_section_header(w, "IAMF Demixing Info", parameter_section_id);
3586  print_int("subblock_duration", demix->subblock_duration);
3587  print_int("dmixp_mode", demix->dmixp_mode);
3588  writer_print_section_footer(w); // parameter_section_id
3589  break;
3590  }
3592  const AVIAMFReconGain *recon = subblock;
3593  writer_print_section_header(w, "IAMF Recon Gain", parameter_section_id);
3594  print_int("subblock_duration", recon->subblock_duration);
3595  writer_print_section_footer(w); // parameter_section_id
3596  break;
3597  }
3598  }
3599  }
3600  if (param->nb_subblocks > 0)
3601  writer_print_section_footer(w); // subsection_id
3602  writer_print_section_footer(w); // section_id
3603 }
3604 
3606  const AVIAMFAudioElement *audio_element)
3607 {
3609  print_int("nb_layers", audio_element->nb_layers);
3610  print_int("audio_element_type", audio_element->audio_element_type);
3611  print_int("default_w", audio_element->default_w);
3613  for (int i = 0; i < audio_element->nb_layers; i++) {
3614  const AVIAMFLayer *layer = audio_element->layers[i];
3615  char val_str[128];
3617  av_channel_layout_describe(&layer->ch_layout, val_str, sizeof(val_str));
3618  print_str("channel_layout", val_str);
3620  print_int("output_gain_flags", layer->output_gain_flags);
3621  print_q("output_gain", layer->output_gain, '/');
3622  } else if (audio_element->audio_element_type == AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE)
3623  print_int("ambisonics_mode", layer->ambisonics_mode);
3624  writer_print_section_footer(w); // SECTION_ID_STREAM_GROUP_SUBCOMPONENT
3625  }
3626  if (audio_element->demixing_info)
3627  print_iamf_param_definition(w, "demixing_info", audio_element->demixing_info,
3629  if (audio_element->recon_gain_info)
3630  print_iamf_param_definition(w, "recon_gain_info", audio_element->recon_gain_info,
3632  writer_print_section_footer(w); // SECTION_ID_STREAM_GROUP_SUBCOMPONENTS
3633  writer_print_section_footer(w); // SECTION_ID_STREAM_GROUP_COMPONENT
3634 }
3635 
3637 {
3639  print_int("nb_elements", submix->nb_elements);
3640  print_int("nb_layouts", submix->nb_layouts);
3641  print_q("default_mix_gain", submix->default_mix_gain, '/');
3643  for (int i = 0; i < submix->nb_elements; i++) {
3644  const AVIAMFSubmixElement *element = submix->elements[i];
3646  print_int("stream_id", element->audio_element_id);
3647  print_q("default_mix_gain", element->default_mix_gain, '/');
3648  print_int("headphones_rendering_mode", element->headphones_rendering_mode);
3650  if (element->annotations) {
3651  const AVDictionaryEntry *annotation = NULL;
3653  while (annotation = av_dict_iterate(element->annotations, annotation))
3654  print_str(annotation->key, annotation->value);
3655  writer_print_section_footer(w); // SECTION_ID_STREAM_GROUP_SUBPIECE
3656  }
3657  if (element->element_mix_config)
3658  print_iamf_param_definition(w, "element_mix_config", element->element_mix_config,
3660  writer_print_section_footer(w); // SECTION_ID_STREAM_GROUP_SUBPIECES
3661  writer_print_section_footer(w); // SECTION_ID_STREAM_GROUP_PIECE
3662  }
3663  if (submix->output_mix_config)
3664  print_iamf_param_definition(w, "output_mix_config", submix->output_mix_config,
3666  for (int i = 0; i < submix->nb_layouts; i++) {
3667  const AVIAMFSubmixLayout *layout = submix->layouts[i];
3668  char val_str[128];
3670  av_channel_layout_describe(&layout->sound_system, val_str, sizeof(val_str));
3671  print_str("sound_system", val_str);
3672  print_q("integrated_loudness", layout->integrated_loudness, '/');
3673  print_q("digital_peak", layout->digital_peak, '/');
3674  print_q("true_peak", layout->true_peak, '/');
3675  print_q("dialogue_anchored_loudness", layout->dialogue_anchored_loudness, '/');
3676  print_q("album_anchored_loudness", layout->album_anchored_loudness, '/');
3677  writer_print_section_footer(w); // SECTION_ID_STREAM_GROUP_PIECE
3678  }
3679  writer_print_section_footer(w); // SECTION_ID_STREAM_GROUP_PIECES
3680  writer_print_section_footer(w); // SECTION_ID_STREAM_GROUP_SUBCOMPONENT
3681 }
3682 
3684  const AVIAMFMixPresentation *mix_presentation)
3685 {
3687  print_int("nb_submixes", mix_presentation->nb_submixes);
3689  if (mix_presentation->annotations) {
3690  const AVDictionaryEntry *annotation = NULL;
3692  while (annotation = av_dict_iterate(mix_presentation->annotations, annotation))
3693  print_str(annotation->key, annotation->value);
3694  writer_print_section_footer(w); // SECTION_ID_STREAM_GROUP_SUBCOMPONENT
3695  }
3696  for (int i = 0; i < mix_presentation->nb_submixes; i++)
3697  print_iamf_submix_params(w, mix_presentation->submixes[i]);
3698  writer_print_section_footer(w); // SECTION_ID_STREAM_GROUP_SUBCOMPONENTS
3699  writer_print_section_footer(w); // SECTION_ID_STREAM_GROUP_COMPONENT
3700 }
3701 
3703 {
3711  writer_print_section_footer(w); // SECTION_ID_STREAM_GROUP_COMPONENTS
3712 }
3713 
3715 {
3716  AVFormatContext *fmt_ctx = ifile->fmt_ctx;
3717  AVBPrint pbuf;
3718  int i, ret = 0;
3719 
3722  print_int("index", stg->index);
3723  if (fmt_ctx->iformat->flags & AVFMT_SHOW_IDS) print_fmt ("id", "0x%"PRIx64, stg->id);
3724  else print_str_opt("id", "N/A");
3725  print_int("nb_streams", stg->nb_streams);
3726  if (stg->type != AV_STREAM_GROUP_PARAMS_NONE)
3727  print_str("type", av_x_if_null(avformat_stream_group_name(stg->type), "unknown"));
3728  else
3729  print_str_opt("type", "unknown");
3732 
3733  /* Print disposition information */
3736 
3739  if (ret < 0)
3740  goto end;
3741 
3743  for (i = 0; i < stg->nb_streams; i++) {
3744  if (selected_streams[stg->streams[i]->index]) {
3745  ret = show_stream(w, fmt_ctx, stg->streams[i]->index, &ifile->streams[stg->streams[i]->index], IN_STREAM_GROUP);
3746  if (ret < 0)
3747  break;
3748  }
3749  }
3751 
3752 end:
3753  av_bprint_finalize(&pbuf, NULL);
3755  return ret;
3756 }
3757 
3759 {
3760  AVFormatContext *fmt_ctx = ifile->fmt_ctx;
3761  int i, ret = 0;
3762 
3764  for (i = 0; i < fmt_ctx->nb_stream_groups; i++) {
3766 
3767  ret = show_stream_group(w, ifile, stg);
3768  if (ret < 0)
3769  break;
3770  }
3772  return ret;
3773 }
3774 
3776 {
3777  AVFormatContext *fmt_ctx = ifile->fmt_ctx;
3778  int i, ret = 0;
3779 
3781  for (i = 0; i < fmt_ctx->nb_chapters; i++) {
3782  AVChapter *chapter = fmt_ctx->chapters[i];
3783 
3785  print_int("id", chapter->id);
3786  print_q ("time_base", chapter->time_base, '/');
3787  print_int("start", chapter->start);
3788  print_time("start_time", chapter->start, &chapter->time_base);
3789  print_int("end", chapter->end);
3790  print_time("end_time", chapter->end, &chapter->time_base);
3794  }
3796 
3797  return ret;
3798 }
3799 
3800 static int show_format(WriterContext *w, InputFile *ifile)
3801 {
3802  AVFormatContext *fmt_ctx = ifile->fmt_ctx;
3803  char val_str[128];
3804  int64_t size = fmt_ctx->pb ? avio_size(fmt_ctx->pb) : -1;
3805  int ret = 0;
3806 
3808  print_str_validate("filename", fmt_ctx->url);
3809  print_int("nb_streams", fmt_ctx->nb_streams);
3810  print_int("nb_programs", fmt_ctx->nb_programs);
3811  print_int("nb_stream_groups", fmt_ctx->nb_stream_groups);
3812  print_str("format_name", fmt_ctx->iformat->name);
3813  if (!do_bitexact) {
3814  if (fmt_ctx->iformat->long_name) print_str ("format_long_name", fmt_ctx->iformat->long_name);
3815  else print_str_opt("format_long_name", "unknown");
3816  }
3817  print_time("start_time", fmt_ctx->start_time, &AV_TIME_BASE_Q);
3818  print_time("duration", fmt_ctx->duration, &AV_TIME_BASE_Q);
3819  if (size >= 0) print_val ("size", size, unit_byte_str);
3820  else print_str_opt("size", "N/A");
3822  else print_str_opt("bit_rate", "N/A");
3823  print_int("probe_score", fmt_ctx->probe_score);
3824  if (do_show_format_tags)
3826 
3828  fflush(stdout);
3829  return ret;
3830 }
3831 
3832 static void show_error(WriterContext *w, int err)
3833 {
3835  print_int("code", err);
3836  print_str("string", av_err2str(err));
3838 }
3839 
3840 static int open_input_file(InputFile *ifile, const char *filename,
3841  const char *print_filename)
3842 {
3843  int err, i;
3845  const AVDictionaryEntry *t = NULL;
3846  int scan_all_pmts_set = 0;
3847 
3849  if (!fmt_ctx)
3850  return AVERROR(ENOMEM);
3851 
3852  if (!av_dict_get(format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE)) {
3853  av_dict_set(&format_opts, "scan_all_pmts", "1", AV_DICT_DONT_OVERWRITE);
3854  scan_all_pmts_set = 1;
3855  }
3856  if ((err = avformat_open_input(&fmt_ctx, filename,
3857  iformat, &format_opts)) < 0) {
3858  print_error(filename, err);
3859  return err;
3860  }
3861  if (print_filename) {
3862  av_freep(&fmt_ctx->url);
3863  fmt_ctx->url = av_strdup(print_filename);
3864  }
3865  ifile->fmt_ctx = fmt_ctx;
3866  if (scan_all_pmts_set)
3867  av_dict_set(&format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE);
3868  while ((t = av_dict_iterate(format_opts, t)))
3869  av_log(NULL, AV_LOG_WARNING, "Option %s skipped - not known to demuxer.\n", t->key);
3870 
3871  if (find_stream_info) {
3872  AVDictionary **opts;
3873  int orig_nb_streams = fmt_ctx->nb_streams;
3874 
3876  if (err < 0)
3877  return err;
3878 
3880 
3881  for (i = 0; i < orig_nb_streams; i++)
3882  av_dict_free(&opts[i]);
3883  av_freep(&opts);
3884 
3885  if (err < 0) {
3886  print_error(filename, err);
3887  return err;
3888  }
3889  }
3890 
3891  av_dump_format(fmt_ctx, 0, filename, 0);
3892 
3893  ifile->streams = av_calloc(fmt_ctx->nb_streams, sizeof(*ifile->streams));
3894  if (!ifile->streams)
3895  exit(1);
3896  ifile->nb_streams = fmt_ctx->nb_streams;
3897 
3898  /* bind a decoder to each input stream */
3899  for (i = 0; i < fmt_ctx->nb_streams; i++) {
3900  InputStream *ist = &ifile->streams[i];
3901  AVStream *stream = fmt_ctx->streams[i];
3902  const AVCodec *codec;
3903 
3904  ist->st = stream;
3905 
3906  if (stream->codecpar->codec_id == AV_CODEC_ID_PROBE) {
3908  "Failed to probe codec for input stream %d\n",
3909  stream->index);
3910  continue;
3911  }
3912 
3913  codec = avcodec_find_decoder(stream->codecpar->codec_id);
3914  if (!codec) {
3916  "Unsupported codec with id %d for input stream %d\n",
3917  stream->codecpar->codec_id, stream->index);
3918  continue;
3919  }
3920  {
3921  AVDictionary *opts;
3922 
3924  fmt_ctx, stream, codec, &opts);
3925  if (err < 0)
3926  exit(1);
3927 
3928  ist->dec_ctx = avcodec_alloc_context3(codec);
3929  if (!ist->dec_ctx)
3930  exit(1);
3931 
3932  err = avcodec_parameters_to_context(ist->dec_ctx, stream->codecpar);
3933  if (err < 0)
3934  exit(1);
3935 
3936  if (do_show_log) {
3937  // For loging it is needed to disable at least frame threads as otherwise
3938  // the log information would need to be reordered and matches up to contexts and frames
3939  // That is in fact possible but not trivial
3940  av_dict_set(&codec_opts, "threads", "1", 0);
3941  }
3942 
3943  av_dict_set(&opts, "flags", "+copy_opaque", AV_DICT_MULTIKEY);
3944 
3945  ist->dec_ctx->pkt_timebase = stream->time_base;
3946 
3947  if (avcodec_open2(ist->dec_ctx, codec, &opts) < 0) {
3948  av_log(NULL, AV_LOG_WARNING, "Could not open codec for input stream %d\n",
3949  stream->index);
3950  exit(1);
3951  }
3952 
3953  if ((t = av_dict_get(opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
3954  av_log(NULL, AV_LOG_ERROR, "Option %s for input stream %d not found\n",
3955  t->key, stream->index);
3956  return AVERROR_OPTION_NOT_FOUND;
3957  }
3958  }
3959  }
3960 
3961  ifile->fmt_ctx = fmt_ctx;
3962  return 0;
3963 }
3964 
3965 static void close_input_file(InputFile *ifile)
3966 {
3967  int i;
3968 
3969  /* close decoder for each stream */
3970  for (i = 0; i < ifile->nb_streams; i++)
3972 
3973  av_freep(&ifile->streams);
3974  ifile->nb_streams = 0;
3975 
3976  avformat_close_input(&ifile->fmt_ctx);
3977 }
3978 
3979 static int probe_file(WriterContext *wctx, const char *filename,
3980  const char *print_filename)
3981 {
3982  InputFile ifile = { 0 };
3983  int ret, i;
3984  int section_id;
3985 
3988 
3989  ret = open_input_file(&ifile, filename, print_filename);
3990  if (ret < 0)
3991  goto end;
3992 
3993 #define CHECK_END if (ret < 0) goto end
3994 
3995  nb_streams = ifile.fmt_ctx->nb_streams;
3999 
4000  for (i = 0; i < ifile.fmt_ctx->nb_streams; i++) {
4001  if (stream_specifier) {
4003  ifile.fmt_ctx->streams[i],
4005  CHECK_END;
4006  else
4007  selected_streams[i] = ret;
4008  ret = 0;
4009  } else {
4010  selected_streams[i] = 1;
4011  }
4012  if (!selected_streams[i])
4013  ifile.fmt_ctx->streams[i]->discard = AVDISCARD_ALL;
4014  }
4015 
4019  section_id = SECTION_ID_PACKETS_AND_FRAMES;
4020  else if (do_show_packets && !do_show_frames)
4021  section_id = SECTION_ID_PACKETS;
4022  else // (!do_show_packets && do_show_frames)
4023  section_id = SECTION_ID_FRAMES;
4025  writer_print_section_header(wctx, NULL, section_id);
4026  ret = read_packets(wctx, &ifile);
4029  CHECK_END;
4030  }
4031 
4032  if (do_show_programs) {
4033  ret = show_programs(wctx, &ifile);
4034  CHECK_END;
4035  }
4036 
4037  if (do_show_stream_groups) {
4038  ret = show_stream_groups(wctx, &ifile);
4039  CHECK_END;
4040  }
4041 
4042  if (do_show_streams) {
4043  ret = show_streams(wctx, &ifile);
4044  CHECK_END;
4045  }
4046  if (do_show_chapters) {
4047  ret = show_chapters(wctx, &ifile);
4048  CHECK_END;
4049  }
4050  if (do_show_format) {
4051  ret = show_format(wctx, &ifile);
4052  CHECK_END;
4053  }
4054 
4055 end:
4056  if (ifile.fmt_ctx)
4057  close_input_file(&ifile);
4061 
4062  return ret;
4063 }
4064 
4065 static void show_usage(void)
4066 {
4067  av_log(NULL, AV_LOG_INFO, "Simple multimedia streams analyzer\n");
4068  av_log(NULL, AV_LOG_INFO, "usage: %s [OPTIONS] INPUT_FILE\n", program_name);
4069  av_log(NULL, AV_LOG_INFO, "\n");
4070 }
4071 
4073 {
4074  AVBPrint pbuf;
4076 
4078  print_str("version", FFMPEG_VERSION);
4079  print_fmt("copyright", "Copyright (c) %d-%d the FFmpeg developers",
4080  program_birth_year, CONFIG_THIS_YEAR);
4081  print_str("compiler_ident", CC_IDENT);
4082  print_str("configuration", FFMPEG_CONFIGURATION);
4084 
4085  av_bprint_finalize(&pbuf, NULL);
4086 }
4087 
4088 #define SHOW_LIB_VERSION(libname, LIBNAME) \
4089  do { \
4090  if (CONFIG_##LIBNAME) { \
4091  unsigned int version = libname##_version(); \
4092  writer_print_section_header(w, NULL, SECTION_ID_LIBRARY_VERSION); \
4093  print_str("name", "lib" #libname); \
4094  print_int("major", LIB##LIBNAME##_VERSION_MAJOR); \
4095  print_int("minor", LIB##LIBNAME##_VERSION_MINOR); \
4096  print_int("micro", LIB##LIBNAME##_VERSION_MICRO); \
4097  print_int("version", version); \
4098  print_str("ident", LIB##LIBNAME##_IDENT); \
4099  writer_print_section_footer(w); \
4100  } \
4101  } while (0)
4102 
4104 {
4106  SHOW_LIB_VERSION(avutil, AVUTIL);
4107  SHOW_LIB_VERSION(avcodec, AVCODEC);
4108  SHOW_LIB_VERSION(avformat, AVFORMAT);
4109  SHOW_LIB_VERSION(avdevice, AVDEVICE);
4110  SHOW_LIB_VERSION(avfilter, AVFILTER);
4111  SHOW_LIB_VERSION(swscale, SWSCALE);
4112  SHOW_LIB_VERSION(swresample, SWRESAMPLE);
4113  SHOW_LIB_VERSION(postproc, POSTPROC);
4115 }
4116 
4117 #define PRINT_PIX_FMT_FLAG(flagname, name) \
4118  do { \
4119  print_int(name, !!(pixdesc->flags & AV_PIX_FMT_FLAG_##flagname)); \
4120  } while (0)
4121 
4123 {
4124  const AVPixFmtDescriptor *pixdesc = NULL;
4125  int i, n;
4126 
4128  while (pixdesc = av_pix_fmt_desc_next(pixdesc)) {
4130  print_str("name", pixdesc->name);
4131  print_int("nb_components", pixdesc->nb_components);
4132  if ((pixdesc->nb_components >= 3) && !(pixdesc->flags & AV_PIX_FMT_FLAG_RGB)) {
4133  print_int ("log2_chroma_w", pixdesc->log2_chroma_w);
4134  print_int ("log2_chroma_h", pixdesc->log2_chroma_h);
4135  } else {
4136  print_str_opt("log2_chroma_w", "N/A");
4137  print_str_opt("log2_chroma_h", "N/A");
4138  }
4139  n = av_get_bits_per_pixel(pixdesc);
4140  if (n) print_int ("bits_per_pixel", n);
4141  else print_str_opt("bits_per_pixel", "N/A");
4144  PRINT_PIX_FMT_FLAG(BE, "big_endian");
4145  PRINT_PIX_FMT_FLAG(PAL, "palette");
4146  PRINT_PIX_FMT_FLAG(BITSTREAM, "bitstream");
4147  PRINT_PIX_FMT_FLAG(HWACCEL, "hwaccel");
4148  PRINT_PIX_FMT_FLAG(PLANAR, "planar");
4149  PRINT_PIX_FMT_FLAG(RGB, "rgb");
4150  PRINT_PIX_FMT_FLAG(ALPHA, "alpha");
4152  }
4153  if (do_show_pixel_format_components && (pixdesc->nb_components > 0)) {
4155  for (i = 0; i < pixdesc->nb_components; i++) {
4157  print_int("index", i + 1);
4158  print_int("bit_depth", pixdesc->comp[i].depth);
4160  }
4162  }
4164  }
4166 }
4167 
4168 static int opt_show_optional_fields(void *optctx, const char *opt, const char *arg)
4169 {
4173 
4175  double num;
4176  int ret = parse_number("show_optional_fields", arg, OPT_TYPE_INT,
4178  if (ret < 0)
4179  return ret;
4180  show_optional_fields = num;
4181  }
4182  return 0;
4183 }
4184 
4185 static int opt_format(void *optctx, const char *opt, const char *arg)
4186 {
4188  if (!iformat) {
4189  av_log(NULL, AV_LOG_ERROR, "Unknown input format: %s\n", arg);
4190  return AVERROR(EINVAL);
4191  }
4192  return 0;
4193 }
4194 
4195 static inline void mark_section_show_entries(SectionID section_id,
4196  int show_all_entries, AVDictionary *entries)
4197 {
4198  struct section *section = &sections[section_id];
4199 
4201  if (show_all_entries) {
4202  for (const SectionID *id = section->children_ids; *id != -1; id++)
4204  } else {
4205  av_dict_copy(&section->entries_to_show, entries, 0);
4206  }
4207 }
4208 
4209 static int match_section(const char *section_name,
4210  int show_all_entries, AVDictionary *entries)
4211 {
4212  int i, ret = 0;
4213 
4214  for (i = 0; i < FF_ARRAY_ELEMS(sections); i++) {
4215  const struct section *section = &sections[i];
4216  if (!strcmp(section_name, section->name) ||
4217  (section->unique_name && !strcmp(section_name, section->unique_name))) {
4219  "'%s' matches section with unique name '%s'\n", section_name,
4221  ret++;
4223  }
4224  }
4225  return ret;
4226 }
4227 
4228 static int opt_show_entries(void *optctx, const char *opt, const char *arg)
4229 {
4230  const char *p = arg;
4231  int ret = 0;
4232 
4233  while (*p) {
4234  AVDictionary *entries = NULL;
4235  char *section_name = av_get_token(&p, "=:");
4236  int show_all_entries = 0;
4237 
4238  if (!section_name) {
4240  "Missing section name for option '%s'\n", opt);
4241  return AVERROR(EINVAL);
4242  }
4243 
4244  if (*p == '=') {
4245  p++;
4246  while (*p && *p != ':') {
4247  char *entry = av_get_token(&p, ",:");
4248  if (!entry)
4249  break;
4251  "Adding '%s' to the entries to show in section '%s'\n",
4252  entry, section_name);
4253  av_dict_set(&entries, entry, "", AV_DICT_DONT_STRDUP_KEY);
4254  if (*p == ',')
4255  p++;
4256  }
4257  } else {
4258  show_all_entries = 1;
4259  }
4260 
4261  ret = match_section(section_name, show_all_entries, entries);
4262  if (ret == 0) {
4263  av_log(NULL, AV_LOG_ERROR, "No match for section '%s'\n", section_name);
4264  ret = AVERROR(EINVAL);
4265  }
4266  av_dict_free(&entries);
4267  av_free(section_name);
4268 
4269  if (ret <= 0)
4270  break;
4271  if (*p)
4272  p++;
4273  }
4274 
4275  return ret;
4276 }
4277 
4278 static int opt_input_file(void *optctx, const char *arg)
4279 {
4280  if (input_filename) {
4282  "Argument '%s' provided as input filename, but '%s' was already specified.\n",
4283  arg, input_filename);
4284  return AVERROR(EINVAL);
4285  }
4286  if (!strcmp(arg, "-"))
4287  arg = "fd:";
4289  if (!input_filename)
4290  return AVERROR(ENOMEM);
4291 
4292  return 0;
4293 }
4294 
4295 static int opt_input_file_i(void *optctx, const char *opt, const char *arg)
4296 {
4297  opt_input_file(optctx, arg);
4298  return 0;
4299 }
4300 
4301 static int opt_output_file_o(void *optctx, const char *opt, const char *arg)
4302 {
4303  if (output_filename) {
4305  "Argument '%s' provided as output filename, but '%s' was already specified.\n",
4306  arg, output_filename);
4307  return AVERROR(EINVAL);
4308  }
4309  if (!strcmp(arg, "-"))
4310  arg = "fd:";
4312  if (!output_filename)
4313  return AVERROR(ENOMEM);
4314 
4315  return 0;
4316 }
4317 
4318 static int opt_print_filename(void *optctx, const char *opt, const char *arg)
4319 {
4322  return print_input_filename ? 0 : AVERROR(ENOMEM);
4323 }
4324 
4325 void show_help_default(const char *opt, const char *arg)
4326 {
4328  show_usage();
4329  show_help_options(options, "Main options:", 0, 0);
4330  printf("\n");
4331 
4334 }
4335 
4336 /**
4337  * Parse interval specification, according to the format:
4338  * INTERVAL ::= [START|+START_OFFSET][%[END|+END_OFFSET]]
4339  * INTERVALS ::= INTERVAL[,INTERVALS]
4340 */
4341 static int parse_read_interval(const char *interval_spec,
4342  ReadInterval *interval)
4343 {
4344  int ret = 0;
4345  char *next, *p, *spec = av_strdup(interval_spec);
4346  if (!spec)
4347  return AVERROR(ENOMEM);
4348 
4349  if (!*spec) {
4350  av_log(NULL, AV_LOG_ERROR, "Invalid empty interval specification\n");
4351  ret = AVERROR(EINVAL);
4352  goto end;
4353  }
4354 
4355  p = spec;
4356  next = strchr(spec, '%');
4357  if (next)
4358  *next++ = 0;
4359 
4360  /* parse first part */
4361  if (*p) {
4362  interval->has_start = 1;
4363 
4364  if (*p == '+') {
4365  interval->start_is_offset = 1;
4366  p++;
4367  } else {
4368  interval->start_is_offset = 0;
4369  }
4370 
4371  ret = av_parse_time(&interval->start, p, 1);
4372  if (ret < 0) {
4373  av_log(NULL, AV_LOG_ERROR, "Invalid interval start specification '%s'\n", p);
4374  goto end;
4375  }
4376  } else {
4377  interval->has_start = 0;
4378  }
4379 
4380  /* parse second part */
4381  p = next;
4382  if (p && *p) {
4383  int64_t us;
4384  interval->has_end = 1;
4385 
4386  if (*p == '+') {
4387  interval->end_is_offset = 1;
4388  p++;
4389  } else {
4390  interval->end_is_offset = 0;
4391  }
4392 
4393  if (interval->end_is_offset && *p == '#') {
4394  long long int lli;
4395  char *tail;
4396  interval->duration_frames = 1;
4397  p++;
4398  lli = strtoll(p, &tail, 10);
4399  if (*tail || lli < 0) {
4401  "Invalid or negative value '%s' for duration number of frames\n", p);
4402  goto end;
4403  }
4404  interval->end = lli;
4405  } else {
4406  interval->duration_frames = 0;
4407  ret = av_parse_time(&us, p, 1);
4408  if (ret < 0) {
4409  av_log(NULL, AV_LOG_ERROR, "Invalid interval end/duration specification '%s'\n", p);
4410  goto end;
4411  }
4412  interval->end = us;
4413  }
4414  } else {
4415  interval->has_end = 0;
4416  }
4417 
4418 end:
4419  av_free(spec);
4420  return ret;
4421 }
4422 
4423 static int parse_read_intervals(const char *intervals_spec)
4424 {
4425  int ret, n, i;
4426  char *p, *spec = av_strdup(intervals_spec);
4427  if (!spec)
4428  return AVERROR(ENOMEM);
4429 
4430  /* preparse specification, get number of intervals */
4431  for (n = 0, p = spec; *p; p++)
4432  if (*p == ',')
4433  n++;
4434  n++;
4435 
4437  if (!read_intervals) {
4438  ret = AVERROR(ENOMEM);
4439  goto end;
4440  }
4441  read_intervals_nb = n;
4442 
4443  /* parse intervals */
4444  p = spec;
4445  for (i = 0; p; i++) {
4446  char *next;
4447 
4449  next = strchr(p, ',');
4450  if (next)
4451  *next++ = 0;
4452 
4453  read_intervals[i].id = i;
4455  if (ret < 0) {
4456  av_log(NULL, AV_LOG_ERROR, "Error parsing read interval #%d '%s'\n",
4457  i, p);
4458  goto end;
4459  }
4460  av_log(NULL, AV_LOG_VERBOSE, "Parsed log interval ");
4462  p = next;
4463  }
4465 
4466 end:
4467  av_free(spec);
4468  return ret;
4469 }
4470 
4471 static int opt_read_intervals(void *optctx, const char *opt, const char *arg)
4472 {
4473  return parse_read_intervals(arg);
4474 }
4475 
4476 static int opt_pretty(void *optctx, const char *opt, const char *arg)
4477 {
4478  show_value_unit = 1;
4479  use_value_prefix = 1;
4482  return 0;
4483 }
4484 
4485 static void print_section(SectionID id, int level)
4486 {
4487  const SectionID *pid;
4488  const struct section *section = &sections[id];
4489  printf("%c%c%c%c",
4490  section->flags & SECTION_FLAG_IS_WRAPPER ? 'W' : '.',
4491  section->flags & SECTION_FLAG_IS_ARRAY ? 'A' : '.',
4493  section->flags & SECTION_FLAG_HAS_TYPE ? 'T' : '.');
4494  printf("%*c %s", level * 4, ' ', section->name);
4495  if (section->unique_name)
4496  printf("/%s", section->unique_name);
4497  printf("\n");
4498 
4499  for (pid = section->children_ids; *pid != -1; pid++)
4500  print_section(*pid, level+1);
4501 }
4502 
4503 static int opt_sections(void *optctx, const char *opt, const char *arg)
4504 {
4505  printf("Sections:\n"
4506  "W... = Section is a wrapper (contains other sections, no local entries)\n"
4507  ".A.. = Section contains an array of elements of the same type\n"
4508  "..V. = Section may contain a variable number of fields with variable keys\n"
4509  "...T = Section contain a unique type\n"
4510  "FLAGS NAME/UNIQUE_NAME\n"
4511  "----\n");
4513  return 0;
4514 }
4515 
4516 static int opt_show_versions(void *optctx, const char *opt, const char *arg)
4517 {
4520  return 0;
4521 }
4522 
4523 #define DEFINE_OPT_SHOW_SECTION(section, target_section_id) \
4524  static int opt_show_##section(void *optctx, const char *opt, const char *arg) \
4525  { \
4526  mark_section_show_entries(SECTION_ID_##target_section_id, 1, NULL); \
4527  return 0; \
4528  }
4529 
4530 DEFINE_OPT_SHOW_SECTION(chapters, CHAPTERS)
4534 DEFINE_OPT_SHOW_SECTION(library_versions, LIBRARY_VERSIONS)
4535 DEFINE_OPT_SHOW_SECTION(packets, PACKETS)
4536 DEFINE_OPT_SHOW_SECTION(pixel_formats, PIXEL_FORMATS)
4537 DEFINE_OPT_SHOW_SECTION(program_version, PROGRAM_VERSION)
4538 DEFINE_OPT_SHOW_SECTION(streams, STREAMS)
4539 DEFINE_OPT_SHOW_SECTION(programs, PROGRAMS)
4540 DEFINE_OPT_SHOW_SECTION(stream_groups, STREAM_GROUPS)
4541 
4542 static const OptionDef real_options[] = {
4544  { "f", OPT_TYPE_FUNC, OPT_FUNC_ARG, {.func_arg = opt_format}, "force format", "format" },
4545  { "unit", OPT_TYPE_BOOL, 0, {&show_value_unit}, "show unit of the displayed values" },
4546  { "prefix", OPT_TYPE_BOOL, 0, {&use_value_prefix}, "use SI prefixes for the displayed values" },
4547  { "byte_binary_prefix", OPT_TYPE_BOOL, 0, {&use_byte_value_binary_prefix},
4548  "use binary prefixes for byte units" },
4549  { "sexagesimal", OPT_TYPE_BOOL, 0, {&use_value_sexagesimal_format},
4550  "use sexagesimal format HOURS:MM:SS.MICROSECONDS for time units" },
4551  { "pretty", OPT_TYPE_FUNC, 0, {.func_arg = opt_pretty},
4552  "prettify the format of displayed values, make it more human readable" },
4553  { "output_format", OPT_TYPE_STRING, 0, { &output_format },
4554  "set the output printing format (available formats are: default, compact, csv, flat, ini, json, xml)", "format" },
4555  { "print_format", OPT_TYPE_STRING, 0, { &output_format }, "alias for -output_format (deprecated)" },
4556  { "of", OPT_TYPE_STRING, 0, { &output_format }, "alias for -output_format", "format" },
4557  { "select_streams", OPT_TYPE_STRING, 0, { &stream_specifier }, "select the specified streams", "stream_specifier" },
4558  { "sections", OPT_TYPE_FUNC, OPT_EXIT, {.func_arg = opt_sections}, "print sections structure and section information, and exit" },
4559  { "show_data", OPT_TYPE_BOOL, 0, { &do_show_data }, "show packets data" },
4560  { "show_data_hash", OPT_TYPE_STRING, 0, { &show_data_hash }, "show packets data hash" },
4561  { "show_error", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_error }, "show probing error" },
4562  { "show_format", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_format }, "show format/container info" },
4563  { "show_frames", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_frames }, "show frames info" },
4564  { "show_entries", OPT_TYPE_FUNC, OPT_FUNC_ARG, {.func_arg = opt_show_entries},
4565  "show a set of specified entries", "entry_list" },
4566 #if HAVE_THREADS
4567  { "show_log", OPT_TYPE_INT, 0, { &do_show_log }, "show log" },
4568 #endif
4569  { "show_packets", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_packets }, "show packets info" },
4570  { "show_programs", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_programs }, "show programs info" },
4571  { "show_stream_groups", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_stream_groups }, "show stream groups info" },
4572  { "show_streams", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_streams }, "show streams info" },
4573  { "show_chapters", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_chapters }, "show chapters info" },
4574  { "count_frames", OPT_TYPE_BOOL, 0, { &do_count_frames }, "count the number of frames per stream" },
4575  { "count_packets", OPT_TYPE_BOOL, 0, { &do_count_packets }, "count the number of packets per stream" },
4576  { "show_program_version", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_program_version }, "show ffprobe version" },
4577  { "show_library_versions", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_library_versions }, "show library versions" },
4578  { "show_versions", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_versions }, "show program and library versions" },
4579  { "show_pixel_formats", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_pixel_formats }, "show pixel format descriptions" },
4580  { "show_optional_fields", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = &opt_show_optional_fields }, "show optional fields" },
4581  { "show_private_data", OPT_TYPE_BOOL, 0, { &show_private_data }, "show private data" },
4582  { "private", OPT_TYPE_BOOL, 0, { &show_private_data }, "same as show_private_data" },
4583  { "bitexact", OPT_TYPE_BOOL, 0, {&do_bitexact}, "force bitexact output" },
4584  { "read_intervals", OPT_TYPE_FUNC, OPT_FUNC_ARG, {.func_arg = opt_read_intervals}, "set read intervals", "read_intervals" },
4585  { "i", OPT_TYPE_FUNC, OPT_FUNC_ARG, {.func_arg = opt_input_file_i}, "read specified file", "input_file"},
4586  { "o", OPT_TYPE_FUNC, OPT_FUNC_ARG, {.func_arg = opt_output_file_o}, "write to specified output", "output_file"},
4587  { "print_filename", OPT_TYPE_FUNC, OPT_FUNC_ARG, {.func_arg = opt_print_filename}, "override the printed input filename", "print_file"},
4588  { "find_stream_info", OPT_TYPE_BOOL, OPT_INPUT | OPT_EXPERT, { &find_stream_info },
4589  "read and decode the streams to fill missing information with heuristics" },
4590  { NULL, },
4591 };
4592 
4593 static inline int check_section_show_entries(int section_id)
4594 {
4595  struct section *section = &sections[section_id];
4596  if (sections[section_id].show_all_entries || sections[section_id].entries_to_show)
4597  return 1;
4598  for (const SectionID *id = section->children_ids; *id != -1; id++)
4599  if (check_section_show_entries(*id))
4600  return 1;
4601  return 0;
4602 }
4603 
4604 #define SET_DO_SHOW(id, varname) do { \
4605  if (check_section_show_entries(SECTION_ID_##id)) \
4606  do_show_##varname = 1; \
4607  } while (0)
4608 
4609 int main(int argc, char **argv)
4610 {
4611  const Writer *w;
4612  WriterContext *wctx;
4613  char *buf;
4614  char *w_name = NULL, *w_args = NULL;
4615  int ret, input_ret, i;
4616 
4617  init_dynload();
4618 
4619 #if HAVE_THREADS
4620  ret = pthread_mutex_init(&log_mutex, NULL);
4621  if (ret != 0) {
4622  goto end;
4623  }
4624 #endif
4626 
4628  parse_loglevel(argc, argv, options);
4630 #if CONFIG_AVDEVICE
4632 #endif
4633 
4634  show_banner(argc, argv, options);
4635  ret = parse_options(NULL, argc, argv, options, opt_input_file);
4636  if (ret < 0) {
4637  ret = (ret == AVERROR_EXIT) ? 0 : ret;
4638  goto end;
4639  }
4640 
4641  if (do_show_log)
4643 
4644  /* mark things to show, based on -show_entries */
4645  SET_DO_SHOW(CHAPTERS, chapters);
4647  SET_DO_SHOW(FORMAT, format);
4648  SET_DO_SHOW(FRAMES, frames);
4649  SET_DO_SHOW(LIBRARY_VERSIONS, library_versions);
4650  SET_DO_SHOW(PACKETS, packets);
4651  SET_DO_SHOW(PIXEL_FORMATS, pixel_formats);
4652  SET_DO_SHOW(PIXEL_FORMAT_FLAGS, pixel_format_flags);
4653  SET_DO_SHOW(PIXEL_FORMAT_COMPONENTS, pixel_format_components);
4654  SET_DO_SHOW(PROGRAM_VERSION, program_version);
4655  SET_DO_SHOW(PROGRAMS, programs);
4656  SET_DO_SHOW(STREAM_GROUP_DISPOSITION, stream_group_disposition);
4657  SET_DO_SHOW(STREAM_GROUPS, stream_groups);
4658  SET_DO_SHOW(STREAM_GROUP_COMPONENTS, stream_group_components);
4659  SET_DO_SHOW(STREAMS, streams);
4660  SET_DO_SHOW(STREAM_DISPOSITION, stream_disposition);
4661  SET_DO_SHOW(PROGRAM_STREAM_DISPOSITION, stream_disposition);
4662  SET_DO_SHOW(STREAM_GROUP_STREAM_DISPOSITION, stream_disposition);
4663 
4664  SET_DO_SHOW(CHAPTER_TAGS, chapter_tags);
4665  SET_DO_SHOW(FORMAT_TAGS, format_tags);
4666  SET_DO_SHOW(FRAME_TAGS, frame_tags);
4667  SET_DO_SHOW(PROGRAM_TAGS, program_tags);
4668  SET_DO_SHOW(STREAM_GROUP_TAGS, stream_group_tags);
4669  SET_DO_SHOW(STREAM_TAGS, stream_tags);
4670  SET_DO_SHOW(PROGRAM_STREAM_TAGS, stream_tags);
4671  SET_DO_SHOW(STREAM_GROUP_STREAM_TAGS, stream_tags);
4672  SET_DO_SHOW(PACKET_TAGS, packet_tags);
4673 
4676  "-bitexact and -show_program_version or -show_library_versions "
4677  "options are incompatible\n");
4678  ret = AVERROR(EINVAL);
4679  goto end;
4680  }
4681 
4683 
4684  if (!output_format)
4685  output_format = av_strdup("default");
4686  if (!output_format) {
4687  ret = AVERROR(ENOMEM);
4688  goto end;
4689  }
4690  w_name = av_strtok(output_format, "=", &buf);
4691  if (!w_name) {
4693  "No name specified for the output format\n");
4694  ret = AVERROR(EINVAL);
4695  goto end;
4696  }
4697  w_args = buf;
4698 
4699  if (show_data_hash) {
4700  if ((ret = av_hash_alloc(&hash, show_data_hash)) < 0) {
4701  if (ret == AVERROR(EINVAL)) {
4702  const char *n;
4704  "Unknown hash algorithm '%s'\nKnown algorithms:",
4705  show_data_hash);
4706  for (i = 0; (n = av_hash_names(i)); i++)
4707  av_log(NULL, AV_LOG_ERROR, " %s", n);
4708  av_log(NULL, AV_LOG_ERROR, "\n");
4709  }
4710  goto end;
4711  }
4712  }
4713 
4714  w = writer_get_by_name(w_name);
4715  if (!w) {
4716  av_log(NULL, AV_LOG_ERROR, "Unknown output format with name '%s'\n", w_name);
4717  ret = AVERROR(EINVAL);
4718  goto end;
4719  }
4720 
4721  if ((ret = writer_open(&wctx, w, w_args,
4723  if (w == &xml_writer)
4725 
4727 
4734 
4735  if (!input_filename &&
4738  show_usage();
4739  av_log(NULL, AV_LOG_ERROR, "You have to specify one input file.\n");
4740  av_log(NULL, AV_LOG_ERROR, "Use -h to get full help or, even better, run 'man %s'.\n", program_name);
4741  ret = AVERROR(EINVAL);
4742  } else if (input_filename) {
4744  if (ret < 0 && do_show_error)
4745  show_error(wctx, ret);
4746  }
4747 
4748  input_ret = ret;
4749 
4751  ret = writer_close(&wctx);
4752  if (ret < 0)
4753  av_log(NULL, AV_LOG_ERROR, "Writing output failed: %s\n", av_err2str(ret));
4754 
4755  ret = FFMIN(ret, input_ret);
4756  }
4757 
4758 end:
4764  av_hash_freep(&hash);
4765 
4766  uninit_opts();
4767  for (i = 0; i < FF_ARRAY_ELEMS(sections); i++)
4769 
4771 
4772 #if HAVE_THREADS
4773  pthread_mutex_destroy(&log_mutex);
4774 #endif
4775 
4776  return ret < 0;
4777 }
compact_print_section_header
static void compact_print_section_header(WriterContext *wctx, const void *data)
Definition: ffprobe.c:1284
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:1448
main
int main(int argc, char **argv)
Definition: ffprobe.c:4609
AV_OPT_SEARCH_CHILDREN
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
Definition: opt.h:522
AVSubtitle
Definition: avcodec.h:2227
SECTION_ID_STREAM_SIDE_DATA_LIST
@ SECTION_ID_STREAM_SIDE_DATA_LIST
Definition: ffprobe.c:235
opt_format
static int opt_format(void *optctx, const char *opt, const char *arg)
Definition: ffprobe.c:4185
AVHDRVividColorTransformParams::maximum_maxrgb
AVRational maximum_maxrgb
Indicates the maximum brightness of the displayed content.
Definition: hdr_dynamic_vivid_metadata.h:260
pthread_mutex_t
_fmutex pthread_mutex_t
Definition: os2threads.h:53
AVFrame::color_trc
enum AVColorTransferCharacteristic color_trc
Definition: frame.h:627
clear_log
static void clear_log(int need_lock)
Definition: ffprobe.c:2693
AVMasteringDisplayMetadata::has_primaries
int has_primaries
Flag indicating whether the display primaries (and white point) are set.
Definition: mastering_display_metadata.h:62
iamf.h
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:4195
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_packet_unref
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition: avpacket.c:427
OPT_EXIT
#define OPT_EXIT
Definition: cmdutils.h:138
show_help_options
void show_help_options(const OptionDef *options, const char *msg, int req_flags, int rej_flags)
Print help for all options matching specified flags.
Definition: cmdutils.c:110
AVCodec
AVCodec.
Definition: codec.h:187
writer_get_by_name
static const Writer * writer_get_by_name(const char *name)
Definition: ffprobe.c:1057
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:368
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
AVIAMFSubmix::elements
AVIAMFSubmixElement ** elements
Array of submix elements.
Definition: iamf.h:552
flat_options
static const AVOption flat_options[]
Definition: ffprobe.c:1424
WriterContext::section_pbuf
AVBPrint section_pbuf[SECTION_MAX_NB_LEVELS]
generic print buffer dedicated to each section, used by various writers
Definition: ffprobe.c:564
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
AVIAMFAudioElement::nb_layers
unsigned int nb_layers
Number of layers, or channel groups, in the Audio Element.
Definition: iamf.h:359
AVFrame::color_range
enum AVColorRange color_range
MPEG vs JPEG YUV range.
Definition: frame.h:623
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:140
WriterContext::level
int level
current level, starting from 0
Definition: ffprobe.c:557
WriterContext::string_validation
int string_validation
Definition: ffprobe.c:571
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:69
AVFormatContext::stream_groups
AVStreamGroup ** stream_groups
A list of all stream groups in the file.
Definition: avformat.h:1342
MAX_REGISTERED_WRITERS_NB
#define MAX_REGISTERED_WRITERS_NB
Definition: ffprobe.c:1042
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
entry
#define entry
Definition: aom_film_grain_template.c:66
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:137
level
uint8_t level
Definition: svq3.c:204
do_show_log
static int do_show_log
Definition: ffprobe.c:128
AVStreamGroup::id
int64_t id
Group type-specific group ID.
Definition: avformat.h:1109
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:98
InputFile::fmt_ctx
AVFormatContext * fmt_ctx
Definition: ffprobe.c:97
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:1638
writer_print_integer
static void writer_print_integer(WriterContext *wctx, const char *key, int64_t val)
Definition: ffprobe.c:827
dec_ctx
static AVCodecContext * dec_ctx
Definition: decode_filter_audio.c:46
SECTION_MAX_NB_LEVELS
#define SECTION_MAX_NB_LEVELS
Definition: ffprobe.c:540
SECTION_ID_STREAM_SIDE_DATA
@ SECTION_ID_STREAM_SIDE_DATA
Definition: ffprobe.c:236
AVIAMFSubmix::layouts
AVIAMFSubmixLayout ** layouts
Array of submix layouts.
Definition: iamf.h:567
do_show_frame_tags
static int do_show_frame_tags
Definition: ffprobe.c:132
AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT
@ AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT
Ambient viewing environment metadata, as defined by H.274.
Definition: packet.h:331
mix
static int mix(int c0, int c1)
Definition: 4xm.c:715
PLANAR
#define PLANAR
Definition: flacdsp.c:42
show_stream_groups
static int show_stream_groups(WriterContext *w, InputFile *ifile)
Definition: ffprobe.c:3758
AVChapter::metadata
AVDictionary * metadata
Definition: avformat.h:1218
r
const char * r
Definition: vf_curves.c:126
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
unit_value::i
int64_t i
Definition: ffprobe.c:453
opt_show_optional_fields
static int opt_show_optional_fields(void *optctx, const char *opt, const char *arg)
Definition: ffprobe.c:4168
SECTION_ID_NONE
@ SECTION_ID_NONE
Definition: ffprobe.c:171
opt.h
FrameData::pkt_pos
int64_t pkt_pos
Definition: ffplay.c:151
read_intervals_nb
static int read_intervals_nb
Definition: ffprobe.c:162
opt_output_file_o
static int opt_output_file_o(void *optctx, const char *opt, const char *arg)
Definition: ffprobe.c:4301
show_stream_group
static int show_stream_group(WriterContext *w, InputFile *ifile, AVStreamGroup *stg)
Definition: ffprobe.c:3714
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:51
AVStreamGroup::tile_grid
struct AVStreamGroupTileGrid * tile_grid
Definition: avformat.h:1125
AVFMT_SHOW_IDS
#define AVFMT_SHOW_IDS
Show format stream IDs numbers.
Definition: avformat.h:477
AVSphericalMapping::projection
enum AVSphericalProjection projection
Projection type.
Definition: spherical.h:82
ReadInterval::end_is_offset
int end_is_offset
Definition: ffprobe.c:157
LogBuffer::log_message
char * log_message
Definition: ffprobe.c:394
AVColorTransferCharacteristic
AVColorTransferCharacteristic
Color Transfer Characteristic.
Definition: pixfmt.h:580
libm.h
FrameData
Definition: ffmpeg.h:593
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:157
show_streams
static int show_streams(WriterContext *w, InputFile *ifile)
Definition: ffprobe.c:3461
AVFilmGrainParams::bit_depth_luma
int bit_depth_luma
Intended bit depth, or 0 for unknown/unspecified.
Definition: film_grain_params.h:287
Writer::name
const char * name
Definition: ffprobe.c:527
writer_put_str_printf
static void writer_put_str_printf(WriterContext *wctx, const char *str)
Definition: ffprobe.c:669
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:88
print_str
#define print_str(k, v)
Definition: ffprobe.c:2016
LogBuffer::context_name
char * context_name
Definition: ffprobe.c:392
color
Definition: vf_paletteuse.c:511
av_bprint_init
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
Definition: bprint.c:69
default_print_int
static void default_print_int(WriterContext *wctx, const char *key, int64_t value)
Definition: ffprobe.c:1161
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:2023
compact_print_section_footer
static void compact_print_section_footer(WriterContext *wctx)
Definition: ffprobe.c:1336
SECTION_ID_PACKET_SIDE_DATA_LIST
@ SECTION_ID_PACKET_SIDE_DATA_LIST
Definition: ffprobe.c:197
AVFormatContext::nb_chapters
unsigned int nb_chapters
Number of chapters in AVChapter array.
Definition: avformat.h:1355
AVCodecParameters
This struct describes the properties of an encoded stream.
Definition: codec_par.h:47
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:212
AVAmbientViewingEnvironment
Ambient viewing environment metadata as defined by H.274.
Definition: ambient_viewing_environment.h:36
AVCodecParameters::color_space
enum AVColorSpace color_space
Definition: codec_par.h:169
AVIAMFAudioElement::default_w
unsigned int default_w
Default weight value as defined in section 3.6 of IAMF.
Definition: iamf.h:384
AVFrame::duration
int64_t duration
Duration of the frame, in the same units as pts.
Definition: frame.h:750
Writer::init
int(* init)(WriterContext *wctx)
Definition: ffprobe.c:529
thread.h
value_string
static char * value_string(char *buf, int buf_size, struct unit_value uv)
Definition: ffprobe.c:457
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:57
AVBufferRef::data
uint8_t * data
The data buffer.
Definition: buffer.h:90
read_packets
static int read_packets(WriterContext *w, InputFile *ifile)
Definition: ffprobe.c:3206
AVStreamGroupTileGrid::horizontal_offset
int horizontal_offset
Offset in pixels from the left edge of the canvas where the actual image meant for presentation start...
Definition: avformat.h:1049
AVIAMFAudioElement::layers
AVIAMFLayer ** layers
Definition: iamf.h:350
AVStream::discard
enum AVDiscard discard
Selects which packets can be discarded at will and do not need to be demuxed.
Definition: avformat.h:814
AV_FIELD_PROGRESSIVE
@ AV_FIELD_PROGRESSIVE
Definition: defs.h:200
pthread_mutex_init
static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
Definition: os2threads.h:104
AVFrame::nb_side_data
int nb_side_data
Definition: frame.h:578
AV_PKT_DATA_MASTERING_DISPLAY_METADATA
@ AV_PKT_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata (based on SMPTE-2086:2014).
Definition: packet.h:223
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
json_print_section_header
static void json_print_section_header(WriterContext *wctx, const void *data)
Definition: ffprobe.c:1692
show_packet
static void show_packet(WriterContext *w, InputFile *ifile, AVPacket *pkt, int packet_idx)
Definition: ffprobe.c:2744
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:584
CompactContext::print_section
int print_section
Definition: ffprobe.c:1237
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:169
AV_FRAME_DATA_DOVI_METADATA
@ AV_FRAME_DATA_DOVI_METADATA
Parsed Dolby Vision metadata, suitable for passing to a software implementation.
Definition: frame.h:208
AV_TIME_BASE_Q
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
Definition: avutil.h:264
Writer::print_section_footer
void(* print_section_footer)(WriterContext *wctx)
Definition: ffprobe.c:533
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:386
SECTION_ID_PROGRAM_TAGS
@ SECTION_ID_PROGRAM_TAGS
Definition: ffprobe.c:209
AVSubtitle::num_rects
unsigned num_rects
Definition: avcodec.h:2231
AVFilmGrainAOMParams::uv_points
uint8_t uv_points[2][10][2]
Definition: film_grain_params.h:63
av_strcasecmp
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
Definition: avstring.c:207
AV_FRAME_DATA_FILM_GRAIN_PARAMS
@ AV_FRAME_DATA_FILM_GRAIN_PARAMS
Film grain parameters for a frame, described by AVFilmGrainParams.
Definition: frame.h:188
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
AVFilmGrainH274Params::blending_mode_id
int blending_mode_id
Specifies the blending mode used to blend the simulated film grain with the decoded images.
Definition: film_grain_params.h:182
AVIAMFMixPresentation::nb_submixes
unsigned int nb_submixes
Number of submixes in the presentation.
Definition: iamf.h:616
avformat_get_class
const AVClass * avformat_get_class(void)
Get the AVClass for AVFormatContext.
Definition: options.c:196
AVFrame::color_primaries
enum AVColorPrimaries color_primaries
Definition: frame.h:625
AVStreamGroup::disposition
int disposition
Stream group disposition - a combination of AV_DISPOSITION_* flags.
Definition: avformat.h:1166
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:1084
AVHDRVividColorTransformParams::tone_mapping_param_num
int tone_mapping_param_num
The number of tone mapping param.
Definition: hdr_dynamic_vivid_metadata.h:272
Writer::priv_class
const AVClass * priv_class
private class of the writer, if any
Definition: ffprobe.c:525
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:358
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:130
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:563
json_escape_str
static const char * json_escape_str(AVBPrint *dst, const char *src, void *log_ctx)
Definition: ffprobe.c:1670
AVFilmGrainParams::aom
AVFilmGrainAOMParams aom
Definition: film_grain_params.h:260
print_ts
#define print_ts(k, v)
Definition: ffprobe.c:2020
AVFrame::colorspace
enum AVColorSpace colorspace
YUV colorspace type.
Definition: frame.h:634
opt_input_file_i
static int opt_input_file_i(void *optctx, const char *opt, const char *arg)
Definition: ffprobe.c:4295
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:569
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:344
pixdesc.h
AVFormatContext::streams
AVStream ** streams
A list of all streams in the file.
Definition: avformat.h:1323
AVFrame::pts
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:456
AVFrame::width
int width
Definition: frame.h:416
writer_put_str
#define writer_put_str(wctx_, str_)
Definition: ffprobe.c:1039
Writer::print_integer
void(* print_integer)(WriterContext *wctx, const char *, int64_t)
Definition: ffprobe.c:534
AVPacketSideData
This structure stores auxiliary information for decoding, presenting, or otherwise processing the cod...
Definition: packet.h:373
w
uint8_t w
Definition: llviddspenc.c:38
validate_string
static int validate_string(WriterContext *wctx, char **dstp, const char *src)
Definition: ffprobe.c:838
OPT_INPUT
#define OPT_INPUT
Definition: cmdutils.h:168
AVHDRVividColorTransformParams::variance_maxrgb
AVRational variance_maxrgb
Indicates the variance brightness of the displayed content.
Definition: hdr_dynamic_vivid_metadata.h:253
av_disposition_to_string
const char * av_disposition_to_string(int disposition)
Definition: options.c:523
flat_print_section_header
static void flat_print_section_header(WriterContext *wctx, const void *data)
Definition: ffprobe.c:1481
SECTION_ID_STREAM_GROUP_COMPONENTS
@ SECTION_ID_STREAM_GROUP_COMPONENTS
Definition: ffprobe.c:215
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:186
AVIAMFParamDefinition::type
enum AVIAMFParamDefinitionType type
Parameters type.
Definition: iamf.h:204
parse_number
int parse_number(const char *context, const char *numstr, enum OptionType type, double min, double max, double *dst)
Parse a string and return its corresponding value as a double.
Definition: cmdutils.c:87
SECTION_ID_PIXEL_FORMAT_COMPONENTS
@ SECTION_ID_PIXEL_FORMAT_COMPONENTS
Definition: ffprobe.c:202
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:522
ReadInterval::duration_frames
int duration_frames
Definition: ffprobe.c:158
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:38
AVPixFmtDescriptor::name
const char * name
Definition: pixdesc.h:70
AVAmbientViewingEnvironment::ambient_light_x
AVRational ambient_light_x
Normalized x chromaticity coordinate of the environmental ambient light in the nominal viewing enviro...
Definition: ambient_viewing_environment.h:47
AVHDRVivid3SplineParams::enable_strength
AVRational enable_strength
3Spline_enable_Strength of three Spline.
Definition: hdr_dynamic_vivid_metadata.h:70
json_print_int
static void json_print_int(WriterContext *wctx, const char *key, int64_t value)
Definition: ffprobe.c:1778
AVOption
AVOption.
Definition: opt.h:346
b
#define b
Definition: input.c:41
AVCOL_TRC_UNSPECIFIED
@ AVCOL_TRC_UNSPECIFIED
Definition: pixfmt.h:583
SECTION_ID_STREAM
@ SECTION_ID_STREAM
Definition: ffprobe.c:231
section::element_name
const char * element_name
name of the contained element, if provided
Definition: ffprobe.c:252
SECTION_ID_PIXEL_FORMAT_FLAGS
@ SECTION_ID_PIXEL_FORMAT_FLAGS
Definition: ffprobe.c:200
LogBuffer
Definition: ffprobe.c:391
AVStream::avg_frame_rate
AVRational avg_frame_rate
Average framerate.
Definition: avformat.h:832
AVStreamGroupTileGrid::vertical_offset
int vertical_offset
Offset in pixels from the top edge of the canvas where the actual image meant for presentation starts...
Definition: avformat.h:1056
spherical.h
AVChapter::start
int64_t start
Definition: avformat.h:1217
data
const char data[16]
Definition: mxf.c:148
avio_open
int avio_open(AVIOContext **s, const char *filename, int flags)
Create and initialize a AVIOContext for accessing the resource indicated by url.
Definition: avio.c:496
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:2969
print_dovi_metadata
static void print_dovi_metadata(WriterContext *w, const AVDOVIMetadata *dovi)
Definition: ffprobe.c:2060
format_opts
AVDictionary * format_opts
Definition: cmdutils.c:61
AV_DOVI_NLQ_NONE
@ AV_DOVI_NLQ_NONE
Definition: dovi_meta.h:118
print_iamf_submix_params
static void print_iamf_submix_params(WriterContext *w, const AVIAMFSubmix *submix)
Definition: ffprobe.c:3636
XMLContext::within_tag
int within_tag
Definition: ffprobe.c:1811
SECTION_MAX_NB_CHILDREN
#define SECTION_MAX_NB_CHILDREN
Definition: ffprobe.c:168
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:75
si_prefixes
static const struct @9 si_prefixes[]
AVFilmGrainParams::color_space
enum AVColorSpace color_space
Definition: film_grain_params.h:282
do_show_stream_tags
static int do_show_stream_tags
Definition: ffprobe.c:135
ini_escape_str
static char * ini_escape_str(AVBPrint *dst, const char *src)
Definition: ffprobe.c:1554
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:2030
SECTION_ID_PIXEL_FORMAT
@ SECTION_ID_PIXEL_FORMAT
Definition: ffprobe.c:199
writer_printf_printf
static void writer_printf_printf(WriterContext *wctx, const char *fmt,...)
Definition: ffprobe.c:674
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
SECTION_ID_PROGRAM_STREAM
@ SECTION_ID_PROGRAM_STREAM
Definition: ffprobe.c:208
category
category
Definition: openal-dec.c:249
AVFormatContext::programs
AVProgram ** programs
Definition: avformat.h:1456
OFFSET
#define OFFSET(x)
Definition: ffprobe.c:1818
SECTION_ID_FORMAT
@ SECTION_ID_FORMAT
Definition: ffprobe.c:176
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:143
AVIAMFParamDefinition
Parameters as defined in section 3.6.1 of IAMF.
Definition: iamf.h:184
AVOption::flags
int flags
A combination of AV_OPT_FLAG_*.
Definition: opt.h:389
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:2914
AVPacket::duration
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
Definition: packet.h:540
SECTION_ID_STREAM_GROUP_SUBCOMPONENT
@ SECTION_ID_STREAM_GROUP_SUBCOMPONENT
Definition: ffprobe.c:218
AVCodecParameters::codec_tag
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
Definition: codec_par.h:59
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:68
check_section_show_entries
static int check_section_show_entries(int section_id)
Definition: ffprobe.c:4593
print_section
static void print_section(SectionID id, int level)
Definition: ffprobe.c:4485
AVIAMFSubmixElement::default_mix_gain
AVRational default_mix_gain
Default mix gain value to apply when there are no AVIAMFParamDefinition with element_mix_config's par...
Definition: iamf.h:460
AVHDRVivid3SplineParams::th_mode
int th_mode
The mode of three Spline.
Definition: hdr_dynamic_vivid_metadata.h:35
section::id
int id
unique id identifying a section
Definition: ffprobe.c:241
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:34
writer_options
static const AVOption writer_options[]
Definition: ffprobe.c:584
AVFrame::flags
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
Definition: frame.h:616
AVChannelLayout::order
enum AVChannelOrder order
Channel order used in this layout.
Definition: channel_layout.h:308
AVColorPrimaries
AVColorPrimaries
Chromaticity coordinates of the source primaries.
Definition: pixfmt.h:555
AVStreamGroupTileGrid::vertical
int vertical
Offset in pixels from the top edge of the canvas where the tile should be placed.
Definition: avformat.h:1031
SECTION_ID_STREAM_GROUP_BLOCKS
@ SECTION_ID_STREAM_GROUP_BLOCKS
Definition: ffprobe.c:223
AVDOVIRpuDataHeader::rpu_format
uint16_t rpu_format
Definition: dovi_meta.h:78
DefaultContext::nokey
int nokey
Definition: ffprobe.c:1086
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:439
do_show_stream_group_components
static int do_show_stream_group_components
Definition: ffprobe.c:118
av_read_frame
int av_read_frame(AVFormatContext *s, AVPacket *pkt)
Return the next frame of a stream.
Definition: demux.c:1525
writer_register_all
static void writer_register_all(void)
Definition: ffprobe.c:1979
AVDOVIDataMapping::mapping_color_space
uint8_t mapping_color_space
Definition: dovi_meta.h:141
CompactContext
Definition: ffprobe.c:1232
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:360
AVHDRVividColorTransformParams::color_saturation_num
int color_saturation_num
The number of color saturation param.
Definition: hdr_dynamic_vivid_metadata.h:289
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:313
dec_val
double dec_val
Definition: ffprobe.c:366
show_tags
static int show_tags(WriterContext *w, AVDictionary *tags, int section_id)
Definition: ffprobe.c:2042
AV_RL8
#define AV_RL8(x)
Definition: intreadwrite.h:396
avio_size
int64_t avio_size(AVIOContext *s)
Get the filesize.
Definition: aviobuf.c:322
av_strlcatf
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
Definition: avstring.c:103
AV_PKT_FLAG_KEY
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: packet.h:577
AVFilmGrainParams::color_trc
enum AVColorTransferCharacteristic color_trc
Definition: film_grain_params.h:281
do_show_format_tags
static int do_show_format_tags
Definition: ffprobe.c:131
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:74
AVFilmGrainParams::seed
uint64_t seed
Seed to use for the synthesis process, if the codec allows for it.
Definition: film_grain_params.h:250
av_chroma_location_name
const char * av_chroma_location_name(enum AVChromaLocation location)
Definition: pixdesc.c:3359
ini_print_section_header
static void ini_print_section_header(WriterContext *wctx, const void *data)
Definition: ffprobe.c:1581
hdr_dynamic_vivid_metadata.h
print_film_grain_params
static void print_film_grain_params(WriterContext *w, const AVFilmGrainParams *fgp)
Definition: ffprobe.c:2402
section::unique_name
const char * unique_name
unique section name, in case the name is ambiguous
Definition: ffprobe.c:253
Writer::print_string
void(* print_string)(WriterContext *wctx, const char *, const char *)
Definition: ffprobe.c:536
do_show_frames
static int do_show_frames
Definition: ffprobe.c:114
xml_print_section_header
static void xml_print_section_header(WriterContext *wctx, const void *data)
Definition: ffprobe.c:1853
OptionDef
Definition: cmdutils.h:126
AV_FIELD_BT
@ AV_FIELD_BT
Bottom coded first, top displayed first.
Definition: defs.h:204
compact_init
static av_cold int compact_init(WriterContext *wctx)
Definition: ffprobe.c:1262
print_dispositions
static void print_dispositions(WriterContext *w, uint32_t disposition, SectionID section_id)
Definition: ffprobe.c:3226
AVInputFormat::long_name
const char * long_name
Descriptive name for the format, meant to be more human-readable than name.
Definition: avformat.h:560
AV_FRAME_FLAG_TOP_FIELD_FIRST
#define AV_FRAME_FLAG_TOP_FIELD_FIRST
A flag to mark frames where the top field is displayed first if the content is interlaced.
Definition: frame.h:608
xml_print_section_footer
static void xml_print_section_footer(WriterContext *wctx)
Definition: ffprobe.c:1899
SECTION_ID_FRAME_TAGS
@ SECTION_ID_FRAME_TAGS
Definition: ffprobe.c:180
ReadInterval::id
int id
identifier
Definition: ffprobe.c:154
AVFrame::opaque_ref
AVBufferRef * opaque_ref
Frame owner's private data.
Definition: frame.h:711
AVContentLightMetadata
Content light level needed by to transmit HDR over HDMI (CTA-861.3).
Definition: mastering_display_metadata.h:98
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
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:124
process_frame
static av_always_inline int process_frame(WriterContext *w, InputFile *ifile, AVFrame *frame, const AVPacket *pkt, int *packet_new)
Definition: ffprobe.c:2996
AVCodecParameters::color_primaries
enum AVColorPrimaries color_primaries
Definition: codec_par.h:167
InputStream
Definition: ffmpeg.h:345
writer_print_data
static void writer_print_data(WriterContext *wctx, const char *name, const uint8_t *data, int size)
Definition: ffprobe.c:969
avformat_close_input
void avformat_close_input(AVFormatContext **s)
Close an opened input AVFormatContext.
Definition: demux.c:362
AVPacketSideData::size
size_t size
Definition: packet.h:375
AVFrame::chroma_location
enum AVChromaLocation chroma_location
Definition: frame.h:636
match_section
static int match_section(const char *section_name, int show_all_entries, AVDictionary *entries)
Definition: ffprobe.c:4209
print_iamf_param_definition
static void print_iamf_param_definition(WriterContext *w, const char *name, const AVIAMFParamDefinition *param, SectionID section_id)
Definition: ffprobe.c:3550
SECTION_FLAG_HAS_TYPE
#define SECTION_FLAG_HAS_TYPE
For these sections the element_name field is mandatory.
Definition: ffprobe.c:248
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:1538
unit_hertz_str
static const char unit_hertz_str[]
Definition: ffprobe.c:379
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:374
xml_print_value
static void xml_print_value(WriterContext *wctx, const char *key, const char *str, int64_t num, const int is_int)
Definition: ffprobe.c:1916
AV_FIELD_TT
@ AV_FIELD_TT
Top coded_first, top displayed first.
Definition: defs.h:201
writer_close
static int writer_close(WriterContext **wctx)
Definition: ffprobe.c:613
SHOW_OPTIONAL_FIELDS_NEVER
#define SHOW_OPTIONAL_FIELDS_NEVER
Definition: ffprobe.c:145
SECTION_ID_STREAMS
@ SECTION_ID_STREAMS
Definition: ffprobe.c:233
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:163
writer_print_data_hash
static void writer_print_data_hash(WriterContext *wctx, const char *name, const uint8_t *data, int size)
Definition: ffprobe.c:997
show_optional_fields
static int show_optional_fields
Definition: ffprobe.c:147
json_print_section_footer
static void json_print_section_footer(WriterContext *wctx)
Definition: ffprobe.c:1731
av_color_space_name
const char * av_color_space_name(enum AVColorSpace space)
Definition: pixdesc.c:3338
SECTION_ID_STREAM_GROUP
@ SECTION_ID_STREAM_GROUP
Definition: ffprobe.c:214
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:4476
AVCodecContext::codec
const struct AVCodec * codec
Definition: avcodec.h:454
AVPacket::opaque_ref
AVBufferRef * opaque_ref
AVBufferRef for free use by the API user.
Definition: packet.h:558
json_options
static const AVOption json_options[]
Definition: ffprobe.c:1652
default_options
static const AVOption default_options[]
Definition: ffprobe.c:1094
fail
#define fail()
Definition: checkasm.h:179
writer_get_name
static const char * writer_get_name(void *p)
Definition: ffprobe.c:576
AVHDRVividColorTransformParams::tm_params
AVHDRVividColorToneMappingParams tm_params[2]
The color tone mapping parameters.
Definition: hdr_dynamic_vivid_metadata.h:277
av_hash_get_name
const char * av_hash_get_name(const AVHashContext *ctx)
Definition: hash.c:104
LogBuffer::log_level
int log_level
Definition: ffprobe.c:393
AVStreamGroupTileGrid
AVStreamGroupTileGrid holds information on how to combine several independent images on a single canv...
Definition: avformat.h:982
AVFilmGrainAOMParams::grain_scale_shift
int grain_scale_shift
Signals the down shift applied to the generated gaussian numbers during synthesis.
Definition: film_grain_params.h:99
print_chroma_location
static void print_chroma_location(WriterContext *w, enum AVChromaLocation chroma_location)
Definition: ffprobe.c:2683
AVDOVIRpuDataHeader::el_bit_depth
uint8_t el_bit_depth
Definition: dovi_meta.h:87
AVHDRVivid3SplineParams::th_delta1
AVRational th_delta1
3Spline_TH_Delta1 of three Spline.
Definition: hdr_dynamic_vivid_metadata.h:56
Writer::uninit
void(* uninit)(WriterContext *wctx)
Definition: ffprobe.c:530
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:246
AVIAMFSubmixLayout
Submix layout as defined in section 3.7.6 of IAMF.
Definition: iamf.h:501
avformat_stream_group_name
const char * avformat_stream_group_name(enum AVStreamGroupParamsType type)
Definition: avformat.c:324
json_writer
static const Writer json_writer
Definition: ffprobe.c:1795
AVStreamGroupTileGrid::coded_width
int coded_width
Width of the canvas.
Definition: avformat.h:997
AVCodecContext::refs
int refs
number of reference frames
Definition: avcodec.h:715
av_opt_free
void av_opt_free(void *obj)
Free all allocated objects in obj.
Definition: opt.c:1908
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:320
AV_BPRINT_SIZE_AUTOMATIC
#define AV_BPRINT_SIZE_AUTOMATIC
AVChapter
Definition: avformat.h:1214
print_tile_grid_params
static void print_tile_grid_params(WriterContext *w, const AVStreamGroup *stg, const AVStreamGroupTileGrid *tile_grid)
Definition: ffprobe.c:3527
val
static double val(void *priv, double ch)
Definition: aeval.c:78
AVFrame::ch_layout
AVChannelLayout ch_layout
Channel layout of the audio data.
Definition: frame.h:745
json_init
static av_cold int json_init(WriterContext *wctx)
Definition: ffprobe.c:1660
show_help_default
void show_help_default(const char *opt, const char *arg)
Per-fftool specific help handler.
Definition: ffprobe.c:4325
AVStreamGroupTileGrid::coded_height
int coded_height
Width of the canvas.
Definition: avformat.h:1003
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:1186
pts
static int64_t pts
Definition: transcode_aac.c:643
SECTION_ID_FRAME_SIDE_DATA_PIECE
@ SECTION_ID_FRAME_SIDE_DATA_PIECE
Definition: ffprobe.c:188
AVCodecContext::coded_height
int coded_height
Definition: avcodec.h:633
us
#define us(width, name, range_min, range_max, subs,...)
Definition: cbs_h2645.c:262
av_opt_set
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
Definition: opt.c:738
AVFilmGrainAOMParams::limit_output_range
int limit_output_range
Signals to clip to limited color levels after film grain application.
Definition: film_grain_params.h:122
show_log
static int show_log(WriterContext *w, int section_ids, int section_id, int log_level)
Definition: ffprobe.c:2709
AVStream::duration
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:802
AVAmbientViewingEnvironment::ambient_illuminance
AVRational ambient_illuminance
Environmental illuminance of the ambient viewing environment in lux.
Definition: ambient_viewing_environment.h:40
input_filename
static const char * input_filename
Definition: ffprobe.c:357
print_duration_ts
#define print_duration_ts(k, v)
Definition: ffprobe.c:2022
AVFilmGrainAOMParams::num_y_points
int num_y_points
Number of points, and the scale and value for each point of the piecewise linear scaling function for...
Definition: film_grain_params.h:49
AVIAMFAudioElement::audio_element_type
enum AVIAMFAudioElementType audio_element_type
Audio element type as defined in section 3.6 of IAMF.
Definition: iamf.h:379
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
AVIAMFReconGain
Recon Gain Info Parameter Data as defined in section 3.8.3 of IAMF.
Definition: iamf.h:139
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:558
AV_FIELD_TB
@ AV_FIELD_TB
Top coded first, bottom displayed first.
Definition: defs.h:203
InputFile
Definition: ffmpeg.h:389
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:110
AVFilmGrainAOMParams
This structure describes how to handle film grain synthesis for AOM codecs.
Definition: film_grain_params.h:44
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:4471
AVFilmGrainH274Params::intensity_interval_upper_bound
uint8_t intensity_interval_upper_bound[3][256]
Specifies the upper bound of each intensity interval for which the set of model values applies for th...
Definition: film_grain_params.h:216
avsubtitle_free
void avsubtitle_free(AVSubtitle *sub)
Free all allocated data in the given subtitle struct.
Definition: avcodec.c:379
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
AV_IAMF_PARAMETER_DEFINITION_RECON_GAIN
@ AV_IAMF_PARAMETER_DEFINITION_RECON_GAIN
Subblocks are of struct type AVIAMFReconGain.
Definition: iamf.h:172
close_input_file
static void close_input_file(InputFile *ifile)
Definition: ffprobe.c:3965
av_frame_alloc
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition: frame.c:118
parse_read_intervals
static int parse_read_intervals(const char *intervals_spec)
Definition: ffprobe.c:4423
AVFormatContext::bit_rate
int64_t bit_rate
Total stream bitrate in bit/s, 0 if not available.
Definition: avformat.h:1397
av_get_bits_per_sample
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
Definition: utils.c:547
AVCodecParameters::color_trc
enum AVColorTransferCharacteristic color_trc
Definition: codec_par.h:168
avcodec_decode_subtitle2
int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, const AVPacket *avpkt)
Decode a subtitle message.
Definition: decode.c:929
json_print_item_str
static void json_print_item_str(WriterContext *wctx, const char *key, const char *value)
Definition: ffprobe.c:1753
default_writer
static const Writer default_writer
Definition: ffprobe.c:1170
AVIAMFSubmixElement::annotations
AVDictionary * annotations
A dictionary of strings describing the submix in different languages.
Definition: iamf.h:481
AVFilmGrainParams::bit_depth_chroma
int bit_depth_chroma
Definition: film_grain_params.h:288
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:943
show_frame
static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream, AVFormatContext *fmt_ctx)
Definition: ffprobe.c:2909
do_show_error
static int do_show_error
Definition: ffprobe.c:112
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:1490
film_grain_params.h
AVFrameSideData::size
size_t size
Definition: frame.h:253
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
AVInputFormat
Definition: avformat.h:548
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_PKT_FLAG_CORRUPT
#define AV_PKT_FLAG_CORRUPT
The packet content is corrupted.
Definition: packet.h:578
print_iamf_audio_element_params
static void print_iamf_audio_element_params(WriterContext *w, const AVStreamGroup *stg, const AVIAMFAudioElement *audio_element)
Definition: ffprobe.c:3605
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:760
AV_PROFILE_UNKNOWN
#define AV_PROFILE_UNKNOWN
Definition: defs.h:65
nb_streams_frames
static uint64_t * nb_streams_frames
Definition: ffprobe.c:385
AVFilmGrainParams::width
int width
Intended display resolution.
Definition: film_grain_params.h:269
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:348
AV_FRAME_FLAG_KEY
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
Definition: frame.h:595
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:214
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:62
postprocess.h
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:644
SECTION_ID_STREAM_GROUP_STREAMS
@ SECTION_ID_STREAM_GROUP_STREAMS
Definition: ffprobe.c:225
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:335
SECTION_ID_FORMAT_TAGS
@ SECTION_ID_FORMAT_TAGS
Definition: ffprobe.c:177
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:535
AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION
@ AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION
Definition: avformat.h:1083
AVDOVIRpuDataHeader::rpu_type
uint8_t rpu_type
Definition: dovi_meta.h:77
initialized
static int initialized
Definition: vaapi_transcode.c:43
avcodec_alloc_context3
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
Definition: options.c:149
av_packet_side_data_name
const char * av_packet_side_data_name(enum AVPacketSideDataType type)
Definition: avpacket.c:269
do_count_frames
static int do_count_frames
Definition: ffprobe.c:107
AVChapter::end
int64_t end
chapter start/end time in time_base units
Definition: avformat.h:1217
writer_child_next
static void * writer_child_next(void *obj, void *prev)
Definition: ffprobe.c:597
print_section_footer
#define print_section_footer(s)
Definition: ffprobe.c:2032
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:155
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:3059
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:198
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
unit_bit_per_second_str
static const char unit_bit_per_second_str[]
Definition: ffprobe.c:381
show_program
static int show_program(WriterContext *w, InputFile *ifile, AVProgram *program)
Definition: ffprobe.c:3478
av_realloc_array
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
Definition: mem.c:215
xml_options
static const AVOption xml_options[]
Definition: ffprobe.c:1820
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:1455
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:553
AVFormatContext::iformat
const struct AVInputFormat * iformat
The input container format.
Definition: avformat.h:1267
AVFormatContext::chapters
AVChapter ** chapters
Definition: avformat.h:1356
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:237
AVDictionaryEntry::key
char * key
Definition: dict.h:90
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:134
av_iamf_param_definition_get_subblock
static av_always_inline void * av_iamf_param_definition_get_subblock(const AVIAMFParamDefinition *par, unsigned int idx)
Get the subblock at the specified.
Definition: iamf.h:251
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:112
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:114
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:178
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
get_frame_side_data_type
static const char * get_frame_side_data_type(const void *data)
Definition: ffprobe.c:265
CompactContext::item_sep
char item_sep
Definition: ffprobe.c:1235
print_fmt
#define print_fmt(k, f,...)
Definition: ffprobe.c:1996
FlatContext
Definition: ffprobe.c:1414
avcodec_receive_frame
int attribute_align_arg avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
Return decoded output data from a decoder or encoder (when the AV_CODEC_FLAG_RECON_FRAME flag is used...
Definition: avcodec.c:681
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:40
AVIAMFSubmixElement::headphones_rendering_mode
enum AVIAMFHeadphonesMode headphones_rendering_mode
A value that indicates whether the referenced channel-based Audio Element shall be rendered to stereo...
Definition: iamf.h:469
xml_print_str
static void xml_print_str(WriterContext *wctx, const char *key, const char *value)
Definition: ffprobe.c:1958
AVIO_FLAG_WRITE
#define AVIO_FLAG_WRITE
write-only
Definition: avio.h:618
setup_find_stream_info_opts
int setup_find_stream_info_opts(AVFormatContext *s, AVDictionary *codec_opts, AVDictionary ***dst)
Setup AVCodecContext options for avformat_find_stream_info().
Definition: cmdutils.c:1055
do_show_stream_group_tags
static int do_show_stream_group_tags
Definition: ffprobe.c:134
AVStreamGroup::index
unsigned int index
Group index in AVFormatContext.
Definition: avformat.h:1101
probe_file
static int probe_file(WriterContext *wctx, const char *filename, const char *print_filename)
Definition: ffprobe.c:3979
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:1690
AVCodecContext::bits_per_raw_sample
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
Definition: avcodec.h:1574
WriterContext::writer_w8
void(* writer_w8)(WriterContext *wctx, int b)
Definition: ffprobe.c:547
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:374
section::show_all_entries
int show_all_entries
Definition: ffprobe.c:256
AVDOVIDecoderConfigurationRecord::dv_profile
uint8_t dv_profile
Definition: dovi_meta.h:55
ctx
AVFormatContext * ctx
Definition: movenc.c:48
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:727
flat_print_str
static void flat_print_str(WriterContext *wctx, const char *key, const char *value)
Definition: ffprobe.c:1512
get_raw_string_type
static const char * get_raw_string_type(const void *data)
Definition: ffprobe.c:271
SECTION_ID_ROOT
@ SECTION_ID_ROOT
Definition: ffprobe.c:230
AVIAMFLayer::ch_layout
AVChannelLayout ch_layout
Definition: iamf.h:288
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
nb_streams
static int nb_streams
Definition: ffprobe.c:383
ffprobe_show_program_version
static void ffprobe_show_program_version(WriterContext *w)
Definition: ffprobe.c:4072
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
IN_STREAM_GROUP
#define IN_STREAM_GROUP
Definition: ffprobe.c:3239
AVSubtitle::pts
int64_t pts
Same as packet pts, in AV_TIME_BASE.
Definition: avcodec.h:2233
pixel_formats
static enum AVPixelFormat pixel_formats[]
Definition: vf_sr.c:67
do_show_chapter_tags
static int do_show_chapter_tags
Definition: ffprobe.c:130
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:127
AV_DOVI_MAPPING_POLYNOMIAL
@ AV_DOVI_MAPPING_POLYNOMIAL
Definition: dovi_meta.h:95
AVFrame::crop_right
size_t crop_right
Definition: frame.h:724
CompactContext::nested_section
int nested_section[SECTION_MAX_NB_LEVELS]
Definition: ffprobe.c:1240
AVCodecContext::rc_max_rate
int64_t rc_max_rate
maximum bitrate
Definition: avcodec.h:1292
SECTION_ID_STREAM_GROUP_SUBPIECE
@ SECTION_ID_STREAM_GROUP_SUBPIECE
Definition: ffprobe.c:222
flat_writer
static const Writer flat_writer
Definition: ffprobe.c:1525
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
AVFilmGrainH274Params::comp_model_value
int16_t comp_model_value[3][256][6]
Specifies the model values for the component for each intensity interval.
Definition: film_grain_params.h:227
filter_codec_opts
int filter_codec_opts(const AVDictionary *opts, enum AVCodecID codec_id, AVFormatContext *s, AVStream *st, const AVCodec *codec, AVDictionary **dst)
Filter out options for given codec.
Definition: cmdutils.c:990
key
const char * key
Definition: hwcontext_opencl.c:189
AVCodecParameters::nb_coded_side_data
int nb_coded_side_data
Amount of entries in coded_side_data.
Definition: codec_par.h:86
color_range
color_range
Definition: vf_selectivecolor.c:43
flat_escape_value_str
static const char * flat_escape_value_str(AVBPrint *dst, const char *src)
Definition: ffprobe.c:1463
InputStream::dec_ctx
AVCodecContext * dec_ctx
Definition: ffprobe.c:93
do_show_chapters
static int do_show_chapters
Definition: ffprobe.c:111
AVCOL_PRI_UNSPECIFIED
@ AVCOL_PRI_UNSPECIFIED
Definition: pixfmt.h:558
AVCPBProperties
This structure describes the bitrate properties of an encoded bitstream.
Definition: defs.h:269
AV_FILM_GRAIN_PARAMS_NONE
@ AV_FILM_GRAIN_PARAMS_NONE
Definition: film_grain_params.h:25
AVFormatContext::probe_score
int probe_score
format probing score.
Definition: avformat.h:1721
show_chapters
static int show_chapters(WriterContext *w, InputFile *ifile)
Definition: ffprobe.c:3775
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:215
find_stream_info
static int find_stream_info
Definition: ffprobe.c:164
frame
static AVFrame * frame
Definition: demux_decode.c:54
SECTION_ID_FRAME_LOGS
@ SECTION_ID_FRAME_LOGS
Definition: ffprobe.c:190
FF_CODEC_PROPERTY_FILM_GRAIN
#define FF_CODEC_PROPERTY_FILM_GRAIN
Definition: avcodec.h:1798
arg
const char * arg
Definition: jacosubdec.c:67
AVStereo3D::flags
int flags
Additional information about the frame packing.
Definition: stereo3d.h:182
do_show_pixel_format_flags
static int do_show_pixel_format_flags
Definition: ffprobe.c:126
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
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:244
section::name
const char * name
Definition: ffprobe.c:242
avio_flush
void avio_flush(AVIOContext *s)
Force flushing of buffered data.
Definition: aviobuf.c:222
AVFilmGrainH274Params::model_id
int model_id
Specifies the film grain simulation mode.
Definition: film_grain_params.h:137
open_input_file
static int open_input_file(InputFile *ifile, const char *filename, const char *print_filename)
Definition: ffprobe.c:3840
AVDOVINLQParams::linear_deadzone_threshold
uint64_t linear_deadzone_threshold
Definition: dovi_meta.h:131
InputFile::streams
InputStream * streams
Definition: ffprobe.c:99
av_color_range_name
const char * av_color_range_name(enum AVColorRange range)
Definition: pixdesc.c:3278
ReadInterval::start
int64_t start
Definition: ffprobe.c:155
AVDISCARD_ALL
@ AVDISCARD_ALL
discard all
Definition: defs.h:219
AVFormatContext
Format I/O context.
Definition: avformat.h:1255
print_int
#define print_int(k, v)
Definition: ffprobe.c:2014
AVFilmGrainAOMParams::uv_mult_luma
int uv_mult_luma[2]
Definition: film_grain_params.h:106
init_dynload
void init_dynload(void)
Initialize dynamic library loading.
Definition: cmdutils.c:78
opts
AVDictionary * opts
Definition: movenc.c:50
read_intervals
static ReadInterval * read_intervals
Definition: ffprobe.c:161
AVIAMFDemixingInfo
Demixing Info Parameter Data as defined in section 3.8.2 of IAMF.
Definition: iamf.h:119
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:766
SECTION_ID_STREAM_GROUPS
@ SECTION_ID_STREAM_GROUPS
Definition: ffprobe.c:229
avcodec_parameters_to_context
int avcodec_parameters_to_context(AVCodecContext *codec, const struct AVCodecParameters *par)
Fill the codec context based on the values from the supplied codec parameters.
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:545
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:156
avcodec_get_class
const AVClass * avcodec_get_class(void)
Get the AVClass for AVCodecContext.
Definition: options.c:185
SECTION_ID_FRAME_LOG
@ SECTION_ID_FRAME_LOG
Definition: ffprobe.c:189
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:782
NULL
#define NULL
Definition: coverity.c:32
compact_print_str
static void compact_print_str(WriterContext *wctx, const char *key, const char *value)
Definition: ffprobe.c:1346
av_hash_names
const char * av_hash_names(int i)
Get the names of available hash algorithms.
Definition: hash.c:98
print_ambient_viewing_environment
static void print_ambient_viewing_environment(WriterContext *w, const AVAmbientViewingEnvironment *env)
Definition: ffprobe.c:2391
SET_DO_SHOW
#define SET_DO_SHOW(id, varname)
Definition: ffprobe.c:4604
writer_print_section_header
static void writer_print_section_header(WriterContext *wctx, const void *data, int section_id)
Definition: ffprobe.c:785
print_color_range
static void print_color_range(WriterContext *w, enum AVColorRange color_range)
Definition: ffprobe.c:2643
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:103
compact_writer
static const Writer compact_writer
Definition: ffprobe.c:1369
StringValidation
StringValidation
Definition: ffprobe.c:517
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:1418
InputStream::st
AVStream * st
Definition: ffmpeg.h:353
AV_DICT_MULTIKEY
#define AV_DICT_MULTIKEY
Allow to store several equal keys in the dictionary.
Definition: dict.h:84
AVHDRVividColorTransformParams::color_saturation_gain
AVRational color_saturation_gain[8]
Indicates the color correction strength parameter.
Definition: hdr_dynamic_vivid_metadata.h:296
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:151
AV_DOVI_MAPPING_MMR
@ AV_DOVI_MAPPING_MMR
Definition: dovi_meta.h:96
OPT_EXPERT
#define OPT_EXPERT
Definition: cmdutils.h:142
ERROR
static void ERROR(const char *str)
Definition: audio_fifo.c:58
do_read_frames
static int do_read_frames
Definition: ffprobe.c:109
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:268
SECTION_ID_LIBRARY_VERSION
@ SECTION_ID_LIBRARY_VERSION
Definition: ffprobe.c:191
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:362
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
AVIAMFParamDefinition::duration
unsigned int duration
The accumulated duration of all blocks in this parameter definition, in units of 1 / parameter_rate.
Definition: iamf.h:222
version.h
SECTION_ID_STREAM_TAGS
@ SECTION_ID_STREAM_TAGS
Definition: ffprobe.c:234
isnan
#define isnan(x)
Definition: libm.h:340
writer_printf
#define writer_printf(wctx_, fmt_,...)
Definition: ffprobe.c:1040
SHOW_OPTIONAL_FIELDS_ALWAYS
#define SHOW_OPTIONAL_FIELDS_ALWAYS
Definition: ffprobe.c:146
AVPacketSideData::type
enum AVPacketSideDataType type
Definition: packet.h:376
print_q
#define print_q(k, v, s)
Definition: ffprobe.c:2015
AVFormatContext::pb
AVIOContext * pb
I/O context.
Definition: avformat.h:1297
av_log_set_flags
void av_log_set_flags(int arg)
Definition: log.c:452
AV_RN32
#define AV_RN32(p)
Definition: intreadwrite.h:362
parseutils.h
AVIAMFLayer
A layer defining a Channel Layout in the Audio Element.
Definition: iamf.h:285
SECTION_ID_STREAM_GROUP_PIECE
@ SECTION_ID_STREAM_GROUP_PIECE
Definition: ffprobe.c:220
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:310
WriterContext::name
char * name
name of this writer instance
Definition: ffprobe.c:551
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:283
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:823
av_color_primaries_name
const char * av_color_primaries_name(enum AVColorPrimaries primaries)
Definition: pixdesc.c:3296
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_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
print_pkt_side_data
static void print_pkt_side_data(WriterContext *w, AVCodecParameters *par, const AVPacketSideData *sd, SectionID id_data)
Definition: ffprobe.c:2527
AV_DICT_DONT_OVERWRITE
#define AV_DICT_DONT_OVERWRITE
Don't overwrite existing entries.
Definition: dict.h:81
AVFrame::pkt_dts
int64_t pkt_dts
DTS copied from the AVPacket that triggered returning this frame.
Definition: frame.h:463
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:128
xml_init
static av_cold int xml_init(WriterContext *wctx)
Definition: ffprobe.c:1830
WriterContext::sections
const struct section * sections
array containing all sections
Definition: ffprobe.c:554
avio_w8
void avio_w8(AVIOContext *s, int b)
Definition: aviobuf.c:178
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:172
csv_writer
static const Writer csv_writer
Definition: ffprobe.c:1400
print_color_trc
static void print_color_trc(WriterContext *w, enum AVColorTransferCharacteristic color_trc)
Definition: ffprobe.c:2673
unit_value::val
union unit_value::@10 val
print_stream_group_params
static void print_stream_group_params(WriterContext *w, AVStreamGroup *stg)
Definition: ffprobe.c:3702
AVCodecParameters::ch_layout
AVChannelLayout ch_layout
Audio only.
Definition: codec_par.h:180
AVFilmGrainParams::subsampling_x
int subsampling_x
Intended subsampling ratio, or 0 for luma-only streams.
Definition: film_grain_params.h:274
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:116
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:266
bin_str
const char * bin_str
Definition: ffprobe.c:367
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:3083
real_options
static const OptionDef real_options[]
Definition: ffprobe.c:4542
AV_PKT_DATA_CONTENT_LIGHT_LEVEL
@ AV_PKT_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
Definition: packet.h:236
AVCOL_RANGE_UNSPECIFIED
@ AVCOL_RANGE_UNSPECIFIED
Definition: pixfmt.h:649
WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER
#define WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER
Definition: ffprobe.c:515
AVCodecParameters::level
int level
Definition: codec_par.h:129
WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS
#define WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS
Definition: ffprobe.c:514
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:380
program_birth_year
const int program_birth_year
program birth year, defined by the program for show_banner()
Definition: ffprobe.c:104
AVCodecParameters::sample_rate
int sample_rate
Audio only.
Definition: codec_par.h:184
AVIAMFLayer::output_gain_flags
unsigned int output_gain_flags
Output gain channel flags as defined in section 3.6.2 of IAMF.
Definition: iamf.h:301
pthread_mutex_unlock
#define pthread_mutex_unlock(a)
Definition: ffprobe.c:81
AVAudioServiceType
AVAudioServiceType
Definition: defs.h:222
av_hash_freep
void av_hash_freep(AVHashContext **ctx)
Free hash context and set hash context pointer to NULL.
Definition: hash.c:248
AVFrame::crop_bottom
size_t crop_bottom
Definition: frame.h:722
show_format
static int show_format(WriterContext *w, InputFile *ifile)
Definition: ffprobe.c:3800
AVStream::nb_frames
int64_t nb_frames
number of frames in this stream if known or 0
Definition: avformat.h:804
SECTION_ID_CHAPTER
@ SECTION_ID_CHAPTER
Definition: ffprobe.c:172
AVIAMFSubmixElement::audio_element_id
unsigned int audio_element_id
The id of the Audio Element this submix element references.
Definition: iamf.h:443
avcodec_find_decoder
const AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
Definition: allcodecs.c:971
xml_print_int
static void xml_print_int(WriterContext *wctx, const char *key, int64_t value)
Definition: ffprobe.c:1962
print_duration_time
#define print_duration_time(k, v, tb)
Definition: ffprobe.c:2021
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
AVFrame::best_effort_timestamp
int64_t best_effort_timestamp
frame timestamp estimated using various heuristics, in stream time base
Definition: frame.h:643
AVCodecParameters::extradata_size
int extradata_size
Size of the extradata content in bytes.
Definition: codec_par.h:73
AVIAMFSubmix
Submix layout as defined in section 3.7 of IAMF.
Definition: iamf.h:543
show_value_unit
static int show_value_unit
Definition: ffprobe.c:138
AVFormatContext::nb_streams
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
Definition: avformat.h:1311
color_primaries
static const AVColorPrimariesDesc color_primaries[AVCOL_PRI_NB]
Definition: csp.c:76
AV_STREAM_GROUP_PARAMS_TILE_GRID
@ AV_STREAM_GROUP_PARAMS_TILE_GRID
Definition: avformat.h:1084
print_input_filename
static const char * print_input_filename
Definition: ffprobe.c:358
AVFilmGrainAOMParams::num_uv_points
int num_uv_points[2]
If chroma_scaling_from_luma is set to 0, signals the chroma scaling function parameters.
Definition: film_grain_params.h:62
AVIAMFReconGain::subblock_duration
unsigned int subblock_duration
Duration for the given subblock, in units of 1 / parameter_rate.
Definition: iamf.h:147
SECTION_ID_FRAMES
@ SECTION_ID_FRAMES
Definition: ffprobe.c:179
codec_opts
AVDictionary * codec_opts
Definition: cmdutils.c:61
AVFrame::crop_left
size_t crop_left
Definition: frame.h:723
FrameData::pkt_size
int pkt_size
Definition: ffprobe.c:87
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:1209
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:2499
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:683
fmt_ctx
static AVFormatContext * fmt_ctx
Definition: decode_filter_audio.c:45
WRITER_STRING_VALIDATION_IGNORE
@ WRITER_STRING_VALIDATION_IGNORE
Definition: ffprobe.c:520
writer_w8
#define writer_w8(wctx_, b_)
Definition: ffprobe.c:1038
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:62
AVIOContext
Bytestream IO Context.
Definition: avio.h:160
SECTION_ID_STREAM_GROUP_PIECES
@ SECTION_ID_STREAM_GROUP_PIECES
Definition: ffprobe.c:219
AVFrame::pict_type
enum AVPictureType pict_type
Picture type of the frame.
Definition: frame.h:446
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:365
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:61
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:83
WriterContext::string_validation_utf8_flags
unsigned int string_validation_utf8_flags
Definition: ffprobe.c:573
DefaultContext::noprint_wrappers
int noprint_wrappers
Definition: ffprobe.c:1087
OPT_TYPE_INT
@ OPT_TYPE_INT
Definition: cmdutils.h:84
AVIAMFDemixingInfo::subblock_duration
unsigned int subblock_duration
Duration for the given subblock, in units of 1 / parameter_rate.
Definition: iamf.h:127
av_log_set_callback
void av_log_set_callback(void(*callback)(void *, int, const char *, va_list))
Set the logging callback.
Definition: log.c:462
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:523
ReadInterval::start_is_offset
int start_is_offset
Definition: ffprobe.c:157
do_show_packet_tags
static int do_show_packet_tags
Definition: ffprobe.c:136
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:681
SECTION_ID_STREAM_DISPOSITION
@ SECTION_ID_STREAM_DISPOSITION
Definition: ffprobe.c:232
avformat_alloc_context
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
Definition: options.c:160
AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT
@ AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT
Ambient viewing environment metadata, as defined by H.274.
Definition: frame.h:220
av_bprint_finalize
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
Definition: bprint.c:240
PRINT_PIX_FMT_FLAG
#define PRINT_PIX_FMT_FLAG(flagname, name)
Definition: ffprobe.c:4117
writer_w8_avio
static void writer_w8_avio(WriterContext *wctx, int b)
Definition: ffprobe.c:645
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
AVFilmGrainH274Params::component_model_present
int component_model_present[3]
Indicates if the modelling of film grain for a given component is present.
Definition: film_grain_params.h:192
AV_DOVI_NLQ_LINEAR_DZ
@ AV_DOVI_NLQ_LINEAR_DZ
Definition: dovi_meta.h:119
AV_PKT_DATA_DYNAMIC_HDR10_PLUS
@ AV_PKT_DATA_DYNAMIC_HDR10_PLUS
HDR10+ dynamic metadata associated with a video frame.
Definition: packet.h:300
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:1813
AVFormatContext::url
char * url
input or output URL.
Definition: avformat.h:1371
SECTION_FLAG_IS_ARRAY
#define SECTION_FLAG_IS_ARRAY
the section contains an array of elements of the same type
Definition: ffprobe.c:245
AVCodecContext::pkt_timebase
AVRational pkt_timebase
Timebase in which pkt_dts/pts and AVPacket.dts/pts are expressed.
Definition: avcodec.h:551
SectionID
SectionID
Definition: ffprobe.c:170
REALLOCZ_ARRAY_STREAM
#define REALLOCZ_ARRAY_STREAM(ptr, cur_n, new_n)
Definition: ffprobe.c:2034
SECTION_ID_STREAM_GROUP_COMPONENT
@ SECTION_ID_STREAM_GROUP_COMPONENT
Definition: ffprobe.c:216
uninit_opts
void uninit_opts(void)
Uninitialize the cmdutils option system, in particular free the *_opts contexts and their contents.
Definition: cmdutils.c:65
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:173
AV_ESCAPE_MODE_XML
@ AV_ESCAPE_MODE_XML
Use XML non-markup character data escaping.
Definition: avstring.h:318
AVHDRVividColorTransformParams::average_maxrgb
AVRational average_maxrgb
Indicates the average brightness of the displayed content.
Definition: hdr_dynamic_vivid_metadata.h:246
show_private_data
static int show_private_data
Definition: ffprobe.c:142
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:662
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:240
AVStreamGroup::iamf_audio_element
struct AVIAMFAudioElement * iamf_audio_element
Definition: avformat.h:1123
opt_show_versions
static int opt_show_versions(void *optctx, const char *opt, const char *arg)
Definition: ffprobe.c:4516
AVFrameSideData::data
uint8_t * data
Definition: frame.h:252
AVFilmGrainParams
This structure describes how to handle film grain synthesis in video for specific codecs.
Definition: film_grain_params.h:238
opt_input_file
static int opt_input_file(void *optctx, const char *arg)
Definition: ffprobe.c:4278
AVCodecParameters::profile
int profile
Codec-specific bitstream restrictions that the stream conforms to.
Definition: codec_par.h:128
PAL
#define PAL
Definition: bktr.c:67
AVCHROMA_LOC_UNSPECIFIED
@ AVCHROMA_LOC_UNSPECIFIED
Definition: pixfmt.h:703
ffprobe_show_library_versions
static void ffprobe_show_library_versions(WriterContext *w)
Definition: ffprobe.c:4103
printf
printf("static const uint8_t my_array[100] = {\n")
AVFrame::format
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
Definition: frame.h:431
SECTION_ID_PACKETS_AND_FRAMES
@ SECTION_ID_PACKETS_AND_FRAMES
Definition: ffprobe.c:196
AVOption::name
const char * name
Definition: opt.h:347
use_value_prefix
static int use_value_prefix
Definition: ffprobe.c:139
SECTION_ID_ERROR
@ SECTION_ID_ERROR
Definition: ffprobe.c:175
AVFilmGrainParams::codec
union AVFilmGrainParams::@357 codec
Additional fields may be added both here and in any structure included.
DefaultContext::nested_section
int nested_section[SECTION_MAX_NB_LEVELS]
Definition: ffprobe.c:1088
AVCPBProperties::min_bitrate
int64_t min_bitrate
Minimum bitrate of the stream, in bits per second.
Definition: defs.h:279
unit_value
Definition: ffprobe.c:452
AVSubtitle::end_display_time
uint32_t end_display_time
Definition: avcodec.h:2230
avdevice.h
show_error
static void show_error(WriterContext *w, int err)
Definition: ffprobe.c:3832
Writer::flags
int flags
a combination or WRITER_FLAG_*
Definition: ffprobe.c:537
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:347
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:1614
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:650
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
print_frame_side_data
static void print_frame_side_data(WriterContext *w, const AVFrame *frame, const AVStream *stream)
Definition: ffprobe.c:2825
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:130
AVPacket::dts
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
Definition: packet.h:521
avio_write
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
Definition: aviobuf.c:200
AVSphericalMapping::padding
uint32_t padding
Number of pixels to pad from the edge of each cube face.
Definition: spherical.h:178
AVIAMFParamDefinition::constant_subblock_duration
unsigned int constant_subblock_duration
The duration of every subblock in the case where all subblocks, with the optional exception of the la...
Definition: iamf.h:229
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:568
AVIAMFAudioElement
Information on how to combine one or more audio streams, as defined in section 3.6 of IAMF.
Definition: iamf.h:347
section::children_ids
const SectionID children_ids[SECTION_MAX_NB_CHILDREN+1]
list of children section IDS, terminated by -1
Definition: ffprobe.c:251
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:181
SECTION_ID_PACKET_TAGS
@ SECTION_ID_PACKET_TAGS
Definition: ffprobe.c:194
AVStreamGroupTileGrid::nb_tiles
unsigned int nb_tiles
Amount of tiles in the grid.
Definition: avformat.h:990
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:66
line
Definition: graph2dot.c:48
SECTION_ID_STREAM_GROUP_STREAM_TAGS
@ SECTION_ID_STREAM_GROUP_STREAM_TAGS
Definition: ffprobe.c:213
AVIAMFMixGain
Mix Gain Parameter Data as defined in section 3.8.1 of IAMF.
Definition: iamf.h:68
AVPacket::flags
int flags
A combination of AV_PKT_FLAG values.
Definition: packet.h:528
av_packet_alloc
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
Definition: avpacket.c:63
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:223
do_show_format
static int do_show_format
Definition: ffprobe.c:113
AVCPBProperties::avg_bitrate
int64_t avg_bitrate
Average bitrate of the stream, in bits per second.
Definition: defs.h:284
AVFilmGrainParams::h274
AVFilmGrainH274Params h274
Definition: film_grain_params.h:261
ReadInterval
Definition: ffprobe.c:153
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:896
AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT
@ AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT
Definition: avformat.h:1082
ini_print_int
static void ini_print_int(WriterContext *wctx, const char *key, int64_t value)
Definition: ffprobe.c:1625
compact_print_int
static void compact_print_int(WriterContext *wctx, const char *key, int64_t value)
Definition: ffprobe.c:1359
OPT_TYPE_FUNC
@ OPT_TYPE_FUNC
Definition: cmdutils.h:81
AV_STEREO3D_FLAG_INVERT
#define AV_STEREO3D_FLAG_INVERT
Inverted views, Right/Bottom represents the left view.
Definition: stereo3d.h:164
AVStreamGroup::streams
AVStream ** streams
A list of streams in the group.
Definition: avformat.h:1156
AVFilmGrainAOMParams::ar_coeffs_y
int8_t ar_coeffs_y[24]
Luma auto-regression coefficients.
Definition: film_grain_params.h:80
Writer
Definition: ffprobe.c:524
section::entries_to_show
AVDictionary * entries_to_show
Definition: ffprobe.c:254
OPT_TYPE_BOOL
@ OPT_TYPE_BOOL
Definition: cmdutils.h:82
AVStreamGroup::iamf_mix_presentation
struct AVIAMFMixPresentation * iamf_mix_presentation
Definition: avformat.h:1124
do_show_stream_disposition
static int do_show_stream_disposition
Definition: ffprobe.c:120
do_show_stream_groups
static int do_show_stream_groups
Definition: ffprobe.c:117
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:191
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:526
AVChromaLocation
AVChromaLocation
Location of chroma samples.
Definition: pixfmt.h:702
registered_writers
static const Writer * registered_writers[MAX_REGISTERED_WRITERS_NB+1]
Definition: ffprobe.c:1044
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:549
do_count_packets
static int do_count_packets
Definition: ffprobe.c:108
iformat
static const AVInputFormat * iformat
Definition: ffprobe.c:359
SHOW_OPTIONAL_FIELDS_AUTO
#define SHOW_OPTIONAL_FIELDS_AUTO
Definition: ffprobe.c:144
pthread_mutex_destroy
static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
Definition: os2threads.h:112
layout
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 layout
Definition: filter_design.txt:18
AV_PKT_DATA_STRINGS_METADATA
@ AV_PKT_DATA_STRINGS_METADATA
A list of zero terminated key/value strings.
Definition: packet.h:173
ReadInterval::has_start
int has_start
Definition: ffprobe.c:156
sections
static struct section sections[]
Definition: ffprobe.c:282
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
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:299
unit_value::unit
const char * unit
Definition: ffprobe.c:454
WriterContext::writer_put_str
void(* writer_put_str)(WriterContext *wctx, const char *str)
Definition: ffprobe.c:548
SECTION_ID_PROGRAM_STREAM_TAGS
@ SECTION_ID_PROGRAM_STREAM_TAGS
Definition: ffprobe.c:205
JSONContext::indent_level
int indent_level
Definition: ffprobe.c:1644
section::flags
int flags
Definition: ffprobe.c:250
avcodec_send_packet
int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt)
Supply raw packet data as input to a decoder.
Definition: decode.c:674
av_opt_next
const AVOption * av_opt_next(const void *obj, const AVOption *last)
Iterate over all AVOptions belonging to obj.
Definition: opt.c:48
AV_PKT_DATA_CPB_PROPERTIES
@ AV_PKT_DATA_CPB_PROPERTIES
This side data corresponds to the AVCPBProperties struct.
Definition: packet.h:146
AVFrame::nb_samples
int nb_samples
number of audio samples (per channel) described by this frame
Definition: frame.h:424
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
AVStreamGroupTileGrid::width
int width
Width of the final image for presentation.
Definition: avformat.h:1067
AVSphericalMapping::roll
int32_t roll
Rotation around the forward vector [-180, 180].
Definition: spherical.h:124
AVSubtitle::format
uint16_t format
Definition: avcodec.h:2228
AVClassCategory
AVClassCategory
Definition: log.h:28
AVFilmGrainParams::color_primaries
enum AVColorPrimaries color_primaries
Definition: film_grain_params.h:280
AV_STREAM_GROUP_PARAMS_NONE
@ AV_STREAM_GROUP_PARAMS_NONE
Definition: avformat.h:1081
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
AVPacket::pts
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: packet.h:515
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
AVIAMFParamDefinition::parameter_id
unsigned int parameter_id
Identifier for the paremeter substream.
Definition: iamf.h:209
AVCodecContext::properties
unsigned properties
Properties of the stream that gets decoded.
Definition: avcodec.h:1795
SECTION_ID_PROGRAM
@ SECTION_ID_PROGRAM
Definition: ffprobe.c:206
AVChapter::id
int64_t id
unique ID to identify the chapter
Definition: avformat.h:1215
print_color_space
static void print_color_space(WriterContext *w, enum AVColorSpace color_space)
Definition: ffprobe.c:2653
ffprobe_show_pixel_formats
static void ffprobe_show_pixel_formats(WriterContext *w)
Definition: ffprobe.c:4122
WRITER_STRING_VALIDATION_NB
@ WRITER_STRING_VALIDATION_NB
Definition: ffprobe.c:521
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:252
show_usage
static void show_usage(void)
Definition: ffprobe.c:4065
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:560
AVFilmGrainH274Params
This structure describes how to handle film grain synthesis for codecs using the ITU-T H....
Definition: film_grain_params.h:132
csv_options
static const AVOption csv_options[]
Definition: ffprobe.c:1386
SECTION_ID_STREAM_GROUP_STREAM
@ SECTION_ID_STREAM_GROUP_STREAM
Definition: ffprobe.c:226
ALPHA
@ ALPHA
Definition: drawutils.c:33
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:83
show_subtitle
static void show_subtitle(WriterContext *w, AVSubtitle *sub, AVStream *stream, AVFormatContext *fmt_ctx)
Definition: ffprobe.c:2802
AVCodecParameters::height
int height
Definition: codec_par.h:135
print_private_data
static void print_private_data(WriterContext *w, void *priv_data)
Definition: ffprobe.c:2630
XMLContext::xsd_strict
int xsd_strict
Definition: ffprobe.c:1814
AVFilmGrainH274Params::num_intensity_intervals
uint16_t num_intensity_intervals[3]
Specifies the number of intensity intervals for which a specific set of model values has been estimat...
Definition: film_grain_params.h:198
do_bitexact
static int do_bitexact
Definition: ffprobe.c:106
av_malloc_array
#define av_malloc_array(a, b)
Definition: tableprint_vlc.h:31
AVColorSpace
AVColorSpace
YUV colorspace type.
Definition: pixfmt.h:609
display.h
SECTION_ID_PACKETS
@ SECTION_ID_PACKETS
Definition: ffprobe.c:195
AV_FIELD_BB
@ AV_FIELD_BB
Bottom coded first, bottom displayed first.
Definition: defs.h:202
AVIAMFMixPresentation
Information on how to render and mix one or more AVIAMFAudioElement to generate the final audio outpu...
Definition: iamf.h:600
AVFilmGrainParams::subsampling_y
int subsampling_y
Definition: film_grain_params.h:274
xml_writer
static Writer xml_writer
Definition: ffprobe.c:1967
AVCPBProperties::max_bitrate
int64_t max_bitrate
Maximum bitrate of the stream, in bits per second.
Definition: defs.h:274
AVDOVIDataMapping::num_y_partitions
uint32_t num_y_partitions
Definition: dovi_meta.h:148
LogBuffer::category
AVClassCategory category
Definition: ffprobe.c:395
writer_print_ts
static void writer_print_ts(WriterContext *wctx, const char *key, int64_t ts, int is_duration)
Definition: ffprobe.c:960
parse_options
int parse_options(void *optctx, int argc, char **argv, const OptionDef *options, int(*parse_arg_function)(void *, const char *))
Definition: cmdutils.c:408
opt_show_entries
static int opt_show_entries(void *optctx, const char *opt, const char *arg)
Definition: ffprobe.c:4228
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:227
SECTION_ID_FRAME_SIDE_DATA
@ SECTION_ID_FRAME_SIDE_DATA
Definition: ffprobe.c:182
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:185
opt_sections
static int opt_sections(void *optctx, const char *opt, const char *arg)
Definition: ffprobe.c:4503
CompactContext::escape_str
const char *(* escape_str)(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
Definition: ffprobe.c:1239
WriterContext::priv
void * priv
private data for use by the filter
Definition: ffprobe.c:552
OPT_FUNC_ARG
#define OPT_FUNC_ARG
Definition: cmdutils.h:136
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:254
AVHDRVividColorTransformParams
Color transform parameters at a processing window in a dynamic metadata for CUVA 005....
Definition: hdr_dynamic_vivid_metadata.h:233
AVFilmGrainAOMParams::scaling_shift
int scaling_shift
Specifies the shift applied to the chroma components.
Definition: film_grain_params.h:69
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
AVProgram
New fields can be added to the end with minor version bumps.
Definition: avformat.h:1179
AVCodecParameters::color_range
enum AVColorRange color_range
Video only.
Definition: codec_par.h:166
AVMasteringDisplayMetadata
Mastering display metadata capable of representing the color volume of the display used to master the...
Definition: mastering_display_metadata.h:38
AVFrame::side_data
AVFrameSideData ** side_data
Definition: frame.h:577
upcase_string
static char * upcase_string(char *dst, size_t dst_size, const char *src)
Definition: ffprobe.c:1105
profile
int profile
Definition: mxfenc.c:2226
AVCOL_SPC_UNSPECIFIED
@ AVCOL_SPC_UNSPECIFIED
Definition: pixfmt.h:612
do_show_stream_group_disposition
static int do_show_stream_group_disposition
Definition: ffprobe.c:121
AVDOVINLQParams
Coefficients of the non-linear inverse quantization.
Definition: dovi_meta.h:126
dec_str
const char * dec_str
Definition: ffprobe.c:368
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:150
AVCodecParameters::coded_side_data
AVPacketSideData * coded_side_data
Additional data associated with the entire stream.
Definition: codec_par.h:81
SECTION_ID_PACKET_SIDE_DATA
@ SECTION_ID_PACKET_SIDE_DATA
Definition: ffprobe.c:198
ambient_viewing_environment.h
use_value_sexagesimal_format
static int use_value_sexagesimal_format
Definition: ffprobe.c:141
SECTION_ID_LIBRARY_VERSIONS
@ SECTION_ID_LIBRARY_VERSIONS
Definition: ffprobe.c:192
AV_FRAME_FLAG_INTERLACED
#define AV_FRAME_FLAG_INTERLACED
A flag to mark frames whose content is interlaced.
Definition: frame.h:603
AVStreamGroup::params
union AVStreamGroup::@298 params
Group type-specific parameters.
av_calloc
void * av_calloc(size_t nmemb, size_t size)
Definition: mem.c:262
AVFilmGrainH274Params::intensity_interval_lower_bound
uint8_t intensity_interval_lower_bound[3][256]
Specifies the lower ounds of each intensity interval for whichthe set of model values applies for the...
Definition: film_grain_params.h:210
SECTION_ID_FRAME_SIDE_DATA_TIMECODE
@ SECTION_ID_FRAME_SIDE_DATA_TIMECODE
Definition: ffprobe.c:184
AVIAMFParamDefinition::nb_subblocks
unsigned int nb_subblocks
Number of subblocks in the array.
Definition: iamf.h:199
LogBuffer::parent_name
char * parent_name
Definition: ffprobe.c:396
AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE
@ AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE
Definition: iamf.h:337
log2
#define log2(x)
Definition: libm.h:404
AVCodecParameters::field_order
enum AVFieldOrder field_order
Video only.
Definition: codec_par.h:161
SECTION_ID_PROGRAM_VERSION
@ SECTION_ID_PROGRAM_VERSION
Definition: ffprobe.c:210
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:1227
AVDOVIDataMapping::curves
AVDOVIReshapingCurve curves[3]
Definition: dovi_meta.h:143
AVStreamGroupTileGrid::horizontal
int horizontal
Offset in pixels from the left edge of the canvas where the tile should be placed.
Definition: avformat.h:1026
ini_writer
static const Writer ini_writer
Definition: ffprobe.c:1630
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:543
PRINT_STRING_OPT
#define PRINT_STRING_OPT
Definition: ffprobe.c:893
AVDOVINLQParams::linear_deadzone_slope
uint64_t linear_deadzone_slope
Definition: dovi_meta.h:130
SECTION_ID_PROGRAMS
@ SECTION_ID_PROGRAMS
Definition: ffprobe.c:211
version.h
json_print_str
static void json_print_str(WriterContext *wctx, const char *key, const char *value)
Definition: ffprobe.c:1765
AVIAMFSubmix::nb_layouts
unsigned int nb_layouts
Number of layouts in the submix.
Definition: iamf.h:574
WriterContext::string_validation_replacement
char * string_validation_replacement
Definition: ffprobe.c:572
AVFilmGrainParams::height
int height
Definition: film_grain_params.h:269
AVDOVIReshapingCurve
Definition: dovi_meta.h:104
version.h
section::get_type
const char *(* get_type)(const void *data)
function returning a type if defined, must be defined when SECTION_FLAG_HAS_TYPE is defined
Definition: ffprobe.c:255
AVStream::disposition
int disposition
Stream disposition - a combination of AV_DISPOSITION_* flags.
Definition: avformat.h:812
av_buffer_allocz
AVBufferRef * av_buffer_allocz(size_t size)
Same as av_buffer_alloc(), except the returned buffer will be initialized to zero.
Definition: buffer.c:93
tag
uint32_t tag
Definition: movenc.c:1786
AVStream::id
int id
Format-specific stream ID.
Definition: avformat.h:755
ret
ret
Definition: filter_design.txt:187
AVStream
Stream structure.
Definition: avformat.h:743
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:400
avcodec_flush_buffers
void avcodec_flush_buffers(AVCodecContext *avctx)
Reset the internal codec state / flush internal buffers.
Definition: avcodec.c:350
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
AVCPBProperties::buffer_size
int64_t buffer_size
The size of the buffer to which the ratecontrol is applied, in bits.
Definition: defs.h:290
AVSphericalMapping::pitch
int32_t pitch
Rotation around the right vector [-90, 90].
Definition: spherical.h:123
AVStreamGroup::metadata
AVDictionary * metadata
Metadata that applies to the whole group.
Definition: avformat.h:1136
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:73
flat_print_int
static void flat_print_int(WriterContext *wctx, const char *key, int64_t value)
Definition: ffprobe.c:1507
AVStereo3D::type
enum AVStereo3DType type
How views are packed within the video.
Definition: stereo3d.h:177
InputFile::streams
InputStream ** streams
Definition: ffmpeg.h:408
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:4341
AVHDRVivid3SplineParams
HDR Vivid three spline params.
Definition: hdr_dynamic_vivid_metadata.h:30
avformat.h
dovi_meta.h
av_bprintf
void av_bprintf(AVBPrint *buf, const char *fmt,...)
Definition: bprint.c:99
AVHDRVividColorTransformParams::minimum_maxrgb
AVRational minimum_maxrgb
Indicates the minimum brightness of the displayed content.
Definition: hdr_dynamic_vivid_metadata.h:239
dict.h
AVPacket::side_data
AVPacketSideData * side_data
Additional packet data that can be provided by the container.
Definition: packet.h:533
flat_init
static av_cold int flat_init(WriterContext *wctx)
Definition: ffprobe.c:1434
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
id
enum AVCodecID id
Definition: dts2pts.c:364
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:74
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:1190
log_buffer_size
static int log_buffer_size
Definition: ffprobe.c:401
U
#define U(x)
Definition: vpx_arith.h:37
AVCodecParameters::chroma_location
enum AVChromaLocation chroma_location
Definition: codec_par.h:170
AVDOVIReshapingCurve::num_pivots
uint8_t num_pivots
Definition: dovi_meta.h:105
AV_PKT_DATA_WEBVTT_IDENTIFIER
@ AV_PKT_DATA_WEBVTT_IDENTIFIER
The optional first identifier line of a WebVTT cue.
Definition: packet.h:197
avformat_network_deinit
int avformat_network_deinit(void)
Undo the initialization done by avformat_network_init.
Definition: utils.c:570
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:544
SECTION_ID_FRAME
@ SECTION_ID_FRAME
Definition: ffprobe.c:178
av_dovi_get_color
static av_always_inline AVDOVIColorMetadata * av_dovi_get_color(const AVDOVIMetadata *data)
Definition: dovi_meta.h:220
AVStreamGroup
Definition: avformat.h:1090
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:123
XML_INDENT
#define XML_INDENT()
Definition: ffprobe.c:1851
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:109
AVCodecContext
main external API structure.
Definition: avcodec.h:445
AVFrame::height
int height
Definition: frame.h:416
AVStream::index
int index
stream index in AVFormatContext
Definition: avformat.h:749
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
hash.h
CompactContext::nokey
int nokey
Definition: ffprobe.c:1236
AVFilmGrainAOMParams::ar_coeff_lag
int ar_coeff_lag
Specifies the auto-regression lag.
Definition: film_grain_params.h:74
WriterContext
Definition: ffprobe.c:542
AVDOVIDataMapping::mapping_chroma_format_idc
uint8_t mapping_chroma_format_idc
Definition: dovi_meta.h:142
AVStreamGroup::nb_streams
unsigned int nb_streams
Number of elements in AVStreamGroup.streams.
Definition: avformat.h:1143
get_packet_side_data_type
static const char * get_packet_side_data_type(const void *data)
Definition: ffprobe.c:259
AV_FILM_GRAIN_PARAMS_H274
@ AV_FILM_GRAIN_PARAMS_H274
The union is valid when interpreted as AVFilmGrainH274Params (codec.h274)
Definition: film_grain_params.h:35
channel_layout.h
AVIAMFSubmix::default_mix_gain
AVRational default_mix_gain
Default mix gain value to apply when there are no AVIAMFParamDefinition with output_mix_config's para...
Definition: iamf.h:590
JSONContext::item_sep
const char * item_sep
Definition: ffprobe.c:1646
nb_streams_packets
static uint64_t * nb_streams_packets
Definition: ffprobe.c:384
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:123
AVFilmGrainAOMParams::y_points
uint8_t y_points[14][2]
Definition: film_grain_params.h:50
AVFilmGrainAOMParams::uv_offset
int uv_offset[2]
Offset used for component scaling function.
Definition: film_grain_params.h:112
opt_common.h
DEFINE_OPT_SHOW_SECTION
#define DEFINE_OPT_SHOW_SECTION(section, target_section_id)
Definition: ffprobe.c:4523
AVInputFormat::flags
int flags
Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS, AVFMT_NOTIMESTAMPS,...
Definition: avformat.h:567
AVRational::den
int den
Denominator.
Definition: rational.h:60
PRINT_STRING_VALIDATE
#define PRINT_STRING_VALIDATE
Definition: ffprobe.c:894
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:235
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:143
AVFrame::metadata
AVDictionary * metadata
metadata.
Definition: frame.h:662
AVHDRVivid3SplineParams::th_enable
AVRational th_enable
3Spline_TH_enable of three Spline.
Definition: hdr_dynamic_vivid_metadata.h:49
av_bprint_clear
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
Definition: bprint.c:232
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:203
SECTION_ID_STREAM_GROUP_BLOCK
@ SECTION_ID_STREAM_GROUP_BLOCK
Definition: ffprobe.c:224
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:200
print_str_validate
#define print_str_validate(k, v)
Definition: ffprobe.c:2018
AVFrameSideData::type
enum AVFrameSideDataType type
Definition: frame.h:251
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:235
output_format
static char * output_format
Definition: ffprobe.c:149
AVFilmGrainH274Params::log2_scale_factor
int log2_scale_factor
Specifies a scale factor used in the film grain characterization equations.
Definition: film_grain_params.h:187
AVFilmGrainAOMParams::uv_mult
int uv_mult[2]
Specifies the luma/chroma multipliers for the index to the component scaling function.
Definition: film_grain_params.h:105
hdr_dynamic_metadata.h
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
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:1546
AVStream::r_frame_rate
AVRational r_frame_rate
Real base framerate of the stream.
Definition: avformat.h:909
print_dynamic_hdr10_plus
static void print_dynamic_hdr10_plus(WriterContext *w, const AVDynamicHDRPlus *metadata)
Definition: ffprobe.c:2222
AV_PKT_DATA_SKIP_SAMPLES
@ AV_PKT_DATA_SKIP_SAMPLES
Recommmends skipping the specified number of samples.
Definition: packet.h:157
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:354
do_show_pixel_formats
static int do_show_pixel_formats
Definition: ffprobe.c:125
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:593
AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN
@ AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN
Subblocks are of struct type AVIAMFMixGain.
Definition: iamf.h:164
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:145
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:1797
AVFormatContext::duration
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds.
Definition: avformat.h:1390
AVHDRVividColorToneMappingParams
Color tone mapping parameters at a processing window in a dynamic metadata for CUVA 005....
Definition: hdr_dynamic_vivid_metadata.h:77
AVPacket::stream_index
int stream_index
Definition: packet.h:524
AVFilmGrainH274Params::num_model_values
uint8_t num_model_values[3]
Specifies the number of model values present for each intensity interval in which the film grain has ...
Definition: film_grain_params.h:204
AVFilmGrainParams::color_range
enum AVColorRange color_range
Intended video signal characteristics.
Definition: film_grain_params.h:279
FlatContext::sep_str
const char * sep_str
Definition: ffprobe.c:1416
DEFINE_WRITER_CLASS
#define DEFINE_WRITER_CLASS(name)
Definition: ffprobe.c:1071
opt_print_filename
static int opt_print_filename(void *optctx, const char *opt, const char *arg)
Definition: ffprobe.c:4318
AVIAMFSubmix::nb_elements
unsigned int nb_elements
Number of elements in the submix.
Definition: iamf.h:559
get_stream_group_type
static const char * get_stream_group_type(const void *data)
Definition: ffprobe.c:276
AVFilmGrainAOMParams::overlap_flag
int overlap_flag
Signals whether to overlap film grain blocks.
Definition: film_grain_params.h:117
AVCodecContext::coded_width
int coded_width
Bitstream width / height, may be different from width/height e.g.
Definition: avcodec.h:633
tc
#define tc
Definition: regdef.h:69
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_strdup
char * av_strdup(const char *s)
Duplicate a string.
Definition: mem.c:270
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:273
XMLContext
Definition: ffprobe.c:1809
AVDOVIDecoderConfigurationRecord::dv_version_minor
uint8_t dv_version_minor
Definition: dovi_meta.h:54
Writer::print_section_header
void(* print_section_header)(WriterContext *wctx, const void *data)
Definition: ffprobe.c:532
do_show_program_tags
static int do_show_program_tags
Definition: ffprobe.c:133
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
WRITER_STRING_VALIDATION_REPLACE
@ WRITER_STRING_VALIDATION_REPLACE
Definition: ffprobe.c:519
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:353
AVIAMFAudioElement::demixing_info
AVIAMFParamDefinition * demixing_info
Demixing information used to reconstruct a scalable channel audio representation.
Definition: iamf.h:367
writer_printf_avio
static void writer_printf_avio(WriterContext *wctx, const char *fmt,...)
Definition: ffprobe.c:655
AVIAMFDemixingInfo::dmixp_mode
unsigned int dmixp_mode
Pre-defined combination of demixing parameters.
Definition: iamf.h:131
AVIAMFSubmix::output_mix_config
AVIAMFParamDefinition * output_mix_config
Information required for post-processing the mixed audio signal to generate the audio signal for play...
Definition: iamf.h:582
AVStreamGroup::type
enum AVStreamGroupParamsType type
Group type.
Definition: avformat.h:1117
AVIAMFLayer::ambisonics_mode
enum AVIAMFAmbisonicsMode ambisonics_mode
Ambisonics mode as defined in section 3.6.3 of IAMF.
Definition: iamf.h:319
CompactContext::item_sep_str
char * item_sep_str
Definition: ffprobe.c:1234
CompactContext::escape_mode_str
char * escape_mode_str
Definition: ffprobe.c:1238
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:225
AVCodecParameters::video_delay
int video_delay
Video only.
Definition: codec_par.h:175
FlatContext::sep
char sep
Definition: ffprobe.c:1417
JSONContext::item_start_end
const char * item_start_end
Definition: ffprobe.c:1646
AVFrameSideData
Structure to hold side data for an AVFrame.
Definition: frame.h:250
AVCodecParameters::format
int format
Definition: codec_par.h:92
AVDynamicHDRVivid::params
AVHDRVividColorTransformParams params[3]
The color transform parameters for every processing window.
Definition: hdr_dynamic_vivid_metadata.h:325
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
default_print_section_header
static void default_print_section_header(WriterContext *wctx, const void *data)
Definition: ffprobe.c:1114
bin_val
double bin_val
Definition: ffprobe.c:365
SECTION_ID_STREAM_GROUP_TAGS
@ SECTION_ID_STREAM_GROUP_TAGS
Definition: ffprobe.c:228
AVIAMFMixPresentation::annotations
AVDictionary * annotations
A dictionary of strings describing the mix in different languages.
Definition: iamf.h:628
SECTION_ID_FRAME_SIDE_DATA_TIMECODE_LIST
@ SECTION_ID_FRAME_SIDE_DATA_TIMECODE_LIST
Definition: ffprobe.c:183
WRITER_STRING_VALIDATION_FAIL
@ WRITER_STRING_VALIDATION_FAIL
Definition: ffprobe.c:518
AVFormatContext::nb_stream_groups
unsigned int nb_stream_groups
Number of elements in AVFormatContext.stream_groups.
Definition: avformat.h:1330
AVStreamGroupTileGrid::height
int height
Height of the final image for presentation.
Definition: avformat.h:1077
av_free
#define av_free(p)
Definition: tableprint_vlc.h:33
AVDictionaryEntry
Definition: dict.h:89
AVIAMFLayer::output_gain
AVRational output_gain
Output gain as defined in section 3.6.2 of IAMF.
Definition: iamf.h:307
compact_options
static const AVOption compact_options[]
Definition: ffprobe.c:1248
CompactContext::has_nested_elems
int has_nested_elems[SECTION_MAX_NB_LEVELS]
Definition: ffprobe.c:1241
AVCodecParameters::codec_id
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:55
AV_OPT_FLAG_EXPORT
#define AV_OPT_FLAG_EXPORT
The option is intended for exporting values to the caller.
Definition: opt.h:280
OPT_TYPE_STRING
@ OPT_TYPE_STRING
Definition: cmdutils.h:83
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:472
AVPacket
This structure stores compressed data.
Definition: packet.h:499
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:251
AVFrame::crop_top
size_t crop_top
Definition: frame.h:721
WriterContext::nb_sections
int nb_sections
number of sections
Definition: ffprobe.c:555
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:88
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:237
cmdutils.h
show_stream
static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_idx, InputStream *ist, int container)
Definition: ffprobe.c:3241
AVPacket::pos
int64_t pos
byte position in stream, -1 if unknown
Definition: packet.h:542
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:2321
av_frame_side_data_name
const char * av_frame_side_data_name(enum AVFrameSideDataType type)
Definition: frame.c:909
SHOW_LIB_VERSION
#define SHOW_LIB_VERSION(libname, LIBNAME)
Definition: ffprobe.c:4088
IN_PROGRAM
#define IN_PROGRAM
Definition: ffprobe.c:3238
writer_print_rational
static void writer_print_rational(WriterContext *wctx, const char *key, AVRational q, char sep)
Definition: ffprobe.c:934
d
d
Definition: ffmpeg_filter.c:409
AVIAMFSubmixElement::element_mix_config
AVIAMFParamDefinition * element_mix_config
Information required required for applying any processing to the referenced and rendered Audio Elemen...
Definition: iamf.h:452
AVIAMFParamDefinition::parameter_rate
unsigned int parameter_rate
Sample rate for the paremeter substream.
Definition: iamf.h:213
XMLContext::indent_level
int indent_level
Definition: ffprobe.c:1812
int32_t
int32_t
Definition: audioconvert.c:56
AVIAMFSubmixElement
Submix element as defined in section 3.7 of IAMF.
Definition: iamf.h:437
AVDOVINLQParams::nlq_offset
uint16_t nlq_offset
Definition: dovi_meta.h:127
timestamp.h
AVStreamGroupTileGrid::offsets
struct AVStreamGroupTileGrid::@297 * offsets
An nb_tiles sized array of offsets in pixels from the topleft edge of the canvas, indicating where ea...
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:474
avio_close
int avio_close(AVIOContext *s)
Close the resource accessed by the AVIOContext s and free it.
Definition: avio.c:615
AV_IAMF_AUDIO_ELEMENT_TYPE_CHANNEL
@ AV_IAMF_AUDIO_ELEMENT_TYPE_CHANNEL
Definition: iamf.h:336
AVFrameSideData::metadata
AVDictionary * metadata
Definition: frame.h:254
AVCodecParameters::bit_rate
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
Definition: codec_par.h:97
av_opt_get
int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
Definition: opt.c:1145
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:314
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:1380
writer_print_section_footer
static void writer_print_section_footer(WriterContext *wctx)
Definition: ffprobe.c:810
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:1104
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:187
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:145
SECTION_ID_PROGRAM_STREAMS
@ SECTION_ID_PROGRAM_STREAMS
Definition: ffprobe.c:207
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:122
AVDOVIRpuDataHeader::disable_residual_flag
uint8_t disable_residual_flag
Definition: dovi_meta.h:91
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
AVERROR_EXIT
#define AVERROR_EXIT
Immediate exit was requested; the called function should not be restarted.
Definition: error.h:58
SECTION_ID_STREAM_GROUP_DISPOSITION
@ SECTION_ID_STREAM_GROUP_DISPOSITION
Definition: ffprobe.c:227
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:145
LogBuffer::parent_category
AVClassCategory parent_category
Definition: ffprobe.c:397
SECTION_ID_PROGRAM_STREAM_DISPOSITION
@ SECTION_ID_PROGRAM_STREAM_DISPOSITION
Definition: ffprobe.c:204
avcodec_descriptor_get
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
Definition: codec_desc.c:3727
AVHDRVivid3SplineParams::th_delta2
AVRational th_delta2
3Spline_TH_Delta2 of three Spline.
Definition: hdr_dynamic_vivid_metadata.h:63
AVIAMFAudioElement::recon_gain_info
AVIAMFParamDefinition * recon_gain_info
Recon gain information used to reconstruct a scalable channel audio representation.
Definition: iamf.h:374
AVStereo3D
Stereo 3D type: this structure describes how two videos are packed within a single video surface,...
Definition: stereo3d.h:173
AVDictionaryEntry::value
char * value
Definition: dict.h:91
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:792
SECTION_ID_STREAM_GROUP_SUBPIECES
@ SECTION_ID_STREAM_GROUP_SUBPIECES
Definition: ffprobe.c:221
show_data_hash
static char * show_data_hash
Definition: ffprobe.c:151
SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION
@ SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION
Definition: ffprobe.c:212
avstring.h
AVHDRVivid3SplineParams::th_enable_mb
AVRational 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:42
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:239
print_primaries
static void print_primaries(WriterContext *w, enum AVColorPrimaries color_primaries)
Definition: ffprobe.c:2663
AVAmbientViewingEnvironment::ambient_light_y
AVRational ambient_light_y
Normalized y chromaticity coordinate of the environmental ambient light in the nominal viewing enviro...
Definition: ambient_viewing_environment.h:54
do_show_streams
static int do_show_streams
Definition: ffprobe.c:119
AVFilmGrainAOMParams::chroma_scaling_from_luma
int chroma_scaling_from_luma
Signals whether to derive the chroma scaling function from the luma.
Definition: film_grain_params.h:56
AVStreamGroupTileGrid::idx
unsigned int idx
Index of the stream in the group this tile references.
Definition: avformat.h:1021
unit_value::d
double d
Definition: ffprobe.c:453
InputFile::nb_streams
int nb_streams
Definition: ffmpeg.h:409
print_iamf_mix_presentation_params
static void print_iamf_mix_presentation_params(WriterContext *w, const AVStreamGroup *stg, const AVIAMFMixPresentation *mix_presentation)
Definition: ffprobe.c:3683
AVColorRange
AVColorRange
Visual content value range.
Definition: pixfmt.h:648
AVChapter::time_base
AVRational time_base
time base in which the start/end timestamps are specified
Definition: avformat.h:1216
AV_FILM_GRAIN_PARAMS_AV1
@ AV_FILM_GRAIN_PARAMS_AV1
The union is valid when interpreted as AVFilmGrainAOMParams (codec.aom)
Definition: film_grain_params.h:30
int
int
Definition: ffmpeg_filter.c:409
AVHDRVividColorToneMappingParams::three_spline
AVHDRVivid3SplineParams three_spline[2]
Definition: hdr_dynamic_vivid_metadata.h:225
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:163
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:95
AVFilmGrainParams::type
enum AVFilmGrainParamsType type
Specifies the codec for which this structure is valid.
Definition: film_grain_params.h:242
AVIAMFMixPresentation::submixes
AVIAMFSubmix ** submixes
Array of submixes.
Definition: iamf.h:609
print_error
static 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.h:401
AVDOVIDataMapping::nlq
AVDOVINLQParams nlq[3]
Definition: dovi_meta.h:149
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:244
snprintf
#define snprintf
Definition: snprintf.h:34
stream_specifier
static char * stream_specifier
Definition: ffprobe.c:150
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:1012
log_callback
static void log_callback(void *ptr, int level, const char *fmt, va_list vl)
Definition: ffprobe.c:403
AVCodecParameters::initial_padding
int initial_padding
Audio only.
Definition: codec_par.h:203
AVFormatContext::priv_data
void * priv_data
Format private data.
Definition: avformat.h:1283
AVDOVIDataMapping
Dolby Vision RPU data mapping parameters.
Definition: dovi_meta.h:139
SECTION_ID_CHAPTERS
@ SECTION_ID_CHAPTERS
Definition: ffprobe.c:174
print_time
#define print_time(k, v, tb)
Definition: ffprobe.c:2019
default_print_str
static void default_print_str(WriterContext *wctx, const char *key, const char *value)
Definition: ffprobe.c:1152
AVSphericalMapping
This structure describes how to handle spherical videos, outlining information about projection,...
Definition: spherical.h:78
av_color_transfer_name
const char * av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
Definition: pixdesc.c:3317
print_str_opt
#define print_str_opt(k, v)
Definition: ffprobe.c:2017
av_tolower
static av_const int av_tolower(int c)
Locale-independent conversion of ASCII characters to lowercase.
Definition: avstring.h:237
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:567
av_dict_iterate
const AVDictionaryEntry * av_dict_iterate(const AVDictionary *m, const AVDictionaryEntry *prev)
Iterate over a dictionary.
Definition: dict.c:44
AVSubtitle::start_display_time
uint32_t start_display_time
Definition: avcodec.h:2229
CompactContext::terminate_line
int terminate_line[SECTION_MAX_NB_LEVELS]
Definition: ffprobe.c:1242
default_print_section_footer
static void default_print_section_footer(WriterContext *wctx)
Definition: ffprobe.c:1139
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:201
INIContext::hierarchical
int hierarchical
Definition: ffprobe.c:1540
AVFrame::repeat_pict
int repeat_pict
Number of fields in this frame which should be repeated, i.e.
Definition: frame.h:512
AVSphericalMapping::yaw
int32_t yaw
Rotation around the up vector [-180, 180].
Definition: spherical.h:122
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:116
SECTION_ID_PACKET
@ SECTION_ID_PACKET
Definition: ffprobe.c:193
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:77
AVInputFormat::priv_class
const AVClass * priv_class
AVClass for the private context.
Definition: avformat.h:578
JSONContext::compact
int compact
Definition: ffprobe.c:1645
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:102
unit_second_str
static const char unit_second_str[]
Definition: ffprobe.c:378
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:312
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
AVDOVIDataMapping::num_x_partitions
uint32_t num_x_partitions
Definition: dovi_meta.h:147
AVFilmGrainAOMParams::ar_coeff_shift
int ar_coeff_shift
Specifies the range of the auto-regressive coefficients.
Definition: film_grain_params.h:93
AVPacket::side_data_elems
int side_data_elems
Definition: packet.h:534
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:605
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:2882
do_show_packets
static int do_show_packets
Definition: ffprobe.c:115
AV_IAMF_PARAMETER_DEFINITION_DEMIXING
@ AV_IAMF_PARAMETER_DEFINITION_DEMIXING
Subblocks are of struct type AVIAMFDemixingInfo.
Definition: iamf.h:168
show_programs
static int show_programs(WriterContext *w, InputFile *ifile)
Definition: ffprobe.c:3509
JSONContext
Definition: ffprobe.c:1642
SECTION_ID_STREAM_GROUP_SUBCOMPONENTS
@ SECTION_ID_STREAM_GROUP_SUBCOMPONENTS
Definition: ffprobe.c:217
av_fourcc2str
#define av_fourcc2str(fourcc)
Definition: avutil.h:345
pthread_mutex_lock
#define pthread_mutex_lock(a)
Definition: ffprobe.c:77
print_list_fmt
#define print_list_fmt(k, f, n, m,...)
Definition: ffprobe.c:2002
writer_w8_printf
static void writer_w8_printf(WriterContext *wctx, int b)
Definition: ffprobe.c:664
bprint_bytes
static void bprint_bytes(AVBPrint *bp, const uint8_t *ubuf, size_t ubuf_size)
Definition: ffprobe.c:637
avdevice_register_all
FF_VISIBILITY_POP_HIDDEN av_cold void avdevice_register_all(void)
Initialize libavdevice and register all the input and output devices.
Definition: alldevices.c:70
AVDOVIDecoderConfigurationRecord
Definition: dovi_meta.h:52
AVFilmGrainAOMParams::ar_coeffs_uv
int8_t ar_coeffs_uv[2][25]
Chroma auto-regression coefficients.
Definition: film_grain_params.h:86
writer_register
static int writer_register(const Writer *writer)
Definition: ffprobe.c:1046