FFmpeg
Loading...
Searching...
No Matches
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
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/avutil.h"
40#include "libavutil/bprint.h"
43#include "libavutil/display.h"
45#include "libavutil/gain_map.h"
47#include "libavutil/iamf.h"
50#include "libavutil/dovi_meta.h"
51#include "libavutil/mem.h"
52#include "libavutil/opt.h"
53#include "libavutil/pixdesc.h"
54#include "libavutil/spherical.h"
55#include "libavutil/stereo3d.h"
56#include "libavutil/dict.h"
60#include "libavutil/timecode.h"
61#include "libavutil/timestamp.h"
63#include "libavdevice/version.h"
64#include "libswscale/swscale.h"
65#include "libswscale/version.h"
68#include "libavfilter/version.h"
70#include "cmdutils.h"
71#include "opt_common.h"
72
73#include "libavutil/thread.h"
74
75// attached as opaque_ref to packets/frames
76typedef struct FrameData {
79} FrameData;
80
81typedef struct InputStream {
82 AVStream *st;
83
86
87typedef struct InputFile {
89
91 int nb_streams;
92} InputFile;
93
94const char program_name[] = "ffprobe";
95const int program_birth_year = 2007;
96
97static int do_analyze_frames = 0;
98static int do_bitexact = 0;
99static int do_count_frames = 0;
100static int do_count_packets = 0;
101static int do_read_frames = 0;
102static int do_read_packets = 0;
103static int do_show_chapters = 0;
104static int do_show_error = 0;
105static int do_show_format = 0;
106static int do_show_frames = 0;
107static int do_show_packets = 0;
108static int do_show_programs = 0;
111static int do_show_streams = 0;
114static int do_show_data = 0;
120static int do_show_log = 0;
121
122static int do_show_chapter_tags = 0;
123static int do_show_format_tags = 0;
124static int do_show_frame_tags = 0;
125static int do_show_program_tags = 0;
127static int do_show_stream_tags = 0;
128static int do_show_packet_tags = 0;
129
130static int show_value_unit = 0;
131static int use_value_prefix = 0;
134static int show_private_data = 1;
135
136static const char *audio_codec_name = NULL;
137static const char *data_codec_name = NULL;
138static const char *subtitle_codec_name = NULL;
139static const char *video_codec_name = NULL;
140
141#define SHOW_OPTIONAL_FIELDS_AUTO -1
142#define SHOW_OPTIONAL_FIELDS_NEVER 0
143#define SHOW_OPTIONAL_FIELDS_ALWAYS 1
145
146static char *output_format;
147static char *stream_specifier;
148static char *show_data_hash;
149static char *data_dump_format;
150
151typedef struct ReadInterval {
152 int id; ///< identifier
153 int64_t start, end; ///< start, end in second/AV_TIME_BASE units
158
160static int read_intervals_nb = 0;
161
162static int find_stream_info = 1;
163
164/* section structure definition */
165
166typedef enum {
253} SectionID;
254
255static const char *get_packet_side_data_type(const void *data)
256{
257 const AVPacketSideData *sd = (const AVPacketSideData *)data;
258 return av_x_if_null(av_packet_side_data_name(sd->type), "unknown");
259}
260
261static const char *get_frame_side_data_type(const void *data)
262{
263 const AVFrameSideData *sd = (const AVFrameSideData *)data;
264 return av_x_if_null(av_frame_side_data_name(sd->type), "unknown");
265}
266
267static const char *get_raw_string_type(const void *data)
268{
269 return data;
270}
271
272static const char *get_stream_group_type(const void *data)
273{
274 const AVStreamGroup *stg = (const AVStreamGroup *)data;
275 return av_x_if_null(avformat_stream_group_name(stg->type), "unknown");
276}
277
281 [SECTION_ID_CHAPTER_TAGS] = { SECTION_ID_CHAPTER_TAGS, "tags", AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "chapter_tags" },
282 [SECTION_ID_ERROR] = { SECTION_ID_ERROR, "error", 0, { -1 } },
283 [SECTION_ID_FORMAT] = { SECTION_ID_FORMAT, "format", 0, { SECTION_ID_FORMAT_TAGS, -1 } },
284 [SECTION_ID_FORMAT_TAGS] = { SECTION_ID_FORMAT_TAGS, "tags", AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "format_tags" },
287 [SECTION_ID_FRAME_TAGS] = { SECTION_ID_FRAME_TAGS, "tags", AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "frame_tags" },
288 [SECTION_ID_FRAME_SIDE_DATA_LIST] ={ SECTION_ID_FRAME_SIDE_DATA_LIST, "side_data_list", AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY, { SECTION_ID_FRAME_SIDE_DATA, -1 }, .element_name = "side_data", .unique_name = "frame_side_data_list" },
292 [SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST] = { SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST, "components", AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY, { SECTION_ID_FRAME_SIDE_DATA_COMPONENT, -1 }, .element_name = "component", .unique_name = "frame_side_data_components" },
294 [SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST] = { SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST, "pieces", AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY, { SECTION_ID_FRAME_SIDE_DATA_PIECE, -1 }, .element_name = "piece", .unique_name = "frame_side_data_pieces" },
295 [SECTION_ID_FRAME_SIDE_DATA_PIECE] = { SECTION_ID_FRAME_SIDE_DATA_PIECE, "piece", AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS|AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE, { -1 }, .element_name = "piece_entry", .unique_name = "frame_side_data_piece", .get_type = get_raw_string_type },
297 [SECTION_ID_FRAME_LOG] = { SECTION_ID_FRAME_LOG, "log", 0, { -1 }, },
299 [SECTION_ID_LIBRARY_VERSION] = { SECTION_ID_LIBRARY_VERSION, "library_version", 0, { -1 } },
303 [SECTION_ID_PACKET_TAGS] = { SECTION_ID_PACKET_TAGS, "tags", AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "packet_tags" },
304 [SECTION_ID_PACKET_SIDE_DATA_LIST] ={ SECTION_ID_PACKET_SIDE_DATA_LIST, "side_data_list", AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY, { SECTION_ID_PACKET_SIDE_DATA, -1 }, .element_name = "side_data", .unique_name = "packet_side_data_list" },
306 [SECTION_ID_PACKET_SIDE_DATA_COMPONENT_LIST] = { SECTION_ID_PACKET_SIDE_DATA_COMPONENT_LIST, "components", AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY, { SECTION_ID_PACKET_SIDE_DATA_COMPONENT, -1 }, .element_name = "component", .unique_name = "packet_side_data_components" },
307 [SECTION_ID_PACKET_SIDE_DATA_COMPONENT] = { SECTION_ID_PACKET_SIDE_DATA_COMPONENT, "component", AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS|AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE, { -1 }, .unique_name = "packet_side_data_component", .element_name = "component_entry", .get_type = get_raw_string_type },
310 [SECTION_ID_PIXEL_FORMAT_FLAGS] = { SECTION_ID_PIXEL_FORMAT_FLAGS, "flags", 0, { -1 }, .unique_name = "pixel_format_flags" },
313 [SECTION_ID_PROGRAM_STREAM_DISPOSITION] = { SECTION_ID_PROGRAM_STREAM_DISPOSITION, "disposition", 0, { -1 }, .unique_name = "program_stream_disposition" },
314 [SECTION_ID_PROGRAM_STREAM_TAGS] = { SECTION_ID_PROGRAM_STREAM_TAGS, "tags", AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "program_stream_tags" },
315 [SECTION_ID_PROGRAM_STREAM_SIDE_DATA_LIST] = { SECTION_ID_PROGRAM_STREAM_SIDE_DATA_LIST, "side_data_list", AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY, { SECTION_ID_PROGRAM_STREAM_SIDE_DATA, -1 }, .element_name = "side_data", .unique_name = "program_stream_side_data_list" },
317 [SECTION_ID_PROGRAM_STREAM_SIDE_DATA_COMPONENT_LIST] = { SECTION_ID_PROGRAM_STREAM_SIDE_DATA_COMPONENT_LIST, "components", AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY, { SECTION_ID_PROGRAM_STREAM_SIDE_DATA_COMPONENT, -1 }, .element_name = "component", .unique_name = "program_stream_side_data_components" },
318 [SECTION_ID_PROGRAM_STREAM_SIDE_DATA_COMPONENT] = { SECTION_ID_PROGRAM_STREAM_SIDE_DATA_COMPONENT, "component", AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS|AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE, { -1 }, .unique_name = "program_stream_side_data_component", .element_name = "component_entry", .get_type = get_raw_string_type },
322 [SECTION_ID_PROGRAM_TAGS] = { SECTION_ID_PROGRAM_TAGS, "tags", AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "program_tags" },
323 [SECTION_ID_PROGRAM_VERSION] = { SECTION_ID_PROGRAM_VERSION, "program_version", 0, { -1 } },
325 [SECTION_ID_STREAM_GROUP_STREAM_GROUP_DISPOSITION] = { SECTION_ID_STREAM_GROUP_STREAM_GROUP_DISPOSITION, "disposition", 0, { -1 }, .unique_name = "stream_group_stream_group_disposition" },
326 [SECTION_ID_STREAM_GROUP_STREAM_GROUP_TAGS] = { SECTION_ID_STREAM_GROUP_STREAM_GROUP_TAGS, "tags", AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "stream_group_stream_group_tags" },
327 [SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION] = { SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION, "disposition", 0, { -1 }, .unique_name = "stream_group_stream_disposition" },
328 [SECTION_ID_STREAM_GROUP_STREAM_TAGS] = { SECTION_ID_STREAM_GROUP_STREAM_TAGS, "tags", AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "stream_group_stream_tags" },
329 [SECTION_ID_STREAM_GROUP_STREAM_SIDE_DATA_LIST] = { SECTION_ID_STREAM_GROUP_STREAM_SIDE_DATA_LIST, "side_data_list", AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY, { SECTION_ID_STREAM_GROUP_STREAM_SIDE_DATA, -1 }, .element_name = "side_data", .unique_name = "stream_group_stream_side_data_list" },
332 [SECTION_ID_STREAM_GROUP_STREAM_SIDE_DATA_COMPONENT] = { SECTION_ID_STREAM_GROUP_STREAM_SIDE_DATA_COMPONENT, "component", AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS|AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE, { -1 }, .unique_name = "stream_group_stream_side_data_component", .element_name = "component_entry", .get_type = get_raw_string_type },
334 [SECTION_ID_STREAM_GROUP_COMPONENTS] = { SECTION_ID_STREAM_GROUP_COMPONENTS, "components", AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY, { SECTION_ID_STREAM_GROUP_COMPONENT, -1 }, .element_name = "component", .unique_name = "stream_group_components" },
338 [SECTION_ID_STREAM_GROUP_PIECES] = { SECTION_ID_STREAM_GROUP_PIECES, "pieces", AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY, { SECTION_ID_STREAM_GROUP_PIECE, -1 }, .element_name = "piece", .unique_name = "stream_group_pieces" },
344 [SECTION_ID_STREAM_GROUP_SIDE_DATA_LIST] = { SECTION_ID_STREAM_GROUP_SIDE_DATA_LIST, "side_data_list", AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY, { SECTION_ID_STREAM_GROUP_SIDE_DATA, -1 }, .element_name = "side_data", .unique_name = "stream_group_side_data_list" },
346 [SECTION_ID_STREAM_GROUP_SIDE_DATA_COMPONENT_LIST] = { SECTION_ID_STREAM_GROUP_SIDE_DATA_COMPONENT_LIST, "components", AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY, { SECTION_ID_STREAM_GROUP_SIDE_DATA_COMPONENT, -1 }, .element_name = "component", .unique_name = "stream_group_side_data_components" },
347 [SECTION_ID_STREAM_GROUP_SIDE_DATA_COMPONENT] = { SECTION_ID_STREAM_GROUP_SIDE_DATA_COMPONENT, "component", AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS|AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE, { -1 }, .unique_name = "stream_group_side_data_component", .element_name = "component_entry", .get_type = get_raw_string_type },
352 [SECTION_ID_STREAM_GROUP_DISPOSITION] = { SECTION_ID_STREAM_GROUP_DISPOSITION, "disposition", 0, { -1 }, .unique_name = "stream_group_disposition" },
353 [SECTION_ID_STREAM_GROUP_TAGS] = { SECTION_ID_STREAM_GROUP_TAGS, "tags", AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "stream_group_tags" },
361 [SECTION_ID_STREAM_DISPOSITION] = { SECTION_ID_STREAM_DISPOSITION, "disposition", 0, { -1 }, .unique_name = "stream_disposition" },
362 [SECTION_ID_STREAM_TAGS] = { SECTION_ID_STREAM_TAGS, "tags", AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "stream_tags" },
363 [SECTION_ID_STREAM_SIDE_DATA_LIST] ={ SECTION_ID_STREAM_SIDE_DATA_LIST, "side_data_list", AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY, { SECTION_ID_STREAM_SIDE_DATA, -1 }, .element_name = "side_data", .unique_name = "stream_side_data_list" },
365 [SECTION_ID_STREAM_SIDE_DATA_COMPONENT_LIST] = { SECTION_ID_STREAM_SIDE_DATA_COMPONENT_LIST, "components", AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY, { SECTION_ID_STREAM_SIDE_DATA_COMPONENT, -1 }, .element_name = "component", .unique_name = "stream_side_data_components" },
366 [SECTION_ID_STREAM_SIDE_DATA_COMPONENT] = { SECTION_ID_STREAM_SIDE_DATA_COMPONENT, "component", AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS|AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE, { -1 }, .unique_name = "stream_side_data_component", .element_name = "component_entry", .get_type = get_raw_string_type },
367 [SECTION_ID_SUBTITLE] = { SECTION_ID_SUBTITLE, "subtitle", 0, { -1 } },
368};
369
370typedef struct EntrySelection {
372 int explicitly_selected; ///< Selected by unique name or through a selected parent.
375
377
378static const OptionDef *options;
379
380/* FFprobe context */
381static const char *input_filename;
382static const char *print_input_filename;
383static const AVInputFormat *iformat = NULL;
384static const char *output_filename = NULL;
385
386static const char unit_hertz_str[] = "Hz" ;
387static const char unit_byte_str[] = "byte" ;
388static const char unit_bit_per_second_str[] = "bit/s";
389
390static unsigned int nb_streams;
391static uint64_t *nb_streams_packets;
392static uint64_t *nb_streams_frames;
396
398
407
410
412{
413 const AVTextFormatSection *section = tctx->section[tctx->level];
414 const EntrySelection *selection = &selected_entries[section - sections];
415
416 return selection->show_all_entries || av_dict_get(selection->entries_to_show, key, NULL, 0);
417}
418
419static void log_callback(void *ptr, int level, const char *fmt, va_list vl)
420{
421 AVClass* avc = ptr ? *(AVClass **) ptr : NULL;
422 va_list vl2;
423 char line[1024];
424 static int print_prefix = 1;
425 void *new_log_buffer;
426
427 va_copy(vl2, vl);
428 av_log_default_callback(ptr, level, fmt, vl);
429 av_log_format_line(ptr, level, fmt, vl2, line, sizeof(line), &print_prefix);
430 va_end(vl2);
431
432#if HAVE_THREADS
434
435 new_log_buffer = av_realloc_array(log_buffer, log_buffer_size + 1, sizeof(*log_buffer));
436 if (new_log_buffer) {
437 char *msg;
438 int i;
439
440 log_buffer = new_log_buffer;
442 log_buffer[log_buffer_size].context_name= avc ? av_strdup(avc->item_name(ptr)) : NULL;
443 if (avc) {
444 if (avc->get_category) log_buffer[log_buffer_size].category = avc->get_category(ptr);
445 else log_buffer[log_buffer_size].category = avc->category;
446 }
447 log_buffer[log_buffer_size].log_level = level;
448 msg = log_buffer[log_buffer_size].log_message = av_strdup(line);
449 for (i=strlen(msg) - 1; i>=0 && msg[i] == '\n'; i--) {
450 msg[i] = 0;
451 }
452 if (avc && avc->parent_log_context_offset) {
453 AVClass** parent = *(AVClass ***) (((uint8_t *) ptr) +
455 if (parent && *parent) {
456 log_buffer[log_buffer_size].parent_name = av_strdup((*parent)->item_name(parent));
457 log_buffer[log_buffer_size].parent_category =
458 (*parent)->get_category ? (*parent)->get_category(parent) :(*parent)->category;
459 }
460 }
462 }
463
465#endif
466}
467
468
469#define print_fmt(k, f, ...) do { \
470 av_bprint_clear(&pbuf); \
471 av_bprintf(&pbuf, f, __VA_ARGS__); \
472 avtext_print_string(tfc, k, pbuf.str, 0); \
473} while (0)
474
475#define print_list_fmt(k, f, n, m, ...) do { \
476 av_bprint_clear(&pbuf); \
477 for (unsigned int idx = 0; idx < n; idx++) { \
478 for (unsigned int idx2 = 0; idx2 < m; idx2++) { \
479 if (idx > 0 || idx2 > 0) \
480 av_bprint_chars(&pbuf, ' ', 1); \
481 av_bprintf(&pbuf, f, __VA_ARGS__); \
482 } \
483 } \
484 avtext_print_string(tfc, k, pbuf.str, 0); \
485} while (0)
486
487#define print_int(k, v) avtext_print_integer(tfc, k, v, 0)
488#define print_int_opt(k, v) avtext_print_integer(tfc, k, v, AV_TEXTFORMAT_PRINT_STRING_OPTIONAL)
489#define print_q(k, v, s) avtext_print_rational(tfc, k, v, s)
490#define print_str(k, v) avtext_print_string(tfc, k, v, 0)
491#define print_str_opt(k, v) avtext_print_string(tfc, k, v, AV_TEXTFORMAT_PRINT_STRING_OPTIONAL)
492#define print_str_validate(k, v) avtext_print_string(tfc, k, v, AV_TEXTFORMAT_PRINT_STRING_VALIDATE)
493#define print_time(k, v, tb) avtext_print_time(tfc, k, v, tb, 0)
494#define print_ts(k, v) avtext_print_ts(tfc, k, v, 0)
495#define print_duration_time(k, v, tb) avtext_print_time(tfc, k, v, tb, 1)
496#define print_duration_ts(k, v) avtext_print_ts(tfc, k, v, 1)
497#define print_val(k, v, u) avtext_print_unit_integer(tfc, k, v, AV_TEXTFORMAT_VALUE_FMT_INT, u)
498#define print_int_fmt(k, v, f, u) avtext_print_unit_integer(tfc, k, v, f, u)
499#define print_decibel(k, v) avtext_print_unit_double(tfc, k, v, AV_TEXTFORMAT_VALUE_FMT_DECIBEL, 0)
500
501static void print_integers(AVTextFormatContext *tfc, const char *key,
502 const void *data, int size, const char *format,
503 int columns, int bytes, int offset_add)
504{
505 AVBPrint bp;
506 unsigned offset = 0;
507
509 av_bprint_chars(&bp, '\n', 1);
510 while (size) {
511 av_bprintf(&bp, "%08x: ", offset);
512 for (int i = 0, l = FFMIN(size, columns); i < l; i++) {
513 if (bytes == 1) av_bprintf(&bp, format, *(const uint8_t*)data);
514 else if (bytes == 2) av_bprintf(&bp, format, AV_RN16(data));
515 else if (bytes == 4) av_bprintf(&bp, format, AV_RN32(data));
516 data = (const char*)data + bytes;
517 size--;
518 }
519 av_bprint_chars(&bp, '\n', 1);
520 offset += offset_add;
521 }
522 avtext_print_string(tfc, key, bp.str, 0);
523}
524
525#define REALLOCZ_ARRAY_STREAM(ptr, cur_n, new_n) \
526{ \
527 ret = av_reallocp_array(&(ptr), (new_n), sizeof(*(ptr))); \
528 if (ret < 0) \
529 goto end; \
530 memset( (ptr) + (cur_n), 0, ((new_n) - (cur_n)) * sizeof(*(ptr)) ); \
531}
532
533static inline int show_tags(AVTextFormatContext *tfc, AVDictionary *tags, int section_id)
534{
535 const AVDictionaryEntry *tag = NULL;
536 int ret = 0;
537
538 if (!tags)
539 return 0;
540 avtext_print_section_header(tfc, NULL, section_id);
541
542 while ((tag = av_dict_iterate(tags, tag))) {
543 if ((ret = print_str_validate(tag->key, tag->value)) < 0)
544 break;
545 }
547
548 return ret;
549}
550
552 const AVDownmixInfo *downmix_info)
553{
554 switch (downmix_info->preferred_downmix_type) {
556 print_str("preferred_downmix_type", "loro");
557 break;
559 print_str("preferred_downmix_type", "ltrt");
560 break;
562 print_str("preferred_downmix_type", "dplII");
563 break;
564 default:
565 print_str("preferred_downmix_type", "unknown");
566 break;
567 }
568 print_decibel("center_mix_level_db", downmix_info->center_mix_level);
569 print_decibel("center_mix_level_ltrt_db", downmix_info->center_mix_level_ltrt);
570 print_decibel("surround_mix_level_db", downmix_info->surround_mix_level);
571 print_decibel("surround_mix_level_ltrt_db", downmix_info->surround_mix_level_ltrt);
572 print_decibel("lfe_mix_level_db", downmix_info->lfe_mix_level);
573}
574
576{
577 double rotation = av_display_rotation_get(matrix);
578 if (isnan(rotation))
579 rotation = 0;
580 print_integers(tfc, "displaymatrix", matrix, 9, " %11d", 3, 4, 1);
581 print_int("rotation", rotation);
582}
583
586{
587 if (metadata->has_primaries) {
588 print_q("red_x", metadata->display_primaries[0][0], '/');
589 print_q("red_y", metadata->display_primaries[0][1], '/');
590 print_q("green_x", metadata->display_primaries[1][0], '/');
591 print_q("green_y", metadata->display_primaries[1][1], '/');
592 print_q("blue_x", metadata->display_primaries[2][0], '/');
593 print_q("blue_y", metadata->display_primaries[2][1], '/');
594
595 print_q("white_point_x", metadata->white_point[0], '/');
596 print_q("white_point_y", metadata->white_point[1], '/');
597 }
598
599 if (metadata->has_luminance) {
600 print_q("min_luminance", metadata->min_luminance, '/');
601 print_q("max_luminance", metadata->max_luminance, '/');
602 }
603}
604
607{
608 print_int("max_content", metadata->MaxCLL);
609 print_int("max_average", metadata->MaxFALL);
610}
611
613{
614 if (!dovi)
615 return;
616
617 {
618 const AVDOVIRpuDataHeader *hdr = av_dovi_get_header(dovi);
619 const AVDOVIDataMapping *mapping = av_dovi_get_mapping(dovi);
621 AVBPrint pbuf;
622
624
625 // header
626 print_int("rpu_type", hdr->rpu_type);
627 print_int("rpu_format", hdr->rpu_format);
628 print_int("vdr_rpu_profile", hdr->vdr_rpu_profile);
629 print_int("vdr_rpu_level", hdr->vdr_rpu_level);
630 print_int("chroma_resampling_explicit_filter_flag",
632 print_int("coef_data_type", hdr->coef_data_type);
633 print_int("coef_log2_denom", hdr->coef_log2_denom);
634 print_int("vdr_rpu_normalized_idc", hdr->vdr_rpu_normalized_idc);
635 print_int("bl_video_full_range_flag", hdr->bl_video_full_range_flag);
636 print_int("bl_bit_depth", hdr->bl_bit_depth);
637 print_int("el_bit_depth", hdr->el_bit_depth);
638 print_int("vdr_bit_depth", hdr->vdr_bit_depth);
639 print_int("spatial_resampling_filter_flag",
641 print_int("el_spatial_resampling_filter_flag",
643 print_int("disable_residual_flag", hdr->disable_residual_flag);
644
645 // data mapping values
646 print_int("vdr_rpu_id", mapping->vdr_rpu_id);
647 print_int("mapping_color_space", mapping->mapping_color_space);
648 print_int("mapping_chroma_format_idc",
650
651 print_int("nlq_method_idc", mapping->nlq_method_idc);
652 switch (mapping->nlq_method_idc) {
653 case AV_DOVI_NLQ_NONE:
654 print_str("nlq_method_idc_name", "none");
655 break;
657 print_str("nlq_method_idc_name", "linear_dz");
658 break;
659 default:
660 print_str("nlq_method_idc_name", "unknown");
661 break;
662 }
663
664 print_int("num_x_partitions", mapping->num_x_partitions);
665 print_int("num_y_partitions", mapping->num_y_partitions);
666
668
669 for (int c = 0; c < 3; c++) {
670 const AVDOVIReshapingCurve *curve = &mapping->curves[c];
672
673 print_list_fmt("pivots", "%"PRIu16, curve->num_pivots, 1, curve->pivots[idx]);
674
676 for (int i = 0; i < curve->num_pivots - 1; i++) {
677 AVBPrint piece_buf;
678
680 switch (curve->mapping_idc[i]) {
682 av_bprintf(&piece_buf, "Polynomial");
683 break;
685 av_bprintf(&piece_buf, "MMR");
686 break;
687 default:
688 av_bprintf(&piece_buf, "Unknown");
689 break;
690 }
691 av_bprintf(&piece_buf, " mapping");
692
694 print_int("mapping_idc", curve->mapping_idc[i]);
695 switch (curve->mapping_idc[i]) {
697 print_str("mapping_idc_name", "polynomial");
698 print_int("poly_order", curve->poly_order[i]);
699 print_list_fmt("poly_coef", "%"PRIi64,
700 curve->poly_order[i] + 1, 1,
701 curve->poly_coef[i][idx]);
702 break;
704 print_str("mapping_idc_name", "mmr");
705 print_int("mmr_order", curve->mmr_order[i]);
706 print_int("mmr_constant", curve->mmr_constant[i]);
707 print_list_fmt("mmr_coef", "%"PRIi64,
708 curve->mmr_order[i], 7,
709 curve->mmr_coef[i][idx][idx2]);
710 break;
711 default:
712 print_str("mapping_idc_name", "unknown");
713 break;
714 }
715
716 // SECTION_ID_FRAME_SIDE_DATA_PIECE
718 }
719
720 // SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST
722
723 if (mapping->nlq_method_idc != AV_DOVI_NLQ_NONE) {
724 const AVDOVINLQParams *nlq = &mapping->nlq[c];
725 print_int("nlq_offset", nlq->nlq_offset);
726 print_int("vdr_in_max", nlq->vdr_in_max);
727
728 switch (mapping->nlq_method_idc) {
730 print_int("linear_deadzone_slope", nlq->linear_deadzone_slope);
731 print_int("linear_deadzone_threshold", nlq->linear_deadzone_threshold);
732 break;
733 }
734 }
735
736 // SECTION_ID_FRAME_SIDE_DATA_COMPONENT
738 }
739
740 // SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST
742
743 // color metadata
744 print_int("dm_metadata_id", color->dm_metadata_id);
745 print_int("scene_refresh_flag", color->scene_refresh_flag);
746 print_list_fmt("ycc_to_rgb_matrix", "%d/%d",
747 FF_ARRAY_ELEMS(color->ycc_to_rgb_matrix), 1,
748 color->ycc_to_rgb_matrix[idx].num,
749 color->ycc_to_rgb_matrix[idx].den);
750 print_list_fmt("ycc_to_rgb_offset", "%d/%d",
751 FF_ARRAY_ELEMS(color->ycc_to_rgb_offset), 1,
752 color->ycc_to_rgb_offset[idx].num,
753 color->ycc_to_rgb_offset[idx].den);
754 print_list_fmt("rgb_to_lms_matrix", "%d/%d",
755 FF_ARRAY_ELEMS(color->rgb_to_lms_matrix), 1,
756 color->rgb_to_lms_matrix[idx].num,
757 color->rgb_to_lms_matrix[idx].den);
758 print_int("signal_eotf", color->signal_eotf);
759 print_int("signal_eotf_param0", color->signal_eotf_param0);
760 print_int("signal_eotf_param1", color->signal_eotf_param1);
761 print_int("signal_eotf_param2", color->signal_eotf_param2);
762 print_int("signal_bit_depth", color->signal_bit_depth);
763 print_int("signal_color_space", color->signal_color_space);
764 print_int("signal_chroma_format", color->signal_chroma_format);
765 print_int("signal_full_range_flag", color->signal_full_range_flag);
766 print_int("source_min_pq", color->source_min_pq);
767 print_int("source_max_pq", color->source_max_pq);
768 print_int("source_diagonal", color->source_diagonal);
769
770 av_bprint_finalize(&pbuf, NULL);
771 }
772}
773
775{
776 if (!metadata)
777 return;
778 print_int("application version", metadata->application_version);
779 print_int("num_windows", metadata->num_windows);
780 for (int n = 1; n < metadata->num_windows; n++) {
781 const AVHDRPlusColorTransformParams *params = &metadata->params[n];
782 print_q("window_upper_left_corner_x",
783 params->window_upper_left_corner_x,'/');
784 print_q("window_upper_left_corner_y",
785 params->window_upper_left_corner_y,'/');
786 print_q("window_lower_right_corner_x",
787 params->window_lower_right_corner_x,'/');
788 print_q("window_lower_right_corner_y",
789 params->window_lower_right_corner_y,'/');
790 print_int("center_of_ellipse_x",
791 params->center_of_ellipse_x ) ;
792 print_int("center_of_ellipse_y",
793 params->center_of_ellipse_y );
794 print_int("rotation_angle",
795 params->rotation_angle);
796 print_int("semimajor_axis_internal_ellipse",
797 params->semimajor_axis_internal_ellipse);
798 print_int("semimajor_axis_external_ellipse",
799 params->semimajor_axis_external_ellipse);
800 print_int("semiminor_axis_external_ellipse",
801 params->semiminor_axis_external_ellipse);
802 print_int("overlap_process_option",
803 params->overlap_process_option);
804 }
805 print_q("targeted_system_display_maximum_luminance",
806 metadata->targeted_system_display_maximum_luminance,'/');
807 if (metadata->targeted_system_display_actual_peak_luminance_flag) {
808 print_int("num_rows_targeted_system_display_actual_peak_luminance",
809 metadata->num_rows_targeted_system_display_actual_peak_luminance);
810 print_int("num_cols_targeted_system_display_actual_peak_luminance",
811 metadata->num_cols_targeted_system_display_actual_peak_luminance);
812 for (int i = 0; i < metadata->num_rows_targeted_system_display_actual_peak_luminance; i++) {
813 for (int j = 0; j < metadata->num_cols_targeted_system_display_actual_peak_luminance; j++) {
814 print_q("targeted_system_display_actual_peak_luminance",
815 metadata->targeted_system_display_actual_peak_luminance[i][j],'/');
816 }
817 }
818 }
819 for (int n = 0; n < metadata->num_windows; n++) {
820 const AVHDRPlusColorTransformParams *params = &metadata->params[n];
821 for (int i = 0; i < 3; i++) {
822 print_q("maxscl",params->maxscl[i],'/');
823 }
824 print_q("average_maxrgb",
825 params->average_maxrgb,'/');
826 print_int("num_distribution_maxrgb_percentiles",
827 params->num_distribution_maxrgb_percentiles);
828 for (int i = 0; i < params->num_distribution_maxrgb_percentiles; i++) {
829 print_int("distribution_maxrgb_percentage",
830 params->distribution_maxrgb[i].percentage);
831 print_q("distribution_maxrgb_percentile",
832 params->distribution_maxrgb[i].percentile,'/');
833 }
834 print_q("fraction_bright_pixels",
835 params->fraction_bright_pixels,'/');
836 }
837 if (metadata->mastering_display_actual_peak_luminance_flag) {
838 print_int("num_rows_mastering_display_actual_peak_luminance",
839 metadata->num_rows_mastering_display_actual_peak_luminance);
840 print_int("num_cols_mastering_display_actual_peak_luminance",
841 metadata->num_cols_mastering_display_actual_peak_luminance);
842 for (int i = 0; i < metadata->num_rows_mastering_display_actual_peak_luminance; i++) {
843 for (int j = 0; j < metadata->num_cols_mastering_display_actual_peak_luminance; j++) {
844 print_q("mastering_display_actual_peak_luminance",
845 metadata->mastering_display_actual_peak_luminance[i][j],'/');
846 }
847 }
848 }
849
850 for (int n = 0; n < metadata->num_windows; n++) {
851 const AVHDRPlusColorTransformParams *params = &metadata->params[n];
852 if (params->tone_mapping_flag) {
853 print_q("knee_point_x", params->knee_point_x,'/');
854 print_q("knee_point_y", params->knee_point_y,'/');
855 print_int("num_bezier_curve_anchors",
856 params->num_bezier_curve_anchors );
857 for (int i = 0; i < params->num_bezier_curve_anchors; i++) {
858 print_q("bezier_curve_anchors",
859 params->bezier_curve_anchors[i],'/');
860 }
861 }
862 if (params->color_saturation_mapping_flag) {
863 print_q("color_saturation_weight",
864 params->color_saturation_weight,'/');
865 }
866 }
867}
868
870{
871 if (!metadata)
872 return;
873 print_int("application_version", metadata->application_version);
874 print_int("minimum_application_version", metadata->minimum_application_version);
875 print_int("has_custom_hdr_reference_white_flag", metadata->has_custom_hdr_reference_white_flag);
876 print_int("has_adaptive_tone_map_flag", metadata->has_adaptive_tone_map_flag);
877
878 if (metadata->has_custom_hdr_reference_white_flag)
879 print_int("hdr_reference_white", metadata->hdr_reference_white);
880
881 if (!metadata->has_adaptive_tone_map_flag)
882 return;
883
884 print_int("baseline_hdr_headroom", metadata->baseline_hdr_headroom);
885 print_int("use_reference_white_tone_mapping_flag", metadata->use_reference_white_tone_mapping_flag);
886
887 if (metadata->use_reference_white_tone_mapping_flag)
888 return;
889
890 print_int("num_alternate_images", metadata->num_alternate_images);
891 print_int("gain_application_space_chromaticities_flag", metadata->gain_application_space_chromaticities_flag);
892 print_int("has_common_component_mix_params_flag", metadata->has_common_component_mix_params_flag);
893 print_int("has_common_curve_params_flag", metadata->has_common_curve_params_flag);
894
895 if (metadata->gain_application_space_chromaticities_flag == 3) {
896 for (int i = 0; i < 8; i++)
897 print_int("gain_application_space_chromaticities", metadata->gain_application_space_chromaticities[i]);
898 }
899
900 for (int a = 0; a < metadata->num_alternate_images; a++) {
901 print_int("alternate_hdr_headroom", metadata->alternate_hdr_headrooms[a]);
902
903 print_int("component_mixing_type", metadata->component_mixing_type[a]);
904 if (metadata->component_mixing_type[a] == 3) {
905 for (int k = 0; k < 6; k++) {
906 print_int("has_component_mixing_coefficient_flag", metadata->has_component_mixing_coefficient_flag[a][k]);
907 if (metadata->has_component_mixing_coefficient_flag[a][k])
908 print_int("component_mixing_coefficient", metadata->component_mixing_coefficient[a][k]);
909 }
910 }
911
912 print_int("gain_curve_num_control_points_minus_1", metadata->gain_curve_num_control_points_minus_1[a]);
913 print_int("gain_curve_use_pchip_slope_flag", metadata->gain_curve_use_pchip_slope_flag[a]);
914 for (int c = 0; c <= metadata->gain_curve_num_control_points_minus_1[a]; c++)
915 print_int("gain_curve_control_point_x", metadata->gain_curve_control_points_x[a][c]);
916 for (int c = 0; c <= metadata->gain_curve_num_control_points_minus_1[a]; c++)
917 print_int("gain_curve_control_point_y", metadata->gain_curve_control_points_y[a][c]);
918 if (!metadata->gain_curve_use_pchip_slope_flag[a]) {
919 for (int c = 0; c <= metadata->gain_curve_num_control_points_minus_1[a]; c++)
920 print_int("gain_curve_control_point_theta", metadata->gain_curve_control_points_theta[a][c]);
921 }
922 }
923}
924
926{
927 if (!metadata)
928 return;
929 print_int("system_start_code", metadata->system_start_code);
930 print_int("num_windows", metadata->num_windows);
931
932 for (int n = 0; n < metadata->num_windows; n++) {
934
935 print_q("minimum_maxrgb", params->minimum_maxrgb, '/');
936 print_q("average_maxrgb", params->average_maxrgb, '/');
937 print_q("variance_maxrgb", params->variance_maxrgb, '/');
938 print_q("maximum_maxrgb", params->maximum_maxrgb, '/');
939 }
940
941 for (int n = 0; n < metadata->num_windows; n++) {
943
944 print_int("tone_mapping_mode_flag", params->tone_mapping_mode_flag);
945 if (params->tone_mapping_mode_flag) {
946 print_int("tone_mapping_param_num", params->tone_mapping_param_num);
947 for (int i = 0; i < params->tone_mapping_param_num; i++) {
948 const AVHDRVividColorToneMappingParams *tm_params = &params->tm_params[i];
949
950 print_q("targeted_system_display_maximum_luminance",
952 print_int("base_enable_flag", tm_params->base_enable_flag);
953 if (tm_params->base_enable_flag) {
954 print_q("base_param_m_p", tm_params->base_param_m_p, '/');
955 print_q("base_param_m_m", tm_params->base_param_m_m, '/');
956 print_q("base_param_m_a", tm_params->base_param_m_a, '/');
957 print_q("base_param_m_b", tm_params->base_param_m_b, '/');
958 print_q("base_param_m_n", tm_params->base_param_m_n, '/');
959
960 print_int("base_param_k1", tm_params->base_param_k1);
961 print_int("base_param_k2", tm_params->base_param_k2);
962 print_int("base_param_k3", tm_params->base_param_k3);
963 print_int("base_param_Delta_enable_mode",
965 print_q("base_param_Delta", tm_params->base_param_Delta, '/');
966 }
967 print_int("3Spline_enable_flag", tm_params->three_Spline_enable_flag);
968 if (tm_params->three_Spline_enable_flag) {
969 print_int("3Spline_num", tm_params->three_Spline_num);
970
971 for (int j = 0; j < tm_params->three_Spline_num; j++) {
972 const AVHDRVivid3SplineParams *three_spline = &tm_params->three_spline[j];
973 print_int("3Spline_TH_mode", three_spline->th_mode);
974 if (three_spline->th_mode == 0 || three_spline->th_mode == 2)
975 print_q("3Spline_TH_enable_MB", three_spline->th_enable_mb, '/');
976 print_q("3Spline_TH_enable", three_spline->th_enable, '/');
977 print_q("3Spline_TH_Delta1", three_spline->th_delta1, '/');
978 print_q("3Spline_TH_Delta2", three_spline->th_delta2, '/');
979 print_q("3Spline_enable_Strength", three_spline->enable_strength, '/');
980 }
981 }
982 }
983 }
984
985 print_int("color_saturation_mapping_flag", params->color_saturation_mapping_flag);
986 if (params->color_saturation_mapping_flag) {
987 print_int("color_saturation_num", params->color_saturation_num);
988 for (int i = 0; i < params->color_saturation_num; i++) {
989 print_q("color_saturation_gain", params->color_saturation_gain[i], '/');
990 }
991 }
992 }
993}
994
997{
998 if (!env)
999 return;
1000
1001 print_q("ambient_illuminance", env->ambient_illuminance, '/');
1002 print_q("ambient_light_x", env->ambient_light_x, '/');
1003 print_q("ambient_light_y", env->ambient_light_y, '/');
1004}
1005
1007 const AVFilmGrainParams *fgp)
1008{
1009 const char *color_range, *color_primaries, *color_trc, *color_space;
1010 const char *const film_grain_type_names[] = {
1011 [AV_FILM_GRAIN_PARAMS_NONE] = "none",
1012 [AV_FILM_GRAIN_PARAMS_AV1] = "av1",
1013 [AV_FILM_GRAIN_PARAMS_H274] = "h274",
1014 };
1015 const char *const component_names[] = { "Y", "Cb", "Cr" };
1016
1017 AVBPrint pbuf;
1018 if (!fgp || fgp->type >= FF_ARRAY_ELEMS(film_grain_type_names))
1019 return;
1020
1023 color_trc = av_color_transfer_name(fgp->color_trc);
1024 color_space = av_color_space_name(fgp->color_space);
1025
1027 print_str("type", film_grain_type_names[fgp->type]);
1028 print_fmt("seed", "%"PRIu64, fgp->seed);
1029 print_int("width", fgp->width);
1030 print_int("height", fgp->height);
1031 print_int("subsampling_x", fgp->subsampling_x);
1032 print_int("subsampling_y", fgp->subsampling_y);
1033 print_str("color_range", color_range ? color_range : "unknown");
1034 print_str("color_primaries", color_primaries ? color_primaries : "unknown");
1035 print_str("color_trc", color_trc ? color_trc : "unknown");
1036 print_str("color_space", color_space ? color_space : "unknown");
1037
1038 switch (fgp->type) {
1040 break;
1042 const AVFilmGrainAOMParams *aom = &fgp->codec.aom;
1043 const int num_ar_coeffs_y = 2 * aom->ar_coeff_lag * (aom->ar_coeff_lag + 1);
1044 const int num_ar_coeffs_uv = num_ar_coeffs_y + !!aom->num_y_points;
1045 print_int("chroma_scaling_from_luma", aom->chroma_scaling_from_luma);
1046 print_int("scaling_shift", aom->scaling_shift);
1047 print_int("ar_coeff_lag", aom->ar_coeff_lag);
1048 print_int("ar_coeff_shift", aom->ar_coeff_shift);
1049 print_int("grain_scale_shift", aom->grain_scale_shift);
1050 print_int("overlap_flag", aom->overlap_flag);
1051 print_int("limit_output_range", aom->limit_output_range);
1052
1054
1055 if (aom->num_y_points) {
1057
1058 print_int("bit_depth_luma", fgp->bit_depth_luma);
1059 print_list_fmt("y_points_value", "%"PRIu8, aom->num_y_points, 1, aom->y_points[idx][0]);
1060 print_list_fmt("y_points_scaling", "%"PRIu8, aom->num_y_points, 1, aom->y_points[idx][1]);
1061 print_list_fmt("ar_coeffs_y", "%"PRId8, num_ar_coeffs_y, 1, aom->ar_coeffs_y[idx]);
1062
1063 // SECTION_ID_FRAME_SIDE_DATA_COMPONENT
1065 }
1066
1067 for (unsigned uv = 0; uv < 2; uv++) {
1068 if (!aom->num_uv_points[uv] && !aom->chroma_scaling_from_luma)
1069 continue;
1070
1072
1073 print_int("bit_depth_chroma", fgp->bit_depth_chroma);
1074 print_list_fmt("uv_points_value", "%"PRIu8, aom->num_uv_points[uv], 1, aom->uv_points[uv][idx][0]);
1075 print_list_fmt("uv_points_scaling", "%"PRIu8, aom->num_uv_points[uv], 1, aom->uv_points[uv][idx][1]);
1076 print_list_fmt("ar_coeffs_uv", "%"PRId8, num_ar_coeffs_uv, 1, aom->ar_coeffs_uv[uv][idx]);
1077 print_int("uv_mult", aom->uv_mult[uv]);
1078 print_int("uv_mult_luma", aom->uv_mult_luma[uv]);
1079 print_int("uv_offset", aom->uv_offset[uv]);
1080
1081 // SECTION_ID_FRAME_SIDE_DATA_COMPONENT
1083 }
1084
1085 // SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST
1087 break;
1088 }
1090 const AVFilmGrainH274Params *h274 = &fgp->codec.h274;
1091 print_int("model_id", h274->model_id);
1092 print_int("blending_mode_id", h274->blending_mode_id);
1093 print_int("log2_scale_factor", h274->log2_scale_factor);
1094
1096
1097 for (int c = 0; c < 3; c++) {
1098 if (!h274->component_model_present[c])
1099 continue;
1100
1102 print_int(c ? "bit_depth_chroma" : "bit_depth_luma", c ? fgp->bit_depth_chroma : fgp->bit_depth_luma);
1103
1105 for (int i = 0; i < h274->num_intensity_intervals[c]; i++) {
1106
1108 print_int("intensity_interval_lower_bound", h274->intensity_interval_lower_bound[c][i]);
1109 print_int("intensity_interval_upper_bound", h274->intensity_interval_upper_bound[c][i]);
1110 print_list_fmt("comp_model_value", "%"PRId16, h274->num_model_values[c], 1, h274->comp_model_value[c][i][idx]);
1111
1112 // SECTION_ID_FRAME_SIDE_DATA_PIECE
1114 }
1115
1116 // SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST
1118
1119 // SECTION_ID_FRAME_SIDE_DATA_COMPONENT
1121 }
1122
1123 // SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST
1125 break;
1126 }
1127 }
1128
1129 av_bprint_finalize(&pbuf, NULL);
1130}
1131
1132#define PKT_SIDE_DATA_IN_STREAM 1
1133#define PKT_SIDE_DATA_IN_STREAM_GROUP 2
1134#define PKT_SIDE_DATA_IN_STREAM_GROUP_STREAM 3
1135#define PKT_SIDE_DATA_IN_PROGRAM_STREAM 4
1136
1138 int width,
1139 int height,
1140 const AVPacketSideData *sd,
1141 int container)
1142{
1143 const char *name = av_packet_side_data_name(sd->type);
1144 const SectionID section_header[] = {
1150 };
1151 const SectionID section_component_list[] = {
1157 };
1158 const SectionID section_component[] = {
1164 };
1165
1166 av_assert0(container < FF_ARRAY_ELEMS(section_header));
1167
1168 avtext_print_section_header(tfc, sd, section_header[container]);
1169 print_str("side_data_type", name ? name : "unknown");
1170 if (sd->type == AV_PKT_DATA_DISPLAYMATRIX && sd->size >= 9*4) {
1171 print_displaymatrix(tfc, (const int32_t*)sd->data);
1172 } else if (sd->type == AV_PKT_DATA_STEREO3D) {
1173 const AVStereo3D *stereo = (AVStereo3D *)sd->data;
1174 print_str("type", av_stereo3d_type_name(stereo->type));
1175 print_int("inverted", !!(stereo->flags & AV_STEREO3D_FLAG_INVERT));
1176 print_str("view", av_stereo3d_view_name(stereo->view));
1177 print_str("primary_eye", av_stereo3d_primary_eye_name(stereo->primary_eye));
1178 print_int("baseline", stereo->baseline);
1179 print_q("horizontal_disparity_adjustment", stereo->horizontal_disparity_adjustment, '/');
1180 print_q("horizontal_field_of_view", stereo->horizontal_field_of_view, '/');
1181 } else if (sd->type == AV_PKT_DATA_SPHERICAL) {
1182 const AVSphericalMapping *spherical = (AVSphericalMapping *)sd->data;
1183 print_str("projection", av_spherical_projection_name(spherical->projection));
1184 if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
1185 print_int("padding", spherical->padding);
1186 } else if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
1187 size_t l, t, r, b;
1189 &l, &t, &r, &b);
1190 print_int("bound_left", l);
1191 print_int("bound_top", t);
1192 print_int("bound_right", r);
1193 print_int("bound_bottom", b);
1194 }
1195
1196 print_int("yaw", (double) spherical->yaw / (1 << 16));
1197 print_int("pitch", (double) spherical->pitch / (1 << 16));
1198 print_int("roll", (double) spherical->roll / (1 << 16));
1199 } else if (sd->type == AV_PKT_DATA_SKIP_SAMPLES && sd->size == 10) {
1200 print_int("skip_samples", AV_RL32(sd->data));
1201 print_int("discard_padding", AV_RL32(sd->data + 4));
1202 print_int("skip_reason", AV_RL8(sd->data + 8));
1203 print_int("discard_reason", AV_RL8(sd->data + 9));
1204 } else if (sd->type == AV_PKT_DATA_MASTERING_DISPLAY_METADATA) {
1206 } else if (sd->type == AV_PKT_DATA_CONTENT_LIGHT_LEVEL) {
1210 tfc, (const AVAmbientViewingEnvironment *)sd->data);
1211 } else if (sd->type == AV_PKT_DATA_DYNAMIC_HDR10_PLUS) {
1214 } else if (sd->type == AV_PKT_DATA_DOVI_CONF) {
1216 const char *comp = "unknown";
1217 print_int("dv_version_major", dovi->dv_version_major);
1218 print_int("dv_version_minor", dovi->dv_version_minor);
1219 print_int("dv_profile", dovi->dv_profile);
1220 print_int("dv_level", dovi->dv_level);
1221 print_int("rpu_present_flag", dovi->rpu_present_flag);
1222 print_int("el_present_flag", dovi->el_present_flag);
1223 print_int("bl_present_flag", dovi->bl_present_flag);
1224 print_int("dv_bl_signal_compatibility_id", dovi->dv_bl_signal_compatibility_id);
1225 switch (dovi->dv_md_compression)
1226 {
1227 case AV_DOVI_COMPRESSION_NONE: comp = "none"; break;
1228 case AV_DOVI_COMPRESSION_LIMITED: comp = "limited"; break;
1229 case AV_DOVI_COMPRESSION_RESERVED: comp = "reserved"; break;
1230 case AV_DOVI_COMPRESSION_EXTENDED: comp = "extended"; break;
1231 }
1232 print_str("dv_md_compression", comp);
1233 } else if (sd->type == AV_PKT_DATA_AUDIO_SERVICE_TYPE) {
1234 enum AVAudioServiceType *t = (enum AVAudioServiceType *)sd->data;
1235 print_int("service_type", *t);
1236 } else if (sd->type == AV_PKT_DATA_MPEGTS_STREAM_ID) {
1237 print_int("id", *sd->data);
1238 } else if (sd->type == AV_PKT_DATA_CPB_PROPERTIES) {
1239 const AVCPBProperties *prop = (AVCPBProperties *)sd->data;
1240 print_int("max_bitrate", prop->max_bitrate);
1241 print_int("min_bitrate", prop->min_bitrate);
1242 print_int("avg_bitrate", prop->avg_bitrate);
1243 print_int("buffer_size", prop->buffer_size);
1244 print_int("vbv_delay", prop->vbv_delay);
1245 } else if (sd->type == AV_PKT_DATA_WEBVTT_IDENTIFIER ||
1247 if (do_show_data)
1248 avtext_print_data(tfc, "data", sd->data, sd->size);
1249 avtext_print_data_hash(tfc, "data_hash", sd->data, sd->size);
1250 } else if (sd->type == AV_PKT_DATA_FRAME_CROPPING && sd->size >= sizeof(uint32_t) * 4) {
1251 print_int("crop_top", AV_RL32(sd->data));
1252 print_int("crop_bottom", AV_RL32(sd->data + 4));
1253 print_int("crop_left", AV_RL32(sd->data + 8));
1254 print_int("crop_right", AV_RL32(sd->data + 12));
1255 } else if (sd->type == AV_PKT_DATA_AFD && sd->size > 0) {
1256 print_int("active_format", *sd->data);
1257 } else if (sd->type == AV_PKT_DATA_EXIF) {
1258 print_int("size", sd->size);
1259 } else if (sd->type == AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL && sd->size >= 8) {
1260 print_int("block_additional_id", AV_RB64(sd->data));
1261 if (do_show_data)
1262 avtext_print_data(tfc, "block_additional_data", sd->data + 8, sd->size - 8);
1263 } else if (sd->type == AV_PKT_DATA_GAIN_MAP_PARAMS) {
1264 const AVGainMapParams *gain = (AVGainMapParams *)sd->data;
1265 print_int("version", gain->version);
1266 print_int("use_base_color_space", gain->use_base_color_space);
1267 print_q("base_hdr_headroom", gain->base_hdr_headroom, '/');
1268 print_q("alternate_hdr_headroom", gain->alternate_hdr_headroom, '/');
1269 print_int("nb_channels", gain->nb_channels);
1270
1271 av_assert0(container < FF_ARRAY_ELEMS(section_component_list) &&
1272 container < FF_ARRAY_ELEMS(section_component));
1273 avtext_print_section_header(tfc, NULL, section_component_list[container]);
1274 for (int c = 0; c < gain->nb_channels; c++) {
1275 const struct AVGainMapChannel *channel = &gain->channels[c];
1276 avtext_print_section_header(tfc, "Gain Map Channel", section_component[container]);
1277 print_q("gain_map_min", channel->gain_map_min, '/');
1278 print_q("gain_map_max", channel->gain_map_min, '/');
1279 print_q("gamma", channel->gamma, '/');
1280 print_q("base_offset", channel->base_offset, '/');
1281 print_q("alternate_offset", channel->alternate_offset, '/');
1283 }
1285 }
1287}
1288
1289static void print_private_data(AVTextFormatContext *tfc, void *priv_data)
1290{
1291 const AVOption *opt = NULL;
1292 while (opt = av_opt_next(priv_data, opt)) {
1293 uint8_t *str;
1294 if (!(opt->flags & AV_OPT_FLAG_EXPORT)) continue;
1295 if (av_opt_get(priv_data, opt->name, 0, &str) >= 0) {
1296 print_str(opt->name, str);
1297 av_free(str);
1298 }
1299 }
1300}
1301
1303{
1304 const char *s = av_get_pix_fmt_name(pix_fmt);
1305 enum AVPixelFormat swapped_pix_fmt;
1306
1307 if (!s) {
1308 print_str_opt("pix_fmt", "unknown");
1309 } else if (!do_bitexact ||
1310 (swapped_pix_fmt = av_pix_fmt_swap_endianness(pix_fmt)) == AV_PIX_FMT_NONE) {
1311 print_str ("pix_fmt", s);
1312 } else {
1313 const char *s2 = av_get_pix_fmt_name(swapped_pix_fmt);
1314 char buf[128];
1315 size_t i = 0;
1316
1317 while (s[i] && s[i] == s2[i] && i < sizeof(buf) - 1) {
1318 buf[i] = s[i];
1319 i++;
1320 }
1321 buf[i] = '\0';
1322
1323 print_str ("pix_fmt", buf);
1324 }
1325}
1326
1328{
1329 const char *val = av_color_range_name(color_range);
1331 print_str_opt("color_range", "unknown");
1332 } else {
1333 print_str("color_range", val);
1334 }
1335}
1336
1337static void print_color_space(AVTextFormatContext *tfc, enum AVColorSpace color_space)
1338{
1339 const char *val = av_color_space_name(color_space);
1340 if (!val || color_space == AVCOL_SPC_UNSPECIFIED) {
1341 print_str_opt("color_space", "unknown");
1342 } else {
1343 print_str("color_space", val);
1344 }
1345}
1346
1348{
1351 print_str_opt("color_primaries", "unknown");
1352 } else {
1353 print_str("color_primaries", val);
1354 }
1355}
1356
1358{
1359 const char *val = av_color_transfer_name(color_trc);
1360 if (!val || color_trc == AVCOL_TRC_UNSPECIFIED) {
1361 print_str_opt("color_transfer", "unknown");
1362 } else {
1363 print_str("color_transfer", val);
1364 }
1365}
1366
1367static void print_chroma_location(AVTextFormatContext *tfc, enum AVChromaLocation chroma_location)
1368{
1369 const char *val = av_chroma_location_name(chroma_location);
1370 if (!val || chroma_location == AVCHROMA_LOC_UNSPECIFIED) {
1371 print_str_opt("chroma_location", "unspecified");
1372 } else {
1373 print_str("chroma_location", val);
1374 }
1375}
1376
1377static void print_alpha_mode(AVTextFormatContext *tfc, enum AVAlphaMode alpha_mode)
1378{
1379 const char *val = av_alpha_mode_name(alpha_mode);
1380 if (!val || alpha_mode == AVALPHA_MODE_UNSPECIFIED) {
1381 print_str_opt("alpha_mode", "unspecified");
1382 } else {
1383 print_str("alpha_mode", val);
1384 }
1385}
1386
1387static void clear_log(int need_lock)
1388{
1389 int i;
1390
1391 if (need_lock)
1393 for (i=0; i<log_buffer_size; i++) {
1394 av_freep(&log_buffer[i].context_name);
1395 av_freep(&log_buffer[i].parent_name);
1396 av_freep(&log_buffer[i].log_message);
1397 }
1398 log_buffer_size = 0;
1399 if(need_lock)
1401}
1402
1403static int show_log(AVTextFormatContext *tfc, int section_ids, int section_id, int log_level)
1404{
1405 int i;
1407 if (!log_buffer_size) {
1409 return 0;
1410 }
1411 avtext_print_section_header(tfc, NULL, section_ids);
1412
1413 for (i=0; i<log_buffer_size; i++) {
1414 if (log_buffer[i].log_level <= log_level) {
1415 avtext_print_section_header(tfc, NULL, section_id);
1416 print_str("context", log_buffer[i].context_name);
1417 print_int("level", log_buffer[i].log_level);
1418 print_int("category", log_buffer[i].category);
1419 if (log_buffer[i].parent_name) {
1420 print_str("parent_context", log_buffer[i].parent_name);
1421 print_int("parent_category", log_buffer[i].parent_category);
1422 } else {
1423 print_str_opt("parent_context", "N/A");
1424 print_str_opt("parent_category", "N/A");
1425 }
1426 print_str("message", log_buffer[i].log_message);
1428 }
1429 }
1430 clear_log(0);
1432
1434
1435 return 0;
1436}
1437
1438static void show_packet(AVTextFormatContext *tfc, InputFile *ifile, AVPacket *pkt, int packet_idx)
1439{
1440 AVStream *st = ifile->streams[pkt->stream_index].st;
1441 AVBPrint pbuf;
1442 const char *s;
1443
1445
1447
1449 if (s) print_str ("codec_type", s);
1450 else print_str_opt("codec_type", "unknown");
1451 print_int("stream_index", pkt->stream_index);
1452 print_ts ("pts", pkt->pts);
1453 print_time("pts_time", pkt->pts, &st->time_base);
1454 print_ts ("dts", pkt->dts);
1455 print_time("dts_time", pkt->dts, &st->time_base);
1456 print_duration_ts("duration", pkt->duration);
1457 print_duration_time("duration_time", pkt->duration, &st->time_base);
1459 if (pkt->pos != -1) print_fmt ("pos", "%"PRId64, pkt->pos);
1460 else print_str_opt("pos", "N/A");
1461 print_fmt("flags", "%c%c%c", pkt->flags & AV_PKT_FLAG_KEY ? 'K' : '_',
1462 pkt->flags & AV_PKT_FLAG_DISCARD ? 'D' : '_',
1463 pkt->flags & AV_PKT_FLAG_CORRUPT ? 'C' : '_');
1464 if (do_show_data)
1465 avtext_print_data(tfc, "data", pkt->data, pkt->size);
1466 avtext_print_data_hash(tfc, "data_hash", pkt->data, pkt->size);
1467
1468 if (pkt->side_data_elems) {
1469 size_t size;
1470 const uint8_t *side_metadata;
1471
1473 if (side_metadata && size && do_show_packet_tags) {
1474 AVDictionary *dict = NULL;
1475 if (av_packet_unpack_dictionary(side_metadata, size, &dict) >= 0)
1477 av_dict_free(&dict);
1478 }
1479
1481 for (int i = 0; i < pkt->side_data_elems; i++) {
1482 print_pkt_side_data(tfc, st->codecpar->width, st->codecpar->height, &pkt->side_data[i], 0);
1483 }
1485 }
1486
1488
1489 av_bprint_finalize(&pbuf, NULL);
1490 fflush(stdout);
1491}
1492
1495{
1496 AVBPrint pbuf;
1497
1499
1501
1502 print_str ("media_type", "subtitle");
1503 print_ts ("pts", sub->pts);
1504 print_time("pts_time", sub->pts, &AV_TIME_BASE_Q);
1505 print_int ("format", sub->format);
1506 print_int ("start_display_time", sub->start_display_time);
1507 print_int ("end_display_time", sub->end_display_time);
1508 print_int ("num_rects", sub->num_rects);
1509
1511
1512 av_bprint_finalize(&pbuf, NULL);
1513 fflush(stdout);
1514}
1515
1516static void print_iamf_param_definition(AVTextFormatContext *tfc, const char *name,
1517 const AVIAMFParamDefinition *param, SectionID section_id);
1518
1520 const AVFrame *frame,
1521 const AVStream *stream)
1522{
1524
1525 for (int i = 0; i < frame->nb_side_data; i++) {
1526 const AVFrameSideData *sd = frame->side_data[i];
1527 const char *name;
1528
1531 print_str("side_data_type", name ? name : "unknown");
1532 if (sd->type == AV_FRAME_DATA_DOWNMIX_INFO) {
1534 } else if (sd->type == AV_FRAME_DATA_DISPLAYMATRIX && sd->size >= 9*4) {
1535 print_displaymatrix(tfc, (const int32_t*)sd->data);
1536 } else if (sd->type == AV_FRAME_DATA_AFD && sd->size > 0) {
1537 print_int("active_format", *sd->data);
1538 } else if (sd->type == AV_FRAME_DATA_GOP_TIMECODE && sd->size >= 8) {
1539 char tcbuf[AV_TIMECODE_STR_SIZE];
1541 print_str("timecode", tcbuf);
1542 } else if (sd->type == AV_FRAME_DATA_S12M_TIMECODE && sd->size == 16) {
1543 uint32_t *tc = (uint32_t*)sd->data;
1544 int m = FFMIN(tc[0],3);
1546 for (int j = 1; j <= m ; j++) {
1547 char tcbuf[AV_TIMECODE_STR_SIZE];
1548 av_timecode_make_smpte_tc_string2(tcbuf, stream->avg_frame_rate, tc[j], 0, 0);
1550 print_str("value", tcbuf);
1552 }
1556 } else if (sd->type == AV_FRAME_DATA_DYNAMIC_HDR_PLUS) {
1562 } else if (sd->type == AV_FRAME_DATA_CONTENT_LIGHT_LEVEL) {
1564 } else if (sd->type == AV_FRAME_DATA_ICC_PROFILE) {
1566 if (tag)
1567 print_str(tag->key, tag->value);
1568 print_int("size", sd->size);
1569 } else if (sd->type == AV_FRAME_DATA_DOVI_METADATA) {
1570 print_dovi_metadata(tfc, (const AVDOVIMetadata *)sd->data);
1571 } else if (sd->type == AV_FRAME_DATA_DYNAMIC_HDR_VIVID) {
1576 } else if (sd->type == AV_FRAME_DATA_FILM_GRAIN_PARAMS) {
1578 print_film_grain_params(tfc, fgp);
1579 } else if (sd->type == AV_FRAME_DATA_VIEW_ID) {
1580 print_int("view_id", *(int*)sd->data);
1581 } else if (sd->type == AV_FRAME_DATA_EXIF) {
1582 print_int("size", sd->size);
1583 } else if (sd->type == AV_FRAME_DATA_IAMF_MIX_GAIN_PARAM ||
1586 const AVIAMFParamDefinition *param = (AVIAMFParamDefinition *)sd->data;
1588 }
1590 }
1592}
1593
1596{
1597 FrameData *fd = frame->opaque_ref ? (FrameData*)frame->opaque_ref->data : NULL;
1598 AVBPrint pbuf;
1599 char val_str[128];
1600 const char *s;
1601
1603
1605
1607 if (s) print_str ("media_type", s);
1608 else print_str_opt("media_type", "unknown");
1609 print_int("stream_index", stream->index);
1610 print_int("key_frame", !!(frame->flags & AV_FRAME_FLAG_KEY));
1611 print_ts ("pts", frame->pts);
1612 print_time("pts_time", frame->pts, &stream->time_base);
1613 print_ts ("pkt_dts", frame->pkt_dts);
1614 print_time("pkt_dts_time", frame->pkt_dts, &stream->time_base);
1615 print_ts ("best_effort_timestamp", frame->best_effort_timestamp);
1616 print_time("best_effort_timestamp_time", frame->best_effort_timestamp, &stream->time_base);
1617 print_duration_ts ("duration", frame->duration);
1618 print_duration_time("duration_time", frame->duration, &stream->time_base);
1619 if (fd && fd->pkt_pos != -1) print_fmt ("pkt_pos", "%"PRId64, fd->pkt_pos);
1620 else print_str_opt("pkt_pos", "N/A");
1621 if (fd && fd->pkt_size != -1) print_int_fmt("pkt_size", fd->pkt_size, AV_TEXTFORMAT_VALUE_FMT_BYTE, unit_byte_str);
1622 else print_str_opt("pkt_size", "N/A");
1623
1624 switch (stream->codecpar->codec_type) {
1625 AVRational sar;
1626
1627 case AVMEDIA_TYPE_VIDEO:
1628 print_int("width", frame->width);
1629 print_int("height", frame->height);
1630 print_int("crop_top", frame->crop_top);
1631 print_int("crop_bottom", frame->crop_bottom);
1632 print_int("crop_left", frame->crop_left);
1633 print_int("crop_right", frame->crop_right);
1634 print_pixel_format(tfc, frame->format);
1636 if (sar.num) {
1637 print_q("sample_aspect_ratio", sar, ':');
1638 } else {
1639 print_str_opt("sample_aspect_ratio", "N/A");
1640 }
1641 print_fmt("pict_type", "%c", av_get_picture_type_char(frame->pict_type));
1642 print_int("interlaced_frame", !!(frame->flags & AV_FRAME_FLAG_INTERLACED));
1643 print_int("top_field_first", !!(frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST));
1644 print_int("lossless", !!(frame->flags & AV_FRAME_FLAG_LOSSLESS));
1645 print_int("repeat_pict", frame->repeat_pict);
1646
1647 print_color_range(tfc, frame->color_range);
1648 print_color_space(tfc, frame->colorspace);
1649 print_primaries(tfc, frame->color_primaries);
1650 print_color_trc(tfc, frame->color_trc);
1651 print_chroma_location(tfc, frame->chroma_location);
1652 print_alpha_mode(tfc, frame->alpha_mode);
1653 break;
1654
1655 case AVMEDIA_TYPE_AUDIO:
1656 s = av_get_sample_fmt_name(frame->format);
1657 if (s) print_str ("sample_fmt", s);
1658 else print_str_opt("sample_fmt", "unknown");
1659 print_int("nb_samples", frame->nb_samples);
1660 print_int("channels", frame->ch_layout.nb_channels);
1661 if (frame->ch_layout.order != AV_CHANNEL_ORDER_UNSPEC) {
1662 av_channel_layout_describe(&frame->ch_layout, val_str, sizeof(val_str));
1663 print_str ("channel_layout", val_str);
1664 } else
1665 print_str_opt("channel_layout", "unknown");
1666 break;
1667 }
1669 show_tags(tfc, frame->metadata, SECTION_ID_FRAME_TAGS);
1670 if (do_show_log)
1672 if (frame->nb_side_data)
1673 print_frame_side_data(tfc, frame, stream);
1674
1676
1677 av_bprint_finalize(&pbuf, NULL);
1678 fflush(stdout);
1679}
1680
1682 InputFile *ifile,
1683 AVFrame *frame, const AVPacket *pkt,
1684 int *packet_new)
1685{
1687 AVCodecContext *dec_ctx = ifile->streams[pkt->stream_index].dec_ctx;
1688 AVCodecParameters *par = ifile->streams[pkt->stream_index].st->codecpar;
1689 AVSubtitle sub;
1690 int ret = 0, got_frame = 0;
1691
1692 clear_log(1);
1693 if (dec_ctx) {
1694 switch (par->codec_type) {
1695 case AVMEDIA_TYPE_VIDEO:
1696 case AVMEDIA_TYPE_AUDIO:
1697 if (*packet_new) {
1699 if (ret == AVERROR(EAGAIN)) {
1700 ret = 0;
1701 } else if (ret >= 0 || ret == AVERROR_EOF) {
1702 ret = 0;
1703 *packet_new = 0;
1704 }
1705 }
1706 if (ret >= 0) {
1708 if (ret >= 0) {
1709 got_frame = 1;
1710 } else if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
1711 ret = 0;
1712 }
1713 }
1714 break;
1715
1717 if (*packet_new)
1718 ret = avcodec_decode_subtitle2(dec_ctx, &sub, &got_frame, pkt);
1719 *packet_new = 0;
1720 break;
1721 default:
1722 *packet_new = 0;
1723 }
1724 } else {
1725 *packet_new = 0;
1726 }
1727
1728 if (ret < 0)
1729 return ret;
1730 if (got_frame) {
1731 int is_sub = (par->codec_type == AVMEDIA_TYPE_SUBTITLE);
1732 nb_streams_frames[pkt->stream_index]++;
1733 if (do_show_frames)
1734 if (is_sub)
1735 show_subtitle(tfc, &sub, ifile->streams[pkt->stream_index].st, fmt_ctx);
1736 else
1737 show_frame(tfc, frame, ifile->streams[pkt->stream_index].st, fmt_ctx);
1738
1739 if (!is_sub && do_analyze_frames) {
1740 for (int i = 0; i < frame->nb_side_data; i++) {
1741 if (frame->side_data[i]->type == AV_FRAME_DATA_A53_CC)
1742 streams_with_closed_captions[pkt->stream_index] = 1;
1743 else if (frame->side_data[i]->type == AV_FRAME_DATA_FILM_GRAIN_PARAMS)
1744 streams_with_film_grain[pkt->stream_index] = 1;
1745 }
1746 }
1747
1748 if (is_sub)
1749 avsubtitle_free(&sub);
1750 }
1751 return got_frame || *packet_new;
1752}
1753
1754static void log_read_interval(const ReadInterval *interval, void *log_ctx, int log_level)
1755{
1756 av_log(log_ctx, log_level, "id:%d", interval->id);
1757
1758 if (interval->has_start) {
1759 av_log(log_ctx, log_level, " start:%s%s", interval->start_is_offset ? "+" : "",
1760 av_ts2timestr(interval->start, &AV_TIME_BASE_Q));
1761 } else {
1762 av_log(log_ctx, log_level, " start:N/A");
1763 }
1764
1765 if (interval->has_end) {
1766 av_log(log_ctx, log_level, " end:%s", interval->end_is_offset ? "+" : "");
1767 if (interval->duration_frames)
1768 av_log(log_ctx, log_level, "#%"PRId64, interval->end);
1769 else
1770 av_log(log_ctx, log_level, "%s", av_ts2timestr(interval->end, &AV_TIME_BASE_Q));
1771 } else {
1772 av_log(log_ctx, log_level, " end:N/A");
1773 }
1774
1775 av_log(log_ctx, log_level, "\n");
1776}
1777
1779 const ReadInterval *interval, int64_t *cur_ts)
1780{
1782 AVPacket *pkt = NULL;
1783 AVFrame *frame = NULL;
1784 int ret = 0, i = 0, frame_count = 0;
1785 int64_t start = -INT64_MAX, end = interval->end;
1786 int has_start = 0, has_end = interval->has_end && !interval->end_is_offset;
1787
1788 av_log(NULL, AV_LOG_VERBOSE, "Processing read interval ");
1790
1791 if (interval->has_start) {
1792 int64_t target;
1793 if (interval->start_is_offset) {
1794 if (*cur_ts == AV_NOPTS_VALUE) {
1796 "Could not seek to relative position since current "
1797 "timestamp is not defined\n");
1798 ret = AVERROR(EINVAL);
1799 goto end;
1800 }
1801 target = *cur_ts + interval->start;
1802 } else {
1803 target = interval->start;
1804 }
1805
1806 av_log(NULL, AV_LOG_VERBOSE, "Seeking to read interval start point %s\n",
1807 av_ts2timestr(target, &AV_TIME_BASE_Q));
1808 if ((ret = avformat_seek_file(fmt_ctx, -1, -INT64_MAX, target, INT64_MAX, 0)) < 0) {
1809 av_log(NULL, AV_LOG_ERROR, "Could not seek to position %"PRId64": %s\n",
1810 interval->start, av_err2str(ret));
1811 goto end;
1812 }
1813 }
1814
1816 if (!frame) {
1817 ret = AVERROR(ENOMEM);
1818 goto end;
1819 }
1820 pkt = av_packet_alloc();
1821 if (!pkt) {
1822 ret = AVERROR(ENOMEM);
1823 goto end;
1824 }
1825 while (!av_read_frame(fmt_ctx, pkt)) {
1826 if (fmt_ctx->nb_streams > nb_streams) {
1832 nb_streams = fmt_ctx->nb_streams;
1833 }
1834 if (selected_streams[pkt->stream_index]) {
1835 AVRational tb = ifile->streams[pkt->stream_index].st->time_base;
1836 int64_t pts = pkt->pts != AV_NOPTS_VALUE ? pkt->pts : pkt->dts;
1837
1838 if (pts != AV_NOPTS_VALUE)
1839 *cur_ts = av_rescale_q(pts, tb, AV_TIME_BASE_Q);
1840
1841 if (!has_start && *cur_ts != AV_NOPTS_VALUE) {
1842 start = *cur_ts;
1843 has_start = 1;
1844 }
1845
1846 if (has_start && !has_end && interval->end_is_offset) {
1847 end = start + interval->end;
1848 has_end = 1;
1849 }
1850
1851 if (interval->end_is_offset && interval->duration_frames) {
1852 if (frame_count >= interval->end)
1853 break;
1854 } else if (has_end && *cur_ts != AV_NOPTS_VALUE && *cur_ts >= end) {
1855 break;
1856 }
1857
1858 frame_count++;
1859 if (do_read_packets) {
1860 if (do_show_packets)
1861 show_packet(tfc, ifile, pkt, i++);
1862 nb_streams_packets[pkt->stream_index]++;
1863 }
1864 if (do_read_frames) {
1865 int packet_new = 1;
1866 FrameData *fd;
1867
1868 pkt->opaque_ref = av_buffer_allocz(sizeof(*fd));
1869 if (!pkt->opaque_ref) {
1870 ret = AVERROR(ENOMEM);
1871 goto end;
1872 }
1873 fd = (FrameData*)pkt->opaque_ref->data;
1874 fd->pkt_pos = pkt->pos;
1875 fd->pkt_size = pkt->size;
1876
1877 while (process_frame(tfc, ifile, frame, pkt, &packet_new) > 0);
1878 }
1879 }
1881 }
1883 //Flush remaining frames that are cached in the decoder
1884 for (int i = 0; i < ifile->nb_streams; i++) {
1885 pkt->stream_index = i;
1886 if (do_read_frames) {
1887 while (process_frame(tfc, ifile, frame, pkt, &(int){1}) > 0);
1888 }
1889 }
1890
1891end:
1894 if (ret < 0) {
1895 av_log(NULL, AV_LOG_ERROR, "Could not read packets in interval ");
1897 }
1898 return ret;
1899}
1900
1901static void flush_buffers(InputFile *ifile)
1902{
1903 int i;
1904
1905 if (!do_read_frames)
1906 return;
1907 for (i = 0; i < ifile->nb_streams; i++) {
1908 if (ifile->streams[i].dec_ctx)
1910 }
1911}
1912
1914{
1916 int ret = 0;
1917 int64_t cur_ts = fmt_ctx->start_time;
1918
1919 if (read_intervals_nb == 0) {
1920 ReadInterval interval = (ReadInterval) { .has_start = 0, .has_end = 0 };
1921 ret = read_interval_packets(tfc, ifile, &interval, &cur_ts);
1922 } else {
1923 for (int i = 0; i < read_intervals_nb; i++) {
1924 /* flushing buffers can reset parts of the private context which may be
1925 * read by show_streams(), so only flush between each read_interval */
1926 if (i)
1927 flush_buffers(ifile);
1928 ret = read_interval_packets(tfc, ifile, &read_intervals[i], &cur_ts);
1929 if (ret < 0)
1930 break;
1931 }
1932 }
1933
1934 return ret;
1935}
1936
1937static void print_dispositions(AVTextFormatContext *tfc, uint32_t disposition, SectionID section_id)
1938{
1939 avtext_print_section_header(tfc, NULL, section_id);
1940 for (unsigned i = 0; i < sizeof(disposition) * CHAR_BIT; i++) {
1941 const char *disposition_str = av_disposition_to_string(1U << i);
1942
1943 if (disposition_str)
1944 print_int(disposition_str, !!(disposition & (1U << i)));
1945 }
1947}
1948
1949#define IN_PROGRAM 1
1950#define IN_STREAM_GROUP 2
1951
1952static int show_stream(AVTextFormatContext *tfc, AVFormatContext *fmt_ctx, int stream_idx, InputStream *ist, int container)
1953{
1954 AVStream *stream = ist->st;
1955 AVCodecParameters *par;
1957 char val_str[128];
1958 const char *s;
1959 AVRational sar, dar;
1960 AVBPrint pbuf;
1961 const AVCodecDescriptor *cd;
1962 const SectionID section_header[] = {
1966 };
1967 const SectionID section_disposition[] = {
1971 };
1972 const SectionID section_tags[] = {
1976 };
1977 const SectionID section_side_data[] = {
1981 };
1982 const SectionID container_side_data[] = {
1986 };
1987 int ret = 0;
1988 const char *profile = NULL;
1989
1990 av_assert0(container < FF_ARRAY_ELEMS(section_header));
1991
1993
1994 avtext_print_section_header(tfc, NULL, section_header[container]);
1995
1996 print_int("index", stream->index);
1997
1998 par = stream->codecpar;
1999 dec_ctx = ist->dec_ctx;
2000 if (cd = avcodec_descriptor_get(par->codec_id)) {
2001 print_str("codec_name", cd->name);
2002 if (!do_bitexact) {
2003 print_str("codec_long_name",
2004 cd->long_name ? cd->long_name : "unknown");
2005 }
2006 } else {
2007 print_str_opt("codec_name", "unknown");
2008 if (!do_bitexact) {
2009 print_str_opt("codec_long_name", "unknown");
2010 }
2011 }
2012
2014 print_str("profile", profile);
2015 else {
2016 if (par->profile != AV_PROFILE_UNKNOWN) {
2017 char profile_num[12];
2018 snprintf(profile_num, sizeof(profile_num), "%d", par->profile);
2019 print_str("profile", profile_num);
2020 } else
2021 print_str_opt("profile", "unknown");
2022 }
2023 if (par->level != AV_LEVEL_UNKNOWN)
2024 print_int("level", par->level);
2025 else
2026 print_int_opt("level", par->level);
2027
2029 if (s) print_str ("codec_type", s);
2030 else print_str_opt("codec_type", "unknown");
2031
2032 /* print AVI/FourCC tag */
2033 print_str("codec_tag_string", av_fourcc2str(par->codec_tag));
2034 print_fmt("codec_tag", "0x%04"PRIx32, par->codec_tag);
2035
2036 av_bprint_clear(&pbuf);
2037 if (!av_mime_codec_str(par, stream->avg_frame_rate, &pbuf))
2038 print_str("mime_codec_string", pbuf.str);
2039
2040 switch (par->codec_type) {
2041 case AVMEDIA_TYPE_VIDEO:
2042 print_int("width", par->width);
2043 print_int("height", par->height);
2044 if (dec_ctx) {
2045 print_int("coded_width", dec_ctx->coded_width);
2046 print_int("coded_height", dec_ctx->coded_height);
2047
2048 if (do_analyze_frames) {
2049 print_int("closed_captions", streams_with_closed_captions[stream->index]);
2050 print_int("film_grain", streams_with_film_grain[stream->index]);
2051 }
2052 }
2053 print_int("has_b_frames", par->video_delay);
2055 if (sar.num) {
2056 print_q("sample_aspect_ratio", sar, ':');
2057 av_reduce(&dar.num, &dar.den,
2058 (int64_t) par->width * sar.num,
2059 (int64_t) par->height * sar.den,
2060 1024*1024);
2061 print_q("display_aspect_ratio", dar, ':');
2062 } else {
2063 print_str_opt("sample_aspect_ratio", "N/A");
2064 print_str_opt("display_aspect_ratio", "N/A");
2065 }
2066 print_pixel_format(tfc, par->format);
2067
2068 print_color_range(tfc, par->color_range);
2069 print_color_space(tfc, par->color_space);
2070 print_color_trc(tfc, par->color_trc);
2073
2075 print_str("field_order", "progressive");
2076 else if (par->field_order == AV_FIELD_TT)
2077 print_str("field_order", "tt");
2078 else if (par->field_order == AV_FIELD_BB)
2079 print_str("field_order", "bb");
2080 else if (par->field_order == AV_FIELD_TB)
2081 print_str("field_order", "tb");
2082 else if (par->field_order == AV_FIELD_BT)
2083 print_str("field_order", "bt");
2084 else
2085 print_str_opt("field_order", "unknown");
2086
2087 if (dec_ctx && do_read_frames)
2088 print_int("refs", dec_ctx->refs);
2089 break;
2090
2091 case AVMEDIA_TYPE_AUDIO:
2093 if (s) print_str ("sample_fmt", s);
2094 else print_str_opt("sample_fmt", "unknown");
2095 print_val("sample_rate", par->sample_rate, unit_hertz_str);
2096 print_int("channels", par->ch_layout.nb_channels);
2097
2099 av_channel_layout_describe(&par->ch_layout, val_str, sizeof(val_str));
2100 print_str ("channel_layout", val_str);
2101 } else {
2102 print_str_opt("channel_layout", "unknown");
2103 }
2104
2105 print_int("bits_per_sample", av_get_bits_per_sample(par->codec_id));
2106
2107 print_int("initial_padding", par->initial_padding);
2108 break;
2109
2111 if (par->width)
2112 print_int("width", par->width);
2113 else
2114 print_str_opt("width", "N/A");
2115 if (par->height)
2116 print_int("height", par->height);
2117 else
2118 print_str_opt("height", "N/A");
2119 break;
2120 }
2121
2122 if (show_private_data) {
2123 if (dec_ctx && dec_ctx->codec->priv_class)
2124 print_private_data(tfc, dec_ctx->priv_data);
2125 if (fmt_ctx->iformat->priv_class)
2126 print_private_data(tfc, fmt_ctx->priv_data);
2127 }
2128
2129 if (fmt_ctx->iformat->flags & AVFMT_SHOW_IDS) print_fmt ("id", "0x%x", stream->id);
2130 else print_str_opt("id", "N/A");
2131 print_q("r_frame_rate", stream->r_frame_rate, '/');
2132 print_q("avg_frame_rate", stream->avg_frame_rate, '/');
2133 print_q("time_base", stream->time_base, '/');
2134 print_ts ("start_pts", stream->start_time);
2135 print_time("start_time", stream->start_time, &stream->time_base);
2136 print_ts ("duration_ts", stream->duration);
2137 print_time("duration", stream->duration, &stream->time_base);
2138 if (par->bit_rate > 0) print_val ("bit_rate", par->bit_rate, unit_bit_per_second_str);
2139 else print_str_opt("bit_rate", "N/A");
2140 if (dec_ctx && dec_ctx->rc_max_rate > 0)
2141 print_val ("max_bit_rate", dec_ctx->rc_max_rate, unit_bit_per_second_str);
2142 else
2143 print_str_opt("max_bit_rate", "N/A");
2144 if (dec_ctx && dec_ctx->bits_per_raw_sample > 0) print_fmt("bits_per_raw_sample", "%d", dec_ctx->bits_per_raw_sample);
2145 else print_str_opt("bits_per_raw_sample", "N/A");
2146 if (stream->nb_frames) print_fmt ("nb_frames", "%"PRId64, stream->nb_frames);
2147 else print_str_opt("nb_frames", "N/A");
2148 if (nb_streams_frames[stream_idx]) print_fmt ("nb_read_frames", "%"PRIu64, nb_streams_frames[stream_idx]);
2149 else print_str_opt("nb_read_frames", "N/A");
2150 if (nb_streams_packets[stream_idx]) print_fmt ("nb_read_packets", "%"PRIu64, nb_streams_packets[stream_idx]);
2151 else print_str_opt("nb_read_packets", "N/A");
2152 if (do_show_data)
2153 avtext_print_data(tfc, "extradata", par->extradata,
2154 par->extradata_size);
2155
2156 if (par->extradata_size > 0) {
2157 print_int("extradata_size", par->extradata_size);
2158 avtext_print_data_hash(tfc, "extradata_hash", par->extradata,
2159 par->extradata_size);
2160 }
2161
2162 /* Print disposition information */
2164 av_assert0(container < FF_ARRAY_ELEMS(section_disposition));
2165 print_dispositions(tfc, stream->disposition, section_disposition[container]);
2166 }
2167
2168 if (do_show_stream_tags) {
2169 av_assert0(container < FF_ARRAY_ELEMS(section_tags));
2170 ret = show_tags(tfc, stream->metadata, section_tags[container]);
2171 }
2172
2173 if (stream->codecpar->nb_coded_side_data) {
2174 av_assert0(container < FF_ARRAY_ELEMS(section_tags) &&
2175 container < FF_ARRAY_ELEMS(container_side_data));
2176 avtext_print_section_header(tfc, NULL, section_side_data[container]);
2177 for (int i = 0; i < stream->codecpar->nb_coded_side_data; i++) {
2178 print_pkt_side_data(tfc, stream->codecpar->width, stream->codecpar->height, &stream->codecpar->coded_side_data[i],
2179 container_side_data[container]);
2180 }
2182 }
2183
2185 av_bprint_finalize(&pbuf, NULL);
2186 fflush(stdout);
2187
2188 return ret;
2189}
2190
2192{
2194 int ret = 0;
2195
2197 for (int i = 0; i < ifile->nb_streams; i++)
2198 if (selected_streams[i]) {
2199 ret = show_stream(tfc, fmt_ctx, i, &ifile->streams[i], 0);
2200 if (ret < 0)
2201 break;
2202 }
2204
2205 return ret;
2206}
2207
2208static int show_program(AVTextFormatContext *tfc, InputFile *ifile, AVProgram *program)
2209{
2211 int ret = 0;
2212
2214 print_int("program_id", program->id);
2215 print_int("program_num", program->program_num);
2216 print_int("nb_streams", program->nb_stream_indexes);
2217 print_int("pmt_pid", program->pmt_pid);
2218 print_int("pcr_pid", program->pcr_pid);
2220 ret = show_tags(tfc, program->metadata, SECTION_ID_PROGRAM_TAGS);
2221 if (ret < 0)
2222 goto end;
2223
2225 for (unsigned i = 0; i < program->nb_stream_indexes; i++) {
2226 if (selected_streams[program->stream_index[i]]) {
2227 ret = show_stream(tfc, fmt_ctx, program->stream_index[i], &ifile->streams[program->stream_index[i]], IN_PROGRAM);
2228 if (ret < 0)
2229 break;
2230 }
2231 }
2233
2234end:
2236 return ret;
2237}
2238
2240{
2242 int ret = 0;
2243
2245 for (unsigned i = 0; i < fmt_ctx->nb_programs; i++) {
2246 AVProgram *program = fmt_ctx->programs[i];
2247 if (!program)
2248 continue;
2249 ret = show_program(tfc, ifile, program);
2250 if (ret < 0)
2251 break;
2252 }
2254 return ret;
2255}
2256
2258 const AVStreamGroupTileGrid *tile_grid)
2259{
2261 print_int("nb_tiles", tile_grid->nb_tiles);
2262 print_int("coded_width", tile_grid->coded_width);
2263 print_int("coded_height", tile_grid->coded_height);
2264 print_int("horizontal_offset", tile_grid->horizontal_offset);
2265 print_int("vertical_offset", tile_grid->vertical_offset);
2266 print_int("width", tile_grid->width);
2267 print_int("height", tile_grid->height);
2269 for (unsigned i = 0; i < tile_grid->nb_tiles; i++) {
2271 print_int("stream_index", tile_grid->offsets[i].idx);
2272 print_int("tile_horizontal_offset", tile_grid->offsets[i].horizontal);
2273 print_int("tile_vertical_offset", tile_grid->offsets[i].vertical);
2275 }
2278}
2279
2281 const AVIAMFParamDefinition *param, SectionID section_id)
2282{
2283 SectionID subsection_id, parameter_section_id;
2284 if (section_id == SECTION_ID_FRAME_SIDE_DATA)
2286 else {
2287 av_assert0(sections[section_id].children_ids[0] != -1);
2288 subsection_id = sections[section_id].children_ids[0];
2289 }
2290 av_assert0(sections[subsection_id].children_ids[0] != -1);
2291 parameter_section_id = sections[subsection_id].children_ids[0];
2292
2293 // When printing as part of side-data, skip opening a section
2294 if (section_id != SECTION_ID_FRAME_SIDE_DATA)
2295 avtext_print_section_header(tfc, "IAMF Param Definition", section_id);
2296
2297 if (name)
2298 print_str("name", name);
2299 print_int("nb_subblocks", param->nb_subblocks);
2300 print_int("type", param->type);
2301 print_int("parameter_id", param->parameter_id);
2302 print_int("parameter_rate", param->parameter_rate);
2303 print_int("duration", param->duration);
2304 print_int("constant_subblock_duration", param->constant_subblock_duration);
2305 if (param->nb_subblocks > 0)
2306 avtext_print_section_header(tfc, NULL, subsection_id);
2307 for (unsigned i = 0; i < param->nb_subblocks; i++) {
2308 const void *subblock = av_iamf_param_definition_get_subblock(param, i);
2309 switch(param->type) {
2311 const AVIAMFMixGain *mix = subblock;
2312 avtext_print_section_header(tfc, "IAMF Mix Gain Parameters", parameter_section_id);
2313 print_int("subblock_duration", mix->subblock_duration);
2314 print_int("animation_type", mix->animation_type);
2315 print_q("start_point_value", mix->start_point_value, '/');
2316 print_q("end_point_value", mix->end_point_value, '/');
2317 print_q("control_point_value", mix->control_point_value, '/');
2318 print_q("control_point_relative_time", mix->control_point_relative_time, '/');
2319 avtext_print_section_footer(tfc); // parameter_section_id
2320 break;
2321 }
2323 const AVIAMFDemixingInfo *demix = subblock;
2324 avtext_print_section_header(tfc, "IAMF Demixing Info", parameter_section_id);
2325 print_int("subblock_duration", demix->subblock_duration);
2326 print_int("dmixp_mode", demix->dmixp_mode);
2327 avtext_print_section_footer(tfc); // parameter_section_id
2328 break;
2329 }
2331 const AVIAMFReconGain *recon = subblock;
2332 avtext_print_section_header(tfc, "IAMF Recon Gain", parameter_section_id);
2333 print_int("subblock_duration", recon->subblock_duration);
2334 avtext_print_section_footer(tfc); // parameter_section_id
2335 break;
2336 }
2337 }
2338 }
2339 if (param->nb_subblocks > 0)
2340 avtext_print_section_footer(tfc); // subsection_id
2341
2342 if (section_id != SECTION_ID_FRAME_SIDE_DATA)
2343 avtext_print_section_footer(tfc); // section_id
2344}
2345
2347 const AVIAMFAudioElement *audio_element)
2348{
2349 AVBPrint pbuf;
2350
2352
2354 print_int("nb_layers", audio_element->nb_layers);
2355 print_int("audio_element_type", audio_element->audio_element_type);
2356 print_int("default_w", audio_element->default_w);
2358 for (unsigned i = 0; i < audio_element->nb_layers; i++) {
2359 const AVIAMFLayer *layer = audio_element->layers[i];
2360 char val_str[128];
2362 av_channel_layout_describe(&layer->ch_layout, val_str, sizeof(val_str));
2363 print_str("channel_layout", val_str);
2365 print_int("output_gain_flags", layer->output_gain_flags);
2366 print_q("output_gain", layer->output_gain, '/');
2367 } else if (audio_element->audio_element_type == AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE) {
2368 print_int("ambisonics_mode", layer->ambisonics_mode);
2370 print_list_fmt("demixing_matrix", "%d/%d", layer->nb_demixing_matrix, 1, layer->demixing_matrix[idx].num,
2371 layer->demixing_matrix[idx].den);
2372 }
2373 avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_SUBCOMPONENT
2374 }
2375 if (audio_element->demixing_info)
2376 print_iamf_param_definition(tfc, "demixing_info", audio_element->demixing_info,
2378 if (audio_element->recon_gain_info)
2379 print_iamf_param_definition(tfc, "recon_gain_info", audio_element->recon_gain_info,
2381 avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_SUBCOMPONENTS
2382 avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_COMPONENT
2383
2384 av_bprint_finalize(&pbuf, NULL);
2385}
2386
2388{
2390 print_int("nb_elements", submix->nb_elements);
2391 print_int("nb_layouts", submix->nb_layouts);
2392 print_q("default_mix_gain", submix->default_mix_gain, '/');
2394 for (unsigned i = 0; i < submix->nb_elements; i++) {
2395 const AVIAMFSubmixElement *element = submix->elements[i];
2397 print_int("stream_id", element->audio_element_id);
2398 print_q("default_mix_gain", element->default_mix_gain, '/');
2399 print_int("headphones_rendering_mode", element->headphones_rendering_mode);
2401 if (element->annotations) {
2402 const AVDictionaryEntry *annotation = NULL;
2404 while (annotation = av_dict_iterate(element->annotations, annotation))
2405 print_str(annotation->key, annotation->value);
2406 avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_SUBPIECE
2407 }
2408 if (element->element_mix_config)
2409 print_iamf_param_definition(tfc, "element_mix_config", element->element_mix_config,
2411 avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_SUBPIECES
2412 avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_PIECE
2413 }
2414 if (submix->output_mix_config)
2415 print_iamf_param_definition(tfc, "output_mix_config", submix->output_mix_config,
2417 for (unsigned i = 0; i < submix->nb_layouts; i++) {
2418 const AVIAMFSubmixLayout *layout = submix->layouts[i];
2419 char val_str[128];
2421 av_channel_layout_describe(&layout->sound_system, val_str, sizeof(val_str));
2422 print_str("sound_system", val_str);
2423 print_q("integrated_loudness", layout->integrated_loudness, '/');
2424 print_q("digital_peak", layout->digital_peak, '/');
2425 print_q("true_peak", layout->true_peak, '/');
2426 print_q("dialogue_anchored_loudness", layout->dialogue_anchored_loudness, '/');
2427 print_q("album_anchored_loudness", layout->album_anchored_loudness, '/');
2428 avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_PIECE
2429 }
2430 avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_PIECES
2431 avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_SUBCOMPONENT
2432}
2433
2435 const AVIAMFMixPresentation *mix_presentation)
2436{
2438 print_int("nb_submixes", mix_presentation->nb_submixes);
2440 if (mix_presentation->annotations) {
2441 const AVDictionaryEntry *annotation = NULL;
2443 while (annotation = av_dict_iterate(mix_presentation->annotations, annotation))
2444 print_str(annotation->key, annotation->value);
2445 avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_SUBCOMPONENT
2446 }
2447 for (unsigned i = 0; i < mix_presentation->nb_submixes; i++)
2448 print_iamf_submix_params(tfc, mix_presentation->submixes[i]);
2449 avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_SUBCOMPONENTS
2450 avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_COMPONENT
2451}
2452
2454 const AVStreamGroupLayeredVideo *layered_video)
2455{
2457 print_int("el_index", layered_video->el_index);
2458 print_int("width", layered_video->width);
2459 print_int("height", layered_video->height);
2460 avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_COMPONENT
2461}
2462
2480
2481static int show_stream_group(AVTextFormatContext *tfc, InputFile *ifile, AVStreamGroup *stg, int container)
2482{
2484 AVBPrint pbuf;
2485 const SectionID section_header[] = {
2489 };
2490 const SectionID section_disposition[] = {
2494 };
2495 const SectionID section_tags[] = {
2499 };
2500 int ret = 0;
2501
2502 av_assert0(container < FF_ARRAY_ELEMS(section_header));
2503
2505 avtext_print_section_header(tfc, NULL, section_header[container]);
2506 print_int("index", stg->index);
2507 if (fmt_ctx->iformat->flags & AVFMT_SHOW_IDS) print_fmt ("id", "0x%"PRIx64, stg->id);
2508 else print_str_opt("id", "N/A");
2509 print_int("nb_streams", stg->nb_entries);
2511 print_str("type", av_x_if_null(avformat_stream_group_name(stg->type), "unknown"));
2512 else
2513 print_str_opt("type", "unknown");
2514
2515 if (container)
2516 goto end;
2517
2519 print_stream_group_params(tfc, stg);
2520
2521 /* Print disposition information */
2523 av_assert0(container < FF_ARRAY_ELEMS(section_disposition));
2524 print_dispositions(tfc, stg->disposition, section_disposition[container]);
2525 }
2526
2528 av_assert0(container < FF_ARRAY_ELEMS(section_tags));
2529 ret = show_tags(tfc, stg->metadata, section_tags[container]);
2530 }
2531 if (ret < 0)
2532 goto end;
2533
2534 if (stg->nb_coded_side_data) {
2535 int width = 0, height = 0;
2537
2538 switch (stg->type) {
2540 const AVStreamGroupTileGrid *tile_grid = stg->params.tile_grid;
2541 width = tile_grid->width;
2542 height = tile_grid->height;
2543 break;
2544 }
2546 const AVStreamGroupLayeredVideo *layered_video = stg->params.layered_video;
2547 width = layered_video->width;
2548 height = layered_video->height;
2549 break;
2550 }
2551 default:
2552 break;
2553 }
2554 for (int i = 0; i < stg->nb_coded_side_data; i++) {
2557 }
2559 }
2560
2562 for (unsigned i = 0; i < stg->nb_entries; i++) {
2565 continue;
2566 ret = show_stream_group(tfc, ifile, entry->stream_group, IN_STREAM_GROUP);
2567 if (ret < 0)
2568 break;
2569 }
2571
2573 for (unsigned i = 0; i < stg->nb_entries; i++) {
2576 continue;
2577 if (selected_streams[stg->entries[i]->stream->index]) {
2578 ret = show_stream(tfc, fmt_ctx, entry->stream->index, &ifile->streams[entry->stream->index], IN_STREAM_GROUP);
2579 if (ret < 0)
2580 break;
2581 }
2582 }
2584
2585end:
2586 av_bprint_finalize(&pbuf, NULL);
2588 return ret;
2589}
2590
2592{
2594 int ret = 0;
2595
2597 for (unsigned i = 0; i < fmt_ctx->nb_stream_groups; i++) {
2598 AVStreamGroup *stg = fmt_ctx->stream_groups[i];
2599
2600 ret = show_stream_group(tfc, ifile, stg, 0);
2601 if (ret < 0)
2602 break;
2603 }
2605 return ret;
2606}
2607
2609{
2611 int ret = 0;
2612
2614 for (unsigned i = 0; i < fmt_ctx->nb_chapters; i++) {
2615 AVChapter *chapter = fmt_ctx->chapters[i];
2616
2618 print_int("id", chapter->id);
2619 print_q ("time_base", chapter->time_base, '/');
2620 print_int("start", chapter->start);
2621 print_time("start_time", chapter->start, &chapter->time_base);
2622 print_int("end", chapter->end);
2623 print_time("end_time", chapter->end, &chapter->time_base);
2625 ret = show_tags(tfc, chapter->metadata, SECTION_ID_CHAPTER_TAGS);
2627 }
2629
2630 return ret;
2631}
2632
2634{
2636 int64_t size = fmt_ctx->pb ? avio_size(fmt_ctx->pb) : -1;
2637 int ret = 0;
2638
2640 print_str_validate("filename", fmt_ctx->url);
2641 print_int("nb_streams", fmt_ctx->nb_streams);
2642 print_int("nb_programs", fmt_ctx->nb_programs);
2643 print_int("nb_stream_groups", fmt_ctx->nb_stream_groups);
2644 print_str("format_name", fmt_ctx->iformat->name);
2645 if (!do_bitexact) {
2646 if (fmt_ctx->iformat->long_name) print_str ("format_long_name", fmt_ctx->iformat->long_name);
2647 else print_str_opt("format_long_name", "unknown");
2648 }
2649 print_time("start_time", fmt_ctx->start_time, &AV_TIME_BASE_Q);
2650 print_time("duration", fmt_ctx->duration, &AV_TIME_BASE_Q);
2652 else print_str_opt("size", "N/A");
2653 if (fmt_ctx->bit_rate > 0) print_val ("bit_rate", fmt_ctx->bit_rate, unit_bit_per_second_str);
2654 else print_str_opt("bit_rate", "N/A");
2655 print_int("probe_score", fmt_ctx->probe_score);
2657 ret = show_tags(tfc, fmt_ctx->metadata, SECTION_ID_FORMAT_TAGS);
2658
2660 fflush(stdout);
2661 return ret;
2662}
2663
2664static void show_error(AVTextFormatContext *tfc, int err)
2665{
2667 print_int("code", err);
2668 print_str("string", av_err2str(err));
2670}
2671
2672static int get_decoder_by_name(const char *codec_name, const AVCodec **codec)
2673{
2674 if (codec_name == NULL)
2675 return 0;
2676
2677 *codec = avcodec_find_decoder_by_name(codec_name);
2678 if (*codec == NULL) {
2680 "No codec could be found with name '%s'\n", codec_name);
2681 return AVERROR(EINVAL);
2682 }
2683 return 0;
2684}
2685
2687{
2688 int ret;
2689
2690#define GET_DECODER(type_) \
2691 ret = get_decoder_by_name(type_##_codec_name, &fmt_ctx->type_##_codec); \
2692 if (ret < 0) return ret;
2693
2694 GET_DECODER(audio);
2696 GET_DECODER(subtitle);
2697 GET_DECODER(video);
2698 return 0;
2699}
2700
2702{
2703 const AVCodec *codec = NULL;
2704 switch (stream->codecpar->codec_type) {
2705 case AVMEDIA_TYPE_VIDEO: codec = fmt_ctx->video_codec; break;
2706 case AVMEDIA_TYPE_AUDIO: codec = fmt_ctx->audio_codec; break;
2707 case AVMEDIA_TYPE_SUBTITLE: codec = fmt_ctx->subtitle_codec; break;
2708 case AVMEDIA_TYPE_DATA: codec = fmt_ctx->data_codec; break;
2709 }
2710
2711 if (codec != NULL)
2712 return codec;
2713
2714 if (stream->codecpar->codec_id == AV_CODEC_ID_PROBE) {
2716 "Failed to probe codec for input stream %d\n", stream->index);
2717 return NULL;
2718 }
2719
2720 codec = avcodec_find_decoder(stream->codecpar->codec_id);
2721 if (codec == NULL) {
2723 "Unsupported codec with id %d for input stream %d\n",
2724 stream->codecpar->codec_id, stream->index);
2725 return NULL;
2726 }
2727
2728 return codec;
2729}
2730
2731static int open_input_file(InputFile *ifile, const char *filename,
2732 const char *print_filename)
2733{
2734 int err;
2736 const AVDictionaryEntry *t = NULL;
2737 int scan_all_pmts_set = 0;
2738
2740 if (!fmt_ctx)
2741 return AVERROR(ENOMEM);
2742
2743 err = set_decoders(fmt_ctx);
2744 if (err < 0)
2745 return err;
2746 if (!av_dict_get(format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE)) {
2747 av_dict_set(&format_opts, "scan_all_pmts", "1", AV_DICT_DONT_OVERWRITE);
2748 scan_all_pmts_set = 1;
2749 }
2750 if ((err = avformat_open_input(&fmt_ctx, filename,
2751 iformat, &format_opts)) < 0) {
2752 print_error(filename, err);
2753 return err;
2754 }
2755 if (print_filename) {
2756 av_freep(&fmt_ctx->url);
2757 fmt_ctx->url = av_strdup(print_filename);
2758 }
2759 ifile->fmt_ctx = fmt_ctx;
2760 if (scan_all_pmts_set)
2761 av_dict_set(&format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE);
2762 while ((t = av_dict_iterate(format_opts, t)))
2763 av_log(NULL, AV_LOG_WARNING, "Option %s skipped - not known to demuxer.\n", t->key);
2764
2765 if (find_stream_info) {
2767 int orig_nb_streams = fmt_ctx->nb_streams;
2768
2770 if (err < 0)
2771 return err;
2772
2774
2775 for (int i = 0; i < orig_nb_streams; i++)
2776 av_dict_free(&opts[i]);
2777 av_freep(&opts);
2778
2779 if (err < 0) {
2780 print_error(filename, err);
2781 return err;
2782 }
2783 }
2784
2785 av_dump_format(fmt_ctx, 0, filename, 0);
2786
2787 ifile->streams = av_calloc(fmt_ctx->nb_streams, sizeof(*ifile->streams));
2788 if (!ifile->streams)
2789 exit(1);
2790 ifile->nb_streams = fmt_ctx->nb_streams;
2791
2792 /* bind a decoder to each input stream */
2793 for (unsigned i = 0; i < fmt_ctx->nb_streams; i++) {
2794 InputStream *ist = &ifile->streams[i];
2795 AVStream *stream = fmt_ctx->streams[i];
2796 const AVCodec *codec;
2797
2798 ist->st = stream;
2799
2800 codec = get_decoder_for_stream(fmt_ctx, stream);
2801 if (!codec)
2802 continue;
2803
2804 {
2806
2808 fmt_ctx, stream, codec, &opts, NULL);
2809 if (err < 0)
2810 exit(1);
2811
2812 ist->dec_ctx = avcodec_alloc_context3(codec);
2813 if (!ist->dec_ctx)
2814 exit(1);
2815
2816 err = avcodec_parameters_to_context(ist->dec_ctx, stream->codecpar);
2817 if (err < 0)
2818 exit(1);
2819
2820 if (do_show_log) {
2821 // For logging it is needed to disable at least frame threads as otherwise
2822 // the log information would need to be reordered and matches up to contexts and frames
2823 // That is in fact possible but not trivial
2824 av_dict_set(&codec_opts, "threads", "1", 0);
2825 }
2826
2827 av_dict_set(&opts, "flags", "+copy_opaque", AV_DICT_MULTIKEY);
2828
2829 ist->dec_ctx->pkt_timebase = stream->time_base;
2830
2831 if (avcodec_open2(ist->dec_ctx, codec, &opts) < 0) {
2832 av_log(NULL, AV_LOG_WARNING, "Could not open codec for input stream %d\n",
2833 stream->index);
2834 exit(1);
2835 }
2836
2837 if ((t = av_dict_iterate(opts, NULL))) {
2838 av_log(NULL, AV_LOG_ERROR, "Option %s for input stream %d not found\n",
2839 t->key, stream->index);
2841 }
2842 }
2843 }
2844
2845 ifile->fmt_ctx = fmt_ctx;
2846 return 0;
2847}
2848
2849static void close_input_file(InputFile *ifile)
2850{
2851
2852 /* close decoder for each stream */
2853 for (int i = 0; i < ifile->nb_streams; i++)
2855
2856 av_freep(&ifile->streams);
2857 ifile->nb_streams = 0;
2858
2860}
2861
2862static int probe_file(AVTextFormatContext *tfc, const char *filename,
2863 const char *print_filename)
2864{
2865 InputFile ifile = { 0 };
2866 int ret;
2867 int section_id;
2868
2872
2873 ret = open_input_file(&ifile, filename, print_filename);
2874 if (ret < 0)
2875 goto end;
2876
2877#define CHECK_END if (ret < 0) goto end
2878
2879 nb_streams = ifile.fmt_ctx->nb_streams;
2885
2886 for (unsigned i = 0; i < ifile.fmt_ctx->nb_streams; i++) {
2887 if (stream_specifier) {
2889 ifile.fmt_ctx->streams[i],
2891 CHECK_END;
2892 else
2893 selected_streams[i] = ret;
2894 ret = 0;
2895 } else {
2896 selected_streams[i] = 1;
2897 }
2898 if (!selected_streams[i])
2900 }
2901
2905 section_id = SECTION_ID_PACKETS_AND_FRAMES;
2906 else if (do_show_packets && !do_show_frames)
2907 section_id = SECTION_ID_PACKETS;
2908 else // (!do_show_packets && do_show_frames)
2909 section_id = SECTION_ID_FRAMES;
2911 avtext_print_section_header(tfc, NULL, section_id);
2912 ret = read_packets(tfc, &ifile);
2915 CHECK_END;
2916 }
2917
2918 if (do_show_programs) {
2919 ret = show_programs(tfc, &ifile);
2920 CHECK_END;
2921 }
2922
2924 ret = show_stream_groups(tfc, &ifile);
2925 CHECK_END;
2926 }
2927
2928 if (do_show_streams) {
2929 ret = show_streams(tfc, &ifile);
2930 CHECK_END;
2931 }
2932 if (do_show_chapters) {
2933 ret = show_chapters(tfc, &ifile);
2934 CHECK_END;
2935 }
2936 if (do_show_format) {
2937 ret = show_format(tfc, &ifile);
2938 CHECK_END;
2939 }
2940
2941end:
2942 if (ifile.fmt_ctx)
2943 close_input_file(&ifile);
2953
2954 return ret;
2955}
2956
2957static void show_usage(void)
2958{
2959 av_log(NULL, AV_LOG_INFO, "Simple multimedia streams analyzer\n");
2960 av_log(NULL, AV_LOG_INFO, "usage: %s [OPTIONS] INPUT_FILE\n", program_name);
2961 av_log(NULL, AV_LOG_INFO, "\n");
2962}
2963
2965{
2966 AVBPrint pbuf;
2968
2970 print_str("version", FFMPEG_VERSION);
2971 print_fmt("copyright", "Copyright (c) %d-%d the FFmpeg developers",
2972 program_birth_year, CONFIG_THIS_YEAR);
2973 print_str("compiler_ident", CC_IDENT);
2974 print_str("configuration", FFMPEG_CONFIGURATION);
2976
2977 av_bprint_finalize(&pbuf, NULL);
2978}
2979
2980#define SHOW_LIB_VERSION(libname, LIBNAME) \
2981 do { \
2982 if (CONFIG_##LIBNAME) { \
2983 unsigned int version = libname##_version(); \
2984 avtext_print_section_header(tfc, NULL, SECTION_ID_LIBRARY_VERSION); \
2985 print_str("name", "lib" #libname); \
2986 print_int("major", LIB##LIBNAME##_VERSION_MAJOR); \
2987 print_int("minor", LIB##LIBNAME##_VERSION_MINOR); \
2988 print_int("micro", LIB##LIBNAME##_VERSION_MICRO); \
2989 print_int("version", version); \
2990 print_str("ident", LIB##LIBNAME##_IDENT); \
2991 avtext_print_section_footer(tfc); \
2992 } \
2993 } while (0)
2994
2996{
2998 SHOW_LIB_VERSION(avutil, AVUTIL);
2999 SHOW_LIB_VERSION(avcodec, AVCODEC);
3000 SHOW_LIB_VERSION(avformat, AVFORMAT);
3001 SHOW_LIB_VERSION(avdevice, AVDEVICE);
3002 SHOW_LIB_VERSION(avfilter, AVFILTER);
3003 SHOW_LIB_VERSION(swscale, SWSCALE);
3004 SHOW_LIB_VERSION(swresample, SWRESAMPLE);
3006}
3007
3008#define PRINT_PIX_FMT_FLAG(flagname, name) \
3009 do { \
3010 print_int(name, !!(pixdesc->flags & AV_PIX_FMT_FLAG_##flagname)); \
3011 } while (0)
3012
3014{
3015 const AVPixFmtDescriptor *pixdesc = NULL;
3016 int i, n;
3017
3019 while (pixdesc = av_pix_fmt_desc_next(pixdesc)) {
3021 print_str("name", pixdesc->name);
3022 print_int("nb_components", pixdesc->nb_components);
3023 if ((pixdesc->nb_components >= 3) && !(pixdesc->flags & AV_PIX_FMT_FLAG_RGB)) {
3024 print_int ("log2_chroma_w", pixdesc->log2_chroma_w);
3025 print_int ("log2_chroma_h", pixdesc->log2_chroma_h);
3026 } else {
3027 print_str_opt("log2_chroma_w", "N/A");
3028 print_str_opt("log2_chroma_h", "N/A");
3029 }
3030 n = av_get_bits_per_pixel(pixdesc);
3031 if (n) print_int ("bits_per_pixel", n);
3032 else print_str_opt("bits_per_pixel", "N/A");
3035 PRINT_PIX_FMT_FLAG(BE, "big_endian");
3036 PRINT_PIX_FMT_FLAG(PAL, "palette");
3037 PRINT_PIX_FMT_FLAG(BITSTREAM, "bitstream");
3038 PRINT_PIX_FMT_FLAG(HWACCEL, "hwaccel");
3039 PRINT_PIX_FMT_FLAG(PLANAR, "planar");
3040 PRINT_PIX_FMT_FLAG(RGB, "rgb");
3041 PRINT_PIX_FMT_FLAG(ALPHA, "alpha");
3043 }
3044 if (do_show_pixel_format_components && (pixdesc->nb_components > 0)) {
3046 for (i = 0; i < pixdesc->nb_components; i++) {
3048 print_int("index", i + 1);
3049 print_int("bit_depth", pixdesc->comp[i].depth);
3051 }
3053 }
3055 }
3057}
3058
3059static int opt_show_optional_fields(void *optctx, const char *opt, const char *arg)
3060{
3064
3066 double num;
3067 int ret = parse_number("show_optional_fields", arg, OPT_TYPE_INT,
3069 if (ret < 0)
3070 return ret;
3072 }
3073 return 0;
3074}
3075
3076static int opt_format(void *optctx, const char *opt, const char *arg)
3077{
3079 if (!iformat) {
3080 av_log(NULL, AV_LOG_ERROR, "Unknown input format: %s\n", arg);
3081 return AVERROR(EINVAL);
3082 }
3083 return 0;
3084}
3085
3086static inline void mark_section_show_entries(SectionID section_id,
3087 int show_all_entries, AVDictionary *entries,
3088 int explicitly_selected)
3089{
3090 EntrySelection *selection = &selected_entries[section_id];
3091
3092 selection->show_all_entries = show_all_entries;
3093 selection->explicitly_selected |= explicitly_selected;
3094 if (show_all_entries) {
3095 const AVTextFormatSection *section = &sections[section_id];
3096 for (const int *id = section->children_ids; *id != -1; id++)
3097 mark_section_show_entries(*id, show_all_entries, entries, explicitly_selected);
3098 } else {
3099 av_dict_copy(&selection->entries_to_show, entries, 0);
3100 }
3101}
3102
3103static int match_section(const char *section_name,
3104 int show_all_entries, AVDictionary *entries)
3105{
3106 int ret = 0;
3107
3108 for (unsigned i = 0; i < FF_ARRAY_ELEMS(sections); i++) {
3109 const struct AVTextFormatSection *section = &sections[i];
3110 if (!strcmp(section_name, section->name) ||
3111 (section->unique_name && !strcmp(section_name, section->unique_name))) {
3113 "'%s' matches section with unique name '%s'\n", section_name,
3114 (char *)av_x_if_null(section->unique_name, section->name));
3115 ret++;
3116 mark_section_show_entries(section->id, show_all_entries, entries,
3117 !section->unique_name ||
3118 !strcmp(section_name, section->unique_name));
3119 }
3120 }
3121 return ret;
3122}
3123
3124static int opt_show_entries(void *optctx, const char *opt, const char *arg)
3125{
3126 const char *p = arg;
3127 int ret = 0;
3128
3129 while (*p) {
3130 AVDictionary *entries = NULL;
3131 char *section_name = av_get_token(&p, "=:");
3132 int show_all_entries = 0;
3133
3134 if (!section_name) {
3136 "Missing section name for option '%s'\n", opt);
3137 return AVERROR(EINVAL);
3138 }
3139
3140 if (*p == '=') {
3141 p++;
3142 while (*p && *p != ':') {
3143 char *entry = av_get_token(&p, ",:");
3144 if (!entry)
3145 break;
3147 "Adding '%s' to the entries to show in section '%s'\n",
3148 entry, section_name);
3150 if (*p == ',')
3151 p++;
3152 }
3153 } else {
3154 show_all_entries = 1;
3155 }
3156
3157 ret = match_section(section_name, show_all_entries, entries);
3158 if (ret == 0) {
3159 av_log(NULL, AV_LOG_ERROR, "No match for section '%s'\n", section_name);
3160 ret = AVERROR(EINVAL);
3161 }
3162 av_dict_free(&entries);
3163 av_free(section_name);
3164
3165 if (ret <= 0)
3166 break;
3167 if (*p)
3168 p++;
3169 }
3170
3171 return ret;
3172}
3173
3174static int opt_input_file(void *optctx, const char *arg)
3175{
3176 if (input_filename) {
3178 "Argument '%s' provided as input filename, but '%s' was already specified.\n",
3180 return AVERROR(EINVAL);
3181 }
3182 if (!strcmp(arg, "-"))
3183 arg = "fd:";
3185 if (!input_filename)
3186 return AVERROR(ENOMEM);
3187
3188 return 0;
3189}
3190
3191static int opt_input_file_i(void *optctx, const char *opt, const char *arg)
3192{
3193 opt_input_file(optctx, arg);
3194 return 0;
3195}
3196
3197static int opt_output_file_o(void *optctx, const char *opt, const char *arg)
3198{
3199 if (output_filename) {
3201 "Argument '%s' provided as output filename, but '%s' was already specified.\n",
3203 return AVERROR(EINVAL);
3204 }
3205 if (!strcmp(arg, "-"))
3206 arg = "fd:";
3208 if (!output_filename)
3209 return AVERROR(ENOMEM);
3210
3211 return 0;
3212}
3213
3214static int opt_print_filename(void *optctx, const char *opt, const char *arg)
3215{
3218 return print_input_filename ? 0 : AVERROR(ENOMEM);
3219}
3220
3231
3232/**
3233 * Parse interval specification, according to the format:
3234 * INTERVAL ::= [START|+START_OFFSET][%[END|+END_OFFSET]]
3235 * INTERVALS ::= INTERVAL[,INTERVALS]
3236*/
3237static int parse_read_interval(const char *interval_spec,
3238 ReadInterval *interval)
3239{
3240 int ret = 0;
3241 char *next, *p, *spec = av_strdup(interval_spec);
3242 if (!spec)
3243 return AVERROR(ENOMEM);
3244
3245 if (!*spec) {
3246 av_log(NULL, AV_LOG_ERROR, "Invalid empty interval specification\n");
3247 ret = AVERROR(EINVAL);
3248 goto end;
3249 }
3250
3251 p = spec;
3252 next = strchr(spec, '%');
3253 if (next)
3254 *next++ = 0;
3255
3256 /* parse first part */
3257 if (*p) {
3258 interval->has_start = 1;
3259
3260 if (*p == '+') {
3261 interval->start_is_offset = 1;
3262 p++;
3263 } else {
3264 interval->start_is_offset = 0;
3265 }
3266
3267 ret = av_parse_time(&interval->start, p, 1);
3268 if (ret < 0) {
3269 av_log(NULL, AV_LOG_ERROR, "Invalid interval start specification '%s'\n", p);
3270 goto end;
3271 }
3272 } else {
3273 interval->has_start = 0;
3274 }
3275
3276 /* parse second part */
3277 p = next;
3278 if (p && *p) {
3279 int64_t us;
3280 interval->has_end = 1;
3281
3282 if (*p == '+') {
3283 interval->end_is_offset = 1;
3284 p++;
3285 } else {
3286 interval->end_is_offset = 0;
3287 }
3288
3289 if (interval->end_is_offset && *p == '#') {
3290 long long int lli;
3291 char *tail;
3292 interval->duration_frames = 1;
3293 p++;
3294 lli = strtoll(p, &tail, 10);
3295 if (*tail || lli < 0) {
3297 "Invalid or negative value '%s' for duration number of frames\n", p);
3298 goto end;
3299 }
3300 interval->end = lli;
3301 } else {
3302 interval->duration_frames = 0;
3303 ret = av_parse_time(&us, p, 1);
3304 if (ret < 0) {
3305 av_log(NULL, AV_LOG_ERROR, "Invalid interval end/duration specification '%s'\n", p);
3306 goto end;
3307 }
3308 interval->end = us;
3309 }
3310 } else {
3311 interval->has_end = 0;
3312 }
3313
3314end:
3315 av_free(spec);
3316 return ret;
3317}
3318
3319static int parse_read_intervals(const char *intervals_spec)
3320{
3321 int ret, n, i;
3322 char *p, *spec = av_strdup(intervals_spec);
3323 if (!spec)
3324 return AVERROR(ENOMEM);
3325
3326 /* preparse specification, get number of intervals */
3327 for (n = 0, p = spec; *p; p++)
3328 if (*p == ',')
3329 n++;
3330 n++;
3331
3333 if (!read_intervals) {
3334 ret = AVERROR(ENOMEM);
3335 goto end;
3336 }
3338
3339 /* parse intervals */
3340 p = spec;
3341 for (i = 0; p; i++) {
3342 char *next;
3343
3345 next = strchr(p, ',');
3346 if (next)
3347 *next++ = 0;
3348
3349 read_intervals[i].id = i;
3351 if (ret < 0) {
3352 av_log(NULL, AV_LOG_ERROR, "Error parsing read interval #%d '%s'\n",
3353 i, p);
3354 goto end;
3355 }
3356 av_log(NULL, AV_LOG_VERBOSE, "Parsed log interval ");
3358 p = next;
3359 }
3361
3362end:
3363 av_free(spec);
3364 return ret;
3365}
3366
3367static int opt_read_intervals(void *optctx, const char *opt, const char *arg)
3368{
3369 return parse_read_intervals(arg);
3370}
3371
3372static int opt_pretty(void *optctx, const char *opt, const char *arg)
3373{
3374 show_value_unit = 1;
3375 use_value_prefix = 1;
3378 return 0;
3379}
3380
3381static void print_section(SectionID id, int level)
3382{
3383 const int *pid;
3384 const struct AVTextFormatSection *section = &sections[id];
3385 printf("%c%c%c%c",
3386 section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER ? 'W' : '.',
3387 section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY ? 'A' : '.',
3389 section->flags & AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE ? 'T' : '.');
3390 printf("%*c %s", level * 4, ' ', section->name);
3391 if (section->unique_name)
3392 printf("/%s", section->unique_name);
3393 printf("\n");
3394
3395 for (pid = section->children_ids; *pid != -1; pid++)
3396 print_section(*pid, level+1);
3397}
3398
3399static int opt_sections(void *optctx, const char *opt, const char *arg)
3400{
3401 printf("Sections:\n"
3402 "W... = Section is a wrapper (contains other sections, no local entries)\n"
3403 ".A.. = Section contains an array of elements of the same type\n"
3404 "..V. = Section may contain a variable number of fields with variable keys\n"
3405 "...T = Section contain a unique type\n"
3406 "FLAGS NAME/UNIQUE_NAME\n"
3407 "----\n");
3409 return 0;
3410}
3411
3412static int opt_codec(void *optctx, const char *opt, const char *arg)
3413{
3414 const char *spec = strchr(opt, ':');
3415 const char **name;
3416 if (!spec) {
3418 "No media specifier was specified for '%s' in option '%s'. Use -%s:<media_spec> "
3419 "where <media_spec> can be one of: 'a' (audio), 'v' (video), 's' (subtitle), 'd' (data)\n",
3420 arg, opt, opt);
3421 return AVERROR(EINVAL);
3422 }
3423 spec++;
3424
3425 switch (spec[0]) {
3426 case 'a' : name = &audio_codec_name; break;
3427 case 'd' : name = &data_codec_name; break;
3428 case 's' : name = &subtitle_codec_name; break;
3429 case 'v' : name = &video_codec_name; break;
3430 default:
3432 "Invalid media specifier '%s' in option '%s'. "
3433 "Must be one of: 'a' (audio), 'v' (video), 's' (subtitle), 'd' (data)\n", spec, opt);
3434 return AVERROR(EINVAL);
3435 }
3436
3437 av_freep(name);
3438 *name = av_strdup(arg);
3439 return *name ? 0 : AVERROR(ENOMEM);
3440}
3441
3442static int opt_show_versions(void *optctx, const char *opt, const char *arg)
3443{
3446 return 0;
3447}
3448
3449#define DEFINE_OPT_SHOW_SECTION(section, target_section_id) \
3450 static int opt_show_##section(void *optctx, const char *opt, const char *arg) \
3451 { \
3452 mark_section_show_entries(SECTION_ID_##target_section_id, 1, NULL, 1); \
3453 return 0; \
3454 }
3455
3456DEFINE_OPT_SHOW_SECTION(chapters, CHAPTERS)
3460DEFINE_OPT_SHOW_SECTION(library_versions, LIBRARY_VERSIONS)
3461DEFINE_OPT_SHOW_SECTION(packets, PACKETS)
3463DEFINE_OPT_SHOW_SECTION(program_version, PROGRAM_VERSION)
3464DEFINE_OPT_SHOW_SECTION(streams, STREAMS)
3465DEFINE_OPT_SHOW_SECTION(programs, PROGRAMS)
3466DEFINE_OPT_SHOW_SECTION(stream_groups, STREAM_GROUPS)
3467
3468static const OptionDef real_options[] = {
3470 { "f", OPT_TYPE_FUNC, OPT_FUNC_ARG, {.func_arg = opt_format}, "force format", "format" },
3471 { "unit", OPT_TYPE_BOOL, 0, {&show_value_unit}, "show unit of the displayed values" },
3472 { "prefix", OPT_TYPE_BOOL, 0, {&use_value_prefix}, "use SI prefixes for the displayed values" },
3473 { "byte_binary_prefix", OPT_TYPE_BOOL, 0, {&use_byte_value_binary_prefix},
3474 "use binary prefixes for byte units" },
3475 { "sexagesimal", OPT_TYPE_BOOL, 0, {&use_value_sexagesimal_format},
3476 "use sexagesimal format HOURS:MM:SS.MICROSECONDS for time units" },
3477 { "pretty", OPT_TYPE_FUNC, 0, {.func_arg = opt_pretty},
3478 "prettify the format of displayed values, make it more human readable" },
3479 { "output_format", OPT_TYPE_STRING, 0, { &output_format },
3480 "set the output printing format (available formats are: default, compact, csv, flat, ini, json, xml)", "format" },
3481 { "print_format", OPT_TYPE_STRING, 0, { &output_format }, "alias for -output_format (deprecated)" },
3482 { "of", OPT_TYPE_STRING, 0, { &output_format }, "alias for -output_format", "format" },
3483 { "select_streams", OPT_TYPE_STRING, 0, { &stream_specifier }, "select the specified streams", "stream_specifier" },
3484 { "sections", OPT_TYPE_FUNC, OPT_EXIT, {.func_arg = opt_sections}, "print sections structure and section information, and exit" },
3485 { "data_dump_format", OPT_TYPE_STRING, 0, { &data_dump_format }, "set data dump format (available formats are: xxd, base64)" },
3486 { "show_data", OPT_TYPE_BOOL, 0, { &do_show_data }, "show packets data" },
3487 { "show_data_hash", OPT_TYPE_STRING, 0, { &show_data_hash }, "show packets data hash" },
3488 { "show_error", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_error }, "show probing error" },
3489 { "show_format", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_format }, "show format/container info" },
3490 { "show_frames", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_frames }, "show frames info" },
3491 { "show_entries", OPT_TYPE_FUNC, OPT_FUNC_ARG, {.func_arg = opt_show_entries},
3492 "show a set of specified entries", "entry_list" },
3493#if HAVE_THREADS
3494 { "show_log", OPT_TYPE_INT, 0, { &do_show_log }, "show log" },
3495#endif
3496 { "show_packets", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_packets }, "show packets info" },
3497 { "show_programs", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_programs }, "show programs info" },
3498 { "show_stream_groups", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_stream_groups }, "show stream groups info" },
3499 { "show_streams", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_streams }, "show streams info" },
3500 { "show_chapters", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_chapters }, "show chapters info" },
3501 { "count_frames", OPT_TYPE_BOOL, 0, { &do_count_frames }, "count the number of frames per stream" },
3502 { "count_packets", OPT_TYPE_BOOL, 0, { &do_count_packets }, "count the number of packets per stream" },
3503 { "show_program_version", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_program_version }, "show ffprobe version" },
3504 { "show_library_versions", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_library_versions }, "show library versions" },
3505 { "show_versions", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_versions }, "show program and library versions" },
3506 { "show_pixel_formats", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_pixel_formats }, "show pixel format descriptions" },
3507 { "show_optional_fields", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = &opt_show_optional_fields }, "show optional fields" },
3508 { "show_private_data", OPT_TYPE_BOOL, 0, { &show_private_data }, "show private data" },
3509 { "private", OPT_TYPE_BOOL, 0, { &show_private_data }, "same as show_private_data" },
3510 { "analyze_frames", OPT_TYPE_BOOL, 0, { &do_analyze_frames }, "analyze frames to provide additional stream-level information" },
3511 { "bitexact", OPT_TYPE_BOOL, 0, {&do_bitexact}, "force bitexact output" },
3512 { "read_intervals", OPT_TYPE_FUNC, OPT_FUNC_ARG, {.func_arg = opt_read_intervals}, "set read intervals", "read_intervals" },
3513 { "i", OPT_TYPE_FUNC, OPT_FUNC_ARG, {.func_arg = opt_input_file_i}, "read specified file", "input_file"},
3514 { "o", OPT_TYPE_FUNC, OPT_FUNC_ARG, {.func_arg = opt_output_file_o}, "write to specified output", "output_file"},
3515 { "print_filename", OPT_TYPE_FUNC, OPT_FUNC_ARG, {.func_arg = opt_print_filename}, "override the printed input filename", "print_file"},
3516 { "find_stream_info", OPT_TYPE_BOOL, OPT_INPUT | OPT_EXPERT, { &find_stream_info },
3517 "read and decode the streams to fill missing information with heuristics" },
3518 { "c", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = opt_codec}, "force decoder", "decoder_name" },
3519 { "codec", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = opt_codec}, "alias for -c (force decoder)", "decoder_name" },
3520 { NULL, },
3521};
3522
3523static inline int check_section_show_entries(int section_id, int require_explicit)
3524{
3525 const EntrySelection *selection = &selected_entries[section_id];
3526
3527 /* A shared stream section must not implicitly enable programs or groups. */
3528 if (section_id == SECTION_ID_PROGRAM_STREAMS ||
3529 section_id == SECTION_ID_STREAM_GROUP_STREAMS)
3530 require_explicit = 1;
3531
3532 if ((!require_explicit || selection->explicitly_selected) &&
3533 (selection->show_all_entries || selection->entries_to_show))
3534 return 1;
3535
3536 const AVTextFormatSection *section = &sections[section_id];
3537 for (const int *id = section->children_ids; *id != -1; id++)
3538 if (check_section_show_entries(*id, require_explicit))
3539 return 1;
3540 return 0;
3541}
3542
3543#define SET_DO_SHOW(id, varname) do { \
3544 if (check_section_show_entries(SECTION_ID_##id, 0)) \
3545 do_show_##varname = 1; \
3546 } while (0)
3547
3548int main(int argc, char **argv)
3549{
3550 const AVTextFormatter *f;
3551 AVTextFormatContext *tctx;
3552 AVTextWriterContext *wctx;
3553 char *buf;
3554 char *f_name = NULL, *f_args = NULL;
3555 int ret, input_ret;
3557
3558 init_dynload();
3559
3560 setvbuf(stderr, NULL, _IONBF, 0); /* win32 runtime needs this */
3561
3563
3565 parse_loglevel(argc, argv, options);
3567#if CONFIG_AVDEVICE
3569#endif
3570
3571 show_banner(argc, argv, options);
3572 ret = parse_options(NULL, argc, argv, options, opt_input_file);
3573 if (ret < 0) {
3574 ret = (ret == AVERROR_EXIT) ? 0 : ret;
3575 goto end;
3576 }
3577
3578 if (do_show_log)
3580
3581 /* mark things to show, based on -show_entries */
3582 SET_DO_SHOW(CHAPTERS, chapters);
3584 SET_DO_SHOW(FORMAT, format);
3585 SET_DO_SHOW(FRAMES, frames);
3586 SET_DO_SHOW(LIBRARY_VERSIONS, library_versions);
3587 SET_DO_SHOW(PACKETS, packets);
3588 SET_DO_SHOW(PIXEL_FORMATS, pixel_formats);
3589 SET_DO_SHOW(PIXEL_FORMAT_FLAGS, pixel_format_flags);
3590 SET_DO_SHOW(PIXEL_FORMAT_COMPONENTS, pixel_format_components);
3591 SET_DO_SHOW(PROGRAM_VERSION, program_version);
3592 SET_DO_SHOW(PROGRAMS, programs);
3593 SET_DO_SHOW(STREAM_GROUP_DISPOSITION, stream_group_disposition);
3594 SET_DO_SHOW(STREAM_GROUPS, stream_groups);
3595 SET_DO_SHOW(STREAM_GROUP_COMPONENTS, stream_group_components);
3596 SET_DO_SHOW(STREAMS, streams);
3597 SET_DO_SHOW(STREAM_DISPOSITION, stream_disposition);
3598 SET_DO_SHOW(PROGRAM_STREAM_DISPOSITION, stream_disposition);
3599 SET_DO_SHOW(STREAM_GROUP_STREAM_DISPOSITION, stream_disposition);
3600
3601 SET_DO_SHOW(CHAPTER_TAGS, chapter_tags);
3602 SET_DO_SHOW(FORMAT_TAGS, format_tags);
3603 SET_DO_SHOW(FRAME_TAGS, frame_tags);
3604 SET_DO_SHOW(PROGRAM_TAGS, program_tags);
3605 SET_DO_SHOW(STREAM_GROUP_TAGS, stream_group_tags);
3606 SET_DO_SHOW(STREAM_TAGS, stream_tags);
3607 SET_DO_SHOW(PROGRAM_STREAM_TAGS, stream_tags);
3608 SET_DO_SHOW(STREAM_GROUP_STREAM_TAGS, stream_tags);
3609 SET_DO_SHOW(PACKET_TAGS, packet_tags);
3610
3613 "-bitexact and -show_program_version or -show_library_versions "
3614 "options are incompatible\n");
3615 ret = AVERROR(EINVAL);
3616 goto end;
3617 }
3618
3619 if (!output_format)
3620 output_format = av_strdup("default");
3621 if (!output_format) {
3622 ret = AVERROR(ENOMEM);
3623 goto end;
3624 }
3625 f_name = av_strtok(output_format, "=", &buf);
3626 if (!f_name) {
3628 "No name specified for the output format\n");
3629 ret = AVERROR(EINVAL);
3630 goto end;
3631 }
3632 f_args = buf;
3633
3635 if (!f) {
3636 av_log(NULL, AV_LOG_ERROR, "Unknown output format with name '%s'\n", f_name);
3637 ret = AVERROR(EINVAL);
3638 goto end;
3639 }
3641 av_log(NULL, AV_LOG_ERROR, "Output format '%s' can only draw filter graphs\n", f_name);
3642 ret = AVERROR(EINVAL);
3643 goto end;
3644 }
3645
3646 if (data_dump_format) {
3647 if (!strcmp(data_dump_format, "xxd")) {
3648 data_dump_format_id = AV_TEXTFORMAT_DATADUMP_XXD;
3649 } else if (!strcmp(data_dump_format, "base64")) {
3650 data_dump_format_id = AV_TEXTFORMAT_DATADUMP_BASE64;
3651 } else {
3652 av_log(NULL, AV_LOG_ERROR, "Unknown data dump format with name '%s'\n", data_dump_format);
3653 ret = AVERROR(EINVAL);
3654 goto end;
3655 }
3656 }
3657
3658 if (output_filename) {
3660 } else
3661 ret = avtextwriter_create_stdout(&wctx);
3662
3663 if (ret < 0)
3664 goto end;
3665
3666 AVTextFormatOptions tf_options = {
3667 .is_key_selected = is_key_selected_callback,
3668 .show_optional_fields = show_optional_fields,
3669 .show_value_unit = show_value_unit,
3670 .use_value_prefix = use_value_prefix,
3671 .use_byte_value_binary_prefix = use_byte_value_binary_prefix,
3672 .use_value_sexagesimal_format = use_value_sexagesimal_format,
3673 .data_dump_format = data_dump_format_id,
3674 };
3675
3676 if ((ret = avtext_context_open(&tctx, f, wctx, f_args, sections, FF_ARRAY_ELEMS(sections), tf_options, show_data_hash)) >= 0) {
3677 if (f == &avtextformatter_xml)
3679
3681
3688
3689 if (!input_filename &&
3692 show_usage();
3693 av_log(NULL, AV_LOG_ERROR, "You have to specify one input file.\n");
3694 av_log(NULL, AV_LOG_ERROR, "Use -h to get full help or, even better, run 'man %s'.\n", program_name);
3695 ret = AVERROR(EINVAL);
3696 } else if (input_filename) {
3698 if (ret < 0 && do_show_error)
3699 show_error(tctx, ret);
3700 }
3701
3702 input_ret = ret;
3703
3705
3706 ret = avtextwriter_context_close(&wctx);
3707 if (ret < 0)
3708 av_log(NULL, AV_LOG_ERROR, "Writing output failed (closing writer): %s\n", av_err2str(ret));
3709
3710 ret = avtext_context_close(&tctx);
3711 if (ret < 0)
3712 av_log(NULL, AV_LOG_ERROR, "Writing output failed (closing formatter): %s\n", av_err2str(ret));
3713
3714 ret = FFMIN(ret, input_ret);
3715 }
3716
3717end:
3723
3724 uninit_opts();
3725 for (size_t i = 0; i < FF_ARRAY_ELEMS(selected_entries); ++i)
3726 av_dict_free(&selected_entries[i].entries_to_show);
3727
3729
3730 return ret < 0;
3731}
SwsAArch64OpImplParams params
Definition ops.c:51
static double val(void *priv, double ch)
Definition aeval.c:77
static const char *const format[]
Definition af_aiir.c:445
#define entry
static int frames
static AVDictionary * opts
int32_t
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition avassert.h:42
Libavcodec external API header.
Main libavdevice API header.
Main libavformat public API header.
@ AV_STREAM_GROUP_ENTRY_STREAM
Definition avformat.h:1172
@ AV_STREAM_GROUP_ENTRY_STREAM_GROUP
Definition avformat.h:1173
@ AV_STREAM_GROUP_PARAMS_DOLBY_VISION
Definition avformat.h:1164
@ AV_STREAM_GROUP_PARAMS_NONE
Definition avformat.h:1158
@ AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION
Definition avformat.h:1160
@ AV_STREAM_GROUP_PARAMS_TILE_GRID
Definition avformat.h:1161
@ AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT
Definition avformat.h:1159
@ AV_STREAM_GROUP_PARAMS_LCEVC
Definition avformat.h:1162
@ AV_STREAM_GROUP_PARAMS_GAIN_MAP
Definition avformat.h:1165
#define AVFMT_SHOW_IDS
Show format stream IDs numbers.
Definition avformat.h:498
const char * av_disposition_to_string(int disposition)
Definition options.c:660
int64_t avio_size(AVIOContext *s)
Get the filesize.
Definition aviobuf.c:326
int avtext_context_open(AVTextFormatContext **ptctx, const AVTextFormatter *formatter, AVTextWriterContext *writer_context, const char *args, const AVTextFormatSection *sections, int nb_sections, AVTextFormatOptions options, char *show_data_hash)
void avtext_print_data(AVTextFormatContext *tctx, const char *key, const uint8_t *data, int size)
int avtext_print_string(AVTextFormatContext *tctx, const char *key, const char *val, int flags)
int avtext_context_close(AVTextFormatContext **ptctx)
void avtext_print_data_hash(AVTextFormatContext *tctx, const char *key, const uint8_t *data, int size)
void avtext_print_section_header(AVTextFormatContext *tctx, const void *data, int section_id)
void avtext_print_section_footer(AVTextFormatContext *tctx)
const AVTextFormatter * avtext_get_formatter_by_name(const char *name)
int avtextwriter_context_close(AVTextWriterContext **pwctx)
AVTextFormatDataDump
@ AV_TEXTFORMAT_DATADUMP_BASE64
@ AV_TEXTFORMAT_DATADUMP_XXD
#define AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE
For these sections the element_name field is mandatory.
#define AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER
the section only contains other sections, but has no data at its own level
#define AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS
the section may contain a variable number of fields with variable keys.
@ AV_TEXTFORMAT_VALUE_FMT_BYTE
#define AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY
the section contains an array of elements of the same type
#define AV_TEXTFORMAT_FLAG_SUPPORTS_MIXED_ARRAY_CONTENT
#define AV_TEXTFORMAT_SECTION_FLAG_NUMBERING_BY_TYPE
the items in this array section should be numbered individually by type
#define AV_TEXTFORMAT_FLAG_IS_DIAGRAM_FORMATTER
const AVTextFormatter avtextformatter_xml
Definition tf_xml.c:202
int avtextwriter_create_stdout(AVTextWriterContext **pwctx)
Definition tw_stdout.c:71
int avtextwriter_create_file(AVTextWriterContext **pwctx, const char *output_filename)
Definition tw_avio.c:79
Convenience header that includes libavutil's core.
void av_bprintf(AVBPrint *buf, const char *fmt,...)
Definition bprint.c:121
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
Definition bprint.c:68
AVBPrint public header.
#define AV_BPRINT_SIZE_UNLIMITED
#define AV_BPRINT_SIZE_AUTOMATIC
static int FUNC metadata(CodedBitstreamContext *ctx, RWContext *rw, APVRawMetadata *current)
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define f(width, name)
Definition cbs_vp8.c:236
#define s(width, name)
Definition cbs_vp9.c:198
Public libavutil channel layout APIs header.
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:138
void init_dynload(void)
Initialize dynamic library loading.
Definition cmdutils.c:73
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:554
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:105
void log_callback_help(void *ptr, int level, const char *fmt, va_list vl)
Trivial log callback.
Definition cmdutils.c:68
AVDictionary * format_opts
Definition cmdutils.c:56
int parse_options(void *optctx, int argc, char **argv, const OptionDef *options, int(*parse_arg_function)(void *, const char *))
Parse the command line arguments.
Definition cmdutils.c:418
int filter_codec_opts(const AVDictionary *opts, enum AVCodecID codec_id, AVFormatContext *s, AVStream *st, const AVCodec *codec, AVDictionary **dst, AVDictionary **opts_used)
Filter out options for given codec.
Definition cmdutils.c:1424
AVDictionary * codec_opts
Definition cmdutils.c:56
void uninit_opts(void)
Uninitialize the cmdutils option system, in particular free the *_opts contexts and their contents.
Definition cmdutils.c:60
int setup_find_stream_info_opts(AVFormatContext *s, AVDictionary *local_codec_opts, AVDictionary ***dst)
Setup AVCodecContext options for avformat_find_stream_info().
Definition cmdutils.c:1492
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:82
const char program_name[]
program name, defined by the program for show_version().
Definition ffmpeg.c:89
#define OPT_FUNC_ARG
Definition cmdutils.h:205
#define OPT_INPUT
Definition cmdutils.h:237
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:472
@ OPT_TYPE_BOOL
Definition cmdutils.h:82
@ OPT_TYPE_STRING
Definition cmdutils.h:83
@ OPT_TYPE_INT
Definition cmdutils.h:84
@ OPT_TYPE_FUNC
Definition cmdutils.h:81
void show_banner(int argc, char **argv, const OptionDef *options)
Print the program banner to stderr.
Definition opt_common.c:240
#define OPT_EXPERT
Definition cmdutils.h:211
#define OPT_EXIT
Definition cmdutils.h:207
const int program_birth_year
program birth year, defined by the program for show_banner()
Definition ffmpeg.c:90
int avcodec_parameters_to_context(AVCodecContext *codec, const AVCodecParameters *par)
Definition codec_par.c:206
#define NULL
Definition coverity.c:32
long long int64_t
Definition coverity.c:34
static const AVColorPrimariesDesc color_primaries[AVCOL_PRI_NB]
Definition csp.c:76
__device__ int printf(const char *,...)
static AVFormatContext * fmt_ctx
static AVCodecContext * dec_ctx
#define AV_PROFILE_UNKNOWN
Definition defs.h:65
#define AV_LEVEL_UNKNOWN
Definition defs.h:223
@ AV_FIELD_TT
Top coded_first, top displayed first.
Definition defs.h:228
@ AV_FIELD_BB
Bottom coded first, bottom displayed first.
Definition defs.h:229
@ AV_FIELD_PROGRESSIVE
Definition defs.h:227
@ AV_FIELD_BT
Bottom coded first, top displayed first.
Definition defs.h:231
@ AV_FIELD_TB
Top coded first, bottom displayed first.
Definition defs.h:230
AVAudioServiceType
Definition defs.h:249
static AVPacket * pkt
static enum AVPixelFormat pix_fmt
static AVFrame * frame
Public dictionary API.
Display matrix.
DOVI configuration.
static av_always_inline AVDOVIColorMetadata * av_dovi_get_color(const AVDOVIMetadata *data)
Definition dovi_meta.h:375
static av_always_inline AVDOVIRpuDataHeader * av_dovi_get_header(const AVDOVIMetadata *data)
Definition dovi_meta.h:363
@ AV_DOVI_COMPRESSION_EXTENDED
Definition dovi_meta.h:71
@ AV_DOVI_COMPRESSION_LIMITED
Definition dovi_meta.h:69
@ AV_DOVI_COMPRESSION_NONE
Definition dovi_meta.h:68
@ AV_DOVI_COMPRESSION_RESERVED
Definition dovi_meta.h:70
@ AV_DOVI_MAPPING_MMR
Definition dovi_meta.h:109
@ AV_DOVI_MAPPING_POLYNOMIAL
Definition dovi_meta.h:108
@ AV_DOVI_NLQ_NONE
Definition dovi_meta.h:131
@ AV_DOVI_NLQ_LINEAR_DZ
Definition dovi_meta.h:132
static av_always_inline AVDOVIDataMapping * av_dovi_get_mapping(const AVDOVIMetadata *data)
Definition dovi_meta.h:369
int main
Definition dovi_rpuenc.c:38
audio downmix medatata
@ ALPHA
Definition drawutils.c:33
enum AVCodecID id
Definition dts2pts.c:607
static void comp(unsigned char *dst, ptrdiff_t dst_stride, unsigned char *src, ptrdiff_t src_stride, int add)
Definition eamad.c:79
channel
Use these values when setting the channel map with ebur128_set_channel().
Definition ebur128.h:39
const char * key
static int opt_format(void *optctx, const char *opt, const char *arg)
Definition ffplay.c:4579
static int find_stream_info
Definition ffplay.c:425
static int opt_codec(void *optctx, const char *opt, const char *arg)
Definition ffplay.c:4637
static int opt_input_file(void *optctx, const char *filename)
Definition ffplay.c:4620
static const char * video_codec_name
Definition ffplay.c:417
static const char * input_filename
Definition ffplay.c:378
static const char * audio_codec_name
Definition ffplay.c:415
static const char * subtitle_codec_name
Definition ffplay.c:416
static void show_usage(void)
Definition ffprobe.c:2957
static char * stream_specifier
Definition ffprobe.c:147
static void log_callback(void *ptr, int level, const char *fmt, va_list vl)
Definition ffprobe.c:419
#define print_list_fmt(k, f, n, m,...)
Definition ffprobe.c:475
static void print_pixel_format(AVTextFormatContext *tfc, enum AVPixelFormat pix_fmt)
Definition ffprobe.c:1302
SectionID
Definition ffprobe.c:166
@ SECTION_ID_STREAM_SIDE_DATA_COMPONENT_LIST
Definition ffprobe.c:250
@ SECTION_ID_FRAME_SIDE_DATA
Definition ffprobe.c:177
@ SECTION_ID_STREAM_GROUP_STREAM_GROUPS
Definition ffprobe.c:238
@ SECTION_ID_STREAM_TAGS
Definition ffprobe.c:247
@ SECTION_ID_STREAM_GROUP_PIECES
Definition ffprobe.c:226
@ SECTION_ID_PROGRAM_STREAM
Definition ffprobe.c:209
@ SECTION_ID_PACKET
Definition ffprobe.c:188
@ SECTION_ID_STREAM_GROUP_SUBPIECES
Definition ffprobe.c:228
@ SECTION_ID_PROGRAM_VERSION
Definition ffprobe.c:211
@ SECTION_ID_STREAM_GROUP_PIECE
Definition ffprobe.c:227
@ SECTION_ID_PACKET_SIDE_DATA_COMPONENT_LIST
Definition ffprobe.c:194
@ SECTION_ID_STREAM_GROUP_STREAM_TAGS
Definition ffprobe.c:214
@ SECTION_ID_STREAM_SIDE_DATA_COMPONENT
Definition ffprobe.c:251
@ SECTION_ID_PIXEL_FORMAT_FLAGS
Definition ffprobe.c:197
@ SECTION_ID_STREAM_GROUP_STREAM
Definition ffprobe.c:237
@ SECTION_ID_STREAM_GROUP_BLOCK
Definition ffprobe.c:231
@ SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION
Definition ffprobe.c:213
@ SECTION_ID_STREAM_GROUP_STREAM_SIDE_DATA
Definition ffprobe.c:216
@ SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST
Definition ffprobe.c:180
@ SECTION_ID_PROGRAM_TAGS
Definition ffprobe.c:210
@ SECTION_ID_PIXEL_FORMATS
Definition ffprobe.c:200
@ SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST
Definition ffprobe.c:182
@ SECTION_ID_STREAM_GROUP_SUBPIECE
Definition ffprobe.c:229
@ SECTION_ID_PROGRAM_STREAM_SIDE_DATA
Definition ffprobe.c:204
@ SECTION_ID_STREAM
Definition ffprobe.c:244
@ SECTION_ID_LIBRARY_VERSION
Definition ffprobe.c:186
@ SECTION_ID_STREAM_GROUP_SIDE_DATA_COMPONENT
Definition ffprobe.c:235
@ SECTION_ID_FRAMES
Definition ffprobe.c:174
@ SECTION_ID_STREAM_SIDE_DATA
Definition ffprobe.c:249
@ SECTION_ID_PROGRAM_STREAM_SIDE_DATA_COMPONENT_LIST
Definition ffprobe.c:205
@ SECTION_ID_PACKETS_AND_FRAMES
Definition ffprobe.c:191
@ SECTION_ID_STREAM_GROUP_STREAMS
Definition ffprobe.c:236
@ SECTION_ID_PACKET_SIDE_DATA_LIST
Definition ffprobe.c:192
@ SECTION_ID_PROGRAM_STREAM_DISPOSITION
Definition ffprobe.c:201
@ SECTION_ID_FRAME_SIDE_DATA_TIMECODE_LIST
Definition ffprobe.c:178
@ SECTION_ID_PROGRAM_STREAM_SIDE_DATA_LIST
Definition ffprobe.c:203
@ SECTION_ID_FRAME_SIDE_DATA_PIECE
Definition ffprobe.c:183
@ SECTION_ID_PACKETS
Definition ffprobe.c:190
@ SECTION_ID_FRAME_TAGS
Definition ffprobe.c:175
@ SECTION_ID_STREAM_GROUP_STREAM_GROUP_TAGS
Definition ffprobe.c:220
@ SECTION_ID_LIBRARY_VERSIONS
Definition ffprobe.c:187
@ SECTION_ID_STREAM_SIDE_DATA_LIST
Definition ffprobe.c:248
@ SECTION_ID_PROGRAMS
Definition ffprobe.c:212
@ SECTION_ID_STREAM_GROUP_SUBCOMPONENTS
Definition ffprobe.c:224
@ SECTION_ID_PROGRAM_STREAM_SIDE_DATA_COMPONENT
Definition ffprobe.c:206
@ SECTION_ID_PROGRAM_STREAM_TAGS
Definition ffprobe.c:202
@ SECTION_ID_STREAM_GROUP_STREAM_SIDE_DATA_COMPONENT
Definition ffprobe.c:218
@ SECTION_ID_FORMAT_TAGS
Definition ffprobe.c:172
@ SECTION_ID_CHAPTERS
Definition ffprobe.c:169
@ SECTION_ID_FRAME_SIDE_DATA_TIMECODE
Definition ffprobe.c:179
@ SECTION_ID_FRAME_LOGS
Definition ffprobe.c:185
@ SECTION_ID_STREAM_GROUP_TAGS
Definition ffprobe.c:241
@ SECTION_ID_PIXEL_FORMAT_COMPONENTS
Definition ffprobe.c:199
@ SECTION_ID_FORMAT
Definition ffprobe.c:171
@ SECTION_ID_STREAM_GROUP_COMPONENT
Definition ffprobe.c:223
@ SECTION_ID_PACKET_TAGS
Definition ffprobe.c:189
@ SECTION_ID_PIXEL_FORMAT_COMPONENT
Definition ffprobe.c:198
@ SECTION_ID_SUBTITLE
Definition ffprobe.c:252
@ SECTION_ID_STREAM_GROUP
Definition ffprobe.c:221
@ SECTION_ID_PIXEL_FORMAT
Definition ffprobe.c:196
@ SECTION_ID_FRAME_SIDE_DATA_LIST
Definition ffprobe.c:176
@ SECTION_ID_FRAME_SIDE_DATA_COMPONENT
Definition ffprobe.c:181
@ SECTION_ID_STREAMS
Definition ffprobe.c:246
@ SECTION_ID_CHAPTER_TAGS
Definition ffprobe.c:168
@ SECTION_ID_STREAM_GROUP_SUBCOMPONENT
Definition ffprobe.c:225
@ SECTION_ID_STREAM_GROUP_SIDE_DATA
Definition ffprobe.c:233
@ SECTION_ID_ERROR
Definition ffprobe.c:170
@ SECTION_ID_STREAM_GROUPS
Definition ffprobe.c:242
@ SECTION_ID_PACKET_SIDE_DATA_COMPONENT
Definition ffprobe.c:195
@ SECTION_ID_STREAM_GROUP_SIDE_DATA_LIST
Definition ffprobe.c:232
@ SECTION_ID_STREAM_GROUP_STREAM_GROUP
Definition ffprobe.c:239
@ SECTION_ID_FRAME_LOG
Definition ffprobe.c:184
@ SECTION_ID_STREAM_GROUP_STREAM_GROUP_DISPOSITION
Definition ffprobe.c:219
@ SECTION_ID_FRAME
Definition ffprobe.c:173
@ SECTION_ID_STREAM_GROUP_BLOCKS
Definition ffprobe.c:230
@ SECTION_ID_PACKET_SIDE_DATA
Definition ffprobe.c:193
@ SECTION_ID_STREAM_GROUP_SIDE_DATA_COMPONENT_LIST
Definition ffprobe.c:234
@ SECTION_ID_STREAM_DISPOSITION
Definition ffprobe.c:245
@ SECTION_ID_ROOT
Definition ffprobe.c:243
@ SECTION_ID_STREAM_GROUP_COMPONENTS
Definition ffprobe.c:222
@ SECTION_ID_STREAM_GROUP_DISPOSITION
Definition ffprobe.c:240
@ SECTION_ID_CHAPTER
Definition ffprobe.c:167
@ SECTION_ID_STREAM_GROUP_STREAM_SIDE_DATA_LIST
Definition ffprobe.c:215
@ SECTION_ID_PROGRAM_STREAMS
Definition ffprobe.c:208
@ SECTION_ID_PROGRAM
Definition ffprobe.c:207
@ SECTION_ID_STREAM_GROUP_STREAM_SIDE_DATA_COMPONENT_LIST
Definition ffprobe.c:217
static void ffprobe_show_program_version(AVTextFormatContext *tfc)
Definition ffprobe.c:2964
static void print_context_light_level(AVTextFormatContext *tfc, const AVContentLightMetadata *metadata)
Definition ffprobe.c:605
#define PKT_SIDE_DATA_IN_STREAM_GROUP
Definition ffprobe.c:1133
static void ffprobe_show_library_versions(AVTextFormatContext *tfc)
Definition ffprobe.c:2995
static void print_iamf_param_definition(AVTextFormatContext *tfc, const char *name, const AVIAMFParamDefinition *param, SectionID section_id)
Definition ffprobe.c:2280
static int use_byte_value_binary_prefix
Definition ffprobe.c:132
static int do_show_frame_tags
Definition ffprobe.c:124
#define CHECK_END
static int do_show_pixel_format_flags
Definition ffprobe.c:118
#define SHOW_LIB_VERSION(libname, LIBNAME)
Definition ffprobe.c:2980
static const OptionDef real_options[]
Definition ffprobe.c:3468
static ReadInterval * read_intervals
Definition ffprobe.c:159
static const char * print_input_filename
Definition ffprobe.c:382
#define print_ts(k, v)
Definition ffprobe.c:494
static int do_show_chapter_tags
Definition ffprobe.c:122
#define print_int(k, v)
Definition ffprobe.c:487
static char * show_data_hash
Definition ffprobe.c:148
static void print_color_trc(AVTextFormatContext *tfc, enum AVColorTransferCharacteristic color_trc)
Definition ffprobe.c:1357
static void print_stream_group_params(AVTextFormatContext *tfc, AVStreamGroup *stg)
Definition ffprobe.c:2463
static const char unit_byte_str[]
Definition ffprobe.c:387
static int do_show_stream_group_components
Definition ffprobe.c:110
static LogBuffer * log_buffer
Definition ffprobe.c:408
#define SHOW_OPTIONAL_FIELDS_AUTO
Definition ffprobe.c:141
#define print_int_opt(k, v)
Definition ffprobe.c:488
static int opt_format(void *optctx, const char *opt, const char *arg)
Definition ffprobe.c:3076
static void print_alpha_mode(AVTextFormatContext *tfc, enum AVAlphaMode alpha_mode)
Definition ffprobe.c:1377
static int show_value_unit
Definition ffprobe.c:130
static int opt_read_intervals(void *optctx, const char *opt, const char *arg)
Definition ffprobe.c:3367
static int * streams_with_closed_captions
Definition ffprobe.c:394
static const char * get_raw_string_type(const void *data)
Definition ffprobe.c:267
static void print_layered_video_params(AVTextFormatContext *tfc, const AVStreamGroup *stg, const AVStreamGroupLayeredVideo *layered_video)
Definition ffprobe.c:2453
#define GET_DECODER(type_)
static void print_color_range(AVTextFormatContext *tfc, enum AVColorRange color_range)
Definition ffprobe.c:1327
static void print_displaymatrix(AVTextFormatContext *tfc, const int32_t matrix[9])
Definition ffprobe.c:575
static void print_chroma_location(AVTextFormatContext *tfc, enum AVChromaLocation chroma_location)
Definition ffprobe.c:1367
static int opt_codec(void *optctx, const char *opt, const char *arg)
Definition ffprobe.c:3412
static int show_programs(AVTextFormatContext *tfc, InputFile *ifile)
Definition ffprobe.c:2239
static void show_error(AVTextFormatContext *tfc, int err)
Definition ffprobe.c:2664
static EntrySelection selected_entries[FF_ARRAY_ELEMS(sections)]
Definition ffprobe.c:376
static void print_color_space(AVTextFormatContext *tfc, enum AVColorSpace color_space)
Definition ffprobe.c:1337
static int do_show_frames
Definition ffprobe.c:106
static uint64_t * nb_streams_packets
Definition ffprobe.c:391
static void print_tile_grid_params(AVTextFormatContext *tfc, const AVStreamGroup *stg, const AVStreamGroupTileGrid *tile_grid)
Definition ffprobe.c:2257
static int do_show_program_tags
Definition ffprobe.c:125
static int do_show_format
Definition ffprobe.c:105
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:3237
static int show_stream_groups(AVTextFormatContext *tfc, InputFile *ifile)
Definition ffprobe.c:2591
static int show_stream_group(AVTextFormatContext *tfc, InputFile *ifile, AVStreamGroup *stg, int container)
Definition ffprobe.c:2481
static int read_interval_packets(AVTextFormatContext *tfc, InputFile *ifile, const ReadInterval *interval, int64_t *cur_ts)
Definition ffprobe.c:1778
static int do_show_packets
Definition ffprobe.c:107
static const char unit_hertz_str[]
Definition ffprobe.c:386
#define print_int_fmt(k, v, f, u)
Definition ffprobe.c:498
static int do_show_data
Definition ffprobe.c:114
static int show_tags(AVTextFormatContext *tfc, AVDictionary *tags, int section_id)
Definition ffprobe.c:533
static int opt_pretty(void *optctx, const char *opt, const char *arg)
Definition ffprobe.c:3372
static av_always_inline int process_frame(AVTextFormatContext *tfc, InputFile *ifile, AVFrame *frame, const AVPacket *pkt, int *packet_new)
Definition ffprobe.c:1681
#define print_str_validate(k, v)
Definition ffprobe.c:492
static const char * get_stream_group_type(const void *data)
Definition ffprobe.c:272
#define IN_STREAM_GROUP
Definition ffprobe.c:1950
static int do_count_packets
Definition ffprobe.c:100
static int opt_show_optional_fields(void *optctx, const char *opt, const char *arg)
Definition ffprobe.c:3059
static int show_stream(AVTextFormatContext *tfc, AVFormatContext *fmt_ctx, int stream_idx, InputStream *ist, int container)
Definition ffprobe.c:1952
static const AVInputFormat * iformat
Definition ffprobe.c:383
static const char unit_bit_per_second_str[]
Definition ffprobe.c:388
static const AVTextFormatSection sections[]
Definition ffprobe.c:278
static void print_dovi_metadata(AVTextFormatContext *tfc, const AVDOVIMetadata *dovi)
Definition ffprobe.c:612
#define print_str(k, v)
Definition ffprobe.c:490
static void show_frame(AVTextFormatContext *tfc, AVFrame *frame, AVStream *stream, AVFormatContext *fmt_ctx)
Definition ffprobe.c:1594
static void flush_buffers(InputFile *ifile)
Definition ffprobe.c:1901
static void print_iamf_submix_params(AVTextFormatContext *tfc, const AVIAMFSubmix *submix)
Definition ffprobe.c:2387
static void mark_section_show_entries(SectionID section_id, int show_all_entries, AVDictionary *entries, int explicitly_selected)
Definition ffprobe.c:3086
static void ffprobe_show_pixel_formats(AVTextFormatContext *tfc)
Definition ffprobe.c:3013
#define print_duration_ts(k, v)
Definition ffprobe.c:496
static void show_packet(AVTextFormatContext *tfc, InputFile *ifile, AVPacket *pkt, int packet_idx)
Definition ffprobe.c:1438
static char * data_dump_format
Definition ffprobe.c:149
static int do_count_frames
Definition ffprobe.c:99
static int show_format(AVTextFormatContext *tfc, InputFile *ifile)
Definition ffprobe.c:2633
static char * output_format
Definition ffprobe.c:146
static int do_show_error
Definition ffprobe.c:104
void show_help_default(const char *opt, const char *arg)
Per-fftool specific help handler.
Definition ffprobe.c:3221
#define print_str_opt(k, v)
Definition ffprobe.c:491
static uint64_t * nb_streams_frames
Definition ffprobe.c:392
static int read_packets(AVTextFormatContext *tfc, InputFile *ifile)
Definition ffprobe.c:1913
static void print_film_grain_params(AVTextFormatContext *tfc, const AVFilmGrainParams *fgp)
Definition ffprobe.c:1006
static void print_integers(AVTextFormatContext *tfc, const char *key, const void *data, int size, const char *format, int columns, int bytes, int offset_add)
Definition ffprobe.c:501
static int do_show_pixel_format_components
Definition ffprobe.c:119
#define PKT_SIDE_DATA_IN_STREAM
Definition ffprobe.c:1132
#define print_val(k, v, u)
Definition ffprobe.c:497
static int show_chapters(AVTextFormatContext *tfc, InputFile *ifile)
Definition ffprobe.c:2608
static int opt_input_file(void *optctx, const char *arg)
Definition ffprobe.c:3174
static int do_show_packet_tags
Definition ffprobe.c:128
#define PKT_SIDE_DATA_IN_STREAM_GROUP_STREAM
Definition ffprobe.c:1134
#define DEFINE_OPT_SHOW_SECTION(section, target_section_id)
Definition ffprobe.c:3449
static void print_mastering_display_metadata(AVTextFormatContext *tfc, const AVMasteringDisplayMetadata *metadata)
Definition ffprobe.c:584
static int read_intervals_nb
Definition ffprobe.c:160
static void log_read_interval(const ReadInterval *interval, void *log_ctx, int log_level)
Definition ffprobe.c:1754
static void print_primaries(AVTextFormatContext *tfc, enum AVColorPrimaries color_primaries)
Definition ffprobe.c:1347
static const char * get_packet_side_data_type(const void *data)
Definition ffprobe.c:255
#define SET_DO_SHOW(id, varname)
Definition ffprobe.c:3543
#define print_q(k, v, s)
Definition ffprobe.c:489
static void print_ambient_viewing_environment(AVTextFormatContext *tfc, const AVAmbientViewingEnvironment *env)
Definition ffprobe.c:995
static void print_iamf_audio_element_params(AVTextFormatContext *tfc, const AVStreamGroup *stg, const AVIAMFAudioElement *audio_element)
Definition ffprobe.c:2346
static int match_section(const char *section_name, int show_all_entries, AVDictionary *entries)
Definition ffprobe.c:3103
static int opt_show_entries(void *optctx, const char *opt, const char *arg)
Definition ffprobe.c:3124
static int do_show_stream_groups
Definition ffprobe.c:109
static int do_show_programs
Definition ffprobe.c:108
static void close_input_file(InputFile *ifile)
Definition ffprobe.c:2849
static void print_section(SectionID id, int level)
Definition ffprobe.c:3381
static const char * get_frame_side_data_type(const void *data)
Definition ffprobe.c:261
static int do_show_library_versions
Definition ffprobe.c:116
static const char * data_codec_name
Definition ffprobe.c:137
static const char * output_filename
Definition ffprobe.c:384
static int probe_file(AVTextFormatContext *tfc, const char *filename, const char *print_filename)
Definition ffprobe.c:2862
static void print_pkt_side_data(AVTextFormatContext *tfc, int width, int height, const AVPacketSideData *sd, int container)
Definition ffprobe.c:1137
static int do_show_stream_tags
Definition ffprobe.c:127
static const AVCodec * get_decoder_for_stream(AVFormatContext *fmt_ctx, AVStream *stream)
Definition ffprobe.c:2701
static int check_section_show_entries(int section_id, int require_explicit)
Definition ffprobe.c:3523
static int do_show_program_version
Definition ffprobe.c:115
static int do_read_packets
Definition ffprobe.c:102
static int opt_print_filename(void *optctx, const char *opt, const char *arg)
Definition ffprobe.c:3214
static int do_bitexact
Definition ffprobe.c:98
#define print_decibel(k, v)
Definition ffprobe.c:499
static int use_value_prefix
Definition ffprobe.c:131
static void print_dispositions(AVTextFormatContext *tfc, uint32_t disposition, SectionID section_id)
Definition ffprobe.c:1937
static int opt_input_file_i(void *optctx, const char *opt, const char *arg)
Definition ffprobe.c:3191
static int * selected_streams
Definition ffprobe.c:393
static int show_log(AVTextFormatContext *tfc, int section_ids, int section_id, int log_level)
Definition ffprobe.c:1403
#define print_duration_time(k, v, tb)
Definition ffprobe.c:495
static void print_dynamic_hdr_vivid(AVTextFormatContext *tfc, const AVDynamicHDRVivid *metadata)
Definition ffprobe.c:925
static int show_optional_fields
Definition ffprobe.c:144
static AVMutex log_mutex
Definition ffprobe.c:397
static int do_show_streams
Definition ffprobe.c:111
static int do_show_log
Definition ffprobe.c:120
static int do_show_chapters
Definition ffprobe.c:103
static int show_private_data
Definition ffprobe.c:134
#define PKT_SIDE_DATA_IN_PROGRAM_STREAM
Definition ffprobe.c:1135
static int do_show_stream_group_tags
Definition ffprobe.c:126
static void print_dynamic_hdr10_plus(AVTextFormatContext *tfc, const AVDynamicHDRPlus *metadata)
Definition ffprobe.c:774
static int opt_output_file_o(void *optctx, const char *opt, const char *arg)
Definition ffprobe.c:3197
static int do_show_stream_group_disposition
Definition ffprobe.c:113
static int do_show_pixel_formats
Definition ffprobe.c:117
static int do_analyze_frames
Definition ffprobe.c:97
static int do_show_stream_disposition
Definition ffprobe.c:112
static void print_frame_side_data(AVTextFormatContext *tfc, const AVFrame *frame, const AVStream *stream)
Definition ffprobe.c:1519
static int set_decoders(AVFormatContext *fmt_ctx)
Definition ffprobe.c:2686
static int log_buffer_size
Definition ffprobe.c:409
#define SHOW_OPTIONAL_FIELDS_ALWAYS
Definition ffprobe.c:143
static int open_input_file(InputFile *ifile, const char *filename, const char *print_filename)
Definition ffprobe.c:2731
#define print_time(k, v, tb)
Definition ffprobe.c:493
static int use_value_sexagesimal_format
Definition ffprobe.c:133
static int * streams_with_film_grain
Definition ffprobe.c:395
static int do_read_frames
Definition ffprobe.c:101
static void print_downmix_info(AVTextFormatContext *tfc, const AVDownmixInfo *downmix_info)
Definition ffprobe.c:551
static int opt_sections(void *optctx, const char *opt, const char *arg)
Definition ffprobe.c:3399
#define REALLOCZ_ARRAY_STREAM(ptr, cur_n, new_n)
Definition ffprobe.c:525
static void clear_log(int need_lock)
Definition ffprobe.c:1387
static int is_key_selected_callback(AVTextFormatContext *tctx, const char *key)
Definition ffprobe.c:411
static int show_program(AVTextFormatContext *tfc, InputFile *ifile, AVProgram *program)
Definition ffprobe.c:2208
#define IN_PROGRAM
Definition ffprobe.c:1949
static int parse_read_intervals(const char *intervals_spec)
Definition ffprobe.c:3319
#define PRINT_PIX_FMT_FLAG(flagname, name)
Definition ffprobe.c:3008
static void print_dynamic_hdr_smpte2094_app5(AVTextFormatContext *tfc, const AVDynamicHDRSmpte2094App5 *metadata)
Definition ffprobe.c:869
static int do_show_format_tags
Definition ffprobe.c:123
static int get_decoder_by_name(const char *codec_name, const AVCodec **codec)
Definition ffprobe.c:2672
static int opt_show_versions(void *optctx, const char *opt, const char *arg)
Definition ffprobe.c:3442
static unsigned int nb_streams
Definition ffprobe.c:390
#define print_fmt(k, f,...)
Definition ffprobe.c:469
static void print_iamf_mix_presentation_params(AVTextFormatContext *tfc, const AVStreamGroup *stg, const AVIAMFMixPresentation *mix_presentation)
Definition ffprobe.c:2434
static void show_subtitle(AVTextFormatContext *tfc, AVSubtitle *sub, AVStream *stream, AVFormatContext *fmt_ctx)
Definition ffprobe.c:1493
static int show_streams(AVTextFormatContext *tfc, InputFile *ifile)
Definition ffprobe.c:2191
#define SHOW_OPTIONAL_FIELDS_NEVER
Definition ffprobe.c:142
static void print_private_data(AVTextFormatContext *tfc, void *priv_data)
Definition ffprobe.c:1289
@ AV_FILM_GRAIN_PARAMS_H274
The union is valid when interpreted as AVFilmGrainH274Params (codec.h274)
@ AV_FILM_GRAIN_PARAMS_AV1
The union is valid when interpreted as AVFilmGrainAOMParams (codec.aom)
@ AV_FILM_GRAIN_PARAMS_NONE
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
Definition opt.h:355
#define AV_OPT_FLAG_EXPORT
The option is intended for exporting values to the caller.
Definition opt.h:362
@ AV_DOWNMIX_TYPE_LTRT
Lt/Rt 2-channel downmix, Dolby Surround compatible.
@ AV_DOWNMIX_TYPE_LORO
Lo/Ro 2-channel downmix (Stereo).
@ AV_DOWNMIX_TYPE_DPLII
Lt/Rt 2-channel downmix, Dolby Pro Logic II compatible.
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
Definition utils.c:557
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec.
Definition avcodec.c:145
const AVClass * avcodec_get_class(void)
Get the AVClass for AVCodecContext.
Definition options.c:188
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
Definition options.c:149
const char * avcodec_profile_name(enum AVCodecID codec_id, int profile)
Return a name for the specified profile, if available.
Definition utils.c:446
const AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
Definition allcodecs.c:996
const AVCodec * avcodec_find_decoder_by_name(const char *name)
Find a registered decoder with the specified name.
Definition allcodecs.c:1024
void avsubtitle_free(AVSubtitle *sub)
Free all allocated data in the given subtitle struct.
Definition avcodec.c:422
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:168
@ 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:618
int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
Alias for avcodec_receive_frame_flags(avctx, frame, 0).
Definition avcodec.c:721
int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt)
Supply raw packet data as input to a decoder.
Definition decode.c:734
int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, const AVPacket *avpkt)
Decode a subtitle message.
Definition decode.c:939
@ AVDISCARD_ALL
discard all
Definition defs.h:246
void avcodec_flush_buffers(AVCodecContext *avctx)
Reset the internal codec state / flush internal buffers.
Definition avcodec.c:390
const char * av_packet_side_data_name(enum AVPacketSideDataType type)
Definition packet.c:269
@ AV_PKT_DATA_STRINGS_METADATA
A list of zero terminated key/value strings.
Definition packet.h:169
@ AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT
Ambient viewing environment metadata, as defined by H.274.
Definition packet.h:327
@ AV_PKT_DATA_SKIP_SAMPLES
Recommends skipping the specified number of samples.
Definition packet.h:153
@ 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:212
@ AV_PKT_DATA_DYNAMIC_HDR10_PLUS
HDR10+ dynamic metadata associated with a video frame.
Definition packet.h:296
@ AV_PKT_DATA_GAIN_MAP_PARAMS
Parameters describing how to combine this gain map with its base image to form an alternate rendition...
Definition packet.h:391
@ AV_PKT_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata (based on SMPTE-2086:2014).
Definition packet.h:219
@ AV_PKT_DATA_AUDIO_SERVICE_TYPE
This side data should be associated with an audio stream and corresponds to enum AVAudioServiceType.
Definition packet.h:117
@ AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL
Data found in BlockAdditional element of matroska container.
Definition packet.h:188
@ AV_PKT_DATA_SPHERICAL
This side data should be associated with a video stream and corresponds to the AVSphericalMapping str...
Definition packet.h:225
@ AV_PKT_DATA_WEBVTT_SETTINGS
The optional settings (rendering instructions) that immediately follow the timestamp specifier of a W...
Definition packet.h:199
@ AV_PKT_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
Definition packet.h:105
@ 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:258
@ AV_PKT_DATA_EXIF
Extensible image file format metadata.
Definition packet.h:369
@ AV_PKT_DATA_CPB_PROPERTIES
This side data corresponds to the AVCPBProperties struct.
Definition packet.h:142
@ AV_PKT_DATA_STEREO3D
This side data should be associated with a video stream and contains Stereoscopic 3D information in f...
Definition packet.h:111
@ AV_PKT_DATA_WEBVTT_IDENTIFIER
The optional first identifier line of a WebVTT cue.
Definition packet.h:193
@ AV_PKT_DATA_FRAME_CROPPING
The number of pixels to discard from the top/bottom/left/right border of the decoded frame to obtain ...
Definition packet.h:340
@ AV_PKT_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
Definition packet.h:232
@ AV_PKT_DATA_DOVI_CONF
DOVI configuration ref: dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2....
Definition packet.h:280
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
Definition packet.c:74
#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:664
#define AV_PKT_FLAG_CORRUPT
The packet content is corrupted.
Definition packet.h:658
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition packet.c:435
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition packet.h:657
int av_packet_unpack_dictionary(const uint8_t *data, size_t size, AVDictionary **dict)
Unpack a dictionary from side_data.
Definition packet.c:355
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, size_t *size)
Get side information from packet.
Definition packet.c:252
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
Definition packet.c:63
FF_VISIBILITY_POP_HIDDEN av_cold void avdevice_register_all(void)
Initialize libavdevice and register all the input and output devices.
Definition alldevices.c:67
int avformat_network_deinit(void)
Undo the initialization done by avformat_network_init.
Definition utils.c:589
const char * avformat_stream_group_name(enum AVStreamGroupParamsType type)
Definition avformat.c:283
int avformat_network_init(void)
Do global initialization of network libraries.
Definition utils.c:577
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
Definition options.c:165
const AVClass * avformat_get_class(void)
Get the AVClass for AVFormatContext.
Definition options.c:193
const AVInputFormat * av_find_input_format(const char *short_name)
Find AVInputFormat based on the short name of the input format.
Definition format.c:146
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:667
int av_read_frame(AVFormatContext *s, AVPacket *pkt)
Return the next frame of a stream.
Definition demux.c:1611
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:231
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
Read packets of a media file to get stream information.
Definition demux.c:2639
void avformat_close_input(AVFormatContext **s)
Close an opened input AVFormatContext.
Definition demux.c:400
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:762
int av_mime_codec_str(const AVCodecParameters *par, AVRational frame_rate, struct AVBPrint *out)
Make a RFC 4281/6381 like string describing a codec for MIME types.
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:941
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:810
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.
@ AV_CHANNEL_ORDER_UNSPEC
Only the channel count is specified, without any further information about the channel order.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
Definition bprint.c:234
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
Append char c n times to a print buffer.
Definition bprint.c:129
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
Definition bprint.c:226
AVBufferRef * av_buffer_allocz(size_t size)
Same as av_buffer_alloc(), except the returned buffer will be initialized to zero.
Definition buffer.c:94
#define AV_DICT_MULTIKEY
Allow to store several equal keys in the dictionary.
Definition dict.h:84
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
Definition dict.c:233
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:60
const AVDictionaryEntry * av_dict_iterate(const AVDictionary *m, const AVDictionaryEntry *prev)
Iterate over a dictionary.
Definition dict.c:42
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
Definition dict.c:247
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
Definition dict.c:86
#define AV_DICT_DONT_OVERWRITE
Don't overwrite existing entries.
Definition dict.h:81
#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
#define AV_DICT_MATCH_CASE
Only get an entry with exact-case key match.
Definition dict.h:74
#define AVERROR_EXIT
Immediate exit was requested; the called function should not be restarted.
Definition error.h:58
#define AVERROR_EOF
End of file.
Definition error.h:57
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
Definition error.h:122
#define AVERROR(e)
Definition error.h:45
#define AVERROR_OPTION_NOT_FOUND
Option not found.
Definition error.h:63
#define AV_FRAME_FLAG_INTERLACED
A flag to mark frames whose content is interlaced.
Definition frame.h:702
#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:707
#define AV_FRAME_FLAG_LOSSLESS
A decoder can use this flag to mark frames which were originally encoded losslessly.
Definition frame.h:715
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
Definition frame.h:694
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition frame.c:64
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition frame.c:52
const char * av_frame_side_data_name(enum AVFrameSideDataType type)
Definition side_data.c:77
@ AV_FRAME_DATA_GOP_TIMECODE
The GOP timecode in 25 bit timecode format.
Definition frame.h:125
@ AV_FRAME_DATA_EXIF
Exchangeable image file format metadata.
Definition frame.h:263
@ AV_FRAME_DATA_DOVI_METADATA
Parsed Dolby Vision metadata, suitable for passing to a software implementation.
Definition frame.h:208
@ AV_FRAME_DATA_VIEW_ID
This side data must be associated with a video frame.
Definition frame.h:245
@ AV_FRAME_DATA_DYNAMIC_HDR_VIVID
HDR Vivid dynamic metadata associated with a video frame.
Definition frame.h:215
@ AV_FRAME_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
Definition frame.h:137
@ AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT
Ambient viewing environment metadata, as defined by H.274.
Definition frame.h:220
@ AV_FRAME_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
Definition frame.h:85
@ AV_FRAME_DATA_A53_CC
ATSC A53 Part 4 Closed Captions.
Definition frame.h:59
@ AV_FRAME_DATA_DYNAMIC_HDR_PLUS
HDR dynamic metadata associated with a video frame.
Definition frame.h:159
@ AV_FRAME_DATA_IAMF_RECON_GAIN_INFO_PARAM
IAMF Recon Gain Info Parameter Data associated with the audio frame.
Definition frame.h:294
@ AV_FRAME_DATA_IAMF_MIX_GAIN_PARAM
IAMF Mix Gain Parameter Data associated with the audio frame.
Definition frame.h:278
@ AV_FRAME_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata associated with a video frame.
Definition frame.h:120
@ AV_FRAME_DATA_DOWNMIX_INFO
Metadata relevant to a downmix procedure.
Definition frame.h:73
@ AV_FRAME_DATA_DYNAMIC_HDR_SMPTE_2094_APP5
HDR dynamic metadata associated with a video frame.
Definition frame.h:270
@ AV_FRAME_DATA_FILM_GRAIN_PARAMS
Film grain parameters for a frame, described by AVFilmGrainParams.
Definition frame.h:188
@ 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
@ 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
@ AV_FRAME_DATA_S12M_TIMECODE
Timecode which conforms to SMPTE ST 12-1.
Definition frame.h:152
@ AV_FRAME_DATA_IAMF_DEMIXING_INFO_PARAM
IAMF Demixing Info Parameter Data associated with the audio frame.
Definition frame.h:286
@ AV_IAMF_AMBISONICS_MODE_PROJECTION
Definition iamf.h:274
@ AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE
Definition iamf.h:349
@ AV_IAMF_AUDIO_ELEMENT_TYPE_CHANNEL
Definition iamf.h:348
static av_always_inline void * av_iamf_param_definition_get_subblock(const AVIAMFParamDefinition *par, unsigned int idx)
Get the subblock at the specified idx.
Definition iamf.h:260
@ AV_IAMF_PARAMETER_DEFINITION_RECON_GAIN
Subblocks are of struct type AVIAMFReconGain.
Definition iamf.h:181
@ AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN
Subblocks are of struct type AVIAMFMixGain.
Definition iamf.h:173
@ AV_IAMF_PARAMETER_DEFINITION_DEMIXING
Subblocks are of struct type AVIAMFDemixingInfo.
Definition iamf.h:177
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition log.h:231
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition log.h:216
#define AV_LOG_VERBOSE
Detailed information.
Definition log.h:226
#define AV_LOG_INFO
Standard information.
Definition log.h:221
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
void av_log_set_callback(void(*callback)(void *, int, const char *, va_list))
Set the logging callback.
Definition log.c:491
void av_log_default_callback(void *ptr, int level, const char *fmt, va_list vl)
Default logging callback.
Definition log.c:379
#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:400
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:361
void av_log_set_flags(int arg)
Definition log.c:481
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
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
Definition mem.c:318
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
static void * av_x_if_null(const void *p, const void *x)
Return x default pointer in case p is NULL.
Definition avutil.h:311
#define av_fourcc2str(fourcc)
Definition avutil.h:323
@ AVMEDIA_TYPE_AUDIO
Definition avutil.h:201
@ AVMEDIA_TYPE_SUBTITLE
Definition avutil.h:203
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
Definition avutil.h:202
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
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:52
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:179
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
Definition avstring.c:208
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
#define AV_UTF8_FLAG_EXCLUDE_XML_INVALID_CONTROL_CODES
exclude control codes not accepted by XML
Definition avstring.h:374
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition avutil.h:247
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
Definition avutil.h:263
double av_display_rotation_get(const int32_t matrix[9])
Extract the rotation component of the transformation matrix.
Definition display.c:34
const char * av_spherical_projection_name(enum AVSphericalProjection projection)
Provide a human-readable name of a given AVSphericalProjection.
Definition spherical.c:69
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:41
@ AV_SPHERICAL_EQUIRECTANGULAR_TILE
Video represents a portion of a sphere mapped on a flat surface using equirectangular projection.
Definition spherical.h:68
@ AV_SPHERICAL_CUBEMAP
Video frame is split into 6 faces of a cube, and arranged on a 3x2 layout.
Definition spherical.h:61
const char * av_stereo3d_view_name(unsigned int view)
Provide a human-readable name of a given stereo3d view.
Definition stereo3d.c:113
const char * av_stereo3d_type_name(unsigned int type)
Provide a human-readable name of a given stereo3d type.
Definition stereo3d.c:93
#define AV_STEREO3D_FLAG_INVERT
Inverted views, Right/Bottom represents the left view.
Definition stereo3d.h:194
const char * av_stereo3d_primary_eye_name(unsigned int eye)
Provide a human-readable name of a given stereo3d primary eye.
Definition stereo3d.c:133
int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
Definition opt.c:1291
const AVOption * av_opt_next(const void *obj, const AVOption *last)
Iterate over all AVOptions belonging to obj.
Definition opt.c:47
int a
#define r
Definition input.c:42
#define b
Definition input.c:43
#define AV_RN32(p)
#define AV_RL8(x)
#define AV_RL32(p)
#define AV_RB64(p)
#define AV_RN16(p)
unsigned offset
Definition libaomenc.c:763
static int mix(int c0, int c1)
Definition 4xm.c:717
#define us(width, name, range_min, range_max, subs,...)
Definition cbs_apv.c:70
#define PLANAR
Definition flacdsp.c:28
const char * arg
Definition jacosubdec.c:65
Libavcodec version macros.
Libavdevice version macros.
Libavfilter version macros.
Libavformat version macros.
#define av_always_inline
Definition attributes.h:72
Immersive Audio Model and Formats API header.
Stereoscopic video.
#define AV_MUTEX_INITIALIZER
Definition thread.h:185
static int ff_mutex_unlock(AVMutex *mutex)
Definition thread.h:189
static int ff_mutex_lock(AVMutex *mutex)
Definition thread.h:188
#define AVMutex
Definition thread.h:184
Libswresample version macros.
swscale version macros
AVClassCategory
Definition log.h:28
#define FFMIN(a, b)
Definition macros.h:49
uint64_t layout
void * av_calloc(size_t nmemb, size_t size)
Definition mem.c:370
Memory handling functions.
uint32_t tag
Definition movenc.c:2128
const char data[16]
Definition mxf.c:149
int profile
Definition mxfenc.c:2299
category
Definition openal-dec.c:249
#define av_strdup(s)
Definition ops_static.c:55
AVOptions.
#define CMDUTILS_COMMON_OPTIONS
Definition opt_common.h:199
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:592
misc parsing utilities
const AVPixFmtDescriptor * av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
Iterate over all pixel format descriptors known to libavutil.
Definition pixdesc.c:3491
const char * av_color_space_name(enum AVColorSpace space)
Definition pixdesc.c:3884
const char * av_color_range_name(enum AVColorRange range)
Definition pixdesc.c:3800
const char * av_alpha_mode_name(enum AVAlphaMode mode)
Definition pixdesc.c:3949
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:3436
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:3404
const char * av_chroma_location_name(enum AVChromaLocation location)
Definition pixdesc.c:3905
const char * av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
Definition pixdesc.c:3851
const char * av_color_primaries_name(enum AVColorPrimaries primaries)
Definition pixdesc.c:3818
enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
Utility function to swap the endianness of a pixel format.
Definition pixdesc.c:3539
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
Definition pixdesc.h:136
AVChromaLocation
Location of chroma samples.
Definition pixfmt.h:807
@ AVCHROMA_LOC_UNSPECIFIED
Definition pixfmt.h:808
AVColorRange
Visual content value range.
Definition pixfmt.h:753
@ AVCOL_RANGE_UNSPECIFIED
Definition pixfmt.h:754
AVAlphaMode
Correlation between the alpha channel and color values.
Definition pixfmt.h:821
@ AVALPHA_MODE_UNSPECIFIED
Unknown alpha handling, or no alpha channel.
Definition pixfmt.h:822
AVPixelFormat
Pixel format.
Definition pixfmt.h:71
@ AV_PIX_FMT_NONE
Definition pixfmt.h:72
AVColorPrimaries
Chromaticity coordinates of the source primaries.
Definition pixfmt.h:647
@ AVCOL_PRI_UNSPECIFIED
Definition pixfmt.h:650
AVColorTransferCharacteristic
Color Transfer Characteristic.
Definition pixfmt.h:677
@ AVCOL_TRC_UNSPECIFIED
Definition pixfmt.h:680
AVColorSpace
YUV colorspace type.
Definition pixfmt.h:711
@ AVCOL_SPC_UNSPECIFIED
Definition pixfmt.h:714
const char * name
Definition qsvenc.c:142
#define FF_ARRAY_ELEMS(a)
Spherical video.
Ambient viewing environment metadata as defined by H.274.
AVRational ambient_illuminance
Environmental illuminance of the ambient viewing environment in lux.
AVRational ambient_light_x
Normalized x chromaticity coordinate of the environmental ambient light in the nominal viewing enviro...
AVRational ambient_light_y
Normalized y chromaticity coordinate of the environmental ambient light in the nominal viewing enviro...
This structure describes the bitrate properties of an encoded bitstream.
Definition defs.h:296
int64_t avg_bitrate
Average bitrate of the stream, in bits per second.
Definition defs.h:311
int64_t max_bitrate
Maximum bitrate of the stream, in bits per second.
Definition defs.h:301
int64_t buffer_size
The size of the buffer to which the ratecontrol is applied, in bits.
Definition defs.h:317
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:326
int64_t min_bitrate
Minimum bitrate of the stream, in bits per second.
Definition defs.h:306
enum AVChannelOrder order
Channel order used in this layout.
int nb_channels
Number of channels in this layout.
int64_t id
unique ID to identify the chapter
Definition avformat.h:1360
int64_t start
Definition avformat.h:1362
AVDictionary * metadata
Definition avformat.h:1363
int64_t end
chapter start/end time in time_base units
Definition avformat.h:1362
AVRational time_base
time base in which the start/end timestamps are specified
Definition avformat.h:1361
Describe the class of an AVClass context structure.
Definition log.h:76
AVClassCategory(* get_category)(void *ctx)
Callback to return the instance category.
Definition log.h:140
AVClassCategory category
Category used for visualization (like color).
Definition log.h:133
int parent_log_context_offset
Offset in the structure where a pointer to the parent context for logging is stored.
Definition log.h:124
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:87
main external API structure.
Definition avcodec.h:443
AVRational pkt_timebase
Timebase in which pkt_dts/pts and AVPacket.dts/pts are expressed.
Definition avcodec.h:554
This struct describes the properties of a single codec described by an AVCodecID.
Definition codec_desc.h:38
const char * long_name
A more descriptive name for this codec.
Definition codec_desc.h:50
const char * name
Name of the codec described by this descriptor.
Definition codec_desc.h:46
This struct describes the properties of an encoded stream.
Definition codec_par.h:49
enum AVColorSpace color_space
Definition codec_par.h:192
int extradata_size
Size of the extradata content in bytes.
Definition codec_par.h:75
enum AVFieldOrder field_order
The order of the fields in interlaced video.
Definition codec_par.h:182
int height
The height of the video frame in pixels.
Definition codec_par.h:150
int nb_coded_side_data
Amount of entries in coded_side_data.
Definition codec_par.h:88
AVChannelLayout ch_layout
The channel layout and number of channels.
Definition codec_par.h:207
int width
The width of the video frame in pixels.
Definition codec_par.h:143
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
Definition codec_par.h:99
enum AVMediaType codec_type
General type of the encoded data.
Definition codec_par.h:53
int profile
Codec-specific bitstream restrictions that the stream conforms to.
Definition codec_par.h:135
int video_delay
Number of delayed frames.
Definition codec_par.h:200
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
Definition codec_par.h:61
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
Definition codec_par.h:71
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition codec_par.h:57
enum AVColorPrimaries color_primaries
Definition codec_par.h:190
int sample_rate
The number of audio samples per second.
Definition codec_par.h:213
enum AVColorTransferCharacteristic color_trc
Definition codec_par.h:191
int initial_padding
Number of padding audio samples at the start.
Definition codec_par.h:239
AVPacketSideData * coded_side_data
Additional data associated with the entire stream.
Definition codec_par.h:83
enum AVChromaLocation chroma_location
Definition codec_par.h:193
enum AVColorRange color_range
Additional colorspace characteristics.
Definition codec_par.h:189
AVCodec.
Definition codec.h:175
int depth
Number of bits in the component.
Definition pixdesc.h:57
Content light level needed by to transmit HDR over HDMI (CTA-861.3).
Dolby Vision RPU colorspace metadata parameters.
Definition dovi_meta.h:171
Dolby Vision RPU data mapping parameters.
Definition dovi_meta.h:152
uint32_t num_x_partitions
Definition dovi_meta.h:160
AVDOVINLQParams nlq[3]
Definition dovi_meta.h:162
uint8_t mapping_color_space
Definition dovi_meta.h:154
uint8_t mapping_chroma_format_idc
Definition dovi_meta.h:155
AVDOVIReshapingCurve curves[3]
Definition dovi_meta.h:156
enum AVDOVINLQMethod nlq_method_idc
Definition dovi_meta.h:159
uint32_t num_y_partitions
Definition dovi_meta.h:161
Combined struct representing a combination of header, mapping and color metadata, for attaching to fr...
Definition dovi_meta.h:345
Coefficients of the non-linear inverse quantization.
Definition dovi_meta.h:139
uint64_t linear_deadzone_slope
Definition dovi_meta.h:143
uint64_t linear_deadzone_threshold
Definition dovi_meta.h:144
uint16_t nlq_offset
Definition dovi_meta.h:140
uint64_t vdr_in_max
Definition dovi_meta.h:141
uint8_t poly_order[AV_DOVI_MAX_PIECES]
Definition dovi_meta.h:122
enum AVDOVIMappingMethod mapping_idc[AV_DOVI_MAX_PIECES]
Definition dovi_meta.h:120
int64_t mmr_constant[AV_DOVI_MAX_PIECES]
Definition dovi_meta.h:126
int64_t mmr_coef[AV_DOVI_MAX_PIECES][3][7]
Definition dovi_meta.h:127
int64_t poly_coef[AV_DOVI_MAX_PIECES][3]
Definition dovi_meta.h:123
uint16_t pivots[AV_DOVI_MAX_PIECES+1]
Definition dovi_meta.h:119
uint8_t mmr_order[AV_DOVI_MAX_PIECES]
Definition dovi_meta.h:125
Dolby Vision RPU data header.
Definition dovi_meta.h:87
uint8_t vdr_rpu_profile
Definition dovi_meta.h:90
uint8_t spatial_resampling_filter_flag
Definition dovi_meta.h:100
uint8_t vdr_bit_depth
Definition dovi_meta.h:99
uint8_t el_spatial_resampling_filter_flag
Definition dovi_meta.h:101
uint8_t bl_video_full_range_flag
Definition dovi_meta.h:96
uint16_t rpu_format
Definition dovi_meta.h:89
uint8_t disable_residual_flag
Definition dovi_meta.h:102
uint8_t vdr_rpu_normalized_idc
Definition dovi_meta.h:95
uint8_t coef_log2_denom
Definition dovi_meta.h:94
uint8_t chroma_resampling_explicit_filter_flag
Definition dovi_meta.h:92
uint8_t coef_data_type
Definition dovi_meta.h:93
uint8_t vdr_rpu_level
Definition dovi_meta.h:91
char * key
Definition dict.h:91
char * value
Definition dict.h:92
This structure describes optional metadata relevant to a downmix procedure.
double lfe_mix_level
Absolute scale factor representing the level at which the LFE data is mixed into L/R channels during ...
double surround_mix_level_ltrt
Absolute scale factor representing the nominal level of the surround channels during an Lt/Rt compati...
double surround_mix_level
Absolute scale factor representing the nominal level of the surround channels during a regular downmi...
double center_mix_level
Absolute scale factor representing the nominal level of the center channel during a regular downmix.
enum AVDownmixType preferred_downmix_type
Type of downmix preferred by the mastering engineer.
double center_mix_level_ltrt
Absolute scale factor representing the nominal level of the center channel during an Lt/Rt compatible...
This struct represents dynamic metadata for color volume transform - application 4 of SMPTE 2094-40:2...
This struct represents dynamic metadata for color volume transform as specified in the SMPTE 2094-50 ...
This struct represents dynamic metadata for color volume transform - CUVA 005.1:2021 standard.
This structure describes how to handle film grain synthesis for AOM codecs.
int chroma_scaling_from_luma
Signals whether to derive the chroma scaling function from the luma.
int limit_output_range
Signals to clip to limited color levels after film grain application.
int scaling_shift
Specifies the shift applied to the chroma components.
int grain_scale_shift
Signals the down shift applied to the generated gaussian numbers during synthesis.
int num_uv_points[2]
If chroma_scaling_from_luma is set to 0, signals the chroma scaling function parameters.
int overlap_flag
Signals whether to overlap film grain blocks.
int ar_coeff_lag
Specifies the auto-regression lag.
int uv_offset[2]
Offset used for component scaling function.
int ar_coeff_shift
Specifies the range of the auto-regressive coefficients.
uint8_t uv_points[2][10][2]
int8_t ar_coeffs_uv[2][25]
Chroma auto-regression coefficients.
int uv_mult[2]
Specifies the luma/chroma multipliers for the index to the component scaling function.
int8_t ar_coeffs_y[24]
Luma auto-regression coefficients.
int num_y_points
Number of points, and the scale and value for each point of the piecewise linear scaling function for...
This structure describes how to handle film grain synthesis for codecs using the ITU-T H....
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...
int blending_mode_id
Specifies the blending mode used to blend the simulated film grain with the decoded images.
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...
int log2_scale_factor
Specifies a scale factor used in the film grain characterization equations.
int16_t comp_model_value[3][256][6]
Specifies the model values for the component for each intensity interval.
int model_id
Specifies the film grain simulation mode.
int component_model_present[3]
Indicates if the modelling of film grain for a given component is present.
uint16_t num_intensity_intervals[3]
Specifies the number of intensity intervals for which a specific set of model values has been estimat...
uint8_t num_model_values[3]
Specifies the number of model values present for each intensity interval in which the film grain has ...
This structure describes how to handle film grain synthesis in video for specific codecs.
enum AVColorPrimaries color_primaries
AVFilmGrainAOMParams aom
AVFilmGrainH274Params h274
enum AVColorRange color_range
Intended video signal characteristics.
int subsampling_x
Intended subsampling ratio, or 0 for luma-only streams.
int bit_depth_luma
Intended bit depth, or 0 for unknown/unspecified.
union AVFilmGrainParams::@177057277273004265167152242113040056044005264354 codec
Additional fields may be added both here and in any structure included.
enum AVFilmGrainParamsType type
Specifies the codec for which this structure is valid.
int width
Intended display resolution.
uint64_t seed
Seed to use for the synthesis process, if the codec allows for it.
enum AVColorTransferCharacteristic color_trc
enum AVColorSpace color_space
Format I/O context.
Definition avformat.h:1400
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
Definition avformat.h:1456
AVStream ** streams
A list of all streams in the file.
Definition avformat.h:1468
Structure to hold side data for an AVFrame.
Definition frame.h:334
enum AVFrameSideDataType type
Definition frame.h:335
AVDictionary * metadata
Definition frame.h:338
size_t size
Definition frame.h:337
uint8_t * data
Definition frame.h:336
This structure describes decoded (raw) audio or video data.
Definition frame.h:479
Parameters describing how to combine a gain map rendition with its base rendition to recover the alte...
Definition gain_map.h:39
AVRational alternate_hdr_headroom
Definition gain_map.h:57
struct AVGainMapParams::AVGainMapChannel channels[3]
int version
The version of this gain map struct.
Definition gain_map.h:44
int nb_channels
Must be 1 or 3.
Definition gain_map.h:83
int use_base_color_space
If non-zero, the gain map is applied in the colour space of the base rendition; otherwise in that of ...
Definition gain_map.h:50
AVRational base_hdr_headroom
log2 of the display headroom at which the base rendition is shown unmodified, and at which the map is...
Definition gain_map.h:56
Color transform parameters at a processing window in a dynamic metadata for SMPTE 2094-40.
HDR Vivid three spline params.
AVRational enable_strength
3Spline_enable_Strength of three Spline.
AVRational th_delta1
3Spline_TH_Delta1 of three Spline.
int th_mode
The mode of three Spline.
AVRational th_delta2
3Spline_TH_Delta2 of three Spline.
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....
AVRational th_enable
3Spline_TH_enable of three Spline.
Color tone mapping parameters at a processing window in a dynamic metadata for CUVA 005....
int three_Spline_enable_flag
indicates 3Spline_enable_flag in the base parameter, This flag indicates that transfer three Spline o...
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...
AVRational base_param_m_m
base_param_m_m in the base parameter, in multiples of 1.0/10.
AVRational base_param_m_p
base_param_m_p in the base parameter, in multiples of 1.0/16383.
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...
AVRational base_param_m_b
base_param_m_b in the base parameter, in multiples of 1/1023.
AVRational base_param_m_a
base_param_m_a in the base parameter, in multiples of 1.0/1023.
AVRational base_param_Delta
base_param_Delta in the base parameter, in multiples of 1.0/127.
int three_Spline_num
The number of three Spline.
AVRational base_param_m_n
base_param_m_n in the base parameter, in multiples of 1.0/10.
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...
AVRational targeted_system_display_maximum_luminance
The nominal maximum display luminance of the targeted system display, in multiples of 1....
int base_enable_flag
This flag indicates that transfer the base parameter(for value of 1)
int base_param_Delta_enable_mode
This flag indicates that delta mode of base parameter(for value of 1)
Color transform parameters at a processing window in a dynamic metadata for CUVA 005....
Information on how to combine one or more audio streams, as defined in section 3.6 of IAMF.
Definition iamf.h:359
enum AVIAMFAudioElementType audio_element_type
Audio element type as defined in section 3.6 of IAMF.
Definition iamf.h:391
AVIAMFParamDefinition * recon_gain_info
Recon gain information used to reconstruct a scalable channel audio representation.
Definition iamf.h:386
unsigned int default_w
Default weight value as defined in section 3.6 of IAMF.
Definition iamf.h:396
AVIAMFParamDefinition * demixing_info
Demixing information used to reconstruct a scalable channel audio representation.
Definition iamf.h:379
AVIAMFLayer ** layers
Definition iamf.h:362
unsigned int nb_layers
Number of layers, or channel groups, in the Audio Element.
Definition iamf.h:371
Demixing Info Parameter Data as defined in section 3.8.2 of IAMF.
Definition iamf.h:128
unsigned int dmixp_mode
Pre-defined combination of demixing parameters.
Definition iamf.h:140
unsigned int subblock_duration
Duration for the given subblock, in units of 1 / parameter_rate.
Definition iamf.h:136
A layer defining a Channel Layout in the Audio Element.
Definition iamf.h:294
unsigned int output_gain_flags
Output gain channel flags as defined in section 3.6.2 of IAMF.
Definition iamf.h:310
enum AVIAMFAmbisonicsMode ambisonics_mode
Ambisonics mode as defined in section 3.6.3 of IAMF.
Definition iamf.h:328
unsigned int nb_demixing_matrix
The length of the Demixing matrix array.
Definition iamf.h:343
AVRational * demixing_matrix
Demixing matrix as defined in section 3.6.3 of IAMF.
Definition iamf.h:336
AVChannelLayout ch_layout
Definition iamf.h:297
AVRational output_gain
Output gain as defined in section 3.6.2 of IAMF.
Definition iamf.h:316
Mix Gain Parameter Data as defined in section 3.8.1 of IAMF.
Definition iamf.h:77
Information on how to render and mix one or more AVIAMFAudioElement to generate the final audio outpu...
Definition iamf.h:616
unsigned int nb_submixes
Number of submixes in the presentation.
Definition iamf.h:632
AVDictionary * annotations
A dictionary of strings describing the mix in different languages.
Definition iamf.h:644
AVIAMFSubmix ** submixes
Array of submixes.
Definition iamf.h:625
Parameters as defined in section 3.6.1 of IAMF.
Definition iamf.h:193
unsigned int parameter_rate
Sample rate for the parameter substream.
Definition iamf.h:222
unsigned int duration
The accumulated duration of all blocks in this parameter definition, in units of 1 / parameter_rate.
Definition iamf.h:231
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:238
unsigned int parameter_id
Identifier for the parameter substream.
Definition iamf.h:218
enum AVIAMFParamDefinitionType type
Parameters type.
Definition iamf.h:213
unsigned int nb_subblocks
Number of subblocks in the array.
Definition iamf.h:208
Recon Gain Info Parameter Data as defined in section 3.8.3 of IAMF.
Definition iamf.h:148
unsigned int subblock_duration
Duration for the given subblock, in units of 1 / parameter_rate.
Definition iamf.h:156
Submix element as defined in section 3.7 of IAMF.
Definition iamf.h:449
AVIAMFParamDefinition * element_mix_config
Information required required for applying any processing to the referenced and rendered Audio Elemen...
Definition iamf.h:464
unsigned int audio_element_id
The id of the Audio Element this submix element references.
Definition iamf.h:455
AVDictionary * annotations
A dictionary of strings describing the submix in different languages.
Definition iamf.h:493
enum AVIAMFHeadphonesMode headphones_rendering_mode
A value that indicates whether the referenced channel-based Audio Element shall be rendered to stereo...
Definition iamf.h:481
AVRational default_mix_gain
Default mix gain value to apply when there are no AVIAMFParamDefinition with element_mix_config's par...
Definition iamf.h:472
Submix layout as defined in section 3.7.6 of IAMF.
Definition iamf.h:517
Submix layout as defined in section 3.7 of IAMF.
Definition iamf.h:559
AVRational default_mix_gain
Default mix gain value to apply when there are no AVIAMFParamDefinition with output_mix_config's para...
Definition iamf.h:606
unsigned int nb_elements
Number of elements in the submix.
Definition iamf.h:575
AVIAMFSubmixElement ** elements
Array of submix elements.
Definition iamf.h:568
AVIAMFSubmixLayout ** layouts
Array of submix layouts.
Definition iamf.h:583
AVIAMFParamDefinition * output_mix_config
Information required for post-processing the mixed audio signal to generate the audio signal for play...
Definition iamf.h:598
unsigned int nb_layouts
Number of layouts in the submix.
Definition iamf.h:590
Mastering display metadata capable of representing the color volume of the display used to master the...
AVOption.
Definition opt.h:428
const char * name
Definition opt.h:429
int flags
A combination of AV_OPT_FLAG_*.
Definition opt.h:471
This structure stores auxiliary information for decoding, presenting, or otherwise processing the cod...
Definition packet.h:431
uint8_t * data
Definition packet.h:432
enum AVPacketSideDataType type
Definition packet.h:434
This structure stores compressed data.
Definition packet.h:587
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition pixdesc.h:69
const char * name
Definition pixdesc.h:70
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
Definition pixdesc.h:105
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
Definition pixdesc.h:80
uint64_t flags
Combination of AV_PIX_FMT_FLAG_... flags.
Definition pixdesc.h:94
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition pixdesc.h:89
uint8_t nb_components
The number of components each pixel has, (1-4)
Definition pixdesc.h:71
New fields can be added to the end with minor version bumps.
Definition avformat.h:1324
int pmt_pid
Definition avformat.h:1333
unsigned int nb_stream_indexes
Definition avformat.h:1329
int program_num
Definition avformat.h:1332
unsigned int * stream_index
Definition avformat.h:1328
int pcr_pid
Definition avformat.h:1334
AVDictionary * metadata
Definition avformat.h:1330
Rational number (pair of numerator and denominator).
Definition rational.h:58
int num
Numerator.
Definition rational.h:59
int den
Denominator.
Definition rational.h:60
This structure describes how to handle spherical videos, outlining information about projection,...
Definition spherical.h:100
enum AVSphericalProjection projection
Projection type.
Definition spherical.h:104
int32_t pitch
Rotation around the right vector [-90, 90].
Definition spherical.h:145
int32_t roll
Rotation around the forward vector [-180, 180].
Definition spherical.h:146
int32_t yaw
Rotation around the up vector [-180, 180].
Definition spherical.h:144
uint32_t padding
Number of pixels to pad from the edge of each cube face.
Definition spherical.h:200
Stereo 3D type: this structure describes how two videos are packed within a single video surface,...
Definition stereo3d.h:203
enum AVStereo3DType type
How views are packed within the video.
Definition stereo3d.h:207
uint32_t baseline
The distance between the centres of the lenses of the camera system, in micrometers.
Definition stereo3d.h:228
AVRational horizontal_disparity_adjustment
Relative shift of the left and right images, which changes the zero parallax plane.
Definition stereo3d.h:234
enum AVStereo3DPrimaryEye primary_eye
Which eye is the primary eye when rendering in 2D.
Definition stereo3d.h:222
int flags
Additional information about the frame packing.
Definition stereo3d.h:212
AVRational horizontal_field_of_view
Horizontal field of view, in degrees.
Definition stereo3d.h:239
enum AVStereo3DView view
Determines which views are packed.
Definition stereo3d.h:217
AVStream * stream
Definition avformat.h:1179
AVStreamGroupLayeredVideo is meant to define the relation between a base layer video stream and a sep...
Definition avformat.h:1104
int height
Height of the final image for presentation.
Definition avformat.h:1129
unsigned int el_index
Index of the enhancement layer stream in AVStreamGroup.
Definition avformat.h:1113
int width
Width of the final stream for presentation.
Definition avformat.h:1125
AVStreamGroupTileGrid holds information on how to combine several independent images on a single canv...
Definition avformat.h:975
int width
Width of the final image for presentation.
Definition avformat.h:1060
int height
Height of the final image for presentation.
Definition avformat.h:1070
int coded_width
Width of the canvas.
Definition avformat.h:990
struct AVStreamGroupTileGrid::@036353327352337314037001273105074056331305251354 * offsets
An nb_tiles sized array of offsets in pixels from the topleft edge of the canvas, indicating where ea...
unsigned int nb_tiles
Amount of tiles in the grid.
Definition avformat.h:983
int horizontal_offset
Offset in pixels from the left edge of the canvas where the actual image meant for presentation start...
Definition avformat.h:1042
int horizontal
Offset in pixels from the left edge of the canvas where the tile should be placed.
Definition avformat.h:1019
unsigned int idx
Index of the stream in the group this tile references.
Definition avformat.h:1014
int vertical_offset
Offset in pixels from the top edge of the canvas where the actual image meant for presentation starts...
Definition avformat.h:1049
int coded_height
Width of the canvas.
Definition avformat.h:996
int vertical
Offset in pixels from the top edge of the canvas where the tile should be placed.
Definition avformat.h:1024
unsigned int nb_entries
Number of elements in AVStreamGroup.entries.
Definition avformat.h:1285
enum AVStreamGroupParamsType type
Group type.
Definition avformat.h:1211
struct AVIAMFMixPresentation * iamf_mix_presentation
Definition avformat.h:1218
AVStreamGroupEntry ** entries
A list of streams or child groups in the group.
Definition avformat.h:1298
struct AVStreamGroupTileGrid * tile_grid
Definition avformat.h:1219
int nb_coded_side_data
Amount of entries in coded_side_data.
Definition avformat.h:1311
AVDictionary * metadata
Metadata that applies to the whole group.
Definition avformat.h:1239
unsigned int index
Group index in AVFormatContext.
Definition avformat.h:1195
union AVStreamGroup::@313244315204024013007202273061153315146016101155 params
Group type-specific parameters.
struct AVIAMFAudioElement * iamf_audio_element
Definition avformat.h:1217
int disposition
Stream group disposition - a combination of AV_DISPOSITION_* flags.
Definition avformat.h:1277
int64_t id
Group type-specific group ID.
Definition avformat.h:1203
AVPacketSideData * coded_side_data
Additional data associated with the group.
Definition avformat.h:1306
struct AVStreamGroupLayeredVideo * layered_video
Definition avformat.h:1220
Stream structure.
Definition avformat.h:768
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition avformat.h:791
int64_t nb_frames
number of frames in this stream if known or 0
Definition avformat.h:829
enum AVDiscard discard
Selects which packets can be discarded at will and do not need to be demuxed.
Definition avformat.h:839
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition avformat.h:827
AVDictionary * metadata
Definition avformat.h:848
int id
Format-specific stream ID.
Definition avformat.h:780
int index
stream index in AVFormatContext
Definition avformat.h:774
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
Definition avformat.h:817
AVRational avg_frame_rate
Average framerate.
Definition avformat.h:857
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
Definition avformat.h:807
AVRational r_frame_rate
Real base framerate of the stream.
Definition avformat.h:902
int disposition
Stream disposition - a combination of AV_DISPOSITION_* flags.
Definition avformat.h:837
uint16_t format
Definition avcodec.h:2103
uint32_t start_display_time
Definition avcodec.h:2104
uint32_t end_display_time
Definition avcodec.h:2105
unsigned num_rects
Definition avcodec.h:2106
int64_t pts
Same as packet pts, in AV_TIME_BASE.
Definition avcodec.h:2108
const AVTextFormatSection * section[SECTION_MAX_NB_LEVELS]
section per each level
int level
current level, starting from 0
unsigned int string_validation_utf8_flags
const AVTextFormatter * formatter
the AVTextFormatter of which this is an instance
const char * name
const int children_ids[SECTION_MAX_NB_CHILDREN+1]
list of children section IDS, terminated by -1
const char * unique_name
unique section name, in case the name is ambiguous
int id
unique id identifying a section
int flags
a combination or AV_TEXTFORMAT__FLAG_*
AVDictionary * entries_to_show
Definition ffprobe.c:373
int show_all_entries
Definition ffprobe.c:371
int explicitly_selected
Selected by unique name or through a selected parent.
Definition ffprobe.c:372
int64_t pkt_pos
Definition ffplay.c:184
int pkt_size
Definition ffprobe.c:78
InputStream ** streams
Definition ffmpeg.h:530
AVFormatContext * fmt_ctx
Definition ffprobe.c:88
int nb_streams
Definition ffmpeg.h:531
AVCodecContext * dec_ctx
Definition ffprobe.c:84
AVStream * st
Definition ffmpeg.h:476
char * context_name
Definition ffprobe.c:400
AVClassCategory parent_category
Definition ffprobe.c:405
AVClassCategory category
Definition ffprobe.c:403
char * log_message
Definition ffprobe.c:402
char * parent_name
Definition ffprobe.c:404
int log_level
Definition ffprobe.c:401
Definition cms.c:66
int64_t end
start, end in second/AV_TIME_BASE units
Definition ffprobe.c:153
int duration_frames
Definition ffprobe.c:156
int64_t start
Definition ffprobe.c:153
int has_start
Definition ffprobe.c:154
int end_is_offset
Definition ffprobe.c:155
int id
identifier
Definition ffprobe.c:152
int start_is_offset
Definition ffprobe.c:155
uint8_t level
Definition svq3.c:208
libswresample public header
external API header
#define av_free(p)
#define av_malloc_array(a, b)
#define av_freep(p)
#define av_log(a,...)
static void error(const char *err)
static void ERROR(const char *str)
Definition audio_fifo.c:58
int num
Definition error.c:23
#define height
Definition dsp.h:99
#define width
Definition dsp.h:99
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:131
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:147
Timecode helpers header.
#define AV_TIMECODE_STR_SIZE
Definition timecode.h:33
timestamp utils, mostly useful for debugging/logging purposes
#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
static int64_t pts
int size
color_range
static enum AVPixelFormat pixel_formats[]
Definition vf_sr.c:64
static double c[64]