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"
46#include "libavutil/iamf.h"
49#include "libavutil/dovi_meta.h"
50#include "libavutil/mem.h"
51#include "libavutil/opt.h"
52#include "libavutil/pixdesc.h"
53#include "libavutil/spherical.h"
54#include "libavutil/stereo3d.h"
55#include "libavutil/dict.h"
57#include "libavutil/libm.h"
59#include "libavutil/timecode.h"
60#include "libavutil/timestamp.h"
62#include "libavdevice/version.h"
63#include "libswscale/swscale.h"
64#include "libswscale/version.h"
67#include "libavfilter/version.h"
69#include "cmdutils.h"
70#include "opt_common.h"
71
72#include "libavutil/thread.h"
73
74// attached as opaque_ref to packets/frames
75typedef struct FrameData {
78} FrameData;
79
80typedef struct InputStream {
81 AVStream *st;
82
85
86typedef struct InputFile {
88
90 int nb_streams;
91} InputFile;
92
93const char program_name[] = "ffprobe";
94const int program_birth_year = 2007;
95
96static int do_analyze_frames = 0;
97static int do_bitexact = 0;
98static int do_count_frames = 0;
99static int do_count_packets = 0;
100static int do_read_frames = 0;
101static int do_read_packets = 0;
102static int do_show_chapters = 0;
103static int do_show_error = 0;
104static int do_show_format = 0;
105static int do_show_frames = 0;
106static int do_show_packets = 0;
107static int do_show_programs = 0;
110static int do_show_streams = 0;
113static int do_show_data = 0;
119static int do_show_log = 0;
120
121static int do_show_chapter_tags = 0;
122static int do_show_format_tags = 0;
123static int do_show_frame_tags = 0;
124static int do_show_program_tags = 0;
126static int do_show_stream_tags = 0;
127static int do_show_packet_tags = 0;
128
129static int show_value_unit = 0;
130static int use_value_prefix = 0;
133static int show_private_data = 1;
134
135static const char *audio_codec_name = NULL;
136static const char *data_codec_name = NULL;
137static const char *subtitle_codec_name = NULL;
138static const char *video_codec_name = NULL;
139
140#define SHOW_OPTIONAL_FIELDS_AUTO -1
141#define SHOW_OPTIONAL_FIELDS_NEVER 0
142#define SHOW_OPTIONAL_FIELDS_ALWAYS 1
144
145static char *output_format;
146static char *stream_specifier;
147static char *show_data_hash;
148static char *data_dump_format;
149
150typedef struct ReadInterval {
151 int id; ///< identifier
152 int64_t start, end; ///< start, end in second/AV_TIME_BASE units
157
159static int read_intervals_nb = 0;
160
161static int find_stream_info = 1;
162
163/* section structure definition */
164
165typedef enum {
234} SectionID;
235
236static const char *get_packet_side_data_type(const void *data)
237{
238 const AVPacketSideData *sd = (const AVPacketSideData *)data;
239 return av_x_if_null(av_packet_side_data_name(sd->type), "unknown");
240}
241
242static const char *get_frame_side_data_type(const void *data)
243{
244 const AVFrameSideData *sd = (const AVFrameSideData *)data;
245 return av_x_if_null(av_frame_side_data_name(sd->type), "unknown");
246}
247
248static const char *get_raw_string_type(const void *data)
249{
250 return data;
251}
252
253static const char *get_stream_group_type(const void *data)
254{
255 const AVStreamGroup *stg = (const AVStreamGroup *)data;
256 return av_x_if_null(avformat_stream_group_name(stg->type), "unknown");
257}
258
262 [SECTION_ID_CHAPTER_TAGS] = { SECTION_ID_CHAPTER_TAGS, "tags", AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "chapter_tags" },
263 [SECTION_ID_ERROR] = { SECTION_ID_ERROR, "error", 0, { -1 } },
264 [SECTION_ID_FORMAT] = { SECTION_ID_FORMAT, "format", 0, { SECTION_ID_FORMAT_TAGS, -1 } },
265 [SECTION_ID_FORMAT_TAGS] = { SECTION_ID_FORMAT_TAGS, "tags", AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "format_tags" },
268 [SECTION_ID_FRAME_TAGS] = { SECTION_ID_FRAME_TAGS, "tags", AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "frame_tags" },
269 [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" },
273 [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" },
275 [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" },
276 [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 },
278 [SECTION_ID_FRAME_LOG] = { SECTION_ID_FRAME_LOG, "log", 0, { -1 }, },
280 [SECTION_ID_LIBRARY_VERSION] = { SECTION_ID_LIBRARY_VERSION, "library_version", 0, { -1 } },
284 [SECTION_ID_PACKET_TAGS] = { SECTION_ID_PACKET_TAGS, "tags", AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "packet_tags" },
285 [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" },
286 [SECTION_ID_PACKET_SIDE_DATA] = { SECTION_ID_PACKET_SIDE_DATA, "side_data", AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS|AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE, { -1 }, .unique_name = "packet_side_data", .element_name = "side_datum", .get_type = get_packet_side_data_type },
289 [SECTION_ID_PIXEL_FORMAT_FLAGS] = { SECTION_ID_PIXEL_FORMAT_FLAGS, "flags", 0, { -1 }, .unique_name = "pixel_format_flags" },
292 [SECTION_ID_PROGRAM_STREAM_DISPOSITION] = { SECTION_ID_PROGRAM_STREAM_DISPOSITION, "disposition", 0, { -1 }, .unique_name = "program_stream_disposition" },
293 [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" },
297 [SECTION_ID_PROGRAM_TAGS] = { SECTION_ID_PROGRAM_TAGS, "tags", AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "program_tags" },
298 [SECTION_ID_PROGRAM_VERSION] = { SECTION_ID_PROGRAM_VERSION, "program_version", 0, { -1 } },
300 [SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION] = { SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION, "disposition", 0, { -1 }, .unique_name = "stream_group_stream_disposition" },
301 [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" },
303 [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" },
307 [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" },
313 [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" },
314 [SECTION_ID_STREAM_GROUP_SIDE_DATA] = { SECTION_ID_STREAM_GROUP_SIDE_DATA, "side_data", AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE|AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .unique_name = "stream_group_side_data", .element_name = "side_datum", .get_type = get_packet_side_data_type },
317 [SECTION_ID_STREAM_GROUP_DISPOSITION] = { SECTION_ID_STREAM_GROUP_DISPOSITION, "disposition", 0, { -1 }, .unique_name = "stream_group_disposition" },
318 [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" },
326 [SECTION_ID_STREAM_DISPOSITION] = { SECTION_ID_STREAM_DISPOSITION, "disposition", 0, { -1 }, .unique_name = "stream_disposition" },
327 [SECTION_ID_STREAM_TAGS] = { SECTION_ID_STREAM_TAGS, "tags", AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "stream_tags" },
328 [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" },
329 [SECTION_ID_STREAM_SIDE_DATA] = { SECTION_ID_STREAM_SIDE_DATA, "side_data", AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE|AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .unique_name = "stream_side_data", .element_name = "side_datum", .get_type = get_packet_side_data_type },
330 [SECTION_ID_SUBTITLE] = { SECTION_ID_SUBTITLE, "subtitle", 0, { -1 } },
331};
332
337
339
340static const OptionDef *options;
341
342/* FFprobe context */
343static const char *input_filename;
344static const char *print_input_filename;
345static const AVInputFormat *iformat = NULL;
346static const char *output_filename = NULL;
347
348static const char unit_hertz_str[] = "Hz" ;
349static const char unit_byte_str[] = "byte" ;
350static const char unit_bit_per_second_str[] = "bit/s";
351
352static unsigned int nb_streams;
353static uint64_t *nb_streams_packets;
354static uint64_t *nb_streams_frames;
358
360
369
372
374{
375 const AVTextFormatSection *section = tctx->section[tctx->level];
376 const EntrySelection *selection = &selected_entries[section - sections];
377
378 return selection->show_all_entries || av_dict_get(selection->entries_to_show, key, NULL, 0);
379}
380
381static void log_callback(void *ptr, int level, const char *fmt, va_list vl)
382{
383 AVClass* avc = ptr ? *(AVClass **) ptr : NULL;
384 va_list vl2;
385 char line[1024];
386 static int print_prefix = 1;
387 void *new_log_buffer;
388
389 va_copy(vl2, vl);
390 av_log_default_callback(ptr, level, fmt, vl);
391 av_log_format_line(ptr, level, fmt, vl2, line, sizeof(line), &print_prefix);
392 va_end(vl2);
393
394#if HAVE_THREADS
396
397 new_log_buffer = av_realloc_array(log_buffer, log_buffer_size + 1, sizeof(*log_buffer));
398 if (new_log_buffer) {
399 char *msg;
400 int i;
401
402 log_buffer = new_log_buffer;
404 log_buffer[log_buffer_size].context_name= avc ? av_strdup(avc->item_name(ptr)) : NULL;
405 if (avc) {
406 if (avc->get_category) log_buffer[log_buffer_size].category = avc->get_category(ptr);
407 else log_buffer[log_buffer_size].category = avc->category;
408 }
409 log_buffer[log_buffer_size].log_level = level;
410 msg = log_buffer[log_buffer_size].log_message = av_strdup(line);
411 for (i=strlen(msg) - 1; i>=0 && msg[i] == '\n'; i--) {
412 msg[i] = 0;
413 }
414 if (avc && avc->parent_log_context_offset) {
415 AVClass** parent = *(AVClass ***) (((uint8_t *) ptr) +
417 if (parent && *parent) {
418 log_buffer[log_buffer_size].parent_name = av_strdup((*parent)->item_name(parent));
419 log_buffer[log_buffer_size].parent_category =
420 (*parent)->get_category ? (*parent)->get_category(parent) :(*parent)->category;
421 }
422 }
424 }
425
427#endif
428}
429
430
431#define print_fmt(k, f, ...) do { \
432 av_bprint_clear(&pbuf); \
433 av_bprintf(&pbuf, f, __VA_ARGS__); \
434 avtext_print_string(tfc, k, pbuf.str, 0); \
435} while (0)
436
437#define print_list_fmt(k, f, n, m, ...) do { \
438 av_bprint_clear(&pbuf); \
439 for (unsigned int idx = 0; idx < n; idx++) { \
440 for (unsigned int idx2 = 0; idx2 < m; idx2++) { \
441 if (idx > 0 || idx2 > 0) \
442 av_bprint_chars(&pbuf, ' ', 1); \
443 av_bprintf(&pbuf, f, __VA_ARGS__); \
444 } \
445 } \
446 avtext_print_string(tfc, k, pbuf.str, 0); \
447} while (0)
448
449#define print_int(k, v) avtext_print_integer(tfc, k, v, 0)
450#define print_q(k, v, s) avtext_print_rational(tfc, k, v, s)
451#define print_str(k, v) avtext_print_string(tfc, k, v, 0)
452#define print_str_opt(k, v) avtext_print_string(tfc, k, v, AV_TEXTFORMAT_PRINT_STRING_OPTIONAL)
453#define print_str_validate(k, v) avtext_print_string(tfc, k, v, AV_TEXTFORMAT_PRINT_STRING_VALIDATE)
454#define print_time(k, v, tb) avtext_print_time(tfc, k, v, tb, 0)
455#define print_ts(k, v) avtext_print_ts(tfc, k, v, 0)
456#define print_duration_time(k, v, tb) avtext_print_time(tfc, k, v, tb, 1)
457#define print_duration_ts(k, v) avtext_print_ts(tfc, k, v, 1)
458#define print_val(k, v, u) avtext_print_unit_integer(tfc, k, v, AV_TEXTFORMAT_VALUE_FMT_INT, u)
459#define print_int_fmt(k, v, f, u) avtext_print_unit_integer(tfc, k, v, f, u)
460#define print_decibel(k, v) avtext_print_unit_double(tfc, k, v, AV_TEXTFORMAT_VALUE_FMT_DECIBEL, 0)
461
462static void print_integers(AVTextFormatContext *tfc, const char *key,
463 const void *data, int size, const char *format,
464 int columns, int bytes, int offset_add)
465{
466 AVBPrint bp;
467 unsigned offset = 0;
468
470 av_bprint_chars(&bp, '\n', 1);
471 while (size) {
472 av_bprintf(&bp, "%08x: ", offset);
473 for (int i = 0, l = FFMIN(size, columns); i < l; i++) {
474 if (bytes == 1) av_bprintf(&bp, format, *(const uint8_t*)data);
475 else if (bytes == 2) av_bprintf(&bp, format, AV_RN16(data));
476 else if (bytes == 4) av_bprintf(&bp, format, AV_RN32(data));
477 data = (const char*)data + bytes;
478 size--;
479 }
480 av_bprint_chars(&bp, '\n', 1);
481 offset += offset_add;
482 }
483 avtext_print_string(tfc, key, bp.str, 0);
484}
485
486#define REALLOCZ_ARRAY_STREAM(ptr, cur_n, new_n) \
487{ \
488 ret = av_reallocp_array(&(ptr), (new_n), sizeof(*(ptr))); \
489 if (ret < 0) \
490 goto end; \
491 memset( (ptr) + (cur_n), 0, ((new_n) - (cur_n)) * sizeof(*(ptr)) ); \
492}
493
494static inline int show_tags(AVTextFormatContext *tfc, AVDictionary *tags, int section_id)
495{
496 const AVDictionaryEntry *tag = NULL;
497 int ret = 0;
498
499 if (!tags)
500 return 0;
501 avtext_print_section_header(tfc, NULL, section_id);
502
503 while ((tag = av_dict_iterate(tags, tag))) {
504 if ((ret = print_str_validate(tag->key, tag->value)) < 0)
505 break;
506 }
508
509 return ret;
510}
511
513 const AVDownmixInfo *downmix_info)
514{
515 switch (downmix_info->preferred_downmix_type) {
517 print_str("preferred_downmix_type", "loro");
518 break;
520 print_str("preferred_downmix_type", "ltrt");
521 break;
523 print_str("preferred_downmix_type", "dplII");
524 break;
525 default:
526 print_str("preferred_downmix_type", "unknown");
527 break;
528 }
529 print_decibel("center_mix_level_db", downmix_info->center_mix_level);
530 print_decibel("center_mix_level_ltrt_db", downmix_info->center_mix_level_ltrt);
531 print_decibel("surround_mix_level_db", downmix_info->surround_mix_level);
532 print_decibel("surround_mix_level_ltrt_db", downmix_info->surround_mix_level_ltrt);
533 print_decibel("lfe_mix_level_db", downmix_info->lfe_mix_level);
534}
535
537{
538 double rotation = av_display_rotation_get(matrix);
539 if (isnan(rotation))
540 rotation = 0;
541 print_integers(tfc, "displaymatrix", matrix, 9, " %11d", 3, 4, 1);
542 print_int("rotation", rotation);
543}
544
547{
548 if (metadata->has_primaries) {
549 print_q("red_x", metadata->display_primaries[0][0], '/');
550 print_q("red_y", metadata->display_primaries[0][1], '/');
551 print_q("green_x", metadata->display_primaries[1][0], '/');
552 print_q("green_y", metadata->display_primaries[1][1], '/');
553 print_q("blue_x", metadata->display_primaries[2][0], '/');
554 print_q("blue_y", metadata->display_primaries[2][1], '/');
555
556 print_q("white_point_x", metadata->white_point[0], '/');
557 print_q("white_point_y", metadata->white_point[1], '/');
558 }
559
560 if (metadata->has_luminance) {
561 print_q("min_luminance", metadata->min_luminance, '/');
562 print_q("max_luminance", metadata->max_luminance, '/');
563 }
564}
565
568{
569 print_int("max_content", metadata->MaxCLL);
570 print_int("max_average", metadata->MaxFALL);
571}
572
574{
575 if (!dovi)
576 return;
577
578 {
579 const AVDOVIRpuDataHeader *hdr = av_dovi_get_header(dovi);
580 const AVDOVIDataMapping *mapping = av_dovi_get_mapping(dovi);
582 AVBPrint pbuf;
583
585
586 // header
587 print_int("rpu_type", hdr->rpu_type);
588 print_int("rpu_format", hdr->rpu_format);
589 print_int("vdr_rpu_profile", hdr->vdr_rpu_profile);
590 print_int("vdr_rpu_level", hdr->vdr_rpu_level);
591 print_int("chroma_resampling_explicit_filter_flag",
593 print_int("coef_data_type", hdr->coef_data_type);
594 print_int("coef_log2_denom", hdr->coef_log2_denom);
595 print_int("vdr_rpu_normalized_idc", hdr->vdr_rpu_normalized_idc);
596 print_int("bl_video_full_range_flag", hdr->bl_video_full_range_flag);
597 print_int("bl_bit_depth", hdr->bl_bit_depth);
598 print_int("el_bit_depth", hdr->el_bit_depth);
599 print_int("vdr_bit_depth", hdr->vdr_bit_depth);
600 print_int("spatial_resampling_filter_flag",
602 print_int("el_spatial_resampling_filter_flag",
604 print_int("disable_residual_flag", hdr->disable_residual_flag);
605
606 // data mapping values
607 print_int("vdr_rpu_id", mapping->vdr_rpu_id);
608 print_int("mapping_color_space", mapping->mapping_color_space);
609 print_int("mapping_chroma_format_idc",
611
612 print_int("nlq_method_idc", mapping->nlq_method_idc);
613 switch (mapping->nlq_method_idc) {
614 case AV_DOVI_NLQ_NONE:
615 print_str("nlq_method_idc_name", "none");
616 break;
618 print_str("nlq_method_idc_name", "linear_dz");
619 break;
620 default:
621 print_str("nlq_method_idc_name", "unknown");
622 break;
623 }
624
625 print_int("num_x_partitions", mapping->num_x_partitions);
626 print_int("num_y_partitions", mapping->num_y_partitions);
627
629
630 for (int c = 0; c < 3; c++) {
631 const AVDOVIReshapingCurve *curve = &mapping->curves[c];
633
634 print_list_fmt("pivots", "%"PRIu16, curve->num_pivots, 1, curve->pivots[idx]);
635
637 for (int i = 0; i < curve->num_pivots - 1; i++) {
638 AVBPrint piece_buf;
639
641 switch (curve->mapping_idc[i]) {
643 av_bprintf(&piece_buf, "Polynomial");
644 break;
646 av_bprintf(&piece_buf, "MMR");
647 break;
648 default:
649 av_bprintf(&piece_buf, "Unknown");
650 break;
651 }
652 av_bprintf(&piece_buf, " mapping");
653
655 print_int("mapping_idc", curve->mapping_idc[i]);
656 switch (curve->mapping_idc[i]) {
658 print_str("mapping_idc_name", "polynomial");
659 print_int("poly_order", curve->poly_order[i]);
660 print_list_fmt("poly_coef", "%"PRIi64,
661 curve->poly_order[i] + 1, 1,
662 curve->poly_coef[i][idx]);
663 break;
665 print_str("mapping_idc_name", "mmr");
666 print_int("mmr_order", curve->mmr_order[i]);
667 print_int("mmr_constant", curve->mmr_constant[i]);
668 print_list_fmt("mmr_coef", "%"PRIi64,
669 curve->mmr_order[i], 7,
670 curve->mmr_coef[i][idx][idx2]);
671 break;
672 default:
673 print_str("mapping_idc_name", "unknown");
674 break;
675 }
676
677 // SECTION_ID_FRAME_SIDE_DATA_PIECE
679 }
680
681 // SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST
683
684 if (mapping->nlq_method_idc != AV_DOVI_NLQ_NONE) {
685 const AVDOVINLQParams *nlq = &mapping->nlq[c];
686 print_int("nlq_offset", nlq->nlq_offset);
687 print_int("vdr_in_max", nlq->vdr_in_max);
688
689 switch (mapping->nlq_method_idc) {
691 print_int("linear_deadzone_slope", nlq->linear_deadzone_slope);
692 print_int("linear_deadzone_threshold", nlq->linear_deadzone_threshold);
693 break;
694 }
695 }
696
697 // SECTION_ID_FRAME_SIDE_DATA_COMPONENT
699 }
700
701 // SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST
703
704 // color metadata
705 print_int("dm_metadata_id", color->dm_metadata_id);
706 print_int("scene_refresh_flag", color->scene_refresh_flag);
707 print_list_fmt("ycc_to_rgb_matrix", "%d/%d",
708 FF_ARRAY_ELEMS(color->ycc_to_rgb_matrix), 1,
709 color->ycc_to_rgb_matrix[idx].num,
710 color->ycc_to_rgb_matrix[idx].den);
711 print_list_fmt("ycc_to_rgb_offset", "%d/%d",
712 FF_ARRAY_ELEMS(color->ycc_to_rgb_offset), 1,
713 color->ycc_to_rgb_offset[idx].num,
714 color->ycc_to_rgb_offset[idx].den);
715 print_list_fmt("rgb_to_lms_matrix", "%d/%d",
716 FF_ARRAY_ELEMS(color->rgb_to_lms_matrix), 1,
717 color->rgb_to_lms_matrix[idx].num,
718 color->rgb_to_lms_matrix[idx].den);
719 print_int("signal_eotf", color->signal_eotf);
720 print_int("signal_eotf_param0", color->signal_eotf_param0);
721 print_int("signal_eotf_param1", color->signal_eotf_param1);
722 print_int("signal_eotf_param2", color->signal_eotf_param2);
723 print_int("signal_bit_depth", color->signal_bit_depth);
724 print_int("signal_color_space", color->signal_color_space);
725 print_int("signal_chroma_format", color->signal_chroma_format);
726 print_int("signal_full_range_flag", color->signal_full_range_flag);
727 print_int("source_min_pq", color->source_min_pq);
728 print_int("source_max_pq", color->source_max_pq);
729 print_int("source_diagonal", color->source_diagonal);
730
731 av_bprint_finalize(&pbuf, NULL);
732 }
733}
734
736{
737 if (!metadata)
738 return;
739 print_int("application version", metadata->application_version);
740 print_int("num_windows", metadata->num_windows);
741 for (int n = 1; n < metadata->num_windows; n++) {
742 const AVHDRPlusColorTransformParams *params = &metadata->params[n];
743 print_q("window_upper_left_corner_x",
744 params->window_upper_left_corner_x,'/');
745 print_q("window_upper_left_corner_y",
746 params->window_upper_left_corner_y,'/');
747 print_q("window_lower_right_corner_x",
748 params->window_lower_right_corner_x,'/');
749 print_q("window_lower_right_corner_y",
750 params->window_lower_right_corner_y,'/');
751 print_int("center_of_ellipse_x",
752 params->center_of_ellipse_x ) ;
753 print_int("center_of_ellipse_y",
754 params->center_of_ellipse_y );
755 print_int("rotation_angle",
756 params->rotation_angle);
757 print_int("semimajor_axis_internal_ellipse",
758 params->semimajor_axis_internal_ellipse);
759 print_int("semimajor_axis_external_ellipse",
760 params->semimajor_axis_external_ellipse);
761 print_int("semiminor_axis_external_ellipse",
762 params->semiminor_axis_external_ellipse);
763 print_int("overlap_process_option",
764 params->overlap_process_option);
765 }
766 print_q("targeted_system_display_maximum_luminance",
767 metadata->targeted_system_display_maximum_luminance,'/');
768 if (metadata->targeted_system_display_actual_peak_luminance_flag) {
769 print_int("num_rows_targeted_system_display_actual_peak_luminance",
770 metadata->num_rows_targeted_system_display_actual_peak_luminance);
771 print_int("num_cols_targeted_system_display_actual_peak_luminance",
772 metadata->num_cols_targeted_system_display_actual_peak_luminance);
773 for (int i = 0; i < metadata->num_rows_targeted_system_display_actual_peak_luminance; i++) {
774 for (int j = 0; j < metadata->num_cols_targeted_system_display_actual_peak_luminance; j++) {
775 print_q("targeted_system_display_actual_peak_luminance",
776 metadata->targeted_system_display_actual_peak_luminance[i][j],'/');
777 }
778 }
779 }
780 for (int n = 0; n < metadata->num_windows; n++) {
781 const AVHDRPlusColorTransformParams *params = &metadata->params[n];
782 for (int i = 0; i < 3; i++) {
783 print_q("maxscl",params->maxscl[i],'/');
784 }
785 print_q("average_maxrgb",
786 params->average_maxrgb,'/');
787 print_int("num_distribution_maxrgb_percentiles",
788 params->num_distribution_maxrgb_percentiles);
789 for (int i = 0; i < params->num_distribution_maxrgb_percentiles; i++) {
790 print_int("distribution_maxrgb_percentage",
791 params->distribution_maxrgb[i].percentage);
792 print_q("distribution_maxrgb_percentile",
793 params->distribution_maxrgb[i].percentile,'/');
794 }
795 print_q("fraction_bright_pixels",
796 params->fraction_bright_pixels,'/');
797 }
798 if (metadata->mastering_display_actual_peak_luminance_flag) {
799 print_int("num_rows_mastering_display_actual_peak_luminance",
800 metadata->num_rows_mastering_display_actual_peak_luminance);
801 print_int("num_cols_mastering_display_actual_peak_luminance",
802 metadata->num_cols_mastering_display_actual_peak_luminance);
803 for (int i = 0; i < metadata->num_rows_mastering_display_actual_peak_luminance; i++) {
804 for (int j = 0; j < metadata->num_cols_mastering_display_actual_peak_luminance; j++) {
805 print_q("mastering_display_actual_peak_luminance",
806 metadata->mastering_display_actual_peak_luminance[i][j],'/');
807 }
808 }
809 }
810
811 for (int n = 0; n < metadata->num_windows; n++) {
812 const AVHDRPlusColorTransformParams *params = &metadata->params[n];
813 if (params->tone_mapping_flag) {
814 print_q("knee_point_x", params->knee_point_x,'/');
815 print_q("knee_point_y", params->knee_point_y,'/');
816 print_int("num_bezier_curve_anchors",
817 params->num_bezier_curve_anchors );
818 for (int i = 0; i < params->num_bezier_curve_anchors; i++) {
819 print_q("bezier_curve_anchors",
820 params->bezier_curve_anchors[i],'/');
821 }
822 }
823 if (params->color_saturation_mapping_flag) {
824 print_q("color_saturation_weight",
825 params->color_saturation_weight,'/');
826 }
827 }
828}
829
831{
832 if (!metadata)
833 return;
834 print_int("application_version", metadata->application_version);
835 print_int("minimum_application_version", metadata->minimum_application_version);
836 print_int("has_custom_hdr_reference_white_flag", metadata->has_custom_hdr_reference_white_flag);
837 print_int("has_adaptive_tone_map_flag", metadata->has_adaptive_tone_map_flag);
838
839 if (metadata->has_custom_hdr_reference_white_flag)
840 print_int("hdr_reference_white", metadata->hdr_reference_white);
841
842 if (!metadata->has_adaptive_tone_map_flag)
843 return;
844
845 print_int("baseline_hdr_headroom", metadata->baseline_hdr_headroom);
846 print_int("use_reference_white_tone_mapping_flag", metadata->use_reference_white_tone_mapping_flag);
847
848 if (metadata->use_reference_white_tone_mapping_flag)
849 return;
850
851 print_int("num_alternate_images", metadata->num_alternate_images);
852 print_int("gain_application_space_chromaticities_flag", metadata->gain_application_space_chromaticities_flag);
853 print_int("has_common_component_mix_params_flag", metadata->has_common_component_mix_params_flag);
854 print_int("has_common_curve_params_flag", metadata->has_common_curve_params_flag);
855
856 if (metadata->gain_application_space_chromaticities_flag == 3) {
857 for (int i = 0; i < 8; i++)
858 print_int("gain_application_space_chromaticities", metadata->gain_application_space_chromaticities[i]);
859 }
860
861 for (int a = 0; a < metadata->num_alternate_images; a++) {
862 print_int("alternate_hdr_headroom", metadata->alternate_hdr_headrooms[a]);
863
864 print_int("component_mixing_type", metadata->component_mixing_type[a]);
865 if (metadata->component_mixing_type[a] == 3) {
866 for (int k = 0; k < 6; k++) {
867 print_int("has_component_mixing_coefficient_flag", metadata->has_component_mixing_coefficient_flag[a][k]);
868 if (metadata->has_component_mixing_coefficient_flag[a][k])
869 print_int("component_mixing_coefficient", metadata->component_mixing_coefficient[a][k]);
870 }
871 }
872
873 print_int("gain_curve_num_control_points_minus_1", metadata->gain_curve_num_control_points_minus_1[a]);
874 print_int("gain_curve_use_pchip_slope_flag", metadata->gain_curve_use_pchip_slope_flag[a]);
875 for (int c = 0; c <= metadata->gain_curve_num_control_points_minus_1[a]; c++)
876 print_int("gain_curve_control_point_x", metadata->gain_curve_control_points_x[a][c]);
877 for (int c = 0; c <= metadata->gain_curve_num_control_points_minus_1[a]; c++)
878 print_int("gain_curve_control_point_y", metadata->gain_curve_control_points_y[a][c]);
879 if (!metadata->gain_curve_use_pchip_slope_flag[a]) {
880 for (int c = 0; c <= metadata->gain_curve_num_control_points_minus_1[a]; c++)
881 print_int("gain_curve_control_point_theta", metadata->gain_curve_control_points_theta[a][c]);
882 }
883 }
884}
885
887{
888 if (!metadata)
889 return;
890 print_int("system_start_code", metadata->system_start_code);
891 print_int("num_windows", metadata->num_windows);
892
893 for (int n = 0; n < metadata->num_windows; n++) {
895
896 print_q("minimum_maxrgb", params->minimum_maxrgb, '/');
897 print_q("average_maxrgb", params->average_maxrgb, '/');
898 print_q("variance_maxrgb", params->variance_maxrgb, '/');
899 print_q("maximum_maxrgb", params->maximum_maxrgb, '/');
900 }
901
902 for (int n = 0; n < metadata->num_windows; n++) {
904
905 print_int("tone_mapping_mode_flag", params->tone_mapping_mode_flag);
906 if (params->tone_mapping_mode_flag) {
907 print_int("tone_mapping_param_num", params->tone_mapping_param_num);
908 for (int i = 0; i < params->tone_mapping_param_num; i++) {
909 const AVHDRVividColorToneMappingParams *tm_params = &params->tm_params[i];
910
911 print_q("targeted_system_display_maximum_luminance",
913 print_int("base_enable_flag", tm_params->base_enable_flag);
914 if (tm_params->base_enable_flag) {
915 print_q("base_param_m_p", tm_params->base_param_m_p, '/');
916 print_q("base_param_m_m", tm_params->base_param_m_m, '/');
917 print_q("base_param_m_a", tm_params->base_param_m_a, '/');
918 print_q("base_param_m_b", tm_params->base_param_m_b, '/');
919 print_q("base_param_m_n", tm_params->base_param_m_n, '/');
920
921 print_int("base_param_k1", tm_params->base_param_k1);
922 print_int("base_param_k2", tm_params->base_param_k2);
923 print_int("base_param_k3", tm_params->base_param_k3);
924 print_int("base_param_Delta_enable_mode",
926 print_q("base_param_Delta", tm_params->base_param_Delta, '/');
927 }
928 print_int("3Spline_enable_flag", tm_params->three_Spline_enable_flag);
929 if (tm_params->three_Spline_enable_flag) {
930 print_int("3Spline_num", tm_params->three_Spline_num);
931
932 for (int j = 0; j < tm_params->three_Spline_num; j++) {
933 const AVHDRVivid3SplineParams *three_spline = &tm_params->three_spline[j];
934 print_int("3Spline_TH_mode", three_spline->th_mode);
935 if (three_spline->th_mode == 0 || three_spline->th_mode == 2)
936 print_q("3Spline_TH_enable_MB", three_spline->th_enable_mb, '/');
937 print_q("3Spline_TH_enable", three_spline->th_enable, '/');
938 print_q("3Spline_TH_Delta1", three_spline->th_delta1, '/');
939 print_q("3Spline_TH_Delta2", three_spline->th_delta2, '/');
940 print_q("3Spline_enable_Strength", three_spline->enable_strength, '/');
941 }
942 }
943 }
944 }
945
946 print_int("color_saturation_mapping_flag", params->color_saturation_mapping_flag);
947 if (params->color_saturation_mapping_flag) {
948 print_int("color_saturation_num", params->color_saturation_num);
949 for (int i = 0; i < params->color_saturation_num; i++) {
950 print_q("color_saturation_gain", params->color_saturation_gain[i], '/');
951 }
952 }
953 }
954}
955
958{
959 if (!env)
960 return;
961
962 print_q("ambient_illuminance", env->ambient_illuminance, '/');
963 print_q("ambient_light_x", env->ambient_light_x, '/');
964 print_q("ambient_light_y", env->ambient_light_y, '/');
965}
966
968 const AVFilmGrainParams *fgp)
969{
970 const char *color_range, *color_primaries, *color_trc, *color_space;
971 const char *const film_grain_type_names[] = {
972 [AV_FILM_GRAIN_PARAMS_NONE] = "none",
973 [AV_FILM_GRAIN_PARAMS_AV1] = "av1",
974 [AV_FILM_GRAIN_PARAMS_H274] = "h274",
975 };
976
977 AVBPrint pbuf;
978 if (!fgp || fgp->type >= FF_ARRAY_ELEMS(film_grain_type_names))
979 return;
980
983 color_trc = av_color_transfer_name(fgp->color_trc);
984 color_space = av_color_space_name(fgp->color_space);
985
987 print_str("type", film_grain_type_names[fgp->type]);
988 print_fmt("seed", "%"PRIu64, fgp->seed);
989 print_int("width", fgp->width);
990 print_int("height", fgp->height);
991 print_int("subsampling_x", fgp->subsampling_x);
992 print_int("subsampling_y", fgp->subsampling_y);
993 print_str("color_range", color_range ? color_range : "unknown");
994 print_str("color_primaries", color_primaries ? color_primaries : "unknown");
995 print_str("color_trc", color_trc ? color_trc : "unknown");
996 print_str("color_space", color_space ? color_space : "unknown");
997
998 switch (fgp->type) {
1000 break;
1002 const AVFilmGrainAOMParams *aom = &fgp->codec.aom;
1003 const int num_ar_coeffs_y = 2 * aom->ar_coeff_lag * (aom->ar_coeff_lag + 1);
1004 const int num_ar_coeffs_uv = num_ar_coeffs_y + !!aom->num_y_points;
1005 print_int("chroma_scaling_from_luma", aom->chroma_scaling_from_luma);
1006 print_int("scaling_shift", aom->scaling_shift);
1007 print_int("ar_coeff_lag", aom->ar_coeff_lag);
1008 print_int("ar_coeff_shift", aom->ar_coeff_shift);
1009 print_int("grain_scale_shift", aom->grain_scale_shift);
1010 print_int("overlap_flag", aom->overlap_flag);
1011 print_int("limit_output_range", aom->limit_output_range);
1012
1014
1015 if (aom->num_y_points) {
1017
1018 print_int("bit_depth_luma", fgp->bit_depth_luma);
1019 print_list_fmt("y_points_value", "%"PRIu8, aom->num_y_points, 1, aom->y_points[idx][0]);
1020 print_list_fmt("y_points_scaling", "%"PRIu8, aom->num_y_points, 1, aom->y_points[idx][1]);
1021 print_list_fmt("ar_coeffs_y", "%"PRId8, num_ar_coeffs_y, 1, aom->ar_coeffs_y[idx]);
1022
1023 // SECTION_ID_FRAME_SIDE_DATA_COMPONENT
1025 }
1026
1027 for (unsigned uv = 0; uv < 2; uv++) {
1028 if (!aom->num_uv_points[uv] && !aom->chroma_scaling_from_luma)
1029 continue;
1030
1032
1033 print_int("bit_depth_chroma", fgp->bit_depth_chroma);
1034 print_list_fmt("uv_points_value", "%"PRIu8, aom->num_uv_points[uv], 1, aom->uv_points[uv][idx][0]);
1035 print_list_fmt("uv_points_scaling", "%"PRIu8, aom->num_uv_points[uv], 1, aom->uv_points[uv][idx][1]);
1036 print_list_fmt("ar_coeffs_uv", "%"PRId8, num_ar_coeffs_uv, 1, aom->ar_coeffs_uv[uv][idx]);
1037 print_int("uv_mult", aom->uv_mult[uv]);
1038 print_int("uv_mult_luma", aom->uv_mult_luma[uv]);
1039 print_int("uv_offset", aom->uv_offset[uv]);
1040
1041 // SECTION_ID_FRAME_SIDE_DATA_COMPONENT
1043 }
1044
1045 // SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST
1047 break;
1048 }
1050 const AVFilmGrainH274Params *h274 = &fgp->codec.h274;
1051 print_int("model_id", h274->model_id);
1052 print_int("blending_mode_id", h274->blending_mode_id);
1053 print_int("log2_scale_factor", h274->log2_scale_factor);
1054
1056
1057 for (int c = 0; c < 3; c++) {
1058 if (!h274->component_model_present[c])
1059 continue;
1060
1062 print_int(c ? "bit_depth_chroma" : "bit_depth_luma", c ? fgp->bit_depth_chroma : fgp->bit_depth_luma);
1063
1065 for (int i = 0; i < h274->num_intensity_intervals[c]; i++) {
1066
1068 print_int("intensity_interval_lower_bound", h274->intensity_interval_lower_bound[c][i]);
1069 print_int("intensity_interval_upper_bound", h274->intensity_interval_upper_bound[c][i]);
1070 print_list_fmt("comp_model_value", "%"PRId16, h274->num_model_values[c], 1, h274->comp_model_value[c][i][idx]);
1071
1072 // SECTION_ID_FRAME_SIDE_DATA_PIECE
1074 }
1075
1076 // SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST
1078
1079 // SECTION_ID_FRAME_SIDE_DATA_COMPONENT
1081 }
1082
1083 // SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST
1085 break;
1086 }
1087 }
1088
1089 av_bprint_finalize(&pbuf, NULL);
1090}
1091
1093 int width,
1094 int height,
1095 const AVPacketSideData *sd,
1096 SectionID id_data)
1097{
1098 const char *name = av_packet_side_data_name(sd->type);
1099
1100 avtext_print_section_header(tfc, sd, id_data);
1101 print_str("side_data_type", name ? name : "unknown");
1102 if (sd->type == AV_PKT_DATA_DISPLAYMATRIX && sd->size >= 9*4) {
1103 print_displaymatrix(tfc, (const int32_t*)sd->data);
1104 } else if (sd->type == AV_PKT_DATA_STEREO3D) {
1105 const AVStereo3D *stereo = (AVStereo3D *)sd->data;
1106 print_str("type", av_stereo3d_type_name(stereo->type));
1107 print_int("inverted", !!(stereo->flags & AV_STEREO3D_FLAG_INVERT));
1108 print_str("view", av_stereo3d_view_name(stereo->view));
1109 print_str("primary_eye", av_stereo3d_primary_eye_name(stereo->primary_eye));
1110 print_int("baseline", stereo->baseline);
1111 print_q("horizontal_disparity_adjustment", stereo->horizontal_disparity_adjustment, '/');
1112 print_q("horizontal_field_of_view", stereo->horizontal_field_of_view, '/');
1113 } else if (sd->type == AV_PKT_DATA_SPHERICAL) {
1114 const AVSphericalMapping *spherical = (AVSphericalMapping *)sd->data;
1115 print_str("projection", av_spherical_projection_name(spherical->projection));
1116 if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
1117 print_int("padding", spherical->padding);
1118 } else if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
1119 size_t l, t, r, b;
1121 &l, &t, &r, &b);
1122 print_int("bound_left", l);
1123 print_int("bound_top", t);
1124 print_int("bound_right", r);
1125 print_int("bound_bottom", b);
1126 }
1127
1128 print_int("yaw", (double) spherical->yaw / (1 << 16));
1129 print_int("pitch", (double) spherical->pitch / (1 << 16));
1130 print_int("roll", (double) spherical->roll / (1 << 16));
1131 } else if (sd->type == AV_PKT_DATA_SKIP_SAMPLES && sd->size == 10) {
1132 print_int("skip_samples", AV_RL32(sd->data));
1133 print_int("discard_padding", AV_RL32(sd->data + 4));
1134 print_int("skip_reason", AV_RL8(sd->data + 8));
1135 print_int("discard_reason", AV_RL8(sd->data + 9));
1136 } else if (sd->type == AV_PKT_DATA_MASTERING_DISPLAY_METADATA) {
1138 } else if (sd->type == AV_PKT_DATA_CONTENT_LIGHT_LEVEL) {
1142 tfc, (const AVAmbientViewingEnvironment *)sd->data);
1143 } else if (sd->type == AV_PKT_DATA_DYNAMIC_HDR10_PLUS) {
1146 } else if (sd->type == AV_PKT_DATA_DOVI_CONF) {
1148 const char *comp = "unknown";
1149 print_int("dv_version_major", dovi->dv_version_major);
1150 print_int("dv_version_minor", dovi->dv_version_minor);
1151 print_int("dv_profile", dovi->dv_profile);
1152 print_int("dv_level", dovi->dv_level);
1153 print_int("rpu_present_flag", dovi->rpu_present_flag);
1154 print_int("el_present_flag", dovi->el_present_flag);
1155 print_int("bl_present_flag", dovi->bl_present_flag);
1156 print_int("dv_bl_signal_compatibility_id", dovi->dv_bl_signal_compatibility_id);
1157 switch (dovi->dv_md_compression)
1158 {
1159 case AV_DOVI_COMPRESSION_NONE: comp = "none"; break;
1160 case AV_DOVI_COMPRESSION_LIMITED: comp = "limited"; break;
1161 case AV_DOVI_COMPRESSION_RESERVED: comp = "reserved"; break;
1162 case AV_DOVI_COMPRESSION_EXTENDED: comp = "extended"; break;
1163 }
1164 print_str("dv_md_compression", comp);
1165 } else if (sd->type == AV_PKT_DATA_AUDIO_SERVICE_TYPE) {
1166 enum AVAudioServiceType *t = (enum AVAudioServiceType *)sd->data;
1167 print_int("service_type", *t);
1168 } else if (sd->type == AV_PKT_DATA_MPEGTS_STREAM_ID) {
1169 print_int("id", *sd->data);
1170 } else if (sd->type == AV_PKT_DATA_CPB_PROPERTIES) {
1171 const AVCPBProperties *prop = (AVCPBProperties *)sd->data;
1172 print_int("max_bitrate", prop->max_bitrate);
1173 print_int("min_bitrate", prop->min_bitrate);
1174 print_int("avg_bitrate", prop->avg_bitrate);
1175 print_int("buffer_size", prop->buffer_size);
1176 print_int("vbv_delay", prop->vbv_delay);
1177 } else if (sd->type == AV_PKT_DATA_WEBVTT_IDENTIFIER ||
1179 if (do_show_data)
1180 avtext_print_data(tfc, "data", sd->data, sd->size);
1181 avtext_print_data_hash(tfc, "data_hash", sd->data, sd->size);
1182 } else if (sd->type == AV_PKT_DATA_FRAME_CROPPING && sd->size >= sizeof(uint32_t) * 4) {
1183 print_int("crop_top", AV_RL32(sd->data));
1184 print_int("crop_bottom", AV_RL32(sd->data + 4));
1185 print_int("crop_left", AV_RL32(sd->data + 8));
1186 print_int("crop_right", AV_RL32(sd->data + 12));
1187 } else if (sd->type == AV_PKT_DATA_AFD && sd->size > 0) {
1188 print_int("active_format", *sd->data);
1189 } else if (sd->type == AV_PKT_DATA_EXIF) {
1190 print_int("size", sd->size);
1191 } else if (sd->type == AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL && sd->size >= 8) {
1192 print_int("block_additional_id", AV_RB64(sd->data));
1193 if (do_show_data)
1194 avtext_print_data(tfc, "block_additional_data", sd->data + 8, sd->size - 8);
1195 }
1196}
1197
1198static void print_private_data(AVTextFormatContext *tfc, void *priv_data)
1199{
1200 const AVOption *opt = NULL;
1201 while (opt = av_opt_next(priv_data, opt)) {
1202 uint8_t *str;
1203 if (!(opt->flags & AV_OPT_FLAG_EXPORT)) continue;
1204 if (av_opt_get(priv_data, opt->name, 0, &str) >= 0) {
1205 print_str(opt->name, str);
1206 av_free(str);
1207 }
1208 }
1209}
1210
1212{
1213 const char *s = av_get_pix_fmt_name(pix_fmt);
1214 enum AVPixelFormat swapped_pix_fmt;
1215
1216 if (!s) {
1217 print_str_opt("pix_fmt", "unknown");
1218 } else if (!do_bitexact ||
1219 (swapped_pix_fmt = av_pix_fmt_swap_endianness(pix_fmt)) == AV_PIX_FMT_NONE) {
1220 print_str ("pix_fmt", s);
1221 } else {
1222 const char *s2 = av_get_pix_fmt_name(swapped_pix_fmt);
1223 char buf[128];
1224 size_t i = 0;
1225
1226 while (s[i] && s[i] == s2[i] && i < sizeof(buf) - 1) {
1227 buf[i] = s[i];
1228 i++;
1229 }
1230 buf[i] = '\0';
1231
1232 print_str ("pix_fmt", buf);
1233 }
1234}
1235
1237{
1238 const char *val = av_color_range_name(color_range);
1240 print_str_opt("color_range", "unknown");
1241 } else {
1242 print_str("color_range", val);
1243 }
1244}
1245
1246static void print_color_space(AVTextFormatContext *tfc, enum AVColorSpace color_space)
1247{
1248 const char *val = av_color_space_name(color_space);
1249 if (!val || color_space == AVCOL_SPC_UNSPECIFIED) {
1250 print_str_opt("color_space", "unknown");
1251 } else {
1252 print_str("color_space", val);
1253 }
1254}
1255
1257{
1260 print_str_opt("color_primaries", "unknown");
1261 } else {
1262 print_str("color_primaries", val);
1263 }
1264}
1265
1267{
1268 const char *val = av_color_transfer_name(color_trc);
1269 if (!val || color_trc == AVCOL_TRC_UNSPECIFIED) {
1270 print_str_opt("color_transfer", "unknown");
1271 } else {
1272 print_str("color_transfer", val);
1273 }
1274}
1275
1276static void print_chroma_location(AVTextFormatContext *tfc, enum AVChromaLocation chroma_location)
1277{
1278 const char *val = av_chroma_location_name(chroma_location);
1279 if (!val || chroma_location == AVCHROMA_LOC_UNSPECIFIED) {
1280 print_str_opt("chroma_location", "unspecified");
1281 } else {
1282 print_str("chroma_location", val);
1283 }
1284}
1285
1286static void print_alpha_mode(AVTextFormatContext *tfc, enum AVAlphaMode alpha_mode)
1287{
1288 const char *val = av_alpha_mode_name(alpha_mode);
1289 if (!val || alpha_mode == AVALPHA_MODE_UNSPECIFIED) {
1290 print_str_opt("alpha_mode", "unspecified");
1291 } else {
1292 print_str("alpha_mode", val);
1293 }
1294}
1295
1296static void clear_log(int need_lock)
1297{
1298 int i;
1299
1300 if (need_lock)
1302 for (i=0; i<log_buffer_size; i++) {
1303 av_freep(&log_buffer[i].context_name);
1304 av_freep(&log_buffer[i].parent_name);
1305 av_freep(&log_buffer[i].log_message);
1306 }
1307 log_buffer_size = 0;
1308 if(need_lock)
1310}
1311
1312static int show_log(AVTextFormatContext *tfc, int section_ids, int section_id, int log_level)
1313{
1314 int i;
1316 if (!log_buffer_size) {
1318 return 0;
1319 }
1320 avtext_print_section_header(tfc, NULL, section_ids);
1321
1322 for (i=0; i<log_buffer_size; i++) {
1323 if (log_buffer[i].log_level <= log_level) {
1324 avtext_print_section_header(tfc, NULL, section_id);
1325 print_str("context", log_buffer[i].context_name);
1326 print_int("level", log_buffer[i].log_level);
1327 print_int("category", log_buffer[i].category);
1328 if (log_buffer[i].parent_name) {
1329 print_str("parent_context", log_buffer[i].parent_name);
1330 print_int("parent_category", log_buffer[i].parent_category);
1331 } else {
1332 print_str_opt("parent_context", "N/A");
1333 print_str_opt("parent_category", "N/A");
1334 }
1335 print_str("message", log_buffer[i].log_message);
1337 }
1338 }
1339 clear_log(0);
1341
1343
1344 return 0;
1345}
1346
1347static void show_packet(AVTextFormatContext *tfc, InputFile *ifile, AVPacket *pkt, int packet_idx)
1348{
1349 AVStream *st = ifile->streams[pkt->stream_index].st;
1350 AVBPrint pbuf;
1351 const char *s;
1352
1354
1356
1358 if (s) print_str ("codec_type", s);
1359 else print_str_opt("codec_type", "unknown");
1360 print_int("stream_index", pkt->stream_index);
1361 print_ts ("pts", pkt->pts);
1362 print_time("pts_time", pkt->pts, &st->time_base);
1363 print_ts ("dts", pkt->dts);
1364 print_time("dts_time", pkt->dts, &st->time_base);
1365 print_duration_ts("duration", pkt->duration);
1366 print_duration_time("duration_time", pkt->duration, &st->time_base);
1368 if (pkt->pos != -1) print_fmt ("pos", "%"PRId64, pkt->pos);
1369 else print_str_opt("pos", "N/A");
1370 print_fmt("flags", "%c%c%c", pkt->flags & AV_PKT_FLAG_KEY ? 'K' : '_',
1371 pkt->flags & AV_PKT_FLAG_DISCARD ? 'D' : '_',
1372 pkt->flags & AV_PKT_FLAG_CORRUPT ? 'C' : '_');
1373 if (do_show_data)
1374 avtext_print_data(tfc, "data", pkt->data, pkt->size);
1375 avtext_print_data_hash(tfc, "data_hash", pkt->data, pkt->size);
1376
1377 if (pkt->side_data_elems) {
1378 size_t size;
1379 const uint8_t *side_metadata;
1380
1382 if (side_metadata && size && do_show_packet_tags) {
1383 AVDictionary *dict = NULL;
1384 if (av_packet_unpack_dictionary(side_metadata, size, &dict) >= 0)
1386 av_dict_free(&dict);
1387 }
1388
1390 for (int i = 0; i < pkt->side_data_elems; i++) {
1391 print_pkt_side_data(tfc, st->codecpar->width, st->codecpar->height, &pkt->side_data[i],
1394 }
1396 }
1397
1399
1400 av_bprint_finalize(&pbuf, NULL);
1401 fflush(stdout);
1402}
1403
1406{
1407 AVBPrint pbuf;
1408
1410
1412
1413 print_str ("media_type", "subtitle");
1414 print_ts ("pts", sub->pts);
1415 print_time("pts_time", sub->pts, &AV_TIME_BASE_Q);
1416 print_int ("format", sub->format);
1417 print_int ("start_display_time", sub->start_display_time);
1418 print_int ("end_display_time", sub->end_display_time);
1419 print_int ("num_rects", sub->num_rects);
1420
1422
1423 av_bprint_finalize(&pbuf, NULL);
1424 fflush(stdout);
1425}
1426
1427static void print_iamf_param_definition(AVTextFormatContext *tfc, const char *name,
1428 const AVIAMFParamDefinition *param, SectionID section_id);
1429
1431 const AVFrame *frame,
1432 const AVStream *stream)
1433{
1435
1436 for (int i = 0; i < frame->nb_side_data; i++) {
1437 const AVFrameSideData *sd = frame->side_data[i];
1438 const char *name;
1439
1442 print_str("side_data_type", name ? name : "unknown");
1443 if (sd->type == AV_FRAME_DATA_DOWNMIX_INFO) {
1445 } else if (sd->type == AV_FRAME_DATA_DISPLAYMATRIX && sd->size >= 9*4) {
1446 print_displaymatrix(tfc, (const int32_t*)sd->data);
1447 } else if (sd->type == AV_FRAME_DATA_AFD && sd->size > 0) {
1448 print_int("active_format", *sd->data);
1449 } else if (sd->type == AV_FRAME_DATA_GOP_TIMECODE && sd->size >= 8) {
1450 char tcbuf[AV_TIMECODE_STR_SIZE];
1452 print_str("timecode", tcbuf);
1453 } else if (sd->type == AV_FRAME_DATA_S12M_TIMECODE && sd->size == 16) {
1454 uint32_t *tc = (uint32_t*)sd->data;
1455 int m = FFMIN(tc[0],3);
1457 for (int j = 1; j <= m ; j++) {
1458 char tcbuf[AV_TIMECODE_STR_SIZE];
1459 av_timecode_make_smpte_tc_string2(tcbuf, stream->avg_frame_rate, tc[j], 0, 0);
1461 print_str("value", tcbuf);
1463 }
1467 } else if (sd->type == AV_FRAME_DATA_DYNAMIC_HDR_PLUS) {
1473 } else if (sd->type == AV_FRAME_DATA_CONTENT_LIGHT_LEVEL) {
1475 } else if (sd->type == AV_FRAME_DATA_ICC_PROFILE) {
1477 if (tag)
1478 print_str(tag->key, tag->value);
1479 print_int("size", sd->size);
1480 } else if (sd->type == AV_FRAME_DATA_DOVI_METADATA) {
1481 print_dovi_metadata(tfc, (const AVDOVIMetadata *)sd->data);
1482 } else if (sd->type == AV_FRAME_DATA_DYNAMIC_HDR_VIVID) {
1487 } else if (sd->type == AV_FRAME_DATA_FILM_GRAIN_PARAMS) {
1489 print_film_grain_params(tfc, fgp);
1490 } else if (sd->type == AV_FRAME_DATA_VIEW_ID) {
1491 print_int("view_id", *(int*)sd->data);
1492 } else if (sd->type == AV_FRAME_DATA_EXIF) {
1493 print_int("size", sd->size);
1494 } else if (sd->type == AV_FRAME_DATA_IAMF_MIX_GAIN_PARAM ||
1497 const AVIAMFParamDefinition *param = (AVIAMFParamDefinition *)sd->data;
1499 }
1501 }
1503}
1504
1507{
1508 FrameData *fd = frame->opaque_ref ? (FrameData*)frame->opaque_ref->data : NULL;
1509 AVBPrint pbuf;
1510 char val_str[128];
1511 const char *s;
1512
1514
1516
1518 if (s) print_str ("media_type", s);
1519 else print_str_opt("media_type", "unknown");
1520 print_int("stream_index", stream->index);
1521 print_int("key_frame", !!(frame->flags & AV_FRAME_FLAG_KEY));
1522 print_ts ("pts", frame->pts);
1523 print_time("pts_time", frame->pts, &stream->time_base);
1524 print_ts ("pkt_dts", frame->pkt_dts);
1525 print_time("pkt_dts_time", frame->pkt_dts, &stream->time_base);
1526 print_ts ("best_effort_timestamp", frame->best_effort_timestamp);
1527 print_time("best_effort_timestamp_time", frame->best_effort_timestamp, &stream->time_base);
1528 print_duration_ts ("duration", frame->duration);
1529 print_duration_time("duration_time", frame->duration, &stream->time_base);
1530 if (fd && fd->pkt_pos != -1) print_fmt ("pkt_pos", "%"PRId64, fd->pkt_pos);
1531 else print_str_opt("pkt_pos", "N/A");
1532 if (fd && fd->pkt_size != -1) print_int_fmt("pkt_size", fd->pkt_size, AV_TEXTFORMAT_VALUE_FMT_BYTE, unit_byte_str);
1533 else print_str_opt("pkt_size", "N/A");
1534
1535 switch (stream->codecpar->codec_type) {
1536 AVRational sar;
1537
1538 case AVMEDIA_TYPE_VIDEO:
1539 print_int("width", frame->width);
1540 print_int("height", frame->height);
1541 print_int("crop_top", frame->crop_top);
1542 print_int("crop_bottom", frame->crop_bottom);
1543 print_int("crop_left", frame->crop_left);
1544 print_int("crop_right", frame->crop_right);
1545 print_pixel_format(tfc, frame->format);
1547 if (sar.num) {
1548 print_q("sample_aspect_ratio", sar, ':');
1549 } else {
1550 print_str_opt("sample_aspect_ratio", "N/A");
1551 }
1552 print_fmt("pict_type", "%c", av_get_picture_type_char(frame->pict_type));
1553 print_int("interlaced_frame", !!(frame->flags & AV_FRAME_FLAG_INTERLACED));
1554 print_int("top_field_first", !!(frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST));
1555 print_int("lossless", !!(frame->flags & AV_FRAME_FLAG_LOSSLESS));
1556 print_int("repeat_pict", frame->repeat_pict);
1557
1558 print_color_range(tfc, frame->color_range);
1559 print_color_space(tfc, frame->colorspace);
1560 print_primaries(tfc, frame->color_primaries);
1561 print_color_trc(tfc, frame->color_trc);
1562 print_chroma_location(tfc, frame->chroma_location);
1563 print_alpha_mode(tfc, frame->alpha_mode);
1564 break;
1565
1566 case AVMEDIA_TYPE_AUDIO:
1567 s = av_get_sample_fmt_name(frame->format);
1568 if (s) print_str ("sample_fmt", s);
1569 else print_str_opt("sample_fmt", "unknown");
1570 print_int("nb_samples", frame->nb_samples);
1571 print_int("channels", frame->ch_layout.nb_channels);
1572 if (frame->ch_layout.order != AV_CHANNEL_ORDER_UNSPEC) {
1573 av_channel_layout_describe(&frame->ch_layout, val_str, sizeof(val_str));
1574 print_str ("channel_layout", val_str);
1575 } else
1576 print_str_opt("channel_layout", "unknown");
1577 break;
1578 }
1580 show_tags(tfc, frame->metadata, SECTION_ID_FRAME_TAGS);
1581 if (do_show_log)
1583 if (frame->nb_side_data)
1584 print_frame_side_data(tfc, frame, stream);
1585
1587
1588 av_bprint_finalize(&pbuf, NULL);
1589 fflush(stdout);
1590}
1591
1593 InputFile *ifile,
1594 AVFrame *frame, const AVPacket *pkt,
1595 int *packet_new)
1596{
1598 AVCodecContext *dec_ctx = ifile->streams[pkt->stream_index].dec_ctx;
1599 AVCodecParameters *par = ifile->streams[pkt->stream_index].st->codecpar;
1600 AVSubtitle sub;
1601 int ret = 0, got_frame = 0;
1602
1603 clear_log(1);
1604 if (dec_ctx) {
1605 switch (par->codec_type) {
1606 case AVMEDIA_TYPE_VIDEO:
1607 case AVMEDIA_TYPE_AUDIO:
1608 if (*packet_new) {
1610 if (ret == AVERROR(EAGAIN)) {
1611 ret = 0;
1612 } else if (ret >= 0 || ret == AVERROR_EOF) {
1613 ret = 0;
1614 *packet_new = 0;
1615 }
1616 }
1617 if (ret >= 0) {
1619 if (ret >= 0) {
1620 got_frame = 1;
1621 } else if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
1622 ret = 0;
1623 }
1624 }
1625 break;
1626
1628 if (*packet_new)
1629 ret = avcodec_decode_subtitle2(dec_ctx, &sub, &got_frame, pkt);
1630 *packet_new = 0;
1631 break;
1632 default:
1633 *packet_new = 0;
1634 }
1635 } else {
1636 *packet_new = 0;
1637 }
1638
1639 if (ret < 0)
1640 return ret;
1641 if (got_frame) {
1642 int is_sub = (par->codec_type == AVMEDIA_TYPE_SUBTITLE);
1643 nb_streams_frames[pkt->stream_index]++;
1644 if (do_show_frames)
1645 if (is_sub)
1646 show_subtitle(tfc, &sub, ifile->streams[pkt->stream_index].st, fmt_ctx);
1647 else
1648 show_frame(tfc, frame, ifile->streams[pkt->stream_index].st, fmt_ctx);
1649
1650 if (!is_sub && do_analyze_frames) {
1651 for (int i = 0; i < frame->nb_side_data; i++) {
1652 if (frame->side_data[i]->type == AV_FRAME_DATA_A53_CC)
1653 streams_with_closed_captions[pkt->stream_index] = 1;
1654 else if (frame->side_data[i]->type == AV_FRAME_DATA_FILM_GRAIN_PARAMS)
1655 streams_with_film_grain[pkt->stream_index] = 1;
1656 }
1657 }
1658
1659 if (is_sub)
1660 avsubtitle_free(&sub);
1661 }
1662 return got_frame || *packet_new;
1663}
1664
1665static void log_read_interval(const ReadInterval *interval, void *log_ctx, int log_level)
1666{
1667 av_log(log_ctx, log_level, "id:%d", interval->id);
1668
1669 if (interval->has_start) {
1670 av_log(log_ctx, log_level, " start:%s%s", interval->start_is_offset ? "+" : "",
1671 av_ts2timestr(interval->start, &AV_TIME_BASE_Q));
1672 } else {
1673 av_log(log_ctx, log_level, " start:N/A");
1674 }
1675
1676 if (interval->has_end) {
1677 av_log(log_ctx, log_level, " end:%s", interval->end_is_offset ? "+" : "");
1678 if (interval->duration_frames)
1679 av_log(log_ctx, log_level, "#%"PRId64, interval->end);
1680 else
1681 av_log(log_ctx, log_level, "%s", av_ts2timestr(interval->end, &AV_TIME_BASE_Q));
1682 } else {
1683 av_log(log_ctx, log_level, " end:N/A");
1684 }
1685
1686 av_log(log_ctx, log_level, "\n");
1687}
1688
1690 const ReadInterval *interval, int64_t *cur_ts)
1691{
1693 AVPacket *pkt = NULL;
1694 AVFrame *frame = NULL;
1695 int ret = 0, i = 0, frame_count = 0;
1696 int64_t start = -INT64_MAX, end = interval->end;
1697 int has_start = 0, has_end = interval->has_end && !interval->end_is_offset;
1698
1699 av_log(NULL, AV_LOG_VERBOSE, "Processing read interval ");
1701
1702 if (interval->has_start) {
1703 int64_t target;
1704 if (interval->start_is_offset) {
1705 if (*cur_ts == AV_NOPTS_VALUE) {
1707 "Could not seek to relative position since current "
1708 "timestamp is not defined\n");
1709 ret = AVERROR(EINVAL);
1710 goto end;
1711 }
1712 target = *cur_ts + interval->start;
1713 } else {
1714 target = interval->start;
1715 }
1716
1717 av_log(NULL, AV_LOG_VERBOSE, "Seeking to read interval start point %s\n",
1718 av_ts2timestr(target, &AV_TIME_BASE_Q));
1719 if ((ret = avformat_seek_file(fmt_ctx, -1, -INT64_MAX, target, INT64_MAX, 0)) < 0) {
1720 av_log(NULL, AV_LOG_ERROR, "Could not seek to position %"PRId64": %s\n",
1721 interval->start, av_err2str(ret));
1722 goto end;
1723 }
1724 }
1725
1727 if (!frame) {
1728 ret = AVERROR(ENOMEM);
1729 goto end;
1730 }
1731 pkt = av_packet_alloc();
1732 if (!pkt) {
1733 ret = AVERROR(ENOMEM);
1734 goto end;
1735 }
1736 while (!av_read_frame(fmt_ctx, pkt)) {
1737 if (fmt_ctx->nb_streams > nb_streams) {
1743 nb_streams = fmt_ctx->nb_streams;
1744 }
1745 if (selected_streams[pkt->stream_index]) {
1746 AVRational tb = ifile->streams[pkt->stream_index].st->time_base;
1747 int64_t pts = pkt->pts != AV_NOPTS_VALUE ? pkt->pts : pkt->dts;
1748
1749 if (pts != AV_NOPTS_VALUE)
1750 *cur_ts = av_rescale_q(pts, tb, AV_TIME_BASE_Q);
1751
1752 if (!has_start && *cur_ts != AV_NOPTS_VALUE) {
1753 start = *cur_ts;
1754 has_start = 1;
1755 }
1756
1757 if (has_start && !has_end && interval->end_is_offset) {
1758 end = start + interval->end;
1759 has_end = 1;
1760 }
1761
1762 if (interval->end_is_offset && interval->duration_frames) {
1763 if (frame_count >= interval->end)
1764 break;
1765 } else if (has_end && *cur_ts != AV_NOPTS_VALUE && *cur_ts >= end) {
1766 break;
1767 }
1768
1769 frame_count++;
1770 if (do_read_packets) {
1771 if (do_show_packets)
1772 show_packet(tfc, ifile, pkt, i++);
1773 nb_streams_packets[pkt->stream_index]++;
1774 }
1775 if (do_read_frames) {
1776 int packet_new = 1;
1777 FrameData *fd;
1778
1779 pkt->opaque_ref = av_buffer_allocz(sizeof(*fd));
1780 if (!pkt->opaque_ref) {
1781 ret = AVERROR(ENOMEM);
1782 goto end;
1783 }
1784 fd = (FrameData*)pkt->opaque_ref->data;
1785 fd->pkt_pos = pkt->pos;
1786 fd->pkt_size = pkt->size;
1787
1788 while (process_frame(tfc, ifile, frame, pkt, &packet_new) > 0);
1789 }
1790 }
1792 }
1794 //Flush remaining frames that are cached in the decoder
1795 for (int i = 0; i < ifile->nb_streams; i++) {
1796 pkt->stream_index = i;
1797 if (do_read_frames) {
1798 while (process_frame(tfc, ifile, frame, pkt, &(int){1}) > 0);
1799 }
1800 }
1801
1802end:
1805 if (ret < 0) {
1806 av_log(NULL, AV_LOG_ERROR, "Could not read packets in interval ");
1808 }
1809 return ret;
1810}
1811
1812static void flush_buffers(InputFile *ifile)
1813{
1814 int i;
1815
1816 if (!do_read_frames)
1817 return;
1818 for (i = 0; i < ifile->nb_streams; i++) {
1819 if (ifile->streams[i].dec_ctx)
1821 }
1822}
1823
1825{
1827 int ret = 0;
1828 int64_t cur_ts = fmt_ctx->start_time;
1829
1830 if (read_intervals_nb == 0) {
1831 ReadInterval interval = (ReadInterval) { .has_start = 0, .has_end = 0 };
1832 ret = read_interval_packets(tfc, ifile, &interval, &cur_ts);
1833 } else {
1834 for (int i = 0; i < read_intervals_nb; i++) {
1835 /* flushing buffers can reset parts of the private context which may be
1836 * read by show_streams(), so only flush between each read_interval */
1837 if (i)
1838 flush_buffers(ifile);
1839 ret = read_interval_packets(tfc, ifile, &read_intervals[i], &cur_ts);
1840 if (ret < 0)
1841 break;
1842 }
1843 }
1844
1845 return ret;
1846}
1847
1848static void print_dispositions(AVTextFormatContext *tfc, uint32_t disposition, SectionID section_id)
1849{
1850 avtext_print_section_header(tfc, NULL, section_id);
1851 for (unsigned i = 0; i < sizeof(disposition) * CHAR_BIT; i++) {
1852 const char *disposition_str = av_disposition_to_string(1U << i);
1853
1854 if (disposition_str)
1855 print_int(disposition_str, !!(disposition & (1U << i)));
1856 }
1858}
1859
1860#define IN_PROGRAM 1
1861#define IN_STREAM_GROUP 2
1862
1863static int show_stream(AVTextFormatContext *tfc, AVFormatContext *fmt_ctx, int stream_idx, InputStream *ist, int container)
1864{
1865 AVStream *stream = ist->st;
1866 AVCodecParameters *par;
1868 char val_str[128];
1869 const char *s;
1870 AVRational sar, dar;
1871 AVBPrint pbuf;
1872 const AVCodecDescriptor *cd;
1873 const SectionID section_header[] = {
1877 };
1878 const SectionID section_disposition[] = {
1882 };
1883 const SectionID section_tags[] = {
1887 };
1888 int ret = 0;
1889 const char *profile = NULL;
1890
1891 av_assert0(container < FF_ARRAY_ELEMS(section_header));
1892
1894
1895 avtext_print_section_header(tfc, NULL, section_header[container]);
1896
1897 print_int("index", stream->index);
1898
1899 par = stream->codecpar;
1900 dec_ctx = ist->dec_ctx;
1901 if (cd = avcodec_descriptor_get(par->codec_id)) {
1902 print_str("codec_name", cd->name);
1903 if (!do_bitexact) {
1904 print_str("codec_long_name",
1905 cd->long_name ? cd->long_name : "unknown");
1906 }
1907 } else {
1908 print_str_opt("codec_name", "unknown");
1909 if (!do_bitexact) {
1910 print_str_opt("codec_long_name", "unknown");
1911 }
1912 }
1913
1915 print_str("profile", profile);
1916 else {
1917 if (par->profile != AV_PROFILE_UNKNOWN) {
1918 char profile_num[12];
1919 snprintf(profile_num, sizeof(profile_num), "%d", par->profile);
1920 print_str("profile", profile_num);
1921 } else
1922 print_str_opt("profile", "unknown");
1923 }
1924
1926 if (s) print_str ("codec_type", s);
1927 else print_str_opt("codec_type", "unknown");
1928
1929 /* print AVI/FourCC tag */
1930 print_str("codec_tag_string", av_fourcc2str(par->codec_tag));
1931 print_fmt("codec_tag", "0x%04"PRIx32, par->codec_tag);
1932
1933 av_bprint_clear(&pbuf);
1934 if (!av_mime_codec_str(par, stream->avg_frame_rate, &pbuf))
1935 print_str("mime_codec_string", pbuf.str);
1936
1937 switch (par->codec_type) {
1938 case AVMEDIA_TYPE_VIDEO:
1939 print_int("width", par->width);
1940 print_int("height", par->height);
1941 if (dec_ctx) {
1942 print_int("coded_width", dec_ctx->coded_width);
1943 print_int("coded_height", dec_ctx->coded_height);
1944
1945 if (do_analyze_frames) {
1946 print_int("closed_captions", streams_with_closed_captions[stream->index]);
1947 print_int("film_grain", streams_with_film_grain[stream->index]);
1948 }
1949 }
1950 print_int("has_b_frames", par->video_delay);
1952 if (sar.num) {
1953 print_q("sample_aspect_ratio", sar, ':');
1954 av_reduce(&dar.num, &dar.den,
1955 (int64_t) par->width * sar.num,
1956 (int64_t) par->height * sar.den,
1957 1024*1024);
1958 print_q("display_aspect_ratio", dar, ':');
1959 } else {
1960 print_str_opt("sample_aspect_ratio", "N/A");
1961 print_str_opt("display_aspect_ratio", "N/A");
1962 }
1963 print_pixel_format(tfc, par->format);
1964 print_int("level", par->level);
1965
1966 print_color_range(tfc, par->color_range);
1967 print_color_space(tfc, par->color_space);
1968 print_color_trc(tfc, par->color_trc);
1971
1973 print_str("field_order", "progressive");
1974 else if (par->field_order == AV_FIELD_TT)
1975 print_str("field_order", "tt");
1976 else if (par->field_order == AV_FIELD_BB)
1977 print_str("field_order", "bb");
1978 else if (par->field_order == AV_FIELD_TB)
1979 print_str("field_order", "tb");
1980 else if (par->field_order == AV_FIELD_BT)
1981 print_str("field_order", "bt");
1982 else
1983 print_str_opt("field_order", "unknown");
1984
1985 if (dec_ctx && do_read_frames)
1986 print_int("refs", dec_ctx->refs);
1987 break;
1988
1989 case AVMEDIA_TYPE_AUDIO:
1991 if (s) print_str ("sample_fmt", s);
1992 else print_str_opt("sample_fmt", "unknown");
1993 print_val("sample_rate", par->sample_rate, unit_hertz_str);
1994 print_int("channels", par->ch_layout.nb_channels);
1995
1997 av_channel_layout_describe(&par->ch_layout, val_str, sizeof(val_str));
1998 print_str ("channel_layout", val_str);
1999 } else {
2000 print_str_opt("channel_layout", "unknown");
2001 }
2002
2003 print_int("bits_per_sample", av_get_bits_per_sample(par->codec_id));
2004
2005 print_int("initial_padding", par->initial_padding);
2006 break;
2007
2009 if (par->width)
2010 print_int("width", par->width);
2011 else
2012 print_str_opt("width", "N/A");
2013 if (par->height)
2014 print_int("height", par->height);
2015 else
2016 print_str_opt("height", "N/A");
2017 break;
2018 }
2019
2020 if (show_private_data) {
2021 if (dec_ctx && dec_ctx->codec->priv_class)
2022 print_private_data(tfc, dec_ctx->priv_data);
2023 if (fmt_ctx->iformat->priv_class)
2024 print_private_data(tfc, fmt_ctx->priv_data);
2025 }
2026
2027 if (fmt_ctx->iformat->flags & AVFMT_SHOW_IDS) print_fmt ("id", "0x%x", stream->id);
2028 else print_str_opt("id", "N/A");
2029 print_q("r_frame_rate", stream->r_frame_rate, '/');
2030 print_q("avg_frame_rate", stream->avg_frame_rate, '/');
2031 print_q("time_base", stream->time_base, '/');
2032 print_ts ("start_pts", stream->start_time);
2033 print_time("start_time", stream->start_time, &stream->time_base);
2034 print_ts ("duration_ts", stream->duration);
2035 print_time("duration", stream->duration, &stream->time_base);
2036 if (par->bit_rate > 0) print_val ("bit_rate", par->bit_rate, unit_bit_per_second_str);
2037 else print_str_opt("bit_rate", "N/A");
2038 if (dec_ctx && dec_ctx->rc_max_rate > 0)
2039 print_val ("max_bit_rate", dec_ctx->rc_max_rate, unit_bit_per_second_str);
2040 else
2041 print_str_opt("max_bit_rate", "N/A");
2042 if (dec_ctx && dec_ctx->bits_per_raw_sample > 0) print_fmt("bits_per_raw_sample", "%d", dec_ctx->bits_per_raw_sample);
2043 else print_str_opt("bits_per_raw_sample", "N/A");
2044 if (stream->nb_frames) print_fmt ("nb_frames", "%"PRId64, stream->nb_frames);
2045 else print_str_opt("nb_frames", "N/A");
2046 if (nb_streams_frames[stream_idx]) print_fmt ("nb_read_frames", "%"PRIu64, nb_streams_frames[stream_idx]);
2047 else print_str_opt("nb_read_frames", "N/A");
2048 if (nb_streams_packets[stream_idx]) print_fmt ("nb_read_packets", "%"PRIu64, nb_streams_packets[stream_idx]);
2049 else print_str_opt("nb_read_packets", "N/A");
2050 if (do_show_data)
2051 avtext_print_data(tfc, "extradata", par->extradata,
2052 par->extradata_size);
2053
2054 if (par->extradata_size > 0) {
2055 print_int("extradata_size", par->extradata_size);
2056 avtext_print_data_hash(tfc, "extradata_hash", par->extradata,
2057 par->extradata_size);
2058 }
2059
2060 /* Print disposition information */
2062 av_assert0(container < FF_ARRAY_ELEMS(section_disposition));
2063 print_dispositions(tfc, stream->disposition, section_disposition[container]);
2064 }
2065
2066 if (do_show_stream_tags) {
2067 av_assert0(container < FF_ARRAY_ELEMS(section_tags));
2068 ret = show_tags(tfc, stream->metadata, section_tags[container]);
2069 }
2070
2071 if (stream->codecpar->nb_coded_side_data) {
2073 for (int i = 0; i < stream->codecpar->nb_coded_side_data; i++) {
2074 print_pkt_side_data(tfc, stream->codecpar->width, stream->codecpar->height, &stream->codecpar->coded_side_data[i],
2077 }
2079 }
2080
2082 av_bprint_finalize(&pbuf, NULL);
2083 fflush(stdout);
2084
2085 return ret;
2086}
2087
2089{
2091 int ret = 0;
2092
2094 for (int i = 0; i < ifile->nb_streams; i++)
2095 if (selected_streams[i]) {
2096 ret = show_stream(tfc, fmt_ctx, i, &ifile->streams[i], 0);
2097 if (ret < 0)
2098 break;
2099 }
2101
2102 return ret;
2103}
2104
2105static int show_program(AVTextFormatContext *tfc, InputFile *ifile, AVProgram *program)
2106{
2108 int ret = 0;
2109
2111 print_int("program_id", program->id);
2112 print_int("program_num", program->program_num);
2113 print_int("nb_streams", program->nb_stream_indexes);
2114 print_int("pmt_pid", program->pmt_pid);
2115 print_int("pcr_pid", program->pcr_pid);
2117 ret = show_tags(tfc, program->metadata, SECTION_ID_PROGRAM_TAGS);
2118 if (ret < 0)
2119 goto end;
2120
2122 for (unsigned i = 0; i < program->nb_stream_indexes; i++) {
2123 if (selected_streams[program->stream_index[i]]) {
2124 ret = show_stream(tfc, fmt_ctx, program->stream_index[i], &ifile->streams[program->stream_index[i]], IN_PROGRAM);
2125 if (ret < 0)
2126 break;
2127 }
2128 }
2130
2131end:
2133 return ret;
2134}
2135
2137{
2139 int ret = 0;
2140
2142 for (unsigned i = 0; i < fmt_ctx->nb_programs; i++) {
2143 AVProgram *program = fmt_ctx->programs[i];
2144 if (!program)
2145 continue;
2146 ret = show_program(tfc, ifile, program);
2147 if (ret < 0)
2148 break;
2149 }
2151 return ret;
2152}
2153
2155 const AVStreamGroupTileGrid *tile_grid)
2156{
2158 print_int("nb_tiles", tile_grid->nb_tiles);
2159 print_int("coded_width", tile_grid->coded_width);
2160 print_int("coded_height", tile_grid->coded_height);
2161 print_int("horizontal_offset", tile_grid->horizontal_offset);
2162 print_int("vertical_offset", tile_grid->vertical_offset);
2163 print_int("width", tile_grid->width);
2164 print_int("height", tile_grid->height);
2166 for (unsigned i = 0; i < tile_grid->nb_tiles; i++) {
2168 print_int("stream_index", tile_grid->offsets[i].idx);
2169 print_int("tile_horizontal_offset", tile_grid->offsets[i].horizontal);
2170 print_int("tile_vertical_offset", tile_grid->offsets[i].vertical);
2172 }
2174 if (tile_grid->nb_coded_side_data) {
2176 for (int i = 0; i < tile_grid->nb_coded_side_data; i++) {
2177 print_pkt_side_data(tfc, tile_grid->width, tile_grid->height, &tile_grid->coded_side_data[i],
2180 }
2182 }
2184}
2185
2187 const AVIAMFParamDefinition *param, SectionID section_id)
2188{
2189 SectionID subsection_id, parameter_section_id;
2190 if (section_id == SECTION_ID_FRAME_SIDE_DATA)
2192 else {
2193 av_assert0(sections[section_id].children_ids[0] != -1);
2194 subsection_id = sections[section_id].children_ids[0];
2195 }
2196 av_assert0(sections[subsection_id].children_ids[0] != -1);
2197 parameter_section_id = sections[subsection_id].children_ids[0];
2198
2199 // When printing as part of side-data, skip opening a section
2200 if (section_id != SECTION_ID_FRAME_SIDE_DATA)
2201 avtext_print_section_header(tfc, "IAMF Param Definition", section_id);
2202
2203 if (name)
2204 print_str("name", name);
2205 print_int("nb_subblocks", param->nb_subblocks);
2206 print_int("type", param->type);
2207 print_int("parameter_id", param->parameter_id);
2208 print_int("parameter_rate", param->parameter_rate);
2209 print_int("duration", param->duration);
2210 print_int("constant_subblock_duration", param->constant_subblock_duration);
2211 if (param->nb_subblocks > 0)
2212 avtext_print_section_header(tfc, NULL, subsection_id);
2213 for (unsigned i = 0; i < param->nb_subblocks; i++) {
2214 const void *subblock = av_iamf_param_definition_get_subblock(param, i);
2215 switch(param->type) {
2217 const AVIAMFMixGain *mix = subblock;
2218 avtext_print_section_header(tfc, "IAMF Mix Gain Parameters", parameter_section_id);
2219 print_int("subblock_duration", mix->subblock_duration);
2220 print_int("animation_type", mix->animation_type);
2221 print_q("start_point_value", mix->start_point_value, '/');
2222 print_q("end_point_value", mix->end_point_value, '/');
2223 print_q("control_point_value", mix->control_point_value, '/');
2224 print_q("control_point_relative_time", mix->control_point_relative_time, '/');
2225 avtext_print_section_footer(tfc); // parameter_section_id
2226 break;
2227 }
2229 const AVIAMFDemixingInfo *demix = subblock;
2230 avtext_print_section_header(tfc, "IAMF Demixing Info", parameter_section_id);
2231 print_int("subblock_duration", demix->subblock_duration);
2232 print_int("dmixp_mode", demix->dmixp_mode);
2233 avtext_print_section_footer(tfc); // parameter_section_id
2234 break;
2235 }
2237 const AVIAMFReconGain *recon = subblock;
2238 avtext_print_section_header(tfc, "IAMF Recon Gain", parameter_section_id);
2239 print_int("subblock_duration", recon->subblock_duration);
2240 avtext_print_section_footer(tfc); // parameter_section_id
2241 break;
2242 }
2243 }
2244 }
2245 if (param->nb_subblocks > 0)
2246 avtext_print_section_footer(tfc); // subsection_id
2247
2248 if (section_id != SECTION_ID_FRAME_SIDE_DATA)
2249 avtext_print_section_footer(tfc); // section_id
2250}
2251
2253 const AVIAMFAudioElement *audio_element)
2254{
2255 AVBPrint pbuf;
2256
2258
2260 print_int("nb_layers", audio_element->nb_layers);
2261 print_int("audio_element_type", audio_element->audio_element_type);
2262 print_int("default_w", audio_element->default_w);
2264 for (unsigned i = 0; i < audio_element->nb_layers; i++) {
2265 const AVIAMFLayer *layer = audio_element->layers[i];
2266 char val_str[128];
2268 av_channel_layout_describe(&layer->ch_layout, val_str, sizeof(val_str));
2269 print_str("channel_layout", val_str);
2271 print_int("output_gain_flags", layer->output_gain_flags);
2272 print_q("output_gain", layer->output_gain, '/');
2273 } else if (audio_element->audio_element_type == AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE) {
2274 print_int("ambisonics_mode", layer->ambisonics_mode);
2276 print_list_fmt("demixing_matrix", "%d/%d", layer->nb_demixing_matrix, 1, layer->demixing_matrix[idx].num,
2277 layer->demixing_matrix[idx].den);
2278 }
2279 avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_SUBCOMPONENT
2280 }
2281 if (audio_element->demixing_info)
2282 print_iamf_param_definition(tfc, "demixing_info", audio_element->demixing_info,
2284 if (audio_element->recon_gain_info)
2285 print_iamf_param_definition(tfc, "recon_gain_info", audio_element->recon_gain_info,
2287 avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_SUBCOMPONENTS
2288 avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_COMPONENT
2289
2290 av_bprint_finalize(&pbuf, NULL);
2291}
2292
2294{
2296 print_int("nb_elements", submix->nb_elements);
2297 print_int("nb_layouts", submix->nb_layouts);
2298 print_q("default_mix_gain", submix->default_mix_gain, '/');
2300 for (unsigned i = 0; i < submix->nb_elements; i++) {
2301 const AVIAMFSubmixElement *element = submix->elements[i];
2303 print_int("stream_id", element->audio_element_id);
2304 print_q("default_mix_gain", element->default_mix_gain, '/');
2305 print_int("headphones_rendering_mode", element->headphones_rendering_mode);
2307 if (element->annotations) {
2308 const AVDictionaryEntry *annotation = NULL;
2310 while (annotation = av_dict_iterate(element->annotations, annotation))
2311 print_str(annotation->key, annotation->value);
2312 avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_SUBPIECE
2313 }
2314 if (element->element_mix_config)
2315 print_iamf_param_definition(tfc, "element_mix_config", element->element_mix_config,
2317 avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_SUBPIECES
2318 avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_PIECE
2319 }
2320 if (submix->output_mix_config)
2321 print_iamf_param_definition(tfc, "output_mix_config", submix->output_mix_config,
2323 for (unsigned i = 0; i < submix->nb_layouts; i++) {
2324 const AVIAMFSubmixLayout *layout = submix->layouts[i];
2325 char val_str[128];
2327 av_channel_layout_describe(&layout->sound_system, val_str, sizeof(val_str));
2328 print_str("sound_system", val_str);
2329 print_q("integrated_loudness", layout->integrated_loudness, '/');
2330 print_q("digital_peak", layout->digital_peak, '/');
2331 print_q("true_peak", layout->true_peak, '/');
2332 print_q("dialogue_anchored_loudness", layout->dialogue_anchored_loudness, '/');
2333 print_q("album_anchored_loudness", layout->album_anchored_loudness, '/');
2334 avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_PIECE
2335 }
2336 avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_PIECES
2337 avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_SUBCOMPONENT
2338}
2339
2341 const AVIAMFMixPresentation *mix_presentation)
2342{
2344 print_int("nb_submixes", mix_presentation->nb_submixes);
2346 if (mix_presentation->annotations) {
2347 const AVDictionaryEntry *annotation = NULL;
2349 while (annotation = av_dict_iterate(mix_presentation->annotations, annotation))
2350 print_str(annotation->key, annotation->value);
2351 avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_SUBCOMPONENT
2352 }
2353 for (unsigned i = 0; i < mix_presentation->nb_submixes; i++)
2354 print_iamf_submix_params(tfc, mix_presentation->submixes[i]);
2355 avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_SUBCOMPONENTS
2356 avtext_print_section_footer(tfc); // SECTION_ID_STREAM_GROUP_COMPONENT
2357}
2358
2370
2372{
2374 AVBPrint pbuf;
2375 int ret = 0;
2376
2379 print_int("index", stg->index);
2380 if (fmt_ctx->iformat->flags & AVFMT_SHOW_IDS) print_fmt ("id", "0x%"PRIx64, stg->id);
2381 else print_str_opt("id", "N/A");
2382 print_int("nb_streams", stg->nb_streams);
2384 print_str("type", av_x_if_null(avformat_stream_group_name(stg->type), "unknown"));
2385 else
2386 print_str_opt("type", "unknown");
2388 print_stream_group_params(tfc, stg);
2389
2390 /* Print disposition information */
2393
2396 if (ret < 0)
2397 goto end;
2398
2400 for (unsigned i = 0; i < stg->nb_streams; i++) {
2401 if (selected_streams[stg->streams[i]->index]) {
2402 ret = show_stream(tfc, fmt_ctx, stg->streams[i]->index, &ifile->streams[stg->streams[i]->index], IN_STREAM_GROUP);
2403 if (ret < 0)
2404 break;
2405 }
2406 }
2408
2409end:
2410 av_bprint_finalize(&pbuf, NULL);
2412 return ret;
2413}
2414
2416{
2418 int ret = 0;
2419
2421 for (unsigned i = 0; i < fmt_ctx->nb_stream_groups; i++) {
2422 AVStreamGroup *stg = fmt_ctx->stream_groups[i];
2423
2424 ret = show_stream_group(tfc, ifile, stg);
2425 if (ret < 0)
2426 break;
2427 }
2429 return ret;
2430}
2431
2433{
2435 int ret = 0;
2436
2438 for (unsigned i = 0; i < fmt_ctx->nb_chapters; i++) {
2439 AVChapter *chapter = fmt_ctx->chapters[i];
2440
2442 print_int("id", chapter->id);
2443 print_q ("time_base", chapter->time_base, '/');
2444 print_int("start", chapter->start);
2445 print_time("start_time", chapter->start, &chapter->time_base);
2446 print_int("end", chapter->end);
2447 print_time("end_time", chapter->end, &chapter->time_base);
2449 ret = show_tags(tfc, chapter->metadata, SECTION_ID_CHAPTER_TAGS);
2451 }
2453
2454 return ret;
2455}
2456
2458{
2460 int64_t size = fmt_ctx->pb ? avio_size(fmt_ctx->pb) : -1;
2461 int ret = 0;
2462
2464 print_str_validate("filename", fmt_ctx->url);
2465 print_int("nb_streams", fmt_ctx->nb_streams);
2466 print_int("nb_programs", fmt_ctx->nb_programs);
2467 print_int("nb_stream_groups", fmt_ctx->nb_stream_groups);
2468 print_str("format_name", fmt_ctx->iformat->name);
2469 if (!do_bitexact) {
2470 if (fmt_ctx->iformat->long_name) print_str ("format_long_name", fmt_ctx->iformat->long_name);
2471 else print_str_opt("format_long_name", "unknown");
2472 }
2473 print_time("start_time", fmt_ctx->start_time, &AV_TIME_BASE_Q);
2474 print_time("duration", fmt_ctx->duration, &AV_TIME_BASE_Q);
2476 else print_str_opt("size", "N/A");
2477 if (fmt_ctx->bit_rate > 0) print_val ("bit_rate", fmt_ctx->bit_rate, unit_bit_per_second_str);
2478 else print_str_opt("bit_rate", "N/A");
2479 print_int("probe_score", fmt_ctx->probe_score);
2481 ret = show_tags(tfc, fmt_ctx->metadata, SECTION_ID_FORMAT_TAGS);
2482
2484 fflush(stdout);
2485 return ret;
2486}
2487
2488static void show_error(AVTextFormatContext *tfc, int err)
2489{
2491 print_int("code", err);
2492 print_str("string", av_err2str(err));
2494}
2495
2496static int get_decoder_by_name(const char *codec_name, const AVCodec **codec)
2497{
2498 if (codec_name == NULL)
2499 return 0;
2500
2501 *codec = avcodec_find_decoder_by_name(codec_name);
2502 if (*codec == NULL) {
2504 "No codec could be found with name '%s'\n", codec_name);
2505 return AVERROR(EINVAL);
2506 }
2507 return 0;
2508}
2509
2511{
2512 int ret;
2513
2514#define GET_DECODER(type_) \
2515 ret = get_decoder_by_name(type_##_codec_name, &fmt_ctx->type_##_codec); \
2516 if (ret < 0) return ret;
2517
2518 GET_DECODER(audio);
2520 GET_DECODER(subtitle);
2521 GET_DECODER(video);
2522 return 0;
2523}
2524
2526{
2527 const AVCodec *codec = NULL;
2528 switch (stream->codecpar->codec_type) {
2529 case AVMEDIA_TYPE_VIDEO: codec = fmt_ctx->video_codec; break;
2530 case AVMEDIA_TYPE_AUDIO: codec = fmt_ctx->audio_codec; break;
2531 case AVMEDIA_TYPE_SUBTITLE: codec = fmt_ctx->subtitle_codec; break;
2532 case AVMEDIA_TYPE_DATA: codec = fmt_ctx->data_codec; break;
2533 }
2534
2535 if (codec != NULL)
2536 return codec;
2537
2538 if (stream->codecpar->codec_id == AV_CODEC_ID_PROBE) {
2540 "Failed to probe codec for input stream %d\n", stream->index);
2541 return NULL;
2542 }
2543
2544 codec = avcodec_find_decoder(stream->codecpar->codec_id);
2545 if (codec == NULL) {
2547 "Unsupported codec with id %d for input stream %d\n",
2548 stream->codecpar->codec_id, stream->index);
2549 return NULL;
2550 }
2551
2552 return codec;
2553}
2554
2555static int open_input_file(InputFile *ifile, const char *filename,
2556 const char *print_filename)
2557{
2558 int err;
2560 const AVDictionaryEntry *t = NULL;
2561 int scan_all_pmts_set = 0;
2562
2564 if (!fmt_ctx)
2565 return AVERROR(ENOMEM);
2566
2567 err = set_decoders(fmt_ctx);
2568 if (err < 0)
2569 return err;
2570 if (!av_dict_get(format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE)) {
2571 av_dict_set(&format_opts, "scan_all_pmts", "1", AV_DICT_DONT_OVERWRITE);
2572 scan_all_pmts_set = 1;
2573 }
2574 if ((err = avformat_open_input(&fmt_ctx, filename,
2575 iformat, &format_opts)) < 0) {
2576 print_error(filename, err);
2577 return err;
2578 }
2579 if (print_filename) {
2580 av_freep(&fmt_ctx->url);
2581 fmt_ctx->url = av_strdup(print_filename);
2582 }
2583 ifile->fmt_ctx = fmt_ctx;
2584 if (scan_all_pmts_set)
2585 av_dict_set(&format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE);
2586 while ((t = av_dict_iterate(format_opts, t)))
2587 av_log(NULL, AV_LOG_WARNING, "Option %s skipped - not known to demuxer.\n", t->key);
2588
2589 if (find_stream_info) {
2591 int orig_nb_streams = fmt_ctx->nb_streams;
2592
2594 if (err < 0)
2595 return err;
2596
2598
2599 for (int i = 0; i < orig_nb_streams; i++)
2600 av_dict_free(&opts[i]);
2601 av_freep(&opts);
2602
2603 if (err < 0) {
2604 print_error(filename, err);
2605 return err;
2606 }
2607 }
2608
2609 av_dump_format(fmt_ctx, 0, filename, 0);
2610
2611 ifile->streams = av_calloc(fmt_ctx->nb_streams, sizeof(*ifile->streams));
2612 if (!ifile->streams)
2613 exit(1);
2614 ifile->nb_streams = fmt_ctx->nb_streams;
2615
2616 /* bind a decoder to each input stream */
2617 for (unsigned i = 0; i < fmt_ctx->nb_streams; i++) {
2618 InputStream *ist = &ifile->streams[i];
2619 AVStream *stream = fmt_ctx->streams[i];
2620 const AVCodec *codec;
2621
2622 ist->st = stream;
2623
2624 codec = get_decoder_for_stream(fmt_ctx, stream);
2625 if (!codec)
2626 continue;
2627
2628 {
2630
2632 fmt_ctx, stream, codec, &opts, NULL);
2633 if (err < 0)
2634 exit(1);
2635
2636 ist->dec_ctx = avcodec_alloc_context3(codec);
2637 if (!ist->dec_ctx)
2638 exit(1);
2639
2640 err = avcodec_parameters_to_context(ist->dec_ctx, stream->codecpar);
2641 if (err < 0)
2642 exit(1);
2643
2644 if (do_show_log) {
2645 // For logging it is needed to disable at least frame threads as otherwise
2646 // the log information would need to be reordered and matches up to contexts and frames
2647 // That is in fact possible but not trivial
2648 av_dict_set(&codec_opts, "threads", "1", 0);
2649 }
2650
2651 av_dict_set(&opts, "flags", "+copy_opaque", AV_DICT_MULTIKEY);
2652
2653 ist->dec_ctx->pkt_timebase = stream->time_base;
2654
2655 if (avcodec_open2(ist->dec_ctx, codec, &opts) < 0) {
2656 av_log(NULL, AV_LOG_WARNING, "Could not open codec for input stream %d\n",
2657 stream->index);
2658 exit(1);
2659 }
2660
2661 if ((t = av_dict_iterate(opts, NULL))) {
2662 av_log(NULL, AV_LOG_ERROR, "Option %s for input stream %d not found\n",
2663 t->key, stream->index);
2665 }
2666 }
2667 }
2668
2669 ifile->fmt_ctx = fmt_ctx;
2670 return 0;
2671}
2672
2673static void close_input_file(InputFile *ifile)
2674{
2675
2676 /* close decoder for each stream */
2677 for (int i = 0; i < ifile->nb_streams; i++)
2679
2680 av_freep(&ifile->streams);
2681 ifile->nb_streams = 0;
2682
2684}
2685
2686static int probe_file(AVTextFormatContext *tfc, const char *filename,
2687 const char *print_filename)
2688{
2689 InputFile ifile = { 0 };
2690 int ret;
2691 int section_id;
2692
2696
2697 ret = open_input_file(&ifile, filename, print_filename);
2698 if (ret < 0)
2699 goto end;
2700
2701#define CHECK_END if (ret < 0) goto end
2702
2703 nb_streams = ifile.fmt_ctx->nb_streams;
2709
2710 for (unsigned i = 0; i < ifile.fmt_ctx->nb_streams; i++) {
2711 if (stream_specifier) {
2713 ifile.fmt_ctx->streams[i],
2715 CHECK_END;
2716 else
2717 selected_streams[i] = ret;
2718 ret = 0;
2719 } else {
2720 selected_streams[i] = 1;
2721 }
2722 if (!selected_streams[i])
2724 }
2725
2729 section_id = SECTION_ID_PACKETS_AND_FRAMES;
2730 else if (do_show_packets && !do_show_frames)
2731 section_id = SECTION_ID_PACKETS;
2732 else // (!do_show_packets && do_show_frames)
2733 section_id = SECTION_ID_FRAMES;
2735 avtext_print_section_header(tfc, NULL, section_id);
2736 ret = read_packets(tfc, &ifile);
2739 CHECK_END;
2740 }
2741
2742 if (do_show_programs) {
2743 ret = show_programs(tfc, &ifile);
2744 CHECK_END;
2745 }
2746
2748 ret = show_stream_groups(tfc, &ifile);
2749 CHECK_END;
2750 }
2751
2752 if (do_show_streams) {
2753 ret = show_streams(tfc, &ifile);
2754 CHECK_END;
2755 }
2756 if (do_show_chapters) {
2757 ret = show_chapters(tfc, &ifile);
2758 CHECK_END;
2759 }
2760 if (do_show_format) {
2761 ret = show_format(tfc, &ifile);
2762 CHECK_END;
2763 }
2764
2765end:
2766 if (ifile.fmt_ctx)
2767 close_input_file(&ifile);
2777
2778 return ret;
2779}
2780
2781static void show_usage(void)
2782{
2783 av_log(NULL, AV_LOG_INFO, "Simple multimedia streams analyzer\n");
2784 av_log(NULL, AV_LOG_INFO, "usage: %s [OPTIONS] INPUT_FILE\n", program_name);
2785 av_log(NULL, AV_LOG_INFO, "\n");
2786}
2787
2789{
2790 AVBPrint pbuf;
2792
2794 print_str("version", FFMPEG_VERSION);
2795 print_fmt("copyright", "Copyright (c) %d-%d the FFmpeg developers",
2796 program_birth_year, CONFIG_THIS_YEAR);
2797 print_str("compiler_ident", CC_IDENT);
2798 print_str("configuration", FFMPEG_CONFIGURATION);
2800
2801 av_bprint_finalize(&pbuf, NULL);
2802}
2803
2804#define SHOW_LIB_VERSION(libname, LIBNAME) \
2805 do { \
2806 if (CONFIG_##LIBNAME) { \
2807 unsigned int version = libname##_version(); \
2808 avtext_print_section_header(tfc, NULL, SECTION_ID_LIBRARY_VERSION); \
2809 print_str("name", "lib" #libname); \
2810 print_int("major", LIB##LIBNAME##_VERSION_MAJOR); \
2811 print_int("minor", LIB##LIBNAME##_VERSION_MINOR); \
2812 print_int("micro", LIB##LIBNAME##_VERSION_MICRO); \
2813 print_int("version", version); \
2814 print_str("ident", LIB##LIBNAME##_IDENT); \
2815 avtext_print_section_footer(tfc); \
2816 } \
2817 } while (0)
2818
2820{
2822 SHOW_LIB_VERSION(avutil, AVUTIL);
2823 SHOW_LIB_VERSION(avcodec, AVCODEC);
2824 SHOW_LIB_VERSION(avformat, AVFORMAT);
2825 SHOW_LIB_VERSION(avdevice, AVDEVICE);
2826 SHOW_LIB_VERSION(avfilter, AVFILTER);
2827 SHOW_LIB_VERSION(swscale, SWSCALE);
2828 SHOW_LIB_VERSION(swresample, SWRESAMPLE);
2830}
2831
2832#define PRINT_PIX_FMT_FLAG(flagname, name) \
2833 do { \
2834 print_int(name, !!(pixdesc->flags & AV_PIX_FMT_FLAG_##flagname)); \
2835 } while (0)
2836
2838{
2839 const AVPixFmtDescriptor *pixdesc = NULL;
2840 int i, n;
2841
2843 while (pixdesc = av_pix_fmt_desc_next(pixdesc)) {
2845 print_str("name", pixdesc->name);
2846 print_int("nb_components", pixdesc->nb_components);
2847 if ((pixdesc->nb_components >= 3) && !(pixdesc->flags & AV_PIX_FMT_FLAG_RGB)) {
2848 print_int ("log2_chroma_w", pixdesc->log2_chroma_w);
2849 print_int ("log2_chroma_h", pixdesc->log2_chroma_h);
2850 } else {
2851 print_str_opt("log2_chroma_w", "N/A");
2852 print_str_opt("log2_chroma_h", "N/A");
2853 }
2854 n = av_get_bits_per_pixel(pixdesc);
2855 if (n) print_int ("bits_per_pixel", n);
2856 else print_str_opt("bits_per_pixel", "N/A");
2859 PRINT_PIX_FMT_FLAG(BE, "big_endian");
2860 PRINT_PIX_FMT_FLAG(PAL, "palette");
2861 PRINT_PIX_FMT_FLAG(BITSTREAM, "bitstream");
2862 PRINT_PIX_FMT_FLAG(HWACCEL, "hwaccel");
2863 PRINT_PIX_FMT_FLAG(PLANAR, "planar");
2864 PRINT_PIX_FMT_FLAG(RGB, "rgb");
2865 PRINT_PIX_FMT_FLAG(ALPHA, "alpha");
2867 }
2868 if (do_show_pixel_format_components && (pixdesc->nb_components > 0)) {
2870 for (i = 0; i < pixdesc->nb_components; i++) {
2872 print_int("index", i + 1);
2873 print_int("bit_depth", pixdesc->comp[i].depth);
2875 }
2877 }
2879 }
2881}
2882
2883static int opt_show_optional_fields(void *optctx, const char *opt, const char *arg)
2884{
2888
2890 double num;
2891 int ret = parse_number("show_optional_fields", arg, OPT_TYPE_INT,
2893 if (ret < 0)
2894 return ret;
2896 }
2897 return 0;
2898}
2899
2900static int opt_format(void *optctx, const char *opt, const char *arg)
2901{
2903 if (!iformat) {
2904 av_log(NULL, AV_LOG_ERROR, "Unknown input format: %s\n", arg);
2905 return AVERROR(EINVAL);
2906 }
2907 return 0;
2908}
2909
2910static inline void mark_section_show_entries(SectionID section_id,
2911 int show_all_entries, AVDictionary *entries)
2912{
2913 EntrySelection *selection = &selected_entries[section_id];
2914
2915 selection->show_all_entries = show_all_entries;
2916 if (show_all_entries) {
2917 const AVTextFormatSection *section = &sections[section_id];
2918 for (const int *id = section->children_ids; *id != -1; id++)
2919 mark_section_show_entries(*id, show_all_entries, entries);
2920 } else {
2921 av_dict_copy(&selection->entries_to_show, entries, 0);
2922 }
2923}
2924
2925static int match_section(const char *section_name,
2926 int show_all_entries, AVDictionary *entries)
2927{
2928 int ret = 0;
2929
2930 for (unsigned i = 0; i < FF_ARRAY_ELEMS(sections); i++) {
2931 const struct AVTextFormatSection *section = &sections[i];
2932 if (!strcmp(section_name, section->name) ||
2933 (section->unique_name && !strcmp(section_name, section->unique_name))) {
2935 "'%s' matches section with unique name '%s'\n", section_name,
2936 (char *)av_x_if_null(section->unique_name, section->name));
2937 ret++;
2938 mark_section_show_entries(section->id, show_all_entries, entries);
2939 }
2940 }
2941 return ret;
2942}
2943
2944static int opt_show_entries(void *optctx, const char *opt, const char *arg)
2945{
2946 const char *p = arg;
2947 int ret = 0;
2948
2949 while (*p) {
2950 AVDictionary *entries = NULL;
2951 char *section_name = av_get_token(&p, "=:");
2952 int show_all_entries = 0;
2953
2954 if (!section_name) {
2956 "Missing section name for option '%s'\n", opt);
2957 return AVERROR(EINVAL);
2958 }
2959
2960 if (*p == '=') {
2961 p++;
2962 while (*p && *p != ':') {
2963 char *entry = av_get_token(&p, ",:");
2964 if (!entry)
2965 break;
2967 "Adding '%s' to the entries to show in section '%s'\n",
2968 entry, section_name);
2970 if (*p == ',')
2971 p++;
2972 }
2973 } else {
2974 show_all_entries = 1;
2975 }
2976
2977 ret = match_section(section_name, show_all_entries, entries);
2978 if (ret == 0) {
2979 av_log(NULL, AV_LOG_ERROR, "No match for section '%s'\n", section_name);
2980 ret = AVERROR(EINVAL);
2981 }
2982 av_dict_free(&entries);
2983 av_free(section_name);
2984
2985 if (ret <= 0)
2986 break;
2987 if (*p)
2988 p++;
2989 }
2990
2991 return ret;
2992}
2993
2994static int opt_input_file(void *optctx, const char *arg)
2995{
2996 if (input_filename) {
2998 "Argument '%s' provided as input filename, but '%s' was already specified.\n",
3000 return AVERROR(EINVAL);
3001 }
3002 if (!strcmp(arg, "-"))
3003 arg = "fd:";
3005 if (!input_filename)
3006 return AVERROR(ENOMEM);
3007
3008 return 0;
3009}
3010
3011static int opt_input_file_i(void *optctx, const char *opt, const char *arg)
3012{
3013 opt_input_file(optctx, arg);
3014 return 0;
3015}
3016
3017static int opt_output_file_o(void *optctx, const char *opt, const char *arg)
3018{
3019 if (output_filename) {
3021 "Argument '%s' provided as output filename, but '%s' was already specified.\n",
3023 return AVERROR(EINVAL);
3024 }
3025 if (!strcmp(arg, "-"))
3026 arg = "fd:";
3028 if (!output_filename)
3029 return AVERROR(ENOMEM);
3030
3031 return 0;
3032}
3033
3034static int opt_print_filename(void *optctx, const char *opt, const char *arg)
3035{
3038 return print_input_filename ? 0 : AVERROR(ENOMEM);
3039}
3040
3051
3052/**
3053 * Parse interval specification, according to the format:
3054 * INTERVAL ::= [START|+START_OFFSET][%[END|+END_OFFSET]]
3055 * INTERVALS ::= INTERVAL[,INTERVALS]
3056*/
3057static int parse_read_interval(const char *interval_spec,
3058 ReadInterval *interval)
3059{
3060 int ret = 0;
3061 char *next, *p, *spec = av_strdup(interval_spec);
3062 if (!spec)
3063 return AVERROR(ENOMEM);
3064
3065 if (!*spec) {
3066 av_log(NULL, AV_LOG_ERROR, "Invalid empty interval specification\n");
3067 ret = AVERROR(EINVAL);
3068 goto end;
3069 }
3070
3071 p = spec;
3072 next = strchr(spec, '%');
3073 if (next)
3074 *next++ = 0;
3075
3076 /* parse first part */
3077 if (*p) {
3078 interval->has_start = 1;
3079
3080 if (*p == '+') {
3081 interval->start_is_offset = 1;
3082 p++;
3083 } else {
3084 interval->start_is_offset = 0;
3085 }
3086
3087 ret = av_parse_time(&interval->start, p, 1);
3088 if (ret < 0) {
3089 av_log(NULL, AV_LOG_ERROR, "Invalid interval start specification '%s'\n", p);
3090 goto end;
3091 }
3092 } else {
3093 interval->has_start = 0;
3094 }
3095
3096 /* parse second part */
3097 p = next;
3098 if (p && *p) {
3099 int64_t us;
3100 interval->has_end = 1;
3101
3102 if (*p == '+') {
3103 interval->end_is_offset = 1;
3104 p++;
3105 } else {
3106 interval->end_is_offset = 0;
3107 }
3108
3109 if (interval->end_is_offset && *p == '#') {
3110 long long int lli;
3111 char *tail;
3112 interval->duration_frames = 1;
3113 p++;
3114 lli = strtoll(p, &tail, 10);
3115 if (*tail || lli < 0) {
3117 "Invalid or negative value '%s' for duration number of frames\n", p);
3118 goto end;
3119 }
3120 interval->end = lli;
3121 } else {
3122 interval->duration_frames = 0;
3123 ret = av_parse_time(&us, p, 1);
3124 if (ret < 0) {
3125 av_log(NULL, AV_LOG_ERROR, "Invalid interval end/duration specification '%s'\n", p);
3126 goto end;
3127 }
3128 interval->end = us;
3129 }
3130 } else {
3131 interval->has_end = 0;
3132 }
3133
3134end:
3135 av_free(spec);
3136 return ret;
3137}
3138
3139static int parse_read_intervals(const char *intervals_spec)
3140{
3141 int ret, n, i;
3142 char *p, *spec = av_strdup(intervals_spec);
3143 if (!spec)
3144 return AVERROR(ENOMEM);
3145
3146 /* preparse specification, get number of intervals */
3147 for (n = 0, p = spec; *p; p++)
3148 if (*p == ',')
3149 n++;
3150 n++;
3151
3153 if (!read_intervals) {
3154 ret = AVERROR(ENOMEM);
3155 goto end;
3156 }
3158
3159 /* parse intervals */
3160 p = spec;
3161 for (i = 0; p; i++) {
3162 char *next;
3163
3165 next = strchr(p, ',');
3166 if (next)
3167 *next++ = 0;
3168
3169 read_intervals[i].id = i;
3171 if (ret < 0) {
3172 av_log(NULL, AV_LOG_ERROR, "Error parsing read interval #%d '%s'\n",
3173 i, p);
3174 goto end;
3175 }
3176 av_log(NULL, AV_LOG_VERBOSE, "Parsed log interval ");
3178 p = next;
3179 }
3181
3182end:
3183 av_free(spec);
3184 return ret;
3185}
3186
3187static int opt_read_intervals(void *optctx, const char *opt, const char *arg)
3188{
3189 return parse_read_intervals(arg);
3190}
3191
3192static int opt_pretty(void *optctx, const char *opt, const char *arg)
3193{
3194 show_value_unit = 1;
3195 use_value_prefix = 1;
3198 return 0;
3199}
3200
3201static void print_section(SectionID id, int level)
3202{
3203 const int *pid;
3204 const struct AVTextFormatSection *section = &sections[id];
3205 printf("%c%c%c%c",
3206 section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER ? 'W' : '.',
3207 section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY ? 'A' : '.',
3209 section->flags & AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE ? 'T' : '.');
3210 printf("%*c %s", level * 4, ' ', section->name);
3211 if (section->unique_name)
3212 printf("/%s", section->unique_name);
3213 printf("\n");
3214
3215 for (pid = section->children_ids; *pid != -1; pid++)
3216 print_section(*pid, level+1);
3217}
3218
3219static int opt_sections(void *optctx, const char *opt, const char *arg)
3220{
3221 printf("Sections:\n"
3222 "W... = Section is a wrapper (contains other sections, no local entries)\n"
3223 ".A.. = Section contains an array of elements of the same type\n"
3224 "..V. = Section may contain a variable number of fields with variable keys\n"
3225 "...T = Section contain a unique type\n"
3226 "FLAGS NAME/UNIQUE_NAME\n"
3227 "----\n");
3229 return 0;
3230}
3231
3232static int opt_codec(void *optctx, const char *opt, const char *arg)
3233{
3234 const char *spec = strchr(opt, ':');
3235 const char **name;
3236 if (!spec) {
3238 "No media specifier was specified for '%s' in option '%s'. Use -%s:<media_spec> "
3239 "where <media_spec> can be one of: 'a' (audio), 'v' (video), 's' (subtitle), 'd' (data)\n",
3240 arg, opt, opt);
3241 return AVERROR(EINVAL);
3242 }
3243 spec++;
3244
3245 switch (spec[0]) {
3246 case 'a' : name = &audio_codec_name; break;
3247 case 'd' : name = &data_codec_name; break;
3248 case 's' : name = &subtitle_codec_name; break;
3249 case 'v' : name = &video_codec_name; break;
3250 default:
3252 "Invalid media specifier '%s' in option '%s'. "
3253 "Must be one of: 'a' (audio), 'v' (video), 's' (subtitle), 'd' (data)\n", spec, opt);
3254 return AVERROR(EINVAL);
3255 }
3256
3257 av_freep(name);
3258 *name = av_strdup(arg);
3259 return *name ? 0 : AVERROR(ENOMEM);
3260}
3261
3262static int opt_show_versions(void *optctx, const char *opt, const char *arg)
3263{
3266 return 0;
3267}
3268
3269#define DEFINE_OPT_SHOW_SECTION(section, target_section_id) \
3270 static int opt_show_##section(void *optctx, const char *opt, const char *arg) \
3271 { \
3272 mark_section_show_entries(SECTION_ID_##target_section_id, 1, NULL); \
3273 return 0; \
3274 }
3275
3276DEFINE_OPT_SHOW_SECTION(chapters, CHAPTERS)
3280DEFINE_OPT_SHOW_SECTION(library_versions, LIBRARY_VERSIONS)
3281DEFINE_OPT_SHOW_SECTION(packets, PACKETS)
3283DEFINE_OPT_SHOW_SECTION(program_version, PROGRAM_VERSION)
3284DEFINE_OPT_SHOW_SECTION(streams, STREAMS)
3285DEFINE_OPT_SHOW_SECTION(programs, PROGRAMS)
3286DEFINE_OPT_SHOW_SECTION(stream_groups, STREAM_GROUPS)
3287
3288static const OptionDef real_options[] = {
3290 { "f", OPT_TYPE_FUNC, OPT_FUNC_ARG, {.func_arg = opt_format}, "force format", "format" },
3291 { "unit", OPT_TYPE_BOOL, 0, {&show_value_unit}, "show unit of the displayed values" },
3292 { "prefix", OPT_TYPE_BOOL, 0, {&use_value_prefix}, "use SI prefixes for the displayed values" },
3293 { "byte_binary_prefix", OPT_TYPE_BOOL, 0, {&use_byte_value_binary_prefix},
3294 "use binary prefixes for byte units" },
3295 { "sexagesimal", OPT_TYPE_BOOL, 0, {&use_value_sexagesimal_format},
3296 "use sexagesimal format HOURS:MM:SS.MICROSECONDS for time units" },
3297 { "pretty", OPT_TYPE_FUNC, 0, {.func_arg = opt_pretty},
3298 "prettify the format of displayed values, make it more human readable" },
3299 { "output_format", OPT_TYPE_STRING, 0, { &output_format },
3300 "set the output printing format (available formats are: default, compact, csv, flat, ini, json, xml)", "format" },
3301 { "print_format", OPT_TYPE_STRING, 0, { &output_format }, "alias for -output_format (deprecated)" },
3302 { "of", OPT_TYPE_STRING, 0, { &output_format }, "alias for -output_format", "format" },
3303 { "select_streams", OPT_TYPE_STRING, 0, { &stream_specifier }, "select the specified streams", "stream_specifier" },
3304 { "sections", OPT_TYPE_FUNC, OPT_EXIT, {.func_arg = opt_sections}, "print sections structure and section information, and exit" },
3305 { "data_dump_format", OPT_TYPE_STRING, 0, { &data_dump_format }, "set data dump format (available formats are: xxd, base64)" },
3306 { "show_data", OPT_TYPE_BOOL, 0, { &do_show_data }, "show packets data" },
3307 { "show_data_hash", OPT_TYPE_STRING, 0, { &show_data_hash }, "show packets data hash" },
3308 { "show_error", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_error }, "show probing error" },
3309 { "show_format", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_format }, "show format/container info" },
3310 { "show_frames", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_frames }, "show frames info" },
3311 { "show_entries", OPT_TYPE_FUNC, OPT_FUNC_ARG, {.func_arg = opt_show_entries},
3312 "show a set of specified entries", "entry_list" },
3313#if HAVE_THREADS
3314 { "show_log", OPT_TYPE_INT, 0, { &do_show_log }, "show log" },
3315#endif
3316 { "show_packets", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_packets }, "show packets info" },
3317 { "show_programs", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_programs }, "show programs info" },
3318 { "show_stream_groups", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_stream_groups }, "show stream groups info" },
3319 { "show_streams", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_streams }, "show streams info" },
3320 { "show_chapters", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_chapters }, "show chapters info" },
3321 { "count_frames", OPT_TYPE_BOOL, 0, { &do_count_frames }, "count the number of frames per stream" },
3322 { "count_packets", OPT_TYPE_BOOL, 0, { &do_count_packets }, "count the number of packets per stream" },
3323 { "show_program_version", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_program_version }, "show ffprobe version" },
3324 { "show_library_versions", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_library_versions }, "show library versions" },
3325 { "show_versions", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_versions }, "show program and library versions" },
3326 { "show_pixel_formats", OPT_TYPE_FUNC, 0, { .func_arg = &opt_show_pixel_formats }, "show pixel format descriptions" },
3327 { "show_optional_fields", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = &opt_show_optional_fields }, "show optional fields" },
3328 { "show_private_data", OPT_TYPE_BOOL, 0, { &show_private_data }, "show private data" },
3329 { "private", OPT_TYPE_BOOL, 0, { &show_private_data }, "same as show_private_data" },
3330 { "analyze_frames", OPT_TYPE_BOOL, 0, { &do_analyze_frames }, "analyze frames to provide additional stream-level information" },
3331 { "bitexact", OPT_TYPE_BOOL, 0, {&do_bitexact}, "force bitexact output" },
3332 { "read_intervals", OPT_TYPE_FUNC, OPT_FUNC_ARG, {.func_arg = opt_read_intervals}, "set read intervals", "read_intervals" },
3333 { "i", OPT_TYPE_FUNC, OPT_FUNC_ARG, {.func_arg = opt_input_file_i}, "read specified file", "input_file"},
3334 { "o", OPT_TYPE_FUNC, OPT_FUNC_ARG, {.func_arg = opt_output_file_o}, "write to specified output", "output_file"},
3335 { "print_filename", OPT_TYPE_FUNC, OPT_FUNC_ARG, {.func_arg = opt_print_filename}, "override the printed input filename", "print_file"},
3336 { "find_stream_info", OPT_TYPE_BOOL, OPT_INPUT | OPT_EXPERT, { &find_stream_info },
3337 "read and decode the streams to fill missing information with heuristics" },
3338 { "c", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = opt_codec}, "force decoder", "decoder_name" },
3339 { "codec", OPT_TYPE_FUNC, OPT_FUNC_ARG, { .func_arg = opt_codec}, "alias for -c (force decoder)", "decoder_name" },
3340 { NULL, },
3341};
3342
3343static inline int check_section_show_entries(int section_id)
3344{
3345 const EntrySelection *selection = &selected_entries[section_id];
3346
3347 if (selection->show_all_entries || selection->entries_to_show)
3348 return 1;
3349
3350 const AVTextFormatSection *section = &sections[section_id];
3351 for (const int *id = section->children_ids; *id != -1; id++)
3353 return 1;
3354 return 0;
3355}
3356
3357#define SET_DO_SHOW(id, varname) do { \
3358 if (check_section_show_entries(SECTION_ID_##id)) \
3359 do_show_##varname = 1; \
3360 } while (0)
3361
3362int main(int argc, char **argv)
3363{
3364 const AVTextFormatter *f;
3365 AVTextFormatContext *tctx;
3366 AVTextWriterContext *wctx;
3367 char *buf;
3368 char *f_name = NULL, *f_args = NULL;
3369 int ret, input_ret;
3371
3372 init_dynload();
3373
3374 setvbuf(stderr, NULL, _IONBF, 0); /* win32 runtime needs this */
3375
3377
3379 parse_loglevel(argc, argv, options);
3381#if CONFIG_AVDEVICE
3383#endif
3384
3385 show_banner(argc, argv, options);
3386 ret = parse_options(NULL, argc, argv, options, opt_input_file);
3387 if (ret < 0) {
3388 ret = (ret == AVERROR_EXIT) ? 0 : ret;
3389 goto end;
3390 }
3391
3392 if (do_show_log)
3394
3395 /* mark things to show, based on -show_entries */
3396 SET_DO_SHOW(CHAPTERS, chapters);
3398 SET_DO_SHOW(FORMAT, format);
3399 SET_DO_SHOW(FRAMES, frames);
3400 SET_DO_SHOW(LIBRARY_VERSIONS, library_versions);
3401 SET_DO_SHOW(PACKETS, packets);
3402 SET_DO_SHOW(PIXEL_FORMATS, pixel_formats);
3403 SET_DO_SHOW(PIXEL_FORMAT_FLAGS, pixel_format_flags);
3404 SET_DO_SHOW(PIXEL_FORMAT_COMPONENTS, pixel_format_components);
3405 SET_DO_SHOW(PROGRAM_VERSION, program_version);
3406 SET_DO_SHOW(PROGRAMS, programs);
3407 SET_DO_SHOW(STREAM_GROUP_DISPOSITION, stream_group_disposition);
3408 SET_DO_SHOW(STREAM_GROUPS, stream_groups);
3409 SET_DO_SHOW(STREAM_GROUP_COMPONENTS, stream_group_components);
3410 SET_DO_SHOW(STREAMS, streams);
3411 SET_DO_SHOW(STREAM_DISPOSITION, stream_disposition);
3412 SET_DO_SHOW(PROGRAM_STREAM_DISPOSITION, stream_disposition);
3413 SET_DO_SHOW(STREAM_GROUP_STREAM_DISPOSITION, stream_disposition);
3414
3415 SET_DO_SHOW(CHAPTER_TAGS, chapter_tags);
3416 SET_DO_SHOW(FORMAT_TAGS, format_tags);
3417 SET_DO_SHOW(FRAME_TAGS, frame_tags);
3418 SET_DO_SHOW(PROGRAM_TAGS, program_tags);
3419 SET_DO_SHOW(STREAM_GROUP_TAGS, stream_group_tags);
3420 SET_DO_SHOW(STREAM_TAGS, stream_tags);
3421 SET_DO_SHOW(PROGRAM_STREAM_TAGS, stream_tags);
3422 SET_DO_SHOW(STREAM_GROUP_STREAM_TAGS, stream_tags);
3423 SET_DO_SHOW(PACKET_TAGS, packet_tags);
3424
3427 "-bitexact and -show_program_version or -show_library_versions "
3428 "options are incompatible\n");
3429 ret = AVERROR(EINVAL);
3430 goto end;
3431 }
3432
3433 if (!output_format)
3434 output_format = av_strdup("default");
3435 if (!output_format) {
3436 ret = AVERROR(ENOMEM);
3437 goto end;
3438 }
3439 f_name = av_strtok(output_format, "=", &buf);
3440 if (!f_name) {
3442 "No name specified for the output format\n");
3443 ret = AVERROR(EINVAL);
3444 goto end;
3445 }
3446 f_args = buf;
3447
3449 if (!f) {
3450 av_log(NULL, AV_LOG_ERROR, "Unknown output format with name '%s'\n", f_name);
3451 ret = AVERROR(EINVAL);
3452 goto end;
3453 }
3454
3455 if (data_dump_format) {
3456 if (!strcmp(data_dump_format, "xxd")) {
3457 data_dump_format_id = AV_TEXTFORMAT_DATADUMP_XXD;
3458 } else if (!strcmp(data_dump_format, "base64")) {
3459 data_dump_format_id = AV_TEXTFORMAT_DATADUMP_BASE64;
3460 } else {
3461 av_log(NULL, AV_LOG_ERROR, "Unknown data dump format with name '%s'\n", data_dump_format);
3462 ret = AVERROR(EINVAL);
3463 goto end;
3464 }
3465 }
3466
3467 if (output_filename) {
3469 } else
3470 ret = avtextwriter_create_stdout(&wctx);
3471
3472 if (ret < 0)
3473 goto end;
3474
3475 AVTextFormatOptions tf_options = {
3476 .is_key_selected = is_key_selected_callback,
3477 .show_optional_fields = show_optional_fields,
3478 .show_value_unit = show_value_unit,
3479 .use_value_prefix = use_value_prefix,
3480 .use_byte_value_binary_prefix = use_byte_value_binary_prefix,
3481 .use_value_sexagesimal_format = use_value_sexagesimal_format,
3482 .data_dump_format = data_dump_format_id,
3483 };
3484
3485 if ((ret = avtext_context_open(&tctx, f, wctx, f_args, sections, FF_ARRAY_ELEMS(sections), tf_options, show_data_hash)) >= 0) {
3486 if (f == &avtextformatter_xml)
3488
3490
3497
3498 if (!input_filename &&
3501 show_usage();
3502 av_log(NULL, AV_LOG_ERROR, "You have to specify one input file.\n");
3503 av_log(NULL, AV_LOG_ERROR, "Use -h to get full help or, even better, run 'man %s'.\n", program_name);
3504 ret = AVERROR(EINVAL);
3505 } else if (input_filename) {
3507 if (ret < 0 && do_show_error)
3508 show_error(tctx, ret);
3509 }
3510
3511 input_ret = ret;
3512
3514
3515 ret = avtextwriter_context_close(&wctx);
3516 if (ret < 0)
3517 av_log(NULL, AV_LOG_ERROR, "Writing output failed (closing writer): %s\n", av_err2str(ret));
3518
3519 ret = avtext_context_close(&tctx);
3520 if (ret < 0)
3521 av_log(NULL, AV_LOG_ERROR, "Writing output failed (closing formatter): %s\n", av_err2str(ret));
3522
3523 ret = FFMIN(ret, input_ret);
3524 }
3525
3526end:
3532
3533 uninit_opts();
3534 for (size_t i = 0; i < FF_ARRAY_ELEMS(selected_entries); ++i)
3535 av_dict_free(&selected_entries[i].entries_to_show);
3536
3538
3539 return ret < 0;
3540}
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_PARAMS_NONE
Definition avformat.h:1147
@ AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION
Definition avformat.h:1149
@ AV_STREAM_GROUP_PARAMS_TILE_GRID
Definition avformat.h:1150
@ AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT
Definition avformat.h:1148
#define AVFMT_SHOW_IDS
Show format stream IDs numbers.
Definition avformat.h:496
const char * av_disposition_to_string(int disposition)
Definition options.c:587
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
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:122
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
Definition bprint.c:69
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:140
void init_dynload(void)
Initialize dynamic library loading.
Definition cmdutils.c:75
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:556
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:107
void log_callback_help(void *ptr, int level, const char *fmt, va_list vl)
Trivial log callback.
Definition cmdutils.c:70
AVDictionary * format_opts
Definition cmdutils.c:58
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:420
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:1423
AVDictionary * codec_opts
Definition cmdutils.c:58
void uninit_opts(void)
Uninitialize the cmdutils option system, in particular free the *_opts contexts and their contents.
Definition cmdutils.c:62
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:1491
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:84
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
@ AV_FIELD_TT
Top coded_first, top displayed first.
Definition defs.h:214
@ AV_FIELD_BB
Bottom coded first, bottom displayed first.
Definition defs.h:215
@ AV_FIELD_PROGRESSIVE
Definition defs.h:213
@ AV_FIELD_BT
Bottom coded first, top displayed first.
Definition defs.h:217
@ AV_FIELD_TB
Top coded first, bottom displayed first.
Definition defs.h:216
AVAudioServiceType
Definition defs.h:235
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
const char * key
static int opt_format(void *optctx, const char *opt, const char *arg)
Definition ffplay.c:3669
static int find_stream_info
Definition ffplay.c:352
static int opt_codec(void *optctx, const char *opt, const char *arg)
Definition ffplay.c:3727
static int opt_input_file(void *optctx, const char *filename)
Definition ffplay.c:3710
static const char * video_codec_name
Definition ffplay.c:344
static const char * input_filename
Definition ffplay.c:309
static const char * audio_codec_name
Definition ffplay.c:342
static const char * subtitle_codec_name
Definition ffplay.c:343
static void show_usage(void)
Definition ffprobe.c:2781
static char * stream_specifier
Definition ffprobe.c:146
static void log_callback(void *ptr, int level, const char *fmt, va_list vl)
Definition ffprobe.c:381
#define print_list_fmt(k, f, n, m,...)
Definition ffprobe.c:437
static void print_pixel_format(AVTextFormatContext *tfc, enum AVPixelFormat pix_fmt)
Definition ffprobe.c:1211
SectionID
Definition ffprobe.c:165
@ SECTION_ID_FRAME_SIDE_DATA
Definition ffprobe.c:176
@ SECTION_ID_STREAM_TAGS
Definition ffprobe.c:230
@ SECTION_ID_STREAM_GROUP_PIECES
Definition ffprobe.c:213
@ SECTION_ID_PROGRAM_STREAM
Definition ffprobe.c:202
@ SECTION_ID_PACKET
Definition ffprobe.c:187
@ SECTION_ID_STREAM_GROUP_SUBPIECES
Definition ffprobe.c:215
@ SECTION_ID_PROGRAM_VERSION
Definition ffprobe.c:204
@ SECTION_ID_STREAM_GROUP_PIECE
Definition ffprobe.c:214
@ SECTION_ID_STREAM_GROUP_STREAM_TAGS
Definition ffprobe.c:207
@ SECTION_ID_PIXEL_FORMAT_FLAGS
Definition ffprobe.c:194
@ SECTION_ID_STREAM_GROUP_STREAM
Definition ffprobe.c:222
@ SECTION_ID_STREAM_GROUP_BLOCK
Definition ffprobe.c:218
@ SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION
Definition ffprobe.c:206
@ SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST
Definition ffprobe.c:179
@ SECTION_ID_PROGRAM_TAGS
Definition ffprobe.c:203
@ SECTION_ID_PIXEL_FORMATS
Definition ffprobe.c:197
@ SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST
Definition ffprobe.c:181
@ SECTION_ID_STREAM_GROUP_SUBPIECE
Definition ffprobe.c:216
@ SECTION_ID_STREAM
Definition ffprobe.c:227
@ SECTION_ID_LIBRARY_VERSION
Definition ffprobe.c:185
@ SECTION_ID_FRAMES
Definition ffprobe.c:173
@ SECTION_ID_STREAM_SIDE_DATA
Definition ffprobe.c:232
@ SECTION_ID_PACKETS_AND_FRAMES
Definition ffprobe.c:190
@ SECTION_ID_STREAM_GROUP_STREAMS
Definition ffprobe.c:221
@ SECTION_ID_PACKET_SIDE_DATA_LIST
Definition ffprobe.c:191
@ SECTION_ID_PROGRAM_STREAM_DISPOSITION
Definition ffprobe.c:198
@ SECTION_ID_FRAME_SIDE_DATA_TIMECODE_LIST
Definition ffprobe.c:177
@ SECTION_ID_FRAME_SIDE_DATA_PIECE
Definition ffprobe.c:182
@ SECTION_ID_PACKETS
Definition ffprobe.c:189
@ SECTION_ID_FRAME_TAGS
Definition ffprobe.c:174
@ SECTION_ID_LIBRARY_VERSIONS
Definition ffprobe.c:186
@ SECTION_ID_STREAM_SIDE_DATA_LIST
Definition ffprobe.c:231
@ SECTION_ID_PROGRAMS
Definition ffprobe.c:205
@ SECTION_ID_STREAM_GROUP_SUBCOMPONENTS
Definition ffprobe.c:211
@ SECTION_ID_PROGRAM_STREAM_TAGS
Definition ffprobe.c:199
@ SECTION_ID_FORMAT_TAGS
Definition ffprobe.c:171
@ SECTION_ID_CHAPTERS
Definition ffprobe.c:168
@ SECTION_ID_FRAME_SIDE_DATA_TIMECODE
Definition ffprobe.c:178
@ SECTION_ID_FRAME_LOGS
Definition ffprobe.c:184
@ SECTION_ID_STREAM_GROUP_TAGS
Definition ffprobe.c:224
@ SECTION_ID_PIXEL_FORMAT_COMPONENTS
Definition ffprobe.c:196
@ SECTION_ID_FORMAT
Definition ffprobe.c:170
@ SECTION_ID_STREAM_GROUP_COMPONENT
Definition ffprobe.c:210
@ SECTION_ID_PACKET_TAGS
Definition ffprobe.c:188
@ SECTION_ID_PIXEL_FORMAT_COMPONENT
Definition ffprobe.c:195
@ SECTION_ID_SUBTITLE
Definition ffprobe.c:233
@ SECTION_ID_STREAM_GROUP
Definition ffprobe.c:208
@ SECTION_ID_PIXEL_FORMAT
Definition ffprobe.c:193
@ SECTION_ID_FRAME_SIDE_DATA_LIST
Definition ffprobe.c:175
@ SECTION_ID_FRAME_SIDE_DATA_COMPONENT
Definition ffprobe.c:180
@ SECTION_ID_STREAMS
Definition ffprobe.c:229
@ SECTION_ID_CHAPTER_TAGS
Definition ffprobe.c:167
@ SECTION_ID_STREAM_GROUP_SUBCOMPONENT
Definition ffprobe.c:212
@ SECTION_ID_STREAM_GROUP_SIDE_DATA
Definition ffprobe.c:220
@ SECTION_ID_ERROR
Definition ffprobe.c:169
@ SECTION_ID_STREAM_GROUPS
Definition ffprobe.c:225
@ SECTION_ID_STREAM_GROUP_SIDE_DATA_LIST
Definition ffprobe.c:219
@ SECTION_ID_FRAME_LOG
Definition ffprobe.c:183
@ SECTION_ID_FRAME
Definition ffprobe.c:172
@ SECTION_ID_STREAM_GROUP_BLOCKS
Definition ffprobe.c:217
@ SECTION_ID_PACKET_SIDE_DATA
Definition ffprobe.c:192
@ SECTION_ID_STREAM_DISPOSITION
Definition ffprobe.c:228
@ SECTION_ID_ROOT
Definition ffprobe.c:226
@ SECTION_ID_STREAM_GROUP_COMPONENTS
Definition ffprobe.c:209
@ SECTION_ID_STREAM_GROUP_DISPOSITION
Definition ffprobe.c:223
@ SECTION_ID_CHAPTER
Definition ffprobe.c:166
@ SECTION_ID_PROGRAM_STREAMS
Definition ffprobe.c:201
@ SECTION_ID_PROGRAM
Definition ffprobe.c:200
static void ffprobe_show_program_version(AVTextFormatContext *tfc)
Definition ffprobe.c:2788
static void print_context_light_level(AVTextFormatContext *tfc, const AVContentLightMetadata *metadata)
Definition ffprobe.c:566
static void ffprobe_show_library_versions(AVTextFormatContext *tfc)
Definition ffprobe.c:2819
static void print_iamf_param_definition(AVTextFormatContext *tfc, const char *name, const AVIAMFParamDefinition *param, SectionID section_id)
Definition ffprobe.c:2186
static int use_byte_value_binary_prefix
Definition ffprobe.c:131
static int do_show_frame_tags
Definition ffprobe.c:123
#define CHECK_END
static int do_show_pixel_format_flags
Definition ffprobe.c:117
#define SHOW_LIB_VERSION(libname, LIBNAME)
Definition ffprobe.c:2804
static const OptionDef real_options[]
Definition ffprobe.c:3288
static ReadInterval * read_intervals
Definition ffprobe.c:158
static const char * print_input_filename
Definition ffprobe.c:344
#define print_ts(k, v)
Definition ffprobe.c:455
static int do_show_chapter_tags
Definition ffprobe.c:121
#define print_int(k, v)
Definition ffprobe.c:449
static char * show_data_hash
Definition ffprobe.c:147
static void print_color_trc(AVTextFormatContext *tfc, enum AVColorTransferCharacteristic color_trc)
Definition ffprobe.c:1266
static void print_stream_group_params(AVTextFormatContext *tfc, AVStreamGroup *stg)
Definition ffprobe.c:2359
static const char unit_byte_str[]
Definition ffprobe.c:349
static int do_show_stream_group_components
Definition ffprobe.c:109
static LogBuffer * log_buffer
Definition ffprobe.c:370
#define SHOW_OPTIONAL_FIELDS_AUTO
Definition ffprobe.c:140
static int opt_format(void *optctx, const char *opt, const char *arg)
Definition ffprobe.c:2900
static void print_alpha_mode(AVTextFormatContext *tfc, enum AVAlphaMode alpha_mode)
Definition ffprobe.c:1286
static int show_value_unit
Definition ffprobe.c:129
static int opt_read_intervals(void *optctx, const char *opt, const char *arg)
Definition ffprobe.c:3187
static int * streams_with_closed_captions
Definition ffprobe.c:356
static const char * get_raw_string_type(const void *data)
Definition ffprobe.c:248
#define GET_DECODER(type_)
static void print_color_range(AVTextFormatContext *tfc, enum AVColorRange color_range)
Definition ffprobe.c:1236
static void print_displaymatrix(AVTextFormatContext *tfc, const int32_t matrix[9])
Definition ffprobe.c:536
static void print_chroma_location(AVTextFormatContext *tfc, enum AVChromaLocation chroma_location)
Definition ffprobe.c:1276
static int opt_codec(void *optctx, const char *opt, const char *arg)
Definition ffprobe.c:3232
static int show_programs(AVTextFormatContext *tfc, InputFile *ifile)
Definition ffprobe.c:2136
static void show_error(AVTextFormatContext *tfc, int err)
Definition ffprobe.c:2488
static EntrySelection selected_entries[FF_ARRAY_ELEMS(sections)]
Definition ffprobe.c:338
static void print_color_space(AVTextFormatContext *tfc, enum AVColorSpace color_space)
Definition ffprobe.c:1246
static int do_show_frames
Definition ffprobe.c:105
static uint64_t * nb_streams_packets
Definition ffprobe.c:353
static void print_tile_grid_params(AVTextFormatContext *tfc, const AVStreamGroup *stg, const AVStreamGroupTileGrid *tile_grid)
Definition ffprobe.c:2154
static int do_show_program_tags
Definition ffprobe.c:124
static int do_show_format
Definition ffprobe.c:104
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:3057
static int show_stream_groups(AVTextFormatContext *tfc, InputFile *ifile)
Definition ffprobe.c:2415
static int read_interval_packets(AVTextFormatContext *tfc, InputFile *ifile, const ReadInterval *interval, int64_t *cur_ts)
Definition ffprobe.c:1689
static int do_show_packets
Definition ffprobe.c:106
static const char unit_hertz_str[]
Definition ffprobe.c:348
#define print_int_fmt(k, v, f, u)
Definition ffprobe.c:459
static int do_show_data
Definition ffprobe.c:113
static int show_tags(AVTextFormatContext *tfc, AVDictionary *tags, int section_id)
Definition ffprobe.c:494
static int opt_pretty(void *optctx, const char *opt, const char *arg)
Definition ffprobe.c:3192
static av_always_inline int process_frame(AVTextFormatContext *tfc, InputFile *ifile, AVFrame *frame, const AVPacket *pkt, int *packet_new)
Definition ffprobe.c:1592
#define print_str_validate(k, v)
Definition ffprobe.c:453
static const char * get_stream_group_type(const void *data)
Definition ffprobe.c:253
#define IN_STREAM_GROUP
Definition ffprobe.c:1861
static int do_count_packets
Definition ffprobe.c:99
static int opt_show_optional_fields(void *optctx, const char *opt, const char *arg)
Definition ffprobe.c:2883
static int show_stream_group(AVTextFormatContext *tfc, InputFile *ifile, AVStreamGroup *stg)
Definition ffprobe.c:2371
static int show_stream(AVTextFormatContext *tfc, AVFormatContext *fmt_ctx, int stream_idx, InputStream *ist, int container)
Definition ffprobe.c:1863
static const AVInputFormat * iformat
Definition ffprobe.c:345
static const char unit_bit_per_second_str[]
Definition ffprobe.c:350
static const AVTextFormatSection sections[]
Definition ffprobe.c:259
static void print_dovi_metadata(AVTextFormatContext *tfc, const AVDOVIMetadata *dovi)
Definition ffprobe.c:573
#define print_str(k, v)
Definition ffprobe.c:451
static void show_frame(AVTextFormatContext *tfc, AVFrame *frame, AVStream *stream, AVFormatContext *fmt_ctx)
Definition ffprobe.c:1505
static void flush_buffers(InputFile *ifile)
Definition ffprobe.c:1812
static void print_iamf_submix_params(AVTextFormatContext *tfc, const AVIAMFSubmix *submix)
Definition ffprobe.c:2293
static void ffprobe_show_pixel_formats(AVTextFormatContext *tfc)
Definition ffprobe.c:2837
#define print_duration_ts(k, v)
Definition ffprobe.c:457
static void show_packet(AVTextFormatContext *tfc, InputFile *ifile, AVPacket *pkt, int packet_idx)
Definition ffprobe.c:1347
static char * data_dump_format
Definition ffprobe.c:148
static int do_count_frames
Definition ffprobe.c:98
static int show_format(AVTextFormatContext *tfc, InputFile *ifile)
Definition ffprobe.c:2457
static char * output_format
Definition ffprobe.c:145
static int do_show_error
Definition ffprobe.c:103
void show_help_default(const char *opt, const char *arg)
Per-fftool specific help handler.
Definition ffprobe.c:3041
#define print_str_opt(k, v)
Definition ffprobe.c:452
static uint64_t * nb_streams_frames
Definition ffprobe.c:354
static int read_packets(AVTextFormatContext *tfc, InputFile *ifile)
Definition ffprobe.c:1824
static void print_film_grain_params(AVTextFormatContext *tfc, const AVFilmGrainParams *fgp)
Definition ffprobe.c:967
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:462
static int do_show_pixel_format_components
Definition ffprobe.c:118
#define print_val(k, v, u)
Definition ffprobe.c:458
static int show_chapters(AVTextFormatContext *tfc, InputFile *ifile)
Definition ffprobe.c:2432
static int opt_input_file(void *optctx, const char *arg)
Definition ffprobe.c:2994
static int do_show_packet_tags
Definition ffprobe.c:127
#define DEFINE_OPT_SHOW_SECTION(section, target_section_id)
Definition ffprobe.c:3269
static void print_mastering_display_metadata(AVTextFormatContext *tfc, const AVMasteringDisplayMetadata *metadata)
Definition ffprobe.c:545
static int read_intervals_nb
Definition ffprobe.c:159
static void log_read_interval(const ReadInterval *interval, void *log_ctx, int log_level)
Definition ffprobe.c:1665
static int check_section_show_entries(int section_id)
Definition ffprobe.c:3343
static void print_primaries(AVTextFormatContext *tfc, enum AVColorPrimaries color_primaries)
Definition ffprobe.c:1256
static const char * get_packet_side_data_type(const void *data)
Definition ffprobe.c:236
#define SET_DO_SHOW(id, varname)
Definition ffprobe.c:3357
#define print_q(k, v, s)
Definition ffprobe.c:450
static void print_ambient_viewing_environment(AVTextFormatContext *tfc, const AVAmbientViewingEnvironment *env)
Definition ffprobe.c:956
static void print_iamf_audio_element_params(AVTextFormatContext *tfc, const AVStreamGroup *stg, const AVIAMFAudioElement *audio_element)
Definition ffprobe.c:2252
static int match_section(const char *section_name, int show_all_entries, AVDictionary *entries)
Definition ffprobe.c:2925
static int opt_show_entries(void *optctx, const char *opt, const char *arg)
Definition ffprobe.c:2944
static int do_show_stream_groups
Definition ffprobe.c:108
static int do_show_programs
Definition ffprobe.c:107
static void close_input_file(InputFile *ifile)
Definition ffprobe.c:2673
static void print_section(SectionID id, int level)
Definition ffprobe.c:3201
static const char * get_frame_side_data_type(const void *data)
Definition ffprobe.c:242
static int do_show_library_versions
Definition ffprobe.c:115
static const char * data_codec_name
Definition ffprobe.c:136
static const char * output_filename
Definition ffprobe.c:346
static int probe_file(AVTextFormatContext *tfc, const char *filename, const char *print_filename)
Definition ffprobe.c:2686
static int do_show_stream_tags
Definition ffprobe.c:126
static const AVCodec * get_decoder_for_stream(AVFormatContext *fmt_ctx, AVStream *stream)
Definition ffprobe.c:2525
static int do_show_program_version
Definition ffprobe.c:114
static int do_read_packets
Definition ffprobe.c:101
static int opt_print_filename(void *optctx, const char *opt, const char *arg)
Definition ffprobe.c:3034
static int do_bitexact
Definition ffprobe.c:97
#define print_decibel(k, v)
Definition ffprobe.c:460
static int use_value_prefix
Definition ffprobe.c:130
static void print_dispositions(AVTextFormatContext *tfc, uint32_t disposition, SectionID section_id)
Definition ffprobe.c:1848
static int opt_input_file_i(void *optctx, const char *opt, const char *arg)
Definition ffprobe.c:3011
static int * selected_streams
Definition ffprobe.c:355
static int show_log(AVTextFormatContext *tfc, int section_ids, int section_id, int log_level)
Definition ffprobe.c:1312
#define print_duration_time(k, v, tb)
Definition ffprobe.c:456
static void print_dynamic_hdr_vivid(AVTextFormatContext *tfc, const AVDynamicHDRVivid *metadata)
Definition ffprobe.c:886
static int show_optional_fields
Definition ffprobe.c:143
static void print_pkt_side_data(AVTextFormatContext *tfc, int width, int height, const AVPacketSideData *sd, SectionID id_data)
Definition ffprobe.c:1092
static AVMutex log_mutex
Definition ffprobe.c:359
static int do_show_streams
Definition ffprobe.c:110
static int do_show_log
Definition ffprobe.c:119
static int do_show_chapters
Definition ffprobe.c:102
static int show_private_data
Definition ffprobe.c:133
static int do_show_stream_group_tags
Definition ffprobe.c:125
static void print_dynamic_hdr10_plus(AVTextFormatContext *tfc, const AVDynamicHDRPlus *metadata)
Definition ffprobe.c:735
static int opt_output_file_o(void *optctx, const char *opt, const char *arg)
Definition ffprobe.c:3017
static int do_show_stream_group_disposition
Definition ffprobe.c:112
static int do_show_pixel_formats
Definition ffprobe.c:116
static int do_analyze_frames
Definition ffprobe.c:96
static int do_show_stream_disposition
Definition ffprobe.c:111
static void print_frame_side_data(AVTextFormatContext *tfc, const AVFrame *frame, const AVStream *stream)
Definition ffprobe.c:1430
static int set_decoders(AVFormatContext *fmt_ctx)
Definition ffprobe.c:2510
static int log_buffer_size
Definition ffprobe.c:371
#define SHOW_OPTIONAL_FIELDS_ALWAYS
Definition ffprobe.c:142
static int open_input_file(InputFile *ifile, const char *filename, const char *print_filename)
Definition ffprobe.c:2555
static void mark_section_show_entries(SectionID section_id, int show_all_entries, AVDictionary *entries)
Definition ffprobe.c:2910
#define print_time(k, v, tb)
Definition ffprobe.c:454
static int use_value_sexagesimal_format
Definition ffprobe.c:132
static int * streams_with_film_grain
Definition ffprobe.c:357
static int do_read_frames
Definition ffprobe.c:100
static void print_downmix_info(AVTextFormatContext *tfc, const AVDownmixInfo *downmix_info)
Definition ffprobe.c:512
static int opt_sections(void *optctx, const char *opt, const char *arg)
Definition ffprobe.c:3219
#define REALLOCZ_ARRAY_STREAM(ptr, cur_n, new_n)
Definition ffprobe.c:486
static void clear_log(int need_lock)
Definition ffprobe.c:1296
static int is_key_selected_callback(AVTextFormatContext *tctx, const char *key)
Definition ffprobe.c:373
static int show_program(AVTextFormatContext *tfc, InputFile *ifile, AVProgram *program)
Definition ffprobe.c:2105
#define IN_PROGRAM
Definition ffprobe.c:1860
static int parse_read_intervals(const char *intervals_spec)
Definition ffprobe.c:3139
#define PRINT_PIX_FMT_FLAG(flagname, name)
Definition ffprobe.c:2832
static void print_dynamic_hdr_smpte2094_app5(AVTextFormatContext *tfc, const AVDynamicHDRSmpte2094App5 *metadata)
Definition ffprobe.c:830
static int do_show_format_tags
Definition ffprobe.c:122
static int get_decoder_by_name(const char *codec_name, const AVCodec **codec)
Definition ffprobe.c:2496
static int opt_show_versions(void *optctx, const char *opt, const char *arg)
Definition ffprobe.c:3262
static unsigned int nb_streams
Definition ffprobe.c:352
#define print_fmt(k, f,...)
Definition ffprobe.c:431
static void print_iamf_mix_presentation_params(AVTextFormatContext *tfc, const AVStreamGroup *stg, const AVIAMFMixPresentation *mix_presentation)
Definition ffprobe.c:2340
static void show_subtitle(AVTextFormatContext *tfc, AVSubtitle *sub, AVStream *stream, AVFormatContext *fmt_ctx)
Definition ffprobe.c:1404
static int show_streams(AVTextFormatContext *tfc, InputFile *ifile)
Definition ffprobe.c:2088
#define SHOW_OPTIONAL_FIELDS_NEVER
Definition ffprobe.c:141
static void print_private_data(AVTextFormatContext *tfc, void *priv_data)
Definition ffprobe.c:1198
@ 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:556
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:144
const AVClass * avcodec_get_class(void)
Get the AVClass for AVCodecContext.
Definition options.c:184
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:991
const AVCodec * avcodec_find_decoder_by_name(const char *name)
Find a registered decoder with the specified name.
Definition allcodecs.c:1019
void avsubtitle_free(AVSubtitle *sub)
Free all allocated data in the given subtitle struct.
Definition avcodec.c:421
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer.
Definition options.c:164
@ 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:614
int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
Alias for avcodec_receive_frame_flags(avctx, frame, 0).
Definition avcodec.c:720
int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt)
Supply raw packet data as input to a decoder.
Definition decode.c:730
int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, const AVPacket *avpkt)
Decode a subtitle message.
Definition decode.c:935
@ AVDISCARD_ALL
discard all
Definition defs.h:232
void avcodec_flush_buffers(AVCodecContext *avctx)
Reset the internal codec state / flush internal buffers.
Definition avcodec.c:389
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_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:657
#define AV_PKT_FLAG_CORRUPT
The packet content is corrupted.
Definition packet.h:651
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition packet.c:434
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition packet.h:650
int av_packet_unpack_dictionary(const uint8_t *data, size_t size, AVDictionary **dict)
Unpack a dictionary from side_data.
Definition packet.c:354
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:580
const char * avformat_stream_group_name(enum AVStreamGroupParamsType type)
Definition avformat.c:269
int avformat_network_init(void)
Do global initialization of network libraries.
Definition utils.c:568
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:664
int av_read_frame(AVFormatContext *s, AVPacket *pkt)
Return the next frame of a stream.
Definition demux.c:1588
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:2606
void avformat_close_input(AVFormatContext **s)
Close an opened input AVFormatContext.
Definition demux.c:377
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:742
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:852
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:788
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:235
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
Append char c n times to a print buffer.
Definition bprint.c:130
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
Definition bprint.c:227
AVBufferRef * av_buffer_allocz(size_t size)
Same as av_buffer_alloc(), except the returned buffer will be initialized to zero.
Definition buffer.c:93
#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:695
#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:700
#define AV_FRAME_FLAG_LOSSLESS
A decoder can use this flag to mark frames which were originally encoded losslessly.
Definition frame.h:708
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
Definition frame.h:687
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:76
@ 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:217
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:35
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:1289
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
Replacements for frequently missing libm functions.
#define isnan(x)
Definition libm.h:342
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:264
Memory handling functions.
uint32_t tag
Definition movenc.c:2087
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:3467
const char * av_color_space_name(enum AVColorSpace space)
Definition pixdesc.c:3860
const char * av_color_range_name(enum AVColorRange range)
Definition pixdesc.c:3776
const char * av_alpha_mode_name(enum AVAlphaMode mode)
Definition pixdesc.c:3925
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:3412
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:3380
const char * av_chroma_location_name(enum AVChromaLocation location)
Definition pixdesc.c:3881
const char * av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
Definition pixdesc.c:3827
const char * av_color_primaries_name(enum AVColorPrimaries primaries)
Definition pixdesc.c:3794
enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
Utility function to swap the endianness of a pixel format.
Definition pixdesc.c:3515
#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:802
@ AVCHROMA_LOC_UNSPECIFIED
Definition pixfmt.h:803
AVColorRange
Visual content value range.
Definition pixfmt.h:748
@ AVCOL_RANGE_UNSPECIFIED
Definition pixfmt.h:749
AVAlphaMode
Correlation between the alpha channel and color values.
Definition pixfmt.h:816
@ AVALPHA_MODE_UNSPECIFIED
Unknown alpha handling, or no alpha channel.
Definition pixfmt.h:817
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:642
@ AVCOL_PRI_UNSPECIFIED
Definition pixfmt.h:645
AVColorTransferCharacteristic
Color Transfer Characteristic.
Definition pixfmt.h:672
@ AVCOL_TRC_UNSPECIFIED
Definition pixfmt.h:675
AVColorSpace
YUV colorspace type.
Definition pixfmt.h:706
@ AVCOL_SPC_UNSPECIFIED
Definition pixfmt.h:709
const char * name
Definition qsvenc.c:142
#define FF_ARRAY_ELEMS(a)
#define snprintf
Definition snprintf.h:34
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:282
int64_t avg_bitrate
Average bitrate of the stream, in bits per second.
Definition defs.h:297
int64_t max_bitrate
Maximum bitrate of the stream, in bits per second.
Definition defs.h:287
int64_t buffer_size
The size of the buffer to which the ratecontrol is applied, in bits.
Definition defs.h:303
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:312
int64_t min_bitrate
Minimum bitrate of the stream, in bits per second.
Definition defs.h:292
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:1293
int64_t start
Definition avformat.h:1295
AVDictionary * metadata
Definition avformat.h:1296
int64_t end
chapter start/end time in time_base units
Definition avformat.h:1295
AVRational time_base
time base in which the start/end timestamps are specified
Definition avformat.h:1294
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:1333
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
Definition avformat.h:1389
AVStream ** streams
A list of all streams in the file.
Definition avformat.h:1401
Structure to hold side data for an AVFrame.
Definition frame.h:327
enum AVFrameSideDataType type
Definition frame.h:328
AVDictionary * metadata
Definition frame.h:331
size_t size
Definition frame.h:330
uint8_t * data
Definition frame.h:329
This structure describes decoded (raw) audio or video data.
Definition frame.h:472
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:424
uint8_t * data
Definition packet.h:425
enum AVPacketSideDataType type
Definition packet.h:427
This structure stores compressed data.
Definition packet.h:580
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:1257
int pmt_pid
Definition avformat.h:1266
unsigned int nb_stream_indexes
Definition avformat.h:1262
int program_num
Definition avformat.h:1265
unsigned int * stream_index
Definition avformat.h:1261
int pcr_pid
Definition avformat.h:1267
AVDictionary * metadata
Definition avformat.h:1263
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
AVStreamGroupTileGrid holds information on how to combine several independent images on a single canv...
Definition avformat.h:973
int nb_coded_side_data
Amount of entries in coded_side_data.
Definition avformat.h:1081
int width
Width of the final image for presentation.
Definition avformat.h:1058
int height
Height of the final image for presentation.
Definition avformat.h:1068
int coded_width
Width of the canvas.
Definition avformat.h:988
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:981
int horizontal_offset
Offset in pixels from the left edge of the canvas where the actual image meant for presentation start...
Definition avformat.h:1040
int horizontal
Offset in pixels from the left edge of the canvas where the tile should be placed.
Definition avformat.h:1017
unsigned int idx
Index of the stream in the group this tile references.
Definition avformat.h:1012
int vertical_offset
Offset in pixels from the top edge of the canvas where the actual image meant for presentation starts...
Definition avformat.h:1047
int coded_height
Width of the canvas.
Definition avformat.h:994
AVPacketSideData * coded_side_data
Additional data associated with the grid.
Definition avformat.h:1076
int vertical
Offset in pixels from the top edge of the canvas where the tile should be placed.
Definition avformat.h:1022
union AVStreamGroup::@166361102046003066253145020066347265153020354020 params
Group type-specific parameters.
enum AVStreamGroupParamsType type
Group type.
Definition avformat.h:1186
struct AVIAMFMixPresentation * iamf_mix_presentation
Definition avformat.h:1193
struct AVStreamGroupTileGrid * tile_grid
Definition avformat.h:1194
unsigned int nb_streams
Number of elements in AVStreamGroup.streams.
Definition avformat.h:1221
AVDictionary * metadata
Metadata that applies to the whole group.
Definition avformat.h:1214
unsigned int index
Group index in AVFormatContext.
Definition avformat.h:1170
struct AVIAMFAudioElement * iamf_audio_element
Definition avformat.h:1192
int disposition
Stream group disposition - a combination of AV_DISPOSITION_* flags.
Definition avformat.h:1244
int64_t id
Group type-specific group ID.
Definition avformat.h:1178
AVStream ** streams
A list of streams in the group.
Definition avformat.h:1234
Stream structure.
Definition avformat.h:766
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition avformat.h:789
int64_t nb_frames
number of frames in this stream if known or 0
Definition avformat.h:827
enum AVDiscard discard
Selects which packets can be discarded at will and do not need to be demuxed.
Definition avformat.h:837
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition avformat.h:825
AVDictionary * metadata
Definition avformat.h:846
int id
Format-specific stream ID.
Definition avformat.h:778
int index
stream index in AVFormatContext
Definition avformat.h:772
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
Definition avformat.h:815
AVRational avg_frame_rate
Average framerate.
Definition avformat.h:855
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
Definition avformat.h:805
AVRational r_frame_rate
Real base framerate of the stream.
Definition avformat.h:900
int disposition
Stream disposition - a combination of AV_DISPOSITION_* flags.
Definition avformat.h:835
uint16_t format
Definition avcodec.h:2099
uint32_t start_display_time
Definition avcodec.h:2100
uint32_t end_display_time
Definition avcodec.h:2101
unsigned num_rects
Definition avcodec.h:2102
int64_t pts
Same as packet pts, in AV_TIME_BASE.
Definition avcodec.h:2104
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:335
int show_all_entries
Definition ffprobe.c:334
int64_t pkt_pos
Definition ffplay.c:150
int pkt_size
Definition ffprobe.c:77
InputStream ** streams
Definition ffmpeg.h:527
AVFormatContext * fmt_ctx
Definition ffprobe.c:87
int nb_streams
Definition ffmpeg.h:528
AVCodecContext * dec_ctx
Definition ffprobe.c:83
AVStream * st
Definition ffmpeg.h:473
char * context_name
Definition ffprobe.c:362
AVClassCategory parent_category
Definition ffprobe.c:367
AVClassCategory category
Definition ffprobe.c:365
char * log_message
Definition ffprobe.c:364
char * parent_name
Definition ffprobe.c:366
int log_level
Definition ffprobe.c:363
Definition cms.c:66
int64_t end
start, end in second/AV_TIME_BASE units
Definition ffprobe.c:152
int duration_frames
Definition ffprobe.c:155
int64_t start
Definition ffprobe.c:152
int has_start
Definition ffprobe.c:153
int end_is_offset
Definition ffprobe.c:154
int id
identifier
Definition ffprobe.c:151
int start_is_offset
Definition ffprobe.c:154
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
#define height
Definition dsp.h:89
#define width
Definition dsp.h:89
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
#define va_copy(dst, src)
Definition va_copy.h:31
color_range
static enum AVPixelFormat pixel_formats[]
Definition vf_sr.c:64
static double c[64]